#! /bin/sh
# Generated from tests/testsuite.at by GNU Autoconf 2.69.
#
# Copyright (C) 2009-2012 Free Software Foundation, Inc.
#
# This test suite is free software; the Free Software Foundation gives
# unlimited permission to copy, distribute and modify it.
#
# Copyright (c) 2009, 2010, 2011, 2012, 2013, 2014, 2015 Nicira, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
## -------------------- ##
## M4sh Initialization. ##
## -------------------- ##

# Be more Bourne compatible
DUALCASE=1; export DUALCASE # for MKS sh
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
  emulate sh
  NULLCMD=:
  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
  # is contrary to our usage.  Disable this feature.
  alias -g '${1+"$@"}'='"$@"'
  setopt NO_GLOB_SUBST
else
  case `(set -o) 2>/dev/null` in #(
  *posix*) :
    set -o posix ;; #(
  *) :
     ;;
esac
fi


as_nl='
'
export as_nl
# Printing a long string crashes Solaris 7 /usr/bin/printf.
as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
# Prefer a ksh shell builtin over an external printf program on Solaris,
# but without wasting forks for bash or zsh.
if test -z "$BASH_VERSION$ZSH_VERSION" \
    && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
  as_echo='print -r --'
  as_echo_n='print -rn --'
elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
  as_echo='printf %s\n'
  as_echo_n='printf %s'
else
  if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
    as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
    as_echo_n='/usr/ucb/echo -n'
  else
    as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
    as_echo_n_body='eval
      arg=$1;
      case $arg in #(
      *"$as_nl"*)
	expr "X$arg" : "X\\(.*\\)$as_nl";
	arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
      esac;
      expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
    '
    export as_echo_n_body
    as_echo_n='sh -c $as_echo_n_body as_echo'
  fi
  export as_echo_body
  as_echo='sh -c $as_echo_body as_echo'
fi

# The user is always right.
if test "${PATH_SEPARATOR+set}" != set; then
  PATH_SEPARATOR=:
  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
    (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
      PATH_SEPARATOR=';'
  }
fi


# IFS
# We need space, tab and new line, in precisely that order.  Quoting is
# there to prevent editors from complaining about space-tab.
# (If _AS_PATH_WALK were called with IFS unset, it would disable word
# splitting by setting IFS to empty value.)
IFS=" ""	$as_nl"

# Find who we are.  Look in the path if we contain no directory separator.
as_myself=
case $0 in #((
  *[\\/]* ) as_myself=$0 ;;
  *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
  IFS=$as_save_IFS
  test -z "$as_dir" && as_dir=.
    test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
  done
IFS=$as_save_IFS

     ;;
esac
# We did not find ourselves, most probably we were run as `sh COMMAND'
# in which case we are not to be found in the path.
if test "x$as_myself" = x; then
  as_myself=$0
fi
if test ! -f "$as_myself"; then
  $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
  exit 1
fi

# Unset variables that we do not need and which cause bugs (e.g. in
# pre-3.0 UWIN ksh).  But do not cause bugs in bash 2.01; the "|| exit 1"
# suppresses any "Segmentation fault" message there.  '((' could
# trigger a bug in pdksh 5.2.14.
for as_var in BASH_ENV ENV MAIL MAILPATH
do eval test x\${$as_var+set} = xset \
  && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
done
PS1='$ '
PS2='> '
PS4='+ '

# NLS nuisances.
LC_ALL=C
export LC_ALL
LANGUAGE=C
export LANGUAGE

# CDPATH.
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH

if test "x$CONFIG_SHELL" = x; then
  as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
  emulate sh
  NULLCMD=:
  # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which
  # is contrary to our usage.  Disable this feature.
  alias -g '\${1+\"\$@\"}'='\"\$@\"'
  setopt NO_GLOB_SUBST
else
  case \`(set -o) 2>/dev/null\` in #(
  *posix*) :
    set -o posix ;; #(
  *) :
     ;;
esac
fi
"
  as_required="as_fn_return () { (exit \$1); }
as_fn_success () { as_fn_return 0; }
as_fn_failure () { as_fn_return 1; }
as_fn_ret_success () { return 0; }
as_fn_ret_failure () { return 1; }

exitcode=0
as_fn_success || { exitcode=1; echo as_fn_success failed.; }
as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :

else
  exitcode=1; echo positional parameters were not saved.
fi
test x\$exitcode = x0 || exit 1
test -x / || exit 1"
  as_suggested="  as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
  as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
  eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
  test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
test \$(( 1 + 1 )) = 2 || exit 1"
  if (eval "$as_required") 2>/dev/null; then :
  as_have_required=yes
else
  as_have_required=no
fi
  if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :

else
  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
as_found=false
for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
do
  IFS=$as_save_IFS
  test -z "$as_dir" && as_dir=.
  as_found=:
  case $as_dir in #(
	 /*)
	   for as_base in sh bash ksh sh5; do
	     # Try only shells that exist, to save several forks.
	     as_shell=$as_dir/$as_base
	     if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
		    { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :
  CONFIG_SHELL=$as_shell as_have_required=yes
		   if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then :
  break 2
fi
fi
	   done;;
       esac
  as_found=false
done
$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
	      { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :
  CONFIG_SHELL=$SHELL as_have_required=yes
fi; }
IFS=$as_save_IFS


      if test "x$CONFIG_SHELL" != x; then :
  export CONFIG_SHELL
             # We cannot yet assume a decent shell, so we have to provide a
# neutralization value for shells without unset; and this also
# works around shells that cannot unset nonexistent variables.
# Preserve -v and -x to the replacement shell.
BASH_ENV=/dev/null
ENV=/dev/null
(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
case $- in # ((((
  *v*x* | *x*v* ) as_opts=-vx ;;
  *v* ) as_opts=-v ;;
  *x* ) as_opts=-x ;;
  * ) as_opts= ;;
esac
exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
# Admittedly, this is quite paranoid, since all the known shells bail
# out after a failed `exec'.
$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
exit 255
fi

    if test x$as_have_required = xno; then :
  $as_echo "$0: This script requires a shell more modern than all"
  $as_echo "$0: the shells that I found on your system."
  if test x${ZSH_VERSION+set} = xset ; then
    $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
    $as_echo "$0: be upgraded to zsh 4.3.4 or later."
  else
    $as_echo "$0: Please tell bug-autoconf@gnu.org about your system,
$0: including any error possibly output before this
$0: message. Then install a modern shell, or manually run
$0: the script under such a shell if you do have one."
  fi
  exit 1
fi
fi
fi
SHELL=${CONFIG_SHELL-/bin/sh}
export SHELL
# Unset more variables known to interfere with behavior of common tools.
CLICOLOR_FORCE= GREP_OPTIONS=
unset CLICOLOR_FORCE GREP_OPTIONS

## --------------------- ##
## M4sh Shell Functions. ##
## --------------------- ##
# as_fn_unset VAR
# ---------------
# Portably unset VAR.
as_fn_unset ()
{
  { eval $1=; unset $1;}
}
as_unset=as_fn_unset

# as_fn_set_status STATUS
# -----------------------
# Set $? to STATUS, without forking.
as_fn_set_status ()
{
  return $1
} # as_fn_set_status

# as_fn_exit STATUS
# -----------------
# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
as_fn_exit ()
{
  set +e
  as_fn_set_status $1
  exit $1
} # as_fn_exit

# as_fn_mkdir_p
# -------------
# Create "$as_dir" as a directory, including parents if necessary.
as_fn_mkdir_p ()
{

  case $as_dir in #(
  -*) as_dir=./$as_dir;;
  esac
  test -d "$as_dir" || eval $as_mkdir_p || {
    as_dirs=
    while :; do
      case $as_dir in #(
      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
      *) as_qdir=$as_dir;;
      esac
      as_dirs="'$as_qdir' $as_dirs"
      as_dir=`$as_dirname -- "$as_dir" ||
$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
	 X"$as_dir" : 'X\(//\)[^/]' \| \
	 X"$as_dir" : 'X\(//\)$' \| \
	 X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
$as_echo X"$as_dir" |
    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
	    s//\1/
	    q
	  }
	  /^X\(\/\/\)[^/].*/{
	    s//\1/
	    q
	  }
	  /^X\(\/\/\)$/{
	    s//\1/
	    q
	  }
	  /^X\(\/\).*/{
	    s//\1/
	    q
	  }
	  s/.*/./; q'`
      test -d "$as_dir" && break
    done
    test -z "$as_dirs" || eval "mkdir $as_dirs"
  } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"


} # as_fn_mkdir_p

# as_fn_executable_p FILE
# -----------------------
# Test if FILE is an executable regular file.
as_fn_executable_p ()
{
  test -f "$1" && test -x "$1"
} # as_fn_executable_p
# as_fn_append VAR VALUE
# ----------------------
# Append the text in VALUE to the end of the definition contained in VAR. Take
# advantage of any shell optimizations that allow amortized linear growth over
# repeated appends, instead of the typical quadratic growth present in naive
# implementations.
if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
  eval 'as_fn_append ()
  {
    eval $1+=\$2
  }'
else
  as_fn_append ()
  {
    eval $1=\$$1\$2
  }
fi # as_fn_append

# as_fn_arith ARG...
# ------------------
# Perform arithmetic evaluation on the ARGs, and store the result in the
# global $as_val. Take advantage of shells that can avoid forks. The arguments
# must be portable across $(()) and expr.
if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
  eval 'as_fn_arith ()
  {
    as_val=$(( $* ))
  }'
else
  as_fn_arith ()
  {
    as_val=`expr "$@" || test $? -eq 1`
  }
fi # as_fn_arith


# as_fn_error STATUS ERROR [LINENO LOG_FD]
# ----------------------------------------
# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
# script with STATUS, using 1 if that was 0.
as_fn_error ()
{
  as_status=$1; test $as_status -eq 0 && as_status=1
  if test "$4"; then
    as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
    $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
  fi
  $as_echo "$as_me: error: $2" >&2
  as_fn_exit $as_status
} # as_fn_error

if expr a : '\(a\)' >/dev/null 2>&1 &&
   test "X`expr 00001 : '.*\(...\)'`" = X001; then
  as_expr=expr
else
  as_expr=false
fi

if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
  as_basename=basename
else
  as_basename=false
fi

as_me=`$as_basename -- "$0" ||
$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
	 X"$0" : 'X\(//\)$' \| \
	 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
$as_echo X/"$0" |
    sed '/^.*\/\([^/][^/]*\)\/*$/{
	    s//\1/
	    q
	  }
	  /^X\/\(\/\/\)$/{
	    s//\1/
	    q
	  }
	  /^X\/\(\/\).*/{
	    s//\1/
	    q
	  }
	  s/.*/./; q'`

if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
  as_dirname=dirname
else
  as_dirname=false
fi

# Avoid depending upon Character Ranges.
as_cr_letters='abcdefghijklmnopqrstuvwxyz'
as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
as_cr_Letters=$as_cr_letters$as_cr_LETTERS
as_cr_digits='0123456789'
as_cr_alnum=$as_cr_Letters$as_cr_digits


  as_lineno_1=$LINENO as_lineno_1a=$LINENO
  as_lineno_2=$LINENO as_lineno_2a=$LINENO
  eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
  test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
  # Blame Lee E. McMahon (1931-1989) for sed's syntax.  :-)
  sed -n '
    p
    /[$]LINENO/=
  ' <$as_myself |
    sed '
      s/[$]LINENO.*/&-/
      t lineno
      b
      :lineno
      N
      :loop
      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
      t loop
      s/-\n.*//
    ' >$as_me.lineno &&
  chmod +x "$as_me.lineno" ||
    { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }

  # If we had to re-execute with $CONFIG_SHELL, we're ensured to have
  # already done that, so ensure we don't try to do so again and fall
  # in an infinite loop.  This has already happened in practice.
  _as_can_reexec=no; export _as_can_reexec
  # Don't try to exec as it changes $[0], causing all sort of problems
  # (the dirname of $[0] is not the place where we might find the
  # original and so on.  Autoconf is especially sensitive to this).
  . "./$as_me.lineno"
  # Exit status is that of the last command.
  exit
}

ECHO_C= ECHO_N= ECHO_T=
case `echo -n x` in #(((((
-n*)
  case `echo 'xy\c'` in
  *c*) ECHO_T='	';;	# ECHO_T is single tab character.
  xy)  ECHO_C='\c';;
  *)   echo `echo ksh88 bug on AIX 6.1` > /dev/null
       ECHO_T='	';;
  esac;;
*)
  ECHO_N='-n';;
esac

rm -f conf$$ conf$$.exe conf$$.file
if test -d conf$$.dir; then
  rm -f conf$$.dir/conf$$.file
else
  rm -f conf$$.dir
  mkdir conf$$.dir 2>/dev/null
fi
if (echo >conf$$.file) 2>/dev/null; then
  if ln -s conf$$.file conf$$ 2>/dev/null; then
    as_ln_s='ln -s'
    # ... but there are two gotchas:
    # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
    # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
    # In both cases, we have to default to `cp -pR'.
    ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
      as_ln_s='cp -pR'
  elif ln conf$$.file conf$$ 2>/dev/null; then
    as_ln_s=ln
  else
    as_ln_s='cp -pR'
  fi
else
  as_ln_s='cp -pR'
fi
rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
rmdir conf$$.dir 2>/dev/null

if mkdir -p . 2>/dev/null; then
  as_mkdir_p='mkdir -p "$as_dir"'
else
  test -d ./-p && rmdir ./-p
  as_mkdir_p=false
fi

as_test_x='test -x'
as_executable_p=as_fn_executable_p

# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"

# Sed expression to map a string onto a valid variable name.
as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"





SHELL=${CONFIG_SHELL-/bin/sh}

# How were we run?
at_cli_args="$@"


# Not all shells have the 'times' builtin; the subshell is needed to make
# sure we discard the 'times: not found' message from the shell.
at_times_p=false
(times) >/dev/null 2>&1 && at_times_p=:

# CLI Arguments to pass to the debugging scripts.
at_debug_args=
# -e sets to true
at_errexit_p=false
# Shall we be verbose?  ':' means no, empty means yes.
at_verbose=:
at_quiet=
# Running several jobs in parallel, 0 means as many as test groups.
at_jobs=1
at_traceon=:
at_trace_echo=:
at_check_filter_trace=:

# Shall we keep the debug scripts?  Must be `:' when the suite is
# run by a debug script, so that the script doesn't remove itself.
at_debug_p=false
# Display help message?
at_help_p=false
# Display the version message?
at_version_p=false
# List test groups?
at_list_p=false
# --clean
at_clean=false
# Test groups to run
at_groups=
# Whether to rerun failed tests.
at_recheck=
# Whether a write failure occurred
at_write_fail=0

# The directory we run the suite in.  Default to . if no -C option.
at_dir=`pwd`
# An absolute reference to this testsuite script.
case $as_myself in
  [\\/]* | ?:[\\/]* ) at_myself=$as_myself ;;
  * ) at_myself=$at_dir/$as_myself ;;
esac
# Whether -C is in effect.
at_change_dir=false

# Whether to enable colored test results.
at_color=auto
# List of the tested programs.
at_tested='ovs-vswitchd
ovs-vsctl'
# As many question marks as there are digits in the last test group number.
# Used to normalize the test group numbers so that `ls' lists them in
# numerical order.
at_format='???'
# Description of all the test groups.
at_help_all="1;ovn.at:50;ovn -- lexer;;
2;ovn.at:154;ovn -- registers;;
3;ovn.at:177;ovn -- conntrack fields;;
4;ovn.at:194;ovn -- composition;;
5;ovn.at:198;ovn -- expression parser;;
6;ovn.at:382;ovn -- expression annotation;;
7;ovn.at:424;ovn -- 1-term expression conversion;;
8;ovn.at:430;ovn -- 2-term expression conversion;;
9;ovn.at:436;ovn -- 3-term expression conversion;;
10;ovn.at:442;ovn -- 3-term numeric expression simplification;;
11;ovn.at:448;ovn -- 4-term string expression simplification;;
12;ovn.at:454;ovn -- 3-term mixed expression simplification;;
13;ovn.at:460;ovn -- simplification special cases;;
14;ovn.at:482;ovn -- is_chassis_resident simplification;;
15;ovn.at:496;ovn -- 4-term numeric expression normalization;;
16;ovn.at:502;ovn -- 4-term string expression normalization;;
17;ovn.at:508;ovn -- 4-term mixed expression normalization;;
18;ovn.at:514;ovn -- 5-term numeric expression normalization;;
19;ovn.at:520;ovn -- 5-term string expression normalization;;
20;ovn.at:526;ovn -- 5-term mixed expression normalization;;
21;ovn.at:532;ovn -- 4-term numeric expressions to flows;expression;
22;ovn.at:539;ovn -- 4-term string expressions to flows;expression;
23;ovn.at:546;ovn -- 4-term mixed expressions to flows;expression;
24;ovn.at:553;ovn -- 3-term numeric expressions to flows;expression;
25;ovn.at:560;ovn -- converting expressions to flows -- string fields;expression;
26;ovn.at:597;ovn -- converting expressions to flows -- address sets;expression;
27;ovn.at:686;ovn -- converting expressions to flows -- port groups;expression;
28;ovn.at:704;ovn -- converting expressions to flows -- conjunction;conjunction;
29;ovn.at:805;ovn -- action parsing;;
30;ovn.at:1548;ovn -- 3 HVs, 1 LS, 3 lports/HV;ovnarp;
31;ovn.at:1842;ovn -- 2 HVs, 1 LS, 2 lports/HV;ovnarp;
32;ovn.at:2019;ovn -- trace 1 LS, 3 LSPs;;
33;ovn.at:2241;ovn -- 2 HVs, 4 lports/HV, localnet ports;;
34;ovn.at:2433;ovn -- vtep: 3 HVs, 1 VIFs/HV, 1 GW, 1 LS;vtep;
35;ovn.at:2635;ovn -- 3 HVs, 1 VIFs/HV, 1 software GW, 1 LS;;
36;ovn.at:2783;ovn -- 3 HVs, 3 LS, 3 lports/LS, 1 LR;;
37;ovn.at:3195;ovn -- IP relocation using GARP request;;
38;ovn.at:3397;ovn -- portsecurity : 3 HVs, 1 LS, 3 lports/HV;;
39;ovn.at:3773;ovn -- 2 HVs, 2 LS, 1 lport/LS, 2 peer LRs;;
40;ovn.at:3918;ovn -- 1 HV, 1 LS, 2 lport/LS, 1 LR;router-admin-state;
41;ovn.at:4029;ovn -- 1 HV, 2 LSs, 1 lport/LS, 1 LR;router-admin-state;
42;ovn.at:4144;ovn -- 2 HVs, 3 LS, 1 lport/LS, 2 peer LRs, static routes;;
43;ovn.at:4296;ovn -- send gratuitous arp on localnet;;
44;ovn.at:4349;ovn -- 2 HVs, 3 LRs connected via LS, static routes;;
45;ovn.at:4525;ovn -- dhcpv4 : 1 HV, 2 LS, 2 LSPs/LS;;
46;ovn.at:4957;ovn -- dhcpv6 : 1 HV, 2 LS, 5 LSPs;;
47;ovn.at:5228;ovn -- 2 HVs, 2 LRs connected via LS, gateway router;;
48;ovn.at:5403;ovn -- icmp_reply: 1 HVs, 2 LSs, 1 lport/LS, 1 LR;router-icmp-reply;
49;ovn.at:5548;ovn -- policy-based routing: 1 HVs, 2 LSs, 1 lport/LS, 1 LR;policy-based-routing;
50;ovn.at:5733;ovn -- policy-based routing IPv6: 1 HVs, 3 LSs, 1 lport/LS, 1 LR;policy-based-routing;
51;ovn.at:5921;ovn -- port state up and down;;
52;ovn.at:5946;ovn -- datapath rules added/removed;cleanup;
53;ovn.at:6010;ovn -- nd_na ;;
54;ovn.at:6081;ovn -- address sets modification/removal smoke test;;
55;ovn.at:6108;ovn -- ipam;;
56;ovn.at:6519;ovn -- ipam connectivity;;
57;ovn.at:6647;ovn -- ovs-vswitchd restart;vswitchd;
58;ovn.at:6741;ovn -- send arp for nexthop;;
59;ovn.at:6850;ovn -- send gratuitous arp for nat ips in localnet;;
60;ovn.at:6901;ovn -- send gratuitous arp with nat-addresses router in localnet;;
61;ovn.at:6967;ovn -- delete mac bindings;;
62;ovn.at:6998;ovn -- conntrack zone allocation;;
63;ovn.at:7051;ovn -- tag allocation;;
64;ovn.at:7166;ovn -- lsp deletion and broadcast-flow deletion on localnet;;
65;ovn.at:7236;ovn -- ACL logging;ovn;
66;ovn.at:7342;ovn -- ACL rate-limited logging;ovn;
67;ovn.at:7427;ovn -- same meter used by multiple logical flows;ovn;
68;ovn.at:7482;ovn -- DSCP marking and meter check;ovn;
69;ovn.at:7609;ovn -- read-only sb db:ptcp access;;
70;ovn.at:7644;ovn -- read-only sb db:pssl access;;
71;ovn.at:7700;ovn -- nb connection/ssl commands;;
72;ovn.at:7751;ovn -- sb connection/ssl commands;;
73;ovn.at:7802;ovn -- nested containers;;
74;ovn.at:8007;ovn -- 3 HVs, 3 LRs connected via LS, source IP based routes;;
75;ovn.at:8207;ovn -- dns lookup : 1 HV, 2 LS, 2 LSPs/LS;;
76;ovn.at:8620;ovn -- 4 HV, 1 LS, 1 LR, packet test with HA distributed router gateway port;;
77;ovn.at:8846;ovn -- 4 HV, 3 LS, 2 LR, packet test with HA distributed router gateway port;;
78;ovn.at:9064;ovn -- 1 LR with distributed router gateway port;;
79;ovn.at:9391;ovn -- send gratuitous arp for NAT rules on distributed router;;
80;ovn.at:9546;ovn -- vlan traffic for external network with distributed router gateway port;;
81;ovn.at:9863;ovn -- IPv6 ND Router Solicitation responder;ovn-nd_ra;
82;ovn.at:10111;ovn -- /32 router IP address;;
83;ovn.at:10208;ovn -- 2 HVs, 1 lport/HV, localport ports;;
84;ovn.at:10329;ovn -- 1 LR with HA distributed router gateway port;;
85;ovn.at:10883;ovn -- send gratuitous ARP for NAT rules on HA distributed router;;
86;ovn.at:11053;ovn -- ensure one gw controller restart in HA doesn't bounce the master;;
87;ovn.at:11148;ovn -- IPv6 Neighbor Solicitation for unknown MAC;ovn-nd_ns for unknown mac;
88;ovn.at:11322;ovn -- options:requested-chassis for logical port;;
89;ovn.at:11401;ovn -- options:requested-chassis with hostname;;
90;ovn.at:11439;ovn -- IPv6 periodic RA;;
91;ovn.at:11627;ovn -- ACL reject rule test;acl-reject;
92;ovn.at:11768;ovn -- Port Groups;ovnpg;
93;ovn.at:11993;ovn -- ACLs on Port Groups;ovnpg_acl;
94;ovn.at:12245;ovn -- Address Set generation from Port Groups (static addressing);;
95;ovn.at:12295;ovn -- Address Set generation from Port Groups (dynamic addressing);;
96;ovn.at:12356;ovn -- ACL conjunction;;
97;ovn.at:12481;ovn -- L2 Drop and Allow ACL w/ Stateful ACL;;
98;ovn.at:12685;ovn -- TTL exceeded;ttl-exceeded;
99;ovn.at:12781;ovn -- router port unreachable;router-port-unreachable;
100;ovn.at:12930;ovn -- ovn-controller exit;;
101;ovn.at:13020;ovn -- external logical port;;
102;ovn.at:13754;ovn -- Address Set Incremental Processing;ovn_as_inc;
103;ovn.at:13832;ovn -- ovn-controller restart;;
104;ovn.at:13927;ovn -- ovn-nbctl duplicate addresses;;
105;ovn.at:13983;ovn -- router - check packet length - icmp defrag;check packet length;
106;ovn.at:14157;ovn -- IP packet buffering;ip-buffering;
107;ovn.at:14302;ovn -- neighbor update on same HV;;
108;ovn.at:14401;ovn -- ipam to non-ipam;;
109;ovn.at:14421;ovn -- ipam router ports;;
110;ovn.at:14442;ovn -- test transport zones;;
111;ovn.at:14605;ovn -- 2 HVs, 2 lports/HV, localnet ports, DVR chassis mac;;
112;ovn.at:14810;ovn -- virtual ports;virtual ports;
113;ovn.at:15108;ovn -- can't write to a backup database server instance;;
114;ovn.at:15127;ovn -- controller event;ovn_controller_event;
115;ovn.at:15235;ovn -- IGMP snoop/querier/relay;;
116;ovn.at:15819;ovn -- MLD snoop/querier/relay;;
117;ovn.at:16434;ovn -- unixctl socket;;
118;ovn.at:16454;ovn -- 2 HVs, 2 lports/HV, localnet ports, DVR N-S ARP handling;;
119;ovn.at:16757;ovn -- 2 HVs, 2 lports/HV, localnet ports, DVR N-S Ping;;
120;ovn.at:17061;ovn -- ARP lookup before learning;virtual ports;
121;ovn.at:17282;ovn -- 1 HVs, 1 lport/HV, localnet ports, RARP;;
122;ovn.at:17348;ovn -- Stateless Floating IP;;
123;ovn.at:17658;ovn -- Load balancer health checks;lb;
124;ovn.at:17805;ovn -- ARP/ND request broadcast limiting;;
125;ovn.at:18083;ovn -- trace when flow cookie updated;cookie;
126;ovn.at:18118;ovn -- interconnection;;
127;ovn.at:18264;ovn -- ECMP static routes;;
128;ovn.at:18364;ovn -- forwarding group: 3 HVs, 1 LR, 2 LS;forwarding-group;
129;ovn.at:18488;ovn -- Load Balancer LS hairpin;;
130;ovn-performance.at:227;ovn -- ovn-controller incremental processing;;
131;ovn-northd.at:2;ovn -- check   from NBDB to SBDB;;
132;ovn-northd.at:152;ovn -- check Gateway_Chassis propagation from NBDB to SBDB backwards compatibility;;
133;ovn-northd.at:200;ovn -- check up state of VIF LSP;;
134;ovn-northd.at:213;ovn -- check up state of router LSP linked to a distributed LR;;
135;ovn-northd.at:228;ovn -- check up state of router LSP linked to a gateway LR;;
136;ovn-northd.at:247;ovn -- check up state of router LSP linked to an LRP with set Gateway Chassis;;
137;ovn-northd.at:265;ovn -- check IPv6 RA config propagation to SBDB;;
138;ovn-northd.at:375;ovn -- test unixctl;;
139;ovn-northd.at:414;ovn -- check HA_Chassis_Group propagation from NBDB to SBDB;;
140;ovn-northd.at:895;ovn -- ovn-northd pause and resume;;
141;ovn-northd.at:954;ovn -- check Redirect Chassis propagation from NB to SB;;
142;ovn-northd.at:983;ovn -- check stateless dnat_and_snat rule;;
143;ovn-northd.at:1077;ovn -- check Load balancer health check and Service Monitor sync;;
144;ovn-nbctl.at:56;ovn-nbctl - basic switch commands - direct;ovn;
145;ovn-nbctl.at:56;ovn-nbctl - basic switch commands - daemon;ovn;
146;ovn-nbctl.at:109;ovn-nbctl - basic logical switch port commands - direct;ovn;
147;ovn-nbctl.at:109;ovn-nbctl - basic logical switch port commands - daemon;ovn;
148;ovn-nbctl.at:156;ovn-nbctl - lsp get ls - direct;ovn;
149;ovn-nbctl.at:156;ovn-nbctl - lsp get ls - daemon;ovn;
150;ovn-nbctl.at:170;ovn-nbctl - lport addresses - direct;ovn;
151;ovn-nbctl.at:170;ovn-nbctl - lport addresses - daemon;ovn;
152;ovn-nbctl.at:188;ovn-nbctl - port security - direct;ovn;
153;ovn-nbctl.at:188;ovn-nbctl - port security - daemon;ovn;
154;ovn-nbctl.at:206;ovn-nbctl - ACLs - direct;ovn;
155;ovn-nbctl.at:206;ovn-nbctl - ACLs - daemon;ovn;
156;ovn-nbctl.at:273;ovn-nbctl - QoS - direct;ovn;
157;ovn-nbctl.at:273;ovn-nbctl - QoS - daemon;ovn;
158;ovn-nbctl.at:342;ovn-nbctl - meters - direct;ovn;
159;ovn-nbctl.at:342;ovn-nbctl - meters - daemon;ovn;
160;ovn-nbctl.at:404;ovn-nbctl - NATs - direct;ovn;
161;ovn-nbctl.at:404;ovn-nbctl - NATs - daemon;ovn;
162;ovn-nbctl.at:613;ovn-nbctl - LBs - direct;ovn;
163;ovn-nbctl.at:613;ovn-nbctl - LBs - daemon;ovn;
164;ovn-nbctl.at:841;ovn-nbctl - LBs IPv6 - direct;ovn;
165;ovn-nbctl.at:841;ovn-nbctl - LBs IPv6 - daemon;ovn;
166;ovn-nbctl.at:1100;ovn-nbctl - basic logical router commands - direct;ovn;
167;ovn-nbctl.at:1100;ovn-nbctl - basic logical router commands - daemon;ovn;
168;ovn-nbctl.at:1153;ovn-nbctl - basic logical router port commands - direct;ovn;
169;ovn-nbctl.at:1153;ovn-nbctl - basic logical router port commands - daemon;ovn;
170;ovn-nbctl.at:1223;ovn-nbctl - logical router port gateway chassis - direct;ovn;
171;ovn-nbctl.at:1223;ovn-nbctl - logical router port gateway chassis - daemon;ovn;
172;ovn-nbctl.at:1283;ovn-nbctl - logical router port redirect type - direct;ovn;
173;ovn-nbctl.at:1283;ovn-nbctl - logical router port redirect type - daemon;ovn;
174;ovn-nbctl.at:1308;ovn-nbctl - logical router port enable and disable - direct;ovn;
175;ovn-nbctl.at:1308;ovn-nbctl - logical router port enable and disable - daemon;ovn;
176;ovn-nbctl.at:1328;ovn-nbctl - routes - direct;ovn;
177;ovn-nbctl.at:1328;ovn-nbctl - routes - daemon;ovn;
178;ovn-nbctl.at:1509;ovn-nbctl - policies - direct;ovn;
179;ovn-nbctl.at:1509;ovn-nbctl - policies - daemon;ovn;
180;ovn-nbctl.at:1566;ovn-nbctl - lsp types - direct;ovn;
181;ovn-nbctl.at:1566;ovn-nbctl - lsp types - daemon;ovn;
182;ovn-nbctl.at:1634;ovn-nbctl - connection - direct;ovn;
183;ovn-nbctl.at:1634;ovn-nbctl - connection - daemon;ovn;
184;ovn-nbctl.at:1643;ovn-nbctl - dry run mode - direct;ovn;
185;ovn-nbctl.at:1643;ovn-nbctl - dry run mode - daemon;ovn;
186;ovn-nbctl.at:1659;ovn-nbctl - oneline output - direct;ovn;
187;ovn-nbctl.at:1659;ovn-nbctl - oneline output - daemon;ovn;
188;ovn-nbctl.at:1675;ovn-nbctl - commands parser error paths - direct;ovn;
189;ovn-nbctl.at:1675;ovn-nbctl - commands parser error paths - daemon;ovn;
190;ovn-nbctl.at:1746;ovn-nbctl - port groups - direct;ovn;
191;ovn-nbctl.at:1746;ovn-nbctl - port groups - daemon;ovn;
192;ovn-nbctl.at:1753;ovn-nbctl - extra newlines - direct;ovn;
193;ovn-nbctl.at:1753;ovn-nbctl - extra newlines - daemon;ovn;
194;ovn-nbctl.at:1765;ovn-nbctl - table formatting - direct;ovn;
195;ovn-nbctl.at:1765;ovn-nbctl - table formatting - daemon;ovn;
196;ovn-nbctl.at:1775;ovn-nbctl - port group commands - direct;ovn;
197;ovn-nbctl.at:1775;ovn-nbctl - port group commands - daemon;ovn;
198;ovn-nbctl.at:1808;ovn-nbctl - fwd groups - direct;ovn;
199;ovn-nbctl.at:1808;ovn-nbctl - fwd groups - daemon;ovn;
200;ovn-nbctl.at:1844;ovn-nbctl - daemon retry connection;ovn;
201;ovn-sbctl.at:37;ovn-sbctl - chassis commands;ovn;
202;ovn-sbctl.at:71;ovn-sbctl;ovn;
203;ovn-sbctl.at:140;ovn-sbctl - connection;ovn;
204;ovn-ic-nbctl.at:25;ovn-ic-nbctl;ic_nbctl;
205;ovn-ic-sbctl.at:25;ovn-ic-sbctl;ic_sbctl;
206;ovn-controller.at:3;ovn-controller - ovn-bridge-mappings;ovn;
207;ovn-controller.at:122;ovn-controller - Chassis external_ids;ovn;
208;ovn-controller.at:209;ovn-controller - change Encap properties;ovn;
209;ovn-controller.at:263;ovn-controller - check sbdb connection;ovn;
210;ovn-controller.at:297;ovn-controller - Chassis self record;ovn;
211;ovn-controller-vtep.at:109;ovn-controller-vtep - chassis;ovn;
212;ovn-controller-vtep.at:177;ovn-controller-vtep - binding 1;ovn;
213;ovn-controller-vtep.at:242;ovn-controller-vtep - binding 2;ovn;
214;ovn-controller-vtep.at:281;ovn-controller-vtep - vtep-lswitch;ovn;
215;ovn-controller-vtep.at:333;ovn-controller-vtep - vtep-macs 1;ovn;
216;ovn-controller-vtep.at:405;ovn-controller-vtep - vtep-macs 2;ovn;
217;ovn-ic.at:2;ovn-ic -- AZ register;;
218;ovn-ic.at:30;ovn-ic -- transit switch handling;;
219;ovn-ic.at:70;ovn-ic -- gateway sync;;
220;ovn-ic.at:126;ovn-ic -- port sync;;
221;ovn-ic.at:190;ovn-ic -- route sync;;
222;checkpatch.at:37;checkpatch - sign-offs;;
223;checkpatch.at:177;checkpatch - parenthesized constructs;;
224;checkpatch.at:238;checkpatch - parenthesized constructs - for;;
225;checkpatch.at:293;checkpatch - comments;;
226;checkpatch.at:315;checkpatch - whitespace around operator;;
"
# List of the all the test groups.
at_groups_all=`$as_echo "$at_help_all" | sed 's/;.*//'`

# at_fn_validate_ranges NAME...
# -----------------------------
# Validate and normalize the test group number contained in each variable
# NAME. Leading zeroes are treated as decimal.
at_fn_validate_ranges ()
{
  for at_grp
  do
    eval at_value=\$$at_grp
    if test $at_value -lt 1 || test $at_value -gt 226; then
      $as_echo "invalid test group: $at_value" >&2
      exit 1
    fi
    case $at_value in
      0*) # We want to treat leading 0 as decimal, like expr and test, but
	  # AS_VAR_ARITH treats it as octal if it uses $(( )).
	  # With XSI shells, ${at_value#${at_value%%[1-9]*}} avoids the
	  # expr fork, but it is not worth the effort to determine if the
	  # shell supports XSI when the user can just avoid leading 0.
	  eval $at_grp='`expr $at_value + 0`' ;;
    esac
  done
}

at_prev=
for at_option
do
  # If the previous option needs an argument, assign it.
  if test -n "$at_prev"; then
    at_option=$at_prev=$at_option
    at_prev=
  fi

  case $at_option in
  *=?*) at_optarg=`expr "X$at_option" : '[^=]*=\(.*\)'` ;;
  *)    at_optarg= ;;
  esac

  # Accept the important Cygnus configure options, so we can diagnose typos.

  case $at_option in
    --help | -h )
	at_help_p=:
	;;

    --list | -l )
	at_list_p=:
	;;

    --version | -V )
	at_version_p=:
	;;

    --clean | -c )
	at_clean=:
	;;

    --color )
	at_color=always
	;;
    --color=* )
	case $at_optarg in
	no | never | none) at_color=never ;;
	auto | tty | if-tty) at_color=auto ;;
	always | yes | force) at_color=always ;;
	*) at_optname=`echo " $at_option" | sed 's/^ //; s/=.*//'`
	   as_fn_error $? "unrecognized argument to $at_optname: $at_optarg" ;;
	esac
	;;

    --debug | -d )
	at_debug_p=:
	;;

    --errexit | -e )
	at_debug_p=:
	at_errexit_p=:
	;;

    --verbose | -v )
	at_verbose=; at_quiet=:
	;;

    --trace | -x )
	at_traceon='set -x'
	at_trace_echo=echo
	at_check_filter_trace=at_fn_filter_trace
	;;

    [0-9] | [0-9][0-9] | [0-9][0-9][0-9] | [0-9][0-9][0-9][0-9])
	at_fn_validate_ranges at_option
	as_fn_append at_groups "$at_option$as_nl"
	;;

    # Ranges
    [0-9]- | [0-9][0-9]- | [0-9][0-9][0-9]- | [0-9][0-9][0-9][0-9]-)
	at_range_start=`echo $at_option |tr -d X-`
	at_fn_validate_ranges at_range_start
	at_range=`$as_echo "$at_groups_all" | \
	  sed -ne '/^'$at_range_start'$/,$p'`
	as_fn_append at_groups "$at_range$as_nl"
	;;

    -[0-9] | -[0-9][0-9] | -[0-9][0-9][0-9] | -[0-9][0-9][0-9][0-9])
	at_range_end=`echo $at_option |tr -d X-`
	at_fn_validate_ranges at_range_end
	at_range=`$as_echo "$at_groups_all" | \
	  sed -ne '1,/^'$at_range_end'$/p'`
	as_fn_append at_groups "$at_range$as_nl"
	;;

    [0-9]-[0-9] | [0-9]-[0-9][0-9] | [0-9]-[0-9][0-9][0-9] | \
    [0-9]-[0-9][0-9][0-9][0-9] | [0-9][0-9]-[0-9][0-9] | \
    [0-9][0-9]-[0-9][0-9][0-9] | [0-9][0-9]-[0-9][0-9][0-9][0-9] | \
    [0-9][0-9][0-9]-[0-9][0-9][0-9] | \
    [0-9][0-9][0-9]-[0-9][0-9][0-9][0-9] | \
    [0-9][0-9][0-9][0-9]-[0-9][0-9][0-9][0-9] )
	at_range_start=`expr $at_option : '\(.*\)-'`
	at_range_end=`expr $at_option : '.*-\(.*\)'`
	if test $at_range_start -gt $at_range_end; then
	  at_tmp=$at_range_end
	  at_range_end=$at_range_start
	  at_range_start=$at_tmp
	fi
	at_fn_validate_ranges at_range_start at_range_end
	at_range=`$as_echo "$at_groups_all" | \
	  sed -ne '/^'$at_range_start'$/,/^'$at_range_end'$/p'`
	as_fn_append at_groups "$at_range$as_nl"
	;;

    # Directory selection.
    --directory | -C )
	at_prev=--directory
	;;
    --directory=* )
	at_change_dir=:
	at_dir=$at_optarg
	if test x- = "x$at_dir" ; then
	  at_dir=./-
	fi
	;;

    # Parallel execution.
    --jobs | -j )
	at_jobs=0
	;;
    --jobs=* | -j[0-9]* )
	if test -n "$at_optarg"; then
	  at_jobs=$at_optarg
	else
	  at_jobs=`expr X$at_option : 'X-j\(.*\)'`
	fi
	case $at_jobs in *[!0-9]*)
	  at_optname=`echo " $at_option" | sed 's/^ //; s/[0-9=].*//'`
	  as_fn_error $? "non-numeric argument to $at_optname: $at_jobs" ;;
	esac
	;;

    # Keywords.
    --keywords | -k )
	at_prev=--keywords
	;;
    --keywords=* )
	at_groups_selected=$at_help_all
	at_save_IFS=$IFS
	IFS=,
	set X $at_optarg
	shift
	IFS=$at_save_IFS
	for at_keyword
	do
	  at_invert=
	  case $at_keyword in
	  '!'*)
	    at_invert="-v"
	    at_keyword=`expr "X$at_keyword" : 'X!\(.*\)'`
	    ;;
	  esac
	  # It is on purpose that we match the test group titles too.
	  at_groups_selected=`$as_echo "$at_groups_selected" |
	      grep -i $at_invert "^[1-9][^;]*;.*[; ]$at_keyword[ ;]"`
	done
	# Smash the keywords.
	at_groups_selected=`$as_echo "$at_groups_selected" | sed 's/;.*//'`
	as_fn_append at_groups "$at_groups_selected$as_nl"
	;;
    --recheck)
	at_recheck=:
	;;

    *=*)
	at_envvar=`expr "x$at_option" : 'x\([^=]*\)='`
	# Reject names that are not valid shell variable names.
	case $at_envvar in
	  '' | [0-9]* | *[!_$as_cr_alnum]* )
	    as_fn_error $? "invalid variable name: \`$at_envvar'" ;;
	esac
	at_value=`$as_echo "$at_optarg" | sed "s/'/'\\\\\\\\''/g"`
	# Export now, but save eval for later and for debug scripts.
	export $at_envvar
	as_fn_append at_debug_args " $at_envvar='$at_value'"
	;;

     *) $as_echo "$as_me: invalid option: $at_option" >&2
	$as_echo "Try \`$0 --help' for more information." >&2
	exit 1
	;;
  esac
done

# Verify our last option didn't require an argument
if test -n "$at_prev"; then :
  as_fn_error $? "\`$at_prev' requires an argument"
fi

# The file containing the suite.
at_suite_log=$at_dir/$as_me.log

# Selected test groups.
if test -z "$at_groups$at_recheck"; then
  at_groups=$at_groups_all
else
  if test -n "$at_recheck" && test -r "$at_suite_log"; then
    at_oldfails=`sed -n '
      /^Failed tests:$/,/^Skipped tests:$/{
	s/^[ ]*\([1-9][0-9]*\):.*/\1/p
      }
      /^Unexpected passes:$/,/^## Detailed failed tests/{
	s/^[ ]*\([1-9][0-9]*\):.*/\1/p
      }
      /^## Detailed failed tests/q
      ' "$at_suite_log"`
    as_fn_append at_groups "$at_oldfails$as_nl"
  fi
  # Sort the tests, removing duplicates.
  at_groups=`$as_echo "$at_groups" | sort -nu | sed '/^$/d'`
fi

if test x"$at_color" = xalways \
   || { test x"$at_color" = xauto && test -t 1; }; then
  at_red=`printf '\033[0;31m'`
  at_grn=`printf '\033[0;32m'`
  at_lgn=`printf '\033[1;32m'`
  at_blu=`printf '\033[1;34m'`
  at_std=`printf '\033[m'`
else
  at_red= at_grn= at_lgn= at_blu= at_std=
fi

# Help message.
if $at_help_p; then
  cat <<_ATEOF || at_write_fail=1
Usage: $0 [OPTION]... [VARIABLE=VALUE]... [TESTS]

Run all the tests, or the selected TESTS, given by numeric ranges, and
save a detailed log file.  Upon failure, create debugging scripts.

Do not change environment variables directly.  Instead, set them via
command line arguments.  Set \`AUTOTEST_PATH' to select the executables
to exercise.  Each relative directory is expanded as build and source
directories relative to the top level of this distribution.
E.g., from within the build directory /tmp/foo-1.0, invoking this:

  $ $0 AUTOTEST_PATH=bin

is equivalent to the following, assuming the source directory is /src/foo-1.0:

  PATH=/tmp/foo-1.0/bin:/src/foo-1.0/bin:\$PATH $0
_ATEOF
cat <<_ATEOF || at_write_fail=1

Operation modes:
  -h, --help     print the help message, then exit
  -V, --version  print version number, then exit
  -c, --clean    remove all the files this test suite might create and exit
  -l, --list     describes all the tests, or the selected TESTS
_ATEOF
cat <<_ATEOF || at_write_fail=1

Execution tuning:
  -C, --directory=DIR
                 change to directory DIR before starting
      --color[=never|auto|always]
                 disable colored test results, or enable even without terminal
  -j, --jobs[=N]
                 Allow N jobs at once; infinite jobs with no arg (default 1)
  -k, --keywords=KEYWORDS
                 select the tests matching all the comma-separated KEYWORDS
                 multiple \`-k' accumulate; prefixed \`!' negates a KEYWORD
      --recheck  select all tests that failed or passed unexpectedly last time
  -e, --errexit  abort as soon as a test fails; implies --debug
  -v, --verbose  force more detailed output
                 default for debugging scripts
  -d, --debug    inhibit clean up and top-level logging
                 default for debugging scripts
  -x, --trace    enable tests shell tracing
_ATEOF
cat <<_ATEOF || at_write_fail=1

Report bugs to <bugs@openvswitch.org>.
_ATEOF
  exit $at_write_fail
fi

# List of tests.
if $at_list_p; then
  cat <<_ATEOF || at_write_fail=1
ovn 2.13.0 test suite test groups:

 NUM: FILE-NAME:LINE     TEST-GROUP-NAME
      KEYWORDS

_ATEOF
  # Pass an empty line as separator between selected groups and help.
  $as_echo "$at_groups$as_nl$as_nl$at_help_all" |
    awk 'NF == 1 && FS != ";" {
	   selected[$ 1] = 1
	   next
	 }
	 /^$/ { FS = ";" }
	 NF > 0 {
	   if (selected[$ 1]) {
	     printf " %3d: %-18s %s\n", $ 1, $ 2, $ 3
	     if ($ 4) {
	       lmax = 79
	       indent = "     "
	       line = indent
	       len = length (line)
	       n = split ($ 4, a, " ")
	       for (i = 1; i <= n; i++) {
		 l = length (a[i]) + 1
		 if (i > 1 && len + l > lmax) {
		   print line
		   line = indent " " a[i]
		   len = length (line)
		 } else {
		   line = line " " a[i]
		   len += l
		 }
	       }
	       if (n)
		 print line
	     }
	   }
	 }' || at_write_fail=1
  exit $at_write_fail
fi
if $at_version_p; then
  $as_echo "$as_me (ovn 2.13.0)" &&
  cat <<\_ATEOF || at_write_fail=1

Copyright (C) 2012 Free Software Foundation, Inc.
This test suite is free software; the Free Software Foundation gives
unlimited permission to copy, distribute and modify it.

Copyright (c) 2009, 2010, 2011, 2012, 2013, 2014, 2015 Nicira, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at:

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
_ATEOF
  exit $at_write_fail
fi

# Should we print banners?  Yes if more than one test is run.
case $at_groups in #(
  *$as_nl* )
      at_print_banners=: ;; #(
  * ) at_print_banners=false ;;
esac
# Text for banner N, set to a single space once printed.
# Banner 1. ovn.at:48
# Category starts at test group 1.
at_banner_text_1="OVN components"
# Banner 2. ovn.at:1545
# Category starts at test group 30.
at_banner_text_2="OVN end-to-end tests"
# Banner 3. ovn-northd.at:1
# Category starts at test group 131.
at_banner_text_3="OVN northd"
# Banner 4. ovn-nbctl.at:1
# Category starts at test group 144.
at_banner_text_4="ovn-nbctl"
# Banner 5. ovn-sbctl.at:1
# Category starts at test group 201.
at_banner_text_5="ovn-sbctl"
# Banner 6. ovn-ic-nbctl.at:1
# Category starts at test group 204.
at_banner_text_6="ovn-ic-nbctl"
# Banner 7. ovn-ic-sbctl.at:1
# Category starts at test group 205.
at_banner_text_7="ovn-ic-sbctl"
# Banner 8. ovn-controller.at:1
# Category starts at test group 206.
at_banner_text_8="ovn-controller"
# Banner 9. ovn-controller-vtep.at:1
# Category starts at test group 211.
at_banner_text_9="ovn_controller_vtep"
# Banner 10. ovn-ic.at:1
# Category starts at test group 217.
at_banner_text_10="OVN Interconnection Controller"
# Banner 11. checkpatch.at:1
# Category starts at test group 222.
at_banner_text_11="checkpatch"

# Take any -C into account.
if $at_change_dir ; then
  test x != "x$at_dir" && cd "$at_dir" \
    || as_fn_error $? "unable to change directory"
  at_dir=`pwd`
fi

# Load the config files for any default variable assignments.
for at_file in atconfig atlocal
do
  test -r $at_file || continue
  . ./$at_file || as_fn_error $? "invalid content: $at_file"
done

# Autoconf <=2.59b set at_top_builddir instead of at_top_build_prefix:
: "${at_top_build_prefix=$at_top_builddir}"

# Perform any assignments requested during argument parsing.
eval "$at_debug_args"

# atconfig delivers names relative to the directory the test suite is
# in, but the groups themselves are run in testsuite-dir/group-dir.
if test -n "$at_top_srcdir"; then
  builddir=../..
  for at_dir_var in srcdir top_srcdir top_build_prefix
  do
    eval at_val=\$at_$at_dir_var
    case $at_val in
      [\\/$]* | ?:[\\/]* ) at_prefix= ;;
      *) at_prefix=../../ ;;
    esac
    eval "$at_dir_var=\$at_prefix\$at_val"
  done
fi

## -------------------- ##
## Directory structure. ##
## -------------------- ##

# This is the set of directories and files used by this script
# (non-literals are capitalized):
#
# TESTSUITE         - the testsuite
# TESTSUITE.log     - summarizes the complete testsuite run
# TESTSUITE.dir/    - created during a run, remains after -d or failed test
# + at-groups/      - during a run: status of all groups in run
# | + NNN/          - during a run: meta-data about test group NNN
# | | + check-line  - location (source file and line) of current AT_CHECK
# | | + status      - exit status of current AT_CHECK
# | | + stdout      - stdout of current AT_CHECK
# | | + stder1      - stderr, including trace
# | | + stderr      - stderr, with trace filtered out
# | | + test-source - portion of testsuite that defines group
# | | + times       - timestamps for computing duration
# | | + pass        - created if group passed
# | | + xpass       - created if group xpassed
# | | + fail        - created if group failed
# | | + xfail       - created if group xfailed
# | | + skip        - created if group skipped
# + at-stop         - during a run: end the run if this file exists
# + at-source-lines - during a run: cache of TESTSUITE line numbers for extraction
# + 0..NNN/         - created for each group NNN, remains after -d or failed test
# | + TESTSUITE.log - summarizes the group results
# | + ...           - files created during the group

# The directory the whole suite works in.
# Should be absolute to let the user `cd' at will.
at_suite_dir=$at_dir/$as_me.dir
# The file containing the suite ($at_dir might have changed since earlier).
at_suite_log=$at_dir/$as_me.log
# The directory containing helper files per test group.
at_helper_dir=$at_suite_dir/at-groups
# Stop file: if it exists, do not start new jobs.
at_stop_file=$at_suite_dir/at-stop
# The fifo used for the job dispatcher.
at_job_fifo=$at_suite_dir/at-job-fifo

if $at_clean; then
  test -d "$at_suite_dir" &&
    find "$at_suite_dir" -type d ! -perm -700 -exec chmod u+rwx \{\} \;
  rm -f -r "$at_suite_dir" "$at_suite_log"
  exit $?
fi

# Don't take risks: use only absolute directories in PATH.
#
# For stand-alone test suites (ie. atconfig was not found),
# AUTOTEST_PATH is relative to `.'.
#
# For embedded test suites, AUTOTEST_PATH is relative to the top level
# of the package.  Then expand it into build/src parts, since users
# may create executables in both places.
AUTOTEST_PATH=`$as_echo "$AUTOTEST_PATH" | sed "s|:|$PATH_SEPARATOR|g"`
at_path=
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $AUTOTEST_PATH $PATH
do
  IFS=$as_save_IFS
  test -z "$as_dir" && as_dir=.
    test -n "$at_path" && as_fn_append at_path $PATH_SEPARATOR
case $as_dir in
  [\\/]* | ?:[\\/]* )
    as_fn_append at_path "$as_dir"
    ;;
  * )
    if test -z "$at_top_build_prefix"; then
      # Stand-alone test suite.
      as_fn_append at_path "$as_dir"
    else
      # Embedded test suite.
      as_fn_append at_path "$at_top_build_prefix$as_dir$PATH_SEPARATOR"
      as_fn_append at_path "$at_top_srcdir/$as_dir"
    fi
    ;;
esac
  done
IFS=$as_save_IFS


# Now build and simplify PATH.
#
# There might be directories that don't exist, but don't redirect
# builtins' (eg., cd) stderr directly: Ultrix's sh hates that.
at_new_path=
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $at_path
do
  IFS=$as_save_IFS
  test -z "$as_dir" && as_dir=.
    test -d "$as_dir" || continue
case $as_dir in
  [\\/]* | ?:[\\/]* ) ;;
  * ) as_dir=`(cd "$as_dir" && pwd) 2>/dev/null` ;;
esac
case $PATH_SEPARATOR$at_new_path$PATH_SEPARATOR in
  *$PATH_SEPARATOR$as_dir$PATH_SEPARATOR*) ;;
  $PATH_SEPARATOR$PATH_SEPARATOR) at_new_path=$as_dir ;;
  *) as_fn_append at_new_path "$PATH_SEPARATOR$as_dir" ;;
esac
  done
IFS=$as_save_IFS

PATH=$at_new_path
export PATH

# Setting up the FDs.



# 5 is the log file.  Not to be overwritten if `-d'.
if $at_debug_p; then
  at_suite_log=/dev/null
else
  : >"$at_suite_log"
fi
exec 5>>"$at_suite_log"

# Banners and logs.
$as_echo "## ---------------------- ##
## ovn 2.13.0 test suite. ##
## ---------------------- ##"
{
  $as_echo "## ---------------------- ##
## ovn 2.13.0 test suite. ##
## ---------------------- ##"
  echo

  $as_echo "$as_me: command line was:"
  $as_echo "  \$ $0 $at_cli_args"
  echo

  # If ChangeLog exists, list a few lines in case it might help determining
  # the exact version.
  if test -n "$at_top_srcdir" && test -f "$at_top_srcdir/ChangeLog"; then
    $as_echo "## ---------- ##
## ChangeLog. ##
## ---------- ##"
    echo
    sed 's/^/| /;10q' "$at_top_srcdir/ChangeLog"
    echo
  fi

  {
cat <<_ASUNAME
## --------- ##
## Platform. ##
## --------- ##

hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
uname -m = `(uname -m) 2>/dev/null || echo unknown`
uname -r = `(uname -r) 2>/dev/null || echo unknown`
uname -s = `(uname -s) 2>/dev/null || echo unknown`
uname -v = `(uname -v) 2>/dev/null || echo unknown`

/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
/bin/uname -X     = `(/bin/uname -X) 2>/dev/null     || echo unknown`

/bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown`
/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown`
/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
/usr/bin/hostinfo      = `(/usr/bin/hostinfo) 2>/dev/null      || echo unknown`
/bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown`
/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`
/bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`

_ASUNAME

as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
  IFS=$as_save_IFS
  test -z "$as_dir" && as_dir=.
    $as_echo "PATH: $as_dir"
  done
IFS=$as_save_IFS

}
  echo

  # Contents of the config files.
  for at_file in atconfig atlocal
  do
    test -r $at_file || continue
    $as_echo "$as_me: $at_file:"
    sed 's/^/| /' $at_file
    echo
  done
} >&5


## ------------------------- ##
## Autotest shell functions. ##
## ------------------------- ##

# at_fn_banner NUMBER
# -------------------
# Output banner NUMBER, provided the testsuite is running multiple groups and
# this particular banner has not yet been printed.
at_fn_banner ()
{
  $at_print_banners || return 0
  eval at_banner_text=\$at_banner_text_$1
  test "x$at_banner_text" = "x " && return 0
  eval "at_banner_text_$1=\" \""
  if test -z "$at_banner_text"; then
    $at_first || echo
  else
    $as_echo "$as_nl$at_banner_text$as_nl"
  fi
} # at_fn_banner

# at_fn_check_prepare_notrace REASON LINE
# ---------------------------------------
# Perform AT_CHECK preparations for the command at LINE for an untraceable
# command; REASON is the reason for disabling tracing.
at_fn_check_prepare_notrace ()
{
  $at_trace_echo "Not enabling shell tracing (command contains $1)"
  $as_echo "$2" >"$at_check_line_file"
  at_check_trace=: at_check_filter=:
  : >"$at_stdout"; : >"$at_stderr"
}

# at_fn_check_prepare_trace LINE
# ------------------------------
# Perform AT_CHECK preparations for the command at LINE for a traceable
# command.
at_fn_check_prepare_trace ()
{
  $as_echo "$1" >"$at_check_line_file"
  at_check_trace=$at_traceon at_check_filter=$at_check_filter_trace
  : >"$at_stdout"; : >"$at_stderr"
}

# at_fn_check_prepare_dynamic COMMAND LINE
# ----------------------------------------
# Decide if COMMAND at LINE is traceable at runtime, and call the appropriate
# preparation function.
at_fn_check_prepare_dynamic ()
{
  case $1 in
    *$as_nl*)
      at_fn_check_prepare_notrace 'an embedded newline' "$2" ;;
    *)
      at_fn_check_prepare_trace "$2" ;;
  esac
}

# at_fn_filter_trace
# ------------------
# Remove the lines in the file "$at_stderr" generated by "set -x" and print
# them to stderr.
at_fn_filter_trace ()
{
  mv "$at_stderr" "$at_stder1"
  grep '^ *+' "$at_stder1" >&2
  grep -v '^ *+' "$at_stder1" >"$at_stderr"
}

# at_fn_log_failure FILE-LIST
# ---------------------------
# Copy the files in the list on stdout with a "> " prefix, and exit the shell
# with a failure exit code.
at_fn_log_failure ()
{
  for file
    do $as_echo "$file:"; sed 's/^/> /' "$file"; done
  echo 1 > "$at_status_file"
  exit 1
}

# at_fn_check_skip EXIT-CODE LINE
# -------------------------------
# Check whether EXIT-CODE is a special exit code (77 or 99), and if so exit
# the test group subshell with that same exit code. Use LINE in any report
# about test failure.
at_fn_check_skip ()
{
  case $1 in
    99) echo 99 > "$at_status_file"; at_failed=:
	$as_echo "$2: hard failure"; exit 99;;
    77) echo 77 > "$at_status_file"; exit 77;;
  esac
}

# at_fn_check_status EXPECTED EXIT-CODE LINE
# ------------------------------------------
# Check whether EXIT-CODE is the EXPECTED exit code, and if so do nothing.
# Otherwise, if it is 77 or 99, exit the test group subshell with that same
# exit code; if it is anything else print an error message referring to LINE,
# and fail the test.
at_fn_check_status ()
{
  case $2 in
    $1 ) ;;
    77) echo 77 > "$at_status_file"; exit 77;;
    99) echo 99 > "$at_status_file"; at_failed=:
	$as_echo "$3: hard failure"; exit 99;;
    *) $as_echo "$3: exit code was $2, expected $1"
      at_failed=:;;
  esac
}

# at_fn_diff_devnull FILE
# -----------------------
# Emit a diff between /dev/null and FILE. Uses "test -s" to avoid useless diff
# invocations.
at_fn_diff_devnull ()
{
  test -s "$1" || return 0
  $at_diff "$at_devnull" "$1"
}

# at_fn_test NUMBER
# -----------------
# Parse out test NUMBER from the tail of this file.
at_fn_test ()
{
  eval at_sed=\$at_sed$1
  sed "$at_sed" "$at_myself" > "$at_test_source"
}

# at_fn_create_debugging_script
# -----------------------------
# Create the debugging script $at_group_dir/run which will reproduce the
# current test group.
at_fn_create_debugging_script ()
{
  {
    echo "#! /bin/sh" &&
    echo 'test "${ZSH_VERSION+set}" = set && alias -g '\''${1+"$@"}'\''='\''"$@"'\''' &&
    $as_echo "cd '$at_dir'" &&
    $as_echo "exec \${CONFIG_SHELL-$SHELL} \"$at_myself\" -v -d $at_debug_args $at_group \${1+\"\$@\"}" &&
    echo 'exit 1'
  } >"$at_group_dir/run" &&
  chmod +x "$at_group_dir/run"
}

## -------------------------------- ##
## End of autotest shell functions. ##
## -------------------------------- ##
{
  $as_echo "## ---------------- ##
## Tested programs. ##
## ---------------- ##"
  echo
} >&5

# Report what programs are being tested.
for at_program in : $at_tested
do
  test "$at_program" = : && continue
  case $at_program in
    [\\/]* | ?:[\\/]* ) $at_program_=$at_program ;;
    * )
    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
  IFS=$as_save_IFS
  test -z "$as_dir" && as_dir=.
    test -f "$as_dir/$at_program" && break
  done
IFS=$as_save_IFS

    at_program_=$as_dir/$at_program ;;
  esac
  if test -f "$at_program_"; then
    {
      $as_echo "$at_srcdir/testsuite.at:1: $at_program_ --version"
      "$at_program_" --version </dev/null
      echo
    } >&5 2>&1
  else
    as_fn_error $? "cannot find $at_program" "$LINENO" 5
  fi
done

{
  $as_echo "## ------------------ ##
## Running the tests. ##
## ------------------ ##"
} >&5

at_start_date=`date`
at_start_time=`date +%s 2>/dev/null`
$as_echo "$as_me: starting at: $at_start_date" >&5


# Set ovs_base to the base directory in which the test is running and
# initialize the OVS_*DIR environment variables to point to this
# directory.
ovs_init() {
    ovs_base=`pwd`
    trap '. "$ovs_base/cleanup"' 0
    : > cleanup
    ovs_setenv
}

# With no parameter or an empty parameter, sets the OVS_*DIR
# environment variables to point to $ovs_base, the base directory in
# which the test is running.
#
# With a parameter, sets them to $ovs_base/$1.
ovs_setenv() {
    sandbox=$1
    ovs_dir=$ovs_base${1:+/$1}
    OVS_RUNDIR=$ovs_dir; export OVS_RUNDIR
    OVN_RUNDIR=$ovs_dir; export OVN_RUNDIR
    OVS_LOGDIR=$ovs_dir; export OVS_LOGDIR
    OVS_DBDIR=$ovs_dir; export OVS_DBDIR
    OVS_SYSCONFDIR=$ovs_dir; export OVS_SYSCONFDIR
    OVS_PKGDATADIR=$ovs_dir; export OVS_PKGDATADIR
}

# Prints the integers from $1 to $2, increasing by $3 (default 1) on stdout.
seq () {
    if test $# = 1; then
        set 1 $1
    fi
    while test $1 -le $2; do
        echo $1
        set `expr $1 + ${3-1}` $2 $3
    done
}

if test "$IS_WIN32" = "yes"; then
    pwd () {
        command pwd -W "$@"
    }

    diff () {
        command diff --strip-trailing-cr "$@"
    }

    # tskill is more effective than taskkill but it isn't always installed.
    if (tskill //?) >/dev/null 2>&1; then :; else
        tskill () { taskkill //F //PID $1 >/dev/null; }
    fi

    kill () {
        signal=
        retval=0
        for arg; do
            case $arg in
            -*) signal=$arg ;;
            [1-9][0-9]*)
                # tasklist always returns 0.
                # If pid does exist, there will be a line with the pid.
                if tasklist //fi "PID eq $arg" | grep $arg >/dev/null; then
                    if test "X$signal" != "X-0"; then
                        tskill $arg
                    fi
                else
                    retval=1
                fi
                ;;
            esac
        done
        return $retval
    }
fi

# parent_pid PID
#
# Prints the PID of the parent of process PID.
parent_pid () {
    # Using "ps" is portable to any POSIX system, but busybox "ps" (used in
    # e.g. Alpine Linux) is noncompliant, so we use a Linux-specific approach
    # when it's available.  We check the format of the status file to avoid
    # the NetBSD file with the same name but different contents.
    if egrep '^PPid:[[:space:]]*[0-9]*$' /proc/$1/status > /dev/null 2>&1; then
        sed -n 's/^PPid:	\([0-9]*\)/\1/p' /proc/$1/status
    else
        ps -o ppid= -p $1
    fi
}

# kill_ovs_vswitchd [PID]
#
# Signal the ovs-vswitchd daemon to exit gracefully and wait for it to
# terminate or kill it if that takes too long.
#
# It is used to cleanup all sorts of tests and results. It can't assume
# any state, including the availability of PID file which can be provided.
kill_ovs_vswitchd () {
    # Use provided PID or save the current PID if available.
    TMPPID=$1
    if test -z "$TMPPID"; then
        TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid 2>/dev/null)
    fi

    # Tell the daemon to terminate gracefully
    ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup 2>/dev/null

    # Nothing else to be done if there is no PID
    test -z "$TMPPID" && return

    for i in 1 2 3 4 5 6 7 8 9; do
        # Check if the daemon is alive.
        kill -0 $TMPPID 2>/dev/null || return

        # Fallback to whole number since POSIX doesn't require
        # fractional times to work.
        sleep 0.1 || sleep 1
    done

    # Make sure it is terminated.
    kill $TMPPID
}

# Normalize the output of 'wc' to match POSIX.
# POSIX says 'wc' should print "%d %d %d", but GNU prints "%7d %7d %7d".
# POSIX says 'wc -l' should print "%d %s", but BSD prints "%8d".
#
# This fixes all of those (it will screw up filenames that contain
# multiple sequential spaces, but that doesn't really matter).
wc () {
   command wc "$@" | tr -s ' ' ' ' | sed 's/^ *//'
}

uuidfilt () {
    $PYTHON "$top_srcdir"/tests/uuidfilt.py "$@"
}

# run_as PROGRAM_NAME COMMAND [ARG...]
#
# Runs a command with argv[0] set to PROGRAM_NAME, if possible, in a
# subshell.  Most utilities print argc[0] as part of their messages,
# so this makes it easier to figure out which particular utility
# prints a message if a bunch of identical processes are running.
#
# Not all shells support "exec -a NAME", so test for it.
if (exec -a myname true 2>/dev/null); then
    run_as () {
        (exec -a "$@")
    }
else
    run_as () {
        shift
        (exec "$@")
    }
fi


ovs_cleanup() {
    if test "$(echo asan.*)" != 'asan.*'; then
        echo "Address Sanitizer reported errors in:" asan.*
        cat asan.*
        $as_echo "ovs-macros.at:195" >"$at_check_line_file"
at_fn_check_skip 99 "$at_srcdir/ovs-macros.at:195"
    fi
}

ovs_wait () {
    echo "$1: waiting $2..." >&5

    # First try the condition without waiting.
    if ovs_wait_cond; then echo "$1: wait succeeded immediately" >&5; return 0; fi

    # Try a quick sleep, so that the test completes very quickly
    # in the normal case.  POSIX doesn't require fractional times to
    # work, so this might not work.
    sleep 0.1
    if ovs_wait_cond; then echo "$1: wait succeeded quickly" >&5; return 0; fi

    # Then wait up to 10 seconds.
    local d
    for d in 1 2 3 4 5 6 7 8 9 10; do
        sleep 1
        if ovs_wait_cond; then echo "$1: wait succeeded after $d seconds" >&5; return 0; fi
    done

    echo "$1: wait failed after $d seconds" >&5
    ovs_wait_failed
    $as_echo "ovs-macros.at:220" >"$at_check_line_file"
at_fn_check_skip 99 "$at_srcdir/ovs-macros.at:220"
}

   on_exit () {
    (echo "$1"; cat cleanup) > cleanup.tmp
    mv cleanup.tmp cleanup
}


ovsdb_client_wait() {
    ovsdb-client -vconsole:warn -vreconnect:err -vjsonrpc:err -vtimeval:off -vfile -vsyslog:off -vvlog:off --timeout=30 wait "$@"
}



# Strips out uninteresting parts of ovs-ofctl output, as well as parts
# that vary from one run to another.
ofctl_strip () {
    sed '
s/ (xid=0x[0-9a-fA-F]*)//
s/ duration=[0-9.]*s,//
s/ cookie=0x0,//
s/ table=0,//
s/ n_packets=0,//
s/ n_bytes=0,//
s/ idle_age=[0-9]*,//
s/ hard_age=[0-9]*,//
s/dp_hash=0x[0-9a-f]*\//dp_hash=0x0\//
s/recirc_id=0x[0-9a-f]*,/recirc_id=0x0,/
s/[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]T[0-9][0-9]:[0-9][0-9]:[0-9][0-9]Z|//
s/dir\/[0-9]*\/br0.mgmt/dir\/XXXX\/br0.mgmt/
'
}

# Filter (multiline) vconn debug messages from ovs-vswitchd.log.
# Use with vconn_sub() and ofctl_strip()
print_vconn_debug () { awk -F\| < ovs-vswitchd.log '
BEGIN { prt=0 }
/\|vconn\|DBG\|/ { sub(/[ \t]*$/, ""); print $3 "|" $4 "|" $5; prt=1; next }
$4 != "" { prt=0; next }
prt==1 { sub(/[ \t]*$/, ""); print $0 }
'
}

vconn_sub() {
    sed '
s/tcp:127.0.0.1:[0-9][0-9]*:/unix:/
s/unix#[0-9]*:/unix:/
'
}


# PARSE_LISTENING_PORT LOGFILE VARIABLE
#
# Parses the TCP or SSL port on which a server is listening from
# LOGFILE, given that the server was told to listen on a kernel-chosen
# port, and assigns the port number to shell VARIABLE.  You should
# specify the listening remote as ptcp:0:127.0.0.1 or
# pssl:0:127.0.0.1, or the equivalent with [::1] instead of 127.0.0.1.
#
# Here's an example of how to use this with ovsdb-server:
#
#    ovsdb-server --log-file --remote=ptcp:0:127.0.0.1 ...
#    PARSE_LISTENING_PORT([ovsdb-server.log], [TCP_PORT])
#    # Now $TCP_PORT holds the listening port.


start_daemon () {
    "$@" -vconsole:off --detach --no-chdir --pidfile --log-file
    pidfile="$OVS_RUNDIR"/$1.pid
    on_exit "test -e \"$pidfile\" && kill \`cat \"$pidfile\"\`"
}

# sim_add SANDBOX
#
# Starts a new simulated Open vSwitch instance named SANDBOX.  Files related to
# the instance, such as logs, databases, sockets, and pidfiles, are created in
# a subdirectory of the main test directory also named SANDBOX.  Afterward, the
# "as" command (see below) can be used to run Open vSwitch utilities in the
# context of the new sandbox.
#
# The new sandbox starts out without any bridges.  Use ovs-vsctl in the context
# of the new sandbox to create a bridge, e.g.:
#
#     sim_add hv0           # Create sandbox hv0.
#     as hv0                # Set hv0 as default sandbox.
#     ovs-vsctl add-br br0  # Add bridge br0 inside hv0.
#
# or:
#
#     sim_add hv0
#     as hv0 ovs-vsctl add-br br0
sims=
sim_add () {
   echo "adding simulator '$1'"

   sims="$sims $1"

   # Create sandbox.
   local d="$ovs_base"/$1
   mkdir "$d" || return 1
   ovs_setenv $1

   # Create database and start ovsdb-server.
   : > "$d"/.conf.db.~lock~
   as $1 ovsdb-tool create "$d"/conf.db "$ovs_srcdir"/vswitchd/vswitch.ovsschema || return 1
   as $1 start_daemon ovsdb-server --remote=punix:"$d"/db.sock || return 1

   # Initialize database.
   as $1 ovs-vsctl --no-wait -- init || return 1

   # Start ovs-vswitchd
   as $1 start_daemon ovs-vswitchd --enable-dummy=system -vvconn -vofproto_dpif -vunixctl
}

# "as $1" sets the OVS_*DIR environment variables to point to $ovs_base/$1.
#
# "as $1 COMMAND..." sets those variables in a subshell and invokes COMMAND
# there.
as() {
    if test "X$2" != X; then
        (ovs_setenv $1; shift; "$@")
    else
        ovs_setenv $1
    fi
}

# Strips 'xid=0x1234' from ovs-ofctl output.
strip_xids () {
    sed 's/ (xid=0x[0-9a-fA-F]*)//'
}

# Changes all 'used:...' to say 'used:0.0', to make output easier to compare.
strip_used () {
    sed 's/used:[0-9]\.[0-9]*/used:0.0/'
}

# Removes all 'duration=...' to make output easier to compare.
strip_duration () {
    sed 's/duration=[0-9]*\.[0-9]*s,//'
}

# Strips 'ufid:...' from output, to make it easier to compare.
# (ufids are random.)
strip_ufid () {
    sed 's/ufid:[-0-9a-f]* //'
}

check_logs () {
    local logs
    for log in *.log; do
        case ${log} in # (
            '*.log'|testsuite.log) ;; # (
            *) logs="${logs} ${log}" ;;
        esac
    done

    # We most notably ignore 'Broken pipe' warnings.  These often and
    # intermittently appear in ovsdb-server.log, because *ctl commands
    # (e.g. ovs-vsctl, ovn-nbctl) exit right after committing a change to the
    # database.  However, in reaction, some daemon may immediately update the
    # database, and this later update may cause database sending update back to
    # *ctl command if *ctl has not exited yet.  If *ctl command exits before
    # the database calls send, the send fails with 'Broken pipe' or
    # 'not connected' depending on system.  Also removes all 'connection reset'
    # warning logs for similar reasons (EPIPE, ENOTCONN or ECONNRESET can be
    # returned on a send depending on whether the peer had unconsumed data
    # when it closed the socket).
    #
    # We also ignore "Dropped # log messages..." messages.  Otherwise, even if
    # we ignore the messages that were rate-limited, we can end up failing just
    # because of the announcement that rate-limiting happened (and in a racy,
    # timing-dependent way, too).
    sed -n "$1
/reset by peer/d
/Broken pipe/d
/is not connected/d
/timeval.*Unreasonably long [0-9]*ms poll interval/d
/timeval.*faults: [0-9]* minor, [0-9]* major/d
/timeval.*disk: [0-9]* reads, [0-9]* writes/d
/timeval.*context switches: [0-9]* voluntary, [0-9]* involuntary/d
/ovs_rcu.*blocked [0-9]* ms waiting for .* to quiesce/d
/Dropped [0-9]* log messages/d
/|WARN|/p
/|ERR|/p
/|EMER|/p" ${logs}
}

# add_of_br BRNUM [ARG...]
add_of_br () {
    local brnum=$1; shift
    local br=br$brnum
    local dpid=fedcba987654321$brnum
    local mac=aa:55:aa:55:00:0$brnum
    ovs-vsctl --timeout=20 \
        -- add-br $br \
        -- set bridge $br datapath-type=dummy \
                          fail-mode=secure \
                          other-config:datapath-id=$dpid \
                          other-config:hwaddr=$mac \
                          protocols="[OpenFlow10,OpenFlow11,OpenFlow12,\
                                       OpenFlow13,OpenFlow14,OpenFlow15]" \
        -- "$@"
}

# add_of_ports__ PORT_TYPE [--pcap] BRIDGE PNUM...
#
# Creates PORT_TYPE interfaces in BRIDGE named pPNUM, OpenFlow port number
# PNUM, and datapath port number PNUM (the latter is a consequence of
# the dummy implementation, which tries to assign datapath port
# numbers based on port names).
#
# If --pcap is supplied then packets received from the interface will
# be written to $port-rx.pcap and those sent to it to $port-tx.pcap.
add_of_ports__ () {
    local args
    local pcap=false
    local ptype=$1
    shift
    if test "$1" = --pcap; then
        pcap=:
    shift
    fi
    local br=$1; shift
    for pnum; do
        as_fn_append args " -- add-port $br p$pnum -- set Interface p$pnum type=$ptype ofport_request=$pnum"
    if $pcap; then
        as_fn_append args " -- set Interface p$pnum options:rxq_pcap=p$pnum-rx.pcap options:tx_pcap=p$pnum-tx.pcap"
    fi
    done
    echo ovs-vsctl $args
    ovs-vsctl $args
}

# add_of_ports [--pcap] BRIDGE PNUM...
#
add_of_ports () {
    add_of_ports__ dummy $@
}

# add_pmd_of_ports [--pcap] BRIDGE PNUM...
#
add_pmd_of_ports () {
    add_of_ports__ dummy-pmd $@
}



# ovn_init_db DATABASE [AZ]
#
# Creates and initializes the given DATABASE (one of "ovn-sb" or "ovn-nb"),
# starts its ovsdb-server instance, and sets the appropriate environment
# variable (OVN_SB_DB or OVN_NB_DB) so that ovn-sbctl or ovn-nbctl uses the
# database by default.
#
# Usually invoked from ovn_start.
ovn_init_db () {
    echo "creating $1 database"
    local as_d=$1
    if test -n "$2"; then
        as_d=$2/$as_d
    fi
    local d=$ovs_base/$as_d
    mkdir "$d" || return 1
    : > "$d"/.$1.db.~lock~
    as $as_d ovsdb-tool create "$d"/$1.db "$abs_top_srcdir"/$1.ovsschema
    as $as_d start_daemon ovsdb-server --remote=punix:"$d"/$1.sock "$d"/$1.db
    local var=`echo $1_db | tr a-z- A-Z_`
    eval "$var=unix:\"\$d\"/\$1.sock"; export $var
}

# ovn_init_ic_db
#
# Creates and initializes ovn-ic-nb and ovn-ic-sb databases and starts their
# ovsdb-server instances, for OVN interconnection.
ovn_init_ic_db () {
    ovn_init_db ovn-ic-nb
    ovn_init_db ovn-ic-sb
}

# ovn_start [AZ]
#
# Creates and initializes ovn-sb and ovn-nb databases and starts their
# ovsdb-server instance, sets appropriate environment variables so that
# ovn-sbctl and ovn-nbctl use them by default, and starts ovn-northd running
# against them.
ovn_start () {
    if test -n "$1"; then
        mkdir "$ovs_base"/$1
    fi

    ovn_init_db ovn-sb $1; ovn-sbctl init
    ovn_init_db ovn-nb $1; ovn-nbctl init
    if test -n "$1"; then
        ovn-nbctl set NB_Global . name=$1
    fi
    local ovn_sb_db=$OVN_SB_DB
    local ovn_nb_db=$OVN_NB_DB

    local as_d=northd
    if test -n "$1"; then
        as_d=$1/$as_d
    fi
    echo "starting ovn-northd"
    mkdir "$ovs_base"/$as_d
    as $as_d start_daemon ovn-northd -v \
               --ovnnb-db=$ovn_nb_db \
               --ovnsb-db=$ovn_sb_db

    as_d=northd-backup
    if test -n "$1"; then
        as_d=$1/$as_d
    fi
    echo "starting backup ovn-northd"
    mkdir "$ovs_base"/$as_d
    as $as_d start_daemon ovn-northd -v \
               --ovnnb-db=$ovn_nb_db \
               --ovnsb-db=$ovn_sb_db

    if test -n "$1"; then
        as_d=$1/ic
        echo "starting ovn-ic"
        mkdir "$ovs_base"/$as_d
        as $as_d start_daemon ovn-ic -v \
               --ovnnb-db=$ovn_nb_db \
               --ovnsb-db=$ovn_sb_db \
               --ic-nb-db=unix:"$ovs_base"/ovn-ic-nb/ovn-ic-nb.sock \
               --ic-sb-db=unix:"$ovs_base"/ovn-ic-sb/ovn-ic-sb.sock
    fi
}

# Interconnection networks.
#
# When multiple sandboxed Open vSwitch instances exist, one will inevitably
# want to connect them together.  These commands allow for that.  Conceptually,
# an interconnection network is a switch for which these functions make it easy
# to plug into other switches in other sandboxed Open vSwitch instances.
# Interconnection networks are implemented as bridges in a switch named "main",
# so to use interconnection networks please avoid working with that switch
# directly.

# net_add NETWORK
#
# Creates a new interconnection network named NETWORK.
net_add () {
    test -d "$ovs_base"/main || sim_add main || return 1
    as main ovs-vsctl add-br "$1"
}

# net_attach NETWORK BRIDGE
#
# Adds a new port to BRIDGE in the default sandbox (as set with as()) and plugs
# it into the NETWORK interconnection network.  NETWORK must already have been
# created by a previous invocation of net_add.  The default sandbox must not be
# "main".
net_attach () {
    local net=$1 bridge=$2

    local port=${sandbox}_$bridge
    as main ovs-vsctl \
        -- add-port $net $port \
        -- set Interface $port options:pstream="punix:$ovs_base/main/$port.sock" options:rxq_pcap="$ovs_base/main/$port-rx.pcap" options:tx_pcap="$ovs_base/main/$port-tx.pcap" \
        || return 1

    ovs-vsctl \
        -- set Interface $bridge options:tx_pcap="$ovs_base/$sandbox/$bridge-tx.pcap" options:rxq_pcap="$ovs_base/$sandbox/$bridge-rx.pcap" \
        -- add-port $bridge ${bridge}_$net \
        -- set Interface ${bridge}_$net options:stream="unix:$ovs_base/main/$port.sock" options:rxq_pcap="$ovs_base/$sandbox/${bridge}_$net-rx.pcap" options:tx_pcap="$ovs_base/$sandbox/${bridge}_$net-tx.pcap" \
        || return 1
}

# ovn_az_attach AZ NETWORK BRIDGE IP [MASKLEN]
ovn_az_attach() {
    local az=$1 net=$2 bridge=$3 ip=$4 masklen=${5-24}
    net_attach $net $bridge || return 1

    mac=`ovs-vsctl get Interface $bridge mac_in_use | sed s/\"//g`
    arp_table="$arp_table $sandbox,$bridge,$ip,$mac"
    ovs-appctl netdev-dummy/ip4addr $bridge $ip/$masklen >/dev/null || return 1
    ovs-appctl ovs/route/add $ip/$masklen $bridge >/dev/null || return 1

    local ovn_remote
    if test X"$az" = XNONE; then
        ovn_remote=unix:$ovs_base/ovn-sb/ovn-sb.sock
    else
        ovn_remote=unix:$ovs_base/$az/ovn-sb/ovn-sb.sock
    fi
    ovs-vsctl \
        -- set Open_vSwitch . external-ids:system-id=$sandbox \
        -- set Open_vSwitch . external-ids:ovn-remote=$ovn_remote \
        -- set Open_vSwitch . external-ids:ovn-encap-type=geneve,vxlan \
        -- set Open_vSwitch . external-ids:ovn-encap-ip=$ip \
        -- add-br br-int \
        -- set bridge br-int fail-mode=secure other-config:disable-in-band=true \
        || return 1
    start_daemon ovn-controller || return 1
}

# ovn_attach NETWORK BRIDGE IP [MASKLEN]
#
# First, this command attaches BRIDGE to interconnection network NETWORK, just
# like "net_attach NETWORK BRIDGE".  Second, it configures (simulated) IP
# address IP (with network mask length MASKLEN, which defaults to 24) on
# BRIDGE.  Finally, it configures the Open vSwitch database to work with OVN
# and starts ovn-controller.
ovn_attach() {
    ovn_az_attach NONE $@
}

# ovn_setenv AZ
ovn_setenv () {
    local d=$ovs_base/$1
    OVN_NB_DB=unix:"$d"/ovn-nb/ovn-nb.sock; export $var
    OVN_SB_DB=unix:"$d"/ovn-sb/ovn-sb.sock; export $var
}

# ovs_as AZ
ovn_as() {
    if test "X$2" != X; then
        (ovn_setenv $1; shift; "$@")
    else
        ovn_setenv $1
    fi
}

# OVN_POPULATE_ARP
#
# This pre-populates the ARP tables of all of the OVN instances that have been
# started with ovn_attach().  That means that packets sent from one hypervisor
# to another never get dropped or delayed by ARP resolution, which makes
# testing easier.
ovn_populate_arp__() {
    for e1 in $arp_table; do
        set `echo $e1 | sed 's/,/ /g'`; sb1=$1 br1=$2 ip=$3 mac=$4
        for e2 in $arp_table; do
            set `echo $e2 | sed 's/,/ /g'`; sb2=$1 br2=$2
            if test $sb1,$br1 != $sb2,$br2; then
                as $sb2 ovs-appctl tnl/neigh/set $br2 $ip $mac || return 1
            fi
        done
    done
}
ovn_check_packets__ () {
     echo
     echo "checking packets in $1 against $2:"
     rcv_pcap=$1
     rcv_text=`echo "$rcv_pcap.packets" | sed 's/\.pcap//'`
     exp_text=$2
     exp_n=`wc -l < "$exp_text"`
     ovs_wait_cond () {
    $PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" $rcv_pcap > $rcv_text
        rcv_n=`wc -l < "$rcv_text"`
        echo "rcv_n=$rcv_n exp_n=$exp_n"
        test $rcv_n -ge $exp_n
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12" "until \$PYTHON \"\$ovs_srcdir/utilities/ovs-pcap.in\" \$rcv_pcap > \$rcv_text
        rcv_n=\`wc -l < \"\$rcv_text\"\`
        echo \"rcv_n=\$rcv_n exp_n=\$exp_n\"
        test \$rcv_n -ge \$exp_n"

     sort $exp_text > expout
   }



# vec_cmp VALUE_VEC OP-VALUE_VEC
#
# Compares each value from VALUE_VEC to the operator-value pair from the
# OP-VALUE_VEC.
#
# VALUE_VEC must be a list of values separated by a character from $IFS.
# OP-VALUE_VEC must be a list of operator-value expressions separated by a
# character from $IFS.  Operator-value expressions cannot contain any characters
# from $IFS like spaces. '=' is treated as an equality operator ('==') for
# conciseness.
#
# Returns the result of each comparison as a list of boolean values (0 or 1)
# separated by a new-line character.
vec_cmp() {
    local a b i j

    i=0
    for a in $1; do
        j=0
        for b in $2; do
            if test $i -eq $j; then
                # Replace assignment '=' with equality comparison '=='
                case "$b" in
                =[0-9]*) b="=$b" ;;
                esac

                echo $(($a $b))
                break
            fi
            j=$((j + 1))
        done
        i=$((i + 1))
    done
}

# vec_sub VEC_A VEC_B
#
# Subtracts two vectors:
#
#     VEC_A = [a1, a2, ...]
#     VEC_B = [b1, b2, ...]
#     OUT = [(a1 - b1), (a2 - b2), ...]
#
# VEC_A and VEC_B must be lists of values separated by a character from $IFS.
vec_sub() {
    local a b i j

    i=0
    for a in $1; do
        j=0
        for b in $2; do
            if test $i -eq $j; then
                echo $((a - b))
                break
            fi
            j=$((j + 1))
        done
        i=$((i + 1))
    done
}

# vec_fold VEC OP
#
# Reduces a vector to a single value by applying the binary operator OP (i.e.,
# one that requires two arguments) cumulatively to all vector elements from left
# to right:
#
#     VEC = [e1, e2, e3 ...]
#     OUT = (...((e1 OP e2) OP e3) OP ...)
#
# VEC must be a list of values separated by a character from $IFS.
vec_fold() {
    local first op prod

    first=1
    op=$2
    for a in $1; do
        if test $first -eq 1; then
            prod=$a
            first=0
        else
            prod=$((prod $op a))
        fi
    done
    echo $prod
}

# read_counters SANDBOXES TARGET COUNTER
#
# Prints out the coverage COUNTER for the TARGET in each of the SANDBOXES.
#
# SANDBOXES must be a list of strings separated by a character from $IFS.
read_counters() {
    local sims="$1" target="$2" counter="$3"

    for sim in $sims; do
        as $sim ovs-appctl -t "$target" coverage/read-counter "$counter" || return 1
    done
}

# counter_delta_ SANDBOXES TARGET COUNTER COMMAND
#
# Runs the COMMAND and reports the COUNTER change registered during the command
# run for the given TARGET in each of the SANDBOXES.
counter_delta_() {
    local sims="$1" target="$2" counter="$3" cmd="$4"
    local before after

    before=$(read_counters "$sims" "$target" "$counter") || return 1
    eval "$cmd" >/dev/null || return 1
    after=$(read_counters "$sims" "$target" "$counter") || return 1

    vec_sub "$after" "$before"
}

# counter_delta SANDBOXES TARGET COUNTER COMMAND
#
# Same as counter_delta_ but also prints the COUNTER values together with the
# COMMAND to standard error.
counter_delta() {
    local cmd="$4"
    local v

    v=$(counter_delta_ "$@") || return 1

    # Dump the counters and the command for troubleshooting
    echo "$v" | tr '\n' '\t' >&2
    echo "$cmd" >&2

    echo "$v"
}

# vec_cmp_counter_delta SANDBOXES TARGET COUNTER CONDS COMMAND
#
# Check if COUNTER change in the TARGET app in each of the SANDBOXES after
# running the COMMAND meets the conditions listed as operator-value pairs in
# CONDS.
vec_cmp_counter_delta() {
    local v

    v=$(counter_delta "$1" "$2" "$3" "$5") || return 1
    v=$(vec_cmp "$v" "$4") || return 1
    v=$(vec_fold "$v" "&&") || return 1

    echo "$v"
}

# cmp_counter_delta SANDBOXES TARGET COUNTER COND COMMAND
#
# Check if COUNTER change in the TARGET app in each of the SANDBOXES after
# running the COMMAND meets the COND condition given as a operator-value pair.
cmp_counter_delta() {
    local conds=""

    # Use the same condition for each sandbox
    for _ in $1; do
        conds="$conds $4"
    done

    vec_cmp_counter_delta "$1" "$2" "$3" "$conds" "$5"
}


# OVN_NBCTL_TEST_START

ovn_nbctl_test_start() {
      { set +x
$as_echo "$at_srcdir/ovn-nbctl.at:11: ovsdb-tool create ovn-nb.db \$abs_top_srcdir/ovn-nb.ovsschema"
at_fn_check_prepare_dynamic "ovsdb-tool create ovn-nb.db $abs_top_srcdir/ovn-nb.ovsschema" "ovn-nbctl.at:11"
( $at_check_trace; ovsdb-tool create ovn-nb.db $abs_top_srcdir/ovn-nb.ovsschema
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:11"
$at_failed && at_fn_log_failure
$at_traceon; }


      { set +x
$as_echo "$at_srcdir/ovn-nbctl.at:14: ovsdb-server --detach --no-chdir --pidfile --log-file --remote=punix:\$OVS_RUNDIR/ovnnb_db.sock ovn-nb.db"
at_fn_check_prepare_dynamic "ovsdb-server --detach --no-chdir --pidfile --log-file --remote=punix:$OVS_RUNDIR/ovnnb_db.sock ovn-nb.db" "ovn-nbctl.at:14"
( $at_check_trace; ovsdb-server --detach --no-chdir --pidfile --log-file --remote=punix:$OVS_RUNDIR/ovnnb_db.sock ovn-nb.db
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:14"
$at_failed && at_fn_log_failure
$at_traceon; }

   on_exit "kill `cat ovsdb-server.pid`"
   case $1 in #(
  daemon) :
    export OVN_NB_DAEMON=$(ovn-nbctl --pidfile --detach --no-chdir --log-file -vsocket_util:off)
        on_exit "kill `cat ovn-nbctl.pid`" ;; #(
  direct) :
     ;; #(
  *) :
    $as_echo "ovn-nbctl.at:16" >"$at_check_line_file"
at_fn_check_skip 99 "$at_srcdir/ovn-nbctl.at:16" ;; #(
  *) :
     ;;
esac
   { set +x
$as_echo "$at_srcdir/ovn-nbctl.at:22: ovn-nbctl init"
at_fn_check_prepare_trace "ovn-nbctl.at:22"
( $at_check_trace; ovn-nbctl init
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:22"
$at_failed && at_fn_log_failure
$at_traceon; }

   { set +x
$as_echo "$at_srcdir/ovn-nbctl.at:23: sed < stderr '
/vlog|INFO|opened log file/d
/ovsdb_server|INFO|ovsdb-server (Open vSwitch)/d'"
at_fn_check_prepare_notrace 'an embedded newline' "ovn-nbctl.at:23"
( $at_check_trace; sed < stderr '
/vlog|INFO|opened log file/d
/ovsdb_server|INFO|ovsdb-server (Open vSwitch)/d'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:23"
$at_failed && at_fn_log_failure
$at_traceon; }

}

# OVN_NBCTL_TEST_STOP

ovn_nbctl_test_stop() {
   { set +x
$as_echo "$at_srcdir/ovn-nbctl.at:31: check_logs \"\$1\""
at_fn_check_prepare_dynamic "check_logs \"$1\"" "ovn-nbctl.at:31"
( $at_check_trace; check_logs "$1"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:31"
$at_failed && at_fn_log_failure
$at_traceon; }

   { set +x
$as_echo "$at_srcdir/ovn-nbctl.at:32: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-nbctl.at:32"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:32"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-nbctl.at:32: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-nbctl.at:32"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:32"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-nbctl.at:32" "while kill -0 \$TMPPID 2>/dev/null"

}


    ovn_nbctl_basic_switch() {

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:56: ovn-nbctl ls-add ls0"
at_fn_check_prepare_trace "ovn-nbctl.at:56"
( $at_check_trace; ovn-nbctl ls-add ls0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:56"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:56: ovn-nbctl ls-list | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:56"
( $at_check_trace; ovn-nbctl ls-list | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "<0> (ls0)
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:56"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:56: ovn-nbctl ls-add ls1"
at_fn_check_prepare_trace "ovn-nbctl.at:56"
( $at_check_trace; ovn-nbctl ls-add ls1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:56"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:56: ovn-nbctl ls-list | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:56"
( $at_check_trace; ovn-nbctl ls-list | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "<0> (ls0)
<1> (ls1)
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:56"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:56: ovn-nbctl ls-del ls0"
at_fn_check_prepare_trace "ovn-nbctl.at:56"
( $at_check_trace; ovn-nbctl ls-del ls0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:56"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:56: ovn-nbctl ls-list | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:56"
( $at_check_trace; ovn-nbctl ls-list | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "<0> (ls1)
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:56"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:56: ovn-nbctl show ls0"
at_fn_check_prepare_trace "ovn-nbctl.at:56"
( $at_check_trace; ovn-nbctl show ls0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:56"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:56: ovn-nbctl ls-add ls0"
at_fn_check_prepare_trace "ovn-nbctl.at:56"
( $at_check_trace; ovn-nbctl ls-add ls0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:56"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:56: ovn-nbctl show ls0 | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:56"
( $at_check_trace; ovn-nbctl show ls0 | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "switch <0> (ls0)
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:56"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:56: ovn-nbctl ls-add ls0"
at_fn_check_prepare_trace "ovn-nbctl.at:56"
( $at_check_trace; ovn-nbctl ls-add ls0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: ls0: a switch with this name already exists
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:56"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:56: ovn-nbctl --may-exist ls-add ls0"
at_fn_check_prepare_trace "ovn-nbctl.at:56"
( $at_check_trace; ovn-nbctl --may-exist ls-add ls0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:56"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:56: ovn-nbctl show ls0 | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:56"
( $at_check_trace; ovn-nbctl show ls0 | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "switch <0> (ls0)
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:56"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:56: ovn-nbctl --add-duplicate ls-add ls0"
at_fn_check_prepare_trace "ovn-nbctl.at:56"
( $at_check_trace; ovn-nbctl --add-duplicate ls-add ls0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:56"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:56: ovn-nbctl --may-exist --add-duplicate ls-add ls0"
at_fn_check_prepare_trace "ovn-nbctl.at:56"
( $at_check_trace; ovn-nbctl --may-exist --add-duplicate ls-add ls0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: --may-exist and --add-duplicate may not be used together
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:56"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:56: ovn-nbctl ls-del ls0"
at_fn_check_prepare_trace "ovn-nbctl.at:56"
( $at_check_trace; ovn-nbctl ls-del ls0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: Multiple logical switches named 'ls0'.  Use a UUID.
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:56"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:56: ovn-nbctl ls-del ls2"
at_fn_check_prepare_trace "ovn-nbctl.at:56"
( $at_check_trace; ovn-nbctl ls-del ls2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: ls2: switch name not found
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:56"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:56: ovn-nbctl --if-exists ls-del ls2"
at_fn_check_prepare_trace "ovn-nbctl.at:56"
( $at_check_trace; ovn-nbctl --if-exists ls-del ls2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:56"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:56: ovn-nbctl ls-add"
at_fn_check_prepare_trace "ovn-nbctl.at:56"
( $at_check_trace; ovn-nbctl ls-add
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:56"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:56: ovn-nbctl ls-add"
at_fn_check_prepare_trace "ovn-nbctl.at:56"
( $at_check_trace; ovn-nbctl ls-add
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:56"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:56: ovn-nbctl --add-duplicate ls-add"
at_fn_check_prepare_trace "ovn-nbctl.at:56"
( $at_check_trace; ovn-nbctl --add-duplicate ls-add
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: --add-duplicate requires specifying a name
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:56"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:56: ovn-nbctl --may-exist ls-add"
at_fn_check_prepare_trace "ovn-nbctl.at:56"
( $at_check_trace; ovn-nbctl --may-exist ls-add
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: --may-exist requires specifying a name
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:56"
$at_failed && at_fn_log_failure
$at_traceon; }

    }


    ovn_nbctl_basic_lsp() {

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:109: ovn-nbctl ls-add ls0"
at_fn_check_prepare_trace "ovn-nbctl.at:109"
( $at_check_trace; ovn-nbctl ls-add ls0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:109"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:109: ovn-nbctl lsp-add ls0 lp0"
at_fn_check_prepare_trace "ovn-nbctl.at:109"
( $at_check_trace; ovn-nbctl lsp-add ls0 lp0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:109"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:109: ovn-nbctl lsp-add ls0 lp0"
at_fn_check_prepare_trace "ovn-nbctl.at:109"
( $at_check_trace; ovn-nbctl lsp-add ls0 lp0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: lp0: a port with this name already exists
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:109"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:109: ovn-nbctl --may-exist lsp-add ls0 lp0"
at_fn_check_prepare_trace "ovn-nbctl.at:109"
( $at_check_trace; ovn-nbctl --may-exist lsp-add ls0 lp0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:109"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:109: ovn-nbctl lsp-list ls0 | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:109"
( $at_check_trace; ovn-nbctl lsp-list ls0 | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "<0> (lp0)
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:109"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:109: ovn-nbctl lsp-add ls0 lp1"
at_fn_check_prepare_trace "ovn-nbctl.at:109"
( $at_check_trace; ovn-nbctl lsp-add ls0 lp1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:109"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:109: ovn-nbctl lsp-list ls0 | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:109"
( $at_check_trace; ovn-nbctl lsp-list ls0 | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "<0> (lp0)
<1> (lp1)
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:109"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:109: ovn-nbctl ls-add ls1"
at_fn_check_prepare_trace "ovn-nbctl.at:109"
( $at_check_trace; ovn-nbctl ls-add ls1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:109"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:109: ovn-nbctl lsp-add ls0 lp1"
at_fn_check_prepare_trace "ovn-nbctl.at:109"
( $at_check_trace; ovn-nbctl lsp-add ls0 lp1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: lp1: a port with this name already exists
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:109"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:109: ovn-nbctl --may-exist lsp-add ls1 lp1"
at_fn_check_prepare_trace "ovn-nbctl.at:109"
( $at_check_trace; ovn-nbctl --may-exist lsp-add ls1 lp1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: lp1: port already exists but in switch ls0
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:109"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:109: ovn-nbctl --may-exist lsp-add ls0 lp1 lp0 5"
at_fn_check_prepare_trace "ovn-nbctl.at:109"
( $at_check_trace; ovn-nbctl --may-exist lsp-add ls0 lp1 lp0 5
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: lp1: port already exists but has no parent
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:109"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:109: ovn-nbctl lsp-del lp1"
at_fn_check_prepare_trace "ovn-nbctl.at:109"
( $at_check_trace; ovn-nbctl lsp-del lp1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:109"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:109: ovn-nbctl lsp-list ls0 | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:109"
( $at_check_trace; ovn-nbctl lsp-list ls0 | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "<0> (lp0)
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:109"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:109: ovn-nbctl lsp-add ls0 lp2 lp3 5"
at_fn_check_prepare_trace "ovn-nbctl.at:109"
( $at_check_trace; ovn-nbctl lsp-add ls0 lp2 lp3 5
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:109"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:109: ovn-nbctl --may-exist lsp-add ls0 lp2 lp4 5"
at_fn_check_prepare_trace "ovn-nbctl.at:109"
( $at_check_trace; ovn-nbctl --may-exist lsp-add ls0 lp2 lp4 5
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: lp2: port already exists with different parent lp3
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:109"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:109: ovn-nbctl --may-exist lsp-add ls0 lp2 lp3 10"
at_fn_check_prepare_trace "ovn-nbctl.at:109"
( $at_check_trace; ovn-nbctl --may-exist lsp-add ls0 lp2 lp3 10
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: lp2: port already exists with different tag_request 5
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:109"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:109: ovn-nbctl clear Logical_Switch_Port lp2 tag_request"
at_fn_check_prepare_trace "ovn-nbctl.at:109"
( $at_check_trace; ovn-nbctl clear Logical_Switch_Port lp2 tag_request
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:109"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:109: ovn-nbctl --may-exist lsp-add ls0 lp2 lp3 5"
at_fn_check_prepare_trace "ovn-nbctl.at:109"
( $at_check_trace; ovn-nbctl --may-exist lsp-add ls0 lp2 lp3 5
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: lp2: port already exists but has no tag_request
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:109"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

    }


    ovn_nbctl_lsp_get_ls() {

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:156: ovn-nbctl ls-add ls0"
at_fn_check_prepare_trace "ovn-nbctl.at:156"
( $at_check_trace; ovn-nbctl ls-add ls0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:156"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:156: ovn-nbctl lsp-add ls0 lp0"
at_fn_check_prepare_trace "ovn-nbctl.at:156"
( $at_check_trace; ovn-nbctl lsp-add ls0 lp0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:156"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:156: ovn-nbctl lsp-get-ls lp0 | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:156"
( $at_check_trace; ovn-nbctl lsp-get-ls lp0 | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "<0> (ls0)
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:156"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:156: ovn-nbctl lsp-get-ls lp1"
at_fn_check_prepare_trace "ovn-nbctl.at:156"
( $at_check_trace; ovn-nbctl lsp-get-ls lp1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: lp1: port name not found
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:156"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

    }


    ovn_nbctl_lport_addresses() {

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:170: ovn-nbctl ls-add ls0"
at_fn_check_prepare_trace "ovn-nbctl.at:170"
( $at_check_trace; ovn-nbctl ls-add ls0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:170"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:170: ovn-nbctl lsp-add ls0 lp0"
at_fn_check_prepare_trace "ovn-nbctl.at:170"
( $at_check_trace; ovn-nbctl lsp-add ls0 lp0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:170"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:170: ovn-nbctl lsp-get-addresses lp0"
at_fn_check_prepare_trace "ovn-nbctl.at:170"
( $at_check_trace; ovn-nbctl lsp-get-addresses lp0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:170"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:170: ovn-nbctl lsp-set-addresses lp0 00:11:22:33:44:55 unknown"
at_fn_check_prepare_trace "ovn-nbctl.at:170"
( $at_check_trace; ovn-nbctl lsp-set-addresses lp0 00:11:22:33:44:55 unknown
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:170"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:170: ovn-nbctl lsp-get-addresses lp0"
at_fn_check_prepare_trace "ovn-nbctl.at:170"
( $at_check_trace; ovn-nbctl lsp-get-addresses lp0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "00:11:22:33:44:55
unknown
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:170"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:170: ovn-nbctl lsp-set-addresses lp0"
at_fn_check_prepare_trace "ovn-nbctl.at:170"
( $at_check_trace; ovn-nbctl lsp-set-addresses lp0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:170"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:170: ovn-nbctl lsp-get-addresses lp0"
at_fn_check_prepare_trace "ovn-nbctl.at:170"
( $at_check_trace; ovn-nbctl lsp-get-addresses lp0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:170"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

    }


    ovn_nbctl_port_security() {

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:188: ovn-nbctl ls-add ls0"
at_fn_check_prepare_trace "ovn-nbctl.at:188"
( $at_check_trace; ovn-nbctl ls-add ls0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:188"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:188: ovn-nbctl lsp-add ls0 lp0"
at_fn_check_prepare_trace "ovn-nbctl.at:188"
( $at_check_trace; ovn-nbctl lsp-add ls0 lp0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:188"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:188: ovn-nbctl lsp-get-addresses lp0"
at_fn_check_prepare_trace "ovn-nbctl.at:188"
( $at_check_trace; ovn-nbctl lsp-get-addresses lp0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:188"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:188: ovn-nbctl lsp-set-port-security lp0 aa:bb:cc:dd:ee:ff 00:11:22:33:44:55"
at_fn_check_prepare_trace "ovn-nbctl.at:188"
( $at_check_trace; ovn-nbctl lsp-set-port-security lp0 aa:bb:cc:dd:ee:ff 00:11:22:33:44:55
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:188"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:188: ovn-nbctl lsp-get-port-security lp0"
at_fn_check_prepare_trace "ovn-nbctl.at:188"
( $at_check_trace; ovn-nbctl lsp-get-port-security lp0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "00:11:22:33:44:55
aa:bb:cc:dd:ee:ff
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:188"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:188: ovn-nbctl lsp-set-port-security lp0"
at_fn_check_prepare_trace "ovn-nbctl.at:188"
( $at_check_trace; ovn-nbctl lsp-set-port-security lp0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:188"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:188: ovn-nbctl lsp-get-port-security lp0"
at_fn_check_prepare_trace "ovn-nbctl.at:188"
( $at_check_trace; ovn-nbctl lsp-get-port-security lp0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:188"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

    }


    ovn_nbctl_acls() {

ovn_nbctl_test_acl() {
   { set +x
$as_echo "$at_srcdir/ovn-nbctl.at:206: ovn-nbctl \$2 --log acl-add \$1 from-lport 600 udp drop"
at_fn_check_prepare_dynamic "ovn-nbctl $2 --log acl-add $1 from-lport 600 udp drop" "ovn-nbctl.at:206"
( $at_check_trace; ovn-nbctl $2 --log acl-add $1 from-lport 600 udp drop
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:206"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

   { set +x
$as_echo "$at_srcdir/ovn-nbctl.at:206: ovn-nbctl \$2 --log --name=test --severity=info acl-add \$1 to-lport 500 udp drop"
at_fn_check_prepare_dynamic "ovn-nbctl $2 --log --name=test --severity=info acl-add $1 to-lport 500 udp drop" "ovn-nbctl.at:206"
( $at_check_trace; ovn-nbctl $2 --log --name=test --severity=info acl-add $1 to-lport 500 udp drop
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:206"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

   { set +x
$as_echo "$at_srcdir/ovn-nbctl.at:206: ovn-nbctl \$2 acl-add \$1 from-lport 400 tcp drop"
at_fn_check_prepare_dynamic "ovn-nbctl $2 acl-add $1 from-lport 400 tcp drop" "ovn-nbctl.at:206"
( $at_check_trace; ovn-nbctl $2 acl-add $1 from-lport 400 tcp drop
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:206"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

   { set +x
$as_echo "$at_srcdir/ovn-nbctl.at:206: ovn-nbctl \$2 acl-add \$1 to-lport 300 tcp drop"
at_fn_check_prepare_dynamic "ovn-nbctl $2 acl-add $1 to-lport 300 tcp drop" "ovn-nbctl.at:206"
( $at_check_trace; ovn-nbctl $2 acl-add $1 to-lport 300 tcp drop
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:206"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

   { set +x
$as_echo "$at_srcdir/ovn-nbctl.at:206: ovn-nbctl \$2 acl-add \$1 from-lport 200 ip drop"
at_fn_check_prepare_dynamic "ovn-nbctl $2 acl-add $1 from-lport 200 ip drop" "ovn-nbctl.at:206"
( $at_check_trace; ovn-nbctl $2 acl-add $1 from-lport 200 ip drop
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:206"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

   { set +x
$as_echo "$at_srcdir/ovn-nbctl.at:206: ovn-nbctl \$2 acl-add \$1 to-lport 100 ip drop"
at_fn_check_prepare_dynamic "ovn-nbctl $2 acl-add $1 to-lport 100 ip drop" "ovn-nbctl.at:206"
( $at_check_trace; ovn-nbctl $2 acl-add $1 to-lport 100 ip drop
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:206"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

      { set +x
$as_echo "$at_srcdir/ovn-nbctl.at:206: ovn-nbctl \$2 acl-add \$1 to-lport 100 ip drop"
at_fn_check_prepare_dynamic "ovn-nbctl $2 acl-add $1 to-lport 100 ip drop" "ovn-nbctl.at:206"
( $at_check_trace; ovn-nbctl $2 acl-add $1 to-lport 100 ip drop
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:206"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

   { set +x
$as_echo "$at_srcdir/ovn-nbctl.at:206: grep 'already existed' stderr"
at_fn_check_prepare_trace "ovn-nbctl.at:206"
( $at_check_trace; grep 'already existed' stderr
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:206"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

   { set +x
$as_echo "$at_srcdir/ovn-nbctl.at:206: ovn-nbctl \$2 --may-exist acl-add \$1 to-lport 100 ip drop"
at_fn_check_prepare_dynamic "ovn-nbctl $2 --may-exist acl-add $1 to-lport 100 ip drop" "ovn-nbctl.at:206"
( $at_check_trace; ovn-nbctl $2 --may-exist acl-add $1 to-lport 100 ip drop
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:206"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


   { set +x
$as_echo "$at_srcdir/ovn-nbctl.at:206: ovn-nbctl \$2 acl-list \$1"
at_fn_check_prepare_dynamic "ovn-nbctl $2 acl-list $1" "ovn-nbctl.at:206"
( $at_check_trace; ovn-nbctl $2 acl-list $1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "from-lport   600 (udp) drop log()
from-lport   400 (tcp) drop
from-lport   200 (ip) drop
  to-lport   500 (udp) drop log(name=test,severity=info)
  to-lport   300 (tcp) drop
  to-lport   100 (ip) drop
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:206"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


      { set +x
$as_echo "$at_srcdir/ovn-nbctl.at:206: ovn-nbctl \$2 acl-del \$1 to-lport"
at_fn_check_prepare_dynamic "ovn-nbctl $2 acl-del $1 to-lport" "ovn-nbctl.at:206"
( $at_check_trace; ovn-nbctl $2 acl-del $1 to-lport
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:206"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

   { set +x
$as_echo "$at_srcdir/ovn-nbctl.at:206: ovn-nbctl \$2 acl-list \$1"
at_fn_check_prepare_dynamic "ovn-nbctl $2 acl-list $1" "ovn-nbctl.at:206"
( $at_check_trace; ovn-nbctl $2 acl-list $1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "from-lport   600 (udp) drop log()
from-lport   400 (tcp) drop
from-lport   200 (ip) drop
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:206"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


      { set +x
$as_echo "$at_srcdir/ovn-nbctl.at:206: ovn-nbctl \$2 acl-del \$1"
at_fn_check_prepare_dynamic "ovn-nbctl $2 acl-del $1" "ovn-nbctl.at:206"
( $at_check_trace; ovn-nbctl $2 acl-del $1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:206"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

   { set +x
$as_echo "$at_srcdir/ovn-nbctl.at:206: ovn-nbctl \$2 acl-list \$1"
at_fn_check_prepare_dynamic "ovn-nbctl $2 acl-list $1" "ovn-nbctl.at:206"
( $at_check_trace; ovn-nbctl $2 acl-list $1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:206"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


   { set +x
$as_echo "$at_srcdir/ovn-nbctl.at:206: ovn-nbctl \$2 acl-add \$1 from-lport 600 udp drop"
at_fn_check_prepare_dynamic "ovn-nbctl $2 acl-add $1 from-lport 600 udp drop" "ovn-nbctl.at:206"
( $at_check_trace; ovn-nbctl $2 acl-add $1 from-lport 600 udp drop
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:206"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

   { set +x
$as_echo "$at_srcdir/ovn-nbctl.at:206: ovn-nbctl \$2 acl-add \$1 from-lport 400 tcp drop"
at_fn_check_prepare_dynamic "ovn-nbctl $2 acl-add $1 from-lport 400 tcp drop" "ovn-nbctl.at:206"
( $at_check_trace; ovn-nbctl $2 acl-add $1 from-lport 400 tcp drop
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:206"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

   { set +x
$as_echo "$at_srcdir/ovn-nbctl.at:206: ovn-nbctl \$2 acl-add \$1 from-lport 200 ip drop"
at_fn_check_prepare_dynamic "ovn-nbctl $2 acl-add $1 from-lport 200 ip drop" "ovn-nbctl.at:206"
( $at_check_trace; ovn-nbctl $2 acl-add $1 from-lport 200 ip drop
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:206"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


      { set +x
$as_echo "$at_srcdir/ovn-nbctl.at:206: ovn-nbctl \$2 acl-del \$1 from-lport 400 tcp"
at_fn_check_prepare_dynamic "ovn-nbctl $2 acl-del $1 from-lport 400 tcp" "ovn-nbctl.at:206"
( $at_check_trace; ovn-nbctl $2 acl-del $1 from-lport 400 tcp
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:206"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

   { set +x
$as_echo "$at_srcdir/ovn-nbctl.at:206: ovn-nbctl \$2 acl-list \$1"
at_fn_check_prepare_dynamic "ovn-nbctl $2 acl-list $1" "ovn-nbctl.at:206"
( $at_check_trace; ovn-nbctl $2 acl-list $1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "from-lport   600 (udp) drop
from-lport   200 (ip) drop
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:206"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

}

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:206: ovn-nbctl ls-add ls0"
at_fn_check_prepare_trace "ovn-nbctl.at:206"
( $at_check_trace; ovn-nbctl ls-add ls0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:206"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

ovn_nbctl_test_acl ls0
{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:206: ovn-nbctl ls-add ls1"
at_fn_check_prepare_trace "ovn-nbctl.at:206"
( $at_check_trace; ovn-nbctl ls-add ls1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:206"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

ovn_nbctl_test_acl ls1 --type=switch
{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:206: ovn-nbctl create port_group name=pg0"
at_fn_check_prepare_trace "ovn-nbctl.at:206"
( $at_check_trace; ovn-nbctl create port_group name=pg0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:206"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

ovn_nbctl_test_acl pg0 --type=port-group

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:206: ovn-nbctl --type=port-group acl-add pg1 to-lport 100 ip drop"
at_fn_check_prepare_trace "ovn-nbctl.at:206"
( $at_check_trace; ovn-nbctl --type=port-group acl-add pg1 to-lport 100 ip drop
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: pg1: port group name not found
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:206"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:206: ovn-nbctl create port_group name=ls0"
at_fn_check_prepare_trace "ovn-nbctl.at:206"
( $at_check_trace; ovn-nbctl create port_group name=ls0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:206"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:206: ovn-nbctl acl-add ls0 to-lport 100 ip drop"
at_fn_check_prepare_trace "ovn-nbctl.at:206"
( $at_check_trace; ovn-nbctl acl-add ls0 to-lport 100 ip drop
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:206"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:206: grep 'exists in both' stderr"
at_fn_check_prepare_trace "ovn-nbctl.at:206"
( $at_check_trace; grep 'exists in both' stderr
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:206"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:206: ovn-nbctl --type=port-group acl-add ls0 to-lport 100 ip drop"
at_fn_check_prepare_trace "ovn-nbctl.at:206"
( $at_check_trace; ovn-nbctl --type=port-group acl-add ls0 to-lport 100 ip drop
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:206"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

    }


    ovn_nbctl_qos() {

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:273: ovn-nbctl ls-add ls0"
at_fn_check_prepare_trace "ovn-nbctl.at:273"
( $at_check_trace; ovn-nbctl ls-add ls0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:273"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:273: ovn-nbctl qos-add ls0 from-lport 600 tcp dscp=63"
at_fn_check_prepare_trace "ovn-nbctl.at:273"
( $at_check_trace; ovn-nbctl qos-add ls0 from-lport 600 tcp dscp=63
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:273"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:273: ovn-nbctl qos-add ls0 from-lport 500 udp rate=100 burst=1000"
at_fn_check_prepare_trace "ovn-nbctl.at:273"
( $at_check_trace; ovn-nbctl qos-add ls0 from-lport 500 udp rate=100 burst=1000
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:273"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:273: ovn-nbctl qos-add ls0 from-lport 400 tcp dscp=0 rate=300 burst=3000"
at_fn_check_prepare_trace "ovn-nbctl.at:273"
( $at_check_trace; ovn-nbctl qos-add ls0 from-lport 400 tcp dscp=0 rate=300 burst=3000
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:273"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:273: ovn-nbctl qos-add ls0 to-lport 300 tcp dscp=48"
at_fn_check_prepare_trace "ovn-nbctl.at:273"
( $at_check_trace; ovn-nbctl qos-add ls0 to-lport 300 tcp dscp=48
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:273"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:273: ovn-nbctl qos-add ls0 to-lport 200 ip rate=101"
at_fn_check_prepare_trace "ovn-nbctl.at:273"
( $at_check_trace; ovn-nbctl qos-add ls0 to-lport 200 ip rate=101
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:273"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:273: ovn-nbctl qos-add ls0 to-lport 100 ip4 dscp=13 rate=301 burst=30000"
at_fn_check_prepare_trace "ovn-nbctl.at:273"
( $at_check_trace; ovn-nbctl qos-add ls0 to-lport 100 ip4 dscp=13 rate=301 burst=30000
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:273"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:273: ovn-nbctl qos-add ls0 to-lport 100 ip4 dscp=11 rate=302 burst=30002"
at_fn_check_prepare_trace "ovn-nbctl.at:273"
( $at_check_trace; ovn-nbctl qos-add ls0 to-lport 100 ip4 dscp=11 rate=302 burst=30002
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:273"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:273: grep 'already existed' stderr"
at_fn_check_prepare_trace "ovn-nbctl.at:273"
( $at_check_trace; grep 'already existed' stderr
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:273"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:273: ovn-nbctl --may-exist qos-add ls0 to-lport 100 ip4 dscp=11 rate=302 burst=30002"
at_fn_check_prepare_trace "ovn-nbctl.at:273"
( $at_check_trace; ovn-nbctl --may-exist qos-add ls0 to-lport 100 ip4 dscp=11 rate=302 burst=30002
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:273"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:273: ovn-nbctl qos-list ls0"
at_fn_check_prepare_trace "ovn-nbctl.at:273"
( $at_check_trace; ovn-nbctl qos-list ls0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "from-lport   600 (tcp) dscp=63
from-lport   500 (udp) rate=100 burst=1000
from-lport   400 (tcp) rate=300 burst=3000 dscp=0
  to-lport   300 (tcp) dscp=48
  to-lport   200 (ip) rate=101
  to-lport   100 (ip4) rate=301 burst=30000 dscp=13
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:273"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:273: ovn-nbctl qos-del ls0 to-lport"
at_fn_check_prepare_trace "ovn-nbctl.at:273"
( $at_check_trace; ovn-nbctl qos-del ls0 to-lport
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:273"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:273: ovn-nbctl qos-list ls0"
at_fn_check_prepare_trace "ovn-nbctl.at:273"
( $at_check_trace; ovn-nbctl qos-list ls0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "from-lport   600 (tcp) dscp=63
from-lport   500 (udp) rate=100 burst=1000
from-lport   400 (tcp) rate=300 burst=3000 dscp=0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:273"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:273: ovn-nbctl qos-del ls0"
at_fn_check_prepare_trace "ovn-nbctl.at:273"
( $at_check_trace; ovn-nbctl qos-del ls0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:273"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:273: ovn-nbctl qos-list ls0"
at_fn_check_prepare_trace "ovn-nbctl.at:273"
( $at_check_trace; ovn-nbctl qos-list ls0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:273"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:273: ovn-nbctl qos-add ls0 from-lport 600 ip rate=1000101"
at_fn_check_prepare_trace "ovn-nbctl.at:273"
( $at_check_trace; ovn-nbctl qos-add ls0 from-lport 600 ip rate=1000101
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:273"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:273: ovn-nbctl qos-add ls0 from-lport 400 tcp dscp=44"
at_fn_check_prepare_trace "ovn-nbctl.at:273"
( $at_check_trace; ovn-nbctl qos-add ls0 from-lport 400 tcp dscp=44
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:273"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:273: ovn-nbctl qos-add ls0 from-lport 200 ip burst=1000102 rate=301 dscp=19"
at_fn_check_prepare_trace "ovn-nbctl.at:273"
( $at_check_trace; ovn-nbctl qos-add ls0 from-lport 200 ip burst=1000102 rate=301 dscp=19
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:273"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:273: ovn-nbctl qos-del ls0 from-lport 400 tcp"
at_fn_check_prepare_trace "ovn-nbctl.at:273"
( $at_check_trace; ovn-nbctl qos-del ls0 from-lport 400 tcp
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:273"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:273: ovn-nbctl qos-list ls0"
at_fn_check_prepare_trace "ovn-nbctl.at:273"
( $at_check_trace; ovn-nbctl qos-list ls0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "from-lport   600 (ip) rate=1000101
from-lport   200 (ip) rate=301 burst=1000102 dscp=19
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:273"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:273: ovn-nbctl qos-add ls0 from-lport 600 ip rate=100010111111"
at_fn_check_prepare_trace "ovn-nbctl.at:273"
( $at_check_trace; ovn-nbctl qos-add ls0 from-lport 600 ip rate=100010111111
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: 100010111111: rate must be in the range 1...4294967295
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:273"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:273: ovn-nbctl qos-add ls0 from-lport 600 ip burst=100010111112 rate=100010"
at_fn_check_prepare_trace "ovn-nbctl.at:273"
( $at_check_trace; ovn-nbctl qos-add ls0 from-lport 600 ip burst=100010111112 rate=100010
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: 100010111112: burst must be in the range 1...4294967295
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:273"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:273: ovn-nbctl qos-add ls0 from-lport 600 ip dscp=-1"
at_fn_check_prepare_trace "ovn-nbctl.at:273"
( $at_check_trace; ovn-nbctl qos-add ls0 from-lport 600 ip dscp=-1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: -1: dscp must be in the range 0...63
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:273"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:273: ovn-nbctl qos-add ls0 from-lport 600 ip dscpa=-1"
at_fn_check_prepare_trace "ovn-nbctl.at:273"
( $at_check_trace; ovn-nbctl qos-add ls0 from-lport 600 ip dscpa=-1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: dscpa=-1: supported arguments are \"dscp=\", \"rate=\", and \"burst=\"
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:273"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:273: ovn-nbctl qos-add ls0 from-lport 600 ip burst=123"
at_fn_check_prepare_trace "ovn-nbctl.at:273"
( $at_check_trace; ovn-nbctl qos-add ls0 from-lport 600 ip burst=123
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: Either \"rate\" and/or \"dscp\" must be specified
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:273"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

    }


    ovn_nbctl_meters() {

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:342: ovn-nbctl meter-add meter1 drop 10 kbps"
at_fn_check_prepare_trace "ovn-nbctl.at:342"
( $at_check_trace; ovn-nbctl meter-add meter1 drop 10 kbps
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:342"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:342: ovn-nbctl meter-add meter2 drop 3 kbps 2"
at_fn_check_prepare_trace "ovn-nbctl.at:342"
( $at_check_trace; ovn-nbctl meter-add meter2 drop 3 kbps 2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:342"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:342: ovn-nbctl meter-add meter3 drop 100 kbps 200"
at_fn_check_prepare_trace "ovn-nbctl.at:342"
( $at_check_trace; ovn-nbctl meter-add meter3 drop 100 kbps 200
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:342"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:342: ovn-nbctl meter-add meter4 drop 10 pktps 30"
at_fn_check_prepare_trace "ovn-nbctl.at:342"
( $at_check_trace; ovn-nbctl meter-add meter4 drop 10 pktps 30
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:342"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:342: ovn-nbctl meter-add meter1 drop 10 kbps"
at_fn_check_prepare_trace "ovn-nbctl.at:342"
( $at_check_trace; ovn-nbctl meter-add meter1 drop 10 kbps
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:342"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:342: grep 'already exists' stderr"
at_fn_check_prepare_trace "ovn-nbctl.at:342"
( $at_check_trace; grep 'already exists' stderr
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:342"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:342: ovn-nbctl meter-add __meter1 drop 10 kbps"
at_fn_check_prepare_trace "ovn-nbctl.at:342"
( $at_check_trace; ovn-nbctl meter-add __meter1 drop 10 kbps
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:342"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:342: grep 'reserved' stderr"
at_fn_check_prepare_trace "ovn-nbctl.at:342"
( $at_check_trace; grep 'reserved' stderr
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:342"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:342: ovn-nbctl meter-add meter5 drop 100010111111 kbps"
at_fn_check_prepare_trace "ovn-nbctl.at:342"
( $at_check_trace; ovn-nbctl meter-add meter5 drop 100010111111 kbps
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: rate must be in the range 1...4294967295
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:342"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:342: ovn-nbctl meter-add meter5 drop 100010111111 foo"
at_fn_check_prepare_trace "ovn-nbctl.at:342"
( $at_check_trace; ovn-nbctl meter-add meter5 drop 100010111111 foo
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: rate must be in the range 1...4294967295
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:342"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:342: ovn-nbctl meter-add meter5 drop 0 kbps"
at_fn_check_prepare_trace "ovn-nbctl.at:342"
( $at_check_trace; ovn-nbctl meter-add meter5 drop 0 kbps
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: rate must be in the range 1...4294967295
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:342"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:342: ovn-nbctl meter-add meter5 drop 10 100010111111 kbps"
at_fn_check_prepare_trace "ovn-nbctl.at:342"
( $at_check_trace; ovn-nbctl meter-add meter5 drop 10 100010111111 kbps
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: unit must be \"kbps\" or \"pktps\"
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:342"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:342: ovn-nbctl meter-list"
at_fn_check_prepare_trace "ovn-nbctl.at:342"
( $at_check_trace; ovn-nbctl meter-list
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "meter1: bands:
  drop: 10 kbps
meter2: bands:
  drop: 3 kbps, 2 kb burst
meter3: bands:
  drop: 100 kbps, 200 kb burst
meter4: bands:
  drop: 10 pktps, 30 packet burst
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:342"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:342: ovn-nbctl meter-del meter2"
at_fn_check_prepare_trace "ovn-nbctl.at:342"
( $at_check_trace; ovn-nbctl meter-del meter2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:342"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:342: ovn-nbctl meter-list"
at_fn_check_prepare_trace "ovn-nbctl.at:342"
( $at_check_trace; ovn-nbctl meter-list
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "meter1: bands:
  drop: 10 kbps
meter3: bands:
  drop: 100 kbps, 200 kb burst
meter4: bands:
  drop: 10 pktps, 30 packet burst
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:342"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:342: ovn-nbctl meter-del"
at_fn_check_prepare_trace "ovn-nbctl.at:342"
( $at_check_trace; ovn-nbctl meter-del
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:342"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:342: ovn-nbctl meter-list"
at_fn_check_prepare_trace "ovn-nbctl.at:342"
( $at_check_trace; ovn-nbctl meter-list
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:342"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

    }


    ovn_nbctl_nats() {

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl lr-add lr0"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl lr-add lr0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl lr-nat-add lr0 snatt 30.0.0.2 192.168.1.2"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl lr-nat-add lr0 snatt 30.0.0.2 192.168.1.2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: snatt: type must be one of \"dnat\", \"snat\" and \"dnat_and_snat\".
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl lr-nat-add lr0 snat 30.0.0.2a 192.168.1.2"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl lr-nat-add lr0 snat 30.0.0.2a 192.168.1.2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: 30.0.0.2a: Not a valid IPv4 or IPv6 address.
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl lr-nat-add lr0 snat 30.0.0 192.168.1.2"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl lr-nat-add lr0 snat 30.0.0 192.168.1.2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: 30.0.0: Not a valid IPv4 or IPv6 address.
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl lr-nat-add lr0 snat 30.0.0.2/24 192.168.1.2"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl lr-nat-add lr0 snat 30.0.0.2/24 192.168.1.2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: 30.0.0.2/24: Not a valid IPv4 or IPv6 address.
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl lr-nat-add lr0 snat 30.0.0.2:80 192.168.1.2"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl lr-nat-add lr0 snat 30.0.0.2:80 192.168.1.2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: 30.0.0.2:80: Not a valid IPv4 or IPv6 address.
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl lr-nat-add lr0 snat 30.0.0.2 192.168.1.2a"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl lr-nat-add lr0 snat 30.0.0.2 192.168.1.2a
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: 192.168.1.2a: should be an IPv4 address or network.
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl lr-nat-add lr0 snat 30.0.0.2 192.168.1"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl lr-nat-add lr0 snat 30.0.0.2 192.168.1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: 192.168.1: should be an IPv4 address or network.
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl lr-nat-add lr0 snat 30.0.0.2 192.168.1.2:80"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl lr-nat-add lr0 snat 30.0.0.2 192.168.1.2:80
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: 192.168.1.2:80: should be an IPv4 address or network.
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl lr-nat-add lr0 snat 30.0.0.2 192.168.1.2/a"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl lr-nat-add lr0 snat 30.0.0.2 192.168.1.2/a
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: 192.168.1.2/a: should be an IPv4 address or network.
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl lr-nat-add lr0 dnat 30.0.0.2 192.168.1.2a"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl lr-nat-add lr0 dnat 30.0.0.2 192.168.1.2a
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: 192.168.1.2a: Not a valid IPv4 address.
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl lr-nat-add lr0 dnat 30.0.0.2 192.168.1"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl lr-nat-add lr0 dnat 30.0.0.2 192.168.1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: 192.168.1: Not a valid IPv4 address.
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl lr-nat-add lr0 dnat 30.0.0.2 192.168.1.2:80"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl lr-nat-add lr0 dnat 30.0.0.2 192.168.1.2:80
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: 192.168.1.2:80: Not a valid IPv4 address.
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl lr-nat-add lr0 dnat 30.0.0.2 192.168.1.2/24"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl lr-nat-add lr0 dnat 30.0.0.2 192.168.1.2/24
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: 192.168.1.2/24: Not a valid IPv4 address.
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl lr-nat-add lr0 dnat_and_snat 30.0.0.2 192.168.1.2/24"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl lr-nat-add lr0 dnat_and_snat 30.0.0.2 192.168.1.2/24
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: 192.168.1.2/24: Not a valid IPv4 address.
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl lr-nat-add lr0 dnat_and_snat 30.0.0.2 192.168.1.2 lp0"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl lr-nat-add lr0 dnat_and_snat 30.0.0.2 192.168.1.2 lp0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: lr-nat-add with logical_port must also specify external_mac.
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl lr-nat-add lr0 dnat 30.0.0.2 192.168.1.2 lp0 00:00:00:01:02:03"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl lr-nat-add lr0 dnat 30.0.0.2 192.168.1.2 lp0 00:00:00:01:02:03
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: logical_port and external_mac are only valid when type is \"dnat_and_snat\".
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl lr-nat-add lr0 snat 30.0.0.2 192.168.1.2 lp0 00:00:00:01:02:03"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl lr-nat-add lr0 snat 30.0.0.2 192.168.1.2 lp0 00:00:00:01:02:03
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: logical_port and external_mac are only valid when type is \"dnat_and_snat\".
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl lr-nat-add lr0 dnat_and_snat 30.0.0.2 192.168.1.2 lp0 00:00:00:01:02:03"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl lr-nat-add lr0 dnat_and_snat 30.0.0.2 192.168.1.2 lp0 00:00:00:01:02:03
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: lp0: port name not found
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl ls-add ls0"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl ls-add ls0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl lsp-add ls0 lp0"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl lsp-add ls0 lp0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl lr-nat-add lr0 dnat_and_snat 30.0.0.2 192.168.1.2 lp0 00:00:00:01:02"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl lr-nat-add lr0 dnat_and_snat 30.0.0.2 192.168.1.2 lp0 00:00:00:01:02
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: invalid mac address 00:00:00:01:02.
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl lr-nat-add lr0 snat 30.0.0.1 192.168.1.0/24"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl lr-nat-add lr0 snat 30.0.0.1 192.168.1.0/24
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl lr-nat-add lr0 snat fd01::1 fd11::/64"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl lr-nat-add lr0 snat fd01::1 fd11::/64
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl lr-nat-add lr0 dnat 30.0.0.1 192.168.1.2"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl lr-nat-add lr0 dnat 30.0.0.1 192.168.1.2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl lr-nat-add lr0 dnat fd01::1 fd11::2"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl lr-nat-add lr0 dnat fd01::1 fd11::2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl lr-nat-add lr0 dnat_and_snat 30.0.0.1 192.168.1.2"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl lr-nat-add lr0 dnat_and_snat 30.0.0.1 192.168.1.2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl lr-nat-add lr0 dnat_and_snat fd01::1 fd11::2"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl lr-nat-add lr0 dnat_and_snat fd01::1 fd11::2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl lr-nat-add lr0 dnat_and_snat 30.0.0.2 192.168.1.3 lp0 00:00:00:01:02:03"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl lr-nat-add lr0 dnat_and_snat 30.0.0.2 192.168.1.3 lp0 00:00:00:01:02:03
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl lr-nat-add lr0 dnat_and_snat fd01::2 fd11::3 lp0 00:00:00:01:02:03"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl lr-nat-add lr0 dnat_and_snat fd01::2 fd11::3 lp0 00:00:00:01:02:03
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl lr-nat-list lr0"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl lr-nat-list lr0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "TYPE             EXTERNAL_IP        LOGICAL_IP            EXTERNAL_MAC         LOGICAL_PORT
dnat             30.0.0.1           192.168.1.2
dnat             fd01::1            fd11::2
dnat_and_snat    30.0.0.1           192.168.1.2
dnat_and_snat    30.0.0.2           192.168.1.3           00:00:00:01:02:03    lp0
dnat_and_snat    fd01::1            fd11::2
dnat_and_snat    fd01::2            fd11::3               00:00:00:01:02:03    lp0
snat             30.0.0.1           192.168.1.0/24
snat             fd01::1            fd11::/64
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl lr-nat-add lr0 snat 30.0.0.1 192.168.1.0/24"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl lr-nat-add lr0 snat 30.0.0.1 192.168.1.0/24
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: 30.0.0.1, 192.168.1.0/24: a NAT with this external_ip and logical_ip already exists
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl lr-nat-add lr0 snat 30.0.0.1 192.168.1.10/24"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl lr-nat-add lr0 snat 30.0.0.1 192.168.1.10/24
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: 30.0.0.1, 192.168.1.0/24: a NAT with this external_ip and logical_ip already exists
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl --may-exist lr-nat-add lr0 snat 30.0.0.1 192.168.1.0/24"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl --may-exist lr-nat-add lr0 snat 30.0.0.1 192.168.1.0/24
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl lr-nat-add lr0 snat 30.0.0.2 192.168.1.0/24"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl lr-nat-add lr0 snat 30.0.0.2 192.168.1.0/24
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: a NAT with this type (snat) and logical_ip (192.168.1.0/24) already exists
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl lr-nat-add lr0 dnat 30.0.0.1 192.168.1.2"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl lr-nat-add lr0 dnat 30.0.0.1 192.168.1.2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: 30.0.0.1, 192.168.1.2: a NAT with this external_ip and logical_ip already exists
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl --may-exist lr-nat-add lr0 dnat 30.0.0.1 192.168.1.2"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl --may-exist lr-nat-add lr0 dnat 30.0.0.1 192.168.1.2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl lr-nat-add lr0 dnat 30.0.0.1 192.168.1.3"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl lr-nat-add lr0 dnat 30.0.0.1 192.168.1.3
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: a NAT with this type (dnat) and external_ip (30.0.0.1) already exists
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl lr-nat-add lr0 dnat_and_snat 30.0.0.1 192.168.1.2"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl lr-nat-add lr0 dnat_and_snat 30.0.0.1 192.168.1.2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: 30.0.0.1, 192.168.1.2: a NAT with this external_ip and logical_ip already exists
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl --may-exist lr-nat-add lr0 dnat_and_snat 30.0.0.1 192.168.1.2"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl --may-exist lr-nat-add lr0 dnat_and_snat 30.0.0.1 192.168.1.2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl lr-nat-add lr0 dnat_and_snat 30.0.0.1 192.168.1.3"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl lr-nat-add lr0 dnat_and_snat 30.0.0.1 192.168.1.3
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: a NAT with this type (dnat_and_snat) and external_ip (30.0.0.1) already exists
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl --may-exist lr-nat-add lr0 dnat_and_snat 30.0.0.2 192.168.1.3 lp0 00:00:00:04:05:06"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl --may-exist lr-nat-add lr0 dnat_and_snat 30.0.0.2 192.168.1.3 lp0 00:00:00:04:05:06
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl lr-nat-list lr0"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl lr-nat-list lr0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "TYPE             EXTERNAL_IP        LOGICAL_IP            EXTERNAL_MAC         LOGICAL_PORT
dnat             30.0.0.1           192.168.1.2
dnat             fd01::1            fd11::2
dnat_and_snat    30.0.0.1           192.168.1.2
dnat_and_snat    30.0.0.2           192.168.1.3           00:00:00:04:05:06    lp0
dnat_and_snat    fd01::1            fd11::2
dnat_and_snat    fd01::2            fd11::3               00:00:00:01:02:03    lp0
snat             30.0.0.1           192.168.1.0/24
snat             fd01::1            fd11::/64
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl --may-exist lr-nat-add lr0 dnat_and_snat 30.0.0.2 192.168.1.3"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl --may-exist lr-nat-add lr0 dnat_and_snat 30.0.0.2 192.168.1.3
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl --may-exist lr-nat-add lr0 dnat_and_snat fd01::2 fd11::3"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl --may-exist lr-nat-add lr0 dnat_and_snat fd01::2 fd11::3
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl lr-nat-list lr0"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl lr-nat-list lr0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "TYPE             EXTERNAL_IP        LOGICAL_IP            EXTERNAL_MAC         LOGICAL_PORT
dnat             30.0.0.1           192.168.1.2
dnat             fd01::1            fd11::2
dnat_and_snat    30.0.0.1           192.168.1.2
dnat_and_snat    30.0.0.2           192.168.1.3
dnat_and_snat    fd01::1            fd11::2
dnat_and_snat    fd01::2            fd11::3
snat             30.0.0.1           192.168.1.0/24
snat             fd01::1            fd11::/64
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl --bare --columns=options list nat | grep stateless=true| wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl --bare --columns=options list nat | grep stateless=true| wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl --stateless lr-nat-add lr0 dnat_and_snat 40.0.0.2 192.168.1.4"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl --stateless lr-nat-add lr0 dnat_and_snat 40.0.0.2 192.168.1.4
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl --bare --columns=options list nat | grep stateless=true| wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl --bare --columns=options list nat | grep stateless=true| wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl --stateless lr-nat-add lr0 dnat_and_snat fd21::1 fd11::2"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl --stateless lr-nat-add lr0 dnat_and_snat fd21::1 fd11::2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl --bare --columns=options list nat | grep stateless=true| wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl --bare --columns=options list nat | grep stateless=true| wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "2
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl lr-nat-del lr0 dnat_and_snat fd21::1"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl lr-nat-del lr0 dnat_and_snat fd21::1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl --stateless lr-nat-add lr0 dnat 40.0.0.2 192.168.1.4"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl --stateless lr-nat-add lr0 dnat 40.0.0.2 192.168.1.4
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: stateless is not applicable to dnat or snat types
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl --stateless lr-nat-add lr0 snat 40.0.0.2 192.168.1.4"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl --stateless lr-nat-add lr0 snat 40.0.0.2 192.168.1.4
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: stateless is not applicable to dnat or snat types
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl lr-nat-add lr0 snat 40.0.0.2 192.168.1.5"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl lr-nat-add lr0 snat 40.0.0.2 192.168.1.5
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: 40.0.0.2, 192.168.1.5: External ip cannot be shared across stateless and stateful NATs
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl lr-nat-add lr0 dnat 40.0.0.2 192.168.1.5"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl lr-nat-add lr0 dnat 40.0.0.2 192.168.1.5
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: 40.0.0.2, 192.168.1.5: External ip cannot be shared across stateless and stateful NATs
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl lr-nat-add lr0 snat 40.0.0.3 192.168.1.6"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl lr-nat-add lr0 snat 40.0.0.3 192.168.1.6
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl --stateless lr-nat-add lr0 dnat_and_snat 40.0.0.3 192.168.1.7"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl --stateless lr-nat-add lr0 dnat_and_snat 40.0.0.3 192.168.1.7
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: 40.0.0.3, 192.168.1.7: External ip cannot be shared across stateless and stateful NATs
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl lr-nat-del lr0 dnat_and_snat 30.0.0.3"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl lr-nat-del lr0 dnat_and_snat 30.0.0.3
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: no matching NAT with the type (dnat_and_snat) and external_ip (30.0.0.3)
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl lr-nat-del lr0 dnat 30.0.0.2"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl lr-nat-del lr0 dnat 30.0.0.2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: no matching NAT with the type (dnat) and external_ip (30.0.0.2)
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl lr-nat-del lr0 snat 192.168.10.0/24"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl lr-nat-del lr0 snat 192.168.10.0/24
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: no matching NAT with the type (snat) and logical_ip (192.168.10.0/24)
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl --if-exists lr-nat-del lr0 snat 192.168.10.0/24"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl --if-exists lr-nat-del lr0 snat 192.168.10.0/24
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl lr-nat-del lr0 dnat_and_snat 30.0.0.1"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl lr-nat-del lr0 dnat_and_snat 30.0.0.1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl lr-nat-del lr0 dnat_and_snat fd01::1"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl lr-nat-del lr0 dnat_and_snat fd01::1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl lr-nat-list lr0"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl lr-nat-list lr0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "TYPE             EXTERNAL_IP        LOGICAL_IP            EXTERNAL_MAC         LOGICAL_PORT
dnat             30.0.0.1           192.168.1.2
dnat             fd01::1            fd11::2
dnat_and_snat    30.0.0.2           192.168.1.3
dnat_and_snat    40.0.0.2           192.168.1.4
dnat_and_snat    fd01::2            fd11::3
snat             30.0.0.1           192.168.1.0/24
snat             40.0.0.3           192.168.1.6
snat             fd01::1            fd11::/64
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl lr-nat-del lr0 dnat"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl lr-nat-del lr0 dnat
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl lr-nat-list lr0"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl lr-nat-list lr0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "TYPE             EXTERNAL_IP        LOGICAL_IP            EXTERNAL_MAC         LOGICAL_PORT
dnat_and_snat    30.0.0.2           192.168.1.3
dnat_and_snat    40.0.0.2           192.168.1.4
dnat_and_snat    fd01::2            fd11::3
snat             30.0.0.1           192.168.1.0/24
snat             40.0.0.3           192.168.1.6
snat             fd01::1            fd11::/64
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl lr-nat-del lr0"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl lr-nat-del lr0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl lr-nat-list lr0"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl lr-nat-list lr0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl lr-nat-del lr0"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl lr-nat-del lr0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:404: ovn-nbctl lr-nat-del lr0 dnat"
at_fn_check_prepare_trace "ovn-nbctl.at:404"
( $at_check_trace; ovn-nbctl lr-nat-del lr0 dnat
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:404"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

    }


    ovn_nbctl_lbs() {

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl -vsocket_util:off lb-add lb0 30.0.0.10:80a 192.168.10.10:80,192.168.10.20:80 tcp"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl -vsocket_util:off lb-add lb0 30.0.0.10:80a 192.168.10.10:80,192.168.10.20:80 tcp
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: 30.0.0.10:80a: should be an IP address (or an IP address and a port number with : as a separator).
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl -vsocket_util:off lb-add lb0 30.0.0.10:a80 192.168.10.10:80,192.168.10.20:80 tcp"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl -vsocket_util:off lb-add lb0 30.0.0.10:a80 192.168.10.10:80,192.168.10.20:80 tcp
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: 30.0.0.10:a80: should be an IP address (or an IP address and a port number with : as a separator).
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl -vsocket_util:off lb-add lb0 30.0.0.10:80 192.168.10.10:80,192.168.10.20 tcp"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl -vsocket_util:off lb-add lb0 30.0.0.10:80 192.168.10.10:80,192.168.10.20 tcp
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: 192.168.10.20: should be an IP address and a port number with : as a separator.
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl -vsocket_util:off lb-add lb0 30.0.0.1a 192.168.10.10:80,192.168.10.20:80"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl -vsocket_util:off lb-add lb0 30.0.0.1a 192.168.10.10:80,192.168.10.20:80
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: 30.0.0.1a: should be an IP address (or an IP address and a port number with : as a separator).
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl -vsocket_util:off lb-add lb0 30.0.0 192.168.10.10:80,192.168.10.20:80"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl -vsocket_util:off lb-add lb0 30.0.0 192.168.10.10:80,192.168.10.20:80
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: 30.0.0: should be an IP address (or an IP address and a port number with : as a separator).
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl -vsocket_util:off lb-add lb0 30.0.0.10 192.168.10.10,192.168.10.20:80"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl -vsocket_util:off lb-add lb0 30.0.0.10 192.168.10.10,192.168.10.20:80
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: 192.168.10.20:80: should be an IP address.
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl -vsocket_util:off lb-add lb0 30.0.0.10 192.168.10.10:a80"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl -vsocket_util:off lb-add lb0 30.0.0.10 192.168.10.10:a80
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: 192.168.10.10:a80: should be an IP address.
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl -vsocket_util:off lb-add lb0 30.0.0.10 192.168.10.10:"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl -vsocket_util:off lb-add lb0 30.0.0.10 192.168.10.10:
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: 192.168.10.10:: should be an IP address.
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl -vsocket_util:off lb-add lb0 30.0.0.10 192.168.10.1a"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl -vsocket_util:off lb-add lb0 30.0.0.10 192.168.10.1a
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: 192.168.10.1a: should be an IP address.
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl lb-add lb0 30.0.0.10: 192.168.10.10:80,192.168.10.20:80 tcp"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl lb-add lb0 30.0.0.10: 192.168.10.10:80,192.168.10.20:80 tcp
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: Protocol is unnecessary when no port of vip is given.
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl lb-add lb0 30.0.0.10 192.168.10.10 tcp"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl lb-add lb0 30.0.0.10 192.168.10.10 tcp
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: Protocol is unnecessary when no port of vip is given.
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl lb-add lb0 30.0.0.10 192.168.10.10:900 tcp"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl lb-add lb0 30.0.0.10 192.168.10.10:900 tcp
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: Protocol is unnecessary when no port of vip is given.
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl lb-add lb0 30.0.0.10:80 ,,,192.168.10.10:80,,,,,"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl lb-add lb0 30.0.0.10:80 ,,,192.168.10.10:80,,,,,
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl lb-add lb1 30.0.0.10:80 ,,,192.168.10.10:80,,,,192.168.10.20:80,,,,"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl lb-add lb1 30.0.0.10:80 ,,,192.168.10.10:80,,,,192.168.10.20:80,,,,
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl lb-list | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl lb-list | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "UUID                                    LB                  PROTO      VIP             IPs
<0>    lb0                 tcp        30.0.0.10:80    192.168.10.10:80
<1>    lb1                 tcp        30.0.0.10:80    192.168.10.10:80,192.168.10.20:80
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl lb-del lb0"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl lb-del lb0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl lb-del lb1"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl lb-del lb1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl lb-add lb0 30.0.0.10:80 192.168.10.10:80,192.168.10.20:80"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl lb-add lb0 30.0.0.10:80 192.168.10.10:80,192.168.10.20:80
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl lb-add lb1 30.0.0.10:80 192.168.10.10:80,192.168.10.20:80 tcp"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl lb-add lb1 30.0.0.10:80 192.168.10.10:80,192.168.10.20:80 tcp
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl lb-list | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl lb-list | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "UUID                                    LB                  PROTO      VIP             IPs
<0>    lb0                 tcp        30.0.0.10:80    192.168.10.10:80,192.168.10.20:80
<1>    lb1                 tcp        30.0.0.10:80    192.168.10.10:80,192.168.10.20:80
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl --may-exist lb-add lb1 30.0.0.10:80 192.168.10.10:80,192.168.10.20:8080"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl --may-exist lb-add lb1 30.0.0.10:80 192.168.10.10:80,192.168.10.20:8080
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl lb-list | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl lb-list | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "UUID                                    LB                  PROTO      VIP             IPs
<0>    lb0                 tcp        30.0.0.10:80    192.168.10.10:80,192.168.10.20:80
<1>    lb1                 tcp        30.0.0.10:80    192.168.10.10:80,192.168.10.20:8080
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl --may-exist lb-add lb1 30.0.0.10:80 192.168.10.10:80,192.168.10.20:8080 udp"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl --may-exist lb-add lb1 30.0.0.10:80 192.168.10.10:80,192.168.10.20:8080 udp
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl lb-list | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl lb-list | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "UUID                                    LB                  PROTO      VIP             IPs
<0>    lb0                 tcp        30.0.0.10:80    192.168.10.10:80,192.168.10.20:80
<1>    lb1                 udp        30.0.0.10:80    192.168.10.10:80,192.168.10.20:8080
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl lb-add lb1 30.0.0.20:80 192.168.10.10:80 udp"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl lb-add lb1 30.0.0.20:80 192.168.10.10:80 udp
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl lb-list | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl lb-list | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "UUID                                    LB                  PROTO      VIP             IPs
<0>    lb0                 tcp        30.0.0.10:80    192.168.10.10:80,192.168.10.20:80
<1>    lb1                 udp        30.0.0.10:80    192.168.10.10:80,192.168.10.20:8080
                                                            udp        30.0.0.20:80    192.168.10.10:80
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl lb-del lb1 30.0.0.20:80"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl lb-del lb1 30.0.0.20:80
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl lb-list | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl lb-list | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "UUID                                    LB                  PROTO      VIP             IPs
<0>    lb0                 tcp        30.0.0.10:80    192.168.10.10:80,192.168.10.20:80
<1>    lb1                 udp        30.0.0.10:80    192.168.10.10:80,192.168.10.20:8080
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl lb-add lb2 30.0.0.30 192.168.10.10"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl lb-add lb2 30.0.0.30 192.168.10.10
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl lb-add lb3 30.0.0.30 192.168.10.10"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl lb-add lb3 30.0.0.30 192.168.10.10
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl lb-list | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl lb-list | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "UUID                                    LB                  PROTO      VIP             IPs
<0>    lb0                 tcp        30.0.0.10:80    192.168.10.10:80,192.168.10.20:80
<1>    lb1                 udp        30.0.0.10:80    192.168.10.10:80,192.168.10.20:8080
<2>    lb2                 tcp        30.0.0.30       192.168.10.10
<3>    lb3                 tcp        30.0.0.30       192.168.10.10
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl lb-del lb2 30.0.0.30"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl lb-del lb2 30.0.0.30
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl lb-del lb3 30.0.0.30"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl lb-del lb3 30.0.0.30
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl lb-add lb2 30.0.0.10:8080 192.168.10.10:80,192.168.10.20:80 tcp"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl lb-add lb2 30.0.0.10:8080 192.168.10.10:80,192.168.10.20:80 tcp
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl --add-duplicate lb-add lb2 30.0.0.10:8080 192.168.10.10:80,192.168.10.20:80 tcp"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl --add-duplicate lb-add lb2 30.0.0.10:8080 192.168.10.10:80,192.168.10.20:80 tcp
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl lb-list | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl lb-list | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "UUID                                    LB                  PROTO      VIP               IPs
<0>    lb0                 tcp        30.0.0.10:80      192.168.10.10:80,192.168.10.20:80
<1>    lb1                 udp        30.0.0.10:80      192.168.10.10:80,192.168.10.20:8080
<2>    lb2                 tcp        30.0.0.10:8080    192.168.10.10:80,192.168.10.20:80
<3>    lb2                 tcp        30.0.0.10:8080    192.168.10.10:80,192.168.10.20:80
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl lb-add lb2 30.0.0.10:8080 192.168.10.10:80,192.168.10.20:80 tcp"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl lb-add lb2 30.0.0.10:8080 192.168.10.10:80,192.168.10.20:80 tcp
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: Multiple load balancers named 'lb2'.  Use a UUID.
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl lb-del lb2"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl lb-del lb2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: Multiple load balancers named 'lb2'.  Use a UUID.
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl --may-exist lb-add lb1 30.0.0.10:80 192.168.10.10:8080,192.168.10.20:8080 udp"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl --may-exist lb-add lb1 30.0.0.10:80 192.168.10.10:8080,192.168.10.20:8080 udp
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl --may-exist lb-add lb1 30.0.0.10:8080 192.168.10.10:8080,192.168.10.20:8080 udp"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl --may-exist lb-add lb1 30.0.0.10:8080 192.168.10.10:8080,192.168.10.20:8080 udp
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl --may-exist lb-add lb1 30.0.0.10:9090 192.168.10.10:8080,192.168.10.20:8080 udp"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl --may-exist lb-add lb1 30.0.0.10:9090 192.168.10.10:8080,192.168.10.20:8080 udp
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl lb-del lb0 30.0.0.10:80"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl lb-del lb0 30.0.0.10:80
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl lb-del lb1"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl lb-del lb1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl lb-list | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl lb-list | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "UUID                                    LB                  PROTO      VIP               IPs
<0>    lb2                 tcp        30.0.0.10:8080    192.168.10.10:80,192.168.10.20:80
<1>    lb2                 tcp        30.0.0.10:8080    192.168.10.10:80,192.168.10.20:80
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl ls-add ls0"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl ls-add ls0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl lb-add lb0 30.0.0.10:80 192.168.10.10:80,192.168.10.20:80"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl lb-add lb0 30.0.0.10:80 192.168.10.10:80,192.168.10.20:80
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl lb-add lb1 30.0.0.10:80 192.168.10.10:80,192.168.10.20:80 udp"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl lb-add lb1 30.0.0.10:80 192.168.10.10:80,192.168.10.20:80 udp
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl lb-add lb3 30.0.0.10 192.168.10.10,192.168.10.20"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl lb-add lb3 30.0.0.10 192.168.10.10,192.168.10.20
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl ls-lb-add ls0 lb0"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl ls-lb-add ls0 lb0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl ls-lb-add ls0 lb1"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl ls-lb-add ls0 lb1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl --may-exist ls-lb-add ls0 lb1"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl --may-exist ls-lb-add ls0 lb1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl ls-lb-add ls0 lb2"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl ls-lb-add ls0 lb2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: Multiple load balancers named 'lb2'.  Use a UUID.
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl ls-lb-add ls0 lb3"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl ls-lb-add ls0 lb3
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl ls-lb-list ls0 | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl ls-lb-list ls0 | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "UUID                                    LB                  PROTO      VIP             IPs
<0>    lb0                 tcp        30.0.0.10:80    192.168.10.10:80,192.168.10.20:80
<1>    lb1                 udp        30.0.0.10:80    192.168.10.10:80,192.168.10.20:80
<2>    lb3                 tcp        30.0.0.10       192.168.10.10,192.168.10.20
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl ls-lb-del ls0 lb0"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl ls-lb-del ls0 lb0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl ls-lb-list ls0 | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl ls-lb-list ls0 | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "UUID                                    LB                  PROTO      VIP             IPs
<0>    lb1                 udp        30.0.0.10:80    192.168.10.10:80,192.168.10.20:80
<1>    lb3                 tcp        30.0.0.10       192.168.10.10,192.168.10.20
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl ls-lb-del ls0 lb1"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl ls-lb-del ls0 lb1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl ls-lb-del ls0 lb3"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl ls-lb-del ls0 lb3
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl ls-lb-list ls0 | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl ls-lb-list ls0 | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl --if-exists ls-lb-del ls0 lb1"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl --if-exists ls-lb-del ls0 lb1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl ls-lb-add ls0 lb0"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl ls-lb-add ls0 lb0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl ls-lb-add ls0 lb1"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl ls-lb-add ls0 lb1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl ls-lb-add ls0 lb3"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl ls-lb-add ls0 lb3
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl ls-lb-del ls0"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl ls-lb-del ls0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl ls-lb-list ls0 | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl ls-lb-list ls0 | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl lr-add lr0"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl lr-add lr0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl lr-lb-add lr0 lb0"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl lr-lb-add lr0 lb0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl lr-lb-add lr0 lb1"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl lr-lb-add lr0 lb1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl --may-exist lr-lb-add lr0 lb1"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl --may-exist lr-lb-add lr0 lb1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl lr-lb-add lr0 lb2"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl lr-lb-add lr0 lb2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: Multiple load balancers named 'lb2'.  Use a UUID.
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl lr-lb-add lr0 lb3"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl lr-lb-add lr0 lb3
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl lr-lb-list lr0 | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl lr-lb-list lr0 | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "UUID                                    LB                  PROTO      VIP             IPs
<0>    lb0                 tcp        30.0.0.10:80    192.168.10.10:80,192.168.10.20:80
<1>    lb1                 udp        30.0.0.10:80    192.168.10.10:80,192.168.10.20:80
<2>    lb3                 tcp        30.0.0.10       192.168.10.10,192.168.10.20
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl lr-lb-del lr0 lb0"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl lr-lb-del lr0 lb0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl lr-lb-list lr0 | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl lr-lb-list lr0 | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "UUID                                    LB                  PROTO      VIP             IPs
<0>    lb1                 udp        30.0.0.10:80    192.168.10.10:80,192.168.10.20:80
<1>    lb3                 tcp        30.0.0.10       192.168.10.10,192.168.10.20
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl lr-lb-del lr0 lb1"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl lr-lb-del lr0 lb1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl lr-lb-del lr0 lb3"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl lr-lb-del lr0 lb3
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl lr-lb-list lr0 | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl lr-lb-list lr0 | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl --if-exists lr-lb-del lr0 lb1"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl --if-exists lr-lb-del lr0 lb1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl lr-lb-add lr0 lb0"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl lr-lb-add lr0 lb0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl lr-lb-add lr0 lb1"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl lr-lb-add lr0 lb1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl lr-lb-add lr0 lb3"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl lr-lb-add lr0 lb3
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl lr-lb-del lr0"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl lr-lb-del lr0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl lr-lb-list lr0 | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl lr-lb-list lr0 | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl lr-lb-add lr0 lb0"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl lr-lb-add lr0 lb0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl ls-lb-add ls0 lb1"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl ls-lb-add ls0 lb1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl lb-del lb0"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl lb-del lb0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl lb-del lb1"
at_fn_check_prepare_trace "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl lb-del lb1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl lr-lb-list lr0 | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl lr-lb-list lr0 | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:613: ovn-nbctl ls-lb-list ls0 | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:613"
( $at_check_trace; ovn-nbctl ls-lb-list ls0 | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:613"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

    }


    ovn_nbctl_lbs_ipv6() {

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl -vsocket_util:off lb-add lb0 [ae0f::10]:80a [fd0f::10]:80,[fd0f::20]:80 tcp"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl -vsocket_util:off lb-add lb0 [ae0f::10]:80a [fd0f::10]:80,[fd0f::20]:80 tcp
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: [ae0f::10]:80a: should be an IP address (or an IP address and a port number with : as a separator).
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }



{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl -vsocket_util:off lb-add lb0 [ae0f::10]:a80 [fd0f::10]:80,[fd0f::20]:80 tcp"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl -vsocket_util:off lb-add lb0 [ae0f::10]:a80 [fd0f::10]:80,[fd0f::20]:80 tcp
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: [ae0f::10]:a80: should be an IP address (or an IP address and a port number with : as a separator).
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }



{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl -vsocket_util:off lb-add lb0 [ae0f::10]:80 [fd0f::10]:80,fd0f::20 tcp"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl -vsocket_util:off lb-add lb0 [ae0f::10]:80 [fd0f::10]:80,fd0f::20 tcp
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: fd0f::20: should be an IP address and a port number with : as a separator.
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }



{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl -vsocket_util:off lb-add lb0 ae0f::10fff [fd0f::10]:80,fd0f::20 tcp"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl -vsocket_util:off lb-add lb0 ae0f::10fff [fd0f::10]:80,fd0f::20 tcp
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: ae0f::10fff: should be an IP address (or an IP address and a port number with : as a separator).
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }



{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl -vsocket_util:off lb-add lb0 ae0f::10 [fd0f::10]:80,[fd0f::20]:80"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl -vsocket_util:off lb-add lb0 ae0f::10 [fd0f::10]:80,[fd0f::20]:80
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: [fd0f::10]:80: should be an IP address.
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }



{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl -vsocket_util:off lb-add lb0 ae0f::10 fd0f::10,[fd0f::20]:80"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl -vsocket_util:off lb-add lb0 ae0f::10 fd0f::10,[fd0f::20]:80
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: [fd0f::20]:80: should be an IP address.
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }



{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl -vsocket_util:off lb-add lb0 ae0f::10 [fd0f::10]:a80"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl -vsocket_util:off lb-add lb0 ae0f::10 [fd0f::10]:a80
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: [fd0f::10]:a80: should be an IP address.
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }



{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl -vsocket_util:off lb-add lb0 ae0f::10 [fd0f::10]:"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl -vsocket_util:off lb-add lb0 ae0f::10 [fd0f::10]:
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: [fd0f::10]:: should be an IP address.
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }



{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl -vsocket_util:off lb-add lb0 ae0f::10 fd0f::1001a"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl -vsocket_util:off lb-add lb0 ae0f::10 fd0f::1001a
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: fd0f::1001a: should be an IP address.
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }



{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl -vsocket_util:off lb-add lb0 [ae0f::10]: [fd0f::10]:80,[fd0f::20]:80 tcp"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl -vsocket_util:off lb-add lb0 [ae0f::10]: [fd0f::10]:80,[fd0f::20]:80 tcp
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: Protocol is unnecessary when no port of vip is given.
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }



{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl lb-add lb0 ae0f::10 fd0f::10 tcp"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl lb-add lb0 ae0f::10 fd0f::10 tcp
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: Protocol is unnecessary when no port of vip is given.
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }



{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl lb-add lb0 ae0f::10 [fd0f::10]:900 tcp"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl lb-add lb0 ae0f::10 [fd0f::10]:900 tcp
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: Protocol is unnecessary when no port of vip is given.
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl lb-add lb0 ae0f::10 192.168.10.10"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl lb-add lb0 ae0f::10 192.168.10.10
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: 192.168.10.10: IP address family is different from VIP ae0f::10.
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl lb-add lb0 ae0f::10 192.168.10.10"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl lb-add lb0 ae0f::10 192.168.10.10
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: 192.168.10.10: IP address family is different from VIP ae0f::10.
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl lb-add lb0 [ae0f::10]:80 192.168.10.10:80"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl lb-add lb0 [ae0f::10]:80 192.168.10.10:80
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: 192.168.10.10:80: IP address family is different from VIP [ae0f::10]:80.
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl lb-add lb0 30.0.0.10 ae0f::10"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl lb-add lb0 30.0.0.10 ae0f::10
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: ae0f::10: IP address family is different from VIP 30.0.0.10.
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl lb-add lb0 30.0.0.10:80 [ae0f::10]:80"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl lb-add lb0 30.0.0.10:80 [ae0f::10]:80
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: [ae0f::10]:80: IP address family is different from VIP 30.0.0.10:80.
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl lb-add lb0 ae0f::10 fd0f::10"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl lb-add lb0 ae0f::10 fd0f::10
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl lb-add lb0 ae0f:0000:0000:0000:0000:0000:0000:0010 fd0f::20"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl lb-add lb0 ae0f:0000:0000:0000:0000:0000:0000:0010 fd0f::20
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: lb0: a load balancer with this vip (ae0f::10) already exists
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl lb-del lb0"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl lb-del lb0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl lb-add lb0 [ae0f::10]:80 ,,,[fd0f::10]:80,,,,,"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl lb-add lb0 [ae0f::10]:80 ,,,[fd0f::10]:80,,,,,
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl lb-add lb1 [ae0f::10]:80 ,,,[fd0f::10]:80,,,,[fd0f::20]:80,,,,"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl lb-add lb1 [ae0f::10]:80 ,,,[fd0f::10]:80,,,,[fd0f::20]:80,,,,
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl lb-list | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl lb-list | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "UUID                                    LB                  PROTO      VIP              IPs
<0>    lb0                 tcp        [ae0f::10]:80    [fd0f::10]:80
<1>    lb1                 tcp        [ae0f::10]:80    [fd0f::10]:80,[fd0f::20]:80
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl lb-del lb0"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl lb-del lb0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl lb-del lb1"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl lb-del lb1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }



{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl lb-add lb0 [ae0f::10]:80 [fd0f::10]:80,[fd0f::20]:80"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl lb-add lb0 [ae0f::10]:80 [fd0f::10]:80,[fd0f::20]:80
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl lb-add lb1 [ae0f::10]:80 [fd0f::10]:80,[fd0f::20]:80 tcp"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl lb-add lb1 [ae0f::10]:80 [fd0f::10]:80,[fd0f::20]:80 tcp
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl lb-list | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl lb-list | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "UUID                                    LB                  PROTO      VIP              IPs
<0>    lb0                 tcp        [ae0f::10]:80    [fd0f::10]:80,[fd0f::20]:80
<1>    lb1                 tcp        [ae0f::10]:80    [fd0f::10]:80,[fd0f::20]:80
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl --may-exist lb-add lb1 [ae0f::10]:80 [fd0f::10]:80,[fd0f::20]:8080"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl --may-exist lb-add lb1 [ae0f::10]:80 [fd0f::10]:80,[fd0f::20]:8080
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl lb-list | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl lb-list | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "UUID                                    LB                  PROTO      VIP              IPs
<0>    lb0                 tcp        [ae0f::10]:80    [fd0f::10]:80,[fd0f::20]:80
<1>    lb1                 tcp        [ae0f::10]:80    [fd0f::10]:80,[fd0f::20]:8080
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl --may-exist lb-add lb1 [ae0f::10]:80 [fd0f::10]:80,[fd0f::20]:8080 udp"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl --may-exist lb-add lb1 [ae0f::10]:80 [fd0f::10]:80,[fd0f::20]:8080 udp
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl lb-list | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl lb-list | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "UUID                                    LB                  PROTO      VIP              IPs
<0>    lb0                 tcp        [ae0f::10]:80    [fd0f::10]:80,[fd0f::20]:80
<1>    lb1                 udp        [ae0f::10]:80    [fd0f::10]:80,[fd0f::20]:8080
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl lb-add lb1 [ae0f::20]:80 [fd0f::10]:80 udp"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl lb-add lb1 [ae0f::20]:80 [fd0f::10]:80 udp
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl lb-list | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl lb-list | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "UUID                                    LB                  PROTO      VIP              IPs
<0>    lb0                 tcp        [ae0f::10]:80    [fd0f::10]:80,[fd0f::20]:80
<1>    lb1                 udp        [ae0f::10]:80    [fd0f::10]:80,[fd0f::20]:8080
                                                            udp        [ae0f::20]:80    [fd0f::10]:80
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl lb-del lb1 [ae0f::20]:80"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl lb-del lb1 [ae0f::20]:80
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl lb-list | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl lb-list | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "UUID                                    LB                  PROTO      VIP              IPs
<0>    lb0                 tcp        [ae0f::10]:80    [fd0f::10]:80,[fd0f::20]:80
<1>    lb1                 udp        [ae0f::10]:80    [fd0f::10]:80,[fd0f::20]:8080
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl lb-add lb2 ae0f::30 fd0f::10"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl lb-add lb2 ae0f::30 fd0f::10
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl lb-add lb3 ae0f::30 fd0f::10"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl lb-add lb3 ae0f::30 fd0f::10
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl lb-list | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl lb-list | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "UUID                                    LB                  PROTO      VIP              IPs
<0>    lb0                 tcp        [ae0f::10]:80    [fd0f::10]:80,[fd0f::20]:80
<1>    lb1                 udp        [ae0f::10]:80    [fd0f::10]:80,[fd0f::20]:8080
<2>    lb2                 tcp        ae0f::30         fd0f::10
<3>    lb3                 tcp        ae0f::30         fd0f::10
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl lb-del lb2 ae0f::30"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl lb-del lb2 ae0f::30
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl lb-del lb3 ae0f::30"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl lb-del lb3 ae0f::30
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl lb-add lb2 [ae0f::10]:8080 [fd0f::10]:80,[fd0f::20]:80 tcp"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl lb-add lb2 [ae0f::10]:8080 [fd0f::10]:80,[fd0f::20]:80 tcp
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl --add-duplicate lb-add lb2 [ae0f::10]:8080 [fd0f::10]:80,[fd0f::20]:80 tcp"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl --add-duplicate lb-add lb2 [ae0f::10]:8080 [fd0f::10]:80,[fd0f::20]:80 tcp
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl lb-list | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl lb-list | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "UUID                                    LB                  PROTO      VIP                IPs
<0>    lb0                 tcp        [ae0f::10]:80      [fd0f::10]:80,[fd0f::20]:80
<1>    lb1                 udp        [ae0f::10]:80      [fd0f::10]:80,[fd0f::20]:8080
<2>    lb2                 tcp        [ae0f::10]:8080    [fd0f::10]:80,[fd0f::20]:80
<3>    lb2                 tcp        [ae0f::10]:8080    [fd0f::10]:80,[fd0f::20]:80
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl lb-add lb2 [ae0f::10]:8080 [fd0f::10]:80,[fd0f::20]:80 tcp"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl lb-add lb2 [ae0f::10]:8080 [fd0f::10]:80,[fd0f::20]:80 tcp
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: Multiple load balancers named 'lb2'.  Use a UUID.
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl lb-del lb2"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl lb-del lb2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: Multiple load balancers named 'lb2'.  Use a UUID.
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl --may-exist lb-add lb1 [ae0f::10]:80 [fd0f::10]:8080,[fd0f::20]:8080 udp"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl --may-exist lb-add lb1 [ae0f::10]:80 [fd0f::10]:8080,[fd0f::20]:8080 udp
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl --may-exist lb-add lb1 [ae0f::10]:8080 [fd0f::10]:8080,[fd0f::20]:8080 udp"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl --may-exist lb-add lb1 [ae0f::10]:8080 [fd0f::10]:8080,[fd0f::20]:8080 udp
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl --may-exist lb-add lb1 [ae0f::10]:9090 [fd0f::10]:8080,[fd0f::20]:8080 udp"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl --may-exist lb-add lb1 [ae0f::10]:9090 [fd0f::10]:8080,[fd0f::20]:8080 udp
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl lb-del lb0 [ae0f::10]:80"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl lb-del lb0 [ae0f::10]:80
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl lb-del lb1"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl lb-del lb1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl lb-list | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl lb-list | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "UUID                                    LB                  PROTO      VIP                IPs
<0>    lb2                 tcp        [ae0f::10]:8080    [fd0f::10]:80,[fd0f::20]:80
<1>    lb2                 tcp        [ae0f::10]:8080    [fd0f::10]:80,[fd0f::20]:80
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl ls-add ls0"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl ls-add ls0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl lb-add lb0 [ae0f::10]:80 [fd0f::10]:80,[fd0f::20]:80"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl lb-add lb0 [ae0f::10]:80 [fd0f::10]:80,[fd0f::20]:80
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl lb-add lb1 [ae0f::10]:80 [fd0f::10]:80,[fd0f::20]:80 udp"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl lb-add lb1 [ae0f::10]:80 [fd0f::10]:80,[fd0f::20]:80 udp
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl lb-add lb3 ae0f::10 fd0f::10,fd0f::20"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl lb-add lb3 ae0f::10 fd0f::10,fd0f::20
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl ls-lb-add ls0 lb0"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl ls-lb-add ls0 lb0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl ls-lb-add ls0 lb1"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl ls-lb-add ls0 lb1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl --may-exist ls-lb-add ls0 lb1"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl --may-exist ls-lb-add ls0 lb1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl ls-lb-add ls0 lb2"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl ls-lb-add ls0 lb2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: Multiple load balancers named 'lb2'.  Use a UUID.
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl ls-lb-add ls0 lb3"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl ls-lb-add ls0 lb3
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl ls-lb-list ls0 | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl ls-lb-list ls0 | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "UUID                                    LB                  PROTO      VIP              IPs
<0>    lb0                 tcp        [ae0f::10]:80    [fd0f::10]:80,[fd0f::20]:80
<1>    lb1                 udp        [ae0f::10]:80    [fd0f::10]:80,[fd0f::20]:80
<2>    lb3                 tcp        ae0f::10         fd0f::10,fd0f::20
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl ls-lb-del ls0 lb0"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl ls-lb-del ls0 lb0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl ls-lb-list ls0 | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl ls-lb-list ls0 | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "UUID                                    LB                  PROTO      VIP              IPs
<0>    lb1                 udp        [ae0f::10]:80    [fd0f::10]:80,[fd0f::20]:80
<1>    lb3                 tcp        ae0f::10         fd0f::10,fd0f::20
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl ls-lb-del ls0 lb1"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl ls-lb-del ls0 lb1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl ls-lb-del ls0 lb3"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl ls-lb-del ls0 lb3
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl ls-lb-list ls0 | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl ls-lb-list ls0 | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl --if-exists ls-lb-del ls0 lb1"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl --if-exists ls-lb-del ls0 lb1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl ls-lb-add ls0 lb0"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl ls-lb-add ls0 lb0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl ls-lb-add ls0 lb1"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl ls-lb-add ls0 lb1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl ls-lb-add ls0 lb3"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl ls-lb-add ls0 lb3
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl ls-lb-del ls0"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl ls-lb-del ls0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl ls-lb-list ls0 | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl ls-lb-list ls0 | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl lr-add lr0"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl lr-add lr0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl lr-lb-add lr0 lb0"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl lr-lb-add lr0 lb0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl lr-lb-add lr0 lb1"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl lr-lb-add lr0 lb1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl --may-exist lr-lb-add lr0 lb1"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl --may-exist lr-lb-add lr0 lb1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl lr-lb-add lr0 lb2"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl lr-lb-add lr0 lb2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: Multiple load balancers named 'lb2'.  Use a UUID.
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl lr-lb-add lr0 lb3"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl lr-lb-add lr0 lb3
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl lr-lb-list lr0 | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl lr-lb-list lr0 | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "UUID                                    LB                  PROTO      VIP              IPs
<0>    lb0                 tcp        [ae0f::10]:80    [fd0f::10]:80,[fd0f::20]:80
<1>    lb1                 udp        [ae0f::10]:80    [fd0f::10]:80,[fd0f::20]:80
<2>    lb3                 tcp        ae0f::10         fd0f::10,fd0f::20
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl lr-lb-del lr0 lb0"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl lr-lb-del lr0 lb0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl lr-lb-list lr0 | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl lr-lb-list lr0 | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "UUID                                    LB                  PROTO      VIP              IPs
<0>    lb1                 udp        [ae0f::10]:80    [fd0f::10]:80,[fd0f::20]:80
<1>    lb3                 tcp        ae0f::10         fd0f::10,fd0f::20
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl lr-lb-del lr0 lb1"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl lr-lb-del lr0 lb1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl lr-lb-del lr0 lb3"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl lr-lb-del lr0 lb3
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl lr-lb-list lr0 | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl lr-lb-list lr0 | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl --if-exists lr-lb-del lr0 lb1"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl --if-exists lr-lb-del lr0 lb1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl lr-lb-add lr0 lb0"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl lr-lb-add lr0 lb0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl lr-lb-add lr0 lb1"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl lr-lb-add lr0 lb1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl lr-lb-add lr0 lb3"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl lr-lb-add lr0 lb3
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl lr-lb-del lr0"
at_fn_check_prepare_trace "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl lr-lb-del lr0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:841: ovn-nbctl lr-lb-list lr0 | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:841"
( $at_check_trace; ovn-nbctl lr-lb-list lr0 | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:841"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

    }


    ovn_nbctl_basic_lr() {

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1100: ovn-nbctl lr-add lr0"
at_fn_check_prepare_trace "ovn-nbctl.at:1100"
( $at_check_trace; ovn-nbctl lr-add lr0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1100"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1100: ovn-nbctl lr-list | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:1100"
( $at_check_trace; ovn-nbctl lr-list | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "<0> (lr0)
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1100"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1100: ovn-nbctl lr-add lr1"
at_fn_check_prepare_trace "ovn-nbctl.at:1100"
( $at_check_trace; ovn-nbctl lr-add lr1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1100"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1100: ovn-nbctl lr-list | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:1100"
( $at_check_trace; ovn-nbctl lr-list | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "<0> (lr0)
<1> (lr1)
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1100"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1100: ovn-nbctl lr-del lr0"
at_fn_check_prepare_trace "ovn-nbctl.at:1100"
( $at_check_trace; ovn-nbctl lr-del lr0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1100"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1100: ovn-nbctl lr-list | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:1100"
( $at_check_trace; ovn-nbctl lr-list | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "<0> (lr1)
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1100"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1100: ovn-nbctl show lr0"
at_fn_check_prepare_trace "ovn-nbctl.at:1100"
( $at_check_trace; ovn-nbctl show lr0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1100"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1100: ovn-nbctl lr-add lr0"
at_fn_check_prepare_trace "ovn-nbctl.at:1100"
( $at_check_trace; ovn-nbctl lr-add lr0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1100"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1100: ovn-nbctl show lr0 | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:1100"
( $at_check_trace; ovn-nbctl show lr0 | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "router <0> (lr0)
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1100"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1100: ovn-nbctl lr-add lr0"
at_fn_check_prepare_trace "ovn-nbctl.at:1100"
( $at_check_trace; ovn-nbctl lr-add lr0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: lr0: a router with this name already exists
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:1100"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1100: ovn-nbctl --may-exist lr-add lr0"
at_fn_check_prepare_trace "ovn-nbctl.at:1100"
( $at_check_trace; ovn-nbctl --may-exist lr-add lr0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1100"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1100: ovn-nbctl show lr0 | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:1100"
( $at_check_trace; ovn-nbctl show lr0 | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "router <0> (lr0)
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1100"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1100: ovn-nbctl --add-duplicate lr-add lr0"
at_fn_check_prepare_trace "ovn-nbctl.at:1100"
( $at_check_trace; ovn-nbctl --add-duplicate lr-add lr0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1100"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1100: ovn-nbctl --may-exist --add-duplicate lr-add lr0"
at_fn_check_prepare_trace "ovn-nbctl.at:1100"
( $at_check_trace; ovn-nbctl --may-exist --add-duplicate lr-add lr0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: --may-exist and --add-duplicate may not be used together
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:1100"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1100: ovn-nbctl lr-del lr0"
at_fn_check_prepare_trace "ovn-nbctl.at:1100"
( $at_check_trace; ovn-nbctl lr-del lr0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: Multiple logical routers named 'lr0'.  Use a UUID.
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:1100"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1100: ovn-nbctl lr-del lr2"
at_fn_check_prepare_trace "ovn-nbctl.at:1100"
( $at_check_trace; ovn-nbctl lr-del lr2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: lr2: router name not found
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:1100"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1100: ovn-nbctl --if-exists lr-del lr2"
at_fn_check_prepare_trace "ovn-nbctl.at:1100"
( $at_check_trace; ovn-nbctl --if-exists lr-del lr2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1100"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1100: ovn-nbctl lr-add"
at_fn_check_prepare_trace "ovn-nbctl.at:1100"
( $at_check_trace; ovn-nbctl lr-add
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1100"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1100: ovn-nbctl lr-add"
at_fn_check_prepare_trace "ovn-nbctl.at:1100"
( $at_check_trace; ovn-nbctl lr-add
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1100"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1100: ovn-nbctl --add-duplicate lr-add"
at_fn_check_prepare_trace "ovn-nbctl.at:1100"
( $at_check_trace; ovn-nbctl --add-duplicate lr-add
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: --add-duplicate requires specifying a name
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:1100"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1100: ovn-nbctl --may-exist lr-add"
at_fn_check_prepare_trace "ovn-nbctl.at:1100"
( $at_check_trace; ovn-nbctl --may-exist lr-add
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: --may-exist requires specifying a name
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:1100"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

    }


    ovn_nbctl_basic_lrp() {

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1153: ovn-nbctl lr-add lr0"
at_fn_check_prepare_trace "ovn-nbctl.at:1153"
( $at_check_trace; ovn-nbctl lr-add lr0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1153"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1153: ovn-nbctl lrp-add lr0 lrp0 00:00:00:01:02 192.168.1.1/24"
at_fn_check_prepare_trace "ovn-nbctl.at:1153"
( $at_check_trace; ovn-nbctl lrp-add lr0 lrp0 00:00:00:01:02 192.168.1.1/24
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: lrp0: invalid mac address 00:00:00:01:02
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:1153"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1153: ovn-nbctl lrp-add lr0 lrp0 00:00:00:01:02:03:04 192.168.1.1/24"
at_fn_check_prepare_trace "ovn-nbctl.at:1153"
( $at_check_trace; ovn-nbctl lrp-add lr0 lrp0 00:00:00:01:02:03:04 192.168.1.1/24
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: lrp0: invalid mac address 00:00:00:01:02:03:04
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:1153"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1153: ovn-nbctl lrp-add lr0 lrp0 00:00:00:01:02:03 192.168.1.1/24"
at_fn_check_prepare_trace "ovn-nbctl.at:1153"
( $at_check_trace; ovn-nbctl lrp-add lr0 lrp0 00:00:00:01:02:03 192.168.1.1/24
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1153"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1153: ovn-nbctl show lr0 | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:1153"
( $at_check_trace; ovn-nbctl show lr0 | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "router <0> (lr0)
    port lrp0
        mac: \"00:00:00:01:02:03\"
        networks: [\"192.168.1.1/24\"]
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1153"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1153: ovn-nbctl lrp-add lr0 lrp0 00:00:00:01:02:03 192.168.1.1/24"
at_fn_check_prepare_trace "ovn-nbctl.at:1153"
( $at_check_trace; ovn-nbctl lrp-add lr0 lrp0 00:00:00:01:02:03 192.168.1.1/24
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: lrp0: a port with this name already exists
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:1153"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1153: ovn-nbctl --may-exist lrp-add lr0 lrp0 00:00:00:01:02:03 192.168.1.1/24"
at_fn_check_prepare_trace "ovn-nbctl.at:1153"
( $at_check_trace; ovn-nbctl --may-exist lrp-add lr0 lrp0 00:00:00:01:02:03 192.168.1.1/24
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1153"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1153: ovn-nbctl lrp-list lr0 | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:1153"
( $at_check_trace; ovn-nbctl lrp-list lr0 | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "<0> (lrp0)
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1153"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1153: ovn-nbctl lrp-add lr0 lrp1 00:00:00:01:02:03 192.168.1.1/24 peer=lrp1-peer"
at_fn_check_prepare_trace "ovn-nbctl.at:1153"
( $at_check_trace; ovn-nbctl lrp-add lr0 lrp1 00:00:00:01:02:03 192.168.1.1/24 peer=lrp1-peer
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1153"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1153: ovn-nbctl lrp-list lr0 | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:1153"
( $at_check_trace; ovn-nbctl lrp-list lr0 | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "<0> (lrp0)
<1> (lrp1)
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1153"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1153: ovn-nbctl lr-add lr1"
at_fn_check_prepare_trace "ovn-nbctl.at:1153"
( $at_check_trace; ovn-nbctl lr-add lr1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1153"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1153: ovn-nbctl lrp-add lr0 lrp1 00:00:00:01:02:03 192.168.1.1/24"
at_fn_check_prepare_trace "ovn-nbctl.at:1153"
( $at_check_trace; ovn-nbctl lrp-add lr0 lrp1 00:00:00:01:02:03 192.168.1.1/24
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: lrp1: a port with this name already exists
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:1153"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1153: ovn-nbctl --may-exist lrp-add lr1 lrp1 00:00:00:01:02:03 192.168.1.1/24"
at_fn_check_prepare_trace "ovn-nbctl.at:1153"
( $at_check_trace; ovn-nbctl --may-exist lrp-add lr1 lrp1 00:00:00:01:02:03 192.168.1.1/24
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: lrp1: port already exists but in router lr0
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:1153"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1153: ovn-nbctl --may-exist lrp-add lr0 lrp1 00:00:00:04:05:06 192.168.1.1/24"
at_fn_check_prepare_trace "ovn-nbctl.at:1153"
( $at_check_trace; ovn-nbctl --may-exist lrp-add lr0 lrp1 00:00:00:04:05:06 192.168.1.1/24
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: lrp1: port already exists with mac 00:00:00:01:02:03
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:1153"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1153: ovn-nbctl --may-exist lrp-add lr0 lrp1 00:00:00:01:02:03 192.168.1.1/24"
at_fn_check_prepare_trace "ovn-nbctl.at:1153"
( $at_check_trace; ovn-nbctl --may-exist lrp-add lr0 lrp1 00:00:00:01:02:03 192.168.1.1/24
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: lrp1: port already exists with mismatching peer
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:1153"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1153: ovn-nbctl --may-exist lrp-add lr0 lrp1 00:00:00:01:02:03 10.0.0.1/24 peer=lrp1-peer"
at_fn_check_prepare_trace "ovn-nbctl.at:1153"
( $at_check_trace; ovn-nbctl --may-exist lrp-add lr0 lrp1 00:00:00:01:02:03 10.0.0.1/24 peer=lrp1-peer
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: lrp1: port already exists with different network
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:1153"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1153: ovn-nbctl --may-exist lrp-add lr0 lrp1 00:00:00:01:02:03 192.168.1.1/24 peer=lrp1-peer"
at_fn_check_prepare_trace "ovn-nbctl.at:1153"
( $at_check_trace; ovn-nbctl --may-exist lrp-add lr0 lrp1 00:00:00:01:02:03 192.168.1.1/24 peer=lrp1-peer
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1153"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1153: ovn-nbctl lrp-del lrp1"
at_fn_check_prepare_trace "ovn-nbctl.at:1153"
( $at_check_trace; ovn-nbctl lrp-del lrp1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1153"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1153: ovn-nbctl lrp-list lr0 | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:1153"
( $at_check_trace; ovn-nbctl lrp-list lr0 | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "<0> (lrp0)
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1153"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1153: ovn-nbctl --may-exist lrp-add lr0 lrp1 00:00:00:01:02:03 192.168.1.1/24 10.0.0.1/24 peer=lrp1-peer"
at_fn_check_prepare_trace "ovn-nbctl.at:1153"
( $at_check_trace; ovn-nbctl --may-exist lrp-add lr0 lrp1 00:00:00:01:02:03 192.168.1.1/24 10.0.0.1/24 peer=lrp1-peer
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1153"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1153: ovn-nbctl --may-exist lrp-add lr0 lrp1 00:00:00:01:02:03 192.168.1.1/24 172.16.0.1/24 peer=lrp1-peer"
at_fn_check_prepare_trace "ovn-nbctl.at:1153"
( $at_check_trace; ovn-nbctl --may-exist lrp-add lr0 lrp1 00:00:00:01:02:03 192.168.1.1/24 172.16.0.1/24 peer=lrp1-peer
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: lrp1: port already exists with different network
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:1153"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1153: ovn-nbctl --may-exist lrp-add lr0 lrp1 00:00:00:01:02:03 10.0.0.1/24 192.168.1.1/24 peer=lrp1-peer"
at_fn_check_prepare_trace "ovn-nbctl.at:1153"
( $at_check_trace; ovn-nbctl --may-exist lrp-add lr0 lrp1 00:00:00:01:02:03 10.0.0.1/24 192.168.1.1/24 peer=lrp1-peer
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1153"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

    }


    ovn_nbctl_lrp_gw_chassi() {

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1223: ovn-nbctl lr-add lr0"
at_fn_check_prepare_trace "ovn-nbctl.at:1223"
( $at_check_trace; ovn-nbctl lr-add lr0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1223"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1223: ovn-nbctl lrp-add lr0 lrp0 00:00:00:01:02:03 192.168.1.1/24"
at_fn_check_prepare_trace "ovn-nbctl.at:1223"
( $at_check_trace; ovn-nbctl lrp-add lr0 lrp0 00:00:00:01:02:03 192.168.1.1/24
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1223"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1223: ovn-nbctl lrp-get-gateway-chassis lrp0"
at_fn_check_prepare_trace "ovn-nbctl.at:1223"
( $at_check_trace; ovn-nbctl lrp-get-gateway-chassis lrp0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1223"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1223: ovn-nbctl lrp-set-gateway-chassis lp0 chassis1"
at_fn_check_prepare_trace "ovn-nbctl.at:1223"
( $at_check_trace; ovn-nbctl lrp-set-gateway-chassis lp0 chassis1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: lp0: port name not found
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:1223"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1223: ovn-nbctl lrp-get-gateway-chassis lp0"
at_fn_check_prepare_trace "ovn-nbctl.at:1223"
( $at_check_trace; ovn-nbctl lrp-get-gateway-chassis lp0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: lp0: port name not found
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:1223"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1223: ovn-nbctl lrp-del-gateway-chassis lp0 chassis1"
at_fn_check_prepare_trace "ovn-nbctl.at:1223"
( $at_check_trace; ovn-nbctl lrp-del-gateway-chassis lp0 chassis1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: lp0: port name not found
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:1223"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1223: ovn-nbctl lrp-del-gateway-chassis lrp0 chassis1"
at_fn_check_prepare_trace "ovn-nbctl.at:1223"
( $at_check_trace; ovn-nbctl lrp-del-gateway-chassis lrp0 chassis1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: chassis chassis1 is not added to logical port lrp0
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:1223"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1223: ovn-nbctl lrp-set-gateway-chassis lrp0 chassis1"
at_fn_check_prepare_trace "ovn-nbctl.at:1223"
( $at_check_trace; ovn-nbctl lrp-set-gateway-chassis lrp0 chassis1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1223"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1223: ovn-nbctl lrp-get-gateway-chassis lrp0"
at_fn_check_prepare_trace "ovn-nbctl.at:1223"
( $at_check_trace; ovn-nbctl lrp-get-gateway-chassis lrp0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "lrp0-chassis1     0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1223"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1223: ovn-nbctl lrp-set-gateway-chassis lrp0 chassis1 10"
at_fn_check_prepare_trace "ovn-nbctl.at:1223"
( $at_check_trace; ovn-nbctl lrp-set-gateway-chassis lrp0 chassis1 10
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1223"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1223: ovn-nbctl lrp-get-gateway-chassis lrp0"
at_fn_check_prepare_trace "ovn-nbctl.at:1223"
( $at_check_trace; ovn-nbctl lrp-get-gateway-chassis lrp0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "lrp0-chassis1    10
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1223"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1223: ovn-nbctl lrp-set-gateway-chassis lrp0 chassis1 20"
at_fn_check_prepare_trace "ovn-nbctl.at:1223"
( $at_check_trace; ovn-nbctl lrp-set-gateway-chassis lrp0 chassis1 20
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1223"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1223: ovn-nbctl lrp-get-gateway-chassis lrp0"
at_fn_check_prepare_trace "ovn-nbctl.at:1223"
( $at_check_trace; ovn-nbctl lrp-get-gateway-chassis lrp0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "lrp0-chassis1    20
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1223"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1223: ovn-nbctl lrp-set-gateway-chassis lrp0 chassis2 5"
at_fn_check_prepare_trace "ovn-nbctl.at:1223"
( $at_check_trace; ovn-nbctl lrp-set-gateway-chassis lrp0 chassis2 5
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1223"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1223: ovn-nbctl lrp-get-gateway-chassis lrp0"
at_fn_check_prepare_trace "ovn-nbctl.at:1223"
( $at_check_trace; ovn-nbctl lrp-get-gateway-chassis lrp0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "lrp0-chassis1    20
lrp0-chassis2     5
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1223"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1223: ovn-nbctl lrp-del-gateway-chassis lrp0 chassis1"
at_fn_check_prepare_trace "ovn-nbctl.at:1223"
( $at_check_trace; ovn-nbctl lrp-del-gateway-chassis lrp0 chassis1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1223"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1223: ovn-nbctl lrp-get-gateway-chassis lrp0"
at_fn_check_prepare_trace "ovn-nbctl.at:1223"
( $at_check_trace; ovn-nbctl lrp-get-gateway-chassis lrp0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "lrp0-chassis2     5
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1223"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1223: ovn-nbctl lrp-del-gateway-chassis lrp0 chassis2"
at_fn_check_prepare_trace "ovn-nbctl.at:1223"
( $at_check_trace; ovn-nbctl lrp-del-gateway-chassis lrp0 chassis2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1223"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1223: ovn-nbctl lrp-get-gateway-chassis lrp0"
at_fn_check_prepare_trace "ovn-nbctl.at:1223"
( $at_check_trace; ovn-nbctl lrp-get-gateway-chassis lrp0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1223"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1223: ovn-nbctl lrp-set-gateway-chassis lrp0 chassis1 1"
at_fn_check_prepare_trace "ovn-nbctl.at:1223"
( $at_check_trace; ovn-nbctl lrp-set-gateway-chassis lrp0 chassis1 1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1223"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1223: ovn-nbctl lrp-set-gateway-chassis lrp0 chassis2 10"
at_fn_check_prepare_trace "ovn-nbctl.at:1223"
( $at_check_trace; ovn-nbctl lrp-set-gateway-chassis lrp0 chassis2 10
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1223"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1223: ovn-nbctl lrp-set-gateway-chassis lrp0 chassis3 5"
at_fn_check_prepare_trace "ovn-nbctl.at:1223"
( $at_check_trace; ovn-nbctl lrp-set-gateway-chassis lrp0 chassis3 5
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1223"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1223: ovn-nbctl lrp-get-gateway-chassis lrp0"
at_fn_check_prepare_trace "ovn-nbctl.at:1223"
( $at_check_trace; ovn-nbctl lrp-get-gateway-chassis lrp0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "lrp0-chassis2    10
lrp0-chassis3     5
lrp0-chassis1     1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1223"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

    }


    ovn_nbctl_redirect_type() {

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1283: ovn-nbctl lr-add lr0"
at_fn_check_prepare_trace "ovn-nbctl.at:1283"
( $at_check_trace; ovn-nbctl lr-add lr0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1283"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1283: ovn-nbctl lrp-add lr0 lrp0 00:00:00:01:02:03 192.168.1.1/24"
at_fn_check_prepare_trace "ovn-nbctl.at:1283"
( $at_check_trace; ovn-nbctl lrp-add lr0 lrp0 00:00:00:01:02:03 192.168.1.1/24
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1283"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1283: ovn-nbctl lrp-get-redirect-type lrp0"
at_fn_check_prepare_trace "ovn-nbctl.at:1283"
( $at_check_trace; ovn-nbctl lrp-get-redirect-type lrp0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "overlay
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1283"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1283: ovn-nbctl lrp-set-redirect-type lp0 bridged"
at_fn_check_prepare_trace "ovn-nbctl.at:1283"
( $at_check_trace; ovn-nbctl lrp-set-redirect-type lp0 bridged
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: lp0: port name not found
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:1283"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1283: ovn-nbctl lrp-set-redirect-type lrp0 bridged"
at_fn_check_prepare_trace "ovn-nbctl.at:1283"
( $at_check_trace; ovn-nbctl lrp-set-redirect-type lrp0 bridged
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1283"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1283: ovn-nbctl lrp-get-redirect-type lrp0"
at_fn_check_prepare_trace "ovn-nbctl.at:1283"
( $at_check_trace; ovn-nbctl lrp-get-redirect-type lrp0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "bridged
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1283"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1283: ovn-nbctl lrp-set-redirect-type lrp0 overlay"
at_fn_check_prepare_trace "ovn-nbctl.at:1283"
( $at_check_trace; ovn-nbctl lrp-set-redirect-type lrp0 overlay
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1283"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1283: ovn-nbctl lrp-get-redirect-type lrp0"
at_fn_check_prepare_trace "ovn-nbctl.at:1283"
( $at_check_trace; ovn-nbctl lrp-get-redirect-type lrp0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "overlay
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1283"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1283: ovn-nbctl lrp-set-redirect-type lrp0 abcd"
at_fn_check_prepare_trace "ovn-nbctl.at:1283"
( $at_check_trace; ovn-nbctl lrp-set-redirect-type lrp0 abcd
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: Invalid redirect type: abcd
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:1283"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }



    }


    ovn_nbctl_lrp_enable() {

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1308: ovn-nbctl lr-add lr0"
at_fn_check_prepare_trace "ovn-nbctl.at:1308"
( $at_check_trace; ovn-nbctl lr-add lr0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1308"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1308: ovn-nbctl lrp-add lr0 lrp0 00:00:00:01:02:03 192.168.1.1/24"
at_fn_check_prepare_trace "ovn-nbctl.at:1308"
( $at_check_trace; ovn-nbctl lrp-add lr0 lrp0 00:00:00:01:02:03 192.168.1.1/24
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1308"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1308: ovn-nbctl lrp-get-enabled lrp0"
at_fn_check_prepare_trace "ovn-nbctl.at:1308"
( $at_check_trace; ovn-nbctl lrp-get-enabled lrp0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "enabled
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1308"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1308: ovn-nbctl lrp-set-enabled lrp0 disabled"
at_fn_check_prepare_trace "ovn-nbctl.at:1308"
( $at_check_trace; ovn-nbctl lrp-set-enabled lrp0 disabled
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1308"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1308: ovn-nbctl lrp-get-enabled lrp0"
at_fn_check_prepare_trace "ovn-nbctl.at:1308"
( $at_check_trace; ovn-nbctl lrp-get-enabled lrp0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "disabled
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1308"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1308: ovn-nbctl lrp-set-enabled lrp0 enabled"
at_fn_check_prepare_trace "ovn-nbctl.at:1308"
( $at_check_trace; ovn-nbctl lrp-set-enabled lrp0 enabled
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1308"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1308: ovn-nbctl lrp-get-enabled lrp0"
at_fn_check_prepare_trace "ovn-nbctl.at:1308"
( $at_check_trace; ovn-nbctl lrp-get-enabled lrp0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "enabled
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1308"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1308: ovn-nbctl lrp-set-enabled lrp0 xyzzy"
at_fn_check_prepare_trace "ovn-nbctl.at:1308"
( $at_check_trace; ovn-nbctl lrp-set-enabled lrp0 xyzzy
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: xyzzy: state must be \"enabled\" or \"disabled\"
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:1308"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

    }


    ovn_nbctl_routes() {

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1328: ovn-nbctl lr-add lr0"
at_fn_check_prepare_trace "ovn-nbctl.at:1328"
( $at_check_trace; ovn-nbctl lr-add lr0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1328: ovn-nbctl lr-route-add lr0 0.0.0.0/0 192.168.0.1"
at_fn_check_prepare_trace "ovn-nbctl.at:1328"
( $at_check_trace; ovn-nbctl lr-route-add lr0 0.0.0.0/0 192.168.0.1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1328: ovn-nbctl lr-route-add lr0 10.0.1.0/24 11.0.1.1 lp0"
at_fn_check_prepare_trace "ovn-nbctl.at:1328"
( $at_check_trace; ovn-nbctl lr-route-add lr0 10.0.1.0/24 11.0.1.1 lp0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1328: ovn-nbctl lr-route-add lr0 10.0.0.1/24 11.0.0.2"
at_fn_check_prepare_trace "ovn-nbctl.at:1328"
( $at_check_trace; ovn-nbctl lr-route-add lr0 10.0.0.1/24 11.0.0.2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1328: ovn-nbctl lr-route-add lr0 10.0.0.111/24 11.0.0.1"
at_fn_check_prepare_trace "ovn-nbctl.at:1328"
( $at_check_trace; ovn-nbctl lr-route-add lr0 10.0.0.111/24 11.0.0.1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: duplicate prefix: 10.0.0.0/24 (policy: dst-ip)
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:1328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1328: ovn-nbctl lr-route-add lr0 10.0.0.111a/24 11.0.0.1"
at_fn_check_prepare_trace "ovn-nbctl.at:1328"
( $at_check_trace; ovn-nbctl lr-route-add lr0 10.0.0.111a/24 11.0.0.1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: bad prefix argument: 10.0.0.111a/24
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:1328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1328: ovn-nbctl lr-route-add lr0 10.0.0.111/24a 11.0.0.1"
at_fn_check_prepare_trace "ovn-nbctl.at:1328"
( $at_check_trace; ovn-nbctl lr-route-add lr0 10.0.0.111/24a 11.0.0.1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: bad prefix argument: 10.0.0.111/24a
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:1328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1328: ovn-nbctl lr-route-add lr0 10.0.0.111/24 11.0.0.1a"
at_fn_check_prepare_trace "ovn-nbctl.at:1328"
( $at_check_trace; ovn-nbctl lr-route-add lr0 10.0.0.111/24 11.0.0.1a
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: bad next hop argument: 11.0.0.1a
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:1328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1328: ovn-nbctl lr-route-add lr0 10.0.0.111/24 11.0.0.1/24"
at_fn_check_prepare_trace "ovn-nbctl.at:1328"
( $at_check_trace; ovn-nbctl lr-route-add lr0 10.0.0.111/24 11.0.0.1/24
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: bad IPv4 nexthop argument: 11.0.0.1/24
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:1328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1328: ovn-nbctl lr-route-add lr0 2001:0db8:1::/64 2001:0db8:0:f103::1/64"
at_fn_check_prepare_trace "ovn-nbctl.at:1328"
( $at_check_trace; ovn-nbctl lr-route-add lr0 2001:0db8:1::/64 2001:0db8:0:f103::1/64
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: bad IPv6 nexthop argument: 2001:0db8:0:f103::1/64
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:1328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1328: ovn-nbctl --may-exist lr-route-add lr0 10.0.0.111/24 11.0.0.1"
at_fn_check_prepare_trace "ovn-nbctl.at:1328"
( $at_check_trace; ovn-nbctl --may-exist lr-route-add lr0 10.0.0.111/24 11.0.0.1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1328: ovn-nbctl --policy=src-ip lr-route-add lr0 9.16.1.0/24 11.0.0.1"
at_fn_check_prepare_trace "ovn-nbctl.at:1328"
( $at_check_trace; ovn-nbctl --policy=src-ip lr-route-add lr0 9.16.1.0/24 11.0.0.1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1328: ovn-nbctl --policy=src-ip lr-route-add lr0 10.0.0.0/24 11.0.0.2"
at_fn_check_prepare_trace "ovn-nbctl.at:1328"
( $at_check_trace; ovn-nbctl --policy=src-ip lr-route-add lr0 10.0.0.0/24 11.0.0.2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1328: ovn-nbctl lr-route-list lr0"
at_fn_check_prepare_trace "ovn-nbctl.at:1328"
( $at_check_trace; ovn-nbctl lr-route-list lr0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "IPv4 Routes
              10.0.0.0/24                  11.0.0.1 dst-ip
              10.0.1.0/24                  11.0.1.1 dst-ip lp0
              9.16.1.0/24                  11.0.0.1 src-ip
              10.0.0.0/24                  11.0.0.2 src-ip
                0.0.0.0/0               192.168.0.1 dst-ip
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1328: ovn-nbctl --may-exist lr-route-add lr0 10.0.0.111/24 11.0.0.1 lp1"
at_fn_check_prepare_trace "ovn-nbctl.at:1328"
( $at_check_trace; ovn-nbctl --may-exist lr-route-add lr0 10.0.0.111/24 11.0.0.1 lp1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1328: ovn-nbctl lr-route-list lr0"
at_fn_check_prepare_trace "ovn-nbctl.at:1328"
( $at_check_trace; ovn-nbctl lr-route-list lr0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "IPv4 Routes
              10.0.0.0/24                  11.0.0.1 dst-ip lp1
              10.0.1.0/24                  11.0.1.1 dst-ip lp0
              9.16.1.0/24                  11.0.0.1 src-ip
              10.0.0.0/24                  11.0.0.2 src-ip
                0.0.0.0/0               192.168.0.1 dst-ip
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1328: ovn-nbctl lr-route-del lr0 10.0.2.1/24"
at_fn_check_prepare_trace "ovn-nbctl.at:1328"
( $at_check_trace; ovn-nbctl lr-route-del lr0 10.0.2.1/24
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: no matching route: policy 'any', prefix '10.0.2.0/24', nexthop 'any', output_port 'any'.
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:1328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1328: ovn-nbctl lr-route-del lr0 10.0.1.0/24 11.0.1.2"
at_fn_check_prepare_trace "ovn-nbctl.at:1328"
( $at_check_trace; ovn-nbctl lr-route-del lr0 10.0.1.0/24 11.0.1.2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: no matching route: policy 'any', prefix '10.0.1.0/24', nexthop '11.0.1.2', output_port 'any'.
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:1328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1328: ovn-nbctl lr-route-del lr0 10.0.1.0/24 11.0.1.1 lp1"
at_fn_check_prepare_trace "ovn-nbctl.at:1328"
( $at_check_trace; ovn-nbctl lr-route-del lr0 10.0.1.0/24 11.0.1.1 lp1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: no matching route: policy 'any', prefix '10.0.1.0/24', nexthop '11.0.1.1', output_port 'lp1'.
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:1328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1328: ovn-nbctl --if-exists lr-route-del lr0 10.0.2.1/24"
at_fn_check_prepare_trace "ovn-nbctl.at:1328"
( $at_check_trace; ovn-nbctl --if-exists lr-route-del lr0 10.0.2.1/24
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1328: ovn-nbctl lr-route-del lr0 10.0.1.1/24"
at_fn_check_prepare_trace "ovn-nbctl.at:1328"
( $at_check_trace; ovn-nbctl lr-route-del lr0 10.0.1.1/24
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1328: ovn-nbctl --policy=src-ip lr-route-del lr0 9.16.1.0/24"
at_fn_check_prepare_trace "ovn-nbctl.at:1328"
( $at_check_trace; ovn-nbctl --policy=src-ip lr-route-del lr0 9.16.1.0/24
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1328: ovn-nbctl lr-route-list lr0"
at_fn_check_prepare_trace "ovn-nbctl.at:1328"
( $at_check_trace; ovn-nbctl lr-route-list lr0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "IPv4 Routes
              10.0.0.0/24                  11.0.0.1 dst-ip lp1
              10.0.0.0/24                  11.0.0.2 src-ip
                0.0.0.0/0               192.168.0.1 dst-ip
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1328: ovn-nbctl --policy=dst-ip lr-route-del lr0 10.0.0.0/24"
at_fn_check_prepare_trace "ovn-nbctl.at:1328"
( $at_check_trace; ovn-nbctl --policy=dst-ip lr-route-del lr0 10.0.0.0/24
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1328: ovn-nbctl --policy=src-ip lr-route-del lr0 10.0.0.0/24"
at_fn_check_prepare_trace "ovn-nbctl.at:1328"
( $at_check_trace; ovn-nbctl --policy=src-ip lr-route-del lr0 10.0.0.0/24
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1328: ovn-nbctl lr-route-list lr0"
at_fn_check_prepare_trace "ovn-nbctl.at:1328"
( $at_check_trace; ovn-nbctl lr-route-list lr0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "IPv4 Routes
                0.0.0.0/0               192.168.0.1 dst-ip
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1328: ovn-nbctl lr-route-add lr0 10.0.0.0/24 11.0.0.1"
at_fn_check_prepare_trace "ovn-nbctl.at:1328"
( $at_check_trace; ovn-nbctl lr-route-add lr0 10.0.0.0/24 11.0.0.1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1328: ovn-nbctl --policy=src-ip lr-route-add lr0 10.0.0.0/24 11.0.0.2"
at_fn_check_prepare_trace "ovn-nbctl.at:1328"
( $at_check_trace; ovn-nbctl --policy=src-ip lr-route-add lr0 10.0.0.0/24 11.0.0.2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1328: ovn-nbctl lr-route-del lr0 10.0.0.0/24"
at_fn_check_prepare_trace "ovn-nbctl.at:1328"
( $at_check_trace; ovn-nbctl lr-route-del lr0 10.0.0.0/24
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1328: ovn-nbctl lr-route-list lr0"
at_fn_check_prepare_trace "ovn-nbctl.at:1328"
( $at_check_trace; ovn-nbctl lr-route-list lr0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "IPv4 Routes
                0.0.0.0/0               192.168.0.1 dst-ip
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1328: ovn-nbctl lr-route-del lr0"
at_fn_check_prepare_trace "ovn-nbctl.at:1328"
( $at_check_trace; ovn-nbctl lr-route-del lr0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1328: ovn-nbctl lr-route-list lr0"
at_fn_check_prepare_trace "ovn-nbctl.at:1328"
( $at_check_trace; ovn-nbctl lr-route-list lr0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1328: ovn-nbctl lr-route-add lr0 10.0.0.0/24 11.0.0.1"
at_fn_check_prepare_trace "ovn-nbctl.at:1328"
( $at_check_trace; ovn-nbctl lr-route-add lr0 10.0.0.0/24 11.0.0.1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1328: ovn-nbctl --ecmp lr-route-add lr0 10.0.0.0/24 11.0.0.2"
at_fn_check_prepare_trace "ovn-nbctl.at:1328"
( $at_check_trace; ovn-nbctl --ecmp lr-route-add lr0 10.0.0.0/24 11.0.0.2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1328: ovn-nbctl --ecmp lr-route-add lr0 10.0.0.0/24 11.0.0.2"
at_fn_check_prepare_trace "ovn-nbctl.at:1328"
( $at_check_trace; ovn-nbctl --ecmp lr-route-add lr0 10.0.0.0/24 11.0.0.2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1328: ovn-nbctl --ecmp lr-route-add lr0 10.0.0.0/24 11.0.0.3"
at_fn_check_prepare_trace "ovn-nbctl.at:1328"
( $at_check_trace; ovn-nbctl --ecmp lr-route-add lr0 10.0.0.0/24 11.0.0.3
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1328: ovn-nbctl --ecmp lr-route-add lr0 10.0.0.0/24 11.0.0.3 lp0"
at_fn_check_prepare_trace "ovn-nbctl.at:1328"
( $at_check_trace; ovn-nbctl --ecmp lr-route-add lr0 10.0.0.0/24 11.0.0.3 lp0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1328: ovn-nbctl lr-route-list lr0"
at_fn_check_prepare_trace "ovn-nbctl.at:1328"
( $at_check_trace; ovn-nbctl lr-route-list lr0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "IPv4 Routes
              10.0.0.0/24                  11.0.0.1 dst-ip
              10.0.0.0/24                  11.0.0.2 dst-ip
              10.0.0.0/24                  11.0.0.2 dst-ip
              10.0.0.0/24                  11.0.0.3 dst-ip
              10.0.0.0/24                  11.0.0.3 dst-ip lp0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1328: ovn-nbctl lr-route-del lr0 10.0.0.0/24 11.0.0.1"
at_fn_check_prepare_trace "ovn-nbctl.at:1328"
( $at_check_trace; ovn-nbctl lr-route-del lr0 10.0.0.0/24 11.0.0.1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1328: ovn-nbctl lr-route-list lr0"
at_fn_check_prepare_trace "ovn-nbctl.at:1328"
( $at_check_trace; ovn-nbctl lr-route-list lr0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "IPv4 Routes
              10.0.0.0/24                  11.0.0.2 dst-ip
              10.0.0.0/24                  11.0.0.2 dst-ip
              10.0.0.0/24                  11.0.0.3 dst-ip
              10.0.0.0/24                  11.0.0.3 dst-ip lp0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1328: ovn-nbctl lr-route-del lr0 10.0.0.0/24 11.0.0.2"
at_fn_check_prepare_trace "ovn-nbctl.at:1328"
( $at_check_trace; ovn-nbctl lr-route-del lr0 10.0.0.0/24 11.0.0.2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1328: ovn-nbctl lr-route-list lr0"
at_fn_check_prepare_trace "ovn-nbctl.at:1328"
( $at_check_trace; ovn-nbctl lr-route-list lr0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "IPv4 Routes
              10.0.0.0/24                  11.0.0.3 dst-ip
              10.0.0.0/24                  11.0.0.3 dst-ip lp0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1328: ovn-nbctl lr-route-del lr0 10.0.0.0/24 11.0.0.3 lp0"
at_fn_check_prepare_trace "ovn-nbctl.at:1328"
( $at_check_trace; ovn-nbctl lr-route-del lr0 10.0.0.0/24 11.0.0.3 lp0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1328: ovn-nbctl lr-route-list lr0"
at_fn_check_prepare_trace "ovn-nbctl.at:1328"
( $at_check_trace; ovn-nbctl lr-route-list lr0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "IPv4 Routes
              10.0.0.0/24                  11.0.0.3 dst-ip
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1328: ovn-nbctl lr-route-del lr0 10.0.0.0/24 11.0.0.3"
at_fn_check_prepare_trace "ovn-nbctl.at:1328"
( $at_check_trace; ovn-nbctl lr-route-del lr0 10.0.0.0/24 11.0.0.3
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1328: ovn-nbctl lr-route-list lr0"
at_fn_check_prepare_trace "ovn-nbctl.at:1328"
( $at_check_trace; ovn-nbctl lr-route-list lr0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1328: ovn-nbctl lr-route-add lr0 0:0:0:0:0:0:0:0/0 2001:0db8:0:f101::1"
at_fn_check_prepare_trace "ovn-nbctl.at:1328"
( $at_check_trace; ovn-nbctl lr-route-add lr0 0:0:0:0:0:0:0:0/0 2001:0db8:0:f101::1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1328: ovn-nbctl lr-route-add lr0 2001:0db8:0::/64 2001:0db8:0:f102::1 lp0"
at_fn_check_prepare_trace "ovn-nbctl.at:1328"
( $at_check_trace; ovn-nbctl lr-route-add lr0 2001:0db8:0::/64 2001:0db8:0:f102::1 lp0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1328: ovn-nbctl lr-route-add lr0 2001:0db8:1::/64 2001:0db8:0:f103::1"
at_fn_check_prepare_trace "ovn-nbctl.at:1328"
( $at_check_trace; ovn-nbctl lr-route-add lr0 2001:0db8:1::/64 2001:0db8:0:f103::1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1328: ovn-nbctl lr-route-list lr0"
at_fn_check_prepare_trace "ovn-nbctl.at:1328"
( $at_check_trace; ovn-nbctl lr-route-list lr0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "IPv6 Routes
            2001:db8::/64        2001:db8:0:f102::1 dst-ip lp0
          2001:db8:1::/64        2001:db8:0:f103::1 dst-ip
                     ::/0        2001:db8:0:f101::1 dst-ip
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1328: ovn-nbctl lr-route-del lr0 2001:0db8:0::/64"
at_fn_check_prepare_trace "ovn-nbctl.at:1328"
( $at_check_trace; ovn-nbctl lr-route-del lr0 2001:0db8:0::/64
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1328: ovn-nbctl lr-route-list lr0"
at_fn_check_prepare_trace "ovn-nbctl.at:1328"
( $at_check_trace; ovn-nbctl lr-route-list lr0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "IPv6 Routes
          2001:db8:1::/64        2001:db8:0:f103::1 dst-ip
                     ::/0        2001:db8:0:f101::1 dst-ip
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1328: ovn-nbctl lr-route-del lr0"
at_fn_check_prepare_trace "ovn-nbctl.at:1328"
( $at_check_trace; ovn-nbctl lr-route-del lr0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1328: ovn-nbctl lr-route-list lr0"
at_fn_check_prepare_trace "ovn-nbctl.at:1328"
( $at_check_trace; ovn-nbctl lr-route-list lr0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1328: ovn-nbctl lr-route-add lr0 0.0.0.0/0 192.168.0.1"
at_fn_check_prepare_trace "ovn-nbctl.at:1328"
( $at_check_trace; ovn-nbctl lr-route-add lr0 0.0.0.0/0 192.168.0.1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1328: ovn-nbctl lr-route-add lr0 10.0.1.1/24 11.0.1.1 lp0"
at_fn_check_prepare_trace "ovn-nbctl.at:1328"
( $at_check_trace; ovn-nbctl lr-route-add lr0 10.0.1.1/24 11.0.1.1 lp0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1328: ovn-nbctl lr-route-add lr0 10.0.0.1/24 11.0.0.1"
at_fn_check_prepare_trace "ovn-nbctl.at:1328"
( $at_check_trace; ovn-nbctl lr-route-add lr0 10.0.0.1/24 11.0.0.1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1328: ovn-nbctl lr-route-add lr0 0:0:0:0:0:0:0:0/0 2001:0db8:0:f101::1"
at_fn_check_prepare_trace "ovn-nbctl.at:1328"
( $at_check_trace; ovn-nbctl lr-route-add lr0 0:0:0:0:0:0:0:0/0 2001:0db8:0:f101::1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1328: ovn-nbctl lr-route-add lr0 2001:0db8:0::/64 2001:0db8:0:f102::1 lp0"
at_fn_check_prepare_trace "ovn-nbctl.at:1328"
( $at_check_trace; ovn-nbctl lr-route-add lr0 2001:0db8:0::/64 2001:0db8:0:f102::1 lp0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1328: ovn-nbctl lr-route-add lr0 2001:0db8:1::/64 2001:0db8:0:f103::1"
at_fn_check_prepare_trace "ovn-nbctl.at:1328"
( $at_check_trace; ovn-nbctl lr-route-add lr0 2001:0db8:1::/64 2001:0db8:0:f103::1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1328: ovn-nbctl lr-route-list lr0"
at_fn_check_prepare_trace "ovn-nbctl.at:1328"
( $at_check_trace; ovn-nbctl lr-route-list lr0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "IPv4 Routes
              10.0.0.0/24                  11.0.0.1 dst-ip
              10.0.1.0/24                  11.0.1.1 dst-ip lp0
                0.0.0.0/0               192.168.0.1 dst-ip

IPv6 Routes
            2001:db8::/64        2001:db8:0:f102::1 dst-ip lp0
          2001:db8:1::/64        2001:db8:0:f103::1 dst-ip
                     ::/0        2001:db8:0:f101::1 dst-ip
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

    }


    ovn_nbctl_policies() {

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1509: ovn-nbctl lr-add lr0"
at_fn_check_prepare_trace "ovn-nbctl.at:1509"
( $at_check_trace; ovn-nbctl lr-add lr0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1509"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1509: ovn-nbctl lr-policy-add lr0 100 \"ip4.src == 1.1.1.0/24\" drop"
at_fn_check_prepare_trace "ovn-nbctl.at:1509"
( $at_check_trace; ovn-nbctl lr-policy-add lr0 100 "ip4.src == 1.1.1.0/24" drop
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1509"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1509: ovn-nbctl lr-policy-add lr0 100 \"ip4.src == 1.1.2.0/24\" allow"
at_fn_check_prepare_trace "ovn-nbctl.at:1509"
( $at_check_trace; ovn-nbctl lr-policy-add lr0 100 "ip4.src == 1.1.2.0/24" allow
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1509"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1509: ovn-nbctl lr-policy-add lr0 101 \"ip4.src == 2.1.1.0/24\" allow"
at_fn_check_prepare_trace "ovn-nbctl.at:1509"
( $at_check_trace; ovn-nbctl lr-policy-add lr0 101 "ip4.src == 2.1.1.0/24" allow
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1509"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1509: ovn-nbctl lr-policy-add lr0 101 \"ip4.src == 2.1.2.0/24\" drop"
at_fn_check_prepare_trace "ovn-nbctl.at:1509"
( $at_check_trace; ovn-nbctl lr-policy-add lr0 101 "ip4.src == 2.1.2.0/24" drop
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1509"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1509: ovn-nbctl lr-policy-add lr0 101 \"ip6.src == 2002::/64\" drop"
at_fn_check_prepare_trace "ovn-nbctl.at:1509"
( $at_check_trace; ovn-nbctl lr-policy-add lr0 101 "ip6.src == 2002::/64" drop
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1509"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1509: ovn-nbctl lr-policy-add lr0 100 \"ip4.src == 1.1.1.0/24\" drop"
at_fn_check_prepare_trace "ovn-nbctl.at:1509"
( $at_check_trace; ovn-nbctl lr-policy-add lr0 100 "ip4.src == 1.1.1.0/24" drop
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: Same routing policy already existed on the logical router lr0.
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:1509"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1509: ovn-nbctl lr-policy-add lr0 103 \"ip4.src == 1.1.1.0/24\" deny"
at_fn_check_prepare_trace "ovn-nbctl.at:1509"
( $at_check_trace; ovn-nbctl lr-policy-add lr0 103 "ip4.src == 1.1.1.0/24" deny
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: deny: action must be one of \"allow\", \"drop\", and \"reroute\"
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:1509"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1509: ovn-nbctl lr-policy-del lr0 100 \"ip4.src == 1.1.1.0/24\""
at_fn_check_prepare_trace "ovn-nbctl.at:1509"
( $at_check_trace; ovn-nbctl lr-policy-del lr0 100 "ip4.src == 1.1.1.0/24"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1509"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1509: ovn-nbctl lr-policy-list lr0"
at_fn_check_prepare_trace "ovn-nbctl.at:1509"
( $at_check_trace; ovn-nbctl lr-policy-list lr0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "Routing Policies
       101                              ip4.src == 2.1.1.0/24           allow
       101                              ip4.src == 2.1.2.0/24            drop
       101                               ip6.src == 2002::/64            drop
       100                              ip4.src == 1.1.2.0/24           allow
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1509"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1509: ovn-nbctl lr-policy-del lr0 101"
at_fn_check_prepare_trace "ovn-nbctl.at:1509"
( $at_check_trace; ovn-nbctl lr-policy-del lr0 101
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1509"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1509: ovn-nbctl lr-policy-list lr0"
at_fn_check_prepare_trace "ovn-nbctl.at:1509"
( $at_check_trace; ovn-nbctl lr-policy-list lr0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "Routing Policies
       100                              ip4.src == 1.1.2.0/24           allow
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1509"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1509: ovn-nbctl lr-policy-add lr0 102 \"ip4.src == 3.1.2.0/24\" reroute 3.3.3.3"
at_fn_check_prepare_trace "ovn-nbctl.at:1509"
( $at_check_trace; ovn-nbctl lr-policy-add lr0 102 "ip4.src == 3.1.2.0/24" reroute 3.3.3.3
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1509"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1509: ovn-nbctl lr-policy-add lr0 103 \"ip4.src == 3.1.2.0/24\" reroute 3.3.3.x"
at_fn_check_prepare_trace "ovn-nbctl.at:1509"
( $at_check_trace; ovn-nbctl lr-policy-add lr0 103 "ip4.src == 3.1.2.0/24" reroute 3.3.3.x
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: bad next hop argument: 3.3.3.x
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:1509"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1509: ovn-nbctl lr-policy-add lr0 104 \"ip6.src == 2001::/64\" reroute 2002::5"
at_fn_check_prepare_trace "ovn-nbctl.at:1509"
( $at_check_trace; ovn-nbctl lr-policy-add lr0 104 "ip6.src == 2001::/64" reroute 2002::5
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1509"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1509: ovn-nbctl lr-policy-add lr0 105 \"ip6.src == 2001::/64\" reroute 2002::x"
at_fn_check_prepare_trace "ovn-nbctl.at:1509"
( $at_check_trace; ovn-nbctl lr-policy-add lr0 105 "ip6.src == 2001::/64" reroute 2002::x
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: bad next hop argument: 2002::x
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:1509"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }



    }


    ovn_nbctl_lsp_types() {

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1566: ovn-nbctl ls-add ls0"
at_fn_check_prepare_trace "ovn-nbctl.at:1566"
( $at_check_trace; ovn-nbctl ls-add ls0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1566"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1566: ovn-nbctl lsp-add ls0 lp0"
at_fn_check_prepare_trace "ovn-nbctl.at:1566"
( $at_check_trace; ovn-nbctl lsp-add ls0 lp0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1566"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1566: ovn-nbctl lsp-get-type lp0"
at_fn_check_prepare_trace "ovn-nbctl.at:1566"
( $at_check_trace; ovn-nbctl lsp-get-type lp0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1566"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1566: ovn-nbctl lsp-set-type lp0 l2gateway"
at_fn_check_prepare_trace "ovn-nbctl.at:1566"
( $at_check_trace; ovn-nbctl lsp-set-type lp0 l2gateway
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1566"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1566: ovn-nbctl lsp-get-type lp0"
at_fn_check_prepare_trace "ovn-nbctl.at:1566"
( $at_check_trace; ovn-nbctl lsp-get-type lp0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "l2gateway
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1566"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1566: ovn-nbctl lsp-set-type lp0 router"
at_fn_check_prepare_trace "ovn-nbctl.at:1566"
( $at_check_trace; ovn-nbctl lsp-set-type lp0 router
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1566"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1566: ovn-nbctl lsp-get-type lp0"
at_fn_check_prepare_trace "ovn-nbctl.at:1566"
( $at_check_trace; ovn-nbctl lsp-get-type lp0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "router
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1566"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1566: ovn-nbctl lsp-set-type lp0 localnet"
at_fn_check_prepare_trace "ovn-nbctl.at:1566"
( $at_check_trace; ovn-nbctl lsp-set-type lp0 localnet
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1566"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1566: ovn-nbctl lsp-get-type lp0"
at_fn_check_prepare_trace "ovn-nbctl.at:1566"
( $at_check_trace; ovn-nbctl lsp-get-type lp0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "localnet
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1566"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1566: ovn-nbctl lsp-set-type lp0 localport"
at_fn_check_prepare_trace "ovn-nbctl.at:1566"
( $at_check_trace; ovn-nbctl lsp-set-type lp0 localport
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1566"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1566: ovn-nbctl lsp-get-type lp0"
at_fn_check_prepare_trace "ovn-nbctl.at:1566"
( $at_check_trace; ovn-nbctl lsp-get-type lp0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "localport
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1566"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1566: ovn-nbctl lsp-set-type lp0 vtep"
at_fn_check_prepare_trace "ovn-nbctl.at:1566"
( $at_check_trace; ovn-nbctl lsp-set-type lp0 vtep
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1566"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1566: ovn-nbctl lsp-get-type lp0"
at_fn_check_prepare_trace "ovn-nbctl.at:1566"
( $at_check_trace; ovn-nbctl lsp-get-type lp0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "vtep
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1566"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1566: ovn-nbctl lsp-set-type lp0 l3gateway"
at_fn_check_prepare_trace "ovn-nbctl.at:1566"
( $at_check_trace; ovn-nbctl lsp-set-type lp0 l3gateway
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: Logical switch port type 'l3gateway' is unrecognized. Not setting type.
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:1566"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1566: ovn-nbctl lsp-set-type lp0 patch"
at_fn_check_prepare_trace "ovn-nbctl.at:1566"
( $at_check_trace; ovn-nbctl lsp-set-type lp0 patch
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: Logical switch port type 'patch' is unrecognized. Not setting type.
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:1566"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1566: ovn-nbctl lsp-set-type lp0 chassisredirect"
at_fn_check_prepare_trace "ovn-nbctl.at:1566"
( $at_check_trace; ovn-nbctl lsp-set-type lp0 chassisredirect
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: Logical switch port type 'chassisredirect' is unrecognized. Not setting type.
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:1566"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1566: ovn-nbctl lsp-get-type lp0"
at_fn_check_prepare_trace "ovn-nbctl.at:1566"
( $at_check_trace; ovn-nbctl lsp-get-type lp0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "vtep
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1566"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1566: ovn-nbctl lsp-set-type lp0 eggs"
at_fn_check_prepare_trace "ovn-nbctl.at:1566"
( $at_check_trace; ovn-nbctl lsp-set-type lp0 eggs
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: Logical switch port type 'eggs' is unrecognized. Not setting type.
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:1566"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1566: ovn-nbctl lsp-set-type lp0 \"\""
at_fn_check_prepare_trace "ovn-nbctl.at:1566"
( $at_check_trace; ovn-nbctl lsp-set-type lp0 ""
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1566"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1566: ovn-nbctl lsp-get-type lp0"
at_fn_check_prepare_trace "ovn-nbctl.at:1566"
( $at_check_trace; ovn-nbctl lsp-get-type lp0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1566"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

    }


    ovn_nbctl_connection() {

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1634: ovn-nbctl --inactivity-probe=30000 set-connection ptcp:6641:127.0.0.1 punix:\$OVS_RUNDIR/ovnnb_db.sock"
at_fn_check_prepare_dynamic "ovn-nbctl --inactivity-probe=30000 set-connection ptcp:6641:127.0.0.1 punix:$OVS_RUNDIR/ovnnb_db.sock" "ovn-nbctl.at:1634"
( $at_check_trace; ovn-nbctl --inactivity-probe=30000 set-connection ptcp:6641:127.0.0.1 punix:$OVS_RUNDIR/ovnnb_db.sock
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1634"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1634: ovn-nbctl list connection | grep inactivity_probe"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:1634"
( $at_check_trace; ovn-nbctl list connection | grep inactivity_probe
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "inactivity_probe    : 30000
inactivity_probe    : 30000
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1634"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

    }


    ovn_nbctl_dry_run_mode() {

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1643: ovn-nbctl --dry-run ls-add ls0 -- ls-list | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:1643"
( $at_check_trace; ovn-nbctl --dry-run ls-add ls0 -- ls-list | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "<0> (ls0)
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1643"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1643: ovn-nbctl ls-list | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:1643"
( $at_check_trace; ovn-nbctl ls-list | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1643"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1643: ovn-nbctl ls-add ls0"
at_fn_check_prepare_trace "ovn-nbctl.at:1643"
( $at_check_trace; ovn-nbctl ls-add ls0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1643"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1643: ovn-nbctl ls-list | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:1643"
( $at_check_trace; ovn-nbctl ls-list | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "<0> (ls0)
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1643"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

    }


    ovn_nbctl_oneline_output() {

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1659: ovn-nbctl ls-add ls0 -- ls-add ls1"
at_fn_check_prepare_trace "ovn-nbctl.at:1659"
( $at_check_trace; ovn-nbctl ls-add ls0 -- ls-add ls1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1659"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1659: ovn-nbctl --oneline ls-list | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:1659"
( $at_check_trace; ovn-nbctl --oneline ls-list | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "<0> (ls0)\\n<1> (ls1)
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1659"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1659: ovn-nbctl --oneline ls-list -- ls-list | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:1659"
( $at_check_trace; ovn-nbctl --oneline ls-list -- ls-list | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "<0> (ls0)\\n<1> (ls1)
<0> (ls0)\\n<1> (ls1)
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1659"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

    }


    ovn_nbctl_error_paths() {


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1675: ovn-nbctl -- --if-exists --if-exists list Logical_Switch"
at_fn_check_prepare_trace "ovn-nbctl.at:1675"
( $at_check_trace; ovn-nbctl -- --if-exists --if-exists list Logical_Switch
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:1675"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1675: grep 'option specified multiple times' stderr"
at_fn_check_prepare_trace "ovn-nbctl.at:1675"
( $at_check_trace; grep 'option specified multiple times' stderr
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1675"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1675: ovn-nbctl"
at_fn_check_prepare_trace "ovn-nbctl.at:1675"
( $at_check_trace; ovn-nbctl
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:1675"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1675: grep 'missing command name' stderr"
at_fn_check_prepare_trace "ovn-nbctl.at:1675"
( $at_check_trace; grep 'missing command name' stderr
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1675"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1675: ovn-nbctl --if-exists"
at_fn_check_prepare_trace "ovn-nbctl.at:1675"
( $at_check_trace; ovn-nbctl --if-exists
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:1675"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1675: grep 'missing command name' stderr"
at_fn_check_prepare_trace "ovn-nbctl.at:1675"
( $at_check_trace; grep 'missing command name' stderr
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1675"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1675: ovn-nbctl --"
at_fn_check_prepare_trace "ovn-nbctl.at:1675"
( $at_check_trace; ovn-nbctl --
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:1675"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1675: grep 'missing command name' stderr"
at_fn_check_prepare_trace "ovn-nbctl.at:1675"
( $at_check_trace; grep 'missing command name' stderr
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1675"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1675: ovn-nbctl -- --if-exists"
at_fn_check_prepare_trace "ovn-nbctl.at:1675"
( $at_check_trace; ovn-nbctl -- --if-exists
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:1675"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1675: grep 'missing command name' stderr"
at_fn_check_prepare_trace "ovn-nbctl.at:1675"
( $at_check_trace; grep 'missing command name' stderr
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1675"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1675: ovn-nbctl foo"
at_fn_check_prepare_trace "ovn-nbctl.at:1675"
( $at_check_trace; ovn-nbctl foo
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:1675"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1675: grep 'unknown command' stderr"
at_fn_check_prepare_trace "ovn-nbctl.at:1675"
( $at_check_trace; grep 'unknown command' stderr
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1675"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1675: ovn-nbctl -- foo"
at_fn_check_prepare_trace "ovn-nbctl.at:1675"
( $at_check_trace; ovn-nbctl -- foo
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:1675"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1675: grep 'unknown command' stderr"
at_fn_check_prepare_trace "ovn-nbctl.at:1675"
( $at_check_trace; grep 'unknown command' stderr
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1675"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1675: ovn-nbctl --foo list Logical_Switch"
at_fn_check_prepare_trace "ovn-nbctl.at:1675"
( $at_check_trace; ovn-nbctl --foo list Logical_Switch
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:1675"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1675: grep 'unrecognized option' stderr"
at_fn_check_prepare_trace "ovn-nbctl.at:1675"
( $at_check_trace; grep 'unrecognized option' stderr
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1675"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1675: ovn-nbctl -- --foo list Logical_Switch"
at_fn_check_prepare_trace "ovn-nbctl.at:1675"
( $at_check_trace; ovn-nbctl -- --foo list Logical_Switch
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:1675"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1675: grep 'command has no .* option' stderr"
at_fn_check_prepare_trace "ovn-nbctl.at:1675"
( $at_check_trace; grep 'command has no .* option' stderr
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1675"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1675: ovn-nbctl --columns"
at_fn_check_prepare_trace "ovn-nbctl.at:1675"
( $at_check_trace; ovn-nbctl --columns
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:1675"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1675: grep 'option .* requires an argument' stderr"
at_fn_check_prepare_trace "ovn-nbctl.at:1675"
( $at_check_trace; grep 'option .* requires an argument' stderr
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1675"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1675: ovn-nbctl -- --columns list Logical_Switch"
at_fn_check_prepare_trace "ovn-nbctl.at:1675"
( $at_check_trace; ovn-nbctl -- --columns list Logical_Switch
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:1675"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1675: grep 'missing argument to .* option' stderr"
at_fn_check_prepare_trace "ovn-nbctl.at:1675"
( $at_check_trace; grep 'missing argument to .* option' stderr
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1675"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1675: ovn-nbctl --if-exists=foo list Logical_Switch"
at_fn_check_prepare_trace "ovn-nbctl.at:1675"
( $at_check_trace; ovn-nbctl --if-exists=foo list Logical_Switch
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:1675"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1675: egrep 'option .* doesn'\\''t allow an argument|option .* requires an argument' stderr"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-nbctl.at:1675"
( $at_check_trace; egrep 'option .* doesn'\''t allow an argument|option .* requires an argument' stderr
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1675"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1675: ovn-nbctl -- --if-exists=foo list Logical_Switch"
at_fn_check_prepare_trace "ovn-nbctl.at:1675"
( $at_check_trace; ovn-nbctl -- --if-exists=foo list Logical_Switch
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:1675"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1675: grep 'option on .* does not accept an argument' stderr"
at_fn_check_prepare_trace "ovn-nbctl.at:1675"
( $at_check_trace; grep 'option on .* does not accept an argument' stderr
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1675"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1675: ovn-nbctl list"
at_fn_check_prepare_trace "ovn-nbctl.at:1675"
( $at_check_trace; ovn-nbctl list
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:1675"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1675: grep 'command requires at least .* arguments' stderr"
at_fn_check_prepare_trace "ovn-nbctl.at:1675"
( $at_check_trace; grep 'command requires at least .* arguments' stderr
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1675"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1675: ovn-nbctl -- list"
at_fn_check_prepare_trace "ovn-nbctl.at:1675"
( $at_check_trace; ovn-nbctl -- list
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:1675"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1675: grep 'command requires at least .* arguments' stderr"
at_fn_check_prepare_trace "ovn-nbctl.at:1675"
( $at_check_trace; grep 'command requires at least .* arguments' stderr
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1675"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1675: ovn-nbctl show foo bar"
at_fn_check_prepare_trace "ovn-nbctl.at:1675"
( $at_check_trace; ovn-nbctl show foo bar
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:1675"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1675: grep 'command takes at most .* arguments' stderr"
at_fn_check_prepare_trace "ovn-nbctl.at:1675"
( $at_check_trace; grep 'command takes at most .* arguments' stderr
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1675"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1675: ovn-nbctl -- show foo bar"
at_fn_check_prepare_trace "ovn-nbctl.at:1675"
( $at_check_trace; ovn-nbctl -- show foo bar
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:1675"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1675: grep 'command takes at most .* arguments' stderr"
at_fn_check_prepare_trace "ovn-nbctl.at:1675"
( $at_check_trace; grep 'command takes at most .* arguments' stderr
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1675"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1675: ovn-nbctl show foo --bar"
at_fn_check_prepare_trace "ovn-nbctl.at:1675"
( $at_check_trace; ovn-nbctl show foo --bar
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:1675"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1675: grep 'command takes at most .* arguments' stderr"
at_fn_check_prepare_trace "ovn-nbctl.at:1675"
( $at_check_trace; grep 'command takes at most .* arguments' stderr
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1675"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1675: ovn-nbctl -- show foo --bar"
at_fn_check_prepare_trace "ovn-nbctl.at:1675"
( $at_check_trace; ovn-nbctl -- show foo --bar
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:1675"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1675: grep 'command takes at most .* arguments' stderr"
at_fn_check_prepare_trace "ovn-nbctl.at:1675"
( $at_check_trace; grep 'command takes at most .* arguments' stderr
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1675"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

    }


    ovn_nbctl_port_groups() {

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1746: ovn-nbctl create Port_Group name=pg0"
at_fn_check_prepare_trace "ovn-nbctl.at:1746"
( $at_check_trace; ovn-nbctl create Port_Group name=pg0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1746"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1746: ovn-nbctl get Port_Group pg0 name"
at_fn_check_prepare_trace "ovn-nbctl.at:1746"
( $at_check_trace; ovn-nbctl get Port_Group pg0 name
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "pg0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1746"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

    }


    ovn_nbctl_extra_newlines() {

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1753: ovn-nbctl ls-add sw1"
at_fn_check_prepare_trace "ovn-nbctl.at:1753"
( $at_check_trace; ovn-nbctl ls-add sw1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1753"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1753: ovn-nbctl --columns=name list logical_switch sw1"
at_fn_check_prepare_trace "ovn-nbctl.at:1753"
( $at_check_trace; ovn-nbctl --columns=name list logical_switch sw1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "name                : sw1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1753"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1753: ovn-nbctl --columns=name list logical_switch sw1"
at_fn_check_prepare_trace "ovn-nbctl.at:1753"
( $at_check_trace; ovn-nbctl --columns=name list logical_switch sw1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "name                : sw1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1753"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

    }


    ovn_nbctl_table_formatting() {

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1765: ovn-nbctl ls-add sw1"
at_fn_check_prepare_trace "ovn-nbctl.at:1765"
( $at_check_trace; ovn-nbctl ls-add sw1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1765"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1765: ovn-nbctl --bare --columns=name list logical_switch sw1"
at_fn_check_prepare_trace "ovn-nbctl.at:1765"
( $at_check_trace; ovn-nbctl --bare --columns=name list logical_switch sw1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "sw1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1765"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

    }


    ovn_nbctl_port_group_commands() {

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1775: ovn-nbctl pg-add pg1"
at_fn_check_prepare_trace "ovn-nbctl.at:1775"
( $at_check_trace; ovn-nbctl pg-add pg1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1775"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1775: ovn-nbctl --bare --columns=name list port_group pg1"
at_fn_check_prepare_trace "ovn-nbctl.at:1775"
( $at_check_trace; ovn-nbctl --bare --columns=name list port_group pg1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "pg1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1775"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1775: ovn-nbctl pg-del pg1"
at_fn_check_prepare_trace "ovn-nbctl.at:1775"
( $at_check_trace; ovn-nbctl pg-del pg1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1775"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1775: ovn-nbctl list port_group"
at_fn_check_prepare_trace "ovn-nbctl.at:1775"
( $at_check_trace; ovn-nbctl list port_group
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1775"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1775: ovn-nbctl ls-add sw1"
at_fn_check_prepare_trace "ovn-nbctl.at:1775"
( $at_check_trace; ovn-nbctl ls-add sw1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1775"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1775: ovn-nbctl lsp-add sw1 sw1-p1"
at_fn_check_prepare_trace "ovn-nbctl.at:1775"
( $at_check_trace; ovn-nbctl lsp-add sw1 sw1-p1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1775"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

SW1P1=$(ovn-nbctl --bare --columns=_uuid list logical_switch_port sw1-p1)
{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1775: ovn-nbctl lsp-add sw1 sw1-p2"
at_fn_check_prepare_trace "ovn-nbctl.at:1775"
( $at_check_trace; ovn-nbctl lsp-add sw1 sw1-p2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1775"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

SW1P2=$(ovn-nbctl --bare --columns=_uuid list logical_switch_port sw1-p2)

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1775: ovn-nbctl pg-add pg1 sw1-p1"
at_fn_check_prepare_trace "ovn-nbctl.at:1775"
( $at_check_trace; ovn-nbctl pg-add pg1 sw1-p1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1775"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1775: ovn-nbctl --bare --columns=name list port_group pg1"
at_fn_check_prepare_trace "ovn-nbctl.at:1775"
( $at_check_trace; ovn-nbctl --bare --columns=name list port_group pg1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "pg1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1775"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1775: ovn-nbctl --bare --columns=ports list port_group pg1"
at_fn_check_prepare_trace "ovn-nbctl.at:1775"
( $at_check_trace; ovn-nbctl --bare --columns=ports list port_group pg1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "$SW1P1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1775"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1775: ovn-nbctl pg-set-ports pg1 sw1-p2"
at_fn_check_prepare_trace "ovn-nbctl.at:1775"
( $at_check_trace; ovn-nbctl pg-set-ports pg1 sw1-p2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1775"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1775: ovn-nbctl --bare --columns=ports list port_group pg1"
at_fn_check_prepare_trace "ovn-nbctl.at:1775"
( $at_check_trace; ovn-nbctl --bare --columns=ports list port_group pg1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "$SW1P2
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1775"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1775: ovn-nbctl pg-del pg1"
at_fn_check_prepare_trace "ovn-nbctl.at:1775"
( $at_check_trace; ovn-nbctl pg-del pg1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1775"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1775: ovn-nbctl list port_group"
at_fn_check_prepare_trace "ovn-nbctl.at:1775"
( $at_check_trace; ovn-nbctl list port_group
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1775"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


    }


    ovn_nbctl_fwd_groups() {


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1808: ovn-nbctl fwd-group-add fwd_grp1 ls0 10.1.1.11 00:11:22:33:44:55 lsp1 lsp2"
at_fn_check_prepare_trace "ovn-nbctl.at:1808"
( $at_check_trace; ovn-nbctl fwd-group-add fwd_grp1 ls0 10.1.1.11 00:11:22:33:44:55 lsp1 lsp2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: ls0: switch name not found
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:1808"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1808: ovn-nbctl ls-add ls0"
at_fn_check_prepare_trace "ovn-nbctl.at:1808"
( $at_check_trace; ovn-nbctl ls-add ls0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1808"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1808: ovn-nbctl fwd-group-add fwd_grp1 ls0 10.1.1.11 00:11:22:33:44:55 lsp1 lsp2"
at_fn_check_prepare_trace "ovn-nbctl.at:1808"
( $at_check_trace; ovn-nbctl fwd-group-add fwd_grp1 ls0 10.1.1.11 00:11:22:33:44:55 lsp1 lsp2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: lsp1: logical switch port does not exist
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:1808"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1808: ovn-nbctl lsp-add ls0 lsp1"
at_fn_check_prepare_trace "ovn-nbctl.at:1808"
( $at_check_trace; ovn-nbctl lsp-add ls0 lsp1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1808"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1808: ovn-nbctl lsp-add ls0 lsp2"
at_fn_check_prepare_trace "ovn-nbctl.at:1808"
( $at_check_trace; ovn-nbctl lsp-add ls0 lsp2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1808"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1808: ovn-nbctl fwd-group-add fwd_grp1 ls0 10.1.1.11 00:11:22:33:44:55 lsp1 lsp2"
at_fn_check_prepare_trace "ovn-nbctl.at:1808"
( $at_check_trace; ovn-nbctl fwd-group-add fwd_grp1 ls0 10.1.1.11 00:11:22:33:44:55 lsp1 lsp2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1808"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1808: ovn-nbctl fwd-group-list ls0"
at_fn_check_prepare_trace "ovn-nbctl.at:1808"
( $at_check_trace; ovn-nbctl fwd-group-list ls0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "FWD_GROUP       LS            VIP             VMAC                  CHILD_PORTS
fwd_grp1        ls0           10.1.1.11      00:11:22:33:44:55      lsp1 lsp2
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1808"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1808: ovn-nbctl --bare --columns=name list forwarding_group"
at_fn_check_prepare_trace "ovn-nbctl.at:1808"
( $at_check_trace; ovn-nbctl --bare --columns=name list forwarding_group
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "fwd_grp1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1808"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1808: ovn-nbctl fwd-group-add fwd_grp1 ls0 10.1.1.11 00:11:22:33:44:55 lsp1 lsp2"
at_fn_check_prepare_trace "ovn-nbctl.at:1808"
( $at_check_trace; ovn-nbctl fwd-group-add fwd_grp1 ls0 10.1.1.11 00:11:22:33:44:55 lsp1 lsp2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: fwd_grp1: a forwarding group by this name already exists
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-nbctl.at:1808"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1808: ovn-nbctl fwd-group-del fwd_grp1"
at_fn_check_prepare_trace "ovn-nbctl.at:1808"
( $at_check_trace; ovn-nbctl fwd-group-del fwd_grp1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1808"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1808: ovn-nbctl list forwarding_group"
at_fn_check_prepare_trace "ovn-nbctl.at:1808"
( $at_check_trace; ovn-nbctl list forwarding_group
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1808"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }



    }


# try_checkpatch PATCH [ERRORS]
#
# Runs checkpatch under Python 2 and Python 3, if installed, on the given
# PATCH, expecting the specified set of ERRORS (and warnings).
try_checkpatch() {
    # Take the patch to test from $1.  Remove an initial four-space indent
    # from it and, if it is just headers with no body, add a null body.
    echo "$1" | sed 's/^    //' > test.patch
    if grep '---' expout >/dev/null 2>&1; then :
    else
        printf '\n---\n' >> test.patch
    fi

    # Take expected output from $2.
    if test -n "$2"; then
        echo "$2" | sed 's/^    //' > expout
    else
        : > expout
    fi

    try_checkpatch__ "$PYTHON3"
}
try_checkpatch__() {
    if test -s expout; then
        { set +x
$as_echo "$at_srcdir/checkpatch.at:28: \$1 \$top_srcdir/utilities/checkpatch.py -q test.patch"
at_fn_check_prepare_dynamic "$1 $top_srcdir/utilities/checkpatch.py -q test.patch" "checkpatch.at:28"
( $at_check_trace; $1 $top_srcdir/utilities/checkpatch.py -q test.patch
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 1 $at_status "$at_srcdir/checkpatch.at:28"
$at_failed && at_fn_log_failure
$at_traceon; }

        { set +x
$as_echo "$at_srcdir/checkpatch.at:30: sed '/^Lines checked:/,\$d' stdout"
at_fn_check_prepare_dynamic "sed '/^Lines checked:/,$d' stdout" "checkpatch.at:30"
( $at_check_trace; sed '/^Lines checked:/,$d' stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/checkpatch.at:30"
$at_failed && at_fn_log_failure
$at_traceon; }

    else
        { set +x
$as_echo "$at_srcdir/checkpatch.at:32: \$1 \$top_srcdir/utilities/checkpatch.py -q test.patch"
at_fn_check_prepare_dynamic "$1 $top_srcdir/utilities/checkpatch.py -q test.patch" "checkpatch.at:32"
( $at_check_trace; $1 $top_srcdir/utilities/checkpatch.py -q test.patch
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/checkpatch.at:32"
$at_failed && at_fn_log_failure
$at_traceon; }

    fi
}


# Create the master directory if it doesn't already exist.
as_dir="$at_suite_dir"; as_fn_mkdir_p ||
  as_fn_error $? "cannot create \`$at_suite_dir'" "$LINENO" 5

# Can we diff with `/dev/null'?  DU 5.0 refuses.
if diff /dev/null /dev/null >/dev/null 2>&1; then
  at_devnull=/dev/null
else
  at_devnull=$at_suite_dir/devnull
  >"$at_devnull"
fi

# Use `diff -u' when possible.
if at_diff=`diff -u "$at_devnull" "$at_devnull" 2>&1` && test -z "$at_diff"
then
  at_diff='diff -u'
else
  at_diff=diff
fi

# Get the last needed group.
for at_group in : $at_groups; do :; done

# Extract the start and end lines of each test group at the tail
# of this file
awk '
BEGIN { FS="" }
/^#AT_START_/ {
  start = NR
}
/^#AT_STOP_/ {
  test = substr ($ 0, 10)
  print "at_sed" test "=\"1," start "d;" (NR-1) "q\""
  if (test == "'"$at_group"'") exit
}' "$at_myself" > "$at_suite_dir/at-source-lines" &&
. "$at_suite_dir/at-source-lines" ||
  as_fn_error $? "cannot create test line number cache" "$LINENO" 5
rm -f "$at_suite_dir/at-source-lines"

# Set number of jobs for `-j'; avoid more jobs than test groups.
set X $at_groups; shift; at_max_jobs=$#
if test $at_max_jobs -eq 0; then
  at_jobs=1
fi
if test $at_jobs -ne 1 &&
   { test $at_jobs -eq 0 || test $at_jobs -gt $at_max_jobs; }; then
  at_jobs=$at_max_jobs
fi

# If parallel mode, don't output banners, don't split summary lines.
if test $at_jobs -ne 1; then
  at_print_banners=false
  at_quiet=:
fi

# Set up helper dirs.
rm -rf "$at_helper_dir" &&
mkdir "$at_helper_dir" &&
cd "$at_helper_dir" &&
{ test -z "$at_groups" || mkdir $at_groups; } ||
as_fn_error $? "testsuite directory setup failed" "$LINENO" 5

# Functions for running a test group.  We leave the actual
# test group execution outside of a shell function in order
# to avoid hitting zsh 4.x exit status bugs.

# at_fn_group_prepare
# -------------------
# Prepare for running a test group.
at_fn_group_prepare ()
{
  # The directory for additional per-group helper files.
  at_job_dir=$at_helper_dir/$at_group
  # The file containing the location of the last AT_CHECK.
  at_check_line_file=$at_job_dir/check-line
  # The file containing the exit status of the last command.
  at_status_file=$at_job_dir/status
  # The files containing the output of the tested commands.
  at_stdout=$at_job_dir/stdout
  at_stder1=$at_job_dir/stder1
  at_stderr=$at_job_dir/stderr
  # The file containing the code for a test group.
  at_test_source=$at_job_dir/test-source
  # The file containing dates.
  at_times_file=$at_job_dir/times

  # Be sure to come back to the top test directory.
  cd "$at_suite_dir"

  # Clearly separate the test groups when verbose.
  $at_first || $at_verbose echo

  at_group_normalized=$at_group

  eval 'while :; do
    case $at_group_normalized in #(
    '"$at_format"'*) break;;
    esac
    at_group_normalized=0$at_group_normalized
  done'


  # Create a fresh directory for the next test group, and enter.
  # If one already exists, the user may have invoked ./run from
  # within that directory; we remove the contents, but not the
  # directory itself, so that we aren't pulling the rug out from
  # under the shell's notion of the current directory.
  at_group_dir=$at_suite_dir/$at_group_normalized
  at_group_log=$at_group_dir/$as_me.log
  if test -d "$at_group_dir"; then
  find "$at_group_dir" -type d ! -perm -700 -exec chmod u+rwx {} \;
  rm -fr "$at_group_dir"/* "$at_group_dir"/.[!.] "$at_group_dir"/.??*
fi ||
    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: test directory for $at_group_normalized could not be cleaned" >&5
$as_echo "$as_me: WARNING: test directory for $at_group_normalized could not be cleaned" >&2;}
  # Be tolerant if the above `rm' was not able to remove the directory.
  as_dir="$at_group_dir"; as_fn_mkdir_p

  echo 0 > "$at_status_file"

  # In verbose mode, append to the log file *and* show on
  # the standard output; in quiet mode only write to the log.
  if test -z "$at_verbose"; then
    at_tee_pipe='tee -a "$at_group_log"'
  else
    at_tee_pipe='cat >> "$at_group_log"'
  fi
}

# at_fn_group_banner ORDINAL LINE DESC PAD [BANNER]
# -------------------------------------------------
# Declare the test group ORDINAL, located at LINE with group description DESC,
# and residing under BANNER. Use PAD to align the status column.
at_fn_group_banner ()
{
  at_setup_line="$2"
  test -n "$5" && at_fn_banner $5
  at_desc="$3"
  case $1 in
    [0-9])      at_desc_line="  $1: ";;
    [0-9][0-9]) at_desc_line=" $1: " ;;
    *)          at_desc_line="$1: "  ;;
  esac
  as_fn_append at_desc_line "$3$4"
  $at_quiet $as_echo_n "$at_desc_line"
  echo "#                             -*- compilation -*-" >> "$at_group_log"
}

# at_fn_group_postprocess
# -----------------------
# Perform cleanup after running a test group.
at_fn_group_postprocess ()
{
  # Be sure to come back to the suite directory, in particular
  # since below we might `rm' the group directory we are in currently.
  cd "$at_suite_dir"

  if test ! -f "$at_check_line_file"; then
    sed "s/^ */$as_me: WARNING: /" <<_ATEOF
      A failure happened in a test group before any test could be
      run. This means that test suite is improperly designed.  Please
      report this failure to <bugs@openvswitch.org>.
_ATEOF
    $as_echo "$at_setup_line" >"$at_check_line_file"
    at_status=99
  fi
  $at_verbose $as_echo_n "$at_group. $at_setup_line: "
  $as_echo_n "$at_group. $at_setup_line: " >> "$at_group_log"
  case $at_xfail:$at_status in
    yes:0)
	at_msg="UNEXPECTED PASS"
	at_res=xpass
	at_errexit=$at_errexit_p
	at_color=$at_red
	;;
    no:0)
	at_msg="ok"
	at_res=pass
	at_errexit=false
	at_color=$at_grn
	;;
    *:77)
	at_msg='skipped ('`cat "$at_check_line_file"`')'
	at_res=skip
	at_errexit=false
	at_color=$at_blu
	;;
    no:* | *:99)
	at_msg='FAILED ('`cat "$at_check_line_file"`')'
	at_res=fail
	at_errexit=$at_errexit_p
	at_color=$at_red
	;;
    yes:*)
	at_msg='expected failure ('`cat "$at_check_line_file"`')'
	at_res=xfail
	at_errexit=false
	at_color=$at_lgn
	;;
  esac
  echo "$at_res" > "$at_job_dir/$at_res"
  # In parallel mode, output the summary line only afterwards.
  if test $at_jobs -ne 1 && test -n "$at_verbose"; then
    $as_echo "$at_desc_line $at_color$at_msg$at_std"
  else
    # Make sure there is a separator even with long titles.
    $as_echo " $at_color$at_msg$at_std"
  fi
  at_log_msg="$at_group. $at_desc ($at_setup_line): $at_msg"
  case $at_status in
    0|77)
      # $at_times_file is only available if the group succeeded.
      # We're not including the group log, so the success message
      # is written in the global log separately.  But we also
      # write to the group log in case they're using -d.
      if test -f "$at_times_file"; then
	at_log_msg="$at_log_msg     ("`sed 1d "$at_times_file"`')'
	rm -f "$at_times_file"
      fi
      $as_echo "$at_log_msg" >> "$at_group_log"
      $as_echo "$at_log_msg" >&5

      # Cleanup the group directory, unless the user wants the files
      # or the success was unexpected.
      if $at_debug_p || test $at_res = xpass; then
	at_fn_create_debugging_script
	if test $at_res = xpass && $at_errexit; then
	  echo stop > "$at_stop_file"
	fi
      else
	if test -d "$at_group_dir"; then
	  find "$at_group_dir" -type d ! -perm -700 -exec chmod u+rwx \{\} \;
	  rm -fr "$at_group_dir"
	fi
	rm -f "$at_test_source"
      fi
      ;;
    *)
      # Upon failure, include the log into the testsuite's global
      # log.  The failure message is written in the group log.  It
      # is later included in the global log.
      $as_echo "$at_log_msg" >> "$at_group_log"

      # Upon failure, keep the group directory for autopsy, and create
      # the debugging script.  With -e, do not start any further tests.
      at_fn_create_debugging_script
      if $at_errexit; then
	echo stop > "$at_stop_file"
      fi
      ;;
  esac
}


## ------------ ##
## Driver loop. ##
## ------------ ##


if (set -m && set +m && set +b) >/dev/null 2>&1; then
  set +b
  at_job_control_on='set -m' at_job_control_off='set +m' at_job_group=-
else
  at_job_control_on=: at_job_control_off=: at_job_group=
fi

for at_signal in 1 2 15; do
  trap 'set +x; set +e
	$at_job_control_off
	at_signal='"$at_signal"'
	echo stop > "$at_stop_file"
	trap "" $at_signal
	at_pgids=
	for at_pgid in `jobs -p 2>/dev/null`; do
	  at_pgids="$at_pgids $at_job_group$at_pgid"
	done
	test -z "$at_pgids" || kill -$at_signal $at_pgids 2>/dev/null
	wait
	if test "$at_jobs" -eq 1 || test -z "$at_verbose"; then
	  echo >&2
	fi
	at_signame=`kill -l $at_signal 2>&1 || echo $at_signal`
	set x $at_signame
	test 0 -gt 2 && at_signame=$at_signal
	{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: caught signal $at_signame, bailing out" >&5
$as_echo "$as_me: WARNING: caught signal $at_signame, bailing out" >&2;}
	as_fn_arith 128 + $at_signal && exit_status=$as_val
	as_fn_exit $exit_status' $at_signal
done

rm -f "$at_stop_file"
at_first=:

if test $at_jobs -ne 1 &&
     rm -f "$at_job_fifo" &&
     test -n "$at_job_group" &&
     ( mkfifo "$at_job_fifo" && trap 'exit 1' PIPE STOP TSTP ) 2>/dev/null
then
  # FIFO job dispatcher.

  trap 'at_pids=
	for at_pid in `jobs -p`; do
	  at_pids="$at_pids $at_job_group$at_pid"
	done
	if test -n "$at_pids"; then
	  at_sig=TSTP
	  test "${TMOUT+set}" = set && at_sig=STOP
	  kill -$at_sig $at_pids 2>/dev/null
	fi
	kill -STOP $$
	test -z "$at_pids" || kill -CONT $at_pids 2>/dev/null' TSTP

  echo
  # Turn jobs into a list of numbers, starting from 1.
  at_joblist=`$as_echo "$at_groups" | sed -n 1,${at_jobs}p`

  set X $at_joblist
  shift
  for at_group in $at_groups; do
    $at_job_control_on 2>/dev/null
    (
      # Start one test group.
      $at_job_control_off
      if $at_first; then
	exec 7>"$at_job_fifo"
      else
	exec 6<&-
      fi
      trap 'set +x; set +e
	    trap "" PIPE
	    echo stop > "$at_stop_file"
	    echo >&7
	    as_fn_exit 141' PIPE
      at_fn_group_prepare
      if cd "$at_group_dir" &&
	 at_fn_test $at_group &&
	 . "$at_test_source"
      then :; else
	{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unable to parse test group: $at_group" >&5
$as_echo "$as_me: WARNING: unable to parse test group: $at_group" >&2;}
	at_failed=:
      fi
      at_fn_group_postprocess
      echo >&7
    ) &
    $at_job_control_off
    if $at_first; then
      at_first=false
      exec 6<"$at_job_fifo" 7>"$at_job_fifo"
    fi
    shift # Consume one token.
    if test $# -gt 0; then :; else
      read at_token <&6 || break
      set x $*
    fi
    test -f "$at_stop_file" && break
  done
  exec 7>&-
  # Read back the remaining ($at_jobs - 1) tokens.
  set X $at_joblist
  shift
  if test $# -gt 0; then
    shift
    for at_job
    do
      read at_token
    done <&6
  fi
  exec 6<&-
  wait
else
  # Run serially, avoid forks and other potential surprises.
  for at_group in $at_groups; do
    at_fn_group_prepare
    if cd "$at_group_dir" &&
       at_fn_test $at_group &&
       . "$at_test_source"; then :; else
      { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unable to parse test group: $at_group" >&5
$as_echo "$as_me: WARNING: unable to parse test group: $at_group" >&2;}
      at_failed=:
    fi
    at_fn_group_postprocess
    test -f "$at_stop_file" && break
    at_first=false
  done
fi

# Wrap up the test suite with summary statistics.
cd "$at_helper_dir"

# Use ?..???? when the list must remain sorted, the faster * otherwise.
at_pass_list=`for f in */pass; do echo $f; done | sed '/\*/d; s,/pass,,'`
at_skip_list=`for f in */skip; do echo $f; done | sed '/\*/d; s,/skip,,'`
at_xfail_list=`for f in */xfail; do echo $f; done | sed '/\*/d; s,/xfail,,'`
at_xpass_list=`for f in ?/xpass ??/xpass ???/xpass ????/xpass; do
		 echo $f; done | sed '/?/d; s,/xpass,,'`
at_fail_list=`for f in ?/fail ??/fail ???/fail ????/fail; do
		echo $f; done | sed '/?/d; s,/fail,,'`

set X $at_pass_list $at_xpass_list $at_xfail_list $at_fail_list $at_skip_list
shift; at_group_count=$#
set X $at_xpass_list; shift; at_xpass_count=$#; at_xpass_list=$*
set X $at_xfail_list; shift; at_xfail_count=$#
set X $at_fail_list; shift; at_fail_count=$#; at_fail_list=$*
set X $at_skip_list; shift; at_skip_count=$#

as_fn_arith $at_group_count - $at_skip_count && at_run_count=$as_val
as_fn_arith $at_xpass_count + $at_fail_count && at_unexpected_count=$as_val
as_fn_arith $at_xfail_count + $at_fail_count && at_total_fail_count=$as_val

# Back to the top directory.
cd "$at_dir"
rm -rf "$at_helper_dir"

# Compute the duration of the suite.
at_stop_date=`date`
at_stop_time=`date +%s 2>/dev/null`
$as_echo "$as_me: ending at: $at_stop_date" >&5
case $at_start_time,$at_stop_time in
  [0-9]*,[0-9]*)
    as_fn_arith $at_stop_time - $at_start_time && at_duration_s=$as_val
    as_fn_arith $at_duration_s / 60 && at_duration_m=$as_val
    as_fn_arith $at_duration_m / 60 && at_duration_h=$as_val
    as_fn_arith $at_duration_s % 60 && at_duration_s=$as_val
    as_fn_arith $at_duration_m % 60 && at_duration_m=$as_val
    at_duration="${at_duration_h}h ${at_duration_m}m ${at_duration_s}s"
    $as_echo "$as_me: test suite duration: $at_duration" >&5
    ;;
esac

echo
$as_echo "## ------------- ##
## Test results. ##
## ------------- ##"
echo
{
  echo
  $as_echo "## ------------- ##
## Test results. ##
## ------------- ##"
  echo
} >&5

if test $at_run_count = 1; then
  at_result="1 test"
  at_were=was
else
  at_result="$at_run_count tests"
  at_were=were
fi
if $at_errexit_p && test $at_unexpected_count != 0; then
  if test $at_xpass_count = 1; then
    at_result="$at_result $at_were run, one passed"
  else
    at_result="$at_result $at_were run, one failed"
  fi
  at_result="$at_result unexpectedly and inhibited subsequent tests."
  at_color=$at_red
else
  # Don't you just love exponential explosion of the number of cases?
  at_color=$at_red
  case $at_xpass_count:$at_fail_count:$at_xfail_count in
    # So far, so good.
    0:0:0) at_result="$at_result $at_were successful." at_color=$at_grn ;;
    0:0:*) at_result="$at_result behaved as expected." at_color=$at_lgn ;;

    # Some unexpected failures
    0:*:0) at_result="$at_result $at_were run,
$at_fail_count failed unexpectedly." ;;

    # Some failures, both expected and unexpected
    0:*:1) at_result="$at_result $at_were run,
$at_total_fail_count failed ($at_xfail_count expected failure)." ;;
    0:*:*) at_result="$at_result $at_were run,
$at_total_fail_count failed ($at_xfail_count expected failures)." ;;

    # No unexpected failures, but some xpasses
    *:0:*) at_result="$at_result $at_were run,
$at_xpass_count passed unexpectedly." ;;

    # No expected failures, but failures and xpasses
    *:1:0) at_result="$at_result $at_were run,
$at_unexpected_count did not behave as expected ($at_fail_count unexpected failure)." ;;
    *:*:0) at_result="$at_result $at_were run,
$at_unexpected_count did not behave as expected ($at_fail_count unexpected failures)." ;;

    # All of them.
    *:*:1) at_result="$at_result $at_were run,
$at_xpass_count passed unexpectedly,
$at_total_fail_count failed ($at_xfail_count expected failure)." ;;
    *:*:*) at_result="$at_result $at_were run,
$at_xpass_count passed unexpectedly,
$at_total_fail_count failed ($at_xfail_count expected failures)." ;;
  esac

  if test $at_skip_count = 0 && test $at_run_count -gt 1; then
    at_result="All $at_result"
  fi
fi

# Now put skips in the mix.
case $at_skip_count in
  0) ;;
  1) at_result="$at_result
1 test was skipped." ;;
  *) at_result="$at_result
$at_skip_count tests were skipped." ;;
esac

if test $at_unexpected_count = 0; then
  echo "$at_color$at_result$at_std"
  echo "$at_result" >&5
else
  echo "${at_color}ERROR: $at_result$at_std" >&2
  echo "ERROR: $at_result" >&5
  {
    echo
    $as_echo "## ------------------------ ##
## Summary of the failures. ##
## ------------------------ ##"

    # Summary of failed and skipped tests.
    if test $at_fail_count != 0; then
      echo "Failed tests:"
      $SHELL "$at_myself" $at_fail_list --list
      echo
    fi
    if test $at_skip_count != 0; then
      echo "Skipped tests:"
      $SHELL "$at_myself" $at_skip_list --list
      echo
    fi
    if test $at_xpass_count != 0; then
      echo "Unexpected passes:"
      $SHELL "$at_myself" $at_xpass_list --list
      echo
    fi
    if test $at_fail_count != 0; then
      $as_echo "## ---------------------- ##
## Detailed failed tests. ##
## ---------------------- ##"
      echo
      for at_group in $at_fail_list
      do
	at_group_normalized=$at_group

  eval 'while :; do
    case $at_group_normalized in #(
    '"$at_format"'*) break;;
    esac
    at_group_normalized=0$at_group_normalized
  done'

	cat "$at_suite_dir/$at_group_normalized/$as_me.log"
	echo
      done
      echo
    fi
    if test -n "$at_top_srcdir"; then
      sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
## ${at_top_build_prefix}config.log ##
_ASBOX
      sed 's/^/| /' ${at_top_build_prefix}config.log
      echo
    fi
  } >&5

  sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
## $as_me.log was created. ##
_ASBOX

  echo
  if $at_debug_p; then
    at_msg='per-test log files'
  else
    at_msg="\`${at_testdir+${at_testdir}/}$as_me.log'"
  fi
  $as_echo "Please send $at_msg and all information you think might help:

   To: <bugs@openvswitch.org>
   Subject: [ovn 2.13.0] $as_me: $at_fail_list${at_fail_list:+ failed${at_xpass_list:+, }}$at_xpass_list${at_xpass_list:+ passed unexpectedly}

You may investigate any problem if you feel able to do so, in which
case the test suite provides a good starting point.  Its output may
be found below \`${at_testdir+${at_testdir}/}$as_me.dir'.
"
  exit 1
fi

exit 0

## ------------- ##
## Actual tests. ##
## ------------- ##
#AT_START_1
at_fn_group_banner 1 'ovn.at:50' \
  "ovn -- lexer" "                                   " 1
at_xfail=no
(
  $as_echo "1. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

cat >test-cases.txt <<'_ATEOF'
foo bar baz quuxquuxquux _abcd_ a.b.c.d a123_.456
"abc\u0020def" => "abc def"
" => error("Input ends inside quoted string.")
$foo $bar $baz $quuxquuxquux $_abcd_ $a.b.c.d $a123_.456
$1 => error("`$' must be followed by a valid identifier.") 1

a/*b*/c => a c
a//b c => a
a/**/b => a b
a/*/b => a error("`/*' without matching `*/'.")
a/*/**/b => a b
a/b => a error("`/' is only valid as part of `//' or `/*'.") b

0 1 12345 18446744073709551615
18446744073709551616 => error("Decimal constants must be less than 2**64.")
9999999999999999999999 => error("Decimal constants must be less than 2**64.")
01 => error("Decimal constants must not have leading zeros.")

0/0
0/1
1/0 => error("Value contains unmasked 1-bits.")
1/1
128/384
1/3
1/ => error("Integer constant expected.")

1/0x123 => error("Value and mask have incompatible formats.")

0x1234
0x01234 => 0x1234
0x0 => 0
0x000 => 0
0xfedcba9876543210
0XFEDCBA9876543210 => 0xfedcba9876543210
0xfedcba9876543210fedcba9876543210
0x0000fedcba9876543210fedcba9876543210 => 0xfedcba9876543210fedcba9876543210
0x => error("Hex digits expected following 0x.")
0X => error("Hex digits expected following 0X.")
0x0/0x0 => 0/0
0x0/0x1 => 0/0x1
0x1/0x0 => error("Value contains unmasked 1-bits.")
0xffff/0x1ffff
0x. => error("Invalid syntax in hexadecimal constant.")

192.168.128.1 1.2.3.4 255.255.255.255 0.0.0.0
256.1.2.3 => error("Invalid numeric constant.")
192.168.0.0/16
192.168.0.0/255.255.0.0 => 192.168.0.0/16
192.168.0.0/255.255.255.0 => 192.168.0.0/24
192.168.0.0/255.255.0.255
192.168.0.0/255.0.0.0 => error("Value contains unmasked 1-bits.")
192.168.0.0/32
192.168.0.0/255.255.255.255 => 192.168.0.0/32
1.2.3.4:5 => 1.2.3.4 : 5

::
::1
ff00::1234 => ff00::1234
2001:db8:85a3::8a2e:370:7334
2001:db8:85a3:0:0:8a2e:370:7334 => 2001:db8:85a3::8a2e:370:7334
2001:0db8:85a3:0000:0000:8a2e:0370:7334 => 2001:db8:85a3::8a2e:370:7334
::ffff:192.0.2.128
::ffff:c000:0280 => ::ffff:192.0.2.128
::1/::1
::1/ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff => ::1/128
::1/128
ff00::/8
ff00::/ff00:: => ff00::/8

01:23:45:67:ab:cd
01:23:45:67:AB:CD => 01:23:45:67:ab:cd
fe:dc:ba:98:76:54
FE:DC:ba:98:76:54 => fe:dc:ba:98:76:54
01:00:00:00:00:00/01:00:00:00:00:00
ff:ff:ff:ff:ff:ff/ff:ff:ff:ff:ff:ff
fe:ff:ff:ff:ff:ff/ff:ff:ff:ff:ff:ff
ff:ff:ff:ff:ff:ff/fe:ff:ff:ff:ff:ff => error("Value contains unmasked 1-bits.")
fe:x => error("Invalid numeric constant.")
00:01:02:03:04:x => error("Invalid numeric constant.")

# Test that operators are tokenized as expected, even without white space.
(){}[]==!=<<=>>=!&&||..,;=<->--: => ( ) { } [ ] == != < <= > >= ! && || .. , ; = <-> -- :
& => error("`&' is only valid as part of `&&'.")
| => error("`|' is only valid as part of `||'.")
- => error("`-' is only valid as part of `--'.")

^ => error("Invalid character `^' in input.")
_ATEOF


sed 's/ =>.*//' test-cases.txt > input.txt
sed 's/.* => //' test-cases.txt > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:146: ovstest test-ovn lex < input.txt"
at_fn_check_prepare_trace "ovn.at:146"
( $at_check_trace; ovstest test-ovn lex < input.txt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:146"
$at_failed && at_fn_log_failure  \
"input.txt"
$at_traceon; }

ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_1
#AT_START_2
at_fn_group_banner 2 'ovn.at:154' \
  "ovn -- registers" "                               " 1
at_xfail=no
(
  $as_echo "2. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

{ set +x
$as_echo "$at_srcdir/ovn.at:155: ovstest test-ovn dump-symtab | grep reg | sort"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:155"
( $at_check_trace; ovstest test-ovn dump-symtab | grep reg | sort
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "reg0 = xxreg0[96..127]
reg1 = xxreg0[64..95]
reg2 = xxreg0[32..63]
reg3 = xxreg0[0..31]
reg4 = xxreg1[96..127]
reg5 = xxreg1[64..95]
reg6 = xxreg1[32..63]
reg7 = xxreg1[0..31]
reg8 = xreg4[32..63]
reg9 = xreg4[0..31]
xreg0 = xxreg0[64..127]
xreg1 = xxreg0[0..63]
xreg2 = xxreg1[64..127]
xreg3 = xxreg1[0..63]
xreg4 = OXM_OF_PKT_REG4
xxreg0 = NXM_NX_XXREG0
xxreg1 = NXM_NX_XXREG1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:155"
$at_failed && at_fn_log_failure
$at_traceon; }

ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_2
#AT_START_3
at_fn_group_banner 3 'ovn.at:177' \
  "ovn -- conntrack fields" "                        " 1
at_xfail=no
(
  $as_echo "3. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

{ set +x
$as_echo "$at_srcdir/ovn.at:178: ovstest test-ovn dump-symtab | grep ^ct | sort"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:178"
( $at_check_trace; ovstest test-ovn dump-symtab | grep ^ct | sort
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "ct.dnat = ct_state[7]
ct.est = ct_state[1]
ct.inv = ct_state[4]
ct.new = ct_state[0]
ct.rel = ct_state[2]
ct.rpl = ct_state[3]
ct.snat = ct_state[6]
ct.trk = ct_state[5]
ct_label = NXM_NX_CT_LABEL
ct_label.blocked = ct_label[0]
ct_mark = NXM_NX_CT_MARK
ct_state = NXM_NX_CT_STATE
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:178"
$at_failed && at_fn_log_failure
$at_traceon; }

ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_3
#AT_START_4
at_fn_group_banner 4 'ovn.at:194' \
  "ovn -- composition" "                             " 1
at_xfail=no
(
  $as_echo "4. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

{ set +x
$as_echo "$at_srcdir/ovn.at:195: ovstest test-ovn composition 2"
at_fn_check_prepare_trace "ovn.at:195"
( $at_check_trace; ovstest test-ovn composition 2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:195"
$at_failed && at_fn_log_failure
$at_traceon; }

ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_4
#AT_START_5
at_fn_group_banner 5 'ovn.at:198' \
  "ovn -- expression parser" "                       " 1
at_xfail=no
(
  $as_echo "5. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

cat >test-cases.txt <<'_ATEOF'

eth.type == 0x800
eth.type==0x800 => eth.type == 0x800
eth.type[0..15] == 0x800 => eth.type == 0x800

vlan.present
vlan.present == 1 => vlan.present
!(vlan.present == 0) => vlan.present
!(vlan.present != 1) => vlan.present
!vlan.present
vlan.present == 0 => !vlan.present
vlan.present != 1 => !vlan.present
!(vlan.present == 1) => !vlan.present
!(vlan.present != 0) => !vlan.present

eth.dst[0]
eth.dst[0] == 1 => eth.dst[0]
eth.dst[0] != 0 => eth.dst[0]
!(eth.dst[0] == 0) => eth.dst[0]
!(eth.dst[0] != 1) => eth.dst[0]

!eth.dst[0]
eth.dst[0] == 0 => !eth.dst[0]
eth.dst[0] != 1 => !eth.dst[0]
!(eth.dst[0] == 1) => !eth.dst[0]
!(eth.dst[0] != 0) => !eth.dst[0]

vlan.tci[12..15] == 0x3
vlan.tci == 0x3000/0xf000 => vlan.tci[12..15] == 0x3
vlan.tci[12..15] != 0x3
vlan.tci != 0x3000/0xf000 => vlan.tci[12..15] != 0x3

!vlan.pcp => vlan.pcp == 0
!(vlan.pcp) => vlan.pcp == 0
vlan.pcp == 0x4
vlan.pcp != 0x4
vlan.pcp > 0x4
vlan.pcp >= 0x4
vlan.pcp < 0x4
vlan.pcp <= 0x4
!(vlan.pcp != 0x4) => vlan.pcp == 0x4
!(vlan.pcp == 0x4) => vlan.pcp != 0x4
!(vlan.pcp <= 0x4) => vlan.pcp > 0x4
!(vlan.pcp < 0x4) => vlan.pcp >= 0x4
!(vlan.pcp >= 0x4) => vlan.pcp < 0x4
!(vlan.pcp > 0x4) => vlan.pcp <= 0x4
0x4 == vlan.pcp => vlan.pcp == 0x4
0x4 != vlan.pcp => vlan.pcp != 0x4
0x4 < vlan.pcp => vlan.pcp > 0x4
0x4 <= vlan.pcp => vlan.pcp >= 0x4
0x4 > vlan.pcp => vlan.pcp < 0x4
0x4 >= vlan.pcp => vlan.pcp <= 0x4
!(0x4 != vlan.pcp) => vlan.pcp == 0x4
!(0x4 == vlan.pcp) => vlan.pcp != 0x4
!(0x4 >= vlan.pcp) => vlan.pcp > 0x4
!(0x4 > vlan.pcp) => vlan.pcp >= 0x4
!(0x4 <= vlan.pcp) => vlan.pcp < 0x4
!(0x4 < vlan.pcp) => vlan.pcp <= 0x4

1 < vlan.pcp < 4 => vlan.pcp > 0x1 && vlan.pcp < 0x4
1 <= vlan.pcp <= 4 => vlan.pcp >= 0x1 && vlan.pcp <= 0x4
1 < vlan.pcp <= 4 => vlan.pcp > 0x1 && vlan.pcp <= 0x4
1 <= vlan.pcp < 4 => vlan.pcp >= 0x1 && vlan.pcp < 0x4
1 <= vlan.pcp <= 4 => vlan.pcp >= 0x1 && vlan.pcp <= 0x4
4 > vlan.pcp > 1 => vlan.pcp < 0x4 && vlan.pcp > 0x1
4 >= vlan.pcp > 1 => vlan.pcp <= 0x4 && vlan.pcp > 0x1
4 > vlan.pcp >= 1 => vlan.pcp < 0x4 && vlan.pcp >= 0x1
4 >= vlan.pcp >= 1 => vlan.pcp <= 0x4 && vlan.pcp >= 0x1
!(1 < vlan.pcp < 4) => vlan.pcp <= 0x1 || vlan.pcp >= 0x4
!(1 <= vlan.pcp <= 4) => vlan.pcp < 0x1 || vlan.pcp > 0x4
!(1 < vlan.pcp <= 4) => vlan.pcp <= 0x1 || vlan.pcp > 0x4
!(1 <= vlan.pcp < 4) => vlan.pcp < 0x1 || vlan.pcp >= 0x4
!(1 <= vlan.pcp <= 4) => vlan.pcp < 0x1 || vlan.pcp > 0x4
!(4 > vlan.pcp > 1) => vlan.pcp >= 0x4 || vlan.pcp <= 0x1
!(4 >= vlan.pcp > 1) => vlan.pcp > 0x4 || vlan.pcp <= 0x1
!(4 > vlan.pcp >= 1) => vlan.pcp >= 0x4 || vlan.pcp < 0x1
!(4 >= vlan.pcp >= 1) => vlan.pcp > 0x4 || vlan.pcp < 0x1

vlan.pcp == {1, 2, 3, 4} => vlan.pcp == 0x1 || vlan.pcp == 0x2 || vlan.pcp == 0x3 || vlan.pcp == 0x4
vlan.pcp == 1 || ((vlan.pcp == 2 || vlan.pcp == 3) || vlan.pcp == 4) => vlan.pcp == 0x1 || vlan.pcp == 0x2 || vlan.pcp == 0x3 || vlan.pcp == 0x4

vlan.pcp != {1, 2, 3, 4} => vlan.pcp != 0x1 && vlan.pcp != 0x2 && vlan.pcp != 0x3 && vlan.pcp != 0x4
vlan.pcp == 1 && ((vlan.pcp == 2 && vlan.pcp == 3) && vlan.pcp == 4) => vlan.pcp == 0x1 && vlan.pcp == 0x2 && vlan.pcp == 0x3 && vlan.pcp == 0x4

vlan.pcp == 1 && !((vlan.pcp == 2 && vlan.pcp == 3) && vlan.pcp == 4) => vlan.pcp == 0x1 && (vlan.pcp != 0x2 || vlan.pcp != 0x3 || vlan.pcp != 0x4)
vlan.pcp == 1 && (!(vlan.pcp == 2 && vlan.pcp == 3) && vlan.pcp == 4) => vlan.pcp == 0x1 && (vlan.pcp != 0x2 || vlan.pcp != 0x3) && vlan.pcp == 0x4
vlan.pcp == 1 && !(!(vlan.pcp == 2 && vlan.pcp == 3) && vlan.pcp == 4) => vlan.pcp == 0x1 && ((vlan.pcp == 0x2 && vlan.pcp == 0x3) || vlan.pcp != 0x4)

ip4.src == {10.0.0.0/8, 192.168.0.0/16, 172.16.20.0/24, 8.8.8.8} => ip4.src[24..31] == 0xa || ip4.src[16..31] == 0xc0a8 || ip4.src[8..31] == 0xac1014 || ip4.src == 0x8080808
ip6.src == ::1 => ip6.src == 0x1

ip4.src == 1.2.3.4 => ip4.src == 0x1020304
ip4.src == ::1.2.3.4/::ffff:ffff => ip4.src == 0x1020304
ip6.src == ::1 => ip6.src == 0x1

1
0
!1 => 0
!0 => 1

inport == "eth0"
!(inport != "eth0") => inport == "eth0"

(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((0))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) => 0

ip4.src == "eth0" => Integer field ip4.src is not compatible with string constant.
inport == 1 => String field inport is not compatible with integer constant.
ip4.src = 1.2.3.4 => Syntax error at `=' expecting relational operator.

ip4.src > {1, 2, 3} => Only == and != operators may be used with value sets.
eth.type > 0x800 => Only == and != operators may be used with nominal field eth.type.
vlan.present > 0 => Only == and != operators may be used with Boolean field vlan.present.

inport != "eth0" => Nominal field inport may only be tested for equality (taking enclosing `!' operators into account).
!(inport == "eth0") => Nominal field inport may only be tested for equality (taking enclosing `!' operators into account).
eth.type != 0x800 => Nominal field eth.type may only be tested for equality (taking enclosing `!' operators into account).
!(eth.type == 0x800) => Nominal field eth.type may only be tested for equality (taking enclosing `!' operators into account).
inport = "eth0" => Syntax error at `=' expecting relational operator.

123 == 123 => Syntax error at `123' expecting field name.

$name => Syntax error at `$name' expecting address set name.
@name => Syntax error at `@name' expecting port group name.

123 == xyzzy => Syntax error at `xyzzy' expecting field name.
xyzzy == 1 => Syntax error at `xyzzy' expecting field name.

inport[1] == 1 => Cannot select subfield of string field inport.

eth.type[] == 1 => Syntax error at `]' expecting small integer.
eth.type[::1] == 1 => Syntax error at `::1' expecting small integer.
eth.type[18446744073709551615] == 1 => Syntax error at `18446744073709551615' expecting small integer.

eth.type[5!] => Syntax error at `!' expecting `]'.

eth.type[5..1] => Invalid bit range 5 to 1.

eth.type[12..16] => Cannot select bits 12 to 16 of 16-bit field eth.type.

eth.type[10] == 1 => Cannot select subfield of nominal field eth.type.

eth.type => Explicit `!= 0' is required for inequality test of multibit field against 0.

!(!(vlan.pcp)) => Explicit `!= 0' is required for inequality test of multibit field against 0.

123 => Syntax error at end of input expecting relational operator.

123 x => Syntax error at `x' expecting relational operator.

{1, "eth0"} => Syntax error at `"eth0"' expecting integer.

eth.type == xyzzy => Syntax error at `xyzzy' expecting constant.

(1 x) => Syntax error at `x' expecting `)'.

!0x800 != eth.type => Missing parentheses around operand of !.

eth.type == 0x800 || eth.type == 0x86dd && ip.proto == 17 => && and || must be parenthesized when used together.

eth.dst == {} => Syntax error at `}' expecting constant.

eth.src > 00:00:00:00:11:11/00:00:00:00:ff:ff => Only == and != operators may be used with masked constants.  Consider using subfields instead (e.g. eth.src[0..15] > 0x1111 in place of eth.src > 00:00:00:00:11:11/00:00:00:00:ff:ff).

ip4.src == ::1 => 128-bit constant is not compatible with 32-bit field ip4.src.

1 == eth.type == 2 => Range expressions must have the form `x < field < y' or `x > field > y', with each `<' optionally replaced by `<=' or `>' by `>=').

eth.dst[40] x => Syntax error at `x' expecting end of input.

ip4.src == {1.2.3.4, $set1, $unknownset} => Syntax error at `$unknownset' expecting address set name.
eth.src == {$set3, badmac, 00:00:00:00:00:01} => Syntax error at `badmac' expecting constant.

((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((())))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) => Parentheses nested too deeply.

ct_label > $set4 => Only == and != operators may be used to compare a field against an empty value set.
_ATEOF

sed 's/ =>.*//' test-cases.txt > input.txt
sed 's/.* => //' test-cases.txt > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:379: ovstest test-ovn parse-expr < input.txt"
at_fn_check_prepare_trace "ovn.at:379"
( $at_check_trace; ovstest test-ovn parse-expr < input.txt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:379"
$at_failed && at_fn_log_failure
$at_traceon; }

ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_5
#AT_START_6
at_fn_group_banner 6 'ovn.at:382' \
  "ovn -- expression annotation" "                   " 1
at_xfail=no
(
  $as_echo "6. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

cat >test-cases.txt <<'_ATEOF'

ip4.src == 1.2.3.4 => ip4.src == 0x1020304 && eth.type == 0x800
ip4.src != 1.2.3.4 => ip4.src != 0x1020304 && eth.type == 0x800
ip.proto == 123 => ip.proto == 0x7b && (eth.type == 0x800 || eth.type == 0x86dd)
ip.proto == {123, 234} => (ip.proto == 0x7b || ip.proto == 0xea) && (eth.type == 0x800 || eth.type == 0x86dd)
ip4.src == 1.2.3.4 && ip4.dst == 5.6.7.8 => ip4.src == 0x1020304 && eth.type == 0x800 && ip4.dst == 0x5060708 && eth.type == 0x800

# Nested expressions over a single symbol should be annotated with symbol's
# prerequisites only once, at the top level.
tcp.dst == 1 || (tcp.dst >= 2 && tcp.dst <= 3) => (tcp.dst == 0x1 || (tcp.dst >= 0x2 && tcp.dst <= 0x3)) && ip.proto == 0x6 && (eth.type == 0x800 || eth.type == 0x86dd)

ip => eth.type == 0x800 || eth.type == 0x86dd
ip == 1 => eth.type == 0x800 || eth.type == 0x86dd
ip[0] == 1 => eth.type == 0x800 || eth.type == 0x86dd
ip > 0 => Only == and != operators may be used with nominal field ip.
!ip => Nominal predicate ip may only be tested positively, e.g. `ip' or `ip == 1' but not `!ip' or `ip == 0'.
ip == 0 => Nominal predicate ip may only be tested positively, e.g. `ip' or `ip == 1' but not `!ip' or `ip == 0'.

vlan.present => vlan.tci[12]
!vlan.present => !vlan.tci[12]

!vlan.pcp => vlan.tci[13..15] == 0 && vlan.tci[12]
vlan.pcp == 1 && vlan.vid == 2 => vlan.tci[13..15] == 0x1 && vlan.tci[12] && vlan.tci[0..11] == 0x2 && vlan.tci[12]
!reg0 && !reg1 && !reg2 && !reg3 => xxreg0[96..127] == 0 && xxreg0[64..95] == 0 && xxreg0[32..63] == 0 && xxreg0[0..31] == 0

ip.first_frag => ip.frag[0] && (eth.type == 0x800 || eth.type == 0x86dd) && (!ip.frag[1] || (eth.type != 0x800 && eth.type != 0x86dd))
!ip.first_frag => !ip.frag[0] || (eth.type != 0x800 && eth.type != 0x86dd) || (ip.frag[1] && (eth.type == 0x800 || eth.type == 0x86dd))
ip.later_frag => ip.frag[1] && (eth.type == 0x800 || eth.type == 0x86dd)

bad_prereq != 0 => Error parsing expression `xyzzy' encountered as prerequisite or predicate of initial expression: Syntax error at `xyzzy' expecting field name.
self_recurse != 0 => Error parsing expression `self_recurse != 0' encountered as prerequisite or predicate of initial expression: Recursive expansion of symbol `self_recurse'.
mutual_recurse_1 != 0 => Error parsing expression `mutual_recurse_2 != 0' encountered as prerequisite or predicate of initial expression: Error parsing expression `mutual_recurse_1 != 0' encountered as prerequisite or predicate of initial expression: Recursive expansion of symbol `mutual_recurse_1'.
mutual_recurse_2 != 0 => Error parsing expression `mutual_recurse_1 != 0' encountered as prerequisite or predicate of initial expression: Error parsing expression `mutual_recurse_2 != 0' encountered as prerequisite or predicate of initial expression: Recursive expansion of symbol `mutual_recurse_2'.
_ATEOF

sed 's/ =>.*//' test-cases.txt > input.txt
sed 's/.* => //' test-cases.txt > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:421: ovstest test-ovn annotate-expr < input.txt"
at_fn_check_prepare_trace "ovn.at:421"
( $at_check_trace; ovstest test-ovn annotate-expr < input.txt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:421"
$at_failed && at_fn_log_failure
$at_traceon; }

ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_6
#AT_START_7
at_fn_group_banner 7 'ovn.at:424' \
  "ovn -- 1-term expression conversion" "            " 1
at_xfail=no
(
  $as_echo "7. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

{ set +x
$as_echo "$at_srcdir/ovn.at:425: ovstest test-ovn exhaustive --operation=convert 1"
at_fn_check_prepare_trace "ovn.at:425"
( $at_check_trace; ovstest test-ovn exhaustive --operation=convert 1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "Tested converting all 1-terminal expressions with 2 numeric vars (each 3 bits) in terms of operators == != < <= > >= and 2 string vars.
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:425"
$at_failed && at_fn_log_failure
$at_traceon; }

ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_7
#AT_START_8
at_fn_group_banner 8 'ovn.at:430' \
  "ovn -- 2-term expression conversion" "            " 1
at_xfail=no
(
  $as_echo "8. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

{ set +x
$as_echo "$at_srcdir/ovn.at:431: ovstest test-ovn exhaustive --operation=convert 2"
at_fn_check_prepare_trace "ovn.at:431"
( $at_check_trace; ovstest test-ovn exhaustive --operation=convert 2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "Tested converting 578 expressions of 2 terminals with 2 numeric vars (each 3 bits) in terms of operators == != < <= > >= and 2 string vars.
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:431"
$at_failed && at_fn_log_failure
$at_traceon; }

ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_8
#AT_START_9
at_fn_group_banner 9 'ovn.at:436' \
  "ovn -- 3-term expression conversion" "            " 1
at_xfail=no
(
  $as_echo "9. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

{ set +x
$as_echo "$at_srcdir/ovn.at:437: ovstest test-ovn exhaustive --operation=convert --bits=2 3"
at_fn_check_prepare_trace "ovn.at:437"
( $at_check_trace; ovstest test-ovn exhaustive --operation=convert --bits=2 3
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "Tested converting 67410 expressions of 3 terminals with 2 numeric vars (each 2 bits) in terms of operators == != < <= > >= and 2 string vars.
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:437"
$at_failed && at_fn_log_failure
$at_traceon; }

ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_9
#AT_START_10
at_fn_group_banner 10 'ovn.at:442' \
  "ovn -- 3-term numeric expression simplification" "" 1
at_xfail=no
(
  $as_echo "10. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

{ set +x
$as_echo "$at_srcdir/ovn.at:443: ovstest test-ovn exhaustive --operation=simplify --nvars=2 --svars=0 3"
at_fn_check_prepare_trace "ovn.at:443"
( $at_check_trace; ovstest test-ovn exhaustive --operation=simplify --nvars=2 --svars=0 3
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "Tested simplifying 490770 expressions of 3 terminals with 2 numeric vars (each 3 bits) in terms of operators == != < <= > >=.
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:443"
$at_failed && at_fn_log_failure
$at_traceon; }

ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_10
#AT_START_11
at_fn_group_banner 11 'ovn.at:448' \
  "ovn -- 4-term string expression simplification" " " 1
at_xfail=no
(
  $as_echo "11. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

{ set +x
$as_echo "$at_srcdir/ovn.at:449: ovstest test-ovn exhaustive --operation=simplify --nvars=0 --svars=4 4"
at_fn_check_prepare_trace "ovn.at:449"
( $at_check_trace; ovstest test-ovn exhaustive --operation=simplify --nvars=0 --svars=4 4
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "Tested simplifying 21978 expressions of 4 terminals with 4 string vars.
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:449"
$at_failed && at_fn_log_failure
$at_traceon; }

ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_11
#AT_START_12
at_fn_group_banner 12 'ovn.at:454' \
  "ovn -- 3-term mixed expression simplification" "  " 1
at_xfail=no
(
  $as_echo "12. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

{ set +x
$as_echo "$at_srcdir/ovn.at:455: ovstest test-ovn exhaustive --operation=simplify --nvars=1 --svars=1 3"
at_fn_check_prepare_trace "ovn.at:455"
( $at_check_trace; ovstest test-ovn exhaustive --operation=simplify --nvars=1 --svars=1 3
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "Tested simplifying 127890 expressions of 3 terminals with 1 numeric vars (each 3 bits) in terms of operators == != < <= > >= and 1 string vars.
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:455"
$at_failed && at_fn_log_failure
$at_traceon; }

ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_12
#AT_START_13
at_fn_group_banner 13 'ovn.at:460' \
  "ovn -- simplification special cases" "            " 1
at_xfail=no
(
  $as_echo "13. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

simplify() {
    echo "$1" | ovstest test-ovn simplify-expr
}
{ set +x
$as_echo "$at_srcdir/ovn.at:464: simplify 'eth.dst == 0/0'"
at_fn_check_prepare_trace "ovn.at:464"
( $at_check_trace; simplify 'eth.dst == 0/0'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:464"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:466: simplify 'eth.dst != 0/0'"
at_fn_check_prepare_trace "ovn.at:466"
( $at_check_trace; simplify 'eth.dst != 0/0'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:466"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:468: simplify 'tcp.dst >= 0'"
at_fn_check_prepare_trace "ovn.at:468"
( $at_check_trace; simplify 'tcp.dst >= 0'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "ip.proto == 0x6 && (eth.type == 0x800 || eth.type == 0x86dd)
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:468"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:471: simplify 'tcp.dst <= 65535'"
at_fn_check_prepare_trace "ovn.at:471"
( $at_check_trace; simplify 'tcp.dst <= 65535'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "ip.proto == 0x6 && (eth.type == 0x800 || eth.type == 0x86dd)
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:471"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:474: simplify 'tcp.dst > 0'"
at_fn_check_prepare_trace "ovn.at:474"
( $at_check_trace; simplify 'tcp.dst > 0'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "(tcp.dst[0] || tcp.dst[1] || tcp.dst[2] || tcp.dst[3] || tcp.dst[4] || tcp.dst[5] || tcp.dst[6] || tcp.dst[7] || tcp.dst[8] || tcp.dst[9] || tcp.dst[10] || tcp.dst[11] || tcp.dst[12] || tcp.dst[13] || tcp.dst[14] || tcp.dst[15]) && ip.proto == 0x6 && (eth.type == 0x800 || eth.type == 0x86dd)
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:474"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:477: simplify 'tcp.dst < 65535'"
at_fn_check_prepare_trace "ovn.at:477"
( $at_check_trace; simplify 'tcp.dst < 65535'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "(!tcp.dst[0] || !tcp.dst[1] || !tcp.dst[2] || !tcp.dst[3] || !tcp.dst[4] || !tcp.dst[5] || !tcp.dst[6] || !tcp.dst[7] || !tcp.dst[8] || !tcp.dst[9] || !tcp.dst[10] || !tcp.dst[11] || !tcp.dst[12] || !tcp.dst[13] || !tcp.dst[14] || !tcp.dst[15]) && ip.proto == 0x6 && (eth.type == 0x800 || eth.type == 0x86dd)
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:477"
$at_failed && at_fn_log_failure
$at_traceon; }

ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_13
#AT_START_14
at_fn_group_banner 14 'ovn.at:482' \
  "ovn -- is_chassis_resident simplification" "      " 1
at_xfail=no
(
  $as_echo "14. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

simplify() {
    echo "$1" | ovstest test-ovn simplify-expr
}
{ set +x
$as_echo "$at_srcdir/ovn.at:486: simplify 'is_chassis_resident(\"eth1\")'"
at_fn_check_prepare_trace "ovn.at:486"
( $at_check_trace; simplify 'is_chassis_resident("eth1")'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:486"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:488: simplify 'is_chassis_resident(\"eth2\")'"
at_fn_check_prepare_trace "ovn.at:488"
( $at_check_trace; simplify 'is_chassis_resident("eth2")'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:488"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:490: simplify '!is_chassis_resident(\"eth1\")'"
at_fn_check_prepare_trace "ovn.at:490"
( $at_check_trace; simplify '!is_chassis_resident("eth1")'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:490"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:492: simplify '!is_chassis_resident(\"eth2\")'"
at_fn_check_prepare_trace "ovn.at:492"
( $at_check_trace; simplify '!is_chassis_resident("eth2")'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:492"
$at_failed && at_fn_log_failure
$at_traceon; }

ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_14
#AT_START_15
at_fn_group_banner 15 'ovn.at:496' \
  "ovn -- 4-term numeric expression normalization" " " 1
at_xfail=no
(
  $as_echo "15. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

{ set +x
$as_echo "$at_srcdir/ovn.at:497: ovstest test-ovn exhaustive --operation=normalize --nvars=3 --svars=0 --bits=1 4"
at_fn_check_prepare_trace "ovn.at:497"
( $at_check_trace; ovstest test-ovn exhaustive --operation=normalize --nvars=3 --svars=0 --bits=1 4
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "Tested normalizing 1874026 expressions of 4 terminals with 3 numeric vars (each 1 bits) in terms of operators == != < <= > >=.
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:497"
$at_failed && at_fn_log_failure
$at_traceon; }

ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_15
#AT_START_16
at_fn_group_banner 16 'ovn.at:502' \
  "ovn -- 4-term string expression normalization" "  " 1
at_xfail=no
(
  $as_echo "16. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

{ set +x
$as_echo "$at_srcdir/ovn.at:503: ovstest test-ovn exhaustive --operation=normalize --nvars=0 --svars=3 --bits=1 4"
at_fn_check_prepare_trace "ovn.at:503"
( $at_check_trace; ovstest test-ovn exhaustive --operation=normalize --nvars=0 --svars=3 --bits=1 4
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "Tested normalizing 11242 expressions of 4 terminals with 3 string vars.
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:503"
$at_failed && at_fn_log_failure
$at_traceon; }

ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_16
#AT_START_17
at_fn_group_banner 17 'ovn.at:508' \
  "ovn -- 4-term mixed expression normalization" "   " 1
at_xfail=no
(
  $as_echo "17. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

{ set +x
$as_echo "$at_srcdir/ovn.at:509: ovstest test-ovn exhaustive --operation=normalize --nvars=1 --bits=1 --svars=2 4"
at_fn_check_prepare_trace "ovn.at:509"
( $at_check_trace; ovstest test-ovn exhaustive --operation=normalize --nvars=1 --bits=1 --svars=2 4
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "Tested normalizing 175978 expressions of 4 terminals with 1 numeric vars (each 1 bits) in terms of operators == != < <= > >= and 2 string vars.
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:509"
$at_failed && at_fn_log_failure
$at_traceon; }

ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_17
#AT_START_18
at_fn_group_banner 18 'ovn.at:514' \
  "ovn -- 5-term numeric expression normalization" " " 1
at_xfail=no
(
  $as_echo "18. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

{ set +x
$as_echo "$at_srcdir/ovn.at:515: ovstest test-ovn exhaustive --operation=normalize --nvars=3 --svars=0 --bits=1 --relops='==' 5"
at_fn_check_prepare_trace "ovn.at:515"
( $at_check_trace; ovstest test-ovn exhaustive --operation=normalize --nvars=3 --svars=0 --bits=1 --relops='==' 5
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "Tested normalizing 1317600 expressions of 5 terminals with 3 numeric vars (each 1 bits) in terms of operators ==.
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:515"
$at_failed && at_fn_log_failure
$at_traceon; }

ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_18
#AT_START_19
at_fn_group_banner 19 'ovn.at:520' \
  "ovn -- 5-term string expression normalization" "  " 1
at_xfail=no
(
  $as_echo "19. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

{ set +x
$as_echo "$at_srcdir/ovn.at:521: ovstest test-ovn exhaustive --operation=normalize --nvars=0 --svars=3 --bits=1 --relops='==' 5"
at_fn_check_prepare_trace "ovn.at:521"
( $at_check_trace; ovstest test-ovn exhaustive --operation=normalize --nvars=0 --svars=3 --bits=1 --relops='==' 5
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "Tested normalizing 368550 expressions of 5 terminals with 3 string vars.
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:521"
$at_failed && at_fn_log_failure
$at_traceon; }

ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_19
#AT_START_20
at_fn_group_banner 20 'ovn.at:526' \
  "ovn -- 5-term mixed expression normalization" "   " 1
at_xfail=no
(
  $as_echo "20. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

{ set +x
$as_echo "$at_srcdir/ovn.at:527: ovstest test-ovn exhaustive --operation=normalize --nvars=1 --svars=1 --bits=1 --relops='==' 5"
at_fn_check_prepare_trace "ovn.at:527"
( $at_check_trace; ovstest test-ovn exhaustive --operation=normalize --nvars=1 --svars=1 --bits=1 --relops='==' 5
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "Tested normalizing 216000 expressions of 5 terminals with 1 numeric vars (each 1 bits) in terms of operators == and 1 string vars.
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:527"
$at_failed && at_fn_log_failure
$at_traceon; }

ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_20
#AT_START_21
at_fn_group_banner 21 'ovn.at:532' \
  "ovn -- 4-term numeric expressions to flows" "     " 1
at_xfail=no
(
  $as_echo "21. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init


{ set +x
$as_echo "$at_srcdir/ovn.at:534: ovstest test-ovn exhaustive --operation=flow --nvars=2 --svars=0 --bits=2 --relops='==' 4"
at_fn_check_prepare_trace "ovn.at:534"
( $at_check_trace; ovstest test-ovn exhaustive --operation=flow --nvars=2 --svars=0 --bits=2 --relops='==' 4
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "Tested converting to flows 175978 expressions of 4 terminals with 2 numeric vars (each 2 bits) in terms of operators ==.
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:534"
$at_failed && at_fn_log_failure
$at_traceon; }

ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_21
#AT_START_22
at_fn_group_banner 22 'ovn.at:539' \
  "ovn -- 4-term string expressions to flows" "      " 1
at_xfail=no
(
  $as_echo "22. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init


{ set +x
$as_echo "$at_srcdir/ovn.at:541: ovstest test-ovn exhaustive --operation=flow --nvars=0 --svars=4 4"
at_fn_check_prepare_trace "ovn.at:541"
( $at_check_trace; ovstest test-ovn exhaustive --operation=flow --nvars=0 --svars=4 4
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "Tested converting to flows 21978 expressions of 4 terminals with 4 string vars.
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:541"
$at_failed && at_fn_log_failure
$at_traceon; }

ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_22
#AT_START_23
at_fn_group_banner 23 'ovn.at:546' \
  "ovn -- 4-term mixed expressions to flows" "       " 1
at_xfail=no
(
  $as_echo "23. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init


{ set +x
$as_echo "$at_srcdir/ovn.at:548: ovstest test-ovn exhaustive --operation=flow --nvars=1 --bits=2 --svars=1 --relops='==' 4"
at_fn_check_prepare_trace "ovn.at:548"
( $at_check_trace; ovstest test-ovn exhaustive --operation=flow --nvars=1 --bits=2 --svars=1 --relops='==' 4
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "Tested converting to flows 48312 expressions of 4 terminals with 1 numeric vars (each 2 bits) in terms of operators == and 1 string vars.
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:548"
$at_failed && at_fn_log_failure
$at_traceon; }

ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_23
#AT_START_24
at_fn_group_banner 24 'ovn.at:553' \
  "ovn -- 3-term numeric expressions to flows" "     " 1
at_xfail=no
(
  $as_echo "24. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init


{ set +x
$as_echo "$at_srcdir/ovn.at:555: ovstest test-ovn exhaustive --operation=flow --nvars=3 --svars=0 --bits=3 --relops='==' 3"
at_fn_check_prepare_trace "ovn.at:555"
( $at_check_trace; ovstest test-ovn exhaustive --operation=flow --nvars=3 --svars=0 --bits=3 --relops='==' 3
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "Tested converting to flows 41328 expressions of 3 terminals with 3 numeric vars (each 3 bits) in terms of operators ==.
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:555"
$at_failed && at_fn_log_failure
$at_traceon; }

ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_24
#AT_START_25
at_fn_group_banner 25 'ovn.at:560' \
  "ovn -- converting expressions to flows -- string fields" "" 1
at_xfail=no
(
  $as_echo "25. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init


expr_to_flow () {
    echo "$1" | ovstest test-ovn expr-to-flows | sort
}
{ set +x
$as_echo "$at_srcdir/ovn.at:565: expr_to_flow 'inport == \"eth0\"'"
at_fn_check_prepare_trace "ovn.at:565"
( $at_check_trace; expr_to_flow 'inport == "eth0"'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "reg14=0x5
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:565"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:567: expr_to_flow 'inport == \"eth1\"'"
at_fn_check_prepare_trace "ovn.at:567"
( $at_check_trace; expr_to_flow 'inport == "eth1"'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "reg14=0x6
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:567"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:569: expr_to_flow 'inport == \"eth2\"'"
at_fn_check_prepare_trace "ovn.at:569"
( $at_check_trace; expr_to_flow 'inport == "eth2"'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "(no flows)
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:569"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:571: expr_to_flow 'inport == \"eth0\" && ip'"
at_fn_check_prepare_trace "ovn.at:571"
( $at_check_trace; expr_to_flow 'inport == "eth0" && ip'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "ip,reg14=0x5
ipv6,reg14=0x5
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:571"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:575: expr_to_flow 'inport == \"eth1\" && ip'"
at_fn_check_prepare_trace "ovn.at:575"
( $at_check_trace; expr_to_flow 'inport == "eth1" && ip'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "ip,reg14=0x6
ipv6,reg14=0x6
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:575"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:579: expr_to_flow 'inport == \"eth2\" && ip'"
at_fn_check_prepare_trace "ovn.at:579"
( $at_check_trace; expr_to_flow 'inport == "eth2" && ip'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "(no flows)
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:579"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:581: expr_to_flow 'inport == {\"eth0\", \"eth1\", \"eth2\", \"LOCAL\"}'"
at_fn_check_prepare_trace "ovn.at:581"
( $at_check_trace; expr_to_flow 'inport == {"eth0", "eth1", "eth2", "LOCAL"}'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "reg14=0x5
reg14=0x6
reg14=0xfffe
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:581"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:586: expr_to_flow 'inport == {\"eth0\", \"eth1\", \"eth2\"} && ip'"
at_fn_check_prepare_trace "ovn.at:586"
( $at_check_trace; expr_to_flow 'inport == {"eth0", "eth1", "eth2"} && ip'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "ip,reg14=0x5
ip,reg14=0x6
ipv6,reg14=0x5
ipv6,reg14=0x6
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:586"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:592: expr_to_flow 'inport == \"eth0\" && inport == \"eth1\"'"
at_fn_check_prepare_trace "ovn.at:592"
( $at_check_trace; expr_to_flow 'inport == "eth0" && inport == "eth1"'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "(no flows)
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:592"
$at_failed && at_fn_log_failure
$at_traceon; }

ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_25
#AT_START_26
at_fn_group_banner 26 'ovn.at:597' \
  "ovn -- converting expressions to flows -- address sets" "" 1
at_xfail=no
(
  $as_echo "26. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init


expr_to_flow () {
    echo "$1" | ovstest test-ovn expr-to-flows | sort
}
{ set +x
$as_echo "$at_srcdir/ovn.at:602: expr_to_flow 'ip4.src == {10.0.0.1, 10.0.0.2, 10.0.0.3}'"
at_fn_check_prepare_trace "ovn.at:602"
( $at_check_trace; expr_to_flow 'ip4.src == {10.0.0.1, 10.0.0.2, 10.0.0.3}'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "ip,nw_src=10.0.0.1
ip,nw_src=10.0.0.2
ip,nw_src=10.0.0.3
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:602"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:607: expr_to_flow 'ip4.src == \$set1'"
at_fn_check_prepare_dynamic "expr_to_flow 'ip4.src == $set1'" "ovn.at:607"
( $at_check_trace; expr_to_flow 'ip4.src == $set1'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "ip,nw_src=10.0.0.1
ip,nw_src=10.0.0.2
ip,nw_src=10.0.0.3
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:607"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:612: expr_to_flow 'ip4.src == {1.2.3.4, \$set1}'"
at_fn_check_prepare_dynamic "expr_to_flow 'ip4.src == {1.2.3.4, $set1}'" "ovn.at:612"
( $at_check_trace; expr_to_flow 'ip4.src == {1.2.3.4, $set1}'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "ip,nw_src=1.2.3.4
ip,nw_src=10.0.0.1
ip,nw_src=10.0.0.2
ip,nw_src=10.0.0.3
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:612"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:618: expr_to_flow 'ip4.src == {1.2.0.0/20, 5.5.5.0/24, \$set1}'"
at_fn_check_prepare_dynamic "expr_to_flow 'ip4.src == {1.2.0.0/20, 5.5.5.0/24, $set1}'" "ovn.at:618"
( $at_check_trace; expr_to_flow 'ip4.src == {1.2.0.0/20, 5.5.5.0/24, $set1}'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "ip,nw_src=1.2.0.0/20
ip,nw_src=10.0.0.1
ip,nw_src=10.0.0.2
ip,nw_src=10.0.0.3
ip,nw_src=5.5.5.0/24
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:618"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:625: expr_to_flow 'ip6.src == {::1, ::2, ::3}'"
at_fn_check_prepare_trace "ovn.at:625"
( $at_check_trace; expr_to_flow 'ip6.src == {::1, ::2, ::3}'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "ipv6,ipv6_src=::1
ipv6,ipv6_src=::2
ipv6,ipv6_src=::3
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:625"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:630: expr_to_flow 'ip6.src == {::1, \$set2, ::4}'"
at_fn_check_prepare_dynamic "expr_to_flow 'ip6.src == {::1, $set2, ::4}'" "ovn.at:630"
( $at_check_trace; expr_to_flow 'ip6.src == {::1, $set2, ::4}'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "ipv6,ipv6_src=::1
ipv6,ipv6_src=::2
ipv6,ipv6_src=::3
ipv6,ipv6_src=::4
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:630"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:636: expr_to_flow 'eth.src == {00:00:00:00:00:01, 00:00:00:00:00:02, 00:00:00:00:00:03}'"
at_fn_check_prepare_trace "ovn.at:636"
( $at_check_trace; expr_to_flow 'eth.src == {00:00:00:00:00:01, 00:00:00:00:00:02, 00:00:00:00:00:03}'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "dl_src=00:00:00:00:00:01
dl_src=00:00:00:00:00:02
dl_src=00:00:00:00:00:03
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:636"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:641: expr_to_flow 'eth.src == {\$set3}'"
at_fn_check_prepare_dynamic "expr_to_flow 'eth.src == {$set3}'" "ovn.at:641"
( $at_check_trace; expr_to_flow 'eth.src == {$set3}'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "dl_src=00:00:00:00:00:01
dl_src=00:00:00:00:00:02
dl_src=00:00:00:00:00:03
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:641"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:646: expr_to_flow 'eth.src == {00:00:00:00:00:01, \$set3, ba:be:be:ef:de:ad, \$set3}'"
at_fn_check_prepare_dynamic "expr_to_flow 'eth.src == {00:00:00:00:00:01, $set3, ba:be:be:ef:de:ad, $set3}'" "ovn.at:646"
( $at_check_trace; expr_to_flow 'eth.src == {00:00:00:00:00:01, $set3, ba:be:be:ef:de:ad, $set3}'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "dl_src=00:00:00:00:00:01
dl_src=00:00:00:00:00:02
dl_src=00:00:00:00:00:03
dl_src=ba:be:be:ef:de:ad
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:646"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:652: expr_to_flow 'ip4.src == {\$set4}'"
at_fn_check_prepare_dynamic "expr_to_flow 'ip4.src == {$set4}'" "ovn.at:652"
( $at_check_trace; expr_to_flow 'ip4.src == {$set4}'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "(no flows)
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:652"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:655: expr_to_flow 'ip4.src == {1.2.3.4, \$set4}'"
at_fn_check_prepare_dynamic "expr_to_flow 'ip4.src == {1.2.3.4, $set4}'" "ovn.at:655"
( $at_check_trace; expr_to_flow 'ip4.src == {1.2.3.4, $set4}'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "ip,nw_src=1.2.3.4
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:655"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:658: expr_to_flow 'ip4.src == 1.2.3.4 || ip4.src == {\$set4}'"
at_fn_check_prepare_dynamic "expr_to_flow 'ip4.src == 1.2.3.4 || ip4.src == {$set4}'" "ovn.at:658"
( $at_check_trace; expr_to_flow 'ip4.src == 1.2.3.4 || ip4.src == {$set4}'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "ip,nw_src=1.2.3.4
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:658"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:661: expr_to_flow 'ip4.src != {\$set4}'"
at_fn_check_prepare_dynamic "expr_to_flow 'ip4.src != {$set4}'" "ovn.at:661"
( $at_check_trace; expr_to_flow 'ip4.src != {$set4}'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:661"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:664: expr_to_flow 'ip4.src != {1.0.0.0/8, \$set4}'"
at_fn_check_prepare_dynamic "expr_to_flow 'ip4.src != {1.0.0.0/8, $set4}'" "ovn.at:664"
( $at_check_trace; expr_to_flow 'ip4.src != {1.0.0.0/8, $set4}'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "ip,nw_src=0.0.0.0/1.0.0.0
ip,nw_src=128.0.0.0/1
ip,nw_src=16.0.0.0/16.0.0.0
ip,nw_src=2.0.0.0/2.0.0.0
ip,nw_src=32.0.0.0/32.0.0.0
ip,nw_src=4.0.0.0/4.0.0.0
ip,nw_src=64.0.0.0/64.0.0.0
ip,nw_src=8.0.0.0/8.0.0.0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:664"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:674: expr_to_flow 'ip4.src != 1.0.0.0/8 && ip4.src != {\$set4}'"
at_fn_check_prepare_dynamic "expr_to_flow 'ip4.src != 1.0.0.0/8 && ip4.src != {$set4}'" "ovn.at:674"
( $at_check_trace; expr_to_flow 'ip4.src != 1.0.0.0/8 && ip4.src != {$set4}'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "ip,nw_src=0.0.0.0/1.0.0.0
ip,nw_src=128.0.0.0/1
ip,nw_src=16.0.0.0/16.0.0.0
ip,nw_src=2.0.0.0/2.0.0.0
ip,nw_src=32.0.0.0/32.0.0.0
ip,nw_src=4.0.0.0/4.0.0.0
ip,nw_src=64.0.0.0/64.0.0.0
ip,nw_src=8.0.0.0/8.0.0.0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:674"
$at_failed && at_fn_log_failure
$at_traceon; }

ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_26
#AT_START_27
at_fn_group_banner 27 'ovn.at:686' \
  "ovn -- converting expressions to flows -- port groups" "" 1
at_xfail=no
(
  $as_echo "27. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init


expr_to_flow () {
    echo "$1" | ovstest test-ovn expr-to-flows | sort
}
{ set +x
$as_echo "$at_srcdir/ovn.at:691: expr_to_flow 'outport == @pg1'"
at_fn_check_prepare_trace "ovn.at:691"
( $at_check_trace; expr_to_flow 'outport == @pg1'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "reg15=0x11
reg15=0x12
reg15=0x13
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:691"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:696: expr_to_flow 'outport == {@pg_empty}'"
at_fn_check_prepare_trace "ovn.at:696"
( $at_check_trace; expr_to_flow 'outport == {@pg_empty}'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "(no flows)
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:696"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:699: expr_to_flow 'outport == {\"lsp1\", @pg_empty}'"
at_fn_check_prepare_trace "ovn.at:699"
( $at_check_trace; expr_to_flow 'outport == {"lsp1", @pg_empty}'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "reg15=0x11
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:699"
$at_failed && at_fn_log_failure
$at_traceon; }

ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_27
#AT_START_28
at_fn_group_banner 28 'ovn.at:704' \
  "ovn -- converting expressions to flows -- conjunction" "" 1
at_xfail=no
(
  $as_echo "28. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init


expr_to_flow () {
    echo "$1" | ovstest test-ovn expr-to-flows | sort
}

lflow="ip4.src == {10.0.0.1, 10.0.0.2, 10.0.0.3} && \
ip4.dst == {20.0.0.1, 20.0.0.2, 20.0.0.3}"
{ set +x
$as_echo "$at_srcdir/ovn.at:712: expr_to_flow \"\$lflow\""
at_fn_check_prepare_dynamic "expr_to_flow \"$lflow\"" "ovn.at:712"
( $at_check_trace; expr_to_flow "$lflow"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "conj_id=1,ip
ip,nw_dst=20.0.0.1: conjunction(1, 0/2)
ip,nw_dst=20.0.0.2: conjunction(1, 0/2)
ip,nw_dst=20.0.0.3: conjunction(1, 0/2)
ip,nw_src=10.0.0.1: conjunction(1, 1/2)
ip,nw_src=10.0.0.2: conjunction(1, 1/2)
ip,nw_src=10.0.0.3: conjunction(1, 1/2)
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:712"
$at_failed && at_fn_log_failure
$at_traceon; }


lflow="ip && (!ct.est || (ct.est && ct_label.blocked == 1))"
{ set +x
$as_echo "$at_srcdir/ovn.at:723: expr_to_flow \"\$lflow\""
at_fn_check_prepare_dynamic "expr_to_flow \"$lflow\"" "ovn.at:723"
( $at_check_trace; expr_to_flow "$lflow"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "ct_state=+est+trk,ct_label=0x1/0x1,ip
ct_state=+est+trk,ct_label=0x1/0x1,ipv6
ct_state=-est+trk,ip
ct_state=-est+trk,ipv6
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:723"
$at_failed && at_fn_log_failure
$at_traceon; }


lflow="ip4.src == {10.0.0.1, 10.0.0.2, 10.0.0.3} && \
ip4.dst == {20.0.0.1, 20.0.0.2}"
{ set +x
$as_echo "$at_srcdir/ovn.at:732: expr_to_flow \"\$lflow\""
at_fn_check_prepare_dynamic "expr_to_flow \"$lflow\"" "ovn.at:732"
( $at_check_trace; expr_to_flow "$lflow"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "conj_id=1,ip
ip,nw_dst=20.0.0.1: conjunction(1, 0/2)
ip,nw_dst=20.0.0.2: conjunction(1, 0/2)
ip,nw_src=10.0.0.1: conjunction(1, 1/2)
ip,nw_src=10.0.0.2: conjunction(1, 1/2)
ip,nw_src=10.0.0.3: conjunction(1, 1/2)
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:732"
$at_failed && at_fn_log_failure
$at_traceon; }


lflow="ip4 && ip4.src == {10.0.0.1, 10.0.0.2, 10.0.0.3} && \
ip4.dst == {20.0.0.1, 20.0.0.2, 20.0.0.3} && \
tcp.dst >= 1000 && tcp.dst <= 1010"

{ set +x
$as_echo "$at_srcdir/ovn.at:745: expr_to_flow \"\$lflow\""
at_fn_check_prepare_dynamic "expr_to_flow \"$lflow\"" "ovn.at:745"
( $at_check_trace; expr_to_flow "$lflow"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "conj_id=1,tcp
tcp,nw_dst=20.0.0.1: conjunction(1, 0/3)
tcp,nw_dst=20.0.0.2: conjunction(1, 0/3)
tcp,nw_dst=20.0.0.3: conjunction(1, 0/3)
tcp,nw_src=10.0.0.1: conjunction(1, 1/3)
tcp,nw_src=10.0.0.2: conjunction(1, 1/3)
tcp,nw_src=10.0.0.3: conjunction(1, 1/3)
tcp,tp_dst=0x3ea/0xfffe: conjunction(1, 2/3)
tcp,tp_dst=0x3ec/0xfffc: conjunction(1, 2/3)
tcp,tp_dst=0x3f0/0xfffe: conjunction(1, 2/3)
tcp,tp_dst=1000: conjunction(1, 2/3)
tcp,tp_dst=1001: conjunction(1, 2/3)
tcp,tp_dst=1010: conjunction(1, 2/3)
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:745"
$at_failed && at_fn_log_failure
$at_traceon; }


lflow="ip4 && ip4.src == {10.0.0.4, 10.0.0.5, 10.0.0.6} && \
((ip4.dst == {20.0.0.4, 20.0.0.7, 20.0.0.8} && tcp.dst >= 1000 && \
tcp.dst <= 2000 && tcp.src >=1000 && tcp.src <= 2000) \
|| ip4.dst == 20.0.0.5 || ip4.dst == 20.0.0.6)"

{ set +x
$as_echo "$at_srcdir/ovn.at:766: expr_to_flow \"\$lflow\""
at_fn_check_prepare_dynamic "expr_to_flow \"$lflow\"" "ovn.at:766"
( $at_check_trace; expr_to_flow "$lflow"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "conj_id=1,tcp
ip,nw_src=10.0.0.4,nw_dst=20.0.0.5
ip,nw_src=10.0.0.4,nw_dst=20.0.0.6
ip,nw_src=10.0.0.5,nw_dst=20.0.0.5
ip,nw_src=10.0.0.5,nw_dst=20.0.0.6
ip,nw_src=10.0.0.6,nw_dst=20.0.0.5
ip,nw_src=10.0.0.6,nw_dst=20.0.0.6
tcp,nw_dst=20.0.0.4: conjunction(1, 0/4)
tcp,nw_dst=20.0.0.7: conjunction(1, 0/4)
tcp,nw_dst=20.0.0.8: conjunction(1, 0/4)
tcp,nw_src=10.0.0.4: conjunction(1, 1/4)
tcp,nw_src=10.0.0.5: conjunction(1, 1/4)
tcp,nw_src=10.0.0.6: conjunction(1, 1/4)
tcp,tp_dst=0x3ea/0xfffe: conjunction(1, 2/4)
tcp,tp_dst=0x3ec/0xfffc: conjunction(1, 2/4)
tcp,tp_dst=0x3f0/0xfff0: conjunction(1, 2/4)
tcp,tp_dst=0x400/0xfe00: conjunction(1, 2/4)
tcp,tp_dst=0x600/0xff00: conjunction(1, 2/4)
tcp,tp_dst=0x700/0xff80: conjunction(1, 2/4)
tcp,tp_dst=0x780/0xffc0: conjunction(1, 2/4)
tcp,tp_dst=0x7c0/0xfff0: conjunction(1, 2/4)
tcp,tp_dst=1000: conjunction(1, 2/4)
tcp,tp_dst=1001: conjunction(1, 2/4)
tcp,tp_dst=2000: conjunction(1, 2/4)
tcp,tp_src=0x3ea/0xfffe: conjunction(1, 3/4)
tcp,tp_src=0x3ec/0xfffc: conjunction(1, 3/4)
tcp,tp_src=0x3f0/0xfff0: conjunction(1, 3/4)
tcp,tp_src=0x400/0xfe00: conjunction(1, 3/4)
tcp,tp_src=0x600/0xff00: conjunction(1, 3/4)
tcp,tp_src=0x700/0xff80: conjunction(1, 3/4)
tcp,tp_src=0x780/0xffc0: conjunction(1, 3/4)
tcp,tp_src=0x7c0/0xfff0: conjunction(1, 3/4)
tcp,tp_src=1000: conjunction(1, 3/4)
tcp,tp_src=1001: conjunction(1, 3/4)
tcp,tp_src=2000: conjunction(1, 3/4)
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:766"
$at_failed && at_fn_log_failure
$at_traceon; }

ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_28
#AT_START_29
at_fn_group_banner 29 'ovn.at:805' \
  "ovn -- action parsing" "                          " 1
at_xfail=no
(
  $as_echo "29. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

cat >test-cases.txt <<'_ATEOF'
# drop
drop;
    encodes as drop
drop; next;
    Syntax error at `next' expecting end of input.
next; drop;
    Syntax error at `drop' expecting action.

# output
output;
    encodes as resubmit(,64)

# next
next;
    encodes as resubmit(,19)
next(11);
    formats as next;
    encodes as resubmit(,19)
next(0);
    encodes as resubmit(,8)
next(23);
    encodes as resubmit(,31)

next();
    Syntax error at `)' expecting "pipeline" or "table".
next(10;
    Syntax error at `;' expecting `)'.
next(24);
    "next" action cannot advance beyond table 23.

next(table=11);
    formats as next;
    encodes as resubmit(,19)
next(pipeline=ingress);
    formats as next;
    encodes as resubmit(,19)
next(table=11, pipeline=ingress);
    formats as next;
    encodes as resubmit(,19)
next(pipeline=ingress, table=11);
    formats as next;
    encodes as resubmit(,19)

next(pipeline=egress);
    "next" action cannot advance from ingress to egress pipeline (use "output" action instead)

next(table=10);
    formats as next(10);
    encodes as resubmit(,18)

# Loading a constant value.
tcp.dst=80;
    formats as tcp.dst = 80;
    encodes as set_field:80->tcp_dst
    has prereqs ip.proto == 0x6 && (eth.type == 0x800 || eth.type == 0x86dd)
eth.dst[40] = 1;
    encodes as set_field:01:00:00:00:00:00/01:00:00:00:00:00->eth_dst
vlan.pcp = 2;
    encodes as set_field:0x4000/0xe000->vlan_tci
    has prereqs vlan.tci[12]
vlan.tci[13..15] = 2;
    encodes as set_field:0x4000/0xe000->vlan_tci
inport = "";
    encodes as set_field:0->reg14
ip.ttl=4;
    formats as ip.ttl = 4;
    encodes as set_field:4->nw_ttl
    has prereqs eth.type == 0x800 || eth.type == 0x86dd
outport="eth0"; next; outport="LOCAL"; next;
    formats as outport = "eth0"; next; outport = "LOCAL"; next;
    encodes as set_field:0x5->reg15,resubmit(,19),set_field:0xfffe->reg15,resubmit(,19)

inport[1] = 1;
    Cannot select subfield of string field inport.
ip.proto[1] = 1;
    Cannot select subfield of nominal field ip.proto.
eth.dst[40] == 1;
    Syntax error at `==' expecting `=' or `<->'.
ip = 1;
    Predicate symbol ip used where lvalue required.
ip.proto = 6;
    Field ip.proto is not modifiable.
inport = {"a", "b"};
    Syntax error at `{' expecting constant.
inport = {};
    Syntax error at `{' expecting constant.
bad_prereq = 123;
    Error parsing expression `xyzzy' encountered as prerequisite or predicate of initial expression: Syntax error at `xyzzy' expecting field name.
self_recurse = 123;
    Error parsing expression `self_recurse != 0' encountered as prerequisite or predicate of initial expression: Error parsing expression `self_recurse != 0' encountered as prerequisite or predicate of initial expression: Recursive expansion of symbol `self_recurse'.
vlan.present = 0;
    Predicate symbol vlan.present used where lvalue required.

# Moving one field into another.
reg0=reg1;
    formats as reg0 = reg1;
    encodes as move:NXM_NX_XXREG0[64..95]->NXM_NX_XXREG0[96..127]
vlan.pcp = reg0[0..2];
    encodes as move:NXM_NX_XXREG0[96..98]->NXM_OF_VLAN_TCI[13..15]
    has prereqs vlan.tci[12]
reg0[10] = vlan.pcp[1];
    encodes as move:NXM_OF_VLAN_TCI[14]->NXM_NX_XXREG0[106]
    has prereqs vlan.tci[12]
outport = inport;
    encodes as move:NXM_NX_REG14[]->NXM_NX_REG15[]

reg0[0] = vlan.present;
    Predicate symbol vlan.present used where lvalue required.
reg0 = reg1[0..10];
    Can't assign 11-bit value to 32-bit destination.
inport = reg0;
    Can't assign integer field (reg0) to string field (inport).
inport = big_string;
    String fields inport and big_string are incompatible for assignment.
ip.proto = reg0[0..7];
    Field ip.proto is not modifiable.

# Exchanging fields.
reg0 <-> reg1;
    encodes as push:NXM_NX_XXREG0[64..95],push:NXM_NX_XXREG0[96..127],pop:NXM_NX_XXREG0[64..95],pop:NXM_NX_XXREG0[96..127]
vlan.pcp <-> reg0[0..2];
    encodes as push:NXM_NX_XXREG0[96..98],push:NXM_OF_VLAN_TCI[13..15],pop:NXM_NX_XXREG0[96..98],pop:NXM_OF_VLAN_TCI[13..15]
    has prereqs vlan.tci[12]
reg0[10] <-> vlan.pcp[1];
    encodes as push:NXM_OF_VLAN_TCI[14],push:NXM_NX_XXREG0[106],pop:NXM_OF_VLAN_TCI[14],pop:NXM_NX_XXREG0[106]
    has prereqs vlan.tci[12]
outport <-> inport;
    encodes as push:NXM_NX_REG14[],push:NXM_NX_REG15[],pop:NXM_NX_REG14[],pop:NXM_NX_REG15[]

reg0[0] <-> vlan.present;
    Predicate symbol vlan.present used where lvalue required.
reg0 <-> reg1[0..10];
    Can't exchange 32-bit field with 11-bit field.
inport <-> reg0;
    Can't exchange string field (inport) with integer field (reg0).
inport <-> big_string;
    String fields inport and big_string are incompatible for exchange.
ip.proto <-> reg0[0..7];
    Field ip.proto is not modifiable.
reg0[0..7] <-> ip.proto;
    Field ip.proto is not modifiable.

# TTL decrement.
ip.ttl--;
    encodes as dec_ttl
    has prereqs ip
ip.ttl
    Syntax error at end of input expecting `--'.

# load balancing.
ct_lb;
    encodes as ct(table=19,zone=NXM_NX_REG13[0..15],nat)
    has prereqs ip
ct_lb();
    formats as ct_lb;
    encodes as ct(table=19,zone=NXM_NX_REG13[0..15],nat)
    has prereqs ip
ct_lb(192.168.1.2:80, 192.168.1.3:80);
    encodes as group:1
    uses group: id(1), name(type=select,selection_method=dp_hash,bucket=bucket_id=0,weight:100,actions=ct(nat(dst=192.168.1.2:80),commit,table=19,zone=NXM_NX_REG13[0..15]),bucket=bucket_id=1,weight:100,actions=ct(nat(dst=192.168.1.3:80),commit,table=19,zone=NXM_NX_REG13[0..15]))
    has prereqs ip
ct_lb(192.168.1.2, 192.168.1.3, );
    formats as ct_lb(192.168.1.2, 192.168.1.3);
    encodes as group:2
    uses group: id(2), name(type=select,selection_method=dp_hash,bucket=bucket_id=0,weight:100,actions=ct(nat(dst=192.168.1.2),commit,table=19,zone=NXM_NX_REG13[0..15]),bucket=bucket_id=1,weight:100,actions=ct(nat(dst=192.168.1.3),commit,table=19,zone=NXM_NX_REG13[0..15]))
    has prereqs ip
ct_lb(fd0f::2, fd0f::3, );
    formats as ct_lb(fd0f::2, fd0f::3);
    encodes as group:3
    uses group: id(3), name(type=select,selection_method=dp_hash,bucket=bucket_id=0,weight:100,actions=ct(nat(dst=fd0f::2),commit,table=19,zone=NXM_NX_REG13[0..15]),bucket=bucket_id=1,weight:100,actions=ct(nat(dst=fd0f::3),commit,table=19,zone=NXM_NX_REG13[0..15]))
    has prereqs ip

ct_lb(192.168.1.2:);
    Syntax error at `)' expecting port number.
ct_lb(192.168.1.2:123456);
    Syntax error at `123456' expecting port number.
ct_lb(foo);
    Syntax error at `foo' expecting IP address.
ct_lb([192.168.1.2]);
    Syntax error at `192.168.1.2' expecting IPv6 address.

# ct_next
ct_next;
    encodes as ct(table=19,zone=NXM_NX_REG13[0..15])
    has prereqs ip

# ct_commit
ct_commit;
    encodes as ct(commit,zone=NXM_NX_REG13[0..15])
    has prereqs ip
ct_commit();
    formats as ct_commit;
    encodes as ct(commit,zone=NXM_NX_REG13[0..15])
    has prereqs ip
ct_commit(ct_mark=1);
    formats as ct_commit(ct_mark=0x1);
    encodes as ct(commit,zone=NXM_NX_REG13[0..15],exec(set_field:0x1->ct_mark))
    has prereqs ip
ct_commit(ct_mark=1/1);
    formats as ct_commit(ct_mark=0x1/0x1);
    encodes as ct(commit,zone=NXM_NX_REG13[0..15],exec(set_field:0x1/0x1->ct_mark))
    has prereqs ip
ct_commit(ct_label=1);
    formats as ct_commit(ct_label=0x1);
    encodes as ct(commit,zone=NXM_NX_REG13[0..15],exec(set_field:0x1->ct_label))
    has prereqs ip
ct_commit(ct_label=1/1);
    formats as ct_commit(ct_label=0x1/0x1);
    encodes as ct(commit,zone=NXM_NX_REG13[0..15],exec(set_field:0x1/0x1->ct_label))
    has prereqs ip
ct_commit(ct_mark=1, ct_label=2);
    formats as ct_commit(ct_mark=0x1, ct_label=0x2);
    encodes as ct(commit,zone=NXM_NX_REG13[0..15],exec(set_field:0x1->ct_mark,set_field:0x2->ct_label))
    has prereqs ip

ct_commit(ct_label=0x01020304050607080910111213141516);
    formats as ct_commit(ct_label=0x1020304050607080910111213141516);
    encodes as ct(commit,zone=NXM_NX_REG13[0..15],exec(set_field:0x1020304050607080910111213141516->ct_label))
    has prereqs ip
ct_commit(ct_label=0x181716151413121110090807060504030201);
    formats as ct_commit(ct_label=0x16151413121110090807060504030201);
    encodes as ct(commit,zone=NXM_NX_REG13[0..15],exec(set_field:0x16151413121110090807060504030201->ct_label))
    has prereqs ip
ct_commit(ct_label=0x1000000000000000000000000000000/0x1000000000000000000000000000000);
    encodes as ct(commit,zone=NXM_NX_REG13[0..15],exec(set_field:0x1000000000000000000000000000000/0x1000000000000000000000000000000->ct_label))
    has prereqs ip
ct_commit(ct_label=18446744073709551615);
    formats as ct_commit(ct_label=0xffffffffffffffff);
    encodes as ct(commit,zone=NXM_NX_REG13[0..15],exec(set_field:0xffffffffffffffff->ct_label))
    has prereqs ip
ct_commit(ct_label=18446744073709551616);
    Decimal constants must be less than 2**64.

# ct_dnat
ct_dnat;
    encodes as ct(table=19,zone=NXM_NX_REG11[0..15],nat)
    has prereqs ip
ct_dnat(192.168.1.2);
    encodes as ct(commit,table=19,zone=NXM_NX_REG11[0..15],nat(dst=192.168.1.2))
    has prereqs ip
ct_dnat(fd11::2);
    encodes as ct(commit,table=19,zone=NXM_NX_REG11[0..15],nat(dst=fd11::2))
    has prereqs ip

ct_dnat(192.168.1.2, 192.168.1.3);
    Syntax error at `,' expecting `)'.
ct_dnat(foo);
    Syntax error at `foo' expecting IPv4 or IPv6 address.
ct_dnat(foo, bar);
    Syntax error at `foo' expecting IPv4 or IPv6 address.
ct_dnat();
    Syntax error at `)' expecting IPv4 or IPv6 address.

# ct_snat
ct_snat;
    encodes as ct(table=19,zone=NXM_NX_REG12[0..15],nat)
    has prereqs ip
ct_snat(192.168.1.2);
    encodes as ct(commit,table=19,zone=NXM_NX_REG12[0..15],nat(src=192.168.1.2))
    has prereqs ip
ct_snat(fd11::2);
    encodes as ct(commit,table=19,zone=NXM_NX_REG12[0..15],nat(src=fd11::2))
    has prereqs ip

ct_snat(192.168.1.2, 192.168.1.3);
    Syntax error at `,' expecting `)'.
ct_snat(foo);
    Syntax error at `foo' expecting IPv4 or IPv6 address.
ct_snat(foo, bar);
    Syntax error at `foo' expecting IPv4 or IPv6 address.
ct_snat();
    Syntax error at `)' expecting IPv4 or IPv6 address.

# ct_clear
ct_clear;
    encodes as ct_clear

# clone
clone { ip4.dst = 255.255.255.255; output; }; next;
    encodes as clone(set_field:255.255.255.255->ip_dst,resubmit(,64)),resubmit(,19)
    has prereqs eth.type == 0x800

# arp
arp { eth.dst = ff:ff:ff:ff:ff:ff; output; }; output;
    encodes as controller(userdata=00.00.00.00.00.00.00.00.00.19.00.10.80.00.06.06.ff.ff.ff.ff.ff.ff.00.00.ff.ff.00.10.00.00.23.20.00.0e.ff.f8.40.00.00.00),resubmit(,64)
    has prereqs ip4
arp { };
    formats as arp { drop; };
    encodes as controller(userdata=00.00.00.00.00.00.00.00)
    has prereqs ip4

# get_arp
get_arp(outport, ip4.dst);
    encodes as push:NXM_NX_REG0[],push:NXM_OF_IP_DST[],pop:NXM_NX_REG0[],set_field:00:00:00:00:00:00->eth_dst,resubmit(,65),pop:NXM_NX_REG0[]
    has prereqs eth.type == 0x800
get_arp(inport, reg0);
    encodes as push:NXM_NX_REG15[],push:NXM_NX_REG0[],push:NXM_NX_XXREG0[96..127],push:NXM_NX_REG14[],pop:NXM_NX_REG15[],pop:NXM_NX_REG0[],set_field:00:00:00:00:00:00->eth_dst,resubmit(,65),pop:NXM_NX_REG0[],pop:NXM_NX_REG15[]

get_arp;
    Syntax error at `;' expecting `('.
get_arp();
    Syntax error at `)' expecting field name.
get_arp(inport);
    Syntax error at `)' expecting `,'.
get_arp(inport ip4.dst);
    Syntax error at `ip4.dst' expecting `,'.
get_arp(inport, ip4.dst;
    Syntax error at `;' expecting `)'.
get_arp(inport, eth.dst);
    Cannot use 48-bit field eth.dst[0..47] where 32-bit field is required.
get_arp(inport, outport);
    Cannot use string field outport where numeric field is required.
get_arp(reg0, ip4.dst);
    Cannot use numeric field reg0 where string field is required.

# put_arp
put_arp(inport, arp.spa, arp.sha);
    encodes as push:NXM_NX_REG0[],push:NXM_OF_ETH_SRC[],push:NXM_NX_ARP_SHA[],push:NXM_OF_ARP_SPA[],pop:NXM_NX_REG0[],pop:NXM_OF_ETH_SRC[],controller(userdata=00.00.00.01.00.00.00.00),pop:NXM_OF_ETH_SRC[],pop:NXM_NX_REG0[]
    has prereqs eth.type == 0x806 && eth.type == 0x806

# lookup_arp
reg0[0] = lookup_arp(inport, ip4.dst, eth.src);
    encodes as push:NXM_NX_REG0[],push:NXM_OF_IP_DST[],pop:NXM_NX_REG0[],set_field:0/0x40->reg10,resubmit(,67),move:NXM_NX_REG10[6]->NXM_NX_XXREG0[96],pop:NXM_NX_REG0[]
    has prereqs eth.type == 0x800
reg1[1] = lookup_arp(inport, arp.spa, arp.sha);
    encodes as push:NXM_NX_REG0[],push:NXM_OF_ETH_SRC[],push:NXM_NX_ARP_SHA[],push:NXM_OF_ARP_SPA[],pop:NXM_NX_REG0[],pop:NXM_OF_ETH_SRC[],set_field:0/0x40->reg10,resubmit(,67),move:NXM_NX_REG10[6]->NXM_NX_XXREG0[65],pop:NXM_OF_ETH_SRC[],pop:NXM_NX_REG0[]
    has prereqs eth.type == 0x806 && eth.type == 0x806

lookup_arp;
    Syntax error at `lookup_arp' expecting action.
reg0[0] = lookup_arp;
    Syntax error at `lookup_arp' expecting field name.
reg0[0] = lookup_arp();
    Syntax error at `)' expecting field name.
reg0[0] = lookup_arp(inport);
    Syntax error at `)' expecting `,'.
reg0[0] = lookup_arp(inport ip4.dst);
    Syntax error at `ip4.dst' expecting `,'.
reg0[0] = lookup_arp(inport, ip4.dst;
    Syntax error at `;' expecting `,'.
reg0[0] = lookup_arp(inport, ip4.dst, eth.src;
    Syntax error at `;' expecting `)'.
reg0[0] = lookup_arp(inport, eth.dst);
    Cannot use 48-bit field eth.dst[0..47] where 32-bit field is required.
reg0[0] = lookup_arp(inport, ip4.src, ip4.dst);
    Cannot use 32-bit field ip4.dst[0..31] where 48-bit field is required.

# put_dhcp_opts
reg1[0] = put_dhcp_opts(offerip = 1.2.3.4, router = 10.0.0.1);
    encodes as controller(userdata=00.00.00.02.00.00.00.00.00.01.de.10.00.00.00.40.01.02.03.04.03.04.0a.00.00.01,pause)
reg2[5] = put_dhcp_opts(offerip=10.0.0.4,router=10.0.0.1,netmask=255.255.254.0,mtu=1400,domain_name="ovn.org",wpad="https://example.org",bootfile_name="https://127.0.0.1/boot.ipxe",path_prefix="/tftpboot");
    formats as reg2[5] = put_dhcp_opts(offerip = 10.0.0.4, router = 10.0.0.1, netmask = 255.255.254.0, mtu = 1400, domain_name = "ovn.org", wpad = "https://example.org", bootfile_name = "https://127.0.0.1/boot.ipxe", path_prefix = "/tftpboot");
    encodes as controller(userdata=00.00.00.02.00.00.00.00.00.01.de.10.00.00.00.25.0a.00.00.04.03.04.0a.00.00.01.01.04.ff.ff.fe.00.1a.02.05.78.0f.07.6f.76.6e.2e.6f.72.67.fc.13.68.74.74.70.73.3a.2f.2f.65.78.61.6d.70.6c.65.2e.6f.72.67.43.1b.68.74.74.70.73.3a.2f.2f.31.32.37.2e.30.2e.30.2e.31.2f.62.6f.6f.74.2e.69.70.78.65.d2.09.2f.74.66.74.70.62.6f.6f.74,pause)
reg0[15] = put_dhcp_opts(offerip=10.0.0.4,router=10.0.0.1,netmask=255.255.255.0,mtu=1400,ip_forward_enable=1,default_ttl=121,dns_server={8.8.8.8,7.7.7.7},classless_static_route={30.0.0.0/24,10.0.0.4,40.0.0.0/16,10.0.0.6,0.0.0.0/0,10.0.0.1},ethernet_encap=1,router_discovery=0,tftp_server_address={10.0.0.4,10.0.0.5});
    formats as reg0[15] = put_dhcp_opts(offerip = 10.0.0.4, router = 10.0.0.1, netmask = 255.255.255.0, mtu = 1400, ip_forward_enable = 1, default_ttl = 121, dns_server = {8.8.8.8, 7.7.7.7}, classless_static_route = {30.0.0.0/24, 10.0.0.4, 40.0.0.0/16, 10.0.0.6, 0.0.0.0/0, 10.0.0.1}, ethernet_encap = 1, router_discovery = 0, tftp_server_address = {10.0.0.4, 10.0.0.5});
    encodes as controller(userdata=00.00.00.02.00.00.00.00.00.01.de.10.00.00.00.6f.0a.00.00.04.03.04.0a.00.00.01.01.04.ff.ff.ff.00.1a.02.05.78.13.01.01.17.01.79.06.08.08.08.08.08.07.07.07.07.79.14.18.1e.00.00.0a.00.00.04.10.28.00.0a.00.00.06.00.0a.00.00.01.24.01.01.1f.01.00.96.08.0a.00.00.04.0a.00.00.05,pause)

reg1[0..1] = put_dhcp_opts(offerip = 1.2.3.4, router = 10.0.0.1);
    Cannot use 2-bit field reg1[0..1] where 1-bit field is required.
reg1[0] = put_dhcp_opts();
    put_dhcp_opts requires offerip to be specified.
reg1[0] = put_dhcp_opts(x = 1.2.3.4, router = 10.0.0.1);
    Syntax error at `x' expecting DHCPv4 option name.
reg1[0] = put_dhcp_opts(router = 10.0.0.1);
    put_dhcp_opts requires offerip to be specified.
reg1[0] = put_dhcp_opts(offerip=1.2.3.4, "hi");
    Syntax error at `"hi"'.
reg1[0] = put_dhcp_opts(offerip=1.2.3.4, xyzzy);
    Syntax error at `xyzzy' expecting DHCPv4 option name.
reg1[0] = put_dhcp_opts(offerip="xyzzy");
    DHCPv4 option offerip requires numeric value.
reg1[0] = put_dhcp_opts(offerip=1.2.3.4, domain_name=1.2.3.4);
    DHCPv4 option domain_name requires string value.

# nd_ns
nd_ns { nd.target = xxreg0; output; };
    encodes as controller(userdata=00.00.00.09.00.00.00.00.ff.ff.00.18.00.00.23.20.00.06.00.80.00.00.00.00.00.01.de.10.00.01.2e.10.ff.ff.00.10.00.00.23.20.00.0e.ff.f8.40.00.00.00)
    has prereqs ip6

nd_ns { };
    formats as nd_ns { drop; };
    encodes as controller(userdata=00.00.00.09.00.00.00.00)
    has prereqs ip6

# nd_na
nd_na { eth.src = 12:34:56:78:9a:bc; nd.tll = 12:34:56:78:9a:bc; outport = inport; inport = ""; /* Allow sending out inport. */ output; };
    formats as nd_na { eth.src = 12:34:56:78:9a:bc; nd.tll = 12:34:56:78:9a:bc; outport = inport; inport = ""; output; };
    encodes as controller(userdata=00.00.00.03.00.00.00.00.00.19.00.10.80.00.08.06.12.34.56.78.9a.bc.00.00.00.19.00.10.80.00.42.06.12.34.56.78.9a.bc.00.00.ff.ff.00.18.00.00.23.20.00.06.00.20.00.00.00.00.00.01.1c.04.00.01.1e.04.00.19.00.10.00.01.1c.04.00.00.00.00.00.00.00.00.ff.ff.00.10.00.00.23.20.00.0e.ff.f8.40.00.00.00)
    has prereqs nd_ns
# nd_na_router
nd_na_router { eth.src = 12:34:56:78:9a:bc; nd.tll = 12:34:56:78:9a:bc; outport = inport; inport = ""; /* Allow sending out inport. */ output; };
    formats as nd_na_router { eth.src = 12:34:56:78:9a:bc; nd.tll = 12:34:56:78:9a:bc; outport = inport; inport = ""; output; };
    encodes as controller(userdata=00.00.00.0c.00.00.00.00.00.19.00.10.80.00.08.06.12.34.56.78.9a.bc.00.00.00.19.00.10.80.00.42.06.12.34.56.78.9a.bc.00.00.ff.ff.00.18.00.00.23.20.00.06.00.20.00.00.00.00.00.01.1c.04.00.01.1e.04.00.19.00.10.00.01.1c.04.00.00.00.00.00.00.00.00.ff.ff.00.10.00.00.23.20.00.0e.ff.f8.40.00.00.00)
    has prereqs nd_ns

# get_nd
get_nd(outport, ip6.dst);
    encodes as push:NXM_NX_XXREG0[],push:NXM_NX_IPV6_DST[],pop:NXM_NX_XXREG0[],set_field:00:00:00:00:00:00->eth_dst,resubmit(,65),pop:NXM_NX_XXREG0[]
    has prereqs eth.type == 0x86dd
get_nd(inport, xxreg0);
    encodes as push:NXM_NX_REG15[],push:NXM_NX_REG14[],pop:NXM_NX_REG15[],set_field:00:00:00:00:00:00->eth_dst,resubmit(,65),pop:NXM_NX_REG15[]
get_nd;
    Syntax error at `;' expecting `('.
get_nd();
    Syntax error at `)' expecting field name.
get_nd(inport);
    Syntax error at `)' expecting `,'.
get_nd(inport ip6.dst);
    Syntax error at `ip6.dst' expecting `,'.
get_nd(inport, ip6.dst;
    Syntax error at `;' expecting `)'.
get_nd(inport, eth.dst);
    Cannot use 48-bit field eth.dst[0..47] where 128-bit field is required.
get_nd(inport, outport);
    Cannot use string field outport where numeric field is required.
get_nd(xxreg0, ip6.dst);
    Cannot use numeric field xxreg0 where string field is required.

# put_nd
put_nd(inport, nd.target, nd.sll);
    encodes as push:NXM_NX_XXREG0[],push:NXM_OF_ETH_SRC[],push:NXM_NX_ND_SLL[],push:NXM_NX_ND_TARGET[],pop:NXM_NX_XXREG0[],pop:NXM_OF_ETH_SRC[],controller(userdata=00.00.00.04.00.00.00.00),pop:NXM_OF_ETH_SRC[],pop:NXM_NX_XXREG0[]
    has prereqs (icmp6.type == 0x87 || icmp6.type == 0x88) && eth.type == 0x86dd && ip.proto == 0x3a && (eth.type == 0x800 || eth.type == 0x86dd) && icmp6.code == 0 && eth.type == 0x86dd && ip.proto == 0x3a && (eth.type == 0x800 || eth.type == 0x86dd) && ip.ttl == 0xff && (eth.type == 0x800 || eth.type == 0x86dd) && icmp6.type == 0x87 && eth.type == 0x86dd && ip.proto == 0x3a && (eth.type == 0x800 || eth.type == 0x86dd) && icmp6.code == 0 && eth.type == 0x86dd && ip.proto == 0x3a && (eth.type == 0x800 || eth.type == 0x86dd) && ip.ttl == 0xff && (eth.type == 0x800 || eth.type == 0x86dd)

# put_dhcpv6_opts
reg1[0] = put_dhcpv6_opts(ia_addr = ae70::4, server_id = 00:00:00:00:10:02);
    encodes as controller(userdata=00.00.00.05.00.00.00.00.00.01.de.10.00.00.00.40.00.05.00.10.ae.70.00.00.00.00.00.00.00.00.00.00.00.00.00.04.00.02.00.06.00.00.00.00.10.02,pause)
reg1[0] = put_dhcpv6_opts();
    encodes as controller(userdata=00.00.00.05.00.00.00.00.00.01.de.10.00.00.00.40,pause)
reg1[0] = put_dhcpv6_opts(dns_server={ae70::1,ae70::2});
    formats as reg1[0] = put_dhcpv6_opts(dns_server = {ae70::1, ae70::2});
    encodes as controller(userdata=00.00.00.05.00.00.00.00.00.01.de.10.00.00.00.40.00.17.00.20.ae.70.00.00.00.00.00.00.00.00.00.00.00.00.00.01.ae.70.00.00.00.00.00.00.00.00.00.00.00.00.00.02,pause)
reg1[0] = put_dhcpv6_opts(server_id=12:34:56:78:9a:bc, dns_server={ae70::1,ae89::2});
    formats as reg1[0] = put_dhcpv6_opts(server_id = 12:34:56:78:9a:bc, dns_server = {ae70::1, ae89::2});
    encodes as controller(userdata=00.00.00.05.00.00.00.00.00.01.de.10.00.00.00.40.00.02.00.06.12.34.56.78.9a.bc.00.17.00.20.ae.70.00.00.00.00.00.00.00.00.00.00.00.00.00.01.ae.89.00.00.00.00.00.00.00.00.00.00.00.00.00.02,pause)
reg1[0] = put_dhcpv6_opts(domain_search = "ovn.org");
    encodes as controller(userdata=00.00.00.05.00.00.00.00.00.01.de.10.00.00.00.40.00.18.00.07.6f.76.6e.2e.6f.72.67,pause)
reg1[0] = put_dhcpv6_opts(x = 1.2.3.4);
    Syntax error at `x' expecting DHCPv6 option name.
reg1[0] = put_dhcpv6_opts(ia_addr=ae70::4, "hi");
    Syntax error at `"hi"'.
reg1[0] = put_dhcpv6_opts(ia_addr=ae70::4, xyzzy);
    Syntax error at `xyzzy' expecting DHCPv6 option name.
reg1[0] = put_dhcpv6_opts(ia_addr="ae70::4");
    DHCPv6 option ia_addr requires numeric value.
reg1[0] = put_dhcpv6_opts(ia_addr=ae70::4, domain_search=ae70::1);
    DHCPv6 option domain_search requires string value.

# lookup_nd
reg2[0] = lookup_nd(inport, ip6.dst, eth.src);
    encodes as push:NXM_NX_XXREG0[],push:NXM_NX_IPV6_DST[],pop:NXM_NX_XXREG0[],set_field:0/0x40->reg10,resubmit(,67),move:NXM_NX_REG10[6]->NXM_NX_XXREG0[32],pop:NXM_NX_XXREG0[]
    has prereqs eth.type == 0x86dd
reg3[0] = lookup_nd(inport, nd.target, nd.tll);
    encodes as push:NXM_NX_XXREG0[],push:NXM_OF_ETH_SRC[],push:NXM_NX_ND_TLL[],push:NXM_NX_ND_TARGET[],pop:NXM_NX_XXREG0[],pop:NXM_OF_ETH_SRC[],set_field:0/0x40->reg10,resubmit(,67),move:NXM_NX_REG10[6]->NXM_NX_XXREG0[0],pop:NXM_OF_ETH_SRC[],pop:NXM_NX_XXREG0[]
    has prereqs (icmp6.type == 0x87 || icmp6.type == 0x88) && eth.type == 0x86dd && ip.proto == 0x3a && (eth.type == 0x800 || eth.type == 0x86dd) && icmp6.code == 0 && eth.type == 0x86dd && ip.proto == 0x3a && (eth.type == 0x800 || eth.type == 0x86dd) && ip.ttl == 0xff && (eth.type == 0x800 || eth.type == 0x86dd) && icmp6.type == 0x88 && eth.type == 0x86dd && ip.proto == 0x3a && (eth.type == 0x800 || eth.type == 0x86dd) && icmp6.code == 0 && eth.type == 0x86dd && ip.proto == 0x3a && (eth.type == 0x800 || eth.type == 0x86dd) && ip.ttl == 0xff && (eth.type == 0x800 || eth.type == 0x86dd)

lookup_nd;
    Syntax error at `lookup_nd' expecting action.
reg0[0] = lookup_nd;
    Syntax error at `lookup_nd' expecting field name.
reg0[0] = lookup_nd();
    Syntax error at `)' expecting field name.
reg0[0] = lookup_nd(inport);
    Syntax error at `)' expecting `,'.
reg0[0] = lookup_nd(inport ip6.dst);
    Syntax error at `ip6.dst' expecting `,'.
reg0[0] = lookup_nd(inport, ip6.dst;
    Syntax error at `;' expecting `,'.
reg0[0] = lookup_nd(inport, ip6.dst, eth.src;
    Syntax error at `;' expecting `)'.
reg0[0] = lookup_nd(inport, eth.dst);
    Cannot use 48-bit field eth.dst[0..47] where 128-bit field is required.
reg0[0] = lookup_nd(inport, ip4.src, ip4.dst);
    Cannot use 32-bit field ip4.src[0..31] where 128-bit field is required.
reg0[0] = lookup_nd(inport, ip6.src, ip6.dst);
    Cannot use 128-bit field ip6.dst[0..127] where 48-bit field is required.

# set_queue
set_queue(0);
    encodes as set_queue:0
set_queue(61440);
    encodes as set_queue:61440
set_queue(65535);
    Queue ID 65535 for set_queue is not in valid range 0 to 61440.

# dns_lookup
reg1[0] = dns_lookup();
    encodes as controller(userdata=00.00.00.06.00.00.00.00.00.01.de.10.00.00.00.40,pause)
    has prereqs udp
reg1[0] = dns_lookup("foo");
    dns_lookup doesn't take any parameters

# set_meter
set_meter(0);
    Rate 0 for set_meter is not in valid.
set_meter(1);
    encodes as meter:1
set_meter(100, 1000);
    encodes as meter:2
set_meter(100, 1000, );
    Syntax error at `,' expecting `)'.
set_meter(4294967295, 4294967295);
    encodes as meter:3

# log
log(verdict=allow, severity=warning);
    encodes as controller(userdata=00.00.00.07.00.00.00.00.00.04)
log(name="test1", verdict=drop, severity=info);
    encodes as controller(userdata=00.00.00.07.00.00.00.00.01.06.74.65.73.74.31)
log(verdict=drop, severity=info, meter="meter1");
    encodes as controller(userdata=00.00.00.07.00.00.00.00.01.06,meter_id=4)
log(name="test1", verdict=drop, severity=info, meter="meter1");
    encodes as controller(userdata=00.00.00.07.00.00.00.00.01.06.74.65.73.74.31,meter_id=4)
log(verdict=drop);
    formats as log(verdict=drop, severity=info);
    encodes as controller(userdata=00.00.00.07.00.00.00.00.01.06)
log(verdict=bad_verdict, severity=info);
    Syntax error at `bad_verdict' unknown verdict.
log(verdict=drop, severity=bad_severity);
    Syntax error at `bad_severity' unknown severity.
log(severity=notice);
    Syntax error at `;' expecting verdict.

# put_nd_ra_opts
reg1[0] = put_nd_ra_opts(addr_mode = "slaac", mtu = 1500, prefix = aef0::/64, slla = ae:01:02:03:04:05);
    encodes as controller(userdata=00.00.00.08.00.00.00.00.00.01.de.10.00.00.00.40.86.00.00.00.ff.00.ff.ff.00.00.00.00.00.00.00.00.05.01.00.00.00.00.05.dc.03.04.40.c0.ff.ff.ff.ff.ff.ff.ff.ff.00.00.00.00.ae.f0.00.00.00.00.00.00.00.00.00.00.00.00.00.00.01.01.ae.01.02.03.04.05,pause)
    has prereqs ip6
reg1[0] = put_nd_ra_opts(addr_mode = "dhcpv6_stateful", slla = ae:01:02:03:04:10, mtu = 1450);
    encodes as controller(userdata=00.00.00.08.00.00.00.00.00.01.de.10.00.00.00.40.86.00.00.00.ff.80.ff.ff.00.00.00.00.00.00.00.00.01.01.ae.01.02.03.04.10.05.01.00.00.00.00.05.aa,pause)
    has prereqs ip6
reg1[0] = put_nd_ra_opts(addr_mode = "dhcpv6_stateless", slla = ae:01:02:03:04:06, prefix = aef0::/64);
    encodes as controller(userdata=00.00.00.08.00.00.00.00.00.01.de.10.00.00.00.40.86.00.00.00.ff.40.ff.ff.00.00.00.00.00.00.00.00.01.01.ae.01.02.03.04.06.03.04.40.c0.ff.ff.ff.ff.ff.ff.ff.ff.00.00.00.00.ae.f0.00.00.00.00.00.00.00.00.00.00.00.00.00.00,pause)
    has prereqs ip6
reg1[0] = put_nd_ra_opts(addr_mode = "slaac", mtu = 1500, prefix = aef0::/64);
    slla option not present
reg1[0] = put_nd_ra_opts(addr_mode = "dhcpv6_stateful", mtu = 1450, prefix = aef0::/64, prefix = bef0::/64, slla = ae:01:02:03:04:10);
    encodes as controller(userdata=00.00.00.08.00.00.00.00.00.01.de.10.00.00.00.40.86.00.00.00.ff.80.ff.ff.00.00.00.00.00.00.00.00.05.01.00.00.00.00.05.aa.03.04.40.80.ff.ff.ff.ff.ff.ff.ff.ff.00.00.00.00.ae.f0.00.00.00.00.00.00.00.00.00.00.00.00.00.00.03.04.40.80.ff.ff.ff.ff.ff.ff.ff.ff.00.00.00.00.be.f0.00.00.00.00.00.00.00.00.00.00.00.00.00.00.01.01.ae.01.02.03.04.10,pause)
    has prereqs ip6
reg1[0] = put_nd_ra_opts(addr_mode = "dhcpv6_stateful", mtu = 1450, prefix = aef0::/64, prefix = bef0::/64, slla = ae:01:02:03:04:10);
    encodes as controller(userdata=00.00.00.08.00.00.00.00.00.01.de.10.00.00.00.40.86.00.00.00.ff.80.ff.ff.00.00.00.00.00.00.00.00.05.01.00.00.00.00.05.aa.03.04.40.80.ff.ff.ff.ff.ff.ff.ff.ff.00.00.00.00.ae.f0.00.00.00.00.00.00.00.00.00.00.00.00.00.00.03.04.40.80.ff.ff.ff.ff.ff.ff.ff.ff.00.00.00.00.be.f0.00.00.00.00.00.00.00.00.00.00.00.00.00.00.01.01.ae.01.02.03.04.10,pause)
    has prereqs ip6
reg1[0] = put_nd_ra_opts(addr_mode = "slaac", slla = ae:01:02:03:04:10);
    prefix option needs to be set when address mode is slaac/dhcpv6_stateless.
reg1[0] = put_nd_ra_opts(addr_mode = "dhcpv6_stateless", slla = ae:01:02:03:04:10);
    prefix option needs to be set when address mode is slaac/dhcpv6_stateless.
reg1[0] = put_nd_ra_opts(addr_mode = dhcpv6_stateless, prefix = aef0::/64, slla = ae:01:02:03:04:10);
    Syntax error at `dhcpv6_stateless' expecting constant.
reg1[0] = put_nd_ra_opts(addr_mode = "slaac", mtu = 1500, prefix = aef0::, slla = ae:01:02:03:04:10);
    Invalid value for "prefix" option
reg1[0] = put_nd_ra_opts(addr_mode = "foo", mtu = 1500, slla = ae:01:02:03:04:10);
    Invalid value for "addr_mode" option
reg1[0] = put_nd_ra_opts(addr_mode = "slaac", mtu = "1500", slla = ae:01:02:03:04:10);
    IPv6 ND RA option mtu requires numeric value.
reg1[0] = put_nd_ra_opts(addr_mode = "slaac", mtu = 10.0.0.4, slla = ae:01:02:03:04:10);
    Invalid value for "mtu" option

# icmp4
icmp4 { eth.dst = ff:ff:ff:ff:ff:ff; output; }; output;
    encodes as controller(userdata=00.00.00.0a.00.00.00.00.00.19.00.10.80.00.06.06.ff.ff.ff.ff.ff.ff.00.00.ff.ff.00.10.00.00.23.20.00.0e.ff.f8.40.00.00.00),resubmit(,64)
    has prereqs ip4

icmp4 { };
    formats as icmp4 { drop; };
    encodes as controller(userdata=00.00.00.0a.00.00.00.00)
    has prereqs ip4

# icmp4 with icmp4.frag_mtu
icmp4 { eth.dst = ff:ff:ff:ff:ff:ff; icmp4.frag_mtu = 1500; output; }; output;
    encodes as controller(userdata=00.00.00.0a.00.00.00.00.00.19.00.10.80.00.06.06.ff.ff.ff.ff.ff.ff.00.00.ff.ff.00.28.00.00.23.20.00.25.00.00.00.00.00.00.00.03.00.0e.00.00.00.0d.00.00.00.00.05.dc.00.00.00.04.00.04.00.00.00.00.ff.ff.00.10.00.00.23.20.00.0e.ff.f8.40.00.00.00),resubmit(,64)
    has prereqs ip4

# icmp4_error
icmp4_error { eth.dst = ff:ff:ff:ff:ff:ff; output; }; output;
    encodes as controller(userdata=00.00.00.0e.00.00.00.00.00.19.00.10.80.00.06.06.ff.ff.ff.ff.ff.ff.00.00.ff.ff.00.10.00.00.23.20.00.0e.ff.f8.40.00.00.00),resubmit(,64)
    has prereqs ip4

icmp4_error { };
    formats as icmp4_error { drop; };
    encodes as controller(userdata=00.00.00.0e.00.00.00.00)
    has prereqs ip4

# icmp4_error with icmp4.frag_mtu
icmp4_error { eth.dst = ff:ff:ff:ff:ff:ff; icmp4.frag_mtu = 1500; output; }; output;
    encodes as controller(userdata=00.00.00.0e.00.00.00.00.00.19.00.10.80.00.06.06.ff.ff.ff.ff.ff.ff.00.00.ff.ff.00.28.00.00.23.20.00.25.00.00.00.00.00.00.00.03.00.0e.00.00.00.0d.00.00.00.00.05.dc.00.00.00.04.00.04.00.00.00.00.ff.ff.00.10.00.00.23.20.00.0e.ff.f8.40.00.00.00),resubmit(,64)
    has prereqs ip4

icmp4.frag_mtu = 1500;
    encodes as controller(userdata=00.00.00.0d.00.00.00.00.05.dc,pause)

# icmp6
icmp6 { eth.dst = ff:ff:ff:ff:ff:ff; output; }; output;
    encodes as controller(userdata=00.00.00.0a.00.00.00.00.00.19.00.10.80.00.06.06.ff.ff.ff.ff.ff.ff.00.00.ff.ff.00.10.00.00.23.20.00.0e.ff.f8.40.00.00.00),resubmit(,64)
    has prereqs ip6

icmp6 { };
    formats as icmp6 { drop; };
    encodes as controller(userdata=00.00.00.0a.00.00.00.00)
    has prereqs ip6

# tcp_reset
tcp_reset { eth.dst = ff:ff:ff:ff:ff:ff; output; }; output;
    encodes as controller(userdata=00.00.00.0b.00.00.00.00.00.19.00.10.80.00.06.06.ff.ff.ff.ff.ff.ff.00.00.ff.ff.00.10.00.00.23.20.00.0e.ff.f8.40.00.00.00),resubmit(,64)
    has prereqs tcp

tcp_reset { };
    formats as tcp_reset { drop; };
    encodes as controller(userdata=00.00.00.0b.00.00.00.00)
    has prereqs tcp

# trigger_event
trigger_event(event = "empty_lb_backends", vip = "10.0.0.1:80", protocol = "tcp", load_balancer = "12345678-abcd-9876-fedc-11119f8e7d6c");
    encodes as controller(userdata=00.00.00.0f.00.00.00.00.00.00.00.00.00.01.00.0b.31.30.2e.30.2e.30.2e.31.3a.38.30.00.02.00.03.74.63.70.00.03.00.24.31.32.33.34.35.36.37.38.2d.61.62.63.64.2d.39.38.37.36.2d.66.65.64.63.2d.31.31.31.31.39.66.38.65.37.64.36.63)

trigger_event(event = "empty_lb_backends", meter="event-elb" vip = "10.0.0.1:80", protocol = "tcp", load_balancer = "12345678-abcd-9876-fedc-11119f8e7d6c");
    formats as trigger_event(event = "empty_lb_backends", meter = "event-elb", vip = "10.0.0.1:80", protocol = "tcp", load_balancer = "12345678-abcd-9876-fedc-11119f8e7d6c");
    encodes as controller(userdata=00.00.00.0f.00.00.00.00.00.00.00.00.00.01.00.0b.31.30.2e.30.2e.30.2e.31.3a.38.30.00.02.00.03.74.63.70.00.03.00.24.31.32.33.34.35.36.37.38.2d.61.62.63.64.2d.39.38.37.36.2d.66.65.64.63.2d.31.31.31.31.39.66.38.65.37.64.36.63,meter_id=5)

# Testing invalid vip results in extra error messages from socket-util.c
trigger_event(event = "empty_lb_backends", vip = "10.0.0.1:80", protocol = "sctp", load_balancer = "12345678-abcd-9876-fedc-11119f8e7d6c");
    Load balancer protocol 'sctp' is not 'tcp' or 'udp'
trigger_event(event = "empty_lb_backends", vip = "10.0.0.1:80", protocol = "tcp", load_balancer = "bacon");
    Load balancer 'bacon' is not a UUID

# IGMP
igmp;
    encodes as controller(userdata=00.00.00.10.00.00.00.00)

# Contradictionary prerequisites (allowed but not useful):
ip4.src = ip6.src[0..31];
    encodes as move:NXM_NX_IPV6_SRC[0..31]->NXM_OF_IP_SRC[]
    has prereqs eth.type == 0x800 && eth.type == 0x86dd
ip4.src <-> ip6.src[0..31];
    encodes as push:NXM_NX_IPV6_SRC[0..31],push:NXM_OF_IP_SRC[],pop:NXM_NX_IPV6_SRC[0..31],pop:NXM_OF_IP_SRC[]
    has prereqs eth.type == 0x800 && eth.type == 0x86dd

# check_pkt_larger
reg0[0] = check_pkt_larger(1500);
    encodes as check_pkt_larger(1500)->NXM_NX_XXREG0[96]

reg0 = check_pkt_larger(1500);
    Cannot use 32-bit field reg0[0..31] where 1-bit field is required.

reg0 = check_pkt_larger(foo);
    Cannot use 32-bit field reg0[0..31] where 1-bit field is required.

reg0[0] = check_pkt_larger(foo);
    Syntax error at `foo' expecting `;'.

# bind_vport
# lsp1's port key is 0x11.
bind_vport("lsp1", inport);
    encodes as controller(userdata=00.00.00.11.00.00.00.00.00.00.00.11)
# lsp2 doesn't exist. So it should be encoded as drop.
bind_vport("lsp2", inport);
    encodes as drop
bind_vport;
    Syntax error at `;' expecting `('.
bind_vport(;
    Syntax error at `;' expecting port name string.
bind_vport("xyzzy";
    Syntax error at `;' expecting `,'.
bind_vport("xyzzy",;
    Syntax error at `;' expecting field name.
bind_vport("xyzzy", inport;
    Syntax error at `;' expecting `)'.

# handle_svc_check
handle_svc_check(inport);
    encodes as controller(userdata=00.00.00.12.00.00.00.00)

handle_svc_check(outport);
    encodes as push:NXM_NX_REG14[],push:NXM_NX_REG15[],pop:NXM_NX_REG14[],controller(userdata=00.00.00.12.00.00.00.00),pop:NXM_NX_REG14[]

handle_svc_check();
    Syntax error at `)' expecting field name.

handle_svc_check(reg0);
    Cannot use numeric field reg0 where string field is required.

# select
reg9[16..31] = select(1=50, 2=100, 3, );
    formats as reg9[16..31] = select(1=50, 2=100, 3=100);
    encodes as group:4
    uses group: id(4), name(type=select,selection_method=dp_hash,bucket=bucket_id=0,weight:50,actions=load:1->xreg4[16..31],resubmit(,19),bucket=bucket_id=1,weight:100,actions=load:2->xreg4[16..31],resubmit(,19),bucket=bucket_id=2,weight:100,actions=load:3->xreg4[16..31],resubmit(,19))

reg0 = select(1, 2);
    formats as reg0 = select(1=100, 2=100);
    encodes as group:5
    uses group: id(5), name(type=select,selection_method=dp_hash,bucket=bucket_id=0,weight:100,actions=load:1->xxreg0[96..127],resubmit(,19),bucket=bucket_id=1,weight:100,actions=load:2->xxreg0[96..127],resubmit(,19))

reg0 = select(1=, 2);
    Syntax error at `,' expecting weight.
reg0 = select(1=0, 2);
    Syntax error at `,' weight can't be 0.
reg0 = select(1=123456, 2);
    Syntax error at `123456' expecting weight.
reg0 = select(123);
    Syntax error at `;' expecting at least 2 group members.
ip.proto = select(1, 2, 3);
    Field ip.proto is not modifiable.
reg0[0..14] = select(1, 2, 3);
    cannot use 15-bit field reg0[0..14] for "select", which requires at least 16 bits.

fwd_group(liveness="true", childports="eth0", "lsp1");
    encodes as group:6
    uses group: id(6), name(type=select,selection_method=dp_hash,bucket=watch_port:5,load=0x5->NXM_NX_REG15[0..15],resubmit(,64),bucket=watch_port:17,load=0x17->NXM_NX_REG15[0..15],resubmit(,64))

fwd_group(childports="eth0", "lsp1");
    encodes as group:7
    uses group: id(7), name(type=select,selection_method=dp_hash,bucket=load=0x5->NXM_NX_REG15[0..15],resubmit(,64),bucket=load=0x17->NXM_NX_REG15[0..15],resubmit(,64))

fwd_group(childports=eth0);
    Syntax error at `eth0' expecting logical switch port.

fwd_group();
    Syntax error at `)' expecting `;'.

fwd_group(liveness="false", childports="eth0", "lsp1");
    Syntax error at `"false"' expecting `,'.

# Miscellaneous negative tests.
;
    Syntax error at `;'.
xyzzy;
    Syntax error at `xyzzy' expecting action.
next; 123;
    Syntax error at `123'.
next; xyzzy;
    Syntax error at `xyzzy' expecting action.
next
    Syntax error at end of input expecting `;'.
_ATEOF

sed '/^[ 	]/d' test-cases.txt > input.txt
cp test-cases.txt expout
{ set +x
$as_echo "$at_srcdir/ovn.at:1542: ovstest test-ovn parse-actions < input.txt"
at_fn_check_prepare_trace "ovn.at:1542"
( $at_check_trace; ovstest test-ovn parse-actions < input.txt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:1542"
$at_failed && at_fn_log_failure
$at_traceon; }

ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_29
#AT_START_30
at_fn_group_banner 30 'ovn.at:1548' \
  "ovn -- 3 HVs, 1 LS, 3 lports/HV" "                " 2
at_xfail=no
(
  $as_echo "30. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init


ovn_start

# Create hypervisors hv[123].
# Add vif1[123] to hv1, vif2[123] to hv2, vif3[123] to hv3.
# Add all of the vifs to a single logical switch lsw0.
# Turn on port security on all the vifs except vif[123]1.
# Make vif13, vif2[23], vif3[123] destinations for unknown MACs.
# Add some ACLs for Ethertypes 1234, 1235, 1236.
ovn-nbctl ls-add lsw0
net_add n1
for i in 1 2 3; do
    sim_add hv$i
    as hv$i
    ovs-vsctl add-br br-phys
    ovn_attach n1 br-phys 192.168.0.$i

    for j in 1 2 3; do
        ovs-vsctl add-port br-int vif$i$j -- set Interface vif$i$j external-ids:iface-id=lp$i$j options:tx_pcap=hv$i/vif$i$j-tx.pcap options:rxq_pcap=hv$i/vif$i$j-rx.pcap ofport-request=$i$j
        ovn-nbctl lsp-add lsw0 lp$i$j
        if test $j = 1; then
            ovn-nbctl lsp-set-addresses lp$i$j "f0:00:00:00:00:$i$j 192.168.0.$i$j" unknown
        else
            if test $j = 3; then
                ip_addrs="192.168.0.$i$j fe80::ea2a:eaff:fe28:$i$j/64 192.169.0.$i$j"
            else
                ip_addrs="192.168.0.$i$j"
            fi
            ovn-nbctl lsp-set-addresses lp$i$j "f0:00:00:00:00:$i$j $ip_addrs"
            ovn-nbctl lsp-set-port-security lp$i$j f0:00:00:00:00:$i$j
        fi
    done
done
ovn-nbctl acl-add lsw0 from-lport 1000 'eth.type == 0x1234' drop
ovn-nbctl acl-add lsw0 from-lport 1000 'eth.type == 0x1235 && inport == "lp11"' drop
ovn-nbctl acl-add lsw0 to-lport 1000 'eth.type == 0x1236 && outport == "lp33"' drop
ovn-nbctl create Address_Set name=set1 addresses=\"f0:00:00:00:00:11\",\"f0:00:00:00:00:21\",\"f0:00:00:00:00:31\"
ovn-nbctl acl-add lsw0 to-lport 1000 'eth.type == 0x1237 && eth.src == $set1 && outport == "lp33"' drop

get_lsp_uuid () {
    ovn-nbctl lsp-list lsw0 | grep $1 | awk '{ print $1 }'
}

ovn-nbctl create Port_Group name=pg1 ports=`get_lsp_uuid lp22`,`get_lsp_uuid lp33`
ovn-nbctl acl-add lsw0 to-lport 1000 'eth.type == 0x1238 && outport == @pg1' drop

# Pre-populate the hypervisors' ARP tables so that we don't lose any
# packets for ARP resolution (native tunneling doesn't queue packets
# for ARP resolution).
{ set +x
$as_echo "$at_srcdir/ovn.at:1598: ovn_populate_arp__"
at_fn_check_prepare_trace "ovn.at:1598"
( $at_check_trace; ovn_populate_arp__
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:1598"
$at_failed && at_fn_log_failure
$at_traceon; }


# Allow some time for ovn-northd and ovn-controller to catch up.
# XXX This should be more systematic.
sleep 1

# Make sure there is no attempt to adding duplicated flows by ovn-controller
$as_echo "ovn.at:1605" >"$at_check_line_file"
(test -n "`grep duplicate hv1/ovn-controller.log`") \
  && at_fn_check_skip 99 "$at_srcdir/ovn.at:1605"
$as_echo "ovn.at:1606" >"$at_check_line_file"
(test -n "`grep duplicate hv2/ovn-controller.log`") \
  && at_fn_check_skip 99 "$at_srcdir/ovn.at:1606"
$as_echo "ovn.at:1607" >"$at_check_line_file"
(test -n "`grep duplicate hv3/ovn-controller.log`") \
  && at_fn_check_skip 99 "$at_srcdir/ovn.at:1607"

# Given the name of a logical port, prints the name of the hypervisor
# on which it is located.
vif_to_hv() {
    echo hv${1%?}
}

# test_packet INPORT DST SRC ETHTYPE OUTPORT...
#
# This shell function causes a packet to be received on INPORT.  The packet's
# content has Ethernet destination DST and source SRC (each exactly 12 hex
# digits) and Ethernet type ETHTYPE (4 hex digits).  The OUTPORTs (zero or
# more) list the VIFs on which the packet should be received.  INPORT and the
# OUTPORTs are specified as logical switch port numbers, e.g. 11 for vif11.
for i in 1 2 3; do
    for j in 1 2 3; do
        : > $i$j.expected
    done
done
test_packet() {
    local inport=$1 packet=$2$3$4; shift; shift; shift; shift
    hv=`vif_to_hv $inport`
    vif=vif$inport
    as $hv ovs-appctl netdev-dummy/receive $vif $packet
    for outport; do
        echo $packet >> $outport.expected
    done
}

# test_arp INPORT SHA SPA TPA [REPLY_HA]
#
# Causes a packet to be received on INPORT.  The packet is an ARP
# request with SHA, SPA, and TPA as specified.  If REPLY_HA is provided, then
# it should be the hardware address of the target to expect to receive in an
# ARP reply; otherwise no reply is expected.
#
# INPORT is an logical switch port number, e.g. 11 for vif11.
# SHA and REPLY_HA are each 12 hex digits.
# SPA and TPA are each 8 hex digits.
test_arp() {
    local inport=$1 sha=$2 spa=$3 tpa=$4 reply_ha=$5
    local request=ffffffffffff${sha}08060001080006040001${sha}${spa}ffffffffffff${tpa}
    hv=`vif_to_hv $inport`
    as $hv ovs-appctl netdev-dummy/receive vif$inport $request

    if test X$reply_ha = X; then
        # Expect to receive the broadcast ARP on the other logical switch ports
        # if no reply is expected.
        local i j
        for i in 1 2 3; do
            for j in 1 2 3; do
                if test $i$j != $inport; then
                    echo $request >> $i$j.expected
                fi
            done
        done
    else
        # Expect to receive the reply, if any.
        local reply=${sha}${reply_ha}08060001080006040002${reply_ha}${tpa}${sha}${spa}
        echo $reply >> $inport.expected
    fi
}

ip_to_hex() {
    printf "%02x%02x%02x%02x" "$@"
}

# Send packets between all pairs of source and destination ports:
#
# 1. Unicast packets are delivered to exactly one logical switch port
#    (except that packets destined to their input ports are dropped).
#
# 2. Broadcast and multicast are delivered to all logical switch ports
#    except the input port.
#
# 3. When port security is turned on, the switch drops packets from the wrong
#    MAC address.
#
# 4. The switch drops all packets with a VLAN tag.
#
# 5. The switch drops all packets with a multicast source address.  (This only
#    affects behavior when port security is turned off, since otherwise port
#    security would drop the packet anyway.)
#
# 6. The switch delivers packets with an unknown destination to logical
#    switch ports with "unknown" among their MAC addresses (and port
#    security disabled).
#
# 7. The switch drops unicast packets that violate an ACL.
#
# 8. The switch drops multicast and broadcast packets that violate an ACL.
#
# 9. OVN generates responses to ARP requests for known IPs, except for
#    requests from a port for the port's own IP.
#
# 10. No response to ARP requests for unknown IPs.

for is in 1 2 3; do
    for js in 1 2 3; do
        s=$is$js
        bcast=
        unknown=
        bacl2=
        bacl3=
        for id in 1 2 3; do
            for jd in 1 2 3; do
                d=$id$jd

                if test $d != $s; then unicast=$d; else unicast=; fi
                test_packet $s f000000000$d f000000000$s $s$d $unicast     #1

                if test $d != $s && test $js = 1; then
                    impersonate=$d
                else
                    impersonate=
                fi
                test_packet $s f000000000$d f00000000055 55$d $impersonate #3

                if test $d != $s && test $s != 11; then acl2=$d; else acl2=; fi
                if test $d != $s && test $d != 33; then acl3=$d; else acl3=; fi
                if test $d = $s || (test $js = 1 && test $d = 33); then
                    # Source of 11, 21, or 31 and dest of 33 should be dropped
                    # due to the 4th ACL that uses address_set(set1).
                    acl4=
                else
                    acl4=$d
                fi
                if test $d = $s || test $d = 22 || test $d = 33; then
                    # dest of 22 and 33 should be dropped
                    # due to the 5th ACL that uses port_group(pg1).
                    acl5=
                else
                    acl5=$d
                fi
                test_packet $s f000000000$d f000000000$s 1234        #7, acl1
                test_packet $s f000000000$d f000000000$s 1235 $acl2  #7, acl2
                test_packet $s f000000000$d f000000000$s 1236 $acl3  #7, acl3
                test_packet $s f000000000$d f000000000$s 1237 $acl4  #7, acl4
                test_packet $s f000000000$d f000000000$s 1238 $acl5  #7, acl5

                test_packet $s f000000000$d f00000000055 810000091234      #4
                test_packet $s f000000000$d 0100000000$s $s$d              #5

                if test $d != $s && test $jd = 1; then
                    unknown="$unknown $d"
                fi
                bcast="$bcast $unicast"
                bacl2="$bacl2 $acl2"
                bacl3="$bacl3 $acl3"

                sip=`ip_to_hex 192 168 0 $is$js`
                tip=`ip_to_hex 192 168 0 $id$jd`
                tip_unknown=`ip_to_hex 11 11 11 11`
                if test $d != $s; then
                    reply_ha=f000000000$d
                else
                    reply_ha=
                fi
                test_arp $s f000000000$s $sip $tip $reply_ha               #9
                test_arp $s f000000000$s $sip $tip_unknown                 #10

                if test $jd = 3; then
                    # lsp[123]3 has an additional ip 192.169.0.[123]3.
                    tip=`ip_to_hex 192 169 0 $id$jd`
                    test_arp $s f000000000$s $sip $tip $reply_ha           #9
                fi
            done
        done

        # Broadcast and multicast.
        test_packet $s ffffffffffff f000000000$s ${s}ff $bcast             #2
        test_packet $s 010000000000 f000000000$s ${s}ff $bcast             #2
        if test $js = 1; then
            bcast_impersonate=$bcast
        else
            bcast_impersonate=
        fi
        test_packet $s 010000000000 f00000000044 44ff $bcast_impersonate   #3

        test_packet $s f0000000ffff f000000000$s ${s}66 $unknown           #6

        test_packet $s ffffffffffff f000000000$s 1234                #8, acl1
        test_packet $s ffffffffffff f000000000$s 1235 $bacl2         #8, acl2
        test_packet $s ffffffffffff f000000000$s 1236 $bacl3         #8, acl3
        test_packet $s 010000000000 f000000000$s 1234                #8, acl1
        test_packet $s 010000000000 f000000000$s 1235 $bacl2         #8, acl2
        test_packet $s 010000000000 f000000000$s 1236 $bacl3         #8, acl3
    done
done

# set address for lp13 with invalid characters.
# lp13 should be configured with only 192.168.0.13.
ovn-nbctl lsp-set-addresses lp13 "f0:00:00:00:00:13 192.168.0.13 invalid 192.169.0.13"

# Allow some time for ovn-northd and ovn-controller to catch up.
# XXX This should be more systematic.
sleep 1

sip=`ip_to_hex 192 168 0 11`
tip=`ip_to_hex 192 168 0 13`
test_arp 11 f00000000011  $sip $tip f00000000013

tip=`ip_to_hex 192 169 0 13`
#arp request for 192.169.0.13 should be flooded
test_arp 11 f00000000011  $sip $tip

# dump information and flows with counters
ovn-sbctl dump-flows -- list multicast_group

echo "------ hv1 dump ------"
as hv1 ovs-vsctl show
as hv1 ovs-ofctl -O OpenFlow13 dump-flows br-int

echo "------ hv2 dump ------"
as hv2 ovs-vsctl show
as hv2 ovs-ofctl -O OpenFlow13 dump-flows br-int

echo "------ hv3 dump ------"
as hv3 ovs-vsctl show
as hv3 ovs-ofctl -O OpenFlow13 dump-flows br-int

# Now check the packets actually received against the ones expected.
for i in 1 2 3; do
    for j in 1 2 3; do
        ovn_check_packets__ "hv$i/vif$i$j-tx.pcap" "$i$j.expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:1832: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:1832"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:1832"
$at_failed && at_fn_log_failure
$at_traceon; }

    done
done




    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:1836: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:1836"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:1836"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:1836: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:1836"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:1836"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:1836" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:1836: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:1836"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:1836"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:1836: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:1836"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:1836"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:1836" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:1836: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:1836"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:1836"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:1836: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:1836"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:1836"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:1836" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:1836: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:1836"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:1836"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:1836: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:1836"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:1836"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:1836" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:1836: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:1836"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:1836"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:1836: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:1836"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:1836"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:1836" "while kill -0 \$TMPPID 2>/dev/null"





    as hv2
    if test "hv2" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:1836: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:1836"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:1836"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:1836: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:1836"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:1836"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:1836" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:1836: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:1836"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:1836"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:1836: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:1836"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:1836"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:1836" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:1836: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:1836"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:1836"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:1836: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:1836"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:1836"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:1836" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv2
    { set +x
$as_echo "$at_srcdir/ovn.at:1836: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:1836"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:1836"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:1836: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:1836"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:1836"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:1836" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:1836: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:1836"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:1836"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:1836: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:1836"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:1836"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:1836" "while kill -0 \$TMPPID 2>/dev/null"





    as hv3
    if test "hv3" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:1836: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:1836"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:1836"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:1836: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:1836"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:1836"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:1836" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:1836: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:1836"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:1836"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:1836: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:1836"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:1836"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:1836" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:1836: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:1836"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:1836"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:1836: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:1836"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:1836"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:1836" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv3
    { set +x
$as_echo "$at_srcdir/ovn.at:1836: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:1836"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:1836"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:1836: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:1836"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:1836"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:1836" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:1836: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:1836"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:1836"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:1836: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:1836"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:1836"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:1836" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:1836: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:1836"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:1836"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:1836: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:1836"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:1836"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:1836" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:1836: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:1836"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:1836"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:1836: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:1836"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:1836"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:1836" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:1836: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:1836"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:1836"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:1836: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:1836"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:1836"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:1836" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:1836: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:1836"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:1836"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:1836: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:1836"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:1836"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:1836" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:1836: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:1836"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:1836"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:1836: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:1836"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:1836"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:1836" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:1836: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:1836"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:1836"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:1836: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:1836"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:1836"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:1836" "while kill -0 \$TMPPID 2>/dev/null"




ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_30
#AT_START_31
at_fn_group_banner 31 'ovn.at:1842' \
  "ovn -- 2 HVs, 1 LS, 2 lports/HV" "                " 2
at_xfail=no
(
  $as_echo "31. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init


ovn_start

# Create hypervisors hv[12].
# Add vif1[12] to hv1, vif2[12] to hv2
ovn-nbctl ls-add lsw0
net_add n1
for i in 1 2; do
    sim_add hv$i
    as hv$i
    ovs-vsctl add-br br-phys
    ovn_attach n1 br-phys 192.168.0.$i

    for j in 1 2; do
        ovs-vsctl add-port br-int vif$i$j -- set Interface vif$i$j external-ids:iface-id=lp$i$j options:tx_pcap=hv$i/vif$i$j-tx.pcap options:rxq_pcap=hv$i/vif$i$j-rx.pcap ofport-request=$i$j
        ovn-nbctl lsp-add lsw0 lp$i$j
        ip_addrs="192.168.0.$i$j"
        ovn-nbctl lsp-set-addresses lp$i$j "f0:00:00:00:00:$i$j $ip_addrs"
        ovn-nbctl --wait=hv lsp-set-port-security lp$i$j f0:00:00:00:00:$i$j
    done
done

get_lsp_uuid () {
    ovn-nbctl lsp-list lsw0 | grep $1 | awk '{ print $1 }'
}

# XXX-Check how to pass lp$i1 in AT_CHECK_UNQUOTED, for now just do it
# explictly

# For Chassis hv1
{ set +x
$as_echo "$at_srcdir/ovn.at:1873: ovn-sbctl  --column encap list port_binding lp11"
at_fn_check_prepare_trace "ovn.at:1873"
( $at_check_trace; ovn-sbctl  --column encap list port_binding lp11
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "encap               : []
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:1873"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:1876: ovn-sbctl  --column encap list port_binding lp12"
at_fn_check_prepare_trace "ovn.at:1876"
( $at_check_trace; ovn-sbctl  --column encap list port_binding lp12
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "encap               : []
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:1876"
$at_failed && at_fn_log_failure
$at_traceon; }


# For Chassis hv2
{ set +x
$as_echo "$at_srcdir/ovn.at:1881: ovn-sbctl  --column encap list port_binding lp21"
at_fn_check_prepare_trace "ovn.at:1881"
( $at_check_trace; ovn-sbctl  --column encap list port_binding lp21
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "encap               : []
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:1881"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:1884: ovn-sbctl  --column encap list port_binding lp22"
at_fn_check_prepare_trace "ovn.at:1884"
( $at_check_trace; ovn-sbctl  --column encap list port_binding lp22
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "encap               : []
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:1884"
$at_failed && at_fn_log_failure
$at_traceon; }


# Bind the ports to the encap-ip
for i in 1 2; do
    for j in 1 2; do
        as hv$i
        ovs-vsctl set Interface vif$i$j external-ids:encap-ip=192.168.0.$i
    done
done

sleep 1

# dump port bindings; since we have vxlan and geneve tunnels, we expect the
# ports to be bound to geneve tunnels.

# For Chassis 1
encap_rec=`ovn-sbctl --data=bare --no-heading --column _uuid find encap chassis_name=hv1 type=geneve ip=192.168.0.1`

{ set +x
$as_echo "$at_srcdir/ovn.at:1904: ovn-sbctl  --column encap list port_binding lp11"
at_fn_check_prepare_trace "ovn.at:1904"
( $at_check_trace; ovn-sbctl  --column encap list port_binding lp11
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "encap               : ${encap_rec}
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:1904"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn.at:1908: ovn-sbctl  --column encap list port_binding lp12"
at_fn_check_prepare_trace "ovn.at:1908"
( $at_check_trace; ovn-sbctl  --column encap list port_binding lp12
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "encap               : ${encap_rec}
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:1908"
$at_failed && at_fn_log_failure
$at_traceon; }


# For Chassis 2
encap_rec=`ovn-sbctl --data=bare --no-heading --column _uuid find encap chassis_name=hv2 type=geneve ip=192.168.0.2`

{ set +x
$as_echo "$at_srcdir/ovn.at:1915: ovn-sbctl  --column encap list port_binding lp21"
at_fn_check_prepare_trace "ovn.at:1915"
( $at_check_trace; ovn-sbctl  --column encap list port_binding lp21
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "encap               : ${encap_rec}
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:1915"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn.at:1919: ovn-sbctl  --column encap list port_binding lp22"
at_fn_check_prepare_trace "ovn.at:1919"
( $at_check_trace; ovn-sbctl  --column encap list port_binding lp22
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "encap               : ${encap_rec}
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:1919"
$at_failed && at_fn_log_failure
$at_traceon; }


# Pre-populate the hypervisors' ARP tables so that we don't lose any
# packets for ARP resolution (native tunneling doesn't queue packets
# for ARP resolution).
{ set +x
$as_echo "$at_srcdir/ovn.at:1926: ovn_populate_arp__"
at_fn_check_prepare_trace "ovn.at:1926"
( $at_check_trace; ovn_populate_arp__
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:1926"
$at_failed && at_fn_log_failure
$at_traceon; }


# Allow some time for ovn-northd and ovn-controller to catch up.
# XXX This should be more systematic.
sleep 1

# Make sure there is no attempt to adding duplicated flows by ovn-controller
$as_echo "ovn.at:1933" >"$at_check_line_file"
(test -n "`grep duplicate hv1/ovn-controller.log`") \
  && at_fn_check_skip 99 "$at_srcdir/ovn.at:1933"
$as_echo "ovn.at:1934" >"$at_check_line_file"
(test -n "`grep duplicate hv2/ovn-controller.log`") \
  && at_fn_check_skip 99 "$at_srcdir/ovn.at:1934"
$as_echo "ovn.at:1935" >"$at_check_line_file"
(test -n "`grep duplicate hv3/ovn-controller.log`") \
  && at_fn_check_skip 99 "$at_srcdir/ovn.at:1935"

# Given the name of a logical port, prints the name of the hypervisor
# on which it is located.
vif_to_hv() {
    echo hv${1%?}
}

# test_packet INPORT DST SRC ETHTYPE OUTPORT...
#
# This shell function causes a packet to be received on INPORT.  The packet's
# content has Ethernet destination DST and source SRC (each exactly 12 hex
# digits) and Ethernet type ETHTYPE (4 hex digits).  The OUTPORTs (zero or
# more) list the VIFs on which the packet should be received.  INPORT and the
# OUTPORTs are specified as logical switch port numbers, e.g. 11 for vif11.
for i in 1 2; do
    for j in 1 2; do
        : > $i$j.expected
    done
done
test_packet() {
    local inport=$1 packet=$2$3$4; shift; shift; shift; shift
    hv=`vif_to_hv $inport`
    vif=vif$inport
    as $hv ovs-appctl netdev-dummy/receive $vif $packet
    for outport; do
        echo $packet >> $outport.expected
    done
}

ip_to_hex() {
    printf "%02x%02x%02x%02x" "$@"
}

# Send packets between all pairs of source and destination ports:
#
# 1. Unicast packets are delivered to exactly one logical switch port
#    (except that packets destined to their input ports are dropped).

for is in 1 2; do
    for js in 1 2; do
        s=$is$js
        bcast=
        unknown=
        bacl2=
        bacl3=
        for id in 1 2 3; do
            for jd in 1 2 3; do
                d=$id$jd

                if test $d != $s; then unicast=$d; else unicast=; fi
                test_packet $s f000000000$d f000000000$s $s$d $unicast     #1
            done
        done

    done
done

# dump information and flows with counters
ovn-sbctl dump-flows -- list multicast_group

echo "------ hv1 dump ------"
as hv1 ovs-vsctl show
as hv1 ovs-ofctl -O OpenFlow13 dump-flows br-int

echo "------ hv2 dump ------"
as hv2 ovs-vsctl show
as hv2 ovs-ofctl -O OpenFlow13 dump-flows br-int

echo "------ hv3 dump ------"
as hv3 ovs-vsctl show
as hv3 ovs-ofctl -O OpenFlow13 dump-flows br-int

# Now check the packets actually received against the ones expected.
for i in 1 2; do
    for j in 1 2; do
        ovn_check_packets__ "hv$i/vif$i$j-tx.pcap" "$i$j.expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:2011: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:2011"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2011"
$at_failed && at_fn_log_failure
$at_traceon; }

    done
done




    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:2015: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:2015"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2015"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:2015: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:2015"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2015"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:2015" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:2015: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:2015"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2015"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:2015: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:2015"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2015"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:2015" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:2015: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:2015"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2015"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:2015: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:2015"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2015"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:2015" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:2015: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:2015"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2015"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:2015: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:2015"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2015"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:2015" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:2015: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:2015"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2015"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:2015: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:2015"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2015"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:2015" "while kill -0 \$TMPPID 2>/dev/null"





    as hv2
    if test "hv2" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:2015: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:2015"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2015"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:2015: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:2015"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2015"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:2015" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:2015: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:2015"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2015"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:2015: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:2015"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2015"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:2015" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:2015: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:2015"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2015"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:2015: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:2015"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2015"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:2015" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv2
    { set +x
$as_echo "$at_srcdir/ovn.at:2015: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:2015"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2015"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:2015: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:2015"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2015"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:2015" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:2015: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:2015"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2015"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:2015: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:2015"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2015"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:2015" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:2015: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:2015"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2015"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:2015: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:2015"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2015"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:2015" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:2015: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:2015"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2015"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:2015: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:2015"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2015"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:2015" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:2015: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:2015"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2015"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:2015: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:2015"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2015"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:2015" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:2015: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:2015"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2015"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:2015: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:2015"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2015"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:2015" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:2015: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:2015"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2015"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:2015: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:2015"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2015"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:2015" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:2015: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:2015"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2015"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:2015: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:2015"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2015"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:2015" "while kill -0 \$TMPPID 2>/dev/null"




ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_31
#AT_START_32
at_fn_group_banner 32 'ovn.at:2019' \
  "ovn -- trace 1 LS, 3 LSPs" "                      " 2
at_xfail=no
(
  $as_echo "32. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

# Create a logical switch and some logical ports.
# Turn on port security on all lports except ls1.
# Make ls1 a destination for unknown MACs.
# Add some ACLs for Ethertypes 1234, 1235, 1236.
ovn-nbctl ls-add lsw0
ovn-sbctl chassis-add hv0 geneve 127.0.0.1
for i in 1 2 3; do
    ovn-nbctl lsp-add lsw0 lp$i
done
ovn-nbctl --wait=sb sync
for i in 1 2 3; do
    ovn-sbctl lsp-bind lp$i hv0
    if test $i = 1; then
        ovn-nbctl lsp-set-addresses lp$i "f0:00:00:00:00:0$i 192.168.0.$i" unknown
    else
        if test $i = 3; then
           ip_addrs="192.168.0.$i fe80::ea2a:eaff:fe28:$i/64 192.169.0.$i"
        else
           ip_addrs="192.168.0.$i"
        fi
        ovn-nbctl lsp-set-addresses lp$i "f0:00:00:00:00:0$i $ip_addrs"
        ovn-nbctl lsp-set-port-security lp$i f0:00:00:00:00:0$i
    fi
done
ovn-nbctl acl-add lsw0 from-lport 1000 'eth.type == 0x1234' drop
ovn-nbctl acl-add lsw0 from-lport 1000 'eth.type == 0x1235 && inport == "lp1"' drop
ovn-nbctl acl-add lsw0 to-lport 1000 'eth.type == 0x1236 && outport == "lp3"' drop
ovn-nbctl create Address_Set name=set1 addresses=\"f0:00:00:00:00:01\",\"f0:00:00:00:00:02\"
ovn-nbctl acl-add lsw0 to-lport 1000 'eth.type == 0x1237 && eth.src == $set1 && outport == "lp3"' drop

ovn-nbctl --wait=sb sync
on_exit 'kill `cat ovn-trace.pid`'
ovn-trace --detach --pidfile --no-chdir

# test_packet INPORT DST SRC [-vlan] [-eth TYPE] OUTPORT...
#
# This shell function causes a packet to be received on INPORT.  The packet's
# content has Ethernet destination DST and source SRC (each exactly 12 hex
# digits) and Ethernet type ETHTYPE (4 hex digits).  The OUTPORTs (zero or
# more) list the VIFs on which the packet should be received.  INPORT and the
# OUTPORTs are specified as logical switch port numbers, e.g. 11 for vif11.
test_packet() {
    local inport=$1 eth_dst=$2 eth_src=$3; shift; shift; shift
    uflow="inport==\"lp$inport\" && eth.dst==$eth_dst && eth.src==$eth_src"
    while :; do
        case $1 in # (
            -vlan) uflow="$uflow && vlan.vid == 1234"; shift ;; # (
            -eth) uflow="$uflow && eth.type == 0x$2"; shift; shift ;; # (
            *) break ;;
        esac
    done
    for outport; do
        echo "output(\"lp$outport\");"
    done > expout


    { set +x
$as_echo "$at_srcdir/ovn.at:2078: ovs-appctl -t ovn-trace trace --all lsw0 \"\$uflow\" | tee trace | sed '1,/Minimal trace/d'"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:2078"
( $at_check_trace; ovs-appctl -t ovn-trace trace --all lsw0 "$uflow" | tee trace | sed '1,/Minimal trace/d'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2078"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

}

# test_arp INPORT SHA SPA TPA [REPLY_HA]
#
# Causes a packet to be received on INPORT.  The packet is an ARP
# request with SHA, SPA, and TPA as specified.  If REPLY_HA is provided, then
# it should be the hardware address of the target to expect to receive in an
# ARP reply; otherwise no reply is expected.
#
# INPORT is an logical switch port number, e.g. 11 for vif11.
# SHA and REPLY_HA are each 12 hex digits.
# SPA and TPA are each 8 hex digits.
test_arp() {
    local inport=$1 sha=$2 spa=$3 tpa=$4 reply_ha=$5

    local request="inport == \"lp$inport\"
                   && eth.dst == ff:ff:ff:ff:ff:ff && eth.src == $sha
                   && arp.op == 1 && arp.sha == $sha && arp.spa == $spa
                   && arp.tha == ff:ff:ff:ff:ff:ff && arp.tpa == $tpa"

    if test -z "$reply_ha"; then
        reply=
        local i
        for i in 1 2 3; do
            if test $i != $inport; then
                reply="${reply}output(\"lp$i\");
"
            fi
        done
    else
        reply="\
eth.dst = $sha;
eth.src = $reply_ha;
arp.op = 2;
arp.tha = $sha;
arp.sha = $reply_ha;
arp.tpa = $spa;
arp.spa = $tpa;
output(\"lp$inport\");
"
    fi


    { set +x
$as_echo "$at_srcdir/ovn.at:2122: ovs-appctl -t ovn-trace trace --all lsw0 \"\$request\" | tee trace | sed '1,/Minimal trace/d'"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:2122"
( $at_check_trace; ovs-appctl -t ovn-trace trace --all lsw0 "$request" | tee trace | sed '1,/Minimal trace/d'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "$reply" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2122"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

}

# Send packets between all pairs of source and destination ports:
#
# 1. Unicast packets are delivered to exactly one logical switch port
#    (except that packets destined to their input ports are dropped).
#
# 2. Broadcast and multicast are delivered to all logical switch ports
#    except the input port.
#
# 3. When port security is turned on, the switch drops packets from the wrong
#    MAC address.
#
# 4. The switch drops all packets with a VLAN tag.
#
# 5. The switch drops all packets with a multicast source address.  (This only
#    affects behavior when port security is turned off, since otherwise port
#    security would drop the packet anyway.)
#
# 6. The switch delivers packets with an unknown destination to logical
#    switch ports with "unknown" among their MAC addresses (and port
#    security disabled).
#
# 7. The switch drops unicast packets that violate an ACL.
#
# 8. The switch drops multicast and broadcast packets that violate an ACL.
#
# 9. OVN generates responses to ARP requests for known IPs, except for
#    requests from a port for the port's own IP.
#
# 10. No response to ARP requests for unknown IPs.

for s in 1 2 3; do
    bcast=
    unknown=
    bacl2=
    bacl3=
    for d in 1 2 3; do
        echo
        echo "lp$s -> lp$d"
        if test $d != $s; then unicast=$d; else unicast=; fi
        test_packet $s f0:00:00:00:00:0$d f0:00:00:00:00:0$s $unicast      #1

        if test $d != $s && test $s = 1; then
            impersonate=$d
        else
            impersonate=
        fi
        test_packet $s f0:00:00:00:00:0$d f0:00:00:00:00:55 $impersonate   #3

        if test $d != $s && test $s != 1; then acl2=$d; else acl2=; fi
        if test $d != $s && test $d != 3; then acl3=$d; else acl3=; fi
        if test $d = $s || ( (test $s = 1 || test $s = 2) && test $d = 3); then
            # Source of 1 or 2 and dest of 3 should be dropped
            # due to the 4th ACL that uses address_set(set1).
            acl4=
        else
            acl4=$d
        fi

        #7, acl1 to acl4:
        test_packet $s f0:00:00:00:00:0$d f0:00:00:00:00:0$s -eth 1234
        test_packet $s f0:00:00:00:00:0$d f0:00:00:00:00:0$s -eth 1235 $acl2
        test_packet $s f0:00:00:00:00:0$d f0:00:00:00:00:0$s -eth 1236 $acl3
        test_packet $s f0:00:00:00:00:0$d f0:00:00:00:00:0$s -eth 1237 $acl4

        test_packet $s f0:00:00:00:00:0$d f0:00:00:00:00:55 -vlan          #4
        test_packet $s f0:00:00:00:00:0$d 01:00:00:00:00:0$s               #5

        if test $d != $s && test $d = 1; then
            unknown="$unknown $d"
        fi
        bcast="$bcast $unicast"
        bacl2="$bacl2 $acl2"
        bacl3="$bacl3 $acl3"

        sip=192.168.0.$s
        tip=192.168.0.$d
        tip_unknown=11.11.11.11
        if test $d != $s; then reply_ha=f0:00:00:00:00:0$d; else reply_ha=; fi
        test_arp $s f0:00:00:00:00:0$s $sip $tip $reply_ha                 #9
        test_arp $s f0:00:00:00:00:0$s $sip $tip_unknown                   #10

        if test $d = 3; then
            # lp3 has an additional ip 192.169.0.[123]3.
            tip=192.169.0.$d
            test_arp $s f0:00:00:00:00:0$s $sip $tip $reply_ha             #9
        fi
    done

    # Broadcast and multicast.
    test_packet $s ff:ff:ff:ff:ff:ff f0:00:00:00:00:0$s $bcast             #2
    test_packet $s 01:00:00:00:00:00 f0:00:00:00:00:0$s $bcast             #2
    if test $s = 1; then
       bcast_impersonate=$bcast
    else
       bcast_impersonate=
    fi
    test_packet $s 01:00:00:00:00:00 f0:00:00:00:00:44 $bcast_impersonate  #3

    test_packet $s f0:00:00:00:ff:ff f0:00:00:00:00:0$s $unknown           #6

    #8, acl1 to acl3:
    test_packet $s ff:ff:ff:ff:ff:ff f0:00:00:00:00:0$s -eth 1234
    test_packet $s ff:ff:ff:ff:ff:ff f0:00:00:00:00:0$s -eth 1235 $bacl2
    test_packet $s ff:ff:ff:ff:ff:ff f0:00:00:00:00:0$s -eth 1236 $bacl3

    #8, acl1 to acl3:
    test_packet $s 01:00:00:00:00:00 f0:00:00:00:00:0$s -eth 1234
    test_packet $s 01:00:00:00:00:00 f0:00:00:00:00:0$s -eth 1235 $bacl2
    test_packet $s 01:00:00:00:00:00 f0:00:00:00:00:0$s -eth 1236 $bacl3
done

ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_32
#AT_START_33
at_fn_group_banner 33 'ovn.at:2241' \
  "ovn -- 2 HVs, 4 lports/HV, localnet ports" "      " 2
at_xfail=no
(
  $as_echo "33. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

# In this test cases we create 3 switches, all connected to same
# physical network (through br-phys on each HV). Each switch has
# VIF ports across 2 HVs. Each HV has 5 VIF ports. The first digit
# of VIF port name indicates the hypervisor it is bound to, e.g.
# lp23 means VIF 3 on hv2.
#
# Each switch's VLAN tag and their logical switch ports are:
#   - ls1:
#       - untagged
#       - ports: lp11, lp12, lp21, lp22
#
#   - ls2:
#       - tagged with VLAN 101
#       - ports: lp13, lp14, lp23, lp24
#   - ls3:
#       - untagged
#       - ports: lp15, lp25
#
# Note: a localnet port is created for each switch to connect to
# physical network.

for i in 1 2 3; do
    ls_name=ls$i
    ovn-nbctl ls-add $ls_name
    ln_port_name=ln$i
    if test $i -eq 2; then
        ovn-nbctl lsp-add $ls_name $ln_port_name "" 101
    else
        ovn-nbctl lsp-add $ls_name $ln_port_name
    fi
    ovn-nbctl lsp-set-addresses $ln_port_name unknown
    ovn-nbctl lsp-set-type $ln_port_name localnet
    ovn-nbctl lsp-set-options $ln_port_name network_name=phys
done

# lsp_to_ls LSP
#
# Prints the name of the logical switch that contains LSP.
lsp_to_ls () {
    case $1 in         lp?[12]) echo ls1 ;;         lp?[34]) echo ls2 ;;         lp?5) echo ls3 ;;         *) $as_echo "ovn.at:2287" >"$at_check_line_file"
at_fn_check_skip 99 "$at_srcdir/ovn.at:2287" ;;
    esac
}

net_add n1
for i in 1 2; do
    sim_add hv$i
    as hv$i
    ovs-vsctl add-br br-phys
    ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys
    ovn_attach n1 br-phys 192.168.0.$i

    for j in 1 2 3 4 5; do
        ovs-vsctl add-port br-int vif$i$j -- \
            set Interface vif$i$j external-ids:iface-id=lp$i$j \
                                  options:tx_pcap=hv$i/vif$i$j-tx.pcap \
                                  options:rxq_pcap=hv$i/vif$i$j-rx.pcap \
                                  ofport-request=$i$j

        lsp_name=lp$i$j
        ls_name=$(lsp_to_ls $lsp_name)

        ovn-nbctl lsp-add $ls_name $lsp_name
        ovn-nbctl lsp-set-addresses $lsp_name f0:00:00:00:00:$i$j
        ovn-nbctl lsp-set-port-security $lsp_name f0:00:00:00:00:$i$j

        ovs_wait_cond () {
    test x`ovn-nbctl lsp-get-up $lsp_name` = xup
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:2313" "until test x\`ovn-nbctl lsp-get-up \$lsp_name\` = xup"

    done
done
ovn-nbctl --wait=sb sync
ovn-sbctl dump-flows

{ set +x
$as_echo "$at_srcdir/ovn.at:2319: ovn_populate_arp__"
at_fn_check_prepare_trace "ovn.at:2319"
( $at_check_trace; ovn_populate_arp__
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2319"
$at_failed && at_fn_log_failure
$at_traceon; }


# XXX This is now the 3rd copy of these functions in this file ...

# Given the name of a logical port, prints the name of the hypervisor
# on which it is located.
vif_to_hv() {
    echo hv${1%?}
}
#
# test_packet INPORT DST SRC ETHTYPE EOUT LOUT
#
# This shell function causes a packet to be received on INPORT.  The packet's
# content has Ethernet destination DST and source SRC (each exactly 12 hex
# digits) and Ethernet type ETHTYPE (4 hex digits).  INPORT is specified as
# logical switch port numbers, e.g. 11 for vif11.
#
# EOUT is the end-to-end output port, that is, where the packet will end up
# after possibly bouncing through one or more localnet ports.  LOUT is the
# logical output port, which might be a localnet port, as seen by ovn-trace
# (which doesn't know what localnet ports are connected to and therefore can't
# figure out the end-to-end answer).
for i in 1 2; do
    for j in 1 2 3 4 5; do
        : > $i$j.expected
    done
done
test_packet() {
    local inport=$1 dst=$2 src=$3 eth=$4 eout=$5 lout=$6
    echo "$@"

    # First try tracing the packet.
    uflow="inport==\"lp$inport\" && eth.dst==$dst && eth.src==$src && eth.type==0x$eth"
    if test $lout != drop; then
        echo "output(\"$lout\");"
    fi > expout

    { set +x
$as_echo "$at_srcdir/ovn.at:2356: ovn-trace --all \$(lsp_to_ls lp\$inport) \"\$uflow\" | tee trace | sed '1,/Minimal trace/d'"
at_fn_check_prepare_notrace 'a $(...) command substitution' "ovn.at:2356"
( $at_check_trace; ovn-trace --all $(lsp_to_ls lp$inport) "$uflow" | tee trace | sed '1,/Minimal trace/d'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2356"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }


    # Then actually send a packet, for an end-to-end test.
    local packet=$(echo $dst$src | sed 's/://g')${eth}
    hv=`vif_to_hv $inport`
    vif=vif$inport
    as $hv ovs-appctl netdev-dummy/receive $vif $packet
    if test $eout != drop; then
        echo $packet >> ${eout#lp}.expected
    fi
}

# lp11 and lp21 are on the same network (phys, untagged)
# and on different hypervisors
test_packet 11 f0:00:00:00:00:21 f0:00:00:00:00:11 1121 lp21 lp21
test_packet 21 f0:00:00:00:00:11 f0:00:00:00:00:21 2111 lp11 lp11

# lp11 and lp12 are on the same network (phys, untagged)
# and on the same hypervisor
test_packet 11 f0:00:00:00:00:12 f0:00:00:00:00:11 1112 lp12 lp12
test_packet 12 f0:00:00:00:00:11 f0:00:00:00:00:12 1211 lp11 lp11

# lp13 and lp23 are on the same network (phys, VLAN 101)
# and on different hypervisors
test_packet 13 f0:00:00:00:00:23 f0:00:00:00:00:13 1323 lp23 lp23
test_packet 23 f0:00:00:00:00:13 f0:00:00:00:00:23 2313 lp13 lp13

# lp13 and lp14 are on the same network (phys, VLAN 101)
# and on the same hypervisor
test_packet 13 f0:00:00:00:00:14 f0:00:00:00:00:13 1314 lp14 lp14
test_packet 14 f0:00:00:00:00:13 f0:00:00:00:00:14 1413 lp13 lp13

# lp11 and lp15 are on the same network (phys, untagged),
# same hypervisor, and on different switches
test_packet 11 f0:00:00:00:00:15 f0:00:00:00:00:11 1115 lp15 ln1
test_packet 15 f0:00:00:00:00:11 f0:00:00:00:00:15 1511 lp11 ln3

# lp11 and lp25 are on the same network (phys, untagged),
# different hypervisors, and on different switches
test_packet 11 f0:00:00:00:00:25 f0:00:00:00:00:11 1125 lp25 ln1
test_packet 25 f0:00:00:00:00:11 f0:00:00:00:00:25 2511 lp11 ln3

# Ports that should not be able to communicate
test_packet 11 f0:00:00:00:00:13 f0:00:00:00:00:11 1113 drop ln1
test_packet 11 f0:00:00:00:00:23 f0:00:00:00:00:11 1123 drop ln1
test_packet 21 f0:00:00:00:00:13 f0:00:00:00:00:21 2113 drop ln1
test_packet 21 f0:00:00:00:00:23 f0:00:00:00:00:21 2123 drop ln1
test_packet 13 f0:00:00:00:00:11 f0:00:00:00:00:13 1311 drop ln2
test_packet 13 f0:00:00:00:00:21 f0:00:00:00:00:13 1321 drop ln2
test_packet 23 f0:00:00:00:00:11 f0:00:00:00:00:23 2311 drop ln2
test_packet 23 f0:00:00:00:00:21 f0:00:00:00:00:23 2321 drop ln2

# Dump a bunch of info helpful for debugging if there's a failure.

echo "------ OVN dump ------"
ovn-nbctl show
ovn-sbctl show

echo "------ hv1 dump ------"
as hv1 ovs-vsctl show
as hv1 ovs-ofctl -O OpenFlow13 dump-flows br-int

echo "------ hv2 dump ------"
as hv2 ovs-vsctl show
as hv2 ovs-ofctl -O OpenFlow13 dump-flows br-int

# Now check the packets actually received against the ones expected.
for i in 1 2; do
    for j in 1 2 3 4 5; do
        ovn_check_packets__ () {
   echo "checking packets in hv$i/vif$i$j-tx.pcap against $i$j.expected:"
   rcv_pcap=hv$i/vif$i$j-tx.pcap
   exp_text=$i$j.expected
   exp_n=`wc -l < "$exp_text"`
   ovs_wait_cond () {
    $PYTHON "$top_srcdir/ovs/utilities/ovs-pcap.in" $rcv_pcap > $rcv_text
      sed -i '/ffffffffffff/d' $rcv_text
      rcv_n=`wc -l < "$rcv_text"`
      echo "rcv_n=$rcv_n exp_n=$exp_n"
      test $rcv_n -ge $exp_n
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:2425" "until \$PYTHON \"\$top_srcdir/ovs/utilities/ovs-pcap.in\" \$rcv_pcap > \$rcv_text
      sed -i '/ffffffffffff/d' \$rcv_text
      rcv_n=\`wc -l < \"\$rcv_text\"\`
      echo \"rcv_n=\$rcv_n exp_n=\$exp_n\"
      test \$rcv_n -ge \$exp_n"

   sort $exp_text > expout
 }

    done
done




    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:2429: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:2429"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2429"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:2429: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:2429"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2429"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:2429" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:2429: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:2429"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2429"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:2429: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:2429"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2429"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:2429" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:2429: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:2429"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2429"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:2429: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:2429"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2429"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:2429" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:2429: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:2429"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2429"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:2429: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:2429"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2429"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:2429" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:2429: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:2429"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2429"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:2429: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:2429"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2429"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:2429" "while kill -0 \$TMPPID 2>/dev/null"





    as hv2
    if test "hv2" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:2429: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:2429"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2429"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:2429: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:2429"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2429"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:2429" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:2429: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:2429"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2429"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:2429: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:2429"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2429"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:2429" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:2429: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:2429"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2429"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:2429: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:2429"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2429"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:2429" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv2
    { set +x
$as_echo "$at_srcdir/ovn.at:2429: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:2429"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2429"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:2429: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:2429"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2429"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:2429" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:2429: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:2429"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2429"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:2429: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:2429"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2429"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:2429" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:2429: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:2429"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2429"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:2429: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:2429"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2429"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:2429" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:2429: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:2429"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2429"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:2429: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:2429"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2429"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:2429" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:2429: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:2429"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2429"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:2429: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:2429"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2429"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:2429" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:2429: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:2429"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2429"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:2429: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:2429"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2429"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:2429" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:2429: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:2429"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2429"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:2429: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:2429"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2429"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:2429" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:2429: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:2429"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2429"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:2429: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:2429"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2429"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:2429" "while kill -0 \$TMPPID 2>/dev/null"




ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_33
#AT_START_34
at_fn_group_banner 34 'ovn.at:2433' \
  "ovn -- vtep: 3 HVs, 1 VIFs/HV, 1 GW, 1 LS" "      " 2
at_xfail=no
(
  $as_echo "34. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init


ovn_start

# Configure the Northbound database
ovn-nbctl ls-add lsw0

ovn-nbctl lsp-add lsw0 lp1
ovn-nbctl lsp-set-addresses lp1 f0:00:00:00:00:01

ovn-nbctl lsp-add lsw0 lp2
ovn-nbctl lsp-set-addresses lp2 f0:00:00:00:00:02

ovn-nbctl lsp-add lsw0 lp-vtep
ovn-nbctl lsp-set-type lp-vtep vtep
ovn-nbctl lsp-set-options lp-vtep vtep-physical-switch=br-vtep vtep-logical-switch=lsw0
ovn-nbctl lsp-set-addresses lp-vtep unknown

# lpr, lr and lrp1 are used for the ARP request handling test only.
ovn-nbctl lsp-add lsw0 lpr
ovn-nbctl lr-add lr
ovn-nbctl lrp-add lr lrp1 f0:00:00:00:00:f1 192.168.1.1/24
ovn-nbctl set Logical_Switch_Port lpr type=router \
                             options:router-port=lrp1 \
    addresses='"f0:00:00:00:00:f1 192.168.1.1"'


net_add n1               # Network to connect hv1, hv2, and vtep
net_add n2               # Network to connect vtep and hv3

# Create hypervisor hv1 connected to n1
sim_add hv1
as hv1
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.1
ovs-vsctl add-port br-int vif1 -- set Interface vif1 external-ids:iface-id=lp1 options:tx_pcap=hv1/vif1-tx.pcap options:rxq_pcap=hv1/vif1-rx.pcap ofport-request=1

# Create hypervisor hv2 connected to n1
sim_add hv2
as hv2
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.2
ovs-vsctl add-port br-int vif2 -- set Interface vif2 external-ids:iface-id=lp2 options:tx_pcap=hv2/vif2-tx.pcap options:rxq_pcap=hv2/vif2-rx.pcap ofport-request=1


# Start the vtep emulator with a leg in both networks
sim_add vtep
as vtep

ovsdb-tool create "$ovs_base"/vtep/vtep.db "$ovs_srcdir"/vtep/vtep.ovsschema
ovs-appctl -t ovsdb-server ovsdb-server/add-db "$ovs_base"/vtep/vtep.db

ovs-vsctl add-br br-phys
net_attach n1 br-phys

mac=`ovs-vsctl get Interface br-phys mac_in_use | sed s/\"//g`
arp_table="$arp_table $sandbox,br-phys,192.168.0.3,$mac"
ovs-appctl netdev-dummy/ip4addr br-phys 192.168.0.3/24 >/dev/null
ovs-appctl ovs/route/add 192.168.0.3/24 br-phys >/dev/null

ovs-vsctl add-br br-vtep
net_attach n2 br-vtep

vtep-ctl add-ps br-vtep
vtep-ctl set Physical_Switch br-vtep tunnel_ips=192.168.0.3
vtep-ctl add-ls lsw0

start_daemon ovs-vtep br-vtep
start_daemon ovn-controller-vtep --vtep-db=unix:"$ovs_base"/vtep/db.sock --ovnsb-db=unix:"$ovs_base"/ovn-sb/ovn-sb.sock

ovs_wait_cond () {
    vtep-ctl bind-ls br-vtep br-vtep_n2 0 lsw0
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:2503" "until vtep-ctl bind-ls br-vtep br-vtep_n2 0 lsw0"


ovs_wait_cond () {
    test -n "`as vtep vtep-ctl get-replication-mode lsw0 |
               grep -- source`"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:2505" "until test -n \"\`as vtep vtep-ctl get-replication-mode lsw0 |
               grep -- source\`\""

# It takes more time for the update to be processed by ovs-vtep.
sleep 1

# Add hv3 on the other side of the vtep
sim_add hv3
as hv3
ovs-vsctl add-br br-phys
net_attach n2 br-phys

ovs-vsctl add-port br-phys vif3 -- set Interface vif3 options:tx_pcap=hv3/vif3-tx.pcap options:rxq_pcap=hv3/vif3-rx.pcap ofport-request=1

# Pre-populate the hypervisors' ARP tables so that we don't lose any
# packets for ARP resolution (native tunneling doesn't queue packets
# for ARP resolution).
{ set +x
$as_echo "$at_srcdir/ovn.at:2521: ovn_populate_arp__"
at_fn_check_prepare_trace "ovn.at:2521"
( $at_check_trace; ovn_populate_arp__
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2521"
$at_failed && at_fn_log_failure
$at_traceon; }


# Allow some time for ovn-northd and ovn-controller to catch up.
# XXX This should be more systematic.
sleep 1

# test_packet INPORT DST SRC ETHTYPE OUTPORT...
#
# This shell function causes a packet to be received on INPORT.  The packet's
# content has Ethernet destination DST and source SRC (each exactly 12 hex
# digits) and Ethernet type ETHTYPE (4 hex digits).  The OUTPORTs (zero or
# more) list the VIFs on which the packet should be received.  INPORT and the
# OUTPORTs are specified as logical switch port numbers, e.g. 1 for vif1.
for i in 1 2 3; do
    : > $i.expected
done
test_packet() {
    local inport=$1 packet=$2$3$4; shift; shift; shift; shift
    #hv=hv`echo $inport | sed 's/^\(.\).*/\1/'`
    hv=hv$inport
    vif=vif$inport
    as $hv ovs-appctl netdev-dummy/receive $vif $packet
    for outport; do
        echo $packet >> $outport.expected
    done
}

# Send packets between all pairs of source and destination ports:
#
# 1. Unicast packets are delivered to exactly one logical switch port
#    (except that packets destined to their input ports are dropped).
#
# 2. Broadcast and multicast are delivered to all logical switch ports
#    except the input port.
#
# 3. The switch delivers packets with an unknown destination to logical
#    switch ports with "unknown" among their MAC addresses (and port
#    security disabled).
for s in 1 2 3; do
    bcast=
    unknown=
    for d in 1 2 3; do
        if test $d != $s; then unicast=$d; else unicast=; fi
        test_packet $s f0000000000$d f0000000000$s 00$s$d $unicast       #1

        # The vtep (vif3) is the only one configured for "unknown"
        if test $d != $s && test $d = 3; then
            unknown="$unknown $d"
        fi
        bcast="$bcast $unicast"
    done

    # Broadcast and multicast.
    test_packet $s ffffffffffff f0000000000$s 0${s}ff $bcast             #2
    test_packet $s 010000000000 f0000000000$s 0${s}ff $bcast             #2

    test_packet $s f0000000ffff f0000000000$s 0${s}66 $unknown           #3
done

# ARP request should not be responded to by logical switch router
# type arp responder on HV1 and HV2 and should reach directly to
# vif1 and vif2
ip_to_hex() {
    printf "%02x%02x%02x%02x" "$@"
}
sha=f00000000003
spa=`ip_to_hex 192 168 1 2`
tpa=`ip_to_hex 192 168 1 1`
request=ffffffffffff${sha}08060001080006040001${sha}${spa}ffffffffffff${tpa}
as hv3 ovs-appctl netdev-dummy/receive vif3 $request
echo $request >> 1.expected
echo $request >> 2.expected

# dump information with counters
echo "------ OVN dump ------"
ovn-nbctl show
ovn-sbctl show

echo "---------SB dump-----"
ovn-sbctl list datapath_binding
echo "---------------------"
ovn-sbctl list port_binding
echo "---------------------"
ovn-sbctl dump-flows

echo "------ hv1 dump ------"
as hv1 ovs-vsctl show
as hv1 ovs-ofctl -O OpenFlow13 show br-int
as hv1 ovs-ofctl -O OpenFlow13 dump-flows br-int

echo "------ hv2 dump ------"
as hv2 ovs-vsctl show
as hv2 ovs-ofctl -O OpenFlow13 show br-int
as hv2 ovs-ofctl -O OpenFlow13 dump-flows br-int

echo "------ hv3 dump ------"
as hv3 ovs-vsctl show
# note: hv3 has no logical port bind, thus it should not have br-int
{ set +x
$as_echo "$at_srcdir/ovn.at:2619: as hv3 ovs-ofctl -O OpenFlow13 show br-int"
at_fn_check_prepare_trace "ovn.at:2619"
( $at_check_trace; as hv3 ovs-ofctl -O OpenFlow13 show br-int
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovs-ofctl: br-int is not a bridge or a socket
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn.at:2619"
$at_failed && at_fn_log_failure
$at_traceon; }


# Now check the packets actually received against the ones expected.
for i in 1 2 3; do
    ovn_check_packets__ "hv$i/vif$i-tx.pcap" "$i.expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:2625: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:2625"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2625"
$at_failed && at_fn_log_failure
$at_traceon; }

done

# Gracefully terminate daemons



    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:2629: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:2629"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2629"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:2629: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:2629"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2629"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:2629" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:2629: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:2629"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2629"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:2629: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:2629"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2629"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:2629" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:2629: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:2629"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2629"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:2629: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:2629"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2629"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:2629" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:2629: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:2629"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2629"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:2629: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:2629"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2629"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:2629" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:2629: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:2629"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2629"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:2629: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:2629"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2629"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:2629" "while kill -0 \$TMPPID 2>/dev/null"





    as hv2
    if test "hv2" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:2629: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:2629"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2629"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:2629: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:2629"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2629"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:2629" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:2629: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:2629"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2629"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:2629: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:2629"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2629"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:2629" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:2629: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:2629"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2629"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:2629: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:2629"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2629"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:2629" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv2
    { set +x
$as_echo "$at_srcdir/ovn.at:2629: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:2629"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2629"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:2629: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:2629"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2629"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:2629" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:2629: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:2629"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2629"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:2629: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:2629"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2629"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:2629" "while kill -0 \$TMPPID 2>/dev/null"





    as vtep
    if test "vtep" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:2629: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:2629"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2629"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:2629: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:2629"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2629"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:2629" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:2629: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:2629"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2629"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:2629: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:2629"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2629"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:2629" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:2629: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:2629"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2629"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:2629: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:2629"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2629"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:2629" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as vtep
    { set +x
$as_echo "$at_srcdir/ovn.at:2629: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:2629"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2629"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:2629: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:2629"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2629"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:2629" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:2629: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:2629"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2629"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:2629: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:2629"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2629"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:2629" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:2629: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:2629"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2629"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:2629: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:2629"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2629"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:2629" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:2629: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:2629"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2629"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:2629: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:2629"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2629"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:2629" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:2629: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:2629"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2629"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:2629: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:2629"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2629"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:2629" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:2629: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:2629"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2629"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:2629: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:2629"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2629"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:2629" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:2629: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:2629"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2629"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:2629: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:2629"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2629"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:2629" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:2629: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:2629"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2629"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:2629: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:2629"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2629"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:2629" "while kill -0 \$TMPPID 2>/dev/null"




    as hv3
    { set +x
$as_echo "$at_srcdir/ovn.at:2630: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:2630"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2630"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:2630: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:2630"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2630"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:2630" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:2630: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:2630"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2630"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:2630: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:2630"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2630"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:2630" "while kill -0 \$TMPPID 2>/dev/null"



ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_34
#AT_START_35
at_fn_group_banner 35 'ovn.at:2635' \
  "ovn -- 3 HVs, 1 VIFs/HV, 1 software GW, 1 LS" "   " 2
at_xfail=no
(
  $as_echo "35. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

# Configure the Northbound database
ovn-nbctl ls-add lsw0

ovn-nbctl lsp-add lsw0 lp1
ovn-nbctl lsp-set-addresses lp1 f0:00:00:00:00:01

ovn-nbctl lsp-add lsw0 lp2
ovn-nbctl lsp-set-addresses lp2 f0:00:00:00:00:02

ovn-nbctl lsp-add lsw0 lp-gw
ovn-nbctl lsp-set-type lp-gw l2gateway
ovn-nbctl lsp-set-options lp-gw network_name=physnet1 l2gateway-chassis=hv_gw
ovn-nbctl lsp-set-addresses lp-gw unknown

net_add n1               # Network to connect hv1, hv2, and gw
net_add n2               # Network to connect gw and hv3

# Create hypervisor hv1 connected to n1
sim_add hv1
as hv1
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.1
ovs-vsctl add-port br-int vif1 -- set Interface vif1 external-ids:iface-id=lp1 options:tx_pcap=hv1/vif1-tx.pcap options:rxq_pcap=hv1/vif1-rx.pcap ofport-request=1

# Create hypervisor hv2 connected to n1
sim_add hv2
as hv2
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.2
ovs-vsctl add-port br-int vif2 -- set Interface vif2 external-ids:iface-id=lp2 options:tx_pcap=hv2/vif2-tx.pcap options:rxq_pcap=hv2/vif2-rx.pcap ofport-request=1

# Create hypervisor hv_gw connected to n1 and n2
# connect br-phys bridge to n1; connect hv-gw bridge to n2
sim_add hv_gw
as hv_gw
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.3
ovs-vsctl add-br br-phys2
net_attach n2 br-phys2
ovs-vsctl set open . external_ids:ovn-bridge-mappings="physnet1:br-phys2"

# Add hv3 on the other side of the GW
sim_add hv3
as hv3
ovs-vsctl add-br br-phys
net_attach n2 br-phys
ovs-vsctl add-port br-phys vif3 -- set Interface vif3 options:tx_pcap=hv3/vif3-tx.pcap options:rxq_pcap=hv3/vif3-rx.pcap ofport-request=1


# Pre-populate the hypervisors' ARP tables so that we don't lose any
# packets for ARP resolution (native tunneling doesn't queue packets
# for ARP resolution).
{ set +x
$as_echo "$at_srcdir/ovn.at:2690: ovn_populate_arp__"
at_fn_check_prepare_trace "ovn.at:2690"
( $at_check_trace; ovn_populate_arp__
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2690"
$at_failed && at_fn_log_failure
$at_traceon; }


# Allow some time for ovn-northd and ovn-controller to catch up.
# XXX This should be more systematic.
sleep 1

# test_packet INPORT DST SRC ETHTYPE OUTPORT...
#
# This shell function causes a packet to be received on INPORT.  The packet's
# content has Ethernet destination DST and source SRC (each exactly 12 hex
# digits) and Ethernet type ETHTYPE (4 hex digits).  The OUTPORTs (zero or
# more) list the VIFs on which the packet should be received.  INPORT and the
# OUTPORTs are specified as lport numbers, e.g. 1 for vif1.
for i in 1 2 3; do
    : > $i.expected
done
test_packet() {
    local inport=$1 packet=$2$3$4; shift; shift; shift; shift
    #hv=hv`echo $inport | sed 's/^\(.\).*/\1/'`
    hv=hv$inport
    vif=vif$inport
    as $hv ovs-appctl netdev-dummy/receive $vif $packet
    for outport; do
        echo $packet >> $outport.expected
    done
}

# Send packets between all pairs of source and destination ports:
#
# 1. Unicast packets are delivered to exactly one lport (except that packets
#    destined to their input ports are dropped).
#
# 2. Broadcast and multicast are delivered to all lports except the input port.
#
# 3. The lswitch delivers packets with an unknown destination to lports with
#    "unknown" among their MAC addresses (and port security disabled).
for s in 1 2 3 ; do
    bcast=
    unknown=
    for d in 1 2 3 ; do
        if test $d != $s; then unicast=$d; else unicast=; fi
        test_packet $s f0000000000$d f0000000000$s 00$s$d $unicast       #1

        # The vtep (vif3) is the only one configured for "unknown"
        if test $d != $s && test $d = 3; then
            unknown="$unknown $d"
        fi
        bcast="$bcast $unicast"
    done

    test_packet $s ffffffffffff f0000000000$s 0${s}ff $bcast             #2
    test_packet $s 010000000000 f0000000000$s 0${s}ff $bcast             #3
    test_packet $s f0000000ffff f0000000000$s 0${s}66 $unknown           #4
done

echo "------ ovn-nbctl show ------"
ovn-nbctl show
echo "------ ovn-sbctl show ------"
ovn-sbctl show

echo "------ hv1 ------"
as hv1 ovs-vsctl show
echo "------ hv1 br-int ------"
as hv1 ovs-ofctl -O OpenFlow13 dump-flows br-int
echo "------ hv1 br-phys ------"
as hv1 ovs-ofctl -O OpenFlow13 dump-flows br-phys

echo "------ hv2 ------"
as hv2 ovs-vsctl show
echo "------ hv2 br-int ------"
as hv2 ovs-ofctl -O OpenFlow13 dump-flows br-int
echo "------ hv2 br-phys ------"
as hv2 ovs-ofctl -O OpenFlow13 dump-flows br-phys

echo "------ hv_gw ------"
as hv_gw ovs-vsctl show
echo "------ hv_gw br-phys ------"
as hv_gw ovs-ofctl -O OpenFlow13 dump-flows br-phys
echo "------ hv_gw br-phys2 ------"
as hv_gw ovs-ofctl -O OpenFlow13 dump-flows br-phys2

echo "------ hv3 ------"
as hv3 ovs-vsctl show
echo "------ hv3 br-phys ------"
as hv3 ovs-ofctl -O OpenFlow13 dump-flows br-phys

# Now check the packets actually received against the ones expected.
for i in 1 2 3; do
    ovn_check_packets__ "hv$i/vif$i-tx.pcap" "$i.expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:2778: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:2778"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2778"
$at_failed && at_fn_log_failure
$at_traceon; }

done
ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_35
#AT_START_36
at_fn_group_banner 36 'ovn.at:2783' \
  "ovn -- 3 HVs, 3 LS, 3 lports/LS, 1 LR" "          " 2
at_xfail=no
(
  $as_echo "36. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

# Logical network:
#
# Three logical switches ls1, ls2, ls3.
# One logical router lr0 connected to ls[123],
# with nine subnets, three per logical switch:
#
#    lrp11 on ls1 for subnet 192.168.11.0/24
#    lrp12 on ls1 for subnet 192.168.12.0/24
#    lrp13 on ls1 for subnet 192.168.13.0/24
#    ...
#    lrp33 on ls3 for subnet 192.168.33.0/24
#
# 27 VIFs, 9 per LS, 3 per subnet: lp[123][123][123], where the first two
# digits are the subnet and the last digit distinguishes the VIF.
for i in 1 2 3; do
    ovn-nbctl ls-add ls$i
    for j in 1 2 3; do
        for k in 1 2 3; do
            # Add "unknown" to MAC addresses for lp?11, so packets for
            # MAC-IP bindings discovered via ARP later have somewhere to go.
            if test $j$k = 11; then unknown=unknown; else unknown=; fi

            ovn-nbctl \
                -- lsp-add ls$i lp$i$j$k \
                -- lsp-set-addresses lp$i$j$k \
                   "f0:00:00:00:0$i:$j$k 192.168.$i$j.$k" $unknown
        done
    done
done

ovn-nbctl lr-add lr0
for i in 1 2 3; do
    for j in 1 2 3; do
        ovn-nbctl lrp-add lr0 lrp$i$j 00:00:00:00:ff:$i$j 192.168.$i$j.254/24
        ovn-nbctl \
            -- lsp-add ls$i lrp$i$j-attachment \
            -- set Logical_Switch_Port lrp$i$j-attachment type=router \
                             options:router-port=lrp$i$j \
                             addresses='"00:00:00:00:ff:'$i$j'"'
    done
done

ovn-nbctl set Logical_Switch_Port lrp33-attachment \
    addresses='"00:00:00:00:ff:33 192.168.33.254"'

# Physical network:
#
# Three hypervisors hv[123].
# lp?1[123] spread across hv[123]: lp?11 on hv1, lp?12 on hv2, lp?13 on hv3.
# lp?2[123] spread across hv[23]: lp?21 and lp?22 on hv2, lp?23 on hv3.
# lp?3[123] all on hv3.


# Given the name of a logical port, prints the name of the hypervisor
# on which it is located.
vif_to_hv() {
    case $1 in         ?11) echo 1 ;;         ?12 | ?21 | ?22) echo 2 ;;         ?13 | ?23 | ?3?) echo 3 ;;
    esac
}

# Given the name of a logical port, prints the name of its logical router
# port, e.g. "vif_to_lrp 123" yields 12.
vif_to_lrp() {
    echo ${1%?}
}

# Given the name of a logical port, prints the name of its logical
# switch, e.g. "vif_to_ls 123" yields 1.
vif_to_ls() {
    echo ${1%??}
}

net_add n1
for i in 1 2 3; do
    sim_add hv$i
    as hv$i
    ovs-vsctl add-br br-phys
    ovn_attach n1 br-phys 192.168.0.$i
done
for i in 1 2 3; do
    for j in 1 2 3; do
        for k in 1 2 3; do
            hv=`vif_to_hv $i$j$k`
                as hv$hv ovs-vsctl \
                -- add-port br-int vif$i$j$k \
                -- set Interface vif$i$j$k \
                    external-ids:iface-id=lp$i$j$k \
                    options:tx_pcap=hv$hv/vif$i$j$k-tx.pcap \
                    options:rxq_pcap=hv$hv/vif$i$j$k-rx.pcap \
                    ofport-request=$i$j$k
        done
    done
done

# Pre-populate the hypervisors' ARP tables so that we don't lose any
# packets for ARP resolution (native tunneling doesn't queue packets
# for ARP resolution).
{ set +x
$as_echo "$at_srcdir/ovn.at:2886: ovn_populate_arp__"
at_fn_check_prepare_trace "ovn.at:2886"
( $at_check_trace; ovn_populate_arp__
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:2886"
$at_failed && at_fn_log_failure
$at_traceon; }


# Allow some time for ovn-northd and ovn-controller to catch up.
# XXX This should be more systematic.
sleep 1

# test_ip INPORT SRC_MAC DST_MAC SRC_IP DST_IP OUTPORT...
#
# This shell function causes a packet to be received on INPORT.  The packet's
# content has Ethernet destination DST and source SRC (each exactly 12 hex
# digits) and Ethernet type ETHTYPE (4 hex digits).  The OUTPORTs (zero or
# more) list the VIFs on which the packet should be received.  INPORT and the
# OUTPORTs are specified as logical switch port numbers, e.g. 123 for vif123.
for i in 1 2 3; do
    for j in 1 2 3; do
        for k in 1 2 3; do
            : > $i$j$k.expected
        done
    done
done
test_ip() {
    # This packet has bad checksums but logical L3 routing doesn't check.
    local inport=$1 src_mac=$2 dst_mac=$3 src_ip=$4 dst_ip=$5
    local packet=${dst_mac}${src_mac}08004500001c0000000040110000${src_ip}${dst_ip}0035111100080000
    shift; shift; shift; shift; shift
    hv=hv`vif_to_hv $inport`
    as $hv ovs-appctl netdev-dummy/receive vif$inport $packet
    #as $hv ovs-appctl ofproto/trace br-int in_port=$inport $packet
    in_ls=`vif_to_ls $inport`
    in_lrp=`vif_to_lrp $inport`
    for outport; do
        out_ls=`vif_to_ls $outport`
        if test $in_ls = $out_ls; then
            # Ports on the same logical switch receive exactly the same packet.
            echo $packet
        else
            # Routing decrements TTL and updates source and dest MAC
            # (and checksum).
            out_lrp=`vif_to_lrp $outport`
            echo f00000000${outport}00000000ff${out_lrp}08004500001c00000000"3f1101"00${src_ip}${dst_ip}0035111100080000
        fi >> $outport.expected
    done
}

# test_arp INPORT SHA SPA TPA FLOOD [REPLY_HA]
#
# Causes a packet to be received on INPORT.  The packet is an ARP
# request with SHA, SPA, and TPA as specified.  If REPLY_HA is provided, then
# it should be the hardware address of the target to expect to receive in an
# ARP reply; otherwise no reply is expected.
#
# INPORT is an logical switch port number, e.g. 11 for vif11.
# SHA and REPLY_HA are each 12 hex digits.
# SPA and TPA are each 8 hex digits.
test_arp() {
    local inport=$1 sha=$2 spa=$3 tpa=$4 flood=$5 reply_ha=$6
    local request=ffffffffffff${sha}08060001080006040001${sha}${spa}ffffffffffff${tpa}
    hv=hv`vif_to_hv $inport`
    as $hv ovs-appctl netdev-dummy/receive vif$inport $request
    as $hv ovs-appctl ofproto/trace br-int in_port=$inport $request

    # Expect to receive the broadcast ARP on the other logical switch ports if
    # IP address is not configured on the switch patch port or on the router
    # port (i.e, $flood == 1).
    local i=`vif_to_ls $inport`
    local j k
    for j in 1 2 3; do
        for k in 1 2 3; do
            # Skip ingress port.
            if test $i$j$k == $inport; then
                continue
            fi

            if test X$flood == X1; then
                echo $request >> $i$j$k.expected
            fi
        done
    done

    # Expect to receive the reply, if any.
    if test X$reply_ha != X; then
        lrp=`vif_to_lrp $inport`
        local reply=${sha}00000000ff${lrp}08060001080006040002${reply_ha}${tpa}${sha}${spa}
        echo $reply >> $inport.expected
    fi
}

as hv1 ovs-vsctl --columns=name,ofport list interface
as hv1 ovn-sbctl list port_binding
as hv1 ovn-sbctl list datapath_binding
as hv1 ovn-sbctl dump-flows
as hv1 ovs-ofctl dump-flows br-int

# Send IP packets between all pairs of source and destination ports:
#
# 1. Unicast IP packets are delivered to exactly one logical switch port
#    (except that packets destined to their input ports are dropped).
#
# 2. Broadcast IP packets are delivered to all logical switch ports
#    except the input port.
ip_to_hex() {
    printf "%02x%02x%02x%02x" "$@"
}
for is in 1 2 3; do
  for js in 1 2 3; do
    for ks in 1 2 3; do
      bcast=
      s=$is$js$ks
      smac=f00000000$s
      sip=`ip_to_hex 192 168 $is$js $ks`
      for id in 1 2 3; do
          for jd in 1 2 3; do
              for kd in 1 2 3; do
                d=$id$jd$kd
                dip=`ip_to_hex 192 168 $id$jd $kd`
                if test $is = $id; then dmac=f00000000$d; else dmac=00000000ff$is$js; fi
                if test $d != $s; then unicast=$d; else unicast=; fi

                test_ip $s $smac $dmac $sip $dip $unicast #1

                if test $id = $is && test $d != $s; then bcast="$bcast $d"; fi
              done
          done
        done
      test_ip $s $smac ffffffffffff $sip ffffffff $bcast #2
      done
  done
done

: > mac_bindings.expected

# 3. Send an IP packet from every logical port to every other subnet,
#    to an IP address that does not have a static IP-MAC binding.
#    This should generate a broadcast ARP request for the destination
#    IP address in the destination subnet.
#    Moreover generate an ARP reply for each of the IP addresses ARPed
for is in 1 2 3; do
  for js in 1 2 3; do
    for ks in 1 2 3; do
      s=$is$js$ks
      smac=f00000000$s
      sip=`ip_to_hex 192 168 $is$js $ks`
      for id in 1 2 3; do
        for jd in 1 2 3; do
          if test $is$js = $id$jd; then
            continue
          fi

          # Send the packet.
          dmac=00000000ff$is$js
          # Calculate a 4th octet for the destination that is
          # unique per $s, avoids the .1 .2 .3 and .254 IP addresses
          # that have static MAC bindings, and fits in the range
          # 0-255.
          o4=`expr $is '*' 9 + $js '*' 3 + $ks + 10`
          dip=`ip_to_hex 192 168 $id$jd $o4`
          test_ip $s $smac $dmac $sip $dip

          # Every LP on the destination subnet's lswitch should
          # receive the ARP request.
          lrmac=00000000ff$id$jd
          lrip=`ip_to_hex 192 168 $id$jd 254`
          arp=ffffffffffff${lrmac}08060001080006040001${lrmac}${lrip}000000000000${dip}
          for jd2 in 1 2 3; do
            for kd in 1 2 3; do
              echo $arp >> $id$jd2$kd.expected
            done
          done

          hmac=8000000000$o4
          rmac=00000000ff$id$jd
          echo ${hmac}${rmac}08004500001c00000000"3f1101"00${sip}${dip}0035111100080000 >> ${id}11.expected

          host_mac=8000000000$o4
          lrmac=00000000ff$id$jd

          arp_reply=${lrmac}${host_mac}08060001080006040002${host_mac}${dip}${lrmac}${lrip}

          hv=hv`vif_to_hv ${id}${jd}1`
          as $hv ovs-appctl netdev-dummy/receive vif${id}${jd}1 $arp_reply

          host_ip_pretty=192.168.$id$jd.$o4
          host_mac_pretty=80:00:00:00:00:$o4
          echo lrp$id$jd,$host_ip_pretty,$host_mac_pretty >> mac_bindings.expected
        done
      done
    done
  done
done

# Test router replies to ARP requests from all source ports:
#
# 4. Router replies to query for its MAC address from port's own IP address.
#
# 5. Router replies to query for its MAC address from any random IP address
#    in its subnet.
#
# 6. No reply to query for IP address other than router IP.
#
# 7. No reply to query from another subnet.
for i in 1 2 3; do
  for j in 1 2 3; do
    for k in 1 2 3; do
      smac=f00000000$i$j$k               # Source MAC
      sip=`ip_to_hex 192 168 $i$j $k`    # Source IP
      rip=`ip_to_hex 192 168 $i$j 254`   # Router IP
      rmac=00000000ff$i$j                # Router MAC
      otherip=`ip_to_hex 192 168 $i$j 55` # Some other IP in subnet
      externalip=`ip_to_hex 1 2 3 4`      # Some other IP not in subnet

      test_arp $i$j$k $smac $sip        $rip       0     $rmac       #4
      test_arp $i$j$k $smac $otherip    $rip       0     $rmac       #5
      test_arp $i$j$k $smac $sip        $otherip   1                 #6

      # When rip is 192.168.33.254, ARP request from externalip won't be
      # filtered, because 192.168.33.254 is configured to switch peer port
      # for lrp33.
      lrp33_rsp=
      if test $i = 3 && test $j = 3; then
        lrp33_rsp=$rmac
      fi
      test_arp $i$j$k $smac $externalip $rip       0      $lrp33_rsp #7

      # MAC binding should be learned from ARP request.
      host_mac_pretty=f0:00:00:00:0$i:$j$k

      host_ip_pretty=192.168.$i$j.$k
      echo lrp$i$j,$host_ip_pretty,$host_mac_pretty >> mac_bindings.expected

      # mac_binding is learned and overwritten so only the last one remains.
      if test $k = 3; then
          # lrp33 will not learn from ARP request, because 192.168.33.254 is
          # configured to switch peer port for lrp33.
          if test $i != 3 || test $j != 3; then
              host_ip_pretty=192.168.$i$j.55
              echo lrp$i$j,$host_ip_pretty,$host_mac_pretty >> mac_bindings.expected
          fi
      fi

    done
  done
done


# Allow some time for packet forwarding.
# XXX This can be improved.
sleep 1

# 8. Send an IP packet from every logical port to every other subnet.  These
#    are the same packets already sent as #3, but now the destinations' IP-MAC
#    bindings have been discovered via ARP, so instead of provoking an ARP
#    request, these packets now get routed to their destinations (which don't
#    have static MAC bindings, so they go to the port we've designated as
#    accepting "unknown" MACs.)
for is in 1 2 3; do
  for js in 1 2 3; do
    for ks in 1 2 3; do
      s=$is$js$ks
      smac=f00000000$s
      sip=`ip_to_hex 192 168 $is$js $ks`
      for id in 1 2 3; do
        for jd in 1 2 3; do
          if test $is$js = $id$jd; then
            continue
          fi

          # Send the packet.
          dmac=00000000ff$is$js
          # Calculate a 4th octet for the destination that is
          # unique per $s, avoids the .1 .2 .3 and .254 IP addresses
          # that have static MAC bindings, and fits in the range
          # 0-255.
          o4=`expr $is '*' 9 + $js '*' 3 + $ks + 10`
          dip=`ip_to_hex 192 168 $id$jd $o4`
          test_ip $s $smac $dmac $sip $dip

          # Expect the packet egress.
          host_mac=8000000000$o4
          outport=${id}11
          out_lrp=$id$jd
          echo ${host_mac}00000000ff${out_lrp}08004500001c00000000"3f1101"00${sip}${dip}0035111100080000 >> $outport.expected
        done
      done
    done
  done
done

ovn-sbctl -f csv -d bare --no-heading \
    -- --columns=logical_port,ip,mac list mac_binding > mac_bindings

# Now check the packets actually received against the ones expected.
for i in 1 2 3; do
    for j in 1 2 3; do
        for k in 1 2 3; do
            ovn_check_packets__ "hv`vif_to_hv $i$j$k`/vif$i$j$k-tx.pcap" "$i$j$k.expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:3180: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:3180"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3180"
$at_failed && at_fn_log_failure
$at_traceon; }

        done
    done
done

# Check the MAC bindings against those expected.
{ set +x
$as_echo "$at_srcdir/ovn.at:3187: sort < mac_bindings"
at_fn_check_prepare_trace "ovn.at:3187"
( $at_check_trace; sort < mac_bindings
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "`sort < mac_bindings.expected`
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3187"
$at_failed && at_fn_log_failure
$at_traceon; }


# Gracefully terminate daemons



    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:3191: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:3191"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3191"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3191: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:3191"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3191"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3191" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:3191: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:3191"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3191"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3191: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:3191"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3191"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3191" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:3191: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:3191"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3191"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3191: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:3191"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3191"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3191" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:3191: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:3191"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3191"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3191: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:3191"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3191"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3191" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:3191: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:3191"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3191"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3191: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:3191"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3191"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3191" "while kill -0 \$TMPPID 2>/dev/null"





    as hv2
    if test "hv2" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:3191: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:3191"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3191"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3191: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:3191"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3191"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3191" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:3191: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:3191"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3191"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3191: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:3191"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3191"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3191" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:3191: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:3191"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3191"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3191: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:3191"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3191"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3191" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv2
    { set +x
$as_echo "$at_srcdir/ovn.at:3191: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:3191"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3191"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3191: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:3191"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3191"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3191" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:3191: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:3191"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3191"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3191: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:3191"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3191"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3191" "while kill -0 \$TMPPID 2>/dev/null"





    as hv3
    if test "hv3" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:3191: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:3191"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3191"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3191: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:3191"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3191"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3191" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:3191: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:3191"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3191"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3191: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:3191"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3191"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3191" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:3191: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:3191"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3191"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3191: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:3191"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3191"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3191" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv3
    { set +x
$as_echo "$at_srcdir/ovn.at:3191: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:3191"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3191"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3191: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:3191"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3191"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3191" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:3191: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:3191"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3191"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3191: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:3191"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3191"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3191" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:3191: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:3191"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3191"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3191: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:3191"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3191"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3191" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:3191: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:3191"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3191"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3191: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:3191"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3191"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3191" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:3191: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:3191"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3191"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3191: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:3191"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3191"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3191" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:3191: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:3191"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3191"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3191: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:3191"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3191"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3191" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:3191: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:3191"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3191"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3191: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:3191"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3191"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3191" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:3191: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:3191"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3191"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3191: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:3191"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3191"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3191" "while kill -0 \$TMPPID 2>/dev/null"




ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_36
#AT_START_37
at_fn_group_banner 37 'ovn.at:3195' \
  "ovn -- IP relocation using GARP request" "        " 2
at_xfail=no
(
  $as_echo "37. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

# Logical network:
#
# Two logical switches ls1, ls2.
# One logical router lr0 connected to ls[12],
# with 2 subnets, 1 per logical switch:
#
#    lrp1 on ls1 for subnet 192.168.1.1/24
#    lrp2 on ls2 for subnet 192.168.2.1/24
#
# 4 VIFs, 2 per LS lp[12][12], first digit being LS.
# VIFs' fixed IP addresses are 192.168.[12].1[12].
#
# There is a secondary IP 192.168.1.100 that is unknown in NB and learned
# through ARP only, and it can move between lp11 and lp12.
#
ovn-nbctl lr-add lr0
for i in 1 2 ; do
    ovn-nbctl ls-add ls$i
    ovn-nbctl lrp-add lr0 lrp$i 00:00:00:00:ff:0$i 192.168.$i.1/24
    ovn-nbctl \
        -- lsp-add ls$i lrp$i-attachment \
        -- set Logical_Switch_Port lrp$i-attachment type=router \
                         options:router-port=lrp$i \
                         addresses=router
    for j in 1 2; do
        ovn-nbctl \
            -- lsp-add ls$i lp$i$j \
            -- lsp-set-addresses lp$i$j \
               "f0:00:00:00:00:$i$j 192.168.$i.1$j"
    done
done

# Physical network:
# 2 hypervisors hv[12], lp?1 on hv1, lp?2 on hv2.

# Given the name of a logical port, prints the name of the hypervisor
# on which it is located, e.g. "vif_to_hv 12" yields 2.
vif_to_hv() {
    echo ${1#?}
}

# Given the name of a logical port, prints the name of its logical router
# port, e.g. "vif_to_lrp 12" yields 1.
vif_to_lrp() {
    echo ${1%?}
}

# Given the name of a logical port, prints the name of its logical
# switch, e.g. "vif_to_ls 12" yields 1.
vif_to_ls() {
    echo ${1%?}
}

net_add n1
for i in 1 2; do
    sim_add hv$i
    as hv$i
    ovs-vsctl add-br br-phys
    ovn_attach n1 br-phys 192.168.0.$i
done
for i in 1 2; do
    for j in 1 2; do
        hv=`vif_to_hv $i$j`
            as hv$hv ovs-vsctl \
                -- add-port br-int vif$i$j \
                -- set Interface vif$i$j \
                    external-ids:iface-id=lp$i$j \
                    options:tx_pcap=hv$hv/vif$i$j-tx.pcap \
                    options:rxq_pcap=hv$hv/vif$i$j-rx.pcap \
                    ofport-request=$i$j
    done
done

# Pre-populate the hypervisors' ARP tables so that we don't lose any
# packets for ARP resolution (native tunneling doesn't queue packets
# for ARP resolution).
{ set +x
$as_echo "$at_srcdir/ovn.at:3274: ovn_populate_arp__"
at_fn_check_prepare_trace "ovn.at:3274"
( $at_check_trace; ovn_populate_arp__
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3274"
$at_failed && at_fn_log_failure
$at_traceon; }


# Allow some time for ovn-northd and ovn-controller to catch up.
# XXX This should be more systematic.
sleep 1

# test_ip INPORT SRC_MAC DST_MAC SRC_IP DST_IP OUTPORT...
#
# This shell function causes a packet to be received on INPORT.  The packet's
# content has Ethernet destination DST and source SRC (each exactly 12 hex
# digits) and Ethernet type ETHTYPE (4 hex digits).  The OUTPORTs (zero or
# more) list the VIFs on which the packet should be received.  INPORT and the
# OUTPORTs are specified as logical switch port numbers, e.g. 12 for vif12.
for i in 1 2; do
    for j in 1 2; do
        : > $i$j.expected
    done
done
test_ip() {
    # This packet has bad checksums but logical L3 routing doesn't check.
    local inport=$1 src_mac=$2 dst_mac=$3 src_ip=$4 dst_ip=$5
    local packet=${dst_mac}${src_mac}08004500001c0000000040110000${src_ip}${dst_ip}0035111100080000
    shift; shift; shift; shift; shift
    hv=hv`vif_to_hv $inport`
    as $hv ovs-appctl netdev-dummy/receive vif$inport $packet
    in_ls=`vif_to_ls $inport`
    in_lrp=`vif_to_lrp $inport`
    for outport; do
        out_ls=`vif_to_ls $outport`
        if test $in_ls = $out_ls; then
            # Ports on the same logical switch receive exactly the same packet.
            echo $packet
        else
            # Routing decrements TTL and updates source and dest MAC
            # (and checksum).
            out_lrp=`vif_to_lrp $outport`
            echo f000000000${outport}00000000ff0${out_lrp}08004500001c00000000"3f1101"00${src_ip}${dst_ip}0035111100080000
        fi >> $outport.expected
    done
}

# test_arp INPORT SHA SPA TPA [REPLY_HA]
#
# Causes a packet to be received on INPORT.  The packet is an ARP
# request with SHA, SPA, and TPA as specified.  If REPLY_HA is provided, then
# it should be the hardware address of the target to expect to receive in an
# ARP reply; otherwise no reply is expected.
#
# INPORT is an logical switch port number, e.g. 11 for vif11.
# SHA and REPLY_HA are each 12 hex digits.
# SPA and TPA are each 8 hex digits.
test_arp() {
    local inport=$1 sha=$2 spa=$3 tpa=$4 reply_ha=$5
    local request=ffffffffffff${sha}08060001080006040001${sha}${spa}ffffffffffff${tpa}
    hv=hv`vif_to_hv $inport`
    as $hv ovs-appctl netdev-dummy/receive vif$inport $request

    # Expect to receive the broadcast ARP on the other logical switch ports if
    # IP address is not configured to the switch patch port.
    local i=`vif_to_ls $inport`
    local j
    for j in 1 2; do
        if test $i$j != $inport; then
            echo $request >> $i$j$k.expected
        fi
    done

    # Expect to receive the reply, if any.
    if test X$reply_ha != X; then
        lrp=`vif_to_lrp $inport`
        local reply=${sha}00000000ff0${lrp}08060001080006040002${reply_ha}${tpa}${sha}${spa}
        echo $reply >> $inport.expected
    fi
}

ip_to_hex() {
    printf "%02x%02x%02x%02x" "$@"
}

# lp11 send GARP request to announce ownership of 192.168.1.100.

sha=f00000000011
spa=`ip_to_hex 192 168 1 100`
tpa=$spa
test_arp 11 $sha $spa $tpa
ovs_wait_cond () {
    test `ovn-sbctl find mac_binding ip="192.168.1.100" | wc -l` -gt 0
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3359" "until test \`ovn-sbctl find mac_binding ip=\"192.168.1.100\" | wc -l\` -gt 0"

ovn-nbctl --wait=hv sync

# Send an IP packet from lp21 to 192.168.1.100, which should go to lp11.

smac=f00000000021
dmac=00000000ff02
sip=`ip_to_hex 192 168 2 11`
dip=`ip_to_hex 192 168 1 100`
test_ip 21 $smac $dmac $sip $dip 11

# lp12 send GARP request to announce ownership of 192.168.1.100.

sha=f00000000012
test_arp 12 $sha $spa $tpa
ovs_wait_cond () {
    ovn-sbctl find mac_binding ip="192.168.1.100" | grep f0:00:00:00:00:12
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3374" "until ovn-sbctl find mac_binding ip=\"192.168.1.100\" | grep f0:00:00:00:00:12"

ovn-nbctl --wait=hv sync
# give to the hv the time to send queued ip packets
sleep 1

# Send an IP packet from lp21 to 192.168.1.100, which should go to lp12.

test_ip 21 $smac $dmac $sip $dip 12

# Now check the packets actually received against the ones expected.
for i in 1 2; do
    for j in 1 2; do
        ovn_check_packets__ "hv`vif_to_hv $i$j`/vif$i$j-tx.pcap" "$i$j.expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:3386: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:3386"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3386"
$at_failed && at_fn_log_failure
$at_traceon; }

    done
done

# Gracefully terminate daemons



    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:3392: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:3392"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3392"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3392: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:3392"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3392"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3392" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:3392: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:3392"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3392"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3392: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:3392"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3392"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3392" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:3392: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:3392"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3392"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3392: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:3392"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3392"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3392" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:3392: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:3392"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3392"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3392: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:3392"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3392"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3392" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:3392: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:3392"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3392"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3392: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:3392"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3392"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3392" "while kill -0 \$TMPPID 2>/dev/null"





    as hv2
    if test "hv2" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:3392: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:3392"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3392"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3392: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:3392"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3392"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3392" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:3392: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:3392"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3392"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3392: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:3392"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3392"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3392" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:3392: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:3392"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3392"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3392: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:3392"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3392"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3392" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv2
    { set +x
$as_echo "$at_srcdir/ovn.at:3392: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:3392"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3392"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3392: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:3392"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3392"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3392" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:3392: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:3392"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3392"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3392: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:3392"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3392"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3392" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:3392: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:3392"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3392"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3392: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:3392"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3392"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3392" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:3392: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:3392"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3392"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3392: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:3392"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3392"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3392" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:3392: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:3392"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3392"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3392: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:3392"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3392"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3392" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:3392: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:3392"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3392"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3392: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:3392"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3392"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3392" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:3392: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:3392"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3392"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3392: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:3392"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3392"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3392" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:3392: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:3392"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3392"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3392: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:3392"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3392"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3392" "while kill -0 \$TMPPID 2>/dev/null"




ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_37
#AT_START_38
at_fn_group_banner 38 'ovn.at:3397' \
  "ovn -- portsecurity : 3 HVs, 1 LS, 3 lports/HV" " " 2
at_xfail=no
(
  $as_echo "38. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

# Create hypervisors hv[123].
# Add vif1[123] to hv1, vif2[123] to hv2, vif3[123] to hv3.
# Add all of the vifs to a single logical switch lsw0.
# Turn off port security on vifs vif[123]1
# Turn on l2 port security on vifs vif[123]2
# Turn of l2 and l3 port security on vifs vif[123]3
# Make vif13, vif2[23], vif3[123] destinations for unknown MACs.
ovn-nbctl ls-add lsw0
net_add n1
for i in 1 2 3; do
    sim_add hv$i
    as hv$i
    ovs-vsctl add-br br-phys
    ovn_attach n1 br-phys 192.168.0.$i

    for j in 1 2 3; do
        ovs-vsctl add-port br-int vif$i$j -- set Interface vif$i$j external-ids:iface-id=lp$i$j options:tx_pcap=hv$i/vif$i$j-tx.pcap options:rxq_pcap=hv$i/vif$i$j-rx.pcap ofport-request=$i$j
        ovn-nbctl lsp-add lsw0 lp$i$j
        if test $j = 1; then
            ovn-nbctl lsp-set-addresses lp$i$j "f0:00:00:00:00:$i$j 192.168.0.$i$j" unknown
        elif test $j = 2; then
            ovn-nbctl lsp-set-addresses lp$i$j "f0:00:00:00:00:$i$j 192.168.0.$i$j"
            ovn-nbctl lsp-set-port-security lp$i$j f0:00:00:00:00:$i$j
        else
            extra_addr="f0:00:00:00:0$i:$i$j fe80::ea2a:eaff:fe28:$i$j"
            ovn-nbctl lsp-set-addresses lp$i$j "f0:00:00:00:00:$i$j 192.168.0.$i$j" "$extra_addr"
            ovn-nbctl lsp-set-port-security lp$i$j "f0:00:00:00:00:$i$j 192.168.0.$i$j" "$extra_addr"
        fi
    done
done

# Pre-populate the hypervisors' ARP tables so that we don't lose any
# packets for ARP resolution (native tunneling doesn't queue packets
# for ARP resolution).
{ set +x
$as_echo "$at_srcdir/ovn.at:3434: ovn_populate_arp__"
at_fn_check_prepare_trace "ovn.at:3434"
( $at_check_trace; ovn_populate_arp__
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3434"
$at_failed && at_fn_log_failure
$at_traceon; }


# Allow some time for ovn-northd and ovn-controller to catch up.
# XXX This should be more systematic.
sleep 1

# Given the name of a logical port, prints the name of the hypervisor
# on which it is located.
vif_to_hv() {
    echo hv${1%?}
}

for i in 1 2 3; do
    for j in 1 2 3; do
        : > $i$j.expected
    done
done

# test_ip INPORT SRC_MAC DST_MAC SRC_IP DST_IP OUTPORT...
#
# This shell function causes an ip packet to be received on INPORT.
# The packet's content has Ethernet destination DST and source SRC
# (each exactly 12 hex digits) and Ethernet type ETHTYPE (4 hex digits).
# The OUTPORTs (zero or more) list the VIFs on which the packet should
# be received.  INPORT and the OUTPORTs are specified as logical switch
# port numbers, e.g. 11 for vif11.
test_ip() {
    # This packet has bad checksums but logical L3 routing doesn't check.
    local inport=$1 src_mac=$2 dst_mac=$3 src_ip=$4 dst_ip=$5
    local packet=${dst_mac}${src_mac}08004500001c0000000040110000${src_ip}${dst_ip}0035111100080000
    shift; shift; shift; shift; shift
    hv=`vif_to_hv $inport`
    as $hv ovs-appctl netdev-dummy/receive vif$inport $packet
    #as $hv ovs-appctl ofproto/trace br-int in_port=$inport $packet
    for outport; do
        echo $packet >> $outport.expected
    done
}

# test_arp INPORT SHA SPA TPA DROP [REPLY_HA]
#
# Causes a packet to be received on INPORT.  The packet is an ARP
# request with SHA, SPA, and TPA as specified.  If REPLY_HA is provided, then
# it should be the hardware address of the target to expect to receive in an
# ARP reply; otherwise no reply is expected.
#
# INPORT is an logical switch port number, e.g. 11 for vif11.
# SHA and REPLY_HA are each 12 hex digits.
# SPA and TPA are each 8 hex digits.
test_arp() {
    local inport=$1 smac=$2 sha=$3 spa=$4 tpa=$5 drop=$6 reply_ha=$7
    local request=ffffffffffff${smac}08060001080006040001${sha}${spa}ffffffffffff${tpa}
    hv=`vif_to_hv $inport`
    as $hv ovs-appctl netdev-dummy/receive vif$inport $request
    #as $hv ovs-appctl ofproto/trace br-int in_port=$inport $request
    if test $drop != 1; then
        if test X$reply_ha = X; then
            # Expect to receive the broadcast ARP on the other logical switch ports
            # if no reply is expected.
            local i j
            for i in 1 2 3; do
                for j in 1 2 3; do
                    if test $i$j != $inport; then
                        echo $request >> $i$j.expected
                    fi
                done
            done
        else
            # Expect to receive the reply, if any.
            local reply=${smac}${reply_ha}08060001080006040002${reply_ha}${tpa}${sha}${spa}
            echo $reply >> $inport.expected
        fi
    fi
}

# test_ipv6 INPORT SRC_MAC DST_MAC SRC_IP DST_IP OUTPORT...
# This function is similar to test_ip() except that it sends
# ipv6 packet
test_ipv6() {
    local inport=$1 src_mac=$2 dst_mac=$3 src_ip=$4 dst_ip=$5
    local packet=${dst_mac}${src_mac}86dd6000000000083aff${src_ip}${dst_ip}0000000000000000
    shift; shift; shift; shift; shift
    hv=`vif_to_hv $inport`
    as $hv ovs-appctl netdev-dummy/receive vif$inport $packet
    #as $hv ovs-appctl ofproto/trace br-int in_port=$inport $packet
    for outport; do
        echo $packet >> $outport.expected
    done
}

# test_icmpv6 INPORT  SRC_MAC DST_MAC SRC_IP DST_IP ICMP_TYPE OUTPORT...
# This function is similar to test_ipv6() except it specifies the ICMPv6 type
# of the test packet
test_icmpv6() {
    local inport=$1 src_mac=$2 dst_mac=$3 src_ip=$4 dst_ip=$5 icmp_type=$6
    local packet=${dst_mac}${src_mac}86dd6000000000083aff${src_ip}${dst_ip}${icmp_type}00000000000000
    shift; shift; shift; shift; shift; shift
    hv=`vif_to_hv $inport`
    as $hv ovs-appctl netdev-dummy/receive vif$inport $packet
    #as $hv ovs-appctl ofproto/trace br-int in_port=$inport $packet
    for outport; do
        echo $packet >> $outport.expected
    done
}

ip_to_hex() {
    printf "%02x%02x%02x%02x" "$@"
}

# no port security
sip=`ip_to_hex 192 168 0 12`
tip=`ip_to_hex 192 168 0 13`
# the arp packet should be allowed even if lp[123]1 is
# not configured with mac f00000000023 and ip 192.168.0.12
for i in 1 2 3; do
    test_arp ${i}1 f00000000023 f00000000023 $sip $tip 0 f00000000013
    for j in 1 2 3; do
        if test $i != $j; then
            test_ip ${i}1 f000000000${i}1 f000000000${j}1 $sip $tip ${j}1
        fi
    done
done

# l2 port security
sip=`ip_to_hex 192 168 0 12`
tip=`ip_to_hex 192 168 0 13`

# arp packet should be allowed since lp22 is configured with
# mac f00000000022
test_arp 22 f00000000022 f00000000022 $sip $tip 0 f00000000013

# arp packet should not be allowed since lp32 is not configured with
# mac f00000000021
test_arp 32 f00000000021 f00000000021 $sip $tip 1

# arp packet with sha set to f00000000021 should not be allowed
# for lp12
test_arp 12 f00000000012 f00000000021 $sip $tip 1

# ip packets should be allowed and received since lp[123]2 do not
# have l3 port security
sip=`ip_to_hex 192 168 0 55`
tip=`ip_to_hex 192 168 0 66`
for i in 1 2 3; do
    for j in 1 2 3; do
        if test $i != $j; then
            test_ip ${i}2 f000000000${i}2 f000000000${j}2 $sip $tip ${j}2
        fi
    done
done

# ipv6 packets should be received by lp[123]2
# lp[123]1 can send ipv6 traffic as there is no port security
sip=fe800000000000000000000000000000
tip=ff020000000000000000000000000000

for i in 1 2 3; do
    test_ipv6 ${i}1 f000000000${i}1 f000000000${i}2 $sip $tip ${i}2
done


# l2 and l3 port security
sip=`ip_to_hex 192 168 0 13`
tip=`ip_to_hex 192 168 0 22`
# arp packet should be allowed since lp13 is configured with
# f00000000013 and 192.168.0.13
test_arp 13 f00000000013 f00000000013 $sip $tip 0 f00000000022

# the arp packet should be dropped because lp23 is not configured
# with mac f00000000022
sip=`ip_to_hex 192 168 0 13`
tip=`ip_to_hex 192 168 0 22`
test_arp 23 f00000000022 f00000000022 $sip $tip 1

# the arp packet should be dropped because lp33 is not configured
# with ip 192.168.0.55
spa=`ip_to_hex 192 168 0 55`
tpa=`ip_to_hex 192 168 0 22`
test_arp 33 f00000000031 f00000000031 $spa $tpa 1

# ip packets should not be received by lp[123]3 since
# l3 port security is enabled
sip=`ip_to_hex 192 168 0 55`
tip=`ip_to_hex 192 168 0 66`
for i in 1 2 3; do
    for j in 1 2 3; do
        test_ip ${i}2 f000000000${i}2 f000000000${j}3 $sip $tip
    done
done

# ipv6 packets should be dropped for lp[123]3 since
# it is configured with only ipv4 address
sip=fe800000000000000000000000000000
tip=ff020000000000000000000000000000

for i in 1 2 3; do
    test_ipv6 ${i}3 f000000000${i}3 f00000000022 $sip $tip
done

# ipv6 packets should not be received by lp[123]3 with mac f000000000$[123]3
# lp[123]1 can send ipv6 traffic as there is no port security
for i in 1 2 3; do
    test_ipv6 ${i}1 f000000000${i}1 f000000000${i}3 $sip $tip
done

# lp13 has extra port security with mac f0000000113 and ipv6 addr
# fe80::ea2a:eaff:fe28:0012

# ipv4 packet should be dropped for lp13 with mac f0000000113
sip=`ip_to_hex 192 168 0 13`
tip=`ip_to_hex 192 168 0 23`
test_ip 13 f00000000113 f00000000023 $sip $tip

# ipv6 packet should be received by lp[123]3 with mac f00000000${i}${i}3
# and ip6.dst as fe80::ea2a:eaff:fe28:0${i}${i}3.
# lp11 can send ipv6 traffic as there is no port security
sip=ee800000000000000000000000000000
for i in 1 2 3; do
    tip=fe80000000000000ea2aeafffe2800${i}3
    test_ipv6 11 f00000000011 f00000000${i}${i}3 $sip $tip ${i}3
done


# ipv6 packet should not be received by lp33 with mac f0000000333
# and ip6.dst as fe80::ea2a:eaff:fe28:0023 as it is
# configured with fe80::ea2a:eaff:fe28:0033
# lp11 can send ipv6 traffic as there is no port security

sip=ee800000000000000000000000000000
tip=fe80000000000000ea2aeafffe280023
test_ipv6 11 f00000000011 f00000000333 $sip $tip

# ipv6 packet should be allowed for lp[123]3 with mac f0000000${i}${i}3
# and ip6.src fe80::ea2a:eaff:fe28:0${i}${i}3 and ip6.src ::.
# and should be dropped for any other ip6.src
# lp21 can receive ipv6 traffic as there is no port security

tip=ee800000000000000000000000000000
for i in 1 2 3; do
    sip=fe80000000000000ea2aeafffe2800${i}3
    test_ipv6 ${i}3 f00000000${i}${i}3 f00000000021 $sip $tip 21

    # Test ICMPv6 MLD reports (v1 and v2) and NS for DAD
    sip=00000000000000000000000000000000
    test_icmpv6 ${i}3 f00000000${i}${i}3 f00000000021 $sip ff020000000000000000000000160000 83 21
    test_icmpv6 ${i}3 f00000000${i}${i}3 f00000000021 $sip ff020000000000000000000000160000 8f 21
    test_icmpv6 ${i}3 f00000000${i}${i}3 f00000000021 $sip ff0200000000000000ea2aeafffe2800 87 21
    # Traffic to non-multicast traffic should be dropped
    test_icmpv6 ${i}3 f00000000${i}${i}3 f00000000021 $sip $tip 83
    # Traffic of other ICMPv6 types should be dropped
    test_icmpv6 ${i}3 f00000000${i}${i}3 f00000000021 $sip ff020000000000000000000000160000 80

    # should be dropped
    sip=ae80000000000000ea2aeafffe2800aa
    test_ipv6 ${i}3 f00000000${i}${i}3 f00000000021 $sip $tip
done

# configure lsp13 to send and received IPv4 packets with an address range
ovn-nbctl lsp-set-port-security lp13 "f0:00:00:00:00:13 192.168.0.13 20.0.0.4/24 10.0.0.0/24"

sleep 2

sip=`ip_to_hex 10 0 0 13`
tip=`ip_to_hex 192 168 0 22`
# arp packet with inner ip 10.0.0.13 should be allowed for lsp13
test_arp 13 f00000000013 f00000000013 $sip $tip 0 f00000000022

sip=`ip_to_hex 10 0 0 14`
tip=`ip_to_hex 192 168 0 23`
# IPv4 packet from lsp13 with src ip 10.0.0.14 destined to lsp23
# with dst ip 192.168.0.23 should be allowed
test_ip 13 f00000000013 f00000000023 $sip $tip 23

sip=`ip_to_hex 192 168 0 33`
tip=`ip_to_hex 10 0 0 15`
# IPv4 packet from lsp33 with src ip 192.168.0.33 destined to lsp13
# with dst ip 10.0.0.15 should be received by lsp13
test_ip 33 f00000000033 f00000000013 $sip $tip 13

sip=`ip_to_hex 192 168 0 33`
tip=`ip_to_hex 20 0 0 4`
# IPv4 packet from lsp33 with src ip 192.168.0.33 destined to lsp13
# with dst ip 20.0.0.4 should be received by lsp13
test_ip 33 f00000000033 f00000000013 $sip $tip 13

sip=`ip_to_hex 192 168 0 33`
tip=`ip_to_hex 20 0 0 5`
# IPv4 packet from lsp33 with src ip 192.168.0.33 destined to lsp13
# with dst ip 20.0.0.5 should not be received by lsp13
test_ip 33 f00000000033 f00000000013 $sip $tip

sip=`ip_to_hex 192 168 0 33`
tip=`ip_to_hex 20 0 0 255`
# IPv4 packet from lsp33 with src ip 192.168.0.33 destined to lsp13
# with dst ip 20.0.0.255 should be received by lsp13
test_ip 33 f00000000033 f00000000013 $sip $tip 13

sip=`ip_to_hex 192 168 0 33`
tip=`ip_to_hex 192 168 0 255`
# IPv4 packet from lsp33 with src ip 192.168.0.33 destined to lsp13
# with dst ip 192.168.0.255 should not be received by lsp13
test_ip 33 f00000000033 f00000000013 $sip $tip

sip=`ip_to_hex 192 168 0 33`
tip=`ip_to_hex 224 0 0 4`
# IPv4 packet from lsp33 with src ip 192.168.0.33 destined to lsp13
# with dst ip 224.0.0.4  should be received by lsp13
test_ip 33 f00000000033 f00000000013 $sip $tip 13

#dump information including flow counters
ovn-nbctl show
ovn-sbctl dump-flows -- list multicast_group

echo "------ hv1 dump ------"
as hv1 ovs-vsctl show
as hv1 ovs-ofctl -O OpenFlow13 show br-int
as hv1 ovs-ofctl -O OpenFlow13 dump-flows br-int

echo "------ hv2 dump ------"
as hv2 ovs-vsctl show
as hv2 ovs-ofctl -O OpenFlow13 show br-int
as hv2 ovs-ofctl -O OpenFlow13 dump-flows br-int

echo "------ hv3 dump ------"
as hv3 ovs-vsctl show
as hv3 ovs-ofctl -O OpenFlow13 show br-int
as hv3 ovs-ofctl -O OpenFlow13 dump-flows br-int

# Now check the packets actually received against the ones expected.
for i in 1 2 3; do
    for j in 1 2 3; do
        ovn_check_packets__ "hv$i/vif$i$j-tx.pcap" "$i$j.expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:3765: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:3765"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3765"
$at_failed && at_fn_log_failure
$at_traceon; }

    done
done




    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:3769: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:3769"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3769"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3769: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:3769"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3769"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3769" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:3769: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:3769"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3769"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3769: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:3769"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3769"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3769" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:3769: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:3769"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3769"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3769: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:3769"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3769"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3769" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:3769: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:3769"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3769"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3769: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:3769"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3769"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3769" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:3769: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:3769"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3769"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3769: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:3769"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3769"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3769" "while kill -0 \$TMPPID 2>/dev/null"





    as hv2
    if test "hv2" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:3769: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:3769"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3769"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3769: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:3769"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3769"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3769" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:3769: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:3769"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3769"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3769: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:3769"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3769"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3769" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:3769: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:3769"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3769"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3769: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:3769"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3769"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3769" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv2
    { set +x
$as_echo "$at_srcdir/ovn.at:3769: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:3769"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3769"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3769: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:3769"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3769"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3769" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:3769: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:3769"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3769"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3769: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:3769"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3769"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3769" "while kill -0 \$TMPPID 2>/dev/null"





    as hv3
    if test "hv3" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:3769: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:3769"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3769"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3769: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:3769"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3769"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3769" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:3769: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:3769"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3769"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3769: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:3769"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3769"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3769" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:3769: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:3769"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3769"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3769: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:3769"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3769"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3769" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv3
    { set +x
$as_echo "$at_srcdir/ovn.at:3769: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:3769"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3769"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3769: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:3769"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3769"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3769" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:3769: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:3769"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3769"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3769: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:3769"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3769"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3769" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:3769: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:3769"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3769"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3769: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:3769"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3769"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3769" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:3769: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:3769"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3769"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3769: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:3769"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3769"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3769" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:3769: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:3769"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3769"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3769: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:3769"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3769"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3769" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:3769: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:3769"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3769"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3769: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:3769"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3769"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3769" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:3769: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:3769"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3769"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3769: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:3769"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3769"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3769" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:3769: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:3769"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3769"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3769: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:3769"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3769"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3769" "while kill -0 \$TMPPID 2>/dev/null"




ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_38
#AT_START_39
at_fn_group_banner 39 'ovn.at:3773' \
  "ovn -- 2 HVs, 2 LS, 1 lport/LS, 2 peer LRs" "     " 2
at_xfail=no
(
  $as_echo "39. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

# Logical network:
# Two LRs - R1 and R2 that are connected to each other as peers in 20.0.0.0/24
# network. R1 has a switchs ls1 (191.168.1.0/24) connected to it.
# R2 has ls2 (172.16.1.0/24) connected to it.

ls1_lp1_mac="f0:00:00:01:02:03"
rp_ls1_mac="00:00:00:01:02:03"
rp_ls2_mac="00:00:00:01:02:04"
ls2_lp1_mac="f0:00:00:01:02:04"

ls1_lp1_ip="192.168.1.2"
ls2_lp1_ip="172.16.1.2"

ovn-nbctl lr-add R1
ovn-nbctl lr-add R2

ovn-nbctl ls-add ls1
ovn-nbctl ls-add ls2

# Connect ls1 to R1
ovn-nbctl lrp-add R1 ls1 $rp_ls1_mac 192.168.1.1/24

ovn-nbctl lsp-add ls1 rp-ls1 -- set Logical_Switch_Port rp-ls1 type=router \
  options:router-port=ls1 addresses=\"$rp_ls1_mac\"

# Connect ls2 to R2
ovn-nbctl lrp-add R2 ls2 $rp_ls2_mac 172.16.1.1/24

ovn-nbctl lsp-add ls2 rp-ls2 -- set Logical_Switch_Port rp-ls2 type=router \
  options:router-port=ls2 addresses=\"$rp_ls2_mac\"

# Connect R1 to R2
ovn-nbctl lrp-add R1 R1_R2 00:00:00:02:03:04 20.0.0.1/24 peer=R2_R1
ovn-nbctl lrp-add R2 R2_R1 00:00:00:02:03:05 20.0.0.2/24 peer=R1_R2

ovn-nbctl lr-route-add R1 "0.0.0.0/0" 20.0.0.2
ovn-nbctl lr-route-add R2 "0.0.0.0/0" 20.0.0.1

# Create logical port ls1-lp1 in ls1
ovn-nbctl lsp-add ls1 ls1-lp1 \
-- lsp-set-addresses ls1-lp1 "$ls1_lp1_mac $ls1_lp1_ip"

# Create logical port ls2-lp1 in ls2
ovn-nbctl lsp-add ls2 ls2-lp1 \
-- lsp-set-addresses ls2-lp1 "$ls2_lp1_mac $ls2_lp1_ip"

# Create two hypervisor and create OVS ports corresponding to logical ports.
net_add n1

sim_add hv1
as hv1
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.1
ovs-vsctl -- add-port br-int hv1-vif1 -- \
    set interface hv1-vif1 external-ids:iface-id=ls1-lp1 \
    options:tx_pcap=hv1/vif1-tx.pcap \
    options:rxq_pcap=hv1/vif1-rx.pcap \
    ofport-request=1

sim_add hv2
as hv2
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.2
ovs-vsctl -- add-port br-int hv2-vif1 -- \
    set interface hv2-vif1 external-ids:iface-id=ls2-lp1 \
    options:tx_pcap=hv2/vif1-tx.pcap \
    options:rxq_pcap=hv2/vif1-rx.pcap \
    ofport-request=1


# Pre-populate the hypervisors' ARP tables so that we don't lose any
# packets for ARP resolution (native tunneling doesn't queue packets
# for ARP resolution).
{ set +x
$as_echo "$at_srcdir/ovn.at:3849: ovn_populate_arp__"
at_fn_check_prepare_trace "ovn.at:3849"
( $at_check_trace; ovn_populate_arp__
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3849"
$at_failed && at_fn_log_failure
$at_traceon; }


# Allow some time for ovn-northd and ovn-controller to catch up.
# XXX This should be more systematic.
sleep 1

# Packet to send.
packet="inport==\"ls1-lp1\" && eth.src==$ls1_lp1_mac && eth.dst==$rp_ls1_mac &&
        ip4 && ip.ttl==64 && ip4.src==$ls1_lp1_ip && ip4.dst==$ls2_lp1_ip &&
        udp && udp.src==53 && udp.dst==4369"
{ set +x
$as_echo "$at_srcdir/ovn.at:3859: as hv1 ovs-appctl -t ovn-controller inject-pkt \"\$packet\""
at_fn_check_prepare_dynamic "as hv1 ovs-appctl -t ovn-controller inject-pkt \"$packet\"" "ovn.at:3859"
( $at_check_trace; as hv1 ovs-appctl -t ovn-controller inject-pkt "$packet"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3859"
$at_failed && at_fn_log_failure
$at_traceon; }



echo "---------NB dump-----"
ovn-nbctl show
echo "---------------------"
ovn-nbctl list logical_router
echo "---------------------"
ovn-nbctl list logical_router_port
echo "---------------------"

echo "---------SB dump-----"
ovn-sbctl list datapath_binding
echo "---------------------"
ovn-sbctl list port_binding
echo "---------------------"

echo "------ hv1 dump ----------"
as hv1 ovs-ofctl show br-int
as hv1 ovs-ofctl dump-flows br-int
echo "------ hv2 dump ----------"
as hv2 ovs-ofctl show br-int
as hv2 ovs-ofctl dump-flows br-int

# Packet to Expect
# The TTL should be decremented by 2.
packet="eth.src==$rp_ls2_mac && eth.dst==$ls2_lp1_mac &&
        ip4 && ip.ttl==62 && ip4.src==$ls1_lp1_ip && ip4.dst==$ls2_lp1_ip &&
        udp && udp.src==53 && udp.dst==4369"
echo $packet | ovstest test-ovn expr-to-packets > expected

ovn_check_packets__ "hv2/vif1-tx.pcap" "expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:3890: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:3890"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3890"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn.at:3892: ovn-sbctl dump-flows | grep lr_in_arp_resolve | \\
grep \"reg0 == 172.16.1.2\" | wc -l"
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:3892"
( $at_check_trace; ovn-sbctl dump-flows | grep lr_in_arp_resolve | \
grep "reg0 == 172.16.1.2" | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3892"
$at_failed && at_fn_log_failure
$at_traceon; }


# Disable the ls2-lp1 port.
ovn-nbctl --wait=hv set logical_switch_port ls2-lp1 enabled=false

{ set +x
$as_echo "$at_srcdir/ovn.at:3899: ovn-sbctl dump-flows | grep lr_in_arp_resolve | \\
grep \"reg0 == 172.16.1.2\" | wc -l"
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:3899"
( $at_check_trace; ovn-sbctl dump-flows | grep lr_in_arp_resolve | \
grep "reg0 == 172.16.1.2" | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3899"
$at_failed && at_fn_log_failure
$at_traceon; }


# Generate the packet destined for ls2-lp1 and it should not be delivered.
# Packet to send.
packet="inport==\"ls1-lp1\" && eth.src==$ls1_lp1_mac && eth.dst==$rp_ls1_mac &&
        ip4 && ip.ttl==64 && ip4.src==$ls1_lp1_ip && ip4.dst==$ls2_lp1_ip &&
        udp && udp.src==53 && udp.dst==4369"

as hv1 ovs-appctl -t ovn-controller inject-pkt "$packet"
# The 2nd packet sent shound not be received.
ovn_check_packets__ "hv2/vif1-tx.pcap" "expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:3911: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:3911"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3911"
$at_failed && at_fn_log_failure
$at_traceon; }





    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:3913: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:3913"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3913"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3913: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:3913"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3913"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3913" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:3913: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:3913"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3913"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3913: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:3913"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3913"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3913" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:3913: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:3913"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3913"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3913: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:3913"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3913"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3913" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:3913: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:3913"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3913"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3913: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:3913"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3913"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3913" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:3913: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:3913"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3913"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3913: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:3913"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3913"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3913" "while kill -0 \$TMPPID 2>/dev/null"





    as hv2
    if test "hv2" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:3913: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:3913"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3913"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3913: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:3913"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3913"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3913" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:3913: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:3913"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3913"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3913: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:3913"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3913"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3913" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:3913: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:3913"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3913"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3913: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:3913"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3913"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3913" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv2
    { set +x
$as_echo "$at_srcdir/ovn.at:3913: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:3913"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3913"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3913: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:3913"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3913"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3913" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:3913: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:3913"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3913"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3913: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:3913"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3913"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3913" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:3913: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:3913"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3913"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3913: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:3913"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3913"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3913" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:3913: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:3913"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3913"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3913: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:3913"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3913"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3913" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:3913: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:3913"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3913"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3913: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:3913"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3913"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3913" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:3913: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:3913"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3913"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3913: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:3913"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3913"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3913" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:3913: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:3913"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3913"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3913: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:3913"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3913"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3913" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:3913: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:3913"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3913"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:3913: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:3913"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:3913"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:3913" "while kill -0 \$TMPPID 2>/dev/null"




ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_39
#AT_START_40
at_fn_group_banner 40 'ovn.at:3918' \
  "ovn -- 1 HV, 1 LS, 2 lport/LS, 1 LR" "            " 2
at_xfail=no
(
  $as_echo "40. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init


ovn_start

# Logical network:
# One LR - R1 has switch ls1 with two subnets attached to it (191.168.1.0/24
# and 172.16.1.0/24) connected to it.

ovn-nbctl lr-add R1

ovn-nbctl ls-add ls1

# Connect ls1 to R1
ovn-nbctl lrp-add R1 ls1 00:00:00:01:02:03 192.168.1.1/24 172.16.1.1/24
ovn-nbctl lsp-add ls1 rp-ls1 -- set Logical_Switch_Port rp-ls1 type=router \
          options:router-port=ls1 addresses=\"00:00:00:01:02:03\"

# Create logical port ls1-lp1 in ls1
ovn-nbctl lsp-add ls1 ls1-lp1 \
          -- lsp-set-addresses ls1-lp1 "f0:00:00:01:02:03 192.168.1.2"

# Create logical port ls1-lp2 in ls1
ovn-nbctl lsp-add ls1 ls1-lp2 \
          -- lsp-set-addresses ls1-lp2 "f0:00:00:01:02:04 172.16.1.2"

# Create one hypervisor and create OVS ports corresponding to logical ports.
net_add n1

sim_add hv1
as hv1
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.1
ovs-vsctl -- add-port br-int vif1 -- \
    set interface vif1 external-ids:iface-id=ls1-lp1 \
    options:tx_pcap=hv1/vif1-tx.pcap \
    options:rxq_pcap=hv1/vif1-rx.pcap \
    ofport-request=1

ovs-vsctl -- add-port br-int vif2 -- \
    set interface vif2 external-ids:iface-id=ls1-lp2 \
    options:tx_pcap=hv1/vif2-tx.pcap \
    options:rxq_pcap=hv1/vif2-rx.pcap \
    ofport-request=1


# Allow some time for ovn-northd and ovn-controller to catch up.
# XXX This should be more systematic.
sleep 1

# Send ip packets between the two ports.
ip_to_hex() {
    printf "%02x%02x%02x%02x" "$@"
}

# Packet to send.
src_mac="f00000010203"
dst_mac="000000010203"
src_ip=`ip_to_hex 192 168 1 2`
dst_ip=`ip_to_hex 172 16 1 2`
packet=${dst_mac}${src_mac}08004500001c0000000040110000${src_ip}${dst_ip}0035111100080000
as hv1 ovs-appctl netdev-dummy/receive vif1 $packet


echo "---------NB dump-----"
ovn-nbctl show
echo "---------------------"
ovn-nbctl list logical_router
echo "---------------------"
ovn-nbctl list logical_router_port
echo "---------------------"

echo "---------SB dump-----"
ovn-sbctl list datapath_binding
echo "---------------------"
ovn-sbctl list logical_flow
echo "---------------------"

echo "------ hv1 dump ----------"
as hv1 ovs-ofctl dump-flows br-int


#Disable router R1
ovn-nbctl set Logical_Router R1 enabled=false

# Allow some time for ovn-northd and ovn-controller to catch up.
# XXX This should be more systematic.
sleep 1

echo "---------SB dump-----"
ovn-sbctl list datapath_binding
echo "---------------------"
ovn-sbctl list logical_flow
echo "---------------------"

echo "------ hv1 dump ----------"
as hv1 ovs-ofctl dump-flows br-int

as hv1 ovs-appctl netdev-dummy/receive vif1 $packet

# Packet to Expect
expect_src_mac="000000010203"
expect_dst_mac="f00000010204"
echo "${expect_dst_mac}${expect_src_mac}08004500001c000000003f110100${src_ip}${dst_ip}0035111100080000" > expected

ovn_check_packets__ "hv1/vif2-tx.pcap" "expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:4022: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:4022"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4022"
$at_failed && at_fn_log_failure
$at_traceon; }





    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:4024: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:4024"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4024"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4024: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:4024"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4024"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4024" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:4024: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:4024"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4024"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4024: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:4024"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4024"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4024" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:4024: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:4024"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4024"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4024: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:4024"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4024"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4024" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:4024: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:4024"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4024"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4024: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:4024"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4024"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4024" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:4024: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:4024"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4024"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4024: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:4024"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4024"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4024" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:4024: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:4024"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4024"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4024: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:4024"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4024"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4024" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:4024: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:4024"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4024"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4024: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:4024"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4024"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4024" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:4024: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:4024"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4024"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4024: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:4024"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4024"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4024" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:4024: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:4024"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4024"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4024: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:4024"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4024"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4024" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:4024: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:4024"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4024"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4024: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:4024"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4024"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4024" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:4024: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:4024"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4024"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4024: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:4024"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4024"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4024" "while kill -0 \$TMPPID 2>/dev/null"




ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_40
#AT_START_41
at_fn_group_banner 41 'ovn.at:4029' \
  "ovn -- 1 HV, 2 LSs, 1 lport/LS, 1 LR" "           " 2
at_xfail=no
(
  $as_echo "41. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init


ovn_start

# Logical network:
# One LR - R1 has switch ls1 (191.168.1.0/24) connected to it,
# and has switch ls2 (172.16.1.0/24) connected to it.

ovn-nbctl lr-add R1

ovn-nbctl ls-add ls1
ovn-nbctl ls-add ls2

# Connect ls1 to R1
ovn-nbctl lrp-add R1 ls1 00:00:00:01:02:03 192.168.1.1/24
ovn-nbctl lsp-add ls1 rp-ls1 -- set Logical_Switch_Port rp-ls1 type=router \
          options:router-port=ls1 addresses=\"00:00:00:01:02:03\"

# Connect ls2 to R1
ovn-nbctl lrp-add R1 ls2 00:00:00:01:02:04 172.16.1.1/24
ovn-nbctl lsp-add ls2 rp-ls2 -- set Logical_Switch_Port rp-ls2 type=router \
          options:router-port=ls2 addresses=\"00:00:00:01:02:04\"

# Create logical port ls1-lp1 in ls1
ovn-nbctl lsp-add ls1 ls1-lp1 \
-- lsp-set-addresses ls1-lp1 "f0:00:00:01:02:03 192.168.1.2"

# Create logical port ls2-lp1 in ls2
ovn-nbctl lsp-add ls2 ls2-lp1 \
-- lsp-set-addresses ls2-lp1 "f0:00:00:01:02:04 172.16.1.2"

# Create one hypervisor and create OVS ports corresponding to logical ports.
net_add n1

sim_add hv1
as hv1
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.1
ovs-vsctl -- add-port br-int vif1 -- \
    set interface vif1 external-ids:iface-id=ls1-lp1 \
    options:tx_pcap=hv1/vif1-tx.pcap \
    options:rxq_pcap=hv1/vif1-rx.pcap \
    ofport-request=1

ovs-vsctl -- add-port br-int vif2 -- \
    set interface vif2 external-ids:iface-id=ls2-lp1 \
    options:tx_pcap=hv1/vif2-tx.pcap \
    options:rxq_pcap=hv1/vif2-rx.pcap \
    ofport-request=1


# Allow some time for ovn-northd and ovn-controller to catch up.
# XXX This should be more systematic.
sleep 1

# Send ip packets between the two ports.
ip_to_hex() {
    printf "%02x%02x%02x%02x" "$@"
}

# Packet to send.
src_mac="f00000010203"
dst_mac="000000010203"
src_ip=`ip_to_hex 192 168 1 2`
dst_ip=`ip_to_hex 172 16 1 2`
packet=${dst_mac}${src_mac}08004500001c0000000040110000${src_ip}${dst_ip}0035111100080000
as hv1 ovs-appctl netdev-dummy/receive vif1 $packet


echo "---------NB dump-----"
ovn-nbctl show
echo "---------------------"
ovn-nbctl list logical_router
echo "---------------------"
ovn-nbctl list logical_router_port
echo "---------------------"

echo "---------SB dump-----"
ovn-sbctl list datapath_binding
echo "---------------------"
ovn-sbctl list logical_flow
echo "---------------------"

echo "------ hv1 dump ----------"
as hv1 ovs-ofctl dump-flows br-int

#Disable router R1
ovn-nbctl set Logical_Router R1 enabled=false

echo "---------SB dump-----"
ovn-sbctl list datapath_binding
echo "---------------------"
ovn-sbctl list logical_flow
echo "---------------------"

echo "------ hv1 dump ----------"
as hv1 ovs-ofctl dump-flows br-int

# Allow some time for the disabling of logical router R1 to propagate.
# XXX This should be more systematic.
sleep 1

as hv1 ovs-appctl netdev-dummy/receive vif1 $packet

# Packet to Expect
expect_src_mac="000000010204"
expect_dst_mac="f00000010204"
echo "${expect_dst_mac}${expect_src_mac}08004500001c000000003f110100${src_ip}${dst_ip}0035111100080000" > expected

ovn_check_packets__ "hv1/vif2-tx.pcap" "expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:4138: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:4138"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4138"
$at_failed && at_fn_log_failure
$at_traceon; }





    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:4140: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:4140"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4140"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4140: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:4140"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4140"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4140" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:4140: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:4140"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4140"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4140: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:4140"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4140"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4140" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:4140: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:4140"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4140"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4140: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:4140"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4140"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4140" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:4140: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:4140"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4140"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4140: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:4140"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4140"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4140" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:4140: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:4140"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4140"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4140: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:4140"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4140"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4140" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:4140: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:4140"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4140"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4140: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:4140"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4140"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4140" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:4140: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:4140"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4140"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4140: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:4140"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4140"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4140" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:4140: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:4140"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4140"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4140: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:4140"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4140"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4140" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:4140: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:4140"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4140"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4140: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:4140"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4140"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4140" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:4140: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:4140"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4140"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4140: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:4140"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4140"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4140" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:4140: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:4140"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4140"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4140: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:4140"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4140"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4140" "while kill -0 \$TMPPID 2>/dev/null"




ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_41
#AT_START_42
at_fn_group_banner 42 'ovn.at:4144' \
  "ovn -- 2 HVs, 3 LS, 1 lport/LS, 2 peer LRs, static routes" "" 2
at_xfail=no
(
  $as_echo "42. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

# Logical network:
# Two LRs - R1 and R2 that are connected to each other as peers in 20.0.0.0/24
# network. R1 has switchess foo (192.168.1.0/24)
# connected to it.
# R2 has alice (172.16.1.0/24) and bob (172.16.2.0/24) connected to it.

ovn-nbctl lr-add R1
ovn-nbctl lr-add R2

ovn-nbctl ls-add foo
ovn-nbctl ls-add alice
ovn-nbctl ls-add bob

# Connect foo to R1
ovn-nbctl lrp-add R1 foo 00:00:00:01:02:03 192.168.1.1/24
ovn-nbctl lsp-add foo rp-foo -- set Logical_Switch_Port rp-foo type=router \
          options:router-port=foo addresses=\"00:00:00:01:02:03\"

# Connect alice to R2
ovn-nbctl lrp-add R2 alice 00:00:00:01:02:04 172.16.1.1/24
ovn-nbctl lsp-add alice rp-alice -- set Logical_Switch_Port rp-alice \
          type=router options:router-port=alice addresses=\"00:00:00:01:02:04\"

# Connect bob to R2
ovn-nbctl lrp-add R2 bob 00:00:00:01:02:05 172.16.2.1/24
ovn-nbctl lsp-add bob rp-bob -- set Logical_Switch_Port rp-bob type=router \
          options:router-port=bob addresses=\"00:00:00:01:02:05\"

# Connect R1 to R2
ovn-nbctl lrp-add R1 R1_R2 00:00:00:02:03:04 20.0.0.1/24 peer=R2_R1
ovn-nbctl lrp-add R2 R2_R1 00:00:00:02:03:05 20.0.0.2/24 peer=R1_R2

#install static routes
ovn-nbctl lr-route-add R1 172.16.1.0/24 20.0.0.2
ovn-nbctl lr-route-add R2 172.16.2.0/24 20.0.0.2 R1_R2
ovn-nbctl lr-route-add R2 192.168.1.0/24 20.0.0.1

# Create logical port foo1 in foo
ovn-nbctl lsp-add foo foo1 \
-- lsp-set-addresses foo1 "f0:00:00:01:02:03 192.168.1.2"

# Create logical port alice1 in alice
ovn-nbctl lsp-add alice alice1 \
-- lsp-set-addresses alice1 "f0:00:00:01:02:04 172.16.1.2"

# Create logical port bob1 in bob
ovn-nbctl lsp-add bob bob1 \
-- lsp-set-addresses bob1 "f0:00:00:01:02:05 172.16.2.2"

# Create two hypervisor and create OVS ports corresponding to logical ports.
net_add n1

sim_add hv1
as hv1
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.1
ovs-vsctl -- add-port br-int hv1-vif1 -- \
    set interface hv1-vif1 external-ids:iface-id=foo1 \
    options:tx_pcap=hv1/vif1-tx.pcap \
    options:rxq_pcap=hv1/vif1-rx.pcap \
    ofport-request=1

ovs-vsctl -- add-port br-int hv1-vif2 -- \
    set interface hv1-vif2 external-ids:iface-id=alice1 \
    options:tx_pcap=hv1/vif2-tx.pcap \
    options:rxq_pcap=hv1/vif2-rx.pcap \
    ofport-request=2

sim_add hv2
as hv2
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.2
ovs-vsctl -- add-port br-int hv2-vif1 -- \
    set interface hv2-vif1 external-ids:iface-id=bob1 \
    options:tx_pcap=hv2/vif1-tx.pcap \
    options:rxq_pcap=hv2/vif1-rx.pcap \
    ofport-request=1


# Pre-populate the hypervisors' ARP tables so that we don't lose any
# packets for ARP resolution (native tunneling doesn't queue packets
# for ARP resolution).
{ set +x
$as_echo "$at_srcdir/ovn.at:4229: ovn_populate_arp__"
at_fn_check_prepare_trace "ovn.at:4229"
( $at_check_trace; ovn_populate_arp__
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4229"
$at_failed && at_fn_log_failure
$at_traceon; }


# Allow some time for ovn-northd and ovn-controller to catch up.
# XXX This should be more systematic.
sleep 1

ip_to_hex() {
    printf "%02x%02x%02x%02x" "$@"
}

# Send ip packets between foo1 and alice1
src_mac="f00000010203"
dst_mac="000000010203"
src_ip=`ip_to_hex 192 168 1 2`
dst_ip=`ip_to_hex 172 16 1 2`
packet=${dst_mac}${src_mac}08004500001c0000000040110000${src_ip}${dst_ip}0035111100080000
as hv1 ovs-appctl netdev-dummy/receive hv1-vif1 $packet

# Send ip packets between foo1 and bob1
src_mac="f00000010203"
dst_mac="000000010203"
src_ip=`ip_to_hex 192 168 1 2`
dst_ip=`ip_to_hex 172 16 2 2`
packet=${dst_mac}${src_mac}08004500001c0000000040110000${src_ip}${dst_ip}0035111100080000
as hv1 ovs-appctl netdev-dummy/receive hv1-vif1 $packet

echo "---------NB dump-----"
ovn-nbctl show
echo "---------------------"
ovn-nbctl list logical_router
echo "---------------------"
ovn-nbctl list logical_router_port
echo "---------------------"

echo "---------SB dump-----"
ovn-sbctl list datapath_binding
echo "---------------------"
ovn-sbctl list port_binding
echo "---------------------"

echo "------ hv1 dump ----------"
as hv1 ovs-ofctl dump-flows br-int
echo "------ hv2 dump ----------"
as hv2 ovs-ofctl dump-flows br-int

# Packet to Expect at bob1
src_mac="000000010205"
dst_mac="f00000010205"
src_ip=`ip_to_hex 192 168 1 2`
dst_ip=`ip_to_hex 172 16 2 2`
echo "${dst_mac}${src_mac}08004500001c000000003e110200${src_ip}${dst_ip}0035111100080000" > expected

ovn_check_packets__ "hv2/vif1-tx.pcap" "expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:4281: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:4281"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4281"
$at_failed && at_fn_log_failure
$at_traceon; }


# Packet to Expect at alice1
src_mac="000000010204"
dst_mac="f00000010204"
src_ip=`ip_to_hex 192 168 1 2`
dst_ip=`ip_to_hex 172 16 1 2`
echo "${dst_mac}${src_mac}08004500001c000000003e110200${src_ip}${dst_ip}0035111100080000" > expected

ovn_check_packets__ "hv1/vif2-tx.pcap" "expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:4290: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:4290"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4290"
$at_failed && at_fn_log_failure
$at_traceon; }





    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:4292: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:4292"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4292"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4292: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:4292"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4292"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4292" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:4292: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:4292"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4292"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4292: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:4292"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4292"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4292" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:4292: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:4292"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4292"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4292: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:4292"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4292"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4292" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:4292: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:4292"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4292"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4292: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:4292"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4292"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4292" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:4292: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:4292"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4292"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4292: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:4292"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4292"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4292" "while kill -0 \$TMPPID 2>/dev/null"





    as hv2
    if test "hv2" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:4292: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:4292"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4292"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4292: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:4292"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4292"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4292" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:4292: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:4292"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4292"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4292: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:4292"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4292"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4292" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:4292: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:4292"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4292"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4292: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:4292"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4292"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4292" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv2
    { set +x
$as_echo "$at_srcdir/ovn.at:4292: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:4292"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4292"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4292: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:4292"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4292"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4292" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:4292: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:4292"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4292"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4292: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:4292"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4292"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4292" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:4292: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:4292"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4292"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4292: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:4292"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4292"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4292" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:4292: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:4292"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4292"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4292: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:4292"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4292"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4292" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:4292: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:4292"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4292"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4292: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:4292"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4292"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4292" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:4292: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:4292"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4292"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4292: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:4292"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4292"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4292" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:4292: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:4292"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4292"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4292: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:4292"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4292"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4292" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:4292: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:4292"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4292"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4292: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:4292"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4292"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4292" "while kill -0 \$TMPPID 2>/dev/null"




ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_42
#AT_START_43
at_fn_group_banner 43 'ovn.at:4296' \
  "ovn -- send gratuitous arp on localnet" "         " 2
at_xfail=no
(
  $as_echo "43. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start
ovn-nbctl ls-add lsw0
net_add n1
sim_add hv
as hv
ovs-vsctl \
    -- add-br br-phys \
    -- add-br br-eth0

ovn_attach n1 br-phys 192.168.0.1

{ set +x
$as_echo "$at_srcdir/ovn.at:4308: ovs-vsctl set Open_vSwitch . external-ids:ovn-bridge-mappings=physnet1:br-eth0"
at_fn_check_prepare_trace "ovn.at:4308"
( $at_check_trace; ovs-vsctl set Open_vSwitch . external-ids:ovn-bridge-mappings=physnet1:br-eth0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4308"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:4309: ovs-vsctl add-port br-eth0 snoopvif -- set Interface snoopvif options:tx_pcap=hv/snoopvif-tx.pcap options:rxq_pcap=hv/snoopvif-rx.pcap"
at_fn_check_prepare_trace "ovn.at:4309"
( $at_check_trace; ovs-vsctl add-port br-eth0 snoopvif -- set Interface snoopvif options:tx_pcap=hv/snoopvif-tx.pcap options:rxq_pcap=hv/snoopvif-rx.pcap
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4309"
$at_failed && at_fn_log_failure
$at_traceon; }


# Create a vif.
{ set +x
$as_echo "$at_srcdir/ovn.at:4312: ovn-nbctl lsp-add lsw0 localvif1"
at_fn_check_prepare_trace "ovn.at:4312"
( $at_check_trace; ovn-nbctl lsp-add lsw0 localvif1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4312"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:4313: ovn-nbctl lsp-set-addresses localvif1 \"f0:00:00:00:00:01 192.168.1.2\""
at_fn_check_prepare_trace "ovn.at:4313"
( $at_check_trace; ovn-nbctl lsp-set-addresses localvif1 "f0:00:00:00:00:01 192.168.1.2"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4313"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:4314: ovn-nbctl lsp-set-port-security localvif1 \"f0:00:00:00:00:01\""
at_fn_check_prepare_trace "ovn.at:4314"
( $at_check_trace; ovn-nbctl lsp-set-port-security localvif1 "f0:00:00:00:00:01"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4314"
$at_failed && at_fn_log_failure
$at_traceon; }


# Create a localnet port.
{ set +x
$as_echo "$at_srcdir/ovn.at:4317: ovn-nbctl lsp-add lsw0 ln_port"
at_fn_check_prepare_trace "ovn.at:4317"
( $at_check_trace; ovn-nbctl lsp-add lsw0 ln_port
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4317"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:4318: ovn-nbctl lsp-set-addresses ln_port unknown"
at_fn_check_prepare_trace "ovn.at:4318"
( $at_check_trace; ovn-nbctl lsp-set-addresses ln_port unknown
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4318"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:4319: ovn-nbctl lsp-set-type ln_port localnet"
at_fn_check_prepare_trace "ovn.at:4319"
( $at_check_trace; ovn-nbctl lsp-set-type ln_port localnet
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4319"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:4320: ovn-nbctl lsp-set-options ln_port network_name=physnet1"
at_fn_check_prepare_trace "ovn.at:4320"
( $at_check_trace; ovn-nbctl lsp-set-options ln_port network_name=physnet1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4320"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn.at:4322: ovs-vsctl add-port br-int localvif1 -- set Interface localvif1 external_ids:iface-id=localvif1"
at_fn_check_prepare_trace "ovn.at:4322"
( $at_check_trace; ovs-vsctl add-port br-int localvif1 -- set Interface localvif1 external_ids:iface-id=localvif1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4322"
$at_failed && at_fn_log_failure
$at_traceon; }


# Wait for packet to be received.
echo "fffffffffffff0000000000108060001080006040001f00000000001c0a80102000000000000c0a80102" > expected
ovn_check_packets__ "hv/snoopvif-tx.pcap" "expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:4326: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:4326"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4326"
$at_failed && at_fn_log_failure
$at_traceon; }


# Check GARP packet when restart openflow connection.
as hv
{ set +x
$as_echo "$at_srcdir/ovn.at:4330: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:4330"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4330"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4330: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:4330"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4330"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4330" "while kill -0 \$TMPPID 2>/dev/null"


ovs_wait_cond () {
    grep -c "waiting 4 seconds before reconnect" hv/ovn-controller.log
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4332" "until grep -c \"waiting 4 seconds before reconnect\" hv/ovn-controller.log"


as hv
start_daemon ovs-vswitchd --enable-dummy=system -vvconn -vofproto_dpif -vunixctl

# Wait for packet to be received.
echo "fffffffffffff0000000000108060001080006040001f00000000001c0a80102000000000000c0a80102" > expected
ovn_check_packets__ "hv/snoopvif-tx.pcap" "expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:4339: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:4339"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4339"
$at_failed && at_fn_log_failure
$at_traceon; }


# Delete the localnet ports.
{ set +x
$as_echo "$at_srcdir/ovn.at:4342: ovs-vsctl del-port localvif1"
at_fn_check_prepare_trace "ovn.at:4342"
( $at_check_trace; ovs-vsctl del-port localvif1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4342"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:4343: ovn-nbctl lsp-del ln_port"
at_fn_check_prepare_trace "ovn.at:4343"
( $at_check_trace; ovn-nbctl lsp-del ln_port
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4343"
$at_failed && at_fn_log_failure
$at_traceon; }





    as hv
    if test "hv" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:4345: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:4345"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4345"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4345: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:4345"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4345"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4345" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:4345: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:4345"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4345"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4345: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:4345"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4345"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4345" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:4345: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:4345"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4345"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4345: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:4345"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4345"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4345" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv
    { set +x
$as_echo "$at_srcdir/ovn.at:4345: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:4345"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4345"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4345: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:4345"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4345"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4345" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:4345: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:4345"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4345"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4345: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:4345"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4345"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4345" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:4345: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:4345"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4345"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4345: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:4345"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4345"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4345" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:4345: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:4345"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4345"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4345: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:4345"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4345"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4345" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:4345: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:4345"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4345"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4345: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:4345"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4345"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4345" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:4345: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:4345"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4345"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4345: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:4345"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4345"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4345" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:4345: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:4345"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4345"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4345: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:4345"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4345"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4345" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:4345: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:4345"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4345"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4345: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:4345"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4345"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4345" "while kill -0 \$TMPPID 2>/dev/null"




ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_43
#AT_START_44
at_fn_group_banner 44 'ovn.at:4349' \
  "ovn -- 2 HVs, 3 LRs connected via LS, static routes" "" 2
at_xfail=no
(
  $as_echo "44. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

# Logical network:
# Three LRs - R1, R2 and R3 that are connected to each other via LS "join"
# in 20.0.0.0/24 network. R1 has switchess foo (192.168.1.0/24)
# connected to it. R2 has alice (172.16.1.0/24) and R3 has bob (10.32.1.0/24)
# connected to it.

ovn-nbctl lr-add R1
ovn-nbctl lr-add R2
ovn-nbctl lr-add R3

ovn-nbctl ls-add foo
ovn-nbctl ls-add alice
ovn-nbctl ls-add bob
ovn-nbctl ls-add join

# Connect foo to R1
ovn-nbctl lrp-add R1 foo 00:00:01:01:02:03 192.168.1.1/24
ovn-nbctl lsp-add foo rp-foo -- set Logical_Switch_Port rp-foo type=router \
    options:router-port=foo addresses=\"00:00:01:01:02:03\"

# Connect alice to R2
ovn-nbctl lrp-add R2 alice 00:00:02:01:02:03 172.16.1.1/24
ovn-nbctl lsp-add alice rp-alice -- set Logical_Switch_Port rp-alice \
    type=router options:router-port=alice addresses=\"00:00:02:01:02:03\"

# Connect bob to R3
ovn-nbctl lrp-add R3 bob 00:00:03:01:02:03 10.32.1.1/24
ovn-nbctl lsp-add bob rp-bob -- set Logical_Switch_Port rp-bob \
    type=router options:router-port=bob addresses=\"00:00:03:01:02:03\"

# Connect R1 to join
ovn-nbctl lrp-add R1 R1_join 00:00:04:01:02:03 20.0.0.1/24
ovn-nbctl lsp-add join r1-join -- set Logical_Switch_Port r1-join \
    type=router options:router-port=R1_join addresses='"00:00:04:01:02:03"'

# Connect R2 to join
ovn-nbctl lrp-add R2 R2_join 00:00:04:01:02:04 20.0.0.2/24
ovn-nbctl lsp-add join r2-join -- set Logical_Switch_Port r2-join \
    type=router options:router-port=R2_join addresses='"00:00:04:01:02:04"'

# Connect R3 to join
ovn-nbctl lrp-add R3 R3_join 00:00:04:01:02:05 20.0.0.3/24
ovn-nbctl lsp-add join r3-join -- set Logical_Switch_Port r3-join \
    type=router options:router-port=R3_join addresses='"00:00:04:01:02:05"'

#install static routes
ovn-nbctl lr-route-add R1 172.16.1.0/24 20.0.0.2
ovn-nbctl lr-route-add R1 10.32.1.0/24 20.0.0.3

ovn-nbctl lr-route-add R2 192.168.1.0/24 20.0.0.1
ovn-nbctl lr-route-add R2 10.32.1.0/24 20.0.0.3

ovn-nbctl lr-route-add R3 192.168.1.0/24 20.0.0.1
ovn-nbctl lr-route-add R3 172.16.1.0/24 20.0.0.2

# Create logical port foo1 in foo
ovn-nbctl lsp-add foo foo1 \
-- lsp-set-addresses foo1 "f0:00:00:01:02:03 192.168.1.2"

# Create logical port alice1 in alice
ovn-nbctl lsp-add alice alice1 \
-- lsp-set-addresses alice1 "f0:00:00:01:02:04 172.16.1.2"

# Create logical port bob1 in bob
ovn-nbctl lsp-add bob bob1 \
-- lsp-set-addresses bob1 "f0:00:00:01:02:05 10.32.1.2"

# Create two hypervisor and create OVS ports corresponding to logical ports.
net_add n1

sim_add hv1
as hv1
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.1
ovs-vsctl -- add-port br-int hv1-vif1 -- \
    set interface hv1-vif1 external-ids:iface-id=foo1 \
    options:tx_pcap=hv1/vif1-tx.pcap \
    options:rxq_pcap=hv1/vif1-rx.pcap \
    ofport-request=1

ovs-vsctl -- add-port br-int hv1-vif2 -- \
    set interface hv1-vif2 external-ids:iface-id=alice1 \
    options:tx_pcap=hv1/vif2-tx.pcap \
    options:rxq_pcap=hv1/vif2-rx.pcap \
    ofport-request=2

sim_add hv2
as hv2
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.2
ovs-vsctl -- add-port br-int hv2-vif1 -- \
    set interface hv2-vif1 external-ids:iface-id=bob1 \
    options:tx_pcap=hv2/vif1-tx.pcap \
    options:rxq_pcap=hv2/vif1-rx.pcap \
    ofport-request=1


# Pre-populate the hypervisors' ARP tables so that we don't lose any
# packets for ARP resolution (native tunneling doesn't queue packets
# for ARP resolution).
{ set +x
$as_echo "$at_srcdir/ovn.at:4452: ovn_populate_arp__"
at_fn_check_prepare_trace "ovn.at:4452"
( $at_check_trace; ovn_populate_arp__
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4452"
$at_failed && at_fn_log_failure
$at_traceon; }


# Allow some time for ovn-northd and ovn-controller to catch up.
# XXX This should be more systematic.
sleep 1

ip_to_hex() {
    printf "%02x%02x%02x%02x" "$@"
}

# Send ip packets between foo1 and alice1
src_mac="f00000010203"
dst_mac="000001010203"
src_ip=`ip_to_hex 192 168 1 2`
dst_ip=`ip_to_hex 172 16 1 2`
packet=${dst_mac}${src_mac}08004500001c0000000040110000${src_ip}${dst_ip}0035111100080000
as hv1 ovs-appctl netdev-dummy/receive hv1-vif1 $packet
as hv1 ovs-appctl ofproto/trace br-int in_port=1 $packet

# Send ip packets between foo1 and bob1
src_mac="f00000010203"
dst_mac="000001010203"
src_ip=`ip_to_hex 192 168 1 2`
dst_ip=`ip_to_hex 10 32 1 2`
packet=${dst_mac}${src_mac}08004500001c0000000040110000${src_ip}${dst_ip}0035111100080000
as hv1 ovs-appctl netdev-dummy/receive hv1-vif1 $packet

echo "---------NB dump-----"
ovn-nbctl show
echo "---------------------"
ovn-nbctl list logical_router
echo "---------------------"
ovn-nbctl list logical_router_port
echo "---------------------"

echo "---------SB dump-----"
ovn-sbctl list datapath_binding
echo "---------------------"
ovn-sbctl list port_binding
echo "---------------------"
ovn-sbctl dump-flows
echo "---------------------"

echo "------ hv1 dump ----------"
as hv1 ovs-ofctl show br-int
as hv1 ovs-ofctl dump-flows br-int
echo "------ hv2 dump ----------"
as hv2 ovs-ofctl show br-int
as hv2 ovs-ofctl dump-flows br-int
echo "----------------------------"

# Packet to Expect at bob1
src_mac="000003010203"
dst_mac="f00000010205"
src_ip=`ip_to_hex 192 168 1 2`
dst_ip=`ip_to_hex 10 32 1 2`
echo "${dst_mac}${src_mac}08004500001c000000003e110200${src_ip}${dst_ip}0035111100080000" > expected

ovn_check_packets__ "hv2/vif1-tx.pcap" "expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:4510: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:4510"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4510"
$at_failed && at_fn_log_failure
$at_traceon; }


# Packet to Expect at alice1
src_mac="000002010203"
dst_mac="f00000010204"
src_ip=`ip_to_hex 192 168 1 2`
dst_ip=`ip_to_hex 172 16 1 2`
echo "${dst_mac}${src_mac}08004500001c000000003e110200${src_ip}${dst_ip}0035111100080000" > expected

ovn_check_packets__ "hv1/vif2-tx.pcap" "expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:4519: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:4519"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4519"
$at_failed && at_fn_log_failure
$at_traceon; }





    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:4521: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:4521"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4521"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4521: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:4521"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4521"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4521" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:4521: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:4521"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4521"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4521: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:4521"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4521"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4521" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:4521: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:4521"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4521"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4521: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:4521"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4521"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4521" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:4521: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:4521"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4521"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4521: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:4521"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4521"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4521" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:4521: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:4521"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4521"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4521: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:4521"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4521"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4521" "while kill -0 \$TMPPID 2>/dev/null"





    as hv2
    if test "hv2" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:4521: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:4521"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4521"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4521: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:4521"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4521"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4521" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:4521: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:4521"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4521"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4521: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:4521"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4521"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4521" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:4521: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:4521"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4521"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4521: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:4521"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4521"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4521" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv2
    { set +x
$as_echo "$at_srcdir/ovn.at:4521: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:4521"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4521"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4521: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:4521"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4521"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4521" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:4521: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:4521"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4521"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4521: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:4521"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4521"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4521" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:4521: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:4521"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4521"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4521: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:4521"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4521"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4521" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:4521: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:4521"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4521"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4521: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:4521"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4521"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4521" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:4521: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:4521"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4521"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4521: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:4521"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4521"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4521" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:4521: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:4521"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4521"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4521: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:4521"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4521"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4521" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:4521: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:4521"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4521"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4521: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:4521"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4521"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4521" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:4521: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:4521"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4521"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4521: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:4521"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4521"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4521" "while kill -0 \$TMPPID 2>/dev/null"




ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_44
#AT_START_45
at_fn_group_banner 45 'ovn.at:4525' \
  "ovn -- dhcpv4 : 1 HV, 2 LS, 2 LSPs/LS" "          " 2
at_xfail=no
(
  $as_echo "45. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

ovn-nbctl ls-add ls1

ovn-nbctl lsp-add ls1 ls1-lp1 \
-- lsp-set-addresses ls1-lp1 "f0:00:00:00:00:01 10.0.0.4"

ovn-nbctl lsp-set-port-security ls1-lp1 "f0:00:00:00:00:01 10.0.0.4"

ovn-nbctl lsp-add ls1 ls1-lp2 \
-- lsp-set-addresses ls1-lp2 "f0:00:00:00:00:02 10.0.0.6 20.0.0.4"

ovn-nbctl lsp-set-port-security ls1-lp2 "f0:00:00:00:00:02 10.0.0.6 20.0.0.4"

ovn-nbctl ls-add ls2
ovn-nbctl lsp-add ls2 ls2-lp1 \
-- lsp-set-addresses ls2-lp1 "f0:00:00:00:00:03 30.0.0.6 40.0.0.4"
ovn-nbctl lsp-set-port-security ls2-lp1 "f0:00:00:00:00:03 30.0.0.6 40.0.0.4"
ovn-nbctl lsp-add ls2 ls2-lp2 \
-- lsp-set-addresses ls2-lp2 "f0:00:00:00:00:04 30.0.0.7"
ovn-nbctl lsp-set-port-security ls2-lp2 "f0:00:00:00:00:04 30.0.0.7"

d1="$(ovn-nbctl create DHCP_Options cidr=10.0.0.0/24 \
options="\"server_id\"=\"10.0.0.1\" \"server_mac\"=\"ff:10:00:00:00:01\" \
\"lease_time\"=\"3600\" \"router\"=\"10.0.0.1\"")"

ovn-nbctl lsp-set-dhcpv4-options ls1-lp1 ${d1}
ovn-nbctl lsp-set-dhcpv4-options ls1-lp2 ${d1}

d2="$(ovn-nbctl create DHCP_Options cidr=30.0.0.0/24 \
options="\"server_id\"=\"30.0.0.1\" \"server_mac\"=\"ff:10:00:00:00:02\" \
\"lease_time\"=\"3600\"")"

ovn-nbctl lsp-set-dhcpv4-options ls2-lp2 ${d2}

net_add n1
sim_add hv1

as hv1
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.1
ovs-vsctl -- add-port br-int hv1-vif1 -- \
    set interface hv1-vif1 external-ids:iface-id=ls1-lp1 \
    options:tx_pcap=hv1/vif1-tx.pcap \
    options:rxq_pcap=hv1/vif1-rx.pcap \
    ofport-request=1

ovs-vsctl -- add-port br-int hv1-vif2 -- \
    set interface hv1-vif2 external-ids:iface-id=ls1-lp2 \
    options:tx_pcap=hv1/vif2-tx.pcap \
    options:rxq_pcap=hv1/vif2-rx.pcap \
    ofport-request=2

ovs-vsctl -- add-port br-int hv1-vif3 -- \
    set interface hv1-vif3 external-ids:iface-id=ls2-lp1 \
    options:tx_pcap=hv1/vif3-tx.pcap \
    options:rxq_pcap=hv1/vif3-rx.pcap \
    ofport-request=3

ovs-vsctl -- add-port br-int hv1-vif4 -- \
    set interface hv1-vif4 external-ids:iface-id=ls2-lp2 \
    options:tx_pcap=hv1/vif4-tx.pcap \
    options:rxq_pcap=hv1/vif4-rx.pcap \
    ofport-request=4

{ set +x
$as_echo "$at_srcdir/ovn.at:4591: ovn_populate_arp__"
at_fn_check_prepare_trace "ovn.at:4591"
( $at_check_trace; ovn_populate_arp__
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4591"
$at_failed && at_fn_log_failure
$at_traceon; }


sleep 2

as hv1 ovs-vsctl show

# This shell function sends a DHCP request packet
# test_dhcp INPORT SRC_MAC DHCP_TYPE OFFER_IP REQUEST_IP ...
test_dhcp() {
    local inport=$1 src_mac=$2 dhcp_type=$3 ciaddr=$4 offer_ip=$5 request_ip=$6 use_ip=$7
    shift; shift; shift; shift; shift; shift; shift;
    if test $use_ip != 0; then
        src_ip=$1
        dst_ip=$2
        shift; shift;
    else
        src_ip=`ip_to_hex 0 0 0 0`
        dst_ip=`ip_to_hex 255 255 255 255`
    fi
    if test $request_ip != 0; then
        ip_len=0120
        udp_len=010b
    else
        ip_len=011a
        udp_len=0106
    fi
    local request=ffffffffffff${src_mac}08004510${ip_len}0000000080110000${src_ip}${dst_ip}
    # udp header and dhcp header
    request=${request}00440043${udp_len}0000
    request=${request}010106006359aa7600000000${ciaddr}000000000000000000000000${src_mac}
    # client hardware padding
    request=${request}00000000000000000000
    # server hostname
    request=${request}0000000000000000000000000000000000000000000000000000000000000000
    request=${request}0000000000000000000000000000000000000000000000000000000000000000
    # boot file name
    request=${request}0000000000000000000000000000000000000000000000000000000000000000
    request=${request}0000000000000000000000000000000000000000000000000000000000000000
    request=${request}0000000000000000000000000000000000000000000000000000000000000000
    request=${request}0000000000000000000000000000000000000000000000000000000000000000
    # dhcp magic cookie
    request=${request}63825363
    # dhcp message type
    request=${request}3501${dhcp_type}
    # dhcp unknown option
    request=${request}d70701020304050607
    # dhcp pad option
    request=${request}00
    if test $request_ip != 0; then
        # dhcp requested ip
        request=${request}3204${request_ip}
    fi
    # dhcp end option
    request=${request}ff

    for port in $inport "$@"; do
        : >> $port.expected
    done
    if test $offer_ip != 0; then
        local srv_mac=$1 srv_ip=$2 dhcp_reply_type=$3 expected_dhcp_opts=$4
        # total IP length will be the IP length of the request packet
        # (which is 272 in our case) + 8 (padding bytes) + (expected_dhcp_opts / 2)
        ip_len=`expr 280 + ${#expected_dhcp_opts} / 2`
        udp_len=`expr $ip_len - 20`
        ip_len=$(printf "%x" $ip_len)
        udp_len=$(printf "%x" $udp_len)
        # $ip_len var will be in 3 digits i.e 134. So adding a '0' before $ip_len
        local reply=${src_mac}${srv_mac}080045100${ip_len}000000008011XXXX${srv_ip}${offer_ip}
        # udp header and dhcp header.
        # $udp_len var will be in 3 digits. So adding a '0' before $udp_len
        reply=${reply}004300440${udp_len}0000020106006359aa7600000000${ciaddr}
        # your ip address; 0 for NAK
        if test $dhcp_reply_type = 06; then
            reply=${reply}00000000
        else
            reply=${reply}${offer_ip}
        fi
        # next server ip address, relay agent ip address, client mac address
        reply=${reply}0000000000000000${src_mac}
        # client hardware padding
        reply=${reply}00000000000000000000
        # server hostname
        reply=${reply}0000000000000000000000000000000000000000000000000000000000000000
        reply=${reply}0000000000000000000000000000000000000000000000000000000000000000
        # boot file name
        reply=${reply}0000000000000000000000000000000000000000000000000000000000000000
        reply=${reply}0000000000000000000000000000000000000000000000000000000000000000
        reply=${reply}0000000000000000000000000000000000000000000000000000000000000000
        reply=${reply}0000000000000000000000000000000000000000000000000000000000000000
        # dhcp magic cookie
        reply=${reply}63825363
        reply=${reply}3501${dhcp_reply_type}${expected_dhcp_opts}00000000ff00000000
        echo $reply >> $inport.expected
    else
        for outport; do
            echo $request >> $outport.expected
        done
    fi
    as hv1 ovs-appctl netdev-dummy/receive hv1-vif$inport $request
}

reset_pcap_file() {
    local iface=$1
    local pcap_file=$2
    ovs-vsctl -- set Interface $iface options:tx_pcap=dummy-tx.pcap \
options:rxq_pcap=dummy-rx.pcap
    rm -f ${pcap_file}*.pcap
    ovs-vsctl -- set Interface $iface options:tx_pcap=${pcap_file}-tx.pcap \
options:rxq_pcap=${pcap_file}-rx.pcap
}

ip_to_hex() {
    printf "%02x%02x%02x%02x" "$@"
}


as hv1 ovs-ofctl monitor br-int resume --detach --no-chdir \
--pidfile=ovs-ofctl0.pid 2> ofctl_monitor0.log

echo "---------NB dump-----"
ovn-nbctl show
echo "---------------------"
echo "---------SB dump-----"
ovn-sbctl list datapath_binding
echo "---------------------"
ovn-sbctl list logical_flow
echo "---------------------"

echo "---------------------"
ovn-sbctl dump-flows
echo "---------------------"

echo "------ hv1 dump ----------"
as hv1 ovs-ofctl dump-flows br-int

# Send DHCPDISCOVER.
offer_ip=`ip_to_hex 10 0 0 4`
server_ip=`ip_to_hex 10 0 0 1`
ciaddr=`ip_to_hex 0 0 0 0`
request_ip=0
expected_dhcp_opts=330400000e100104ffffff0003040a00000136040a000001
test_dhcp 1 f00000000001 01 $ciaddr $offer_ip $request_ip 0 ff1000000001 $server_ip 02 $expected_dhcp_opts

# NXT_RESUMEs should be 1.
ovs_wait_cond () {
    test 1 = `cat ofctl_monitor*.log | grep -c NXT_RESUME`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4735" "until test 1 = \`cat ofctl_monitor*.log | grep -c NXT_RESUME\`"


$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/vif1-tx.pcap > 1.packets
cat 1.expected | cut -c -48 > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:4739: cat 1.packets | cut -c -48"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:4739"
( $at_check_trace; cat 1.packets | cut -c -48
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4739"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

# Skipping the IPv4 checksum.
cat 1.expected | cut -c 53- > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:4742: cat 1.packets | cut -c 53-"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:4742"
( $at_check_trace; cat 1.packets | cut -c 53-
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4742"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }


# ovs-ofctl also resumes the packets and this causes other ports to receive
# the DHCP request packet. So reset the pcap files so that its easier to test.
reset_pcap_file hv1-vif1 hv1/vif1
reset_pcap_file hv1-vif2 hv1/vif2
rm -f 1.expected
rm -f 2.expected

# Send DHCPREQUEST in the SELECTING/INIT-REBOOT state with the offered IP
# address in the Requested IP Address option.
offer_ip=`ip_to_hex 10 0 0 6`
server_ip=`ip_to_hex 10 0 0 1`
ciaddr=`ip_to_hex 0 0 0 0`
request_ip=$offer_ip
expected_dhcp_opts=330400000e100104ffffff0003040a00000136040a000001
test_dhcp 2 f00000000002 03 $ciaddr $offer_ip $request_ip 0 ff1000000001 $server_ip 05 $expected_dhcp_opts

# NXT_RESUMEs should be 2.
ovs_wait_cond () {
    test 2 = `cat ofctl_monitor*.log | grep -c NXT_RESUME`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4761" "until test 2 = \`cat ofctl_monitor*.log | grep -c NXT_RESUME\`"


$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/vif2-tx.pcap > 2.packets
cat 2.expected | cut -c -48 > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:4765: cat 2.packets | cut -c -48"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:4765"
( $at_check_trace; cat 2.packets | cut -c -48
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4765"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

# Skipping the IPv4 checksum.
cat 2.expected | cut -c 53- > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:4768: cat 2.packets | cut -c 53-"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:4768"
( $at_check_trace; cat 2.packets | cut -c 53-
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4768"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }


reset_pcap_file hv1-vif1 hv1/vif1
reset_pcap_file hv1-vif2 hv1/vif2
rm -f 1.expected
rm -f 2.expected

# Send DHCPREQUEST in the SELECTING/INIT-REBOOT state with a mismatched IP in
# the Requested IP Address option, expect a DHCPNAK.
offer_ip=`ip_to_hex 10 0 0 6`
server_ip=`ip_to_hex 10 0 0 1`
ciaddr=`ip_to_hex 0 0 0 0`
request_ip=`ip_to_hex 10 0 0 7`
expected_dhcp_opts=""
test_dhcp 2 f00000000002 03 $ciaddr $offer_ip $request_ip 0 ff1000000001 $server_ip 06 $expected_dhcp_opts

# NXT_RESUMEs should be 3.
ovs_wait_cond () {
    test 3 = `cat ofctl_monitor*.log | grep -c NXT_RESUME`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4785" "until test 3 = \`cat ofctl_monitor*.log | grep -c NXT_RESUME\`"


$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/vif2-tx.pcap > 2.packets
cat 2.expected | cut -c -48 > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:4789: cat 2.packets | cut -c -48"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:4789"
( $at_check_trace; cat 2.packets | cut -c -48
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4789"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

# Skipping the IPv4 checksum.
cat 2.expected | cut -c 53- > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:4792: cat 2.packets | cut -c 53-"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:4792"
( $at_check_trace; cat 2.packets | cut -c 53-
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4792"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }


reset_pcap_file hv1-vif1 hv1/vif1
reset_pcap_file hv1-vif2 hv1/vif2
rm -f 1.expected
rm -f 2.expected

# Send Invalid DHCPv4 packet on ls1-lp2. It should be received by ovn-controller
# but should be resumed without the reply.
# ls1-lp1 (vif1-tx.pcap) should receive the DHCPv4 request packet twice,
# one from ovn-controller and the other from "ovs-ofctl resume."
ciaddr=`ip_to_hex 0 0 0 0`
offer_ip=0
request_ip=0
test_dhcp 2 f00000000002 08 $ciaddr $offer_ip $request_ip 0 1 1

# NXT_RESUMEs should be 4.
ovs_wait_cond () {
    test 4 = `cat ofctl_monitor*.log | grep -c NXT_RESUME`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4809" "until test 4 = \`cat ofctl_monitor*.log | grep -c NXT_RESUME\`"


# vif1-tx.pcap should have received the DHCPv4 (invalid) request packet
ovn_check_packets__ "hv1/vif1-tx.pcap" "1.expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:4812: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:4812"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4812"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }


reset_pcap_file hv1-vif1 hv1/vif1
reset_pcap_file hv1-vif2 hv1/vif2
rm -f 1.expected
rm -f 2.expected

# Send DHCPv4 packet on ls2-lp1. It doesn't have any DHCPv4 options defined.
# ls2-lp2 (vif4-tx.pcap) should receive the DHCPv4 request packet once.

ciaddr=`ip_to_hex 0 0 0 0`
test_dhcp 3 f00000000003 01 $ciaddr 0 0 4 0

# Send DHCPv4 packet on ls2-lp2. "router" DHCPv4 option is not defined for
# this lport.
ciaddr=`ip_to_hex 0 0 0 0`
test_dhcp 4 f00000000004 01 $ciaddr 0 0 3 0

# NXT_RESUMEs should be 4.
ovs_wait_cond () {
    test 4 = `cat ofctl_monitor*.log | grep -c NXT_RESUME`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4831" "until test 4 = \`cat ofctl_monitor*.log | grep -c NXT_RESUME\`"


#OVN_CHECK_PACKETS([hv1/vif3-tx.pcap], [3.expected])
#OVN_CHECK_PACKETS([hv1/vif4-tx.pcap], [4.expected])

# Send DHCPREQUEST in the RENEWING/REBINDING state with ip4.src set to 10.0.0.6
# and ip4.dst set to 10.0.0.1.
offer_ip=`ip_to_hex 10 0 0 6`
server_ip=`ip_to_hex 10 0 0 1`
ciaddr=$offer_ip
request_ip=0
src_ip=$offer_ip
dst_ip=$server_ip
expected_dhcp_opts=330400000e100104ffffff0003040a00000136040a000001
test_dhcp 2 f00000000002 03 $ciaddr $offer_ip $request_ip 1 $src_ip $dst_ip ff1000000001 $server_ip 05 $expected_dhcp_opts

# NXT_RESUMEs should be 5.
ovs_wait_cond () {
    test 5 = `cat ofctl_monitor*.log | grep -c NXT_RESUME`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4848" "until test 5 = \`cat ofctl_monitor*.log | grep -c NXT_RESUME\`"


$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/vif2-tx.pcap > 2.packets
cat 2.expected | cut -c -48 > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:4852: cat 2.packets | cut -c -48"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:4852"
( $at_check_trace; cat 2.packets | cut -c -48
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4852"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

# Skipping the IPv4 checksum.
cat 2.expected | cut -c 53- > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:4855: cat 2.packets | cut -c 53-"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:4855"
( $at_check_trace; cat 2.packets | cut -c 53-
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4855"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }


reset_pcap_file hv1-vif1 hv1/vif1
reset_pcap_file hv1-vif2 hv1/vif2
rm -f 1.expected
rm -f 2.expected

# Send DHCPREQUEST in the RENEWING/REBINDING state with ip4.src set to 10.0.0.6
# and ip4.dst set to 255.255.255.255.
offer_ip=`ip_to_hex 10 0 0 6`
server_ip=`ip_to_hex 10 0 0 1`
ciaddr=$offer_ip
request_ip=0
src_ip=$offer_ip
dst_ip=`ip_to_hex 255 255 255 255`
expected_dhcp_opts=330400000e100104ffffff0003040a00000136040a000001
test_dhcp 2 f00000000002 03 $ciaddr $offer_ip $request_ip 1 $src_ip $dst_ip ff1000000001 $server_ip 05 $expected_dhcp_opts

# NXT_RESUMEs should be 6.
ovs_wait_cond () {
    test 6 = `cat ofctl_monitor*.log | grep -c NXT_RESUME`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4874" "until test 6 = \`cat ofctl_monitor*.log | grep -c NXT_RESUME\`"


$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/vif2-tx.pcap > 2.packets
cat 2.expected | cut -c -48 > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:4878: cat 2.packets | cut -c -48"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:4878"
( $at_check_trace; cat 2.packets | cut -c -48
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4878"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

# Skipping the IPv4 checksum.
cat 2.expected | cut -c 53- > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:4881: cat 2.packets | cut -c 53-"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:4881"
( $at_check_trace; cat 2.packets | cut -c 53-
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4881"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }


reset_pcap_file hv1-vif1 hv1/vif1
reset_pcap_file hv1-vif2 hv1/vif2
rm -f 1.expected
rm -f 2.expected

# Send DHCPREQUEST in the RENEWING/REBINDING state with a mismatched IP in the
# ciaddr, expect a DHCPNAK.
offer_ip=`ip_to_hex 10 0 0 6`
server_ip=`ip_to_hex 10 0 0 1`
ciaddr=`ip_to_hex 10 0 0 7`
request_ip=0
src_ip=$offer_ip
dst_ip=`ip_to_hex 255 255 255 255`
expected_dhcp_opts=""
test_dhcp 2 f00000000002 03 $ciaddr $offer_ip $request_ip 1 $src_ip $dst_ip ff1000000001 $server_ip 06 $expected_dhcp_opts

# NXT_RESUMEs should be 7.
ovs_wait_cond () {
    test 7 = `cat ofctl_monitor*.log | grep -c NXT_RESUME`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4900" "until test 7 = \`cat ofctl_monitor*.log | grep -c NXT_RESUME\`"


$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/vif2-tx.pcap > 2.packets
cat 2.expected | cut -c -48 > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:4904: cat 2.packets | cut -c -48"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:4904"
( $at_check_trace; cat 2.packets | cut -c -48
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4904"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

# Skipping the IPv4 checksum.
cat 2.expected | cut -c 53- > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:4907: cat 2.packets | cut -c 53-"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:4907"
( $at_check_trace; cat 2.packets | cut -c 53-
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4907"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }


reset_pcap_file hv1-vif1 hv1/vif1
reset_pcap_file hv1-vif2 hv1/vif2
rm -f 1.expected
rm -f 2.expected

# Send DHCPREQUEST in the RENEWING/REBINDING state without a specifyied ciaddr,
# expect a DHCPNAK.
offer_ip=`ip_to_hex 10 0 0 6`
server_ip=`ip_to_hex 10 0 0 1`
ciaddr=`ip_to_hex 0 0 0 0`
request_ip=0
src_ip=$offer_ip
dst_ip=`ip_to_hex 255 255 255 255`
expected_dhcp_opts=""
test_dhcp 2 f00000000002 03 $ciaddr $offer_ip $request_ip 1 $src_ip $dst_ip ff1000000001 $server_ip 06 $expected_dhcp_opts

# NXT_RESUMEs should be 8.
ovs_wait_cond () {
    test 8 = `cat ofctl_monitor*.log | grep -c NXT_RESUME`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4926" "until test 8 = \`cat ofctl_monitor*.log | grep -c NXT_RESUME\`"


$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/vif2-tx.pcap > 2.packets
cat 2.expected | cut -c -48 > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:4930: cat 2.packets | cut -c -48"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:4930"
( $at_check_trace; cat 2.packets | cut -c -48
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4930"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

# Skipping the IPv4 checksum.
cat 2.expected | cut -c 53- > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:4933: cat 2.packets | cut -c 53-"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:4933"
( $at_check_trace; cat 2.packets | cut -c 53-
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4933"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }


reset_pcap_file hv1-vif1 hv1/vif1
reset_pcap_file hv1-vif2 hv1/vif2
rm -f 1.expected
rm -f 2.expected

# Send DHCPREQUEST with ip4.src set to 10.0.0.6 and ip4.dst set to 10.0.0.4.
# The packet should not be received by ovn-controller.
ciaddr=`ip_to_hex 0 0 0 0`
src_ip=`ip_to_hex 10 0 0 6`
dst_ip=`ip_to_hex 10 0 0 4`
test_dhcp 2 f00000000002 03 $ciaddr 0 0 1 $src_ip $dst_ip 1

# NXT_RESUMEs should be 8.
ovs_wait_cond () {
    test 8 = `cat ofctl_monitor*.log | grep -c NXT_RESUME`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4948" "until test 8 = \`cat ofctl_monitor*.log | grep -c NXT_RESUME\`"


# vif1-tx.pcap should have received the DHCPv4 request packet
ovn_check_packets__ "hv1/vif1-tx.pcap" "1.expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:4951: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:4951"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4951"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }





    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:4953: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:4953"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4953"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4953: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:4953"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4953"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4953" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:4953: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:4953"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4953"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4953: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:4953"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4953"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4953" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:4953: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:4953"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4953"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4953: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:4953"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4953"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4953" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:4953: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:4953"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4953"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4953: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:4953"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4953"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4953" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:4953: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:4953"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4953"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4953: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:4953"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4953"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4953" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:4953: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:4953"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4953"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4953: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:4953"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4953"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4953" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:4953: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:4953"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4953"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4953: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:4953"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4953"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4953" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:4953: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:4953"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4953"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4953: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:4953"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4953"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4953" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:4953: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:4953"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4953"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4953: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:4953"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4953"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4953" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:4953: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:4953"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4953"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4953: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:4953"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4953"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4953" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:4953: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:4953"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4953"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:4953: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:4953"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:4953"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:4953" "while kill -0 \$TMPPID 2>/dev/null"




ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_45
#AT_START_46
at_fn_group_banner 46 'ovn.at:4957' \
  "ovn -- dhcpv6 : 1 HV, 2 LS, 5 LSPs" "             " 2
at_xfail=no
(
  $as_echo "46. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

ovn-nbctl ls-add ls1
ovn-nbctl lsp-add ls1 ls1-lp1 \
-- lsp-set-addresses ls1-lp1 "f0:00:00:00:00:01 10.0.0.4 ae70::4"

ovn-nbctl lsp-set-port-security ls1-lp1 "f0:00:00:00:00:01 10.0.0.4 ae70::4"

ovn-nbctl lsp-add ls1 ls1-lp2 \
-- lsp-set-addresses ls1-lp2 "f0:00:00:00:00:02 ae70::5"

ovn-nbctl lsp-set-port-security ls1-lp2 "f0:00:00:00:00:02 ae70::5"

ovn-nbctl lsp-add ls1 ls1-lp3 \
-- lsp-set-addresses ls1-lp3 "f0:00:00:00:00:22 ae70::22"

ovn-nbctl lsp-set-port-security ls1-lp3 "f0:00:00:00:00:22 ae70::22"

d1="$(ovn-nbctl create DHCP_Options cidr="ae70\:\:/64" \
options="\"server_id\"=\"00:00:00:10:00:01\"")"

ovn-nbctl lsp-set-dhcpv6-options ls1-lp1 ${d1}
ovn-nbctl lsp-set-dhcpv6-options ls1-lp2 ${d1}

d2="$(ovn-nbctl create DHCP_Options cidr="ae70\:\:/64" \
options="\"dhcpv6_stateless\"=\"true\" \"server_id\"=\"00:00:00:10:00:01\"")"

ovn-nbctl lsp-set-dhcpv6-options ls1-lp3 ${d2}

ovn-nbctl ls-add ls2
ovn-nbctl lsp-add ls2 ls2-lp1 \
-- lsp-set-addresses ls2-lp1 "f0:00:00:00:00:03 be70::3"
ovn-nbctl lsp-set-port-security ls2-lp1 "f0:00:00:00:00:03 be70::3"
ovn-nbctl lsp-add ls2 ls2-lp2 \
-- lsp-set-addresses ls2-lp2 "f0:00:00:00:00:04 be70::4"
ovn-nbctl lsp-set-port-security ls2-lp2 "f0:00:00:00:00:04 be70::4"

net_add n1
sim_add hv1

as hv1
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.1
ovs-vsctl -- add-port br-int hv1-vif1 -- \
    set interface hv1-vif1 external-ids:iface-id=ls1-lp1 \
    options:tx_pcap=hv1/vif1-tx.pcap \
    options:rxq_pcap=hv1/vif1-rx.pcap \
    ofport-request=1

ovs-vsctl -- add-port br-int hv1-vif2 -- \
    set interface hv1-vif2 external-ids:iface-id=ls1-lp2 \
    options:tx_pcap=hv1/vif2-tx.pcap \
    options:rxq_pcap=hv1/vif2-rx.pcap \
    ofport-request=2

ovs-vsctl -- add-port br-int hv1-vif3 -- \
    set interface hv1-vif3 external-ids:iface-id=ls2-lp1 \
    options:tx_pcap=hv1/vif3-tx.pcap \
    options:rxq_pcap=hv1/vif3-rx.pcap \
    ofport-request=3

ovs-vsctl -- add-port br-int hv1-vif4 -- \
    set interface hv1-vif4 external-ids:iface-id=ls2-lp2 \
    options:tx_pcap=hv1/vif4-tx.pcap \
    options:rxq_pcap=hv1/vif4-rx.pcap \
    ofport-request=4

ovs-vsctl -- add-port br-int hv1-vif5 -- \
    set interface hv1-vif5 external-ids:iface-id=ls1-lp3 \
    options:tx_pcap=hv1/vif5-tx.pcap \
    options:rxq_pcap=hv1/vif5-rx.pcap \
    ofport-request=5

{ set +x
$as_echo "$at_srcdir/ovn.at:5031: ovn_populate_arp__"
at_fn_check_prepare_trace "ovn.at:5031"
( $at_check_trace; ovn_populate_arp__
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5031"
$at_failed && at_fn_log_failure
$at_traceon; }


sleep 2

trim_zeros() {
    sed 's/\(00\)\{1,\}$//'
}

# This shell function sends a DHCPv6 request packet
# test_dhcpv6 INPORT SRC_MAC SRC_LLA DHCPv6_MSG_TYPE OFFER_IP OUTPORT...
# The OUTPORTs (zero or more) list the VIFs on which the original DHCPv6
# packet should be received twice (one from ovn-controller and the other
# from the "ovs-ofctl monitor br-int resume"
test_dhcpv6() {
    local inport=$1 src_mac=$2 src_lla=$3 msg_code=$4 offer_ip=$5
    if test $msg_code != 0b; then
        req_len=2a
    else
        req_len=1a
    fi
    local request=ffffffffffff${src_mac}86dd0000000000${req_len}1101${src_lla}
    # dst ip ff02::1:2
    request=${request}ff020000000000000000000000010002
    # udp header and dhcpv6 header
    request=${request}0222022300${req_len}ffff${msg_code}010203
    # Client identifier
    request=${request}0001000a00030001${src_mac}
    # Add IA-NA (Identity Association for Non Temporary Address) if msg_code
    # is not 11 (information request packet)
    if test $msg_code != 0b; then
        request=${request}0003000c0102030400000e1000001518
    fi
    shift; shift; shift; shift; shift;
    if test $offer_ip != 0; then
        local server_mac=000000100001
        local server_lla=fe80000000000000020000fffe100001
        local reply_code=07
        if test $msg_code = 01; then
            reply_code=02
        fi
        local msg_len=54
        if test $offer_ip = 1; then
            msg_len=28
        fi
        local reply=${src_mac}${server_mac}86dd0000000000${msg_len}1101${server_lla}${src_lla}
        # udp header and dhcpv6 header
        reply=${reply}0223022200${msg_len}ffff${reply_code}010203
        # Client identifier
        reply=${reply}0001000a00030001${src_mac}
        # IA-NA
        if test $offer_ip != 1; then
            reply=${reply}0003002801020304ffffffffffffffff00050018${offer_ip}ffffffffffffffff
        fi
        # Server identifier
        reply=${reply}0002000a00030001${server_mac}
        echo $reply | trim_zeros >> $inport.expected
    else
        for outport; do
            echo $request | trim_zeros >> $outport.expected
        done
    fi

    as hv1 ovs-appctl netdev-dummy/receive hv1-vif$inport $request
}

reset_pcap_file() {
    local iface=$1
    local pcap_file=$2
    ovs-vsctl -- set Interface $iface options:tx_pcap=dummy-tx.pcap \
options:rxq_pcap=dummy-rx.pcap
    rm -f ${pcap_file}*.pcap
    ovs-vsctl -- set Interface $iface options:tx_pcap=${pcap_file}-tx.pcap \
options:rxq_pcap=${pcap_file}-rx.pcap
}


as hv1 ovs-ofctl monitor br-int resume --detach --no-chdir \
--pidfile=ovs-ofctl0.pid 2> ofctl_monitor0.log

echo "---------NB dump-----"
ovn-nbctl show
echo "---------------------"
echo "---------SB dump-----"
ovn-sbctl list datapath_binding
echo "---------------------"
ovn-sbctl list logical_flow
echo "---------------------"

echo "---------------------"
ovn-sbctl dump-flows
echo "---------------------"

echo "------ hv1 dump ----------"
as hv1 ovs-ofctl dump-flows br-int

src_mac=f00000000001
src_lla=fe80000000000000f20000fffe000001
offer_ip=ae700000000000000000000000000004
test_dhcpv6 1 $src_mac $src_lla 01 $offer_ip

# NXT_RESUMEs should be 1.
ovs_wait_cond () {
    test 1 = `cat ofctl_monitor*.log | grep -c NXT_RESUME`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5132" "until test 1 = \`cat ofctl_monitor*.log | grep -c NXT_RESUME\`"


$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/vif1-tx.pcap | trim_zeros > 1.packets
# cat 1.expected | trim_zeros > expout
cat 1.expected | cut -c -120 > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:5137: cat 1.packets | cut -c -120"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:5137"
( $at_check_trace; cat 1.packets | cut -c -120
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5137"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

# Skipping the UDP checksum
cat 1.expected | cut -c 125- > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:5140: cat 1.packets | cut -c 125-"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:5140"
( $at_check_trace; cat 1.packets | cut -c 125-
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5140"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }


rm  1.expected

# Send invalid packet on ls1-lp2. ovn-controller should resume the packet
# without any modifications and the packet should be received by ls1-lp1.
# ls1-lp1 will receive the packet twice, one from the ovn-controller after the
# resume and the other from ovs-ofctl monitor resume.

reset_pcap_file hv1-vif1 hv1/vif1
reset_pcap_file hv1-vif2 hv1/vif2

src_mac=f00000000002
src_lla=fe80000000000000f20000fffe000002
offer_ip=ae700000000000000000000000000005
# Set invalid msg_type

test_dhcpv6 2 $src_mac $src_lla 10 0 1 1

# NXT_RESUMEs should be 2.
ovs_wait_cond () {
    test 2 = `cat ofctl_monitor*.log | grep -c NXT_RESUME`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5160" "until test 2 = \`cat ofctl_monitor*.log | grep -c NXT_RESUME\`"


# vif2-tx.pcap should not have received the DHCPv6 reply packet
rm 2.packets
$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/vif2-tx.pcap | trim_zeros > 2.packets
{ set +x
$as_echo "$at_srcdir/ovn.at:5165: cat 2.packets"
at_fn_check_prepare_trace "ovn.at:5165"
( $at_check_trace; cat 2.packets
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5165"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }


# vif1-tx.pcap should have received the DHCPv6 (invalid) request packet
$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/vif1-tx.pcap | trim_zeros > 1.packets
cat 1.expected > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:5170: cat 1.packets"
at_fn_check_prepare_trace "ovn.at:5170"
( $at_check_trace; cat 1.packets
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5170"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }


# Send DHCPv6 packet on ls2-lp1. native DHCPv6 is disabled on this port.
# There should be no DHCPv6 reply from ovn-controller and the request packet
# should be received by ls2-lp2.

src_mac=f00000000003
src_lla=fe80000000000000f20000fffe000003
test_dhcpv6 3 $src_mac $src_lla 01 0 4

# NXT_RESUMEs should be 2 only.
ovs_wait_cond () {
    test 2 = `cat ofctl_monitor*.log | grep -c NXT_RESUME`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5181" "until test 2 = \`cat ofctl_monitor*.log | grep -c NXT_RESUME\`"


# vif3-tx.pcap should not have received the DHCPv6 reply packet
$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/vif3-tx.pcap | trim_zeros > 3.packets
{ set +x
$as_echo "$at_srcdir/ovn.at:5185: cat 3.packets"
at_fn_check_prepare_trace "ovn.at:5185"
( $at_check_trace; cat 3.packets
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5185"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }


# vif4-tx.pcap should have received the DHCPv6 request packet
$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/vif4-tx.pcap | trim_zeros > 4.packets
cat 4.expected > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:5190: cat 4.packets"
at_fn_check_prepare_trace "ovn.at:5190"
( $at_check_trace; cat 4.packets
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5190"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }


# Send DHCPv6 packet on ls1-lp3. native DHCPv6 works as stateless mode for this port.
# The DHCPv6 reply shouldn't contain offer_ip.
src_mac=f00000000022
src_lla=fe80000000000000f20000fffe000022
reset_pcap_file hv1-vif5 hv1/vif5
test_dhcpv6 5 $src_mac $src_lla 01 1 5

# NXT_RESUMEs should be 3.
ovs_wait_cond () {
    test 3 = `cat ofctl_monitor*.log | grep -c NXT_RESUME`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5200" "until test 3 = \`cat ofctl_monitor*.log | grep -c NXT_RESUME\`"


$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/vif5-tx.pcap | trim_zeros > 5.packets
# Skipping the UDP checksum
cat 5.expected | cut -c 1-120,125- > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:5205: cat 5.packets | cut -c 1-120,125- "
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:5205"
( $at_check_trace; cat 5.packets | cut -c 1-120,125-
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5205"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }


# Send DHCPv6 information request (code 11) on ls1-lp3. The DHCPv6 reply
# shouldn't contain offer_ip
src_mac=f00000000022
src_lla=fe80000000000000f20000fffe000022
reset_pcap_file hv1-vif5 hv1/vif5
rm -f 5.expected
test_dhcpv6 5 $src_mac $src_lla 0b 1 5

# NXT_RESUMEs should be 4.
ovs_wait_cond () {
    test 4 = `cat ofctl_monitor*.log | grep -c NXT_RESUME`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5216" "until test 4 = \`cat ofctl_monitor*.log | grep -c NXT_RESUME\`"


$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/vif5-tx.pcap |
trim_zeros > 5.packets
# Skipping the UDP checksum
cat 5.expected | cut -c 1-120,125- > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:5222: cat 5.packets | cut -c 1-120,125- "
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:5222"
( $at_check_trace; cat 5.packets | cut -c 1-120,125-
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5222"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }





    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:5224: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:5224"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5224"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5224: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:5224"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5224"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5224" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:5224: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:5224"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5224"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5224: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:5224"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5224"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5224" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:5224: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:5224"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5224"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5224: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:5224"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5224"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5224" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:5224: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:5224"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5224"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5224: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:5224"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5224"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5224" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:5224: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:5224"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5224"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5224: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:5224"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5224"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5224" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:5224: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:5224"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5224"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5224: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:5224"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5224"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5224" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:5224: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:5224"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5224"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5224: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:5224"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5224"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5224" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:5224: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:5224"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5224"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5224: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:5224"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5224"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5224" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:5224: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:5224"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5224"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5224: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:5224"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5224"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5224" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:5224: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:5224"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5224"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5224: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:5224"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5224"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5224" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:5224: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:5224"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5224"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5224: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:5224"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5224"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5224" "while kill -0 \$TMPPID 2>/dev/null"




ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_46
#AT_START_47
at_fn_group_banner 47 'ovn.at:5228' \
  "ovn -- 2 HVs, 2 LRs connected via LS, gateway router" "" 2
at_xfail=no
(
  $as_echo "47. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

# Logical network:
# Two LRs - R1 and R2 that are connected to each other via LS "join"
# in 20.0.0.0/24 network. R1 has switchess foo (192.168.1.0/24)
# connected to it. R2 has alice (172.16.1.0/24) connected to it.
# R2 is a gateway router.



# Create two hypervisor and create OVS ports corresponding to logical ports.
net_add n1

sim_add hv1
as hv1
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.1
ovs-vsctl -- add-port br-int hv1-vif1 -- \
    set interface hv1-vif1 external-ids:iface-id=foo1 \
    options:tx_pcap=hv1/vif1-tx.pcap \
    options:rxq_pcap=hv1/vif1-rx.pcap \
    ofport-request=1


sim_add hv2
as hv2
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.2
ovs-vsctl -- add-port br-int hv2-vif1 -- \
    set interface hv2-vif1 external-ids:iface-id=alice1 \
    options:tx_pcap=hv2/vif1-tx.pcap \
    options:rxq_pcap=hv2/vif1-rx.pcap \
    ofport-request=1

# Pre-populate the hypervisors' ARP tables so that we don't lose any
# packets for ARP resolution (native tunneling doesn't queue packets
# for ARP resolution).
{ set +x
$as_echo "$at_srcdir/ovn.at:5266: ovn_populate_arp__"
at_fn_check_prepare_trace "ovn.at:5266"
( $at_check_trace; ovn_populate_arp__
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5266"
$at_failed && at_fn_log_failure
$at_traceon; }


ovn-nbctl create Logical_Router name=R1
ovn-nbctl create Logical_Router name=R2 options:chassis="hv2"

ovn-nbctl ls-add foo
ovn-nbctl ls-add alice
ovn-nbctl ls-add join

# Connect foo to R1
ovn-nbctl lrp-add R1 foo 00:00:01:01:02:03 192.168.1.1/24
ovn-nbctl lsp-add foo rp-foo -- set Logical_Switch_Port rp-foo \
    type=router options:router-port=foo addresses=\"00:00:01:01:02:03\"

# Connect alice to R2
ovn-nbctl lrp-add R2 alice 00:00:02:01:02:03 172.16.1.1/24
ovn-nbctl lsp-add alice rp-alice -- set Logical_Switch_Port rp-alice \
    type=router options:router-port=alice addresses=\"00:00:02:01:02:03\"

# Connect R1 to join
ovn-nbctl lrp-add R1 R1_join 00:00:04:01:02:03 20.0.0.1/24
ovn-nbctl lsp-add join r1-join -- set Logical_Switch_Port r1-join \
    type=router options:router-port=R1_join addresses='"00:00:04:01:02:03"'

# Connect R2 to join
ovn-nbctl lrp-add R2 R2_join 00:00:04:01:02:04 20.0.0.2/24
ovn-nbctl lsp-add join r2-join -- set Logical_Switch_Port r2-join \
    type=router options:router-port=R2_join addresses='"00:00:04:01:02:04"'


#install static routes
ovn-nbctl -- --id=@lrt create Logical_Router_Static_Route \
ip_prefix=172.16.1.0/24 nexthop=20.0.0.2 -- add Logical_Router \
R1 static_routes @lrt

ovn-nbctl -- --id=@lrt create Logical_Router_Static_Route \
ip_prefix=192.168.1.0/24 nexthop=20.0.0.1 -- add Logical_Router \
R2 static_routes @lrt

# Create logical port foo1 in foo
ovn-nbctl lsp-add foo foo1 \
-- lsp-set-addresses foo1 "f0:00:00:01:02:03 192.168.1.2"

# Create logical port alice1 in alice
ovn-nbctl lsp-add alice alice1 \
-- lsp-set-addresses alice1 "f0:00:00:01:02:04 172.16.1.2"


# Allow some time for ovn-northd and ovn-controller to catch up.
# XXX This should be more systematic.
sleep 2

ip_to_hex() {
    printf "%02x%02x%02x%02x" "$@"
}

# Send ip packets between foo1 and alice1
src_mac="f00000010203"
dst_mac="000001010203"
src_ip=`ip_to_hex 192 168 1 2`
dst_ip=`ip_to_hex 172 16 1 2`
packet=${dst_mac}${src_mac}08004500001c0000000040110000${src_ip}${dst_ip}0035111100080000

echo "---------NB dump-----"
ovn-nbctl show
echo "---------------------"
ovn-nbctl list logical_router
echo "---------------------"
ovn-nbctl list logical_router_port
echo "---------------------"

echo "---------SB dump-----"
ovn-sbctl list datapath_binding
echo "---------------------"
ovn-sbctl list port_binding
echo "---------------------"
ovn-sbctl dump-flows
echo "---------------------"
ovn-sbctl list chassis
ovn-sbctl list encap
echo "---------------------"

# Packet to Expect at alice1
src_mac="000002010203"
dst_mac="f00000010204"
src_ip=`ip_to_hex 192 168 1 2`
dst_ip=`ip_to_hex 172 16 1 2`
expected=${dst_mac}${src_mac}08004500001c000000003e110200${src_ip}${dst_ip}0035111100080000


as hv1 ovs-appctl netdev-dummy/receive hv1-vif1 $packet
as hv1 ovs-appctl ofproto/trace br-int in_port=1 $packet

echo "------ hv1 dump after packet 1 ----------"
as hv1 ovs-ofctl show br-int
as hv1 ovs-ofctl dump-flows br-int
echo "------ hv2 dump after packet 1 ----------"
as hv2 ovs-ofctl show br-int
as hv2 ovs-ofctl dump-flows br-int
echo "----------------------------"

echo $expected > expected
ovn_check_packets__ "hv2/vif1-tx.pcap" "expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:5368: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:5368"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5368"
$at_failed && at_fn_log_failure
$at_traceon; }


# Delete the router and re-create it. Things should work as before.
ovn-nbctl  lr-del R2
ovn-nbctl create Logical_Router name=R2 options:chassis="hv2"
# Connect alice to R2
ovn-nbctl lrp-add R2 alice 00:00:02:01:02:03 172.16.1.1/24
# Connect R2 to join
ovn-nbctl lrp-add R2 R2_join 00:00:04:01:02:04 20.0.0.2/24

ovn-nbctl -- --id=@lrt create Logical_Router_Static_Route \
ip_prefix=192.168.1.0/24 nexthop=20.0.0.1 -- add Logical_Router \
R2 static_routes @lrt

# Wait for ovn-controller to catch up.
sleep 1

# Send the packet again.
as hv1 ovs-appctl netdev-dummy/receive hv1-vif1 $packet

echo "------ hv1 dump after packet 2 ----------"
as hv1 ovs-ofctl show br-int
as hv1 ovs-ofctl dump-flows br-int
echo "------ hv2 dump after packet 2 ----------"
as hv2 ovs-ofctl show br-int
as hv2 ovs-ofctl dump-flows br-int
echo "----------------------------"

echo $expected >> expected
ovn_check_packets__ "hv2/vif1-tx.pcap" "expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:5397: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:5397"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5397"
$at_failed && at_fn_log_failure
$at_traceon; }





    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:5399: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:5399"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5399"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5399: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:5399"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5399"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5399" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:5399: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:5399"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5399"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5399: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:5399"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5399"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5399" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:5399: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:5399"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5399"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5399: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:5399"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5399"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5399" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:5399: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:5399"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5399"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5399: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:5399"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5399"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5399" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:5399: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:5399"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5399"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5399: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:5399"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5399"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5399" "while kill -0 \$TMPPID 2>/dev/null"





    as hv2
    if test "hv2" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:5399: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:5399"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5399"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5399: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:5399"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5399"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5399" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:5399: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:5399"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5399"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5399: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:5399"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5399"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5399" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:5399: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:5399"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5399"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5399: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:5399"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5399"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5399" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv2
    { set +x
$as_echo "$at_srcdir/ovn.at:5399: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:5399"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5399"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5399: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:5399"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5399"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5399" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:5399: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:5399"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5399"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5399: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:5399"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5399"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5399" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:5399: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:5399"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5399"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5399: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:5399"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5399"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5399" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:5399: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:5399"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5399"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5399: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:5399"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5399"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5399" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:5399: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:5399"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5399"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5399: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:5399"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5399"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5399" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:5399: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:5399"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5399"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5399: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:5399"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5399"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5399" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:5399: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:5399"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5399"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5399: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:5399"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5399"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5399" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:5399: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:5399"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5399"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5399: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:5399"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5399"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5399" "while kill -0 \$TMPPID 2>/dev/null"




ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_47
#AT_START_48
at_fn_group_banner 48 'ovn.at:5403' \
  "ovn -- icmp_reply: 1 HVs, 2 LSs, 1 lport/LS, 1 LR" "" 2
at_xfail=no
(
  $as_echo "48. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init


ovn_start

# Logical network:
# One LR - R1 has switch ls1 (191.168.1.0/24) connected to it,
# and has switch ls2 (172.16.1.0/24) connected to it.

ovn-nbctl lr-add R1

ovn-nbctl ls-add ls1
ovn-nbctl ls-add ls2

# Connect ls1 to R1
ovn-nbctl lrp-add R1 ls1 00:00:00:01:02:f1 192.168.1.1/24
ovn-nbctl lsp-add ls1 rp-ls1 -- set Logical_Switch_Port rp-ls1 \
    type=router options:router-port=ls1 addresses=\"00:00:00:01:02:f1\"

# Connect ls2 to R1
ovn-nbctl lrp-add R1 ls2 00:00:00:01:02:f2 172.16.1.1/24
ovn-nbctl lsp-add ls2 rp-ls2 -- set Logical_Switch_Port rp-ls2 \
    type=router options:router-port=ls2 addresses=\"00:00:00:01:02:f2\"

# Create logical port ls1-lp1 in ls1
ovn-nbctl lsp-add ls1 ls1-lp1 \
-- lsp-set-addresses ls1-lp1 "00:00:00:01:02:03 192.168.1.2"

# Create logical port ls2-lp1 in ls2
ovn-nbctl lsp-add ls2 ls2-lp1 \
-- lsp-set-addresses ls2-lp1 "00:00:00:01:02:04 172.16.1.2"

# Create one hypervisor and create OVS ports corresponding to logical ports.
net_add n1

sim_add hv1
as hv1
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.1
ovs-vsctl -- add-port br-int vif1 -- \
    set interface vif1 external-ids:iface-id=ls1-lp1 \
    options:tx_pcap=hv1/vif1-tx.pcap \
    options:rxq_pcap=hv1/vif1-rx.pcap \
    ofport-request=1

ovs-vsctl -- add-port br-int vif2 -- \
    set interface vif2 external-ids:iface-id=ls2-lp1 \
    options:tx_pcap=hv1/vif2-tx.pcap \
    options:rxq_pcap=hv1/vif2-rx.pcap \
    ofport-request=1


# Allow some time for ovn-northd and ovn-controller to catch up.
# XXX This should be more systematic.
sleep 1


ip_to_hex() {
    printf "%02x%02x%02x%02x" "$@"
}
for i in 1 2; do
    : > vif$i.expected
done
# test_ipv4_icmp_request INPORT ETH_SRC ETH_DST IPV4_SRC IPV4_DST IP_CHKSUM ICMP_CHKSUM [EXP_IP_CHKSUM EXP_ICMP_CHKSUM]
#
# Causes a packet to be received on INPORT.  The packet is an ICMPv4
# request with ETH_SRC, ETH_DST, IPV4_SRC, IPV4_DST, IP_CHSUM and
# ICMP_CHKSUM as specified.  If EXP_IP_CHKSUM and EXP_ICMP_CHKSUM are
# provided, then it should be the ip and icmp checksums of the packet
# responded; otherwise, no reply is expected.
# In the absence of an ip checksum calculation helpers, this relies
# on the caller to provide the checksums for the ip and icmp headers.
# XXX This should be more systematic.
#
# INPORT is an lport number, e.g. 11 for vif11.
# ETH_SRC and ETH_DST are each 12 hex digits.
# IPV4_SRC and IPV4_DST are each 8 hex digits.
# IP_CHSUM and ICMP_CHKSUM are each 4 hex digits.
# EXP_IP_CHSUM and EXP_ICMP_CHKSUM are each 4 hex digits.
test_ipv4_icmp_request() {
    local inport=$1 eth_src=$2 eth_dst=$3 ipv4_src=$4 ipv4_dst=$5 ip_chksum=$6 icmp_chksum=$7
    local exp_ip_chksum=$8 exp_icmp_chksum=$9
    shift; shift; shift; shift; shift; shift; shift
    shift; shift

    # Use ttl to exercise section 4.2.2.9 of RFC1812
    local ip_ttl=01
    local icmp_id=5fbf
    local icmp_seq=0001
    local icmp_data=$(seq 1 56 | xargs printf "%02x")
    local icmp_type_code_request=0800
    local icmp_payload=${icmp_type_code_request}${icmp_chksum}${icmp_id}${icmp_seq}${icmp_data}
    local packet=${eth_dst}${eth_src}08004500005400004000${ip_ttl}01${ip_chksum}${ipv4_src}${ipv4_dst}${icmp_payload}

    as hv1 ovs-appctl netdev-dummy/receive vif$inport $packet
    if test X$exp_icmp_chksum != X; then
        # Expect to receive the reply, if any. In same port where packet was sent.
        # Note: src and dst fields are expected to be reversed.
        local icmp_type_code_response=0000
        local reply_icmp_ttl=fe
        local reply_icmp_payload=${icmp_type_code_response}${exp_icmp_chksum}${icmp_id}${icmp_seq}${icmp_data}
        local reply=${eth_src}${eth_dst}08004500005400004000${reply_icmp_ttl}01${exp_ip_chksum}${ipv4_dst}${ipv4_src}${reply_icmp_payload}
        echo $reply >> vif$inport.expected
    fi
}

# Send ping packet to router's ip addresses, from each of the 2 logical ports.
rtr_l1_ip=$(ip_to_hex 192 168 1 1)
rtr_l2_ip=$(ip_to_hex 172 16 1 1)
l1_ip=$(ip_to_hex 192 168 1 2)
l2_ip=$(ip_to_hex 172 16 1 2)

# Ping router ip address that is on same subnet as the logical port
test_ipv4_icmp_request 1 000000010203 0000000102f1 $l1_ip $rtr_l1_ip 0000 8510 02ff 8d10
test_ipv4_icmp_request 2 000000010204 0000000102f2 $l2_ip $rtr_l2_ip 0000 8510 02ff 8d10

# Ping router ip address that is on the other side of the logical ports
test_ipv4_icmp_request 1 000000010203 0000000102f1 $l1_ip $rtr_l2_ip 0000 8510 02ff 8d10
test_ipv4_icmp_request 2 000000010204 0000000102f2 $l2_ip $rtr_l1_ip 0000 8510 02ff 8d10


echo "---------NB dump-----"
ovn-nbctl show
echo "---------------------"
ovn-nbctl list logical_router
echo "---------------------"
ovn-nbctl list logical_router_port
echo "---------------------"

echo "---------SB dump-----"
ovn-sbctl list datapath_binding
echo "---------------------"
ovn-sbctl list logical_flow
echo "---------------------"

echo "------ hv1 dump ----------"
as hv1 ovs-ofctl dump-flows br-int

# Now check the packets actually received against the ones expected.
for inport in 1 2; do
    ovn_check_packets__ "hv1/vif${inport}-tx.pcap" "vif$inport.expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:5542: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:5542"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5542"
$at_failed && at_fn_log_failure
$at_traceon; }

done




    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:5545: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:5545"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5545"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5545: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:5545"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5545"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5545" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:5545: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:5545"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5545"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5545: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:5545"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5545"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5545" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:5545: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:5545"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5545"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5545: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:5545"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5545"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5545" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:5545: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:5545"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5545"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5545: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:5545"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5545"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5545" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:5545: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:5545"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5545"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5545: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:5545"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5545"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5545" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:5545: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:5545"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5545"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5545: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:5545"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5545"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5545" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:5545: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:5545"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5545"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5545: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:5545"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5545"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5545" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:5545: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:5545"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5545"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5545: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:5545"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5545"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5545" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:5545: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:5545"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5545"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5545: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:5545"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5545"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5545" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:5545: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:5545"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5545"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5545: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:5545"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5545"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5545" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:5545: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:5545"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5545"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5545: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:5545"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5545"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5545" "while kill -0 \$TMPPID 2>/dev/null"



ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_48
#AT_START_49
at_fn_group_banner 49 'ovn.at:5548' \
  "ovn -- policy-based routing: 1 HVs, 2 LSs, 1 lport/LS, 1 LR" "" 2
at_xfail=no
(
  $as_echo "49. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init


ovn_start

# Logical network:
# One LR - R1 has switch ls1 (191.168.1.0/24) connected to it,
# and has switch ls2 (172.16.1.0/24) connected to it.

ovn-nbctl lr-add R1

ovn-nbctl ls-add ls1
ovn-nbctl ls-add ls2
ovn-nbctl ls-add ls3

# Connect ls1 to R1
ovn-nbctl lrp-add R1 ls1 00:00:00:01:02:f1 192.168.1.1/24
ovn-nbctl lsp-add ls1 rp-ls1 -- set Logical_Switch_Port rp-ls1 \
    type=router options:router-port=ls1 addresses=\"00:00:00:01:02:f1\"

# Connect ls2 to R1
ovn-nbctl lrp-add R1 ls2 00:00:00:01:02:f2 172.16.1.1/24
ovn-nbctl lsp-add ls2 rp-ls2 -- set Logical_Switch_Port rp-ls2 \
    type=router options:router-port=ls2 addresses=\"00:00:00:01:02:f2\"

# Connect ls3 to R1
ovn-nbctl lrp-add R1 ls3 00:00:00:01:02:f3 20.20.1.1/24
ovn-nbctl lsp-add ls3 rp-ls3 -- set Logical_Switch_Port rp-ls3 \
    type=router options:router-port=ls3 addresses=\"00:00:00:01:02:f3\"

# Create logical port ls1-lp1 in ls1
ovn-nbctl lsp-add ls1 ls1-lp1 \
-- lsp-set-addresses ls1-lp1 "00:00:00:01:02:03 192.168.1.2"

# Create logical port ls2-lp1 in ls2
ovn-nbctl lsp-add ls2 ls2-lp1 \
-- lsp-set-addresses ls2-lp1 "00:00:00:01:02:04 172.16.1.2"

# Create logical port ls3-lp1 in ls3
ovn-nbctl lsp-add ls3 ls3-lp1 \
-- lsp-set-addresses ls3-lp1 "00:00:00:01:02:05 20.20.1.2"

# Create one hypervisor and create OVS ports corresponding to logical ports.
net_add n1

sim_add pbr-hv
as pbr-hv
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.1

ovs-vsctl -- add-port br-int vif1 -- \
    set interface vif1 external-ids:iface-id=ls1-lp1 \
    options:tx_pcap=pbr-hv/vif1-tx.pcap \
    options:rxq_pcap=pbr-hv/vif1-rx.pcap \
    ofport-request=1

ovs-vsctl -- add-port br-int vif2 -- \
    set interface vif2 external-ids:iface-id=ls2-lp1 \
    options:tx_pcap=pbr-hv/vif2-tx.pcap \
    options:rxq_pcap=pbr-hv/vif2-rx.pcap \
    ofport-request=1

ovs-vsctl -- add-port br-int vif3 -- \
    set interface vif3 external-ids:iface-id=ls3-lp1 \
    options:tx_pcap=pbr-hv/vif3-tx.pcap \
    options:rxq_pcap=pbr-hv/vif3-rx.pcap \
    ofport-request=1

# Allow some time for ovn-northd and ovn-controller to catch up.
# XXX This should be more systematic.
sleep 1

ls1_ro_mac=00:00:00:01:02:f1
ls1_ro_ip=192.168.1.1

ls2_ro_mac=00:00:00:01:02:f2
ls2_ro_ip=172.16.1.1

ls3_ro_mac=00:00:00:01:02:f3

ls1_p1_mac=00:00:00:01:02:03
ls1_p1_ip=192.168.1.2

ls2_p1_mac=00:00:00:01:02:04
ls2_p1_ip=172.16.1.2

ls3_p1_mac=00:00:00:01:02:05

# Create a drop policy
ovn-nbctl lr-policy-add R1 10 "ip4.src==192.168.1.0/24 && ip4.dst==172.16.1.0/24" drop

# Check logical flow
{ set +x
$as_echo "$at_srcdir/ovn.at:5639: ovn-sbctl dump-flows | grep lr_in_policy | grep \"192.168.1.0\" | wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:5639"
( $at_check_trace; ovn-sbctl dump-flows | grep lr_in_policy | grep "192.168.1.0" | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5639"
$at_failed && at_fn_log_failure
$at_traceon; }


# Send packet.
packet="inport==\"ls1-lp1\" && eth.src==$ls1_p1_mac && eth.dst==$ls1_ro_mac &&
       ip4 && ip.ttl==64 && ip4.src==$ls1_p1_ip && ip4.dst==$ls2_p1_ip &&
       udp && udp.src==53 && udp.dst==4369"

as pbr-hv ovs-appctl -t ovn-controller inject-pkt "$packet"

# Check if packet hit the drop policy
{ set +x
$as_echo "$at_srcdir/ovn.at:5651: ovs-ofctl dump-flows br-int | \\
    grep \"nw_src=192.168.1.0/24,nw_dst=172.16.1.0/24 actions=drop\" | \\
    grep \"priority=10\" | \\
    grep \"n_packets=1\" | wc -l"
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:5651"
( $at_check_trace; ovs-ofctl dump-flows br-int | \
    grep "nw_src=192.168.1.0/24,nw_dst=172.16.1.0/24 actions=drop" | \
    grep "priority=10" | \
    grep "n_packets=1" | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5651"
$at_failed && at_fn_log_failure
$at_traceon; }


# Expected to drop the packet.
$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" pbr-hv/vif2-tx.pcap > vif2.packets
rcvd_packet=`cat vif2.packets`
$as_echo "ovn.at:5661" >"$at_check_line_file"
(rcvd_packet = "") \
  && at_fn_check_skip 99 "$at_srcdir/ovn.at:5661"

# Override drop policy with allow
ovn-nbctl lr-policy-add R1 20 "ip4.src==192.168.1.0/24 && ip4.dst==172.16.1.0/24" allow

# Check logical flow
{ set +x
$as_echo "$at_srcdir/ovn.at:5667: ovn-sbctl dump-flows | grep lr_in_policy | grep \"192.168.1.0\" | wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:5667"
( $at_check_trace; ovn-sbctl dump-flows | grep lr_in_policy | grep "192.168.1.0" | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "2
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5667"
$at_failed && at_fn_log_failure
$at_traceon; }


# Send packet.
packet="inport==\"ls1-lp1\" && eth.src==$ls1_p1_mac && eth.dst==$ls1_ro_mac &&
       ip4 && ip.ttl==64 && ip4.src==$ls1_p1_ip && ip4.dst==$ls2_p1_ip &&
       udp && udp.src==53 && udp.dst==4369"
as pbr-hv ovs-appctl -t ovn-controller inject-pkt "$packet"

# Check if packet hit the allow policy
{ set +x
$as_echo "$at_srcdir/ovn.at:5678: ovn-sbctl dump-flows | grep lr_in_policy | \\
    grep \"192.168.1.0\" | \\
    grep \"priority=20\" | wc -l"
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:5678"
( $at_check_trace; ovn-sbctl dump-flows | grep lr_in_policy | \
    grep "192.168.1.0" | \
    grep "priority=20" | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5678"
$at_failed && at_fn_log_failure
$at_traceon; }


# Expected packet has TTL decreased by 1
expected="eth.src==$ls2_ro_mac && eth.dst==$ls2_p1_mac &&
       ip4 && ip.ttl==63 && ip4.src==$ls1_p1_ip && ip4.dst==$ls2_p1_ip &&
       udp && udp.src==53 && udp.dst==4369"
echo $expected | ovstest test-ovn expr-to-packets > expected

ovn_check_packets__ "pbr-hv/vif2-tx.pcap" "expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:5690: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:5690"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5690"
$at_failed && at_fn_log_failure
$at_traceon; }


# Override allow policy with reroute
ovn-nbctl lr-policy-add R1 30 "ip4.src==192.168.1.0/24 && ip4.dst==172.16.1.0/24" reroute 20.20.1.2

# Check logical flow
{ set +x
$as_echo "$at_srcdir/ovn.at:5696: ovn-sbctl dump-flows | grep lr_in_policy | \\
    grep \"192.168.1.0\" | \\
    grep \"priority=30\" | wc -l"
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:5696"
( $at_check_trace; ovn-sbctl dump-flows | grep lr_in_policy | \
    grep "192.168.1.0" | \
    grep "priority=30" | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5696"
$at_failed && at_fn_log_failure
$at_traceon; }


# Send packet.
packet="inport==\"ls1-lp1\" && eth.src==$ls1_p1_mac && eth.dst==$ls1_ro_mac &&
       ip4 && ip.ttl==64 && ip4.src==$ls1_p1_ip && ip4.dst==$ls2_p1_ip &&
       udp && udp.src==53 && udp.dst==4369"
as pbr-hv ovs-appctl -t ovn-controller inject-pkt "$packet"

echo "southbound flows"

ovn-sbctl dump-flows | grep lr_in_policy
echo "ovs flows"
ovs-ofctl dump-flows br-int
# Check if packet hit the allow policy
{ set +x
$as_echo "$at_srcdir/ovn.at:5714: ovs-ofctl dump-flows br-int | \\
    grep \"nw_src=192.168.1.0/24,nw_dst=172.16.1.0/24\" | \\
    grep \"priority=30\" | \\
    grep \"n_packets=1\" | wc -l"
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:5714"
( $at_check_trace; ovs-ofctl dump-flows br-int | \
    grep "nw_src=192.168.1.0/24,nw_dst=172.16.1.0/24" | \
    grep "priority=30" | \
    grep "n_packets=1" | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5714"
$at_failed && at_fn_log_failure
$at_traceon; }

echo "packet hit reroute policy"

# Expected packet has TTL decreased by 1
expected="eth.src==$ls3_ro_mac && eth.dst==$ls3_p1_mac &&
       ip4 && ip.ttl==63 && ip4.src==$ls1_p1_ip && ip4.dst==$ls2_p1_ip &&
       udp && udp.src==53 && udp.dst==4369"
echo $expected | ovstest test-ovn expr-to-packets > 3.expected

ovn_check_packets__ "pbr-hv/vif3-tx.pcap" "3.expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:5728: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:5728"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5728"
$at_failed && at_fn_log_failure
$at_traceon; }





    as pbr-hv
    if test "pbr-hv" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:5730: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:5730"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5730"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5730: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:5730"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5730"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5730" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:5730: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:5730"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5730"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5730: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:5730"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5730"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5730" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:5730: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:5730"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5730"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5730: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:5730"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5730"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5730" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as pbr-hv
    { set +x
$as_echo "$at_srcdir/ovn.at:5730: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:5730"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5730"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5730: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:5730"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5730"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5730" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:5730: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:5730"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5730"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5730: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:5730"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5730"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5730" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:5730: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:5730"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5730"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5730: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:5730"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5730"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5730" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:5730: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:5730"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5730"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5730: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:5730"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5730"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5730" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:5730: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:5730"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5730"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5730: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:5730"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5730"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5730" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:5730: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:5730"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5730"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5730: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:5730"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5730"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5730" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:5730: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:5730"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5730"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5730: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:5730"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5730"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5730" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:5730: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:5730"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5730"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5730: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:5730"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5730"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5730" "while kill -0 \$TMPPID 2>/dev/null"



ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_49
#AT_START_50
at_fn_group_banner 50 'ovn.at:5733' \
  "ovn -- policy-based routing IPv6: 1 HVs, 3 LSs, 1 lport/LS, 1 LR" "" 2
at_xfail=no
(
  $as_echo "50. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init


ovn_start

# Logical network:
# One LR - R1 has switch ls1 (191.168.1.0/24) connected to it,
# and has switch ls2 (172.16.1.0/24) connected to it.

ovn-nbctl lr-add R1

ovn-nbctl ls-add ls1
ovn-nbctl ls-add ls2
ovn-nbctl ls-add ls3

# Connect ls1 to R1
ovn-nbctl lrp-add R1 ls1 00:00:00:01:02:f1 2001::1/64
ovn-nbctl lsp-add ls1 rp-ls1 -- set Logical_Switch_Port rp-ls1 \
    type=router options:router-port=ls1 addresses=\"00:00:00:01:02:f1\"

# Connect ls2 to R1
ovn-nbctl lrp-add R1 ls2 00:00:00:01:02:f2 2002::1/64
ovn-nbctl lsp-add ls2 rp-ls2 -- set Logical_Switch_Port rp-ls2 \
    type=router options:router-port=ls2 addresses=\"00:00:00:01:02:f2\"

# Connect ls3 to R1
ovn-nbctl lrp-add R1 ls3 00:00:00:01:02:f3 2003::1/64
ovn-nbctl lsp-add ls3 rp-ls3 -- set Logical_Switch_Port rp-ls3 \
    type=router options:router-port=ls3 addresses=\"00:00:00:01:02:f3\"

# Create logical port ls1-lp1 in ls1
ovn-nbctl lsp-add ls1 ls1-lp1 \
-- lsp-set-addresses ls1-lp1 "00:00:00:01:02:03 2001::2"

# Create logical port ls2-lp1 in ls2
ovn-nbctl lsp-add ls2 ls2-lp1 \
-- lsp-set-addresses ls2-lp1 "00:00:00:01:02:04 2002::2"

# Create logical port ls3-lp1 in ls3
ovn-nbctl lsp-add ls3 ls3-lp1 \
-- lsp-set-addresses ls3-lp1 "00:00:00:01:02:05 2003::2"

# Create one hypervisor and create OVS ports corresponding to logical ports.
net_add n1

sim_add pbr-hv
as pbr-hv
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.1

ovs-vsctl -- add-port br-int vif1 -- \
    set interface vif1 external-ids:iface-id=ls1-lp1 \
    options:tx_pcap=pbr-hv/vif1-tx.pcap \
    options:rxq_pcap=pbr-hv/vif1-rx.pcap \
    ofport-request=1

ovs-vsctl -- add-port br-int vif2 -- \
    set interface vif2 external-ids:iface-id=ls2-lp1 \
    options:tx_pcap=pbr-hv/vif2-tx.pcap \
    options:rxq_pcap=pbr-hv/vif2-rx.pcap \
    ofport-request=1

ovs-vsctl -- add-port br-int vif3 -- \
    set interface vif3 external-ids:iface-id=ls3-lp1 \
    options:tx_pcap=pbr-hv/vif3-tx.pcap \
    options:rxq_pcap=pbr-hv/vif3-rx.pcap \
    ofport-request=1

# Allow some time for ovn-northd and ovn-controller to catch up.
# XXX This should be more systematic.
sleep 1

ls1_ro_mac=00:00:00:01:02:f1
ls1_ro_ip=2001::1

ls2_ro_mac=00:00:00:01:02:f2
ls2_ro_ip=2002::1

ls3_ro_mac=00:00:00:01:02:f3

ls1_p1_mac=00:00:00:01:02:03
ls1_p1_ip=2001::2

ls2_p1_mac=00:00:00:01:02:04
ls2_p1_ip=2002::2

ls3_p1_mac=00:00:00:01:02:05

# Create a drop policy
ovn-nbctl lr-policy-add R1 10 "ip6.src==2001::/64 && ip6.dst==2002::/64" drop

# Check logical flow
{ set +x
$as_echo "$at_srcdir/ovn.at:5824: ovn-sbctl dump-flows | grep lr_in_policy | grep \"2001\" | wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:5824"
( $at_check_trace; ovn-sbctl dump-flows | grep lr_in_policy | grep "2001" | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5824"
$at_failed && at_fn_log_failure
$at_traceon; }


# Send packet.
packet="inport==\"ls1-lp1\" && eth.src==$ls1_p1_mac && eth.dst==$ls1_ro_mac &&
       ip6 && ip.ttl==64 && ip6.src==$ls1_p1_ip && ip6.dst==$ls2_p1_ip &&
       udp && udp.src==53 && udp.dst==4369"

as pbr-hv ovs-appctl -t ovn-controller inject-pkt "$packet"

# Check if packet hit the drop policy
{ set +x
$as_echo "$at_srcdir/ovn.at:5836: ovs-ofctl dump-flows br-int | \\
    grep \"ipv6_src=2001::/64,ipv6_dst=2002::/64 actions=drop\" | \\
    grep \"priority=10\" | \\
    grep \"n_packets=1\" | wc -l"
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:5836"
( $at_check_trace; ovs-ofctl dump-flows br-int | \
    grep "ipv6_src=2001::/64,ipv6_dst=2002::/64 actions=drop" | \
    grep "priority=10" | \
    grep "n_packets=1" | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5836"
$at_failed && at_fn_log_failure
$at_traceon; }


# Expected to drop the packet.
$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" pbr-hv/vif2-tx.pcap > vif2.packets
rcvd_packet=`cat vif2.packets`
$as_echo "ovn.at:5846" >"$at_check_line_file"
(rcvd_packet = "") \
  && at_fn_check_skip 99 "$at_srcdir/ovn.at:5846"

# Override drop policy with allow
ovn-nbctl lr-policy-add R1 20 "ip6.src==2001::/64 && ip6.dst==2002::/64" allow

# Check logical flow
{ set +x
$as_echo "$at_srcdir/ovn.at:5852: ovn-sbctl dump-flows | grep lr_in_policy | grep \"2001\" | wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:5852"
( $at_check_trace; ovn-sbctl dump-flows | grep lr_in_policy | grep "2001" | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "2
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5852"
$at_failed && at_fn_log_failure
$at_traceon; }


# Send packet.
packet="inport==\"ls1-lp1\" && eth.src==$ls1_p1_mac && eth.dst==$ls1_ro_mac &&
       ip6 && ip.ttl==64 && ip6.src==$ls1_p1_ip && ip6.dst==$ls2_p1_ip &&
       udp && udp.src==53 && udp.dst==4369"
as pbr-hv ovs-appctl -t ovn-controller inject-pkt "$packet"

# Check if packet hit the allow policy
{ set +x
$as_echo "$at_srcdir/ovn.at:5863: ovn-sbctl dump-flows | grep lr_in_policy | \\
    grep \"2001\" | \\
    grep \"priority=20\" | wc -l"
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:5863"
( $at_check_trace; ovn-sbctl dump-flows | grep lr_in_policy | \
    grep "2001" | \
    grep "priority=20" | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5863"
$at_failed && at_fn_log_failure
$at_traceon; }


# Expected packet has TTL decreased by 1
expected="eth.src==$ls2_ro_mac && eth.dst==$ls2_p1_mac &&
       ip6 && ip.ttl==63 && ip6.src==$ls1_p1_ip && ip6.dst==$ls2_p1_ip &&
       udp && udp.src==53 && udp.dst==4369"
echo $expected | ovstest test-ovn expr-to-packets > expected

ovn_check_packets__ "pbr-hv/vif2-tx.pcap" "expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:5875: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:5875"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5875"
$at_failed && at_fn_log_failure
$at_traceon; }


# Override allow policy with reroute
ovn-nbctl lr-policy-add R1 30 "ip6.src==2001::/64 && ip6.dst==2002::/64" reroute 2003::2

# Check logical flow
{ set +x
$as_echo "$at_srcdir/ovn.at:5881: ovn-sbctl dump-flows | grep lr_in_policy | \\
    grep \"2001\" | \\
    grep \"priority=30\" | wc -l"
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:5881"
( $at_check_trace; ovn-sbctl dump-flows | grep lr_in_policy | \
    grep "2001" | \
    grep "priority=30" | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5881"
$at_failed && at_fn_log_failure
$at_traceon; }


# Send packet.
packet="inport==\"ls1-lp1\" && eth.src==$ls1_p1_mac && eth.dst==$ls1_ro_mac &&
       ip6 && ip.ttl==64 && ip6.src==$ls1_p1_ip && ip6.dst==$ls2_p1_ip &&
       udp && udp.src==53 && udp.dst==4369"
as pbr-hv ovs-appctl -t ovn-controller inject-pkt "$packet"

echo "southbound flows"

ovn-sbctl dump-flows | grep lr_in_policy
echo "ovs flows"
ovs-ofctl dump-flows br-int
# Check if packet hit the allow policy
{ set +x
$as_echo "$at_srcdir/ovn.at:5899: ovs-ofctl dump-flows br-int | \\
    grep \"ipv6_src=2001::/64,ipv6_dst=2002::/64\" | \\
    grep \"priority=30\" | \\
    grep \"n_packets=1\" | wc -l"
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:5899"
( $at_check_trace; ovs-ofctl dump-flows br-int | \
    grep "ipv6_src=2001::/64,ipv6_dst=2002::/64" | \
    grep "priority=30" | \
    grep "n_packets=1" | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5899"
$at_failed && at_fn_log_failure
$at_traceon; }

echo "packet hit reroute policy"

# Expected packet has TTL decreased by 1
expected="eth.src==$ls3_ro_mac && eth.dst==$ls3_p1_mac &&
       ip6 && ip.ttl==63 && ip6.src==$ls1_p1_ip && ip6.dst==$ls2_p1_ip &&
       udp && udp.src==53 && udp.dst==4369"
echo $expected | ovstest test-ovn expr-to-packets > 3.expected

ovn_check_packets__ "pbr-hv/vif3-tx.pcap" "3.expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:5913: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:5913"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5913"
$at_failed && at_fn_log_failure
$at_traceon; }





    as pbr-hv
    if test "pbr-hv" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:5915: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:5915"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5915"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5915: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:5915"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5915"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5915" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:5915: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:5915"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5915"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5915: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:5915"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5915"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5915" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:5915: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:5915"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5915"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5915: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:5915"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5915"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5915" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as pbr-hv
    { set +x
$as_echo "$at_srcdir/ovn.at:5915: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:5915"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5915"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5915: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:5915"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5915"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5915" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:5915: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:5915"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5915"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5915: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:5915"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5915"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5915" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:5915: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:5915"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5915"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5915: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:5915"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5915"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5915" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:5915: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:5915"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5915"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5915: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:5915"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5915"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5915" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:5915: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:5915"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5915"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5915: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:5915"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5915"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5915" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:5915: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:5915"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5915"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5915: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:5915"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5915"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5915" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:5915: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:5915"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5915"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5915: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:5915"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5915"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5915" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:5915: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:5915"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5915"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5915: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:5915"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5915"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5915" "while kill -0 \$TMPPID 2>/dev/null"



ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_50
#AT_START_51
at_fn_group_banner 51 'ovn.at:5921' \
  "ovn -- port state up and down" "                  " 2
at_xfail=no
(
  $as_echo "51. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

ovn-nbctl ls-add ls1
ovn-nbctl lsp-add ls1 lp1
ovn-nbctl lsp-set-addresses lp1 unknown

net_add n1
sim_add hv1
as hv1 ovs-vsctl add-br br-phys
as hv1 ovn_attach n1 br-phys 192.168.0.1

as hv1 ovs-vsctl add-port br-int vif1 -- set Interface vif1 external-ids:iface-id=lp1
ovs_wait_cond () {
    test x`ovn-nbctl lsp-get-up lp1` = xup
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5934" "until test x\`ovn-nbctl lsp-get-up lp1\` = xup"


as hv1 ovs-vsctl del-port br-int vif1
ovs_wait_cond () {
    test x`ovn-nbctl lsp-get-up lp1` = xdown
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5937" "until test x\`ovn-nbctl lsp-get-up lp1\` = xdown"





    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:5939: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:5939"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5939"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5939: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:5939"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5939"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5939" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:5939: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:5939"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5939"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5939: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:5939"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5939"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5939" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:5939: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:5939"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5939"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5939: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:5939"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5939"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5939" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:5939: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:5939"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5939"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5939: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:5939"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5939"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5939" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:5939: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:5939"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5939"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5939: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:5939"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5939"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5939" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:5939: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:5939"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5939"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5939: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:5939"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5939"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5939" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:5939: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:5939"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5939"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5939: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:5939"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5939"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5939" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:5939: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:5939"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5939"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5939: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:5939"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5939"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5939" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:5939: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:5939"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5939"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5939: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:5939"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5939"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5939" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:5939: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:5939"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5939"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5939: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:5939"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5939"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5939" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:5939: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:5939"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5939"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:5939: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:5939"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5939"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5939" "while kill -0 \$TMPPID 2>/dev/null"




ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_51
#AT_START_52
at_fn_group_banner 52 'ovn.at:5946' \
  "ovn -- datapath rules added/removed" "            " 2
at_xfail=no
(
  $as_echo "52. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init


ovn_start

net_add n1
sim_add hv1
as hv1 ovs-vsctl add-br br-phys
as hv1 ovn_attach n1 br-phys 192.168.0.1

# This shell function checks if OF rules in br-int have clauses
# related to OVN datapaths. The caller determines if it should find
# a match in the output, or not.
#
# EXPECT_DATAPATH param determines whether flows that refer to
#                 datapath to should be present or not. 0 means
#                 they should not be.
# STAGE_INFO param is a simple string to help identify the stage
#            in the test when this function was invoked.
test_datapath_in_of_rules() {
    local expect_datapath=$1 stage_info=$2
    echo "------ ovn-nbctl show ${stage_info} ------"
    ovn-nbctl show
    echo "------ ovn-sbctl show ${stage_info} ------"
    ovn-sbctl show
    echo "------ OF rules ${stage_info} ------"
    { set +x
$as_echo "$at_srcdir/ovn.at:5971: ovs-ofctl dump-flows br-int"
at_fn_check_prepare_trace "ovn.at:5971"
( $at_check_trace; ovs-ofctl dump-flows br-int
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5971"
$at_failed && at_fn_log_failure
$at_traceon; }

    # if there is a datapath mentioned in the output, check for the
    # magic keyword that represents one, based on the exit status of
    # a quiet grep
    if test $expect_datapath != 0; then
       { set +x
$as_echo "$at_srcdir/ovn.at:5976: grep -q -i 'metadata=' stdout"
at_fn_check_prepare_trace "ovn.at:5976"
( $at_check_trace; grep -q -i 'metadata=' stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:

at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:5976"
$at_failed && at_fn_log_failure
$at_traceon; }

    else
       { set +x
$as_echo "$at_srcdir/ovn.at:5978: grep -q -i 'metadata=' stdout"
at_fn_check_prepare_trace "ovn.at:5978"
( $at_check_trace; grep -q -i 'metadata=' stdout
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:

at_fn_check_status 1 $at_status "$at_srcdir/ovn.at:5978"
$at_failed && at_fn_log_failure
$at_traceon; }

    fi
}

test_datapath_in_of_rules 0 "before ls+port create"

ovn-nbctl ls-add ls1
ovn-nbctl lsp-add ls1 lp1
ovn-nbctl lsp-set-addresses lp1 unknown

as hv1 ovs-vsctl add-port br-int vif1 -- set Interface vif1 external-ids:iface-id=lp1
ovs_wait_cond () {
    test x`ovn-nbctl lsp-get-up lp1` = xup
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5989" "until test x\`ovn-nbctl lsp-get-up lp1\` = xup"


test_datapath_in_of_rules 1 "after port is bound"

as hv1 ovs-vsctl del-port br-int vif1
ovs_wait_cond () {
    test x`ovn-nbctl lsp-get-up lp1` = xdown
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:5994" "until test x\`ovn-nbctl lsp-get-up lp1\` = xdown"


ovn-nbctl lsp-set-addresses lp1
ovn-nbctl lsp-del lp1
ovn-nbctl ls-del ls1

# wait for earlier changes to take effect
{ set +x
$as_echo "$at_srcdir/ovn.at:6001: ovn-nbctl --timeout=3 --wait=sb sync"
at_fn_check_prepare_trace "ovn.at:6001"
( $at_check_trace; ovn-nbctl --timeout=3 --wait=sb sync
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6001"
$at_failed && at_fn_log_failure
$at_traceon; }


# ensure OF rules are no longer present. There used to be a bug here.
test_datapath_in_of_rules 0 "after lport+ls removal"




    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:6006: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:6006"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6006"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6006: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:6006"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6006"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6006" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:6006: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:6006"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6006"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6006: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:6006"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6006"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6006" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:6006: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:6006"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6006"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6006: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:6006"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6006"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6006" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:6006: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:6006"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6006"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6006: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:6006"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6006"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6006" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:6006: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:6006"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6006"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6006: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:6006"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6006"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6006" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:6006: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:6006"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6006"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6006: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:6006"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6006"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6006" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:6006: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:6006"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6006"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6006: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:6006"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6006"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6006" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:6006: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:6006"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6006"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6006: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:6006"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6006"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6006" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:6006: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:6006"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6006"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6006: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:6006"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6006"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6006" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:6006: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:6006"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6006"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6006: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:6006"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6006"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6006" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:6006: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:6006"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6006"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6006: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:6006"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6006"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6006" "while kill -0 \$TMPPID 2>/dev/null"




ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_52
#AT_START_53
at_fn_group_banner 53 'ovn.at:6010' \
  "ovn -- nd_na " "                                  " 2
at_xfail=no
(
  $as_echo "53. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

#TODO: since patch port for IPv6 logical router port is not ready not,
#  so we are not going to test vifs on different lswitches cases. Try
#  to update for that once relevant stuff implemented.

# In this test cases we create 1 lswitch, it has 2 VIF ports attached
# with. NS packet we test, from one VIF for another VIF, will be replied
# by local ovn-controller, but not by target VIF.

# Create hypervisors and logical switch lsw0.
ovn-nbctl ls-add lsw0
net_add n1
sim_add hv1
as hv1
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.2

# Add vif1 to hv1 and lsw0, turn on l2 port security on vif1.
ovs-vsctl add-port br-int vif1 -- set Interface vif1 external-ids:iface-id=lp1 options:tx_pcap=hv1/vif1-tx.pcap options:rxq_pcap=hv1/vif1-rx.pcap ofport-request=1
ovn-nbctl lsp-add lsw0 lp1
ovn-nbctl lsp-set-addresses lp1 "fa:16:3e:94:05:98 192.168.0.3 fd81:ce49:a948:0:f816:3eff:fe94:598"
ovn-nbctl lsp-set-port-security lp1 "fa:16:3e:94:05:98 192.168.0.3 fd81:ce49:a948:0:f816:3eff:fe94:598"

# Add vif2 to hv1 and lsw0, turn on l2 port security on vif2.
ovs-vsctl add-port br-int vif2 -- set Interface vif2 external-ids:iface-id=lp2 options:tx_pcap=hv1/vif2-tx.pcap options:rxq_pcap=hv1/vif2-rx.pcap ofport-request=2
ovn-nbctl lsp-add lsw0 lp2
ovn-nbctl lsp-set-addresses lp2 "fa:16:3e:a1:f9:ae 192.168.0.4 fd81:ce49:a948:0:f816:3eff:fea1:f9ae"
ovn-nbctl lsp-set-port-security lp2 "fa:16:3e:a1:f9:ae 192.168.0.4 fd81:ce49:a948:0:f816:3eff:fea1:f9ae"

# Add ACL rule for ICMPv6 on lsw0
ovn-nbctl acl-add lsw0 from-lport 1002 'ip6 && icmp6'  allow-related
ovn-nbctl acl-add lsw0 to-lport 1002 'outport == "lp1" && ip6 && icmp6'  allow-related
ovn-nbctl acl-add lsw0 to-lport 1002 'outport == "lp2" && ip6 && icmp6'  allow-related

# Allow some time for ovn-northd and ovn-controller to catch up.
# XXX This should be more systematic.
sleep 1

# Given the name of a logical port, prints the name of the hypervisor
# on which it is located.
vif_to_hv() {
    echo hv1${1%?}
}
for i in 1 2; do
    : > $i.expected
done

# Complete Neighbor Solicitation packet and Neighbor Advertisement packet
# vif1 -> NS -> vif2.  vif1 <- NA <- ovn-controller.
# vif2 will not receive NS packet, since ovn-controller will reply for it.
ns_packet=3333ffa1f9aefa163e94059886dd6000000000203afffd81ce49a9480000f8163efffe940598fd81ce49a9480000f8163efffea1f9ae8700e01160000000fd81ce49a9480000f8163efffea1f9ae0101fa163e940598
na_packet=fa163e940598fa163ea1f9ae86dd6000000000203afffd81ce49a9480000f8163efffea1f9aefd81ce49a9480000f8163efffe9405988800e9ed60000000fd81ce49a9480000f8163efffea1f9ae0201fa163ea1f9ae

as hv1 ovs-appctl netdev-dummy/receive vif1 $ns_packet
echo $na_packet >> 1.expected

echo "------ hv1 dump ------"
as hv1 ovs-vsctl show
as hv1 ovs-ofctl -O OpenFlow13 show br-int
as hv1 ovs-ofctl -O OpenFlow13 dump-flows br-int

for i in 1 2; do
    ovn_check_packets__ "hv1/vif$i-tx.pcap" "$i.expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:6074: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:6074"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6074"
$at_failed && at_fn_log_failure
$at_traceon; }

done




    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:6077: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:6077"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6077"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6077: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:6077"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6077"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6077" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:6077: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:6077"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6077"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6077: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:6077"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6077"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6077" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:6077: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:6077"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6077"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6077: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:6077"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6077"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6077" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:6077: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:6077"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6077"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6077: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:6077"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6077"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6077" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:6077: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:6077"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6077"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6077: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:6077"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6077"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6077" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:6077: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:6077"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6077"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6077: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:6077"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6077"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6077" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:6077: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:6077"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6077"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6077: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:6077"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6077"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6077" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:6077: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:6077"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6077"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6077: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:6077"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6077"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6077" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:6077: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:6077"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6077"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6077: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:6077"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6077"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6077" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:6077: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:6077"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6077"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6077: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:6077"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6077"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6077" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:6077: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:6077"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6077"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6077: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:6077"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6077"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6077" "while kill -0 \$TMPPID 2>/dev/null"




ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_53
#AT_START_54
at_fn_group_banner 54 'ovn.at:6081' \
  "ovn -- address sets modification/removal smoke test" "" 2
at_xfail=no
(
  $as_echo "54. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

net_add n1

sim_add hv1
as hv1
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.1

row=`ovn-nbctl create Address_Set name=set1 addresses=\"1.1.1.1\"`
ovn-nbctl set Address_Set $row name=set1 addresses=\"1.1.1.1,1.1.1.2\"
ovn-nbctl destroy Address_Set $row

sleep 1

# A bug previously existed in the address set support code
# that caused ovn-controller to crash after an address set
# was updated and then removed.  This test case ensures
# that ovn-controller is at least still running after
# creating, updating, and deleting an address set.
{ set +x
$as_echo "$at_srcdir/ovn.at:6102: ovs-appctl -t ovn-controller version"
at_fn_check_prepare_trace "ovn.at:6102"
( $at_check_trace; ovs-appctl -t ovn-controller version
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6102"
$at_failed && at_fn_log_failure
$at_traceon; }





    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:6104: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:6104"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6104"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6104: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:6104"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6104"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6104" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:6104: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:6104"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6104"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6104: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:6104"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6104"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6104" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:6104: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:6104"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6104"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6104: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:6104"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6104"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6104" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:6104: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:6104"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6104"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6104: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:6104"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6104"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6104" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:6104: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:6104"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6104"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6104: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:6104"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6104"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6104" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:6104: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:6104"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6104"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6104: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:6104"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6104"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6104" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:6104: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:6104"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6104"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6104: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:6104"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6104"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6104" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:6104: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:6104"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6104"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6104: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:6104"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6104"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6104" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:6104: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:6104"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6104"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6104: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:6104"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6104"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6104" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:6104: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:6104"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6104"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6104: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:6104"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6104"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6104" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:6104: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:6104"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6104"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6104: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:6104"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6104"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6104" "while kill -0 \$TMPPID 2>/dev/null"




ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_54
#AT_START_55
at_fn_group_banner 55 'ovn.at:6108' \
  "ovn -- ipam" "                                    " 2
at_xfail=no
(
  $as_echo "55. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

# Add a port to a switch that does not have a subnet set, then set the
# subnet which should result in an address being allocated for the port.
ovn-nbctl --wait=hv set NB_Global . options:mac_prefix="0a:00:00:00:00:00"
ovn-nbctl ls-add sw0
ovn-nbctl lsp-add sw0 p0 -- lsp-set-addresses p0 dynamic
ovn-nbctl --wait=sb add Logical-Switch sw0 other_config subnet=192.168.1.0/24
{ set +x
$as_echo "$at_srcdir/ovn.at:6117: ovn-nbctl get Logical-Switch-Port p0 dynamic_addresses"
at_fn_check_prepare_trace "ovn.at:6117"
( $at_check_trace; ovn-nbctl get Logical-Switch-Port p0 dynamic_addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"0a:00:00:a8:01:03 192.168.1.2\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6117"
$at_failed && at_fn_log_failure
$at_traceon; }


# Add 9 more ports to sw0, addresses should all be unique.
for n in `seq 1 9`; do
    ovn-nbctl --wait=sb lsp-add sw0 "p$n" -- lsp-set-addresses "p$n" dynamic
done
{ set +x
$as_echo "$at_srcdir/ovn.at:6125: ovn-nbctl get Logical-Switch-Port p1 dynamic_addresses"
at_fn_check_prepare_trace "ovn.at:6125"
( $at_check_trace; ovn-nbctl get Logical-Switch-Port p1 dynamic_addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"0a:00:00:a8:01:04 192.168.1.3\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6125"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:6128: ovn-nbctl get Logical-Switch-Port p2 dynamic_addresses"
at_fn_check_prepare_trace "ovn.at:6128"
( $at_check_trace; ovn-nbctl get Logical-Switch-Port p2 dynamic_addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"0a:00:00:a8:01:05 192.168.1.4\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6128"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:6131: ovn-nbctl get Logical-Switch-Port p3 dynamic_addresses"
at_fn_check_prepare_trace "ovn.at:6131"
( $at_check_trace; ovn-nbctl get Logical-Switch-Port p3 dynamic_addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"0a:00:00:a8:01:06 192.168.1.5\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6131"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:6134: ovn-nbctl get Logical-Switch-Port p4 dynamic_addresses"
at_fn_check_prepare_trace "ovn.at:6134"
( $at_check_trace; ovn-nbctl get Logical-Switch-Port p4 dynamic_addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"0a:00:00:a8:01:07 192.168.1.6\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6134"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:6137: ovn-nbctl get Logical-Switch-Port p5 dynamic_addresses"
at_fn_check_prepare_trace "ovn.at:6137"
( $at_check_trace; ovn-nbctl get Logical-Switch-Port p5 dynamic_addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"0a:00:00:a8:01:08 192.168.1.7\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6137"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:6140: ovn-nbctl get Logical-Switch-Port p6 dynamic_addresses"
at_fn_check_prepare_trace "ovn.at:6140"
( $at_check_trace; ovn-nbctl get Logical-Switch-Port p6 dynamic_addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"0a:00:00:a8:01:09 192.168.1.8\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6140"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:6143: ovn-nbctl get Logical-Switch-Port p7 dynamic_addresses"
at_fn_check_prepare_trace "ovn.at:6143"
( $at_check_trace; ovn-nbctl get Logical-Switch-Port p7 dynamic_addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"0a:00:00:a8:01:0a 192.168.1.9\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6143"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:6146: ovn-nbctl get Logical-Switch-Port p8 dynamic_addresses"
at_fn_check_prepare_trace "ovn.at:6146"
( $at_check_trace; ovn-nbctl get Logical-Switch-Port p8 dynamic_addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"0a:00:00:a8:01:0b 192.168.1.10\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6146"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:6149: ovn-nbctl get Logical-Switch-Port p9 dynamic_addresses"
at_fn_check_prepare_trace "ovn.at:6149"
( $at_check_trace; ovn-nbctl get Logical-Switch-Port p9 dynamic_addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"0a:00:00:a8:01:0c 192.168.1.11\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6149"
$at_failed && at_fn_log_failure
$at_traceon; }


# Trying similar tests with a second switch. MAC addresses should be unique
# across both switches but IP's only need to be unique within the same switch.
ovn-nbctl ls-add sw1
ovn-nbctl lsp-add sw1 p10 -- lsp-set-addresses p10 dynamic
ovn-nbctl --wait=sb add Logical-Switch sw1 other_config subnet=192.168.1.0/24
{ set +x
$as_echo "$at_srcdir/ovn.at:6158: ovn-nbctl get Logical-Switch-Port p10 dynamic_addresses"
at_fn_check_prepare_trace "ovn.at:6158"
( $at_check_trace; ovn-nbctl get Logical-Switch-Port p10 dynamic_addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"0a:00:00:a8:01:0d 192.168.1.2\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6158"
$at_failed && at_fn_log_failure
$at_traceon; }


for n in `seq 11 19`; do
    ovn-nbctl --wait=sb lsp-add sw1 "p$n" -- lsp-set-addresses "p$n" dynamic
done
{ set +x
$as_echo "$at_srcdir/ovn.at:6165: ovn-nbctl get Logical-Switch-Port p11 dynamic_addresses"
at_fn_check_prepare_trace "ovn.at:6165"
( $at_check_trace; ovn-nbctl get Logical-Switch-Port p11 dynamic_addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"0a:00:00:a8:01:0e 192.168.1.3\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6165"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:6168: ovn-nbctl get Logical-Switch-Port p12 dynamic_addresses"
at_fn_check_prepare_trace "ovn.at:6168"
( $at_check_trace; ovn-nbctl get Logical-Switch-Port p12 dynamic_addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"0a:00:00:a8:01:0f 192.168.1.4\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6168"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:6171: ovn-nbctl get Logical-Switch-Port p13 dynamic_addresses"
at_fn_check_prepare_trace "ovn.at:6171"
( $at_check_trace; ovn-nbctl get Logical-Switch-Port p13 dynamic_addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"0a:00:00:a8:01:10 192.168.1.5\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6171"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:6174: ovn-nbctl get Logical-Switch-Port p14 dynamic_addresses"
at_fn_check_prepare_trace "ovn.at:6174"
( $at_check_trace; ovn-nbctl get Logical-Switch-Port p14 dynamic_addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"0a:00:00:a8:01:11 192.168.1.6\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6174"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:6177: ovn-nbctl get Logical-Switch-Port p15 dynamic_addresses"
at_fn_check_prepare_trace "ovn.at:6177"
( $at_check_trace; ovn-nbctl get Logical-Switch-Port p15 dynamic_addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"0a:00:00:a8:01:12 192.168.1.7\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6177"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:6180: ovn-nbctl get Logical-Switch-Port p16 dynamic_addresses"
at_fn_check_prepare_trace "ovn.at:6180"
( $at_check_trace; ovn-nbctl get Logical-Switch-Port p16 dynamic_addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"0a:00:00:a8:01:13 192.168.1.8\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6180"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:6183: ovn-nbctl get Logical-Switch-Port p17 dynamic_addresses"
at_fn_check_prepare_trace "ovn.at:6183"
( $at_check_trace; ovn-nbctl get Logical-Switch-Port p17 dynamic_addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"0a:00:00:a8:01:14 192.168.1.9\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6183"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:6186: ovn-nbctl get Logical-Switch-Port p18 dynamic_addresses"
at_fn_check_prepare_trace "ovn.at:6186"
( $at_check_trace; ovn-nbctl get Logical-Switch-Port p18 dynamic_addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"0a:00:00:a8:01:15 192.168.1.10\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6186"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:6189: ovn-nbctl get Logical-Switch-Port p19 dynamic_addresses"
at_fn_check_prepare_trace "ovn.at:6189"
( $at_check_trace; ovn-nbctl get Logical-Switch-Port p19 dynamic_addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"0a:00:00:a8:01:16 192.168.1.11\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6189"
$at_failed && at_fn_log_failure
$at_traceon; }


# Change a port's address to test for multiple ip's for a single address entry
# and addresses set by the user.
ovn-nbctl lsp-set-addresses p0 "0a:00:00:a8:01:17 192.168.1.2 192.168.1.12 192.168.1.14"
ovn-nbctl --wait=sb lsp-add sw0 p20 -- lsp-set-addresses p20 dynamic
{ set +x
$as_echo "$at_srcdir/ovn.at:6197: ovn-nbctl get Logical-Switch-Port p20 dynamic_addresses"
at_fn_check_prepare_trace "ovn.at:6197"
( $at_check_trace; ovn-nbctl get Logical-Switch-Port p20 dynamic_addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"0a:00:00:a8:01:18 192.168.1.13\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6197"
$at_failed && at_fn_log_failure
$at_traceon; }


# Test for logical router port address management.
ovn-nbctl create Logical_Router name=R1
ovn-nbctl -- --id=@lrp create Logical_Router_port name=sw0 \
network="192.168.1.1/24" mac=\"0a:00:00:a8:01:19\" \
-- add Logical_Router R1 ports @lrp -- lsp-add sw0 rp-sw0 \
-- set Logical_Switch_Port rp-sw0 type=router options:router-port=sw0
ovn-nbctl --wait=sb lsp-add sw0 p21 -- lsp-set-addresses p21 dynamic
{ set +x
$as_echo "$at_srcdir/ovn.at:6208: ovn-nbctl get Logical-Switch-Port p21 dynamic_addresses"
at_fn_check_prepare_trace "ovn.at:6208"
( $at_check_trace; ovn-nbctl get Logical-Switch-Port p21 dynamic_addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"0a:00:00:a8:01:1a 192.168.1.15\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6208"
$at_failed && at_fn_log_failure
$at_traceon; }


# Test for address reuse after logical port is deleted.
ovn-nbctl lsp-del p0
ovn-nbctl --wait=sb lsp-add sw0 p23 -- lsp-set-addresses p23 dynamic
{ set +x
$as_echo "$at_srcdir/ovn.at:6215: ovn-nbctl get Logical-Switch-Port p23 dynamic_addresses"
at_fn_check_prepare_trace "ovn.at:6215"
( $at_check_trace; ovn-nbctl get Logical-Switch-Port p23 dynamic_addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"0a:00:00:a8:01:03 192.168.1.2\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6215"
$at_failed && at_fn_log_failure
$at_traceon; }


# Test for multiple addresses to one logical port.
ovn-nbctl lsp-add sw0 p25 -- lsp-set-addresses p25 \
"0a:00:00:a8:01:1b 192.168.1.12" "0a:00:00:a8:01:1c 192.168.1.14"
ovn-nbctl --wait=sb lsp-add sw0 p26 -- lsp-set-addresses p26 dynamic
{ set +x
$as_echo "$at_srcdir/ovn.at:6223: ovn-nbctl get Logical-Switch-Port p26 dynamic_addresses"
at_fn_check_prepare_trace "ovn.at:6223"
( $at_check_trace; ovn-nbctl get Logical-Switch-Port p26 dynamic_addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"0a:00:00:a8:01:17 192.168.1.16\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6223"
$at_failed && at_fn_log_failure
$at_traceon; }


# Test for exhausting subnet address space.
ovn-nbctl ls-add sw2 -- add Logical-Switch sw2 other_config subnet=172.16.1.0/30
ovn-nbctl --wait=sb lsp-add sw2 p27 -- lsp-set-addresses p27 dynamic
{ set +x
$as_echo "$at_srcdir/ovn.at:6230: ovn-nbctl get Logical-Switch-Port p27 dynamic_addresses"
at_fn_check_prepare_trace "ovn.at:6230"
( $at_check_trace; ovn-nbctl get Logical-Switch-Port p27 dynamic_addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"0a:00:00:10:01:03 172.16.1.2\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6230"
$at_failed && at_fn_log_failure
$at_traceon; }


ovn-nbctl --wait=sb lsp-add sw2 p28 -- lsp-set-addresses p28 dynamic
{ set +x
$as_echo "$at_srcdir/ovn.at:6235: ovn-nbctl get Logical-Switch-Port p28 dynamic_addresses"
at_fn_check_prepare_trace "ovn.at:6235"
( $at_check_trace; ovn-nbctl get Logical-Switch-Port p28 dynamic_addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"0a:00:00:00:00:01\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6235"
$at_failed && at_fn_log_failure
$at_traceon; }


# Test that address management does not add duplicate MAC for lsp/lrp peers.
ovn-nbctl create Logical_Router name=R2
ovn-nbctl ls-add sw3
ovn-nbctl lsp-add sw3 p29 -- lsp-set-addresses p29 \
"0a:00:00:a8:01:18"
ovn-nbctl -- --id=@lrp create Logical_Router_port name=sw3 \
network="192.168.2.1/24" mac=\"0a:00:00:a8:01:18\" \
-- add Logical_Router R2 ports @lrp -- lsp-add sw3 rp-sw3 \
-- set Logical_Switch_Port rp-sw3 type=router options:router-port=sw3
ovn-nbctl --wait=sb lsp-add sw0 p30 -- lsp-set-addresses p30 dynamic
{ set +x
$as_echo "$at_srcdir/ovn.at:6249: ovn-nbctl get Logical-Switch-Port p30 dynamic_addresses"
at_fn_check_prepare_trace "ovn.at:6249"
( $at_check_trace; ovn-nbctl get Logical-Switch-Port p30 dynamic_addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"0a:00:00:a8:01:1d 192.168.1.17\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6249"
$at_failed && at_fn_log_failure
$at_traceon; }


# Test static MAC address with dynamically allocated IP
ovn-nbctl --wait=sb lsp-add sw0 p31 -- lsp-set-addresses p31 \
"fe:dc:ba:98:76:54 dynamic"
{ set +x
$as_echo "$at_srcdir/ovn.at:6256: ovn-nbctl get Logical-Switch-Port p31 dynamic_addresses"
at_fn_check_prepare_trace "ovn.at:6256"
( $at_check_trace; ovn-nbctl get Logical-Switch-Port p31 dynamic_addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"fe:dc:ba:98:76:54 192.168.1.18\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6256"
$at_failed && at_fn_log_failure
$at_traceon; }


# Update the static MAC address with dynamically allocated IP and check
# if the MAC address is updated in 'Logical_Switch_Port.dynamic_adddresses'
ovn-nbctl --wait=sb lsp-set-addresses p31 "fe:dc:ba:98:76:55 dynamic"

{ set +x
$as_echo "$at_srcdir/ovn.at:6264: ovn-nbctl get Logical-Switch-Port p31 dynamic_addresses"
at_fn_check_prepare_trace "ovn.at:6264"
( $at_check_trace; ovn-nbctl get Logical-Switch-Port p31 dynamic_addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"fe:dc:ba:98:76:55 192.168.1.18\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6264"
$at_failed && at_fn_log_failure
$at_traceon; }


ovn-nbctl --wait=sb lsp-set-addresses p31 "dynamic"
{ set +x
$as_echo "$at_srcdir/ovn.at:6269: ovn-nbctl get Logical-Switch-Port p31 dynamic_addresses"
at_fn_check_prepare_trace "ovn.at:6269"
( $at_check_trace; ovn-nbctl get Logical-Switch-Port p31 dynamic_addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"0a:00:00:a8:01:1e 192.168.1.18\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6269"
$at_failed && at_fn_log_failure
$at_traceon; }


ovn-nbctl --wait=sb lsp-set-addresses p31 "fe:dc:ba:98:76:56 dynamic"
{ set +x
$as_echo "$at_srcdir/ovn.at:6274: ovn-nbctl get Logical-Switch-Port p31 dynamic_addresses"
at_fn_check_prepare_trace "ovn.at:6274"
( $at_check_trace; ovn-nbctl get Logical-Switch-Port p31 dynamic_addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"fe:dc:ba:98:76:56 192.168.1.18\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6274"
$at_failed && at_fn_log_failure
$at_traceon; }



# Test the exclude_ips from the IPAM list
ovn-nbctl --wait=sb set logical_switch sw0 \
other_config:exclude_ips="192.168.1.19 192.168.1.21 192.168.1.23..192.168.1.50"

ovn-nbctl --wait=sb lsp-add sw0 p32 -- lsp-set-addresses p32 \
"dynamic"
# 192.168.1.20 should be assigned as 192.168.1.19 is excluded.
{ set +x
$as_echo "$at_srcdir/ovn.at:6286: ovn-nbctl get Logical-Switch-Port p32 dynamic_addresses"
at_fn_check_prepare_trace "ovn.at:6286"
( $at_check_trace; ovn-nbctl get Logical-Switch-Port p32 dynamic_addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"0a:00:00:a8:01:1e 192.168.1.20\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6286"
$at_failed && at_fn_log_failure
$at_traceon; }


ovn-nbctl --wait=sb lsp-add sw0 p33 -- lsp-set-addresses p33 \
"dynamic"
# 192.168.1.22 should be assigned as 192.168.1.21 is excluded.
{ set +x
$as_echo "$at_srcdir/ovn.at:6293: ovn-nbctl get Logical-Switch-Port p33 dynamic_addresses"
at_fn_check_prepare_trace "ovn.at:6293"
( $at_check_trace; ovn-nbctl get Logical-Switch-Port p33 dynamic_addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"0a:00:00:a8:01:1f 192.168.1.22\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6293"
$at_failed && at_fn_log_failure
$at_traceon; }


ovn-nbctl --wait=sb lsp-add sw0 p34 -- lsp-set-addresses p34 \
"dynamic"
# 192.168.1.51 should be assigned as 192.168.1.23-192.168.1.50 is excluded.
{ set +x
$as_echo "$at_srcdir/ovn.at:6300: ovn-nbctl get Logical-Switch-Port p34 dynamic_addresses"
at_fn_check_prepare_trace "ovn.at:6300"
( $at_check_trace; ovn-nbctl get Logical-Switch-Port p34 dynamic_addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"0a:00:00:a8:01:34 192.168.1.51\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6300"
$at_failed && at_fn_log_failure
$at_traceon; }


# Now clear the exclude_ips list. 192.168.1.19 should be assigned.
ovn-nbctl --wait=sb set Logical-switch sw0 other_config:exclude_ips="invalid"
ovn-nbctl --wait=sb lsp-add sw0 p35 -- lsp-set-addresses p35 \
"dynamic"
{ set +x
$as_echo "$at_srcdir/ovn.at:6308: ovn-nbctl get Logical-Switch-Port p35 dynamic_addresses"
at_fn_check_prepare_trace "ovn.at:6308"
( $at_check_trace; ovn-nbctl get Logical-Switch-Port p35 dynamic_addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"0a:00:00:a8:01:20 192.168.1.19\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6308"
$at_failed && at_fn_log_failure
$at_traceon; }


# Set invalid data in exclude_ips list. It should be ignored.
ovn-nbctl --wait=sb set Logical-switch sw0 other_config:exclude_ips="182.168.1.30"
ovn-nbctl --wait=sb lsp-add sw0 p36 -- lsp-set-addresses p36 \
"dynamic"
# 192.168.1.21 should be assigned as that's the next free one.
{ set +x
$as_echo "$at_srcdir/ovn.at:6317: ovn-nbctl get Logical-Switch-Port p36 dynamic_addresses"
at_fn_check_prepare_trace "ovn.at:6317"
( $at_check_trace; ovn-nbctl get Logical-Switch-Port p36 dynamic_addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"0a:00:00:a8:01:21 192.168.1.21\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6317"
$at_failed && at_fn_log_failure
$at_traceon; }


# Clear the dynamic addresses assignment request.
ovn-nbctl --wait=sb clear logical_switch_port p36 addresses
{ set +x
$as_echo "$at_srcdir/ovn.at:6323: ovn-nbctl get Logical-Switch-Port p36 dynamic_addresses"
at_fn_check_prepare_trace "ovn.at:6323"
( $at_check_trace; ovn-nbctl get Logical-Switch-Port p36 dynamic_addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "[]
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6323"
$at_failed && at_fn_log_failure
$at_traceon; }


# Set IPv6 prefix
ovn-nbctl --wait=sb set Logical-switch sw0 other_config:ipv6_prefix="aef0::"
ovn-nbctl --wait=sb lsp-add sw0 p37 -- lsp-set-addresses p37 \
"dynamic"

# With prefix aef0 and mac 0a:00:00:00:00:26, the dynamic IPv6 should be
# - aef0::800:ff:fe00:26 (EUI64)
{ set +x
$as_echo "$at_srcdir/ovn.at:6334: ovn-nbctl get Logical-Switch-Port p37 dynamic_addresses"
at_fn_check_prepare_trace "ovn.at:6334"
( $at_check_trace; ovn-nbctl get Logical-Switch-Port p37 dynamic_addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"0a:00:00:a8:01:21 192.168.1.21 aef0::800:ff:fea8:121\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6334"
$at_failed && at_fn_log_failure
$at_traceon; }


ovn-nbctl --wait=sb ls-add sw4
ovn-nbctl --wait=sb set Logical-switch sw4 other_config:ipv6_prefix="bef0::" \
-- set Logical-switch sw4 other_config:subnet=192.168.2.0/30
ovn-nbctl --wait=sb lsp-add sw4 p38 -- lsp-set-addresses p38 \
"dynamic"

{ set +x
$as_echo "$at_srcdir/ovn.at:6344: ovn-nbctl get Logical-Switch-Port p38 dynamic_addresses"
at_fn_check_prepare_trace "ovn.at:6344"
( $at_check_trace; ovn-nbctl get Logical-Switch-Port p38 dynamic_addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"0a:00:00:a8:02:03 192.168.2.2 bef0::800:ff:fea8:203\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6344"
$at_failed && at_fn_log_failure
$at_traceon; }


ovn-nbctl --wait=sb lsp-add sw4 p39 -- lsp-set-addresses p39 \
"f0:00:00:00:10:12 dynamic"

{ set +x
$as_echo "$at_srcdir/ovn.at:6351: ovn-nbctl get Logical-Switch-Port p39 dynamic_addresses"
at_fn_check_prepare_trace "ovn.at:6351"
( $at_check_trace; ovn-nbctl get Logical-Switch-Port p39 dynamic_addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"f0:00:00:00:10:12 bef0::f200:ff:fe00:1012\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6351"
$at_failed && at_fn_log_failure
$at_traceon; }


# Test the case where IPv4 addresses are exhausted and IPv6 prefix is set
# p40 should not have an IPv4 address since the pool is exhausted
ovn-nbctl --wait=sb lsp-add sw4 p40 -- lsp-set-addresses p40 \
"dynamic"
{ set +x
$as_echo "$at_srcdir/ovn.at:6359: ovn-nbctl get Logical-Switch-Port p40 dynamic_addresses"
at_fn_check_prepare_trace "ovn.at:6359"
( $at_check_trace; ovn-nbctl get Logical-Switch-Port p40 dynamic_addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"0a:00:00:00:00:02 bef0::800:ff:fe00:2\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6359"
$at_failed && at_fn_log_failure
$at_traceon; }


# Test dynamic changes on switch ports.
#
ovn-nbctl --wait=sb ls-add sw5
ovn-nbctl --wait=sb lsp-add sw5 p41 -- lsp-set-addresses p41 \
"dynamic"
# p41 will start with nothing
{ set +x
$as_echo "$at_srcdir/ovn.at:6369: ovn-nbctl get Logical-Switch-Port p41 dynamic_addresses"
at_fn_check_prepare_trace "ovn.at:6369"
( $at_check_trace; ovn-nbctl get Logical-Switch-Port p41 dynamic_addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "[]
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6369"
$at_failed && at_fn_log_failure
$at_traceon; }


# Set a subnet. Now p41 should have an ipv4 address, too
ovn-nbctl --wait=sb add Logical-Switch sw5 other_config subnet=192.168.1.0/24
{ set +x
$as_echo "$at_srcdir/ovn.at:6375: ovn-nbctl get Logical-Switch-Port p41 dynamic_addresses"
at_fn_check_prepare_trace "ovn.at:6375"
( $at_check_trace; ovn-nbctl get Logical-Switch-Port p41 dynamic_addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"0a:00:00:a8:01:22 192.168.1.2\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6375"
$at_failed && at_fn_log_failure
$at_traceon; }


# Clear the other_config. The IPv4 address should be gone
ovn-nbctl --wait=sb clear Logical-Switch sw5 other_config
{ set +x
$as_echo "$at_srcdir/ovn.at:6381: ovn-nbctl get Logical-Switch-Port p41 dynamic_addresses"
at_fn_check_prepare_trace "ovn.at:6381"
( $at_check_trace; ovn-nbctl get Logical-Switch-Port p41 dynamic_addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "[]
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6381"
$at_failed && at_fn_log_failure
$at_traceon; }


# Set an IPv6 prefix. Now p41 should have an IPv6 address.
ovn-nbctl --wait=sb set Logical-Switch sw5 other_config:ipv6_prefix="aef0::"
{ set +x
$as_echo "$at_srcdir/ovn.at:6387: ovn-nbctl get Logical-Switch-Port p41 dynamic_addresses"
at_fn_check_prepare_trace "ovn.at:6387"
( $at_check_trace; ovn-nbctl get Logical-Switch-Port p41 dynamic_addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"0a:00:00:00:00:03 aef0::800:ff:fe00:3\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6387"
$at_failed && at_fn_log_failure
$at_traceon; }


# Change the MAC address to a static one. The IPv6 address should update.
ovn-nbctl --wait=sb lsp-set-addresses p41 "f0:00:00:00:10:2b dynamic"
{ set +x
$as_echo "$at_srcdir/ovn.at:6393: ovn-nbctl get Logical-Switch-Port p41 dynamic_addresses"
at_fn_check_prepare_trace "ovn.at:6393"
( $at_check_trace; ovn-nbctl get Logical-Switch-Port p41 dynamic_addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"f0:00:00:00:10:2b aef0::f200:ff:fe00:102b\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6393"
$at_failed && at_fn_log_failure
$at_traceon; }


# Change the IPv6 prefix. The IPv6 address should update.
ovn-nbctl --wait=sb set Logical-Switch sw5 other_config:ipv6_prefix="bef0::"
{ set +x
$as_echo "$at_srcdir/ovn.at:6399: ovn-nbctl get Logical-Switch-Port p41 dynamic_addresses"
at_fn_check_prepare_trace "ovn.at:6399"
( $at_check_trace; ovn-nbctl get Logical-Switch-Port p41 dynamic_addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"f0:00:00:00:10:2b bef0::f200:ff:fe00:102b\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6399"
$at_failed && at_fn_log_failure
$at_traceon; }


# Clear the other_config. The IPv6 address should be gone
ovn-nbctl --wait=sb clear Logical-Switch sw5 other_config
{ set +x
$as_echo "$at_srcdir/ovn.at:6405: ovn-nbctl get Logical-Switch-Port p41 dynamic_addresses"
at_fn_check_prepare_trace "ovn.at:6405"
( $at_check_trace; ovn-nbctl get Logical-Switch-Port p41 dynamic_addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "[]
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6405"
$at_failed && at_fn_log_failure
$at_traceon; }


# Set the subnet again. Now p41 should get the IPv4 address again.
ovn-nbctl --wait=sb add Logical-Switch sw5 other_config subnet=192.168.1.0/24
{ set +x
$as_echo "$at_srcdir/ovn.at:6411: ovn-nbctl get Logical-Switch-Port p41 dynamic_addresses"
at_fn_check_prepare_trace "ovn.at:6411"
( $at_check_trace; ovn-nbctl get Logical-Switch-Port p41 dynamic_addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"f0:00:00:00:10:2b 192.168.1.2\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6411"
$at_failed && at_fn_log_failure
$at_traceon; }


# Add an excluded IP address that conflicts with p41. p41 should update.
ovn-nbctl --wait=sb add Logical-Switch sw5 other_config \
exclude_ips="192.168.1.2"
{ set +x
$as_echo "$at_srcdir/ovn.at:6418: ovn-nbctl get Logical-Switch-Port p41 dynamic_addresses"
at_fn_check_prepare_trace "ovn.at:6418"
( $at_check_trace; ovn-nbctl get Logical-Switch-Port p41 dynamic_addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"f0:00:00:00:10:2b 192.168.1.3\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6418"
$at_failed && at_fn_log_failure
$at_traceon; }


# Add static ip address
ovn-nbctl --wait=sb lsp-set-addresses p41 "dynamic 192.168.1.100"
ovn-nbctl list Logical-Switch-Port p41
ovn-nbctl --wait=sb lsp-add sw5 p42 -- lsp-set-addresses p42 \
"dynamic 192.168.1.101"
{ set +x
$as_echo "$at_srcdir/ovn.at:6427: ovn-nbctl get Logical-Switch-Port p41 dynamic_addresses"
at_fn_check_prepare_trace "ovn.at:6427"
( $at_check_trace; ovn-nbctl get Logical-Switch-Port p41 dynamic_addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"0a:00:00:a8:01:65 192.168.1.100\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6427"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:6430: ovn-nbctl get Logical-Switch-Port p42 dynamic_addresses"
at_fn_check_prepare_trace "ovn.at:6430"
( $at_check_trace; ovn-nbctl get Logical-Switch-Port p42 dynamic_addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"0a:00:00:a8:01:66 192.168.1.101\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6430"
$at_failed && at_fn_log_failure
$at_traceon; }


# define a mac address prefix
ovn-nbctl ls-add sw6
ovn-nbctl --wait=hv set NB_Global . options:mac_prefix="00:11:22:33:44:55"
ovn-nbctl --wait=sb set Logical-Switch sw6 other_config:subnet=192.168.100.0/24
for n in $(seq 1 3); do
    ovn-nbctl --wait=sb lsp-add sw6 "p5$n" -- lsp-set-addresses "p5$n" dynamic
done
{ set +x
$as_echo "$at_srcdir/ovn.at:6441: ovn-nbctl get Logical-Switch-Port p51 dynamic_addresses"
at_fn_check_prepare_trace "ovn.at:6441"
( $at_check_trace; ovn-nbctl get Logical-Switch-Port p51 dynamic_addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"00:11:22:a8:64:03 192.168.100.2\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6441"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:6444: ovn-nbctl get Logical-Switch-Port p52 dynamic_addresses"
at_fn_check_prepare_trace "ovn.at:6444"
( $at_check_trace; ovn-nbctl get Logical-Switch-Port p52 dynamic_addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"00:11:22:a8:64:04 192.168.100.3\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6444"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:6447: ovn-nbctl get Logical-Switch-Port p53 dynamic_addresses"
at_fn_check_prepare_trace "ovn.at:6447"
( $at_check_trace; ovn-nbctl get Logical-Switch-Port p53 dynamic_addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"00:11:22:a8:64:05 192.168.100.4\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6447"
$at_failed && at_fn_log_failure
$at_traceon; }


# verify configuration order does not break IPAM/MACAM
ovn-nbctl ls-add sw7
for n in $(seq 1 3); do
    ovn-nbctl --wait=sb lsp-add sw7 "p7$n" -- lsp-set-addresses "p7$n" dynamic
done
ovn-nbctl --wait=sb set Logical-Switch sw7 other_config:ipv6_prefix="bef0::"
p71_addr=$(ovn-nbctl get Logical-Switch-Port p71 dynamic_addresses)
p72_addr=$(ovn-nbctl get Logical-Switch-Port p72 dynamic_addresses)
p73_addr=$(ovn-nbctl get Logical-Switch-Port p73 dynamic_addresses)
{ set +x
$as_echo "$at_srcdir/ovn.at:6460: test \"\$p71_addr\" != \"\$p72_addr\""
at_fn_check_prepare_dynamic "test \"$p71_addr\" != \"$p72_addr\"" "ovn.at:6460"
( $at_check_trace; test "$p71_addr" != "$p72_addr"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6460"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:6461: test \"\$p71_addr\" != \"\$p73_addr\""
at_fn_check_prepare_dynamic "test \"$p71_addr\" != \"$p73_addr\"" "ovn.at:6461"
( $at_check_trace; test "$p71_addr" != "$p73_addr"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6461"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:6462: test \"\$p72_addr\" != \"\$p73_addr\""
at_fn_check_prepare_dynamic "test \"$p72_addr\" != \"$p73_addr\"" "ovn.at:6462"
( $at_check_trace; test "$p72_addr" != "$p73_addr"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6462"
$at_failed && at_fn_log_failure
$at_traceon; }


# request to assign mac only
#
ovn-nbctl ls-add sw8
ovn-nbctl --wait=sb set Logical-Switch sw8 other_config:mac_only=true
for n in $(seq 1 3); do
    ovn-nbctl --wait=sb lsp-add sw8 "p8$n" -- lsp-set-addresses "p8$n" dynamic
done
{ set +x
$as_echo "$at_srcdir/ovn.at:6471: ovn-nbctl get Logical-Switch-Port p81 dynamic_addresses"
at_fn_check_prepare_trace "ovn.at:6471"
( $at_check_trace; ovn-nbctl get Logical-Switch-Port p81 dynamic_addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"00:11:22:00:00:06\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6471"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:6474: ovn-nbctl get Logical-Switch-Port p82 dynamic_addresses"
at_fn_check_prepare_trace "ovn.at:6474"
( $at_check_trace; ovn-nbctl get Logical-Switch-Port p82 dynamic_addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"00:11:22:00:00:07\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6474"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:6477: ovn-nbctl get Logical-Switch-Port p83 dynamic_addresses"
at_fn_check_prepare_trace "ovn.at:6477"
( $at_check_trace; ovn-nbctl get Logical-Switch-Port p83 dynamic_addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"00:11:22:00:00:08\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6477"
$at_failed && at_fn_log_failure
$at_traceon; }


# clear mac_prefix and check it is allocated in a random manner
ovn-nbctl --wait=hv remove NB_Global . options mac_prefix
ovn-nbctl ls-add sw9
ovn-nbctl --wait=sb set Logical-Switch sw9 other_config:mac_only=true
ovn-nbctl --wait=sb lsp-add sw9 p91 -- lsp-set-addresses p91 dynamic

mac_prefix=$(ovn-nbctl --wait=sb get NB_Global . options:mac_prefix | tr -d \")
port_addr=$(ovn-nbctl get Logical-Switch-Port p91 dynamic_addresses | tr -d \")
{ set +x
$as_echo "$at_srcdir/ovn.at:6489: test \"\$port_addr\" = \"\${mac_prefix}:00:00:09\""
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "ovn.at:6489"
( $at_check_trace; test "$port_addr" = "${mac_prefix}:00:00:09"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6489"
$at_failed && at_fn_log_failure
$at_traceon; }


ovn-nbctl --wait=hv set NB_Global . options:mac_prefix="00:11:22"
ovn-nbctl ls-add sw10
ovn-nbctl --wait=sb set Logical-Switch sw10 other_config:ipv6_prefix="ae01::"
ovn-nbctl --wait=sb lsp-add sw10 p101 -- lsp-set-addresses p101 "dynamic ae01::1"
{ set +x
$as_echo "$at_srcdir/ovn.at:6495: ovn-nbctl get Logical-Switch-Port p101 dynamic_addresses"
at_fn_check_prepare_trace "ovn.at:6495"
( $at_check_trace; ovn-nbctl get Logical-Switch-Port p101 dynamic_addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"00:11:22:00:00:0a ae01::1\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6495"
$at_failed && at_fn_log_failure
$at_traceon; }


ovn-nbctl --wait=sb set Logical-Switch sw10 other_config:subnet=192.168.110.0/24
ovn-nbctl --wait=sb lsp-add sw10 p102 -- lsp-set-addresses p102 "dynamic 192.168.110.10 ae01::2"
{ set +x
$as_echo "$at_srcdir/ovn.at:6501: ovn-nbctl get Logical-Switch-Port p102 dynamic_addresses"
at_fn_check_prepare_trace "ovn.at:6501"
( $at_check_trace; ovn-nbctl get Logical-Switch-Port p102 dynamic_addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"00:11:22:a8:6e:0b 192.168.110.10 ae01::2\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6501"
$at_failed && at_fn_log_failure
$at_traceon; }


as ovn-sb
{ set +x
$as_echo "$at_srcdir/ovn.at:6506: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:6506"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6506"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6506: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:6506"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6506"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6506" "while kill -0 \$TMPPID 2>/dev/null"


as ovn-nb
{ set +x
$as_echo "$at_srcdir/ovn.at:6509: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:6509"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6509"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6509: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:6509"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6509"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6509" "while kill -0 \$TMPPID 2>/dev/null"


as northd
{ set +x
$as_echo "$at_srcdir/ovn.at:6512: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:6512"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6512"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6512: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:6512"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6512"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6512" "while kill -0 \$TMPPID 2>/dev/null"


as northd-backup
{ set +x
$as_echo "$at_srcdir/ovn.at:6515: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:6515"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6515"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6515: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:6515"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6515"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6515" "while kill -0 \$TMPPID 2>/dev/null"


ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_55
#AT_START_56
at_fn_group_banner 56 'ovn.at:6519' \
  "ovn -- ipam connectivity" "                       " 2
at_xfail=no
(
  $as_echo "56. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

ovn-nbctl lr-add R1

# Test for a ping using dynamically allocated addresses.
ovn-nbctl --wait=hv set NB_Global . options:mac_prefix="0a:00:00:00:00:00"
ovn-nbctl ls-add foo -- add Logical_Switch foo other_config subnet=192.168.1.0/24
ovn-nbctl ls-add alice -- add Logical_Switch alice other_config subnet=192.168.2.0/24

# Connect foo to R1
ovn-nbctl lrp-add R1 foo 00:00:00:01:02:03 192.168.1.1/24
ovn-nbctl lsp-add foo rp-foo -- set Logical_Switch_Port rp-foo type=router \
          options:router-port=foo \
          -- lsp-set-addresses rp-foo router

# Connect alice to R1
ovn-nbctl lrp-add R1 alice 00:00:00:01:02:04 192.168.2.1/24
ovn-nbctl lsp-add alice rp-alice -- set Logical_Switch_Port rp-alice type=router \
          options:router-port=alice addresses=\"00:00:00:01:02:04\"

# Create logical port foo1 in foo
ovn-nbctl --wait=sb lsp-add foo foo1 \
-- lsp-set-addresses foo1 "dynamic"
{ set +x
$as_echo "$at_srcdir/ovn.at:6543: ovn-nbctl --timeout=10 wait-until Logical-Switch-Port foo1 dynamic_addresses='\"0a:00:00:a8:01:03 192.168.1.2\"'"
at_fn_check_prepare_trace "ovn.at:6543"
( $at_check_trace; ovn-nbctl --timeout=10 wait-until Logical-Switch-Port foo1 dynamic_addresses='"0a:00:00:a8:01:03 192.168.1.2"'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6543"
$at_failed && at_fn_log_failure
$at_traceon; }


# Create logical port alice1 in alice
ovn-nbctl --wait=sb lsp-add alice alice1 \
-- lsp-set-addresses alice1 "dynamic"
{ set +x
$as_echo "$at_srcdir/ovn.at:6548: ovn-nbctl --timeout=10 wait-until Logical-Switch-Port alice1 dynamic_addresses='\"0a:00:00:a8:02:03 192.168.2.2\"'"
at_fn_check_prepare_trace "ovn.at:6548"
( $at_check_trace; ovn-nbctl --timeout=10 wait-until Logical-Switch-Port alice1 dynamic_addresses='"0a:00:00:a8:02:03 192.168.2.2"'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6548"
$at_failed && at_fn_log_failure
$at_traceon; }


# Create logical port foo2 in foo
ovn-nbctl --wait=sb lsp-add foo foo2 \
-- lsp-set-addresses foo2 "dynamic"
{ set +x
$as_echo "$at_srcdir/ovn.at:6553: ovn-nbctl --timeout=10 wait-until Logical-Switch-Port foo2 dynamic_addresses='\"0a:00:00:a8:01:04 192.168.1.3\"'"
at_fn_check_prepare_trace "ovn.at:6553"
( $at_check_trace; ovn-nbctl --timeout=10 wait-until Logical-Switch-Port foo2 dynamic_addresses='"0a:00:00:a8:01:04 192.168.1.3"'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6553"
$at_failed && at_fn_log_failure
$at_traceon; }


# Create a hypervisor and create OVS ports corresponding to logical ports.
net_add n1

sim_add hv1
as hv1
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.1
ovs-vsctl -- add-port br-int hv1-vif1 -- \
    set interface hv1-vif1 external-ids:iface-id=foo1 \
    options:tx_pcap=hv1/vif1-tx.pcap \
    options:rxq_pcap=hv1/vif1-rx.pcap \
    ofport-request=1

ovs-vsctl -- add-port br-int hv1-vif2 -- \
    set interface hv1-vif2 external-ids:iface-id=foo2 \
    options:tx_pcap=hv1/vif2-tx.pcap \
    options:rxq_pcap=hv1/vif2-rx.pcap \
    ofport-request=2

ovs-vsctl -- add-port br-int hv1-vif3 -- \
    set interface hv1-vif3 external-ids:iface-id=alice1 \
    options:tx_pcap=hv1/vif3-tx.pcap \
    options:rxq_pcap=hv1/vif3-rx.pcap \
    ofport-request=3

# Allow some time for ovn-northd and ovn-controller to catch up.
# XXX This should be more systematic.
sleep 1

ip_to_hex() {
    printf "%02x%02x%02x%02x" "$@"
}

# Send ip packets between foo1 and foo2
src_mac="0a0000a80103"
dst_mac="0a0000a80104"
src_ip=`ip_to_hex 192 168 1 2`
dst_ip=`ip_to_hex 192 168 1 3`
packet=${dst_mac}${src_mac}08004500001c0000000040110000${src_ip}${dst_ip}0035111100080000
as hv1 ovs-appctl netdev-dummy/receive hv1-vif1 $packet

# Send ip packets between foo1 and alice1
src_mac="0a0000a80103"
dst_mac="000000010203"
src_ip=`ip_to_hex 192 168 1 2`
dst_ip=`ip_to_hex 192 168 2 2`
packet=${dst_mac}${src_mac}08004500001c0000000040110000${src_ip}${dst_ip}0035111100080000
as hv1 ovs-appctl netdev-dummy/receive hv1-vif1 $packet

echo "---------NB dump-----"
ovn-nbctl show
echo "---------------------"
ovn-nbctl list logical_router
echo "---------------------"
ovn-nbctl list logical_router_port
echo "---------------------"

echo "---------SB dump-----"
ovn-sbctl list datapath_binding
echo "---------------------"
ovn-sbctl list port_binding
echo "---------------------"

echo "------ hv1 dump ----------"
as hv1 ovs-ofctl dump-flows br-int

# Packet to Expect at foo2
src_mac="0a0000a80103"
dst_mac="0a0000a80104"
src_ip=`ip_to_hex 192 168 1 2`
dst_ip=`ip_to_hex 192 168 1 3`
expected=${dst_mac}${src_mac}08004500001c0000000040110000${src_ip}${dst_ip}0035111100080000

$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/vif2-tx.pcap > received1.packets
echo $expected > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:6630: cat received1.packets"
at_fn_check_prepare_trace "ovn.at:6630"
( $at_check_trace; cat received1.packets
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6630"
$at_failed && at_fn_log_failure
$at_traceon; }


# Packet to Expect at alice1
src_mac="000000010204"
dst_mac="0a0000a80203"
src_ip=`ip_to_hex 192 168 1 2`
dst_ip=`ip_to_hex 192 168 2 2`
expected=${dst_mac}${src_mac}08004500001c000000003f110100${src_ip}${dst_ip}0035111100080000

$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/vif3-tx.pcap > received2.packets
echo $expected > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:6641: cat received2.packets"
at_fn_check_prepare_trace "ovn.at:6641"
( $at_check_trace; cat received2.packets
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6641"
$at_failed && at_fn_log_failure
$at_traceon; }





    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:6643: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:6643"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6643"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6643: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:6643"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6643"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6643" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:6643: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:6643"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6643"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6643: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:6643"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6643"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6643" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:6643: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:6643"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6643"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6643: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:6643"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6643"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6643" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:6643: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:6643"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6643"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6643: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:6643"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6643"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6643" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:6643: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:6643"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6643"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6643: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:6643"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6643"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6643" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:6643: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:6643"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6643"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6643: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:6643"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6643"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6643" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:6643: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:6643"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6643"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6643: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:6643"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6643"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6643" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:6643: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:6643"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6643"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6643: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:6643"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6643"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6643" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:6643: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:6643"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6643"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6643: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:6643"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6643"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6643" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:6643: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:6643"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6643"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6643: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:6643"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6643"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6643" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:6643: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:6643"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6643"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6643: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:6643"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6643"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6643" "while kill -0 \$TMPPID 2>/dev/null"




ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_56
#AT_START_57
at_fn_group_banner 57 'ovn.at:6647' \
  "ovn -- ovs-vswitchd restart" "                    " 2
at_xfail=no
(
  $as_echo "57. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init


ovn_start

ovn-nbctl ls-add ls1

ovn-nbctl lsp-add ls1 ls1-lp1 \
-- lsp-set-addresses ls1-lp1 "f0:00:00:00:00:01 10.0.0.4"

ovn-nbctl lsp-set-port-security ls1-lp1 "f0:00:00:00:00:01 10.0.0.4"

net_add n1
sim_add hv1

as hv1
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.1
ovs-vsctl -- add-port br-int hv1-vif1 -- \
    set interface hv1-vif1 external-ids:iface-id=ls1-lp1 \
    options:tx_pcap=hv1/vif1-tx.pcap \
    options:rxq_pcap=hv1/vif1-rx.pcap \
    ofport-request=1

{ set +x
$as_echo "$at_srcdir/ovn.at:6670: ovn_populate_arp__"
at_fn_check_prepare_trace "ovn.at:6670"
( $at_check_trace; ovn_populate_arp__
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6670"
$at_failed && at_fn_log_failure
$at_traceon; }

sleep 2

as hv1 ovs-vsctl show

echo "---------------------"
ovn-sbctl dump-flows
echo "---------------------"

echo "------ hv1 dump ----------"
as hv1 ovs-ofctl dump-flows br-int
total_flows=`as hv1 ovs-ofctl dump-flows br-int | wc -l`

echo "Total flows before vswitchd restart = " $total_flows

# Code taken from ovs-save utility
save_flows () {
    echo "ovs-ofctl add-flows br-int - << EOF" > restore_flows.sh
    as hv1 ovs-ofctl dump-flows "br-int" | sed -e '/NXST_FLOW/d' \
            -e 's/\(idle\|hard\)_age=^,*,//g' >> restore_flows.sh
    echo "EOF" >> restore_flows.sh
}

restart_vswitchd () {
    restore_flows=$1

    if test $restore_flows = true; then
        save_flows
    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:6701: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:6701"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6701"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6701: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:6701"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6701"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6701" "while kill -0 \$TMPPID 2>/dev/null"


    if test $restore_flows = true; then
        as hv1
        ovs-vsctl --no-wait set open_vswitch . other_config:flow-restore-wait="true"
    fi

    as hv1
    start_daemon ovs-vswitchd --enable-dummy=system -vvconn -vofproto_dpif -vunixctl
    ovs-ofctl dump-flows br-int

    if test $restore_flows = true; then
        sh ./restore_flows.sh
        echo "Flows after restore"
        as hv1
        ovs-ofctl dump-flows br-int
        ovs-vsctl --no-wait --if-exists remove open_vswitch . other_config \
            flow-restore-wait="true"
    fi
}

# Save the flows, restart vswitchd and restore the flows
restart_vswitchd true
ovs_wait_cond () {

    total_flows_after_restart=`as hv1 ovs-ofctl dump-flows br-int | wc -l`
    echo "Total flows after vswitchd restart = " $total_flows_after_restart
    test "${total_flows}" = "${total_flows_after_restart}"

}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6724" "until
    total_flows_after_restart=\`as hv1 ovs-ofctl dump-flows br-int | wc -l\`
    echo \"Total flows after vswitchd restart = \" \$total_flows_after_restart
    test \"\${total_flows}\" = \"\${total_flows_after_restart}\"
"


# Restart vswitchd without restoring
restart_vswitchd false
ovs_wait_cond () {

    total_flows_after_restart=`as hv1 ovs-ofctl dump-flows br-int | wc -l`
    echo "Total flows after vswitchd restart = " $total_flows_after_restart
    test "${total_flows}" = "${total_flows_after_restart}"

}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6732" "until
    total_flows_after_restart=\`as hv1 ovs-ofctl dump-flows br-int | wc -l\`
    echo \"Total flows after vswitchd restart = \" \$total_flows_after_restart
    test \"\${total_flows}\" = \"\${total_flows_after_restart}\"
"





    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:6738: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:6738"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6738"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6738: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:6738"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6738"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6738" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:6738: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:6738"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6738"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6738: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:6738"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6738"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6738" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:6738: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:6738"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6738"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6738: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:6738"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6738"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6738" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:6738: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:6738"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6738"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6738: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:6738"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6738"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6738" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:6738: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:6738"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6738"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6738: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:6738"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6738"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6738" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:6738: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:6738"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6738"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6738: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:6738"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6738"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6738" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:6738: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:6738"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6738"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6738: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:6738"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6738"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6738" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:6738: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:6738"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6738"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6738: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:6738"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6738"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6738" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:6738: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:6738"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6738"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6738: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:6738"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6738"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6738" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:6738: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:6738"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6738"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6738: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:6738"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6738"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6738" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:6738: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:6738"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6738"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6738: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:6738"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6738"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6738" "while kill -0 \$TMPPID 2>/dev/null"



ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_57
#AT_START_58
at_fn_group_banner 58 'ovn.at:6741' \
  "ovn -- send arp for nexthop" "                    " 2
at_xfail=no
(
  $as_echo "58. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

# Topology: Two LSs - ls1 and ls2 are connected via router r0

# Create logical switches
ovn-nbctl ls-add ls1
ovn-nbctl ls-add ls2

# Create  router
ovn-nbctl create Logical_Router name=lr0

# Add router ls1p1 port to gateway router
ovn-nbctl lrp-add lr0 lrp-ls1lp1 f0:00:00:00:00:01 192.168.0.1/24
ovn-nbctl lsp-add ls1 ls1lp1 -- set Logical_Switch_Port ls1lp1  \
    type=router options:router-port=lrp-ls1lp1 \
    addresses='"f0:00:00:00:00:01 192.168.0.1"'

# Add router ls2p2 port to gateway router
ovn-nbctl lrp-add lr0 lrp-ls2lp1 f0:00:00:00:00:02 192.168.1.1/24
ovn-nbctl lsp-add ls2 ls2lp1 -- set Logical_Switch_Port ls2lp1 \
    type=router options:router-port=lrp-ls2lp1 \
    addresses='"f0:00:00:00:00:02 192.168.1.1"'

# Set default gateway (nexthop) to 192.168.1.254
ovn-nbctl lr-route-add lr0 "0.0.0.0/0" 192.168.1.254 lrp-ls2lp1

# Create logical port ls1lp2 in ls1
ovn-nbctl lsp-add ls1 ls1lp2 \
-- lsp-set-addresses ls1lp2 "f0:00:00:00:00:03 192.168.0.2"

# Create logical port ls2lp2 in ls2
ovn-nbctl lsp-add ls2 ls2lp2 \
-- lsp-set-addresses ls2lp2 "f0:00:00:00:00:04 192.168.1.10"

net_add n1
sim_add hv1
as hv1
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.1
ovs-vsctl -- add-port br-int hv1-ls1lp2 -- \
    set interface hv1-ls1lp2 external-ids:iface-id=ls1lp2 \
    options:tx_pcap=hv1/ls1lp2-tx.pcap \
    options:rxq_pcap=hv1/ls1lp2-rx.pcap \
    ofport-request=1
ovs-vsctl -- add-port br-int hv1-ls2lp2 -- \
    set interface hv1-ls2lp2 external-ids:iface-id=ls2lp2 \
    options:tx_pcap=hv1/ls2lp2-tx.pcap \
    options:rxq_pcap=hv1/ls2lp2-rx.pcap \
    ofport-request=2

# Allow some time for ovn-northd and ovn-controller to catch up.
# XXX This should be more systematic.
sleep 1

echo "---------NB dump-----"
ovn-nbctl show
echo "---------------------"
ovn-nbctl list logical_router
echo "---------------------"
ovn-nbctl list logical_router_port
echo "---------------------"

echo "---------SB dump-----"
ovn-sbctl list datapath_binding
echo "---------------------"
ovn-sbctl list port_binding
echo "---------------------"
ovn-sbctl dump-flows
echo "---------------------"
ovn-sbctl list chassis
ovn-sbctl list encap
echo "---------------------"

echo "------Flows dump-----"
as hv1
ovs-ofctl dump-flows
echo "---------------------"

ip_to_hex() {
    printf "%02x%02x%02x%02x" "$@"
}

src_mac="f00000000003"
dst_mac="f00000000001"
src_ip=`ip_to_hex 192 168 0 2`
dst_ip=`ip_to_hex 8 8 8 8`
packet=${dst_mac}${src_mac}08004500001c0000000040110000${src_ip}${dst_ip}0035111100080000

# Send IP packet destined to 8.8.8.8 from lsp1lp2
as hv1 ovs-appctl netdev-dummy/receive hv1-ls1lp2 $packet

trim_zeros() {
    sed 's/\(00\)\{1,\}$//'
}

# ARP packet should be received with Target IP Address set to 192.168.1.254 and
# not 8.8.8.8

$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/ls2lp2-tx.pcap | trim_zeros > packets
expected="fffffffffffff0000000000208060001080006040001f00000000002c0a80101000000000000c0a801fe"
echo $expected > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:6843: cat packets"
at_fn_check_prepare_trace "ovn.at:6843"
( $at_check_trace; cat packets
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6843"
$at_failed && at_fn_log_failure
$at_traceon; }

cat packets




    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:6846: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:6846"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6846"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6846: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:6846"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6846"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6846" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:6846: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:6846"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6846"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6846: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:6846"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6846"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6846" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:6846: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:6846"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6846"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6846: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:6846"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6846"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6846" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:6846: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:6846"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6846"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6846: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:6846"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6846"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6846" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:6846: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:6846"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6846"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6846: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:6846"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6846"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6846" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:6846: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:6846"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6846"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6846: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:6846"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6846"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6846" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:6846: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:6846"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6846"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6846: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:6846"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6846"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6846" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:6846: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:6846"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6846"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6846: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:6846"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6846"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6846" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:6846: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:6846"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6846"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6846: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:6846"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6846"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6846" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:6846: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:6846"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6846"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6846: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:6846"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6846"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6846" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:6846: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:6846"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6846"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6846: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:6846"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6846"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6846" "while kill -0 \$TMPPID 2>/dev/null"




ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_58
#AT_START_59
at_fn_group_banner 59 'ovn.at:6850' \
  "ovn -- send gratuitous arp for nat ips in localnet" "" 2
at_xfail=no
(
  $as_echo "59. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start
# Create logical switch
ovn-nbctl ls-add ls0
# Create gateway router
ovn-nbctl create Logical_Router name=lr0 options:chassis=hv1
# Add router port to gateway router
ovn-nbctl lrp-add lr0 lrp0 f0:00:00:00:00:01 192.168.0.1/24
ovn-nbctl lsp-add ls0 lrp0-rp -- set Logical_Switch_Port lrp0-rp \
    type=router options:router-port=lrp0 addresses='"f0:00:00:00:00:01"'
# Add nat-address option
ovn-nbctl lsp-set-options lrp0-rp router-port=lrp0 nat-addresses="f0:00:00:00:00:01 192.168.0.2"

net_add n1
sim_add hv1
as hv1
ovs-vsctl \
    -- add-br br-phys \
    -- add-br br-eth0

ovn_attach n1 br-phys 192.168.0.1

{ set +x
$as_echo "$at_srcdir/ovn.at:6872: ovs-vsctl set Open_vSwitch . external-ids:ovn-bridge-mappings=physnet1:br-eth0"
at_fn_check_prepare_trace "ovn.at:6872"
( $at_check_trace; ovs-vsctl set Open_vSwitch . external-ids:ovn-bridge-mappings=physnet1:br-eth0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6872"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:6873: ovs-vsctl add-port br-eth0 snoopvif -- set Interface snoopvif options:tx_pcap=hv1/snoopvif-tx.pcap options:rxq_pcap=hv1/snoopvif-rx.pcap"
at_fn_check_prepare_trace "ovn.at:6873"
( $at_check_trace; ovs-vsctl add-port br-eth0 snoopvif -- set Interface snoopvif options:tx_pcap=hv1/snoopvif-tx.pcap options:rxq_pcap=hv1/snoopvif-rx.pcap
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6873"
$at_failed && at_fn_log_failure
$at_traceon; }


# Create a localnet port.
{ set +x
$as_echo "$at_srcdir/ovn.at:6876: ovn-nbctl lsp-add ls0 ln_port"
at_fn_check_prepare_trace "ovn.at:6876"
( $at_check_trace; ovn-nbctl lsp-add ls0 ln_port
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6876"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:6877: ovn-nbctl lsp-set-addresses ln_port unknown"
at_fn_check_prepare_trace "ovn.at:6877"
( $at_check_trace; ovn-nbctl lsp-set-addresses ln_port unknown
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6877"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:6878: ovn-nbctl lsp-set-type ln_port localnet"
at_fn_check_prepare_trace "ovn.at:6878"
( $at_check_trace; ovn-nbctl lsp-set-type ln_port localnet
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6878"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:6879: ovn-nbctl lsp-set-options ln_port network_name=physnet1"
at_fn_check_prepare_trace "ovn.at:6879"
( $at_check_trace; ovn-nbctl lsp-set-options ln_port network_name=physnet1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6879"
$at_failed && at_fn_log_failure
$at_traceon; }


# Wait until the patch ports are created in hv1 to connect br-int to br-eth0
ovs_wait_cond () {
    test 1 = `as hv1 ovs-vsctl show | \
grep "Port patch-br-int-to-ln_port" | wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6882" "until test 1 = \`as hv1 ovs-vsctl show | \\
grep \"Port patch-br-int-to-ln_port\" | wc -l\`"


# Wait for packet to be received.
ovs_wait_cond () {
    test `wc -c < "hv1/snoopvif-tx.pcap"` -ge 50
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6886" "until test \`wc -c < \"hv1/snoopvif-tx.pcap\"\` -ge 50"

trim_zeros() {
    sed 's/\(00\)\{1,\}$//'
}
$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/snoopvif-tx.pcap | trim_zeros > packets
expected="fffffffffffff0000000000108060001080006040001f00000000001c0a80001000000000000c0a80001"
echo $expected > expout
expected="fffffffffffff0000000000108060001080006040001f00000000001c0a80002000000000000c0a80002"
echo $expected >> expout
{ set +x
$as_echo "$at_srcdir/ovn.at:6895: sort packets"
at_fn_check_prepare_trace "ovn.at:6895"
( $at_check_trace; sort packets
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6895"
$at_failed && at_fn_log_failure
$at_traceon; }





    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:6897: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:6897"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6897"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6897: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:6897"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6897"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6897" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:6897: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:6897"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6897"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6897: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:6897"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6897"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6897" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:6897: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:6897"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6897"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6897: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:6897"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6897"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6897" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:6897: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:6897"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6897"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6897: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:6897"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6897"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6897" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:6897: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:6897"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6897"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6897: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:6897"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6897"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6897" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:6897: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:6897"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6897"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6897: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:6897"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6897"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6897" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:6897: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:6897"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6897"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6897: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:6897"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6897"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6897" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:6897: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:6897"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6897"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6897: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:6897"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6897"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6897" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:6897: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:6897"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6897"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6897: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:6897"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6897"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6897" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:6897: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:6897"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6897"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6897: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:6897"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6897"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6897" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:6897: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:6897"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6897"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6897: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:6897"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6897"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6897" "while kill -0 \$TMPPID 2>/dev/null"




ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_59
#AT_START_60
at_fn_group_banner 60 'ovn.at:6901' \
  "ovn -- send gratuitous arp with nat-addresses router in localnet" "" 2
at_xfail=no
(
  $as_echo "60. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start
# Create logical switch
ovn-nbctl ls-add ls0
# Create gateway router
ovn-nbctl create Logical_Router name=lr0 options:chassis=hv1
# Add router port to gateway router
ovn-nbctl lrp-add lr0 lrp0 f0:00:00:00:00:01 192.168.0.1/24
ovn-nbctl lsp-add ls0 lrp0-rp -- set Logical_Switch_Port lrp0-rp \
    type=router options:router-port=lrp0 addresses='"f0:00:00:00:00:01"'
# Add nat-address option
ovn-nbctl lsp-set-options lrp0-rp router-port=lrp0 nat-addresses="router"
# Add NAT rules
{ set +x
$as_echo "$at_srcdir/ovn.at:6914: ovn-nbctl lr-nat-add lr0 snat 192.168.0.1 10.0.0.0/24"
at_fn_check_prepare_trace "ovn.at:6914"
( $at_check_trace; ovn-nbctl lr-nat-add lr0 snat 192.168.0.1 10.0.0.0/24
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6914"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:6915: ovn-nbctl lr-nat-add lr0 dnat 192.168.0.2 10.0.0.1"
at_fn_check_prepare_trace "ovn.at:6915"
( $at_check_trace; ovn-nbctl lr-nat-add lr0 dnat 192.168.0.2 10.0.0.1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6915"
$at_failed && at_fn_log_failure
$at_traceon; }

# Add load balancers
{ set +x
$as_echo "$at_srcdir/ovn.at:6917: ovn-nbctl lb-add lb0 192.168.0.3:80 10.0.0.2:80,10.0.0.3:80"
at_fn_check_prepare_trace "ovn.at:6917"
( $at_check_trace; ovn-nbctl lb-add lb0 192.168.0.3:80 10.0.0.2:80,10.0.0.3:80
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6917"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:6918: ovn-nbctl lr-lb-add lr0 lb0"
at_fn_check_prepare_trace "ovn.at:6918"
( $at_check_trace; ovn-nbctl lr-lb-add lr0 lb0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6918"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:6919: ovn-nbctl lb-add lb1 192.168.0.3:8080 10.0.0.2:8080,10.0.0.3:8080"
at_fn_check_prepare_trace "ovn.at:6919"
( $at_check_trace; ovn-nbctl lb-add lb1 192.168.0.3:8080 10.0.0.2:8080,10.0.0.3:8080
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6919"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:6920: ovn-nbctl lr-lb-add lr0 lb1"
at_fn_check_prepare_trace "ovn.at:6920"
( $at_check_trace; ovn-nbctl lr-lb-add lr0 lb1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6920"
$at_failed && at_fn_log_failure
$at_traceon; }


net_add n1
sim_add hv1
as hv1
ovs-vsctl \
    -- add-br br-phys \
    -- add-br br-eth0

ovn_attach n1 br-phys 192.168.0.1

{ set +x
$as_echo "$at_srcdir/ovn.at:6931: ovs-vsctl set Open_vSwitch . external-ids:ovn-bridge-mappings=physnet1:br-eth0"
at_fn_check_prepare_trace "ovn.at:6931"
( $at_check_trace; ovs-vsctl set Open_vSwitch . external-ids:ovn-bridge-mappings=physnet1:br-eth0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6931"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:6932: ovs-vsctl add-port br-eth0 snoopvif -- set Interface snoopvif options:tx_pcap=hv1/snoopvif-tx.pcap options:rxq_pcap=hv1/snoopvif-rx.pcap"
at_fn_check_prepare_trace "ovn.at:6932"
( $at_check_trace; ovs-vsctl add-port br-eth0 snoopvif -- set Interface snoopvif options:tx_pcap=hv1/snoopvif-tx.pcap options:rxq_pcap=hv1/snoopvif-rx.pcap
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6932"
$at_failed && at_fn_log_failure
$at_traceon; }


# Create a localnet port.
{ set +x
$as_echo "$at_srcdir/ovn.at:6935: ovn-nbctl lsp-add ls0 ln_port"
at_fn_check_prepare_trace "ovn.at:6935"
( $at_check_trace; ovn-nbctl lsp-add ls0 ln_port
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6935"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:6936: ovn-nbctl lsp-set-addresses ln_port unknown"
at_fn_check_prepare_trace "ovn.at:6936"
( $at_check_trace; ovn-nbctl lsp-set-addresses ln_port unknown
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6936"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:6937: ovn-nbctl lsp-set-type ln_port localnet"
at_fn_check_prepare_trace "ovn.at:6937"
( $at_check_trace; ovn-nbctl lsp-set-type ln_port localnet
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6937"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:6938: ovn-nbctl lsp-set-options ln_port network_name=physnet1"
at_fn_check_prepare_trace "ovn.at:6938"
( $at_check_trace; ovn-nbctl lsp-set-options ln_port network_name=physnet1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6938"
$at_failed && at_fn_log_failure
$at_traceon; }


# Wait until the patch ports are created to connect br-int to br-eth0
ovs_wait_cond () {
    test 1 = `ovs-vsctl show | \
grep "Port patch-br-int-to-ln_port" | wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6941" "until test 1 = \`ovs-vsctl show | \\
grep \"Port patch-br-int-to-ln_port\" | wc -l\`"


ovn-sbctl list port_binding lrp0-rp
echo "*****"
ovn-nbctl list logical_switch_port lrp0-rp
ovn-nbctl list logical_router_port lrp0
ovn-nbctl show
# Wait for packet to be received.
ovs_wait_cond () {
    test `wc -c < "hv1/snoopvif-tx.pcap"` -ge 50
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6950" "until test \`wc -c < \"hv1/snoopvif-tx.pcap\"\` -ge 50"

trim_zeros() {
    sed 's/\(00\)\{1,\}$//'
}
$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/snoopvif-tx.pcap | trim_zeros > packets
expected="fffffffffffff0000000000108060001080006040001f00000000001c0a80001000000000000c0a80001"
echo $expected > expout
expected="fffffffffffff0000000000108060001080006040001f00000000001c0a80002000000000000c0a80002"
echo $expected >> expout
expected="fffffffffffff0000000000108060001080006040001f00000000001c0a80003000000000000c0a80003"
echo $expected >> expout
{ set +x
$as_echo "$at_srcdir/ovn.at:6961: sort packets"
at_fn_check_prepare_trace "ovn.at:6961"
( $at_check_trace; sort packets
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6961"
$at_failed && at_fn_log_failure
$at_traceon; }





    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:6963: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:6963"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6963"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6963: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:6963"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6963"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6963" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:6963: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:6963"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6963"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6963: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:6963"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6963"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6963" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:6963: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:6963"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6963"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6963: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:6963"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6963"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6963" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:6963: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:6963"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6963"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6963: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:6963"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6963"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6963" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:6963: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:6963"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6963"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6963: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:6963"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6963"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6963" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:6963: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:6963"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6963"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6963: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:6963"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6963"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6963" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:6963: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:6963"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6963"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6963: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:6963"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6963"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6963" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:6963: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:6963"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6963"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6963: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:6963"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6963"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6963" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:6963: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:6963"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6963"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6963: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:6963"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6963"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6963" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:6963: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:6963"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6963"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6963: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:6963"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6963"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6963" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:6963: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:6963"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6963"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6963: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:6963"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6963"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6963" "while kill -0 \$TMPPID 2>/dev/null"




ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_60
#AT_START_61
at_fn_group_banner 61 'ovn.at:6967' \
  "ovn -- delete mac bindings" "                     " 2
at_xfail=no
(
  $as_echo "61. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start
net_add n1
sim_add hv1
as hv1
ovs-vsctl -- add-br br-phys
ovn_attach n1 br-phys 192.168.0.1
# Create logical switch ls0
ovn-nbctl ls-add ls0
# Create ports lp0, lp1 in ls0
ovn-nbctl lsp-add ls0 lp0
ovn-nbctl lsp-add ls0 lp1
ovn-nbctl lsp-set-addresses lp0 "f0:00:00:00:00:01 192.168.0.1"
ovn-nbctl lsp-set-addresses lp1 "f0:00:00:00:00:02 192.168.0.2"
dp_uuid=`ovn-sbctl find datapath | grep uuid | cut -f2 -d ":" | cut -f2 -d " "`
ovn-sbctl create MAC_Binding ip=10.0.0.1 datapath=$dp_uuid logical_port=lp0 mac="mac1"
ovn-sbctl create MAC_Binding ip=10.0.0.1 datapath=$dp_uuid logical_port=lp1 mac="mac2"
ovn-sbctl find MAC_Binding
# Delete port lp0 and check that its MAC_Binding is deleted.
ovn-nbctl lsp-del lp0
ovn-sbctl find MAC_Binding
ovs_wait_cond () {
    test `ovn-sbctl find MAC_Binding logical_port=lp0 | wc -l` = 0
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6988" "until test \`ovn-sbctl find MAC_Binding logical_port=lp0 | wc -l\` = 0"

# Delete logical switch ls0 and check that its MAC_Binding is deleted.
ovn-nbctl ls-del ls0
ovn-sbctl find MAC_Binding
ovs_wait_cond () {
    test `ovn-sbctl find MAC_Binding | wc -l` = 0
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6992" "until test \`ovn-sbctl find MAC_Binding | wc -l\` = 0"





    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:6994: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:6994"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6994"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6994: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:6994"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6994"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6994" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:6994: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:6994"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6994"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6994: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:6994"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6994"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6994" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:6994: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:6994"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6994"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6994: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:6994"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6994"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6994" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:6994: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:6994"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6994"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6994: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:6994"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6994"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6994" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:6994: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:6994"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6994"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6994: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:6994"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6994"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6994" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:6994: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:6994"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6994"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6994: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:6994"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6994"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6994" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:6994: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:6994"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6994"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6994: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:6994"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6994"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6994" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:6994: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:6994"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6994"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6994: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:6994"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6994"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6994" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:6994: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:6994"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6994"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6994: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:6994"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6994"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6994" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:6994: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:6994"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6994"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6994: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:6994"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6994"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6994" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:6994: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:6994"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6994"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:6994: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:6994"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:6994"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:6994" "while kill -0 \$TMPPID 2>/dev/null"




ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_61
#AT_START_62
at_fn_group_banner 62 'ovn.at:6998' \
  "ovn -- conntrack zone allocation" "               " 2
at_xfail=no
(
  $as_echo "62. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

# Logical network:
# 2 logical switches "foo" (192.168.1.0/24) and "bar" (172.16.1.0/24)
# connected to a router R1.
# foo has foo1 to act as a client.
# bar has bar1, bar2, bar3 to act as servers.

net_add n1

sim_add hv1
as hv1
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.1
for i in foo1 bar1 bar2 bar3; do
    ovs-vsctl -- add-port br-int $i -- \
        set interface $i external-ids:iface-id=$i \
        options:tx_pcap=hv1/$i-tx.pcap \
        options:rxq_pcap=hv1/$i-rx.pcap
done

ovn-nbctl create Logical_Router name=R1
ovn-nbctl ls-add foo
ovn-nbctl ls-add bar

# Connect foo to R1
ovn-nbctl lrp-add R1 foo 00:00:01:01:02:03 192.168.1.1/24
ovn-nbctl lsp-add foo rp-foo -- set Logical_Switch_Port rp-foo \
    type=router options:router-port=foo addresses=\"00:00:01:01:02:03\"

# Connect bar to R1
ovn-nbctl lrp-add R1 bar 00:00:01:01:02:04 172.16.1.1/24
ovn-nbctl lsp-add bar rp-bar -- set Logical_Switch_Port rp-bar \
    type=router options:router-port=bar addresses=\"00:00:01:01:02:04\"

# Create logical port foo1 in foo
ovn-nbctl lsp-add foo foo1 \
-- lsp-set-addresses foo1 "f0:00:00:01:02:03 192.168.1.2"

# Create logical port bar1, bar2 and bar3 in bar
for i in `seq 1 3`; do
    ip=`expr $i + 1`
    ovn-nbctl lsp-add bar bar$i \
    -- lsp-set-addresses bar$i "f0:00:0a:01:02:$i 172.16.1.$ip"
done

ovs_wait_cond () {
    test `ovs-ofctl dump-flows br-int table=0 | grep REG13 | wc -l` -eq 4
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7045" "until test \`ovs-ofctl dump-flows br-int table=0 | grep REG13 | wc -l\` -eq 4"





    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:7047: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:7047"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7047"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7047: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:7047"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7047"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7047" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:7047: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:7047"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7047"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7047: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:7047"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7047"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7047" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:7047: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:7047"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7047"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7047: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:7047"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7047"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7047" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:7047: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:7047"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7047"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7047: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:7047"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7047"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7047" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:7047: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:7047"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7047"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7047: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:7047"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7047"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7047" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:7047: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:7047"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7047"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7047: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:7047"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7047"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7047" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:7047: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:7047"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7047"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7047: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:7047"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7047"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7047" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:7047: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:7047"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7047"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7047: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:7047"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7047"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7047" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:7047: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:7047"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7047"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7047: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:7047"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7047"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7047" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:7047: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:7047"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7047"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7047: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:7047"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7047"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7047" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:7047: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:7047"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7047"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7047: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:7047"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7047"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7047" "while kill -0 \$TMPPID 2>/dev/null"




ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_62
#AT_START_63
at_fn_group_banner 63 'ovn.at:7051' \
  "ovn -- tag allocation" "                          " 2
at_xfail=no
(
  $as_echo "63. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

{ set +x
$as_echo "$at_srcdir/ovn.at:7054: ovn-nbctl ls-add ls0"
at_fn_check_prepare_trace "ovn.at:7054"
( $at_check_trace; ovn-nbctl ls-add ls0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7054"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:7055: ovn-nbctl lsp-add ls0 parent1"
at_fn_check_prepare_trace "ovn.at:7055"
( $at_check_trace; ovn-nbctl lsp-add ls0 parent1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7055"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:7056: ovn-nbctl lsp-add ls0 parent2"
at_fn_check_prepare_trace "ovn.at:7056"
( $at_check_trace; ovn-nbctl lsp-add ls0 parent2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7056"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:7057: ovn-nbctl ls-add ls1"
at_fn_check_prepare_trace "ovn.at:7057"
( $at_check_trace; ovn-nbctl ls-add ls1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7057"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn.at:7060: ovn-nbctl --wait=sb lsp-add ls1 c0 parent1 3"
at_fn_check_prepare_trace "ovn.at:7060"
( $at_check_trace; ovn-nbctl --wait=sb lsp-add ls1 c0 parent1 3
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7060"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:7061: ovn-nbctl lsp-get-tag c0"
at_fn_check_prepare_trace "ovn.at:7061"
( $at_check_trace; ovn-nbctl lsp-get-tag c0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "3
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7061"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:7064: ovn-sbctl --data=bare --no-heading --columns=tag find port_binding \\
logical_port=\"c0\""
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:7064"
( $at_check_trace; ovn-sbctl --data=bare --no-heading --columns=tag find port_binding \
logical_port="c0"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "3
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7064"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn.at:7069: ovn-nbctl --wait=sb lsp-add ls1 c1 parent1 0"
at_fn_check_prepare_trace "ovn.at:7069"
( $at_check_trace; ovn-nbctl --wait=sb lsp-add ls1 c1 parent1 0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7069"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:7070: ovn-nbctl lsp-get-tag c1"
at_fn_check_prepare_trace "ovn.at:7070"
( $at_check_trace; ovn-nbctl lsp-get-tag c1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7070"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:7072: ovn-sbctl --data=bare --no-heading --columns=tag find port_binding \\
logical_port=\"c1\""
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:7072"
( $at_check_trace; ovn-sbctl --data=bare --no-heading --columns=tag find port_binding \
logical_port="c1"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7072"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn.at:7076: ovn-nbctl --wait=sb lsp-add ls1 c2 parent1 0"
at_fn_check_prepare_trace "ovn.at:7076"
( $at_check_trace; ovn-nbctl --wait=sb lsp-add ls1 c2 parent1 0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7076"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:7077: ovn-nbctl lsp-get-tag c2"
at_fn_check_prepare_trace "ovn.at:7077"
( $at_check_trace; ovn-nbctl lsp-get-tag c2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "2
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7077"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:7079: ovn-sbctl --data=bare --no-heading --columns=tag find port_binding \\
logical_port=\"c2\""
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:7079"
( $at_check_trace; ovn-sbctl --data=bare --no-heading --columns=tag find port_binding \
logical_port="c2"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "2
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7079"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:7082: ovn-nbctl --wait=sb lsp-add ls1 c3 parent1 0"
at_fn_check_prepare_trace "ovn.at:7082"
( $at_check_trace; ovn-nbctl --wait=sb lsp-add ls1 c3 parent1 0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7082"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:7083: ovn-nbctl lsp-get-tag c3"
at_fn_check_prepare_trace "ovn.at:7083"
( $at_check_trace; ovn-nbctl lsp-get-tag c3
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "4
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7083"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:7085: ovn-sbctl --data=bare --no-heading --columns=tag find port_binding \\
logical_port=\"c3\""
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:7085"
( $at_check_trace; ovn-sbctl --data=bare --no-heading --columns=tag find port_binding \
logical_port="c3"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "4
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7085"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn.at:7090: ovn-nbctl --wait=sb lsp-add ls1 c4 parent2 0"
at_fn_check_prepare_trace "ovn.at:7090"
( $at_check_trace; ovn-nbctl --wait=sb lsp-add ls1 c4 parent2 0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7090"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:7091: ovn-nbctl lsp-get-tag c4"
at_fn_check_prepare_trace "ovn.at:7091"
( $at_check_trace; ovn-nbctl lsp-get-tag c4
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7091"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:7093: ovn-sbctl --data=bare --no-heading --columns=tag find port_binding \\
logical_port=\"c4\""
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:7093"
( $at_check_trace; ovn-sbctl --data=bare --no-heading --columns=tag find port_binding \
logical_port="c4"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7093"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn.at:7097: ovn-nbctl --wait=sb lsp-add ls1 c5 parent2 0"
at_fn_check_prepare_trace "ovn.at:7097"
( $at_check_trace; ovn-nbctl --wait=sb lsp-add ls1 c5 parent2 0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7097"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:7098: ovn-nbctl lsp-get-tag c5"
at_fn_check_prepare_trace "ovn.at:7098"
( $at_check_trace; ovn-nbctl lsp-get-tag c5
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "2
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7098"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:7100: ovn-sbctl --data=bare --no-heading --columns=tag find port_binding \\
logical_port=\"c5\""
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:7100"
( $at_check_trace; ovn-sbctl --data=bare --no-heading --columns=tag find port_binding \
logical_port="c5"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "2
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7100"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn.at:7105: ovn-nbctl --wait=sb lsp-del c1"
at_fn_check_prepare_trace "ovn.at:7105"
( $at_check_trace; ovn-nbctl --wait=sb lsp-del c1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7105"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:7106: ovn-nbctl --wait=sb lsp-add ls1 c6 parent1 0"
at_fn_check_prepare_trace "ovn.at:7106"
( $at_check_trace; ovn-nbctl --wait=sb lsp-add ls1 c6 parent1 0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7106"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:7107: ovn-nbctl lsp-get-tag c6"
at_fn_check_prepare_trace "ovn.at:7107"
( $at_check_trace; ovn-nbctl lsp-get-tag c6
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7107"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:7109: ovn-sbctl --data=bare --no-heading --columns=tag find port_binding \\
logical_port=\"c6\""
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:7109"
( $at_check_trace; ovn-sbctl --data=bare --no-heading --columns=tag find port_binding \
logical_port="c6"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7109"
$at_failed && at_fn_log_failure
$at_traceon; }


as northd
{ set +x
$as_echo "$at_srcdir/ovn.at:7115: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:7115"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7115"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7115: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:7115"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7115"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7115" "while kill -0 \$TMPPID 2>/dev/null"

start_daemon ovn-northd \
    --ovnnb-db=unix:"$ovs_base"/ovn-nb/ovn-nb.sock \
    --ovnsb-db=unix:"$ovs_base"/ovn-sb/ovn-sb.sock

{ set +x
$as_echo "$at_srcdir/ovn.at:7121: ovn-nbctl --wait=sb ls-add ls-dummy"
at_fn_check_prepare_trace "ovn.at:7121"
( $at_check_trace; ovn-nbctl --wait=sb ls-add ls-dummy
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7121"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:7122: ovn-nbctl lsp-get-tag c0"
at_fn_check_prepare_trace "ovn.at:7122"
( $at_check_trace; ovn-nbctl lsp-get-tag c0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "3
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7122"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:7124: ovn-nbctl lsp-get-tag c6"
at_fn_check_prepare_trace "ovn.at:7124"
( $at_check_trace; ovn-nbctl lsp-get-tag c6
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7124"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:7126: ovn-nbctl lsp-get-tag c2"
at_fn_check_prepare_trace "ovn.at:7126"
( $at_check_trace; ovn-nbctl lsp-get-tag c2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "2
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7126"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:7128: ovn-nbctl lsp-get-tag c3"
at_fn_check_prepare_trace "ovn.at:7128"
( $at_check_trace; ovn-nbctl lsp-get-tag c3
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "4
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7128"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:7130: ovn-nbctl lsp-get-tag c4"
at_fn_check_prepare_trace "ovn.at:7130"
( $at_check_trace; ovn-nbctl lsp-get-tag c4
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7130"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:7132: ovn-nbctl lsp-get-tag c5"
at_fn_check_prepare_trace "ovn.at:7132"
( $at_check_trace; ovn-nbctl lsp-get-tag c5
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "2
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7132"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn.at:7137: ovn-nbctl --wait=sb lsp-add ls1 c7 parent2 2"
at_fn_check_prepare_trace "ovn.at:7137"
( $at_check_trace; ovn-nbctl --wait=sb lsp-add ls1 c7 parent2 2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7137"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:7138: ovn-nbctl lsp-get-tag c7"
at_fn_check_prepare_trace "ovn.at:7138"
( $at_check_trace; ovn-nbctl lsp-get-tag c7
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "2
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7138"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:7140: ovn-sbctl --data=bare --no-heading --columns=tag find port_binding \\
logical_port=\"c7\""
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:7140"
( $at_check_trace; ovn-sbctl --data=bare --no-heading --columns=tag find port_binding \
logical_port="c7"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "2
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7140"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:7143: ovn-nbctl lsp-get-tag c5"
at_fn_check_prepare_trace "ovn.at:7143"
( $at_check_trace; ovn-nbctl lsp-get-tag c5
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "2
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7143"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn.at:7146: ovn-nbctl ls-add ls2"
at_fn_check_prepare_trace "ovn.at:7146"
( $at_check_trace; ovn-nbctl ls-add ls2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7146"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:7149: ovn-nbctl --wait=sb lsp-add ls2 local0 \"\" 25"
at_fn_check_prepare_trace "ovn.at:7149"
( $at_check_trace; ovn-nbctl --wait=sb lsp-add ls2 local0 "" 25
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7149"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:7150: ovn-nbctl lsp-get-tag local0"
at_fn_check_prepare_trace "ovn.at:7150"
( $at_check_trace; ovn-nbctl lsp-get-tag local0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "25
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7150"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:7153: ovn-sbctl --data=bare --no-heading --columns=tag find port_binding \\
logical_port=\"local0\""
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:7153"
( $at_check_trace; ovn-sbctl --data=bare --no-heading --columns=tag find port_binding \
logical_port="local0"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "25
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7153"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:7157: ovn-nbctl --wait=sb lsp-add ls2 local1 \"\" 0"
at_fn_check_prepare_trace "ovn.at:7157"
( $at_check_trace; ovn-nbctl --wait=sb lsp-add ls2 local1 "" 0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7157"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:7158: ovn-nbctl lsp-get-tag local1"
at_fn_check_prepare_trace "ovn.at:7158"
( $at_check_trace; ovn-nbctl lsp-get-tag local1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7158"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:7160: ovn-nbctl --wait=sb  set logical_switch_port local1 tag_request=50"
at_fn_check_prepare_trace "ovn.at:7160"
( $at_check_trace; ovn-nbctl --wait=sb  set logical_switch_port local1 tag_request=50
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7160"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:7161: ovn-nbctl lsp-get-tag local1"
at_fn_check_prepare_trace "ovn.at:7161"
( $at_check_trace; ovn-nbctl lsp-get-tag local1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "50
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7161"
$at_failed && at_fn_log_failure
$at_traceon; }


ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_63
#AT_START_64
at_fn_group_banner 64 'ovn.at:7166' \
  "ovn -- lsp deletion and broadcast-flow deletion on localnet" "" 2
at_xfail=no
(
  $as_echo "64. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start
ovn-nbctl ls-add lsw0
net_add n1
for i in 1 2; do
    sim_add hv$i
    as hv$i
    ovs-vsctl add-br br-phys
    ovn_attach n1 br-phys 192.168.0.$i
    ovs-vsctl add-br br-eth0
    { set +x
$as_echo "$at_srcdir/ovn.at:7176: ovs-vsctl set Open_vSwitch . external-ids:ovn-bridge-mappings=physnet1:br-eth0"
at_fn_check_prepare_trace "ovn.at:7176"
( $at_check_trace; ovs-vsctl set Open_vSwitch . external-ids:ovn-bridge-mappings=physnet1:br-eth0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7176"
$at_failed && at_fn_log_failure
$at_traceon; }

done

# Create a localnet port.
{ set +x
$as_echo "$at_srcdir/ovn.at:7180: ovn-nbctl lsp-add lsw0 ln_port"
at_fn_check_prepare_trace "ovn.at:7180"
( $at_check_trace; ovn-nbctl lsp-add lsw0 ln_port
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7180"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:7181: ovn-nbctl lsp-set-addresses ln_port unknown"
at_fn_check_prepare_trace "ovn.at:7181"
( $at_check_trace; ovn-nbctl lsp-set-addresses ln_port unknown
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7181"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:7182: ovn-nbctl lsp-set-type ln_port localnet"
at_fn_check_prepare_trace "ovn.at:7182"
( $at_check_trace; ovn-nbctl lsp-set-type ln_port localnet
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7182"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:7183: ovn-nbctl lsp-set-options ln_port network_name=physnet1"
at_fn_check_prepare_trace "ovn.at:7183"
( $at_check_trace; ovn-nbctl lsp-set-options ln_port network_name=physnet1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7183"
$at_failed && at_fn_log_failure
$at_traceon; }



# Create 3 vifs.
{ set +x
$as_echo "$at_srcdir/ovn.at:7187: ovn-nbctl lsp-add lsw0 localvif1"
at_fn_check_prepare_trace "ovn.at:7187"
( $at_check_trace; ovn-nbctl lsp-add lsw0 localvif1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7187"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:7188: ovn-nbctl lsp-set-addresses localvif1 \"f0:00:00:00:00:01 192.168.1.1\""
at_fn_check_prepare_trace "ovn.at:7188"
( $at_check_trace; ovn-nbctl lsp-set-addresses localvif1 "f0:00:00:00:00:01 192.168.1.1"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7188"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:7189: ovn-nbctl lsp-set-port-security localvif1 \"f0:00:00:00:00:01\""
at_fn_check_prepare_trace "ovn.at:7189"
( $at_check_trace; ovn-nbctl lsp-set-port-security localvif1 "f0:00:00:00:00:01"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7189"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:7190: ovn-nbctl lsp-add lsw0 localvif2"
at_fn_check_prepare_trace "ovn.at:7190"
( $at_check_trace; ovn-nbctl lsp-add lsw0 localvif2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7190"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:7191: ovn-nbctl lsp-set-addresses localvif2 \"f0:00:00:00:00:02 192.168.1.2\""
at_fn_check_prepare_trace "ovn.at:7191"
( $at_check_trace; ovn-nbctl lsp-set-addresses localvif2 "f0:00:00:00:00:02 192.168.1.2"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7191"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:7192: ovn-nbctl lsp-set-port-security localvif2 \"f0:00:00:00:00:02\""
at_fn_check_prepare_trace "ovn.at:7192"
( $at_check_trace; ovn-nbctl lsp-set-port-security localvif2 "f0:00:00:00:00:02"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7192"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:7193: ovn-nbctl lsp-add lsw0 localvif3"
at_fn_check_prepare_trace "ovn.at:7193"
( $at_check_trace; ovn-nbctl lsp-add lsw0 localvif3
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7193"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:7194: ovn-nbctl lsp-set-addresses localvif3 \"f0:00:00:00:00:03 192.168.1.3\""
at_fn_check_prepare_trace "ovn.at:7194"
( $at_check_trace; ovn-nbctl lsp-set-addresses localvif3 "f0:00:00:00:00:03 192.168.1.3"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7194"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:7195: ovn-nbctl lsp-set-port-security localvif3 \"f0:00:00:00:00:03\""
at_fn_check_prepare_trace "ovn.at:7195"
( $at_check_trace; ovn-nbctl lsp-set-port-security localvif3 "f0:00:00:00:00:03"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7195"
$at_failed && at_fn_log_failure
$at_traceon; }


# Bind the localvif1 to hv1.
as hv1
{ set +x
$as_echo "$at_srcdir/ovn.at:7199: ovs-vsctl add-port br-int localvif1 -- set Interface localvif1 external_ids:iface-id=localvif1"
at_fn_check_prepare_trace "ovn.at:7199"
( $at_check_trace; ovs-vsctl add-port br-int localvif1 -- set Interface localvif1 external_ids:iface-id=localvif1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7199"
$at_failed && at_fn_log_failure
$at_traceon; }


# On hv1, check that there are no flows outputting bcast to tunnel
ovs_wait_cond () {
    test `ovs-ofctl dump-flows br-int table=32 | ofctl_strip | grep output | wc -l` -eq 0
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7202" "until test \`ovs-ofctl dump-flows br-int table=32 | ofctl_strip | grep output | wc -l\` -eq 0"


# On hv2, check that no flow outputs bcast to tunnel to hv1.
as hv2
ovs_wait_cond () {
    test `ovs-ofctl dump-flows br-int table=32 | ofctl_strip | grep output | wc -l` -eq 0
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7206" "until test \`ovs-ofctl dump-flows br-int table=32 | ofctl_strip | grep output | wc -l\` -eq 0"


# Now bind vif2 on hv2.
{ set +x
$as_echo "$at_srcdir/ovn.at:7209: ovs-vsctl add-port br-int localvif2 -- set Interface localvif2 external_ids:iface-id=localvif2"
at_fn_check_prepare_trace "ovn.at:7209"
( $at_check_trace; ovs-vsctl add-port br-int localvif2 -- set Interface localvif2 external_ids:iface-id=localvif2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7209"
$at_failed && at_fn_log_failure
$at_traceon; }


# At this point, the broadcast flow on vif2 should be deleted.
# because, there is now a localnet vif bound (table=32 programming logic)
ovs_wait_cond () {
    test `ovs-ofctl dump-flows br-int table=32 | ofctl_strip | grep output | wc -l` -eq 0
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7213" "until test \`ovs-ofctl dump-flows br-int table=32 | ofctl_strip | grep output | wc -l\` -eq 0"


# Verify that the local net patch port exists on hv2.
ovs_wait_cond () {
    test `ovs-vsctl show | grep "Port patch-br-int-to-ln_port" | wc -l` -eq 1
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7216" "until test \`ovs-vsctl show | grep \"Port patch-br-int-to-ln_port\" | wc -l\` -eq 1"


# Now bind vif3 on hv2.
{ set +x
$as_echo "$at_srcdir/ovn.at:7219: ovs-vsctl add-port br-int localvif3 -- set Interface localvif3 external_ids:iface-id=localvif3"
at_fn_check_prepare_trace "ovn.at:7219"
( $at_check_trace; ovs-vsctl add-port br-int localvif3 -- set Interface localvif3 external_ids:iface-id=localvif3
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7219"
$at_failed && at_fn_log_failure
$at_traceon; }


# Verify that the local net patch port still exists on hv2
ovs_wait_cond () {
    test `ovs-vsctl show | grep "Port patch-br-int-to-ln_port" | wc -l` -eq 1
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7222" "until test \`ovs-vsctl show | grep \"Port patch-br-int-to-ln_port\" | wc -l\` -eq 1"


# Delete localvif2
{ set +x
$as_echo "$at_srcdir/ovn.at:7225: ovn-nbctl lsp-del localvif2"
at_fn_check_prepare_trace "ovn.at:7225"
( $at_check_trace; ovn-nbctl lsp-del localvif2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7225"
$at_failed && at_fn_log_failure
$at_traceon; }


# Verify that the local net patch port still exists on hv2,
# because, localvif3 is still bound.
ovs_wait_cond () {
    test `ovs-vsctl show | grep "Port patch-br-int-to-ln_port" | wc -l` -eq 1
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7229" "until test \`ovs-vsctl show | grep \"Port patch-br-int-to-ln_port\" | wc -l\` -eq 1"





    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:7231: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:7231"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7231"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7231: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:7231"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7231"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7231" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:7231: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:7231"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7231"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7231: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:7231"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7231"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7231" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:7231: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:7231"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7231"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7231: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:7231"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7231"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7231" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:7231: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:7231"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7231"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7231: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:7231"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7231"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7231" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:7231: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:7231"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7231"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7231: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:7231"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7231"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7231" "while kill -0 \$TMPPID 2>/dev/null"





    as hv2
    if test "hv2" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:7231: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:7231"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7231"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7231: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:7231"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7231"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7231" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:7231: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:7231"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7231"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7231: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:7231"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7231"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7231" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:7231: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:7231"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7231"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7231: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:7231"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7231"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7231" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv2
    { set +x
$as_echo "$at_srcdir/ovn.at:7231: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:7231"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7231"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7231: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:7231"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7231"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7231" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:7231: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:7231"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7231"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7231: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:7231"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7231"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7231" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:7231: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:7231"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7231"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7231: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:7231"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7231"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7231" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:7231: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:7231"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7231"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7231: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:7231"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7231"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7231" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:7231: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:7231"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7231"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7231: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:7231"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7231"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7231" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:7231: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:7231"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7231"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7231: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:7231"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7231"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7231" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:7231: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:7231"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7231"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7231: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:7231"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7231"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7231" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:7231: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:7231"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7231"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7231: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:7231"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7231"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7231" "while kill -0 \$TMPPID 2>/dev/null"




ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_64
#AT_START_65
at_fn_group_banner 65 'ovn.at:7236' \
  "ovn -- ACL logging" "                             " 2
at_xfail=no
(
  $as_echo "65. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init


ovn_start

net_add n1

sim_add hv
as hv
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.1
for i in lp1 lp2; do
    ovs-vsctl -- add-port br-int $i -- \
        set interface $i external-ids:iface-id=$i \
        options:tx_pcap=hv/$i-tx.pcap \
        options:rxq_pcap=hv/$i-rx.pcap
done

lp1_mac="f0:00:00:00:00:01"
lp1_ip="192.168.1.2"

lp2_mac="f0:00:00:00:00:02"
lp2_ip="192.168.1.3"

ovn-nbctl ls-add lsw0
ovn-nbctl --wait=sb lsp-add lsw0 lp1
ovn-nbctl --wait=sb lsp-add lsw0 lp2
ovn-nbctl lsp-set-addresses lp1 $lp1_mac
ovn-nbctl lsp-set-addresses lp2 $lp2_mac
ovn-nbctl --wait=sb sync

ovn-nbctl acl-add lsw0 to-lport 1000 'tcp.dst==80' drop
ovn-nbctl --log --severity=alert --name=drop-flow acl-add lsw0 to-lport 1000 'tcp.dst==81' drop

ovn-nbctl acl-add lsw0 to-lport 1000 'tcp.dst==82' allow
ovn-nbctl --log --severity=info --name=allow-flow acl-add lsw0 to-lport 1000 'tcp.dst==83' allow

ovn-nbctl acl-add lsw0 to-lport 1000 'tcp.dst==84' allow-related
ovn-nbctl --log acl-add lsw0 to-lport 1000 'tcp.dst==85' allow-related

ovn-nbctl acl-add lsw0 to-lport 1000 'tcp.dst==86' reject
ovn-nbctl --wait=hv --log --severity=alert --name=reject-flow acl-add lsw0 to-lport 1000 'tcp.dst==87' reject

ovn-sbctl dump-flows


# Send packet that should be dropped without logging.
packet="inport==\"lp1\" && eth.src==$lp1_mac && eth.dst==$lp2_mac &&
        ip4 && ip.ttl==64 && ip4.src==$lp1_ip && ip4.dst==$lp2_ip &&
        tcp && tcp.flags==2 && tcp.src==4360 && tcp.dst==80"
as hv ovs-appctl -t ovn-controller inject-pkt "$packet"

# Send packet that should be dropped with logging.
packet="inport==\"lp1\" && eth.src==$lp1_mac && eth.dst==$lp2_mac &&
        ip4 && ip.ttl==64 && ip4.src==$lp1_ip && ip4.dst==$lp2_ip &&
        tcp && tcp.flags==2 && tcp.src==4361 && tcp.dst==81"
as hv ovs-appctl -t ovn-controller inject-pkt "$packet"

# Send packet that should be allowed without logging.
packet="inport==\"lp1\" && eth.src==$lp1_mac && eth.dst==$lp2_mac &&
        ip4 && ip.ttl==64 && ip4.src==$lp1_ip && ip4.dst==$lp2_ip &&
        tcp && tcp.flags==2 && tcp.src==4362 && tcp.dst==82"
as hv ovs-appctl -t ovn-controller inject-pkt "$packet"

# Send packet that should be allowed with logging.
packet="inport==\"lp1\" && eth.src==$lp1_mac && eth.dst==$lp2_mac &&
        ip4 && ip.ttl==64 && ip4.src==$lp1_ip && ip4.dst==$lp2_ip &&
        tcp && tcp.flags==2 && tcp.src==4363 && tcp.dst==83"
as hv ovs-appctl -t ovn-controller inject-pkt "$packet"

# Send packet that should allow related flows without logging.
packet="inport==\"lp1\" && eth.src==$lp1_mac && eth.dst==$lp2_mac &&
        ip4 && ip.ttl==64 && ip4.src==$lp1_ip && ip4.dst==$lp2_ip &&
        tcp && tcp.flags==2 && tcp.src==4364 && tcp.dst==84"
as hv ovs-appctl -t ovn-controller inject-pkt "$packet"

# Send packet that should allow related flows with logging.
packet="inport==\"lp1\" && eth.src==$lp1_mac && eth.dst==$lp2_mac &&
        ip4 && ip.ttl==64 && ip4.src==$lp1_ip && ip4.dst==$lp2_ip &&
        tcp && tcp.flags==2 && tcp.src==4365 && tcp.dst==85"
as hv ovs-appctl -t ovn-controller inject-pkt "$packet"

# Send packet that should be rejected without logging.
packet="inport==\"lp1\" && eth.src==$lp1_mac && eth.dst==$lp2_mac &&
        ip4 && ip.ttl==64 && ip4.src==$lp1_ip && ip4.dst==$lp2_ip &&
        tcp && tcp.flags==2 && tcp.src==4366 && tcp.dst==86"
as hv ovs-appctl -t ovn-controller inject-pkt "$packet"

# Send packet that should be rejected with logging.
packet="inport==\"lp1\" && eth.src==$lp1_mac && eth.dst==$lp2_mac &&
        ip4 && ip.ttl==64 && ip4.src==$lp1_ip && ip4.dst==$lp2_ip &&
        tcp && tcp.flags==2 && tcp.src==4367 && tcp.dst==87"
as hv ovs-appctl -t ovn-controller inject-pkt "$packet"

ovs_wait_cond () {
     test 4 = $(grep -c 'acl_log' hv/ovn-controller.log)
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7329" "until  test 4 = \$(grep -c 'acl_log' hv/ovn-controller.log) "


{ set +x
$as_echo "$at_srcdir/ovn.at:7331: grep 'acl_log' hv/ovn-controller.log | sed 's/.*name=/name=/'"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:7331"
( $at_check_trace; grep 'acl_log' hv/ovn-controller.log | sed 's/.*name=/name=/'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "name=\"drop-flow\", verdict=drop, severity=alert: tcp,vlan_tci=0x0000,dl_src=f0:00:00:00:00:01,dl_dst=f0:00:00:00:00:02,nw_src=192.168.1.2,nw_dst=192.168.1.3,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=4361,tp_dst=81,tcp_flags=syn
name=\"allow-flow\", verdict=allow, severity=info: tcp,vlan_tci=0x0000,dl_src=f0:00:00:00:00:01,dl_dst=f0:00:00:00:00:02,nw_src=192.168.1.2,nw_dst=192.168.1.3,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=4363,tp_dst=83,tcp_flags=syn
name=\"<unnamed>\", verdict=allow, severity=info: tcp,vlan_tci=0x0000,dl_src=f0:00:00:00:00:01,dl_dst=f0:00:00:00:00:02,nw_src=192.168.1.2,nw_dst=192.168.1.3,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=4365,tp_dst=85,tcp_flags=syn
name=\"reject-flow\", verdict=reject, severity=alert: tcp,vlan_tci=0x0000,dl_src=f0:00:00:00:00:01,dl_dst=f0:00:00:00:00:02,nw_src=192.168.1.2,nw_dst=192.168.1.3,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=4367,tp_dst=87,tcp_flags=syn
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7331"
$at_failed && at_fn_log_failure
$at_traceon; }





    as hv
    if test "hv" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:7338: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:7338"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7338"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7338: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:7338"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7338"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7338" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:7338: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:7338"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7338"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7338: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:7338"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7338"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7338" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:7338: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:7338"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7338"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7338: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:7338"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7338"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7338" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv
    { set +x
$as_echo "$at_srcdir/ovn.at:7338: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:7338"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7338"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7338: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:7338"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7338"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7338" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:7338: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:7338"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7338"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7338: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:7338"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7338"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7338" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:7338: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:7338"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7338"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7338: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:7338"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7338"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7338" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:7338: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:7338"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7338"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7338: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:7338"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7338"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7338" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:7338: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:7338"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7338"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7338: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:7338"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7338"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7338" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:7338: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:7338"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7338"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7338: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:7338"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7338"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7338" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:7338: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:7338"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7338"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7338: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:7338"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7338"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7338" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:7338: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:7338"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7338"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7338: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:7338"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7338"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7338" "while kill -0 \$TMPPID 2>/dev/null"



ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_65
#AT_START_66
at_fn_group_banner 66 'ovn.at:7342' \
  "ovn -- ACL rate-limited logging" "                " 2
at_xfail=no
(
  $as_echo "66. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init


ovn_start

net_add n1

sim_add hv
as hv
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.1
for i in lp1 lp2; do
    ovs-vsctl -- add-port br-int $i -- \
        set interface $i external-ids:iface-id=$i \
        options:tx_pcap=hv/$i-tx.pcap \
        options:rxq_pcap=hv/$i-rx.pcap
done

lp1_mac="f0:00:00:00:00:01"
lp1_ip="192.168.1.2"

lp2_mac="f0:00:00:00:00:02"
lp2_ip="192.168.1.3"

ovn-nbctl ls-add lsw0
ovn-nbctl --wait=sb lsp-add lsw0 lp1
ovn-nbctl --wait=sb lsp-add lsw0 lp2
ovn-nbctl lsp-set-addresses lp1 $lp1_mac
ovn-nbctl lsp-set-addresses lp2 $lp2_mac
ovn-nbctl --wait=sb sync


# Add an ACL that rate-limits logs at 10 per second.
ovn-nbctl meter-add http-rl1 drop 10 pktps
ovn-nbctl --log --severity=alert --meter=http-rl1 --name=http-acl1 acl-add lsw0 to-lport 1000 'tcp.dst==80' drop

# Add an ACL that rate-limits logs at 5 per second.
ovn-nbctl meter-add http-rl2 drop 5 pktps
ovn-nbctl --log --severity=alert --meter=http-rl2 --name=http-acl2 acl-add lsw0 to-lport 1000 'tcp.dst==81' allow

# Add an ACL that doesn't rate-limit logs.
ovn-nbctl --log --severity=alert --name=http-acl3 acl-add lsw0 to-lport 1000 'tcp.dst==82' drop
ovn-nbctl --wait=hv sync

# For each ACL, send 100 packets.
for i in `seq 1 100`; do
    ovs-appctl netdev-dummy/receive lp1 'in_port(1),eth(src=f0:00:00:00:00:01,dst=f0:00:00:00:00:02),eth_type(0x0800),ipv4(src=192.168.1.2,dst=192.168.1.3,proto=6,tos=0,ttl=64,frag=no),tcp(src=7777,dst=80)'

    ovs-appctl netdev-dummy/receive lp1 'in_port(1),eth(src=f0:00:00:00:00:01,dst=f0:00:00:00:00:02),eth_type(0x0800),ipv4(src=192.168.1.2,dst=192.168.1.3,proto=6,tos=0,ttl=64,frag=no),tcp(src=7777,dst=81)'

    ovs-appctl netdev-dummy/receive lp1 'in_port(1),eth(src=f0:00:00:00:00:01,dst=f0:00:00:00:00:02),eth_type(0x0800),ipv4(src=192.168.1.2,dst=192.168.1.3,proto=6,tos=0,ttl=64,frag=no),tcp(src=7777,dst=82)'
done

# The rate at which packets are sent is highly system-dependent, so we
# can't count on precise drop counts.  To work around that, we just
# check that exactly 100 "http-acl3" actions were logged and that there
# were more "http-acl1" actions than "http-acl2" ones.
ovs_wait_cond () {
     test 100 = $(grep -c 'http-acl3' hv/ovn-controller.log)
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7398" "until  test 100 = \$(grep -c 'http-acl3' hv/ovn-controller.log) "


# On particularly slow or overloaded systems, the transmission rate may
# be lower than the configured meter rate.  To prevent false test
# failures, we check the duration count of the meter, and if it's
# greater than nine seconds, just skip the test.
d_secs=$(as hv ovs-ofctl -O OpenFlow13 meter-stats br-int | grep "meter:1" | sed 's/.* duration:\([0-9]\{1,\}\)\.[0-9]\+s .*/\1/')

echo "Meter duration: $d_secs"
$as_echo "ovn.at:7407" >"$at_check_line_file"
(test $d_secs -gt 9) \
  && at_fn_check_skip 77 "$at_srcdir/ovn.at:7407"

# Print some information that may help debugging.
{ set +x
$as_echo "$at_srcdir/ovn.at:7410: as hv ovs-appctl -t ovn-controller meter-table-list"
at_fn_check_prepare_trace "ovn.at:7410"
( $at_check_trace; as hv ovs-appctl -t ovn-controller meter-table-list
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "http-rl1: 1
http-rl2: 2
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7410"
$at_failed && at_fn_log_failure
$at_traceon; }

as hv ovs-ofctl -O OpenFlow13 meter-stats br-int

n_acl1=$(grep -c 'http-acl1' hv/ovn-controller.log)
n_acl2=$(grep -c 'http-acl2' hv/ovn-controller.log)
n_acl3=$(grep -c 'http-acl3' hv/ovn-controller.log)

{ set +x
$as_echo "$at_srcdir/ovn.at:7420:  test \$n_acl3 -gt \$n_acl1 "
at_fn_check_prepare_dynamic " test $n_acl3 -gt $n_acl1 " "ovn.at:7420"
( $at_check_trace;  test $n_acl3 -gt $n_acl1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7420"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:7421:  test \$n_acl1 -gt \$n_acl2 "
at_fn_check_prepare_dynamic " test $n_acl1 -gt $n_acl2 " "ovn.at:7421"
( $at_check_trace;  test $n_acl1 -gt $n_acl2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7421"
$at_failed && at_fn_log_failure
$at_traceon; }





    as hv
    if test "hv" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:7423: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:7423"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7423"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7423: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:7423"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7423"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7423" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:7423: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:7423"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7423"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7423: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:7423"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7423"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7423" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:7423: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:7423"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7423"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7423: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:7423"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7423"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7423" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv
    { set +x
$as_echo "$at_srcdir/ovn.at:7423: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:7423"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7423"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7423: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:7423"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7423"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7423" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:7423: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:7423"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7423"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7423: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:7423"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7423"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7423" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:7423: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:7423"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7423"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7423: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:7423"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7423"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7423" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:7423: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:7423"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7423"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7423: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:7423"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7423"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7423" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:7423: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:7423"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7423"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7423: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:7423"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7423"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7423" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:7423: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:7423"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7423"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7423: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:7423"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7423"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7423" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:7423: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:7423"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7423"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7423: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:7423"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7423"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7423" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:7423: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:7423"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7423"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7423: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:7423"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7423"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7423" "while kill -0 \$TMPPID 2>/dev/null"



ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_66
#AT_START_67
at_fn_group_banner 67 'ovn.at:7427' \
  "ovn -- same meter used by multiple logical flows" "" 2
at_xfail=no
(
  $as_echo "67. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init


ovn_start

net_add n1

sim_add hv
as hv
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.1
for i in lp1 lp2; do
    ovs-vsctl -- add-port br-int $i -- \
        set interface $i external-ids:iface-id=$i \
        options:tx_pcap=hv/$i-tx.pcap \
        options:rxq_pcap=hv/$i-rx.pcap
done

lp1_mac="f0:00:00:00:00:01"
lp1_ip="192.168.1.2"

lp2_mac="f0:00:00:00:00:02"
lp2_ip="192.168.1.3"

ovn-nbctl ls-add lsw0
ovn-nbctl --wait=sb lsp-add lsw0 lp1
ovn-nbctl --wait=sb lsp-add lsw0 lp2
ovn-nbctl lsp-set-addresses lp1 $lp1_mac
ovn-nbctl lsp-set-addresses lp2 $lp2_mac
ovn-nbctl --wait=sb sync

ovn-appctl -t ovn-controller vlog/set file:dbg

# Add acl1 and acl2 using same meter.
ovn-nbctl meter-add http-rl1 drop 10 pktps
ovn-nbctl --log --meter=http-rl1 acl-add lsw0 to-lport 1000 'tcp.dst==80' drop \
       -- --log --meter=http-rl1 acl-add lsw0 to-lport 1000 'tcp.dst==81' allow

ovn-nbctl --wait=hv sync

{ set +x
$as_echo "$at_srcdir/ovn.at:7466: ovs-ofctl -O OpenFlow13 dump-meters br-int | grep meter"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:7466"
( $at_check_trace; ovs-ofctl -O OpenFlow13 dump-meters br-int | grep meter
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7466"
$at_failed && at_fn_log_failure
$at_traceon; }


# Delete acl1, meter should be kept in OVS
ovn-nbctl acl-del lsw0 to-lport 1000 'tcp.dst==80'
ovn-nbctl --wait=hv sync
{ set +x
$as_echo "$at_srcdir/ovn.at:7471: ovs-ofctl -O OpenFlow13 dump-meters br-int | grep meter"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:7471"
( $at_check_trace; ovs-ofctl -O OpenFlow13 dump-meters br-int | grep meter
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7471"
$at_failed && at_fn_log_failure
$at_traceon; }


# Delete acl2, meter should be deleted in OVS
ovn-nbctl acl-del lsw0 to-lport 1000 'tcp.dst==81'
ovn-nbctl --wait=hv sync
{ set +x
$as_echo "$at_srcdir/ovn.at:7476: ovs-ofctl -O OpenFlow13 dump-meters br-int | grep meter"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:7476"
( $at_check_trace; ovs-ofctl -O OpenFlow13 dump-meters br-int | grep meter
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn.at:7476"
$at_failed && at_fn_log_failure
$at_traceon; }





    as hv
    if test "hv" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:7478: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:7478"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7478"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7478: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:7478"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7478"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7478" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:7478: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:7478"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7478"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7478: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:7478"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7478"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7478" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:7478: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:7478"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7478"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7478: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:7478"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7478"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7478" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv
    { set +x
$as_echo "$at_srcdir/ovn.at:7478: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:7478"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7478"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7478: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:7478"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7478"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7478" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:7478: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:7478"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7478"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7478: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:7478"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7478"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7478" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:7478: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:7478"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7478"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7478: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:7478"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7478"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7478" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:7478: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:7478"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7478"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7478: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:7478"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7478"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7478" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:7478: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:7478"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7478"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7478: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:7478"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7478"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7478" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:7478: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:7478"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7478"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7478: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:7478"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7478"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7478" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:7478: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:7478"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7478"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7478: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:7478"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7478"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7478" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:7478: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:7478"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7478"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7478: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:7478"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7478"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7478" "while kill -0 \$TMPPID 2>/dev/null"



ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_67
#AT_START_68
at_fn_group_banner 68 'ovn.at:7482' \
  "ovn -- DSCP marking and meter check" "            " 2
at_xfail=no
(
  $as_echo "68. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init


ovn_start

ovn-nbctl ls-add lsw0
ovn-nbctl --wait=sb lsp-add lsw0 lp1
ovn-nbctl --wait=sb lsp-add lsw0 lp2
ovn-nbctl --wait=sb lsp-add lsw0 lp3
ovn-nbctl lsp-set-addresses lp1 f0:00:00:00:00:01
ovn-nbctl lsp-set-addresses lp2 f0:00:00:00:00:02
ovn-nbctl lsp-set-addresses lp3 f0:00:00:00:00:03
ovn-nbctl lsp-set-port-security lp1 f0:00:00:00:00:01
ovn-nbctl lsp-set-port-security lp2 f0:00:00:00:00:02
ovn-nbctl --wait=sb sync
net_add n1
sim_add hv
as hv
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.1
ovs-vsctl add-port br-int vif1 -- set Interface vif1 external-ids:iface-id=lp1 options:tx_pcap=vif1-tx.pcap options:rxq_pcap=vif1-rx.pcap ofport-request=1
ovs-vsctl add-port br-int vif2 -- set Interface vif2 external-ids:iface-id=lp2 options:tx_pcap=vif2-tx.pcap options:rxq_pcap=vif2-rx.pcap ofport-request=2


ovn_trace () {
    ovn-trace --all "$@" | tee trace | sed '1,/Minimal trace/d'
}

# Extracts nw_tos from the final flow from ofproto/trace output and prints
# it on stdout.  Prints "none" if no nw_tos was included.
get_final_nw_tos() {
    if flow=$(grep '^Final flow:' stdout); then :; else
       # The output didn't have a final flow.
       return 99
    fi

    tos=$(echo "$flow" | sed -n 's/.*nw_tos=\([0-9]\{1,\}\).*/\1/p')
    case $tos in
        '') echo none ;;
        *) echo $tos ;;
    esac
}

# check_tos TOS
#
# Checks that a packet from 1.1.1.1 to 1.1.1.2 gets its DSCP set to TOS.
check_tos() {
    # First check with ovn-trace for logical flows.
    echo "checking for tos $1"
    (if test $1 != 0; then echo "ip.dscp = $1;"; fi;
     echo 'output("lp2");') > expout
    { set +x
$as_echo "$at_srcdir/ovn.at:7532: ovn_trace lsw0 'inport == \"lp1\" && eth.src == f0:00:00:00:00:01 && eth.dst == f0:00:00:00:00:02 && ip4.src == 1.1.1.1 && ip4.dst == 1.1.1.2'"
at_fn_check_prepare_trace "ovn.at:7532"
( $at_check_trace; ovn_trace lsw0 'inport == "lp1" && eth.src == f0:00:00:00:00:01 && eth.dst == f0:00:00:00:00:02 && ip4.src == 1.1.1.1 && ip4.dst == 1.1.1.2'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7532"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }


    # Then re-check with ofproto/trace for a physical packet.
    { set +x
$as_echo "$at_srcdir/ovn.at:7535: ovs-appctl ofproto/trace br-int 'in_port=1,dl_src=f0:00:00:00:00:01,dl_dst=f0:00:00:00:00:02,dl_type=0x800,nw_src=1.1.1.1,nw_dst=1.1.1.2'"
at_fn_check_prepare_trace "ovn.at:7535"
( $at_check_trace; ovs-appctl ofproto/trace br-int 'in_port=1,dl_src=f0:00:00:00:00:01,dl_dst=f0:00:00:00:00:02,dl_type=0x800,nw_src=1.1.1.1,nw_dst=1.1.1.2'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout captured; cp "$at_stdout" stdout
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7535"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

    { set +x
$as_echo "$at_srcdir/ovn.at:7536: get_final_nw_tos"
at_fn_check_prepare_trace "ovn.at:7536"
( $at_check_trace; get_final_nw_tos
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "`expr $1 \* 4`
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7536"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

}

# check at L2
{ set +x
$as_echo "$at_srcdir/ovn.at:7541: ovn_trace lsw0 'inport == \"lp1\" && eth.src == f0:00:00:00:00:01 && eth.dst == f0:00:00:00:00:02'"
at_fn_check_prepare_trace "ovn.at:7541"
( $at_check_trace; ovn_trace lsw0 'inport == "lp1" && eth.src == f0:00:00:00:00:01 && eth.dst == f0:00:00:00:00:02'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "output(\"lp2\");
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7541"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:7543: ovs-appctl ofproto/trace br-int 'in_port=1,dl_src=f0:00:00:00:00:01,dl_dst=f0:00:00:00:00:02'"
at_fn_check_prepare_trace "ovn.at:7543"
( $at_check_trace; ovs-appctl ofproto/trace br-int 'in_port=1,dl_src=f0:00:00:00:00:01,dl_dst=f0:00:00:00:00:02'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout captured; cp "$at_stdout" stdout
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7543"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:7544: get_final_nw_tos"
at_fn_check_prepare_trace "ovn.at:7544"
( $at_check_trace; get_final_nw_tos
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "none
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7544"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }


# check at L3 without dscp marking
check_tos 0

# Mark DSCP with a valid value
qos_id=$(ovn-nbctl --wait=hv -- --id=@lp1-qos create QoS priority=100 action=dscp=48 match="inport\=\=\"lp1\"\ &&\ is_chassis_resident(\"lp1\")" direction="from-lport" -- set Logical_Switch lsw0 qos_rules=@lp1-qos)
{ set +x
$as_echo "$at_srcdir/ovn.at:7552: as hv ovn-nbctl qos-list lsw0 | wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:7552"
( $at_check_trace; as hv ovn-nbctl qos-list lsw0 | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7552"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

check_tos 48

# check at hv without qos meter
{ set +x
$as_echo "$at_srcdir/ovn.at:7557: as hv ovs-ofctl dump-flows br-int -O OpenFlow13 | grep meter | wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:7557"
( $at_check_trace; as hv ovs-ofctl dump-flows br-int -O OpenFlow13 | grep meter | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7557"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }


# Update the meter rate
ovn-nbctl --wait=hv set QoS $qos_id bandwidth=rate=100

# check at hv with a qos meter table
{ set +x
$as_echo "$at_srcdir/ovn.at:7564: as hv ovs-ofctl dump-meters br-int -O OpenFlow13 | grep rate=100 | wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:7564"
( $at_check_trace; as hv ovs-ofctl dump-meters br-int -O OpenFlow13 | grep rate=100 | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7564"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:7566: as hv ovs-ofctl dump-flows br-int -O OpenFlow13 | grep meter | wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:7566"
( $at_check_trace; as hv ovs-ofctl dump-flows br-int -O OpenFlow13 | grep meter | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7566"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }


# Update the DSCP marking
ovn-nbctl --wait=hv set QoS $qos_id action=dscp=63
check_tos 63

# Update the meter rate
ovn-nbctl --wait=hv set QoS $qos_id bandwidth=rate=4294967295,burst=4294967295

# check at hv with a qos meter table
{ set +x
$as_echo "$at_srcdir/ovn.at:7577: as hv ovs-ofctl dump-meters br-int -O OpenFlow13 | grep burst_size=4294967295 | wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:7577"
( $at_check_trace; as hv ovs-ofctl dump-meters br-int -O OpenFlow13 | grep burst_size=4294967295 | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7577"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:7579: as hv ovs-ofctl dump-flows br-int -O OpenFlow13 | grep meter | wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:7579"
( $at_check_trace; as hv ovs-ofctl dump-flows br-int -O OpenFlow13 | grep meter | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7579"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }


ovn-nbctl --wait=hv set QoS $qos_id match="outport\=\=\"lp2\"" direction="to-lport"
check_tos 63

# Disable DSCP marking
ovn-nbctl --wait=hv qos-del lsw0
{ set +x
$as_echo "$at_srcdir/ovn.at:7587: as hv ovn-nbctl qos-list lsw0 | wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:7587"
( $at_check_trace; as hv ovn-nbctl qos-list lsw0 | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7587"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

check_tos 0

# check at hv without qos meter
{ set +x
$as_echo "$at_srcdir/ovn.at:7592: as hv ovs-ofctl dump-flows br-int -O OpenFlow13 | grep meter | wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:7592"
( $at_check_trace; as hv ovs-ofctl dump-flows br-int -O OpenFlow13 | grep meter | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7592"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }


# check meter with chassis not resident
ovn-nbctl qos-add lsw0 to-lport 1001 'inport=="lp3" && is_chassis_resident("lp3")' rate=11123 burst=111230
{ set +x
$as_echo "$at_srcdir/ovn.at:7597: as hv ovn-nbctl qos-list lsw0 | wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:7597"
( $at_check_trace; as hv ovn-nbctl qos-list lsw0 | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7597"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }


# check no meter table
{ set +x
$as_echo "$at_srcdir/ovn.at:7601: as hv ovs-ofctl dump-flows br-int -O OpenFlow13 | grep meter | wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:7601"
( $at_check_trace; as hv ovs-ofctl dump-flows br-int -O OpenFlow13 | grep meter | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7601"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:7603: as hv ovs-ofctl dump-meters br-int -O OpenFlow13 | grep rate=11123 | wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:7603"
( $at_check_trace; as hv ovs-ofctl dump-meters br-int -O OpenFlow13 | grep rate=11123 | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7603"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }





    as hv
    if test "hv" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:7606: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:7606"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7606"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7606: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:7606"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7606"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7606" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:7606: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:7606"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7606"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7606: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:7606"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7606"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7606" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:7606: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:7606"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7606"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7606: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:7606"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7606"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7606" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv
    { set +x
$as_echo "$at_srcdir/ovn.at:7606: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:7606"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7606"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7606: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:7606"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7606"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7606" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:7606: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:7606"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7606"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7606: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:7606"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7606"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7606" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:7606: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:7606"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7606"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7606: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:7606"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7606"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7606" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:7606: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:7606"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7606"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7606: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:7606"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7606"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7606" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:7606: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:7606"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7606"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7606: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:7606"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7606"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7606" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:7606: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:7606"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7606"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7606: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:7606"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7606"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7606" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:7606: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:7606"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7606"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7606: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:7606"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7606"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7606" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:7606: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:7606"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7606"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7606: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:7606"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7606"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7606" "while kill -0 \$TMPPID 2>/dev/null"



ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_68
#AT_START_69
at_fn_group_banner 69 'ovn.at:7609' \
  "ovn -- read-only sb db:ptcp access" "             " 2
at_xfail=no
(
  $as_echo "69. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init


: > .$1.db.~lock~
ovsdb-tool create ovn-sb.db "$abs_top_srcdir"/ovn-sb.ovsschema

# Add read-only remote to sb ovsdb-server
{ set +x
$as_echo "$at_srcdir/ovn.at:7615: ovsdb-tool transact ovn-sb.db \\
     '[\"OVN_Southbound\",
       {\"op\": \"insert\",
        \"table\": \"SB_Global\",
        \"row\": {
          \"connections\": [\"set\", [[\"named-uuid\", \"xyz\"]]]}},
       {\"op\": \"insert\",
        \"table\": \"Connection\",
        \"uuid-name\": \"xyz\",
        \"row\": {\"target\": \"ptcp:0:127.0.0.1\",
               \"read_only\": true}}]'"
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:7615"
( $at_check_trace; ovsdb-tool transact ovn-sb.db \
     '["OVN_Southbound",
       {"op": "insert",
        "table": "SB_Global",
        "row": {
          "connections": ["set", [["named-uuid", "xyz"]]]}},
       {"op": "insert",
        "table": "Connection",
        "uuid-name": "xyz",
        "row": {"target": "ptcp:0:127.0.0.1",
               "read_only": true}}]'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7615"
$at_failed && at_fn_log_failure
$at_traceon; }


start_daemon ovsdb-server --remote=punix:ovn-sb.sock --remote=db:OVN_Southbound,SB_Global,connections ovn-sb.db

ovs_wait_cond () {
    TCP_PORT=`sed -n 's/.*0:.*: listening on port \([0-9]*\)$/\1/p' "ovsdb-server.log"` && test X != X"$TCP_PORT"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7630" "until TCP_PORT=\`sed -n 's/.*0:.*: listening on port \\([0-9]*\\)\$/\\1/p' \"ovsdb-server.log\"\` && test X != X\"\$TCP_PORT\""


# read-only accesses should succeed
{ set +x
$as_echo "$at_srcdir/ovn.at:7633: ovn-sbctl --db=tcp:127.0.0.1:\$TCP_PORT list SB_Global"
at_fn_check_prepare_dynamic "ovn-sbctl --db=tcp:127.0.0.1:$TCP_PORT list SB_Global" "ovn.at:7633"
( $at_check_trace; ovn-sbctl --db=tcp:127.0.0.1:$TCP_PORT list SB_Global
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7633"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:7634: ovn-sbctl --db=tcp:127.0.0.1:\$TCP_PORT list Connection"
at_fn_check_prepare_dynamic "ovn-sbctl --db=tcp:127.0.0.1:$TCP_PORT list Connection" "ovn.at:7634"
( $at_check_trace; ovn-sbctl --db=tcp:127.0.0.1:$TCP_PORT list Connection
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7634"
$at_failed && at_fn_log_failure
$at_traceon; }


# write access should fail
{ set +x
$as_echo "$at_srcdir/ovn.at:7637: ovn-sbctl --db=tcp:127.0.0.1:\$TCP_PORT chassis-add ch vxlan 1.2.4.8"
at_fn_check_prepare_dynamic "ovn-sbctl --db=tcp:127.0.0.1:$TCP_PORT chassis-add ch vxlan 1.2.4.8" "ovn.at:7637"
( $at_check_trace; ovn-sbctl --db=tcp:127.0.0.1:$TCP_PORT chassis-add ch vxlan 1.2.4.8
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-sbctl: transaction error: {\"details\":\"insert operation not allowed when database server is in read only mode\",\"error\":\"not allowed\"}
" | \
  $at_diff - "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 1 $at_status "$at_srcdir/ovn.at:7637"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn.at:7641: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:7641"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7641"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7641: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:7641"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7641"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7641" "while kill -0 \$TMPPID 2>/dev/null"

ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_69
#AT_START_70
at_fn_group_banner 70 'ovn.at:7644' \
  "ovn -- read-only sb db:pssl access" "             " 2
at_xfail=no
(
  $as_echo "70. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

$as_echo "ovn.at:7645" >"$at_check_line_file"
(test "$HAVE_OPENSSL" = no) \
  && at_fn_check_skip 77 "$at_srcdir/ovn.at:7645"
PKIDIR="$(cd $abs_top_builddir/tests && pwd)"
$as_echo "ovn.at:7647" >"$at_check_line_file"
(expr "$PKIDIR" : ".* 	'\"
\\") \
  && at_fn_check_skip 77 "$at_srcdir/ovn.at:7647"

: > .$1.db.~lock~
ovsdb-tool create ovn-sb.db "$abs_top_srcdir"/ovn-sb.ovsschema

# Add read-only remote to sb ovsdb-server
{ set +x
$as_echo "$at_srcdir/ovn.at:7654: ovsdb-tool transact ovn-sb.db \\
     '[\"OVN_Southbound\",
       {\"op\": \"insert\",
        \"table\": \"SB_Global\",
        \"row\": {
          \"connections\": [\"set\", [[\"named-uuid\", \"xyz\"]]]}},
       {\"op\": \"insert\",
        \"table\": \"Connection\",
        \"uuid-name\": \"xyz\",
        \"row\": {\"target\": \"pssl:0:127.0.0.1\",
               \"read_only\": true}}]'"
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:7654"
( $at_check_trace; ovsdb-tool transact ovn-sb.db \
     '["OVN_Southbound",
       {"op": "insert",
        "table": "SB_Global",
        "row": {
          "connections": ["set", [["named-uuid", "xyz"]]]}},
       {"op": "insert",
        "table": "Connection",
        "uuid-name": "xyz",
        "row": {"target": "pssl:0:127.0.0.1",
               "read_only": true}}]'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7654"
$at_failed && at_fn_log_failure
$at_traceon; }


start_daemon ovsdb-server --remote=punix:ovn-sb.sock \
                          --remote=db:OVN_Southbound,SB_Global,connections \
                          --private-key="$PKIDIR/testpki-privkey2.pem" \
                          --certificate="$PKIDIR/testpki-cert2.pem" \
                          --ca-cert="$PKIDIR/testpki-cacert.pem" \
                          ovn-sb.db

ovs_wait_cond () {
    TCP_PORT=`sed -n 's/.*0:.*: listening on port \([0-9]*\)$/\1/p' "ovsdb-server.log"` && test X != X"$TCP_PORT"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7674" "until TCP_PORT=\`sed -n 's/.*0:.*: listening on port \\([0-9]*\\)\$/\\1/p' \"ovsdb-server.log\"\` && test X != X\"\$TCP_PORT\""


# read-only accesses should succeed
{ set +x
$as_echo "$at_srcdir/ovn.at:7677: ovn-sbctl --db=ssl:127.0.0.1:\$TCP_PORT \\
                    --private-key=\$PKIDIR/testpki-privkey.pem \\
                    --certificate=\$PKIDIR/testpki-cert.pem \\
                    --ca-cert=\$PKIDIR/testpki-cacert.pem \\
                    list SB_Global"
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:7677"
( $at_check_trace; ovn-sbctl --db=ssl:127.0.0.1:$TCP_PORT \
                    --private-key=$PKIDIR/testpki-privkey.pem \
                    --certificate=$PKIDIR/testpki-cert.pem \
                    --ca-cert=$PKIDIR/testpki-cacert.pem \
                    list SB_Global
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7677"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:7682: ovn-sbctl --db=ssl:127.0.0.1:\$TCP_PORT \\
                    --private-key=\$PKIDIR/testpki-privkey.pem \\
                    --certificate=\$PKIDIR/testpki-cert.pem \\
                    --ca-cert=\$PKIDIR/testpki-cacert.pem \\
                    list Connection"
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:7682"
( $at_check_trace; ovn-sbctl --db=ssl:127.0.0.1:$TCP_PORT \
                    --private-key=$PKIDIR/testpki-privkey.pem \
                    --certificate=$PKIDIR/testpki-cert.pem \
                    --ca-cert=$PKIDIR/testpki-cacert.pem \
                    list Connection
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7682"
$at_failed && at_fn_log_failure
$at_traceon; }


# write access should fail
{ set +x
$as_echo "$at_srcdir/ovn.at:7689: ovn-sbctl --db=ssl:127.0.0.1:\$TCP_PORT \\
                    --private-key=\$PKIDIR/testpki-privkey.pem \\
                    --certificate=\$PKIDIR/testpki-cert.pem \\
                    --ca-cert=\$PKIDIR/testpki-cacert.pem \\
                    chassis-add ch vxlan 1.2.4.8"
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:7689"
( $at_check_trace; ovn-sbctl --db=ssl:127.0.0.1:$TCP_PORT \
                    --private-key=$PKIDIR/testpki-privkey.pem \
                    --certificate=$PKIDIR/testpki-cert.pem \
                    --ca-cert=$PKIDIR/testpki-cacert.pem \
                    chassis-add ch vxlan 1.2.4.8
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-sbctl: transaction error: {\"details\":\"insert operation not allowed when database server is in read only mode\",\"error\":\"not allowed\"}
" | \
  $at_diff - "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 1 $at_status "$at_srcdir/ovn.at:7689"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn.at:7697: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:7697"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7697"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7697: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:7697"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7697"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7697" "while kill -0 \$TMPPID 2>/dev/null"

ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_70
#AT_START_71
at_fn_group_banner 71 'ovn.at:7700' \
  "ovn -- nb connection/ssl commands" "              " 2
at_xfail=no
(
  $as_echo "71. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

$as_echo "ovn.at:7701" >"$at_check_line_file"
(test "$HAVE_OPENSSL" = no) \
  && at_fn_check_skip 77 "$at_srcdir/ovn.at:7701"
PKIDIR="$(cd $abs_top_builddir/tests && pwd)"
$as_echo "ovn.at:7703" >"$at_check_line_file"
(expr "$PKIDIR" : ".* 	'\"
\\") \
  && at_fn_check_skip 77 "$at_srcdir/ovn.at:7703"

: > .$1.db.~lock~
ovsdb-tool create ovn-nb.db "$abs_top_srcdir"/ovn-nb.ovsschema

# Start nb db server using db connection/ssl entries (unpopulated initially)
start_daemon ovsdb-server --remote=punix:ovnnb_db.sock \
                          --remote=db:OVN_Northbound,NB_Global,connections \
                          --private-key=db:OVN_Northbound,SSL,private_key \
                          --certificate=db:OVN_Northbound,SSL,certificate \
                          --ca-cert=db:OVN_Northbound,SSL,ca_cert \
                          ovn-nb.db

# Populate SSL configuration entries in nb db
{ set +x
$as_echo "$at_srcdir/ovn.at:7718: ovn-nbctl set-ssl \$PKIDIR/testpki-privkey.pem \\
                       \$PKIDIR/testpki-cert.pem \\
                       \$PKIDIR/testpki-cacert.pem"
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:7718"
( $at_check_trace; ovn-nbctl set-ssl $PKIDIR/testpki-privkey.pem \
                       $PKIDIR/testpki-cert.pem \
                       $PKIDIR/testpki-cacert.pem
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7718"
$at_failed && at_fn_log_failure
$at_traceon; }


# Populate a passive SSL connection in nb db
{ set +x
$as_echo "$at_srcdir/ovn.at:7724: ovn-nbctl set-connection pssl:0:127.0.0.1"
at_fn_check_prepare_trace "ovn.at:7724"
( $at_check_trace; ovn-nbctl set-connection pssl:0:127.0.0.1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7724"
$at_failed && at_fn_log_failure
$at_traceon; }


ovs_wait_cond () {
    TCP_PORT=`sed -n 's/.*0:.*: listening on port \([0-9]*\)$/\1/p' "ovsdb-server.log"` && test X != X"$TCP_PORT"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7726" "until TCP_PORT=\`sed -n 's/.*0:.*: listening on port \\([0-9]*\\)\$/\\1/p' \"ovsdb-server.log\"\` && test X != X\"\$TCP_PORT\""


# Verify SSL connetivity to nb db server
{ set +x
$as_echo "$at_srcdir/ovn.at:7729: ovn-nbctl --db=ssl:127.0.0.1:\$TCP_PORT \\
                    --private-key=\$PKIDIR/testpki-privkey.pem \\
                    --certificate=\$PKIDIR/testpki-cert.pem \\
                    --ca-cert=\$PKIDIR/testpki-cacert.pem \\
          list NB_Global"
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:7729"
( $at_check_trace; ovn-nbctl --db=ssl:127.0.0.1:$TCP_PORT \
                    --private-key=$PKIDIR/testpki-privkey.pem \
                    --certificate=$PKIDIR/testpki-cert.pem \
                    --ca-cert=$PKIDIR/testpki-cacert.pem \
          list NB_Global
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7729"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:7735: ovn-nbctl --db=ssl:127.0.0.1:\$TCP_PORT \\
                    --private-key=\$PKIDIR/testpki-privkey.pem \\
                    --certificate=\$PKIDIR/testpki-cert.pem \\
                    --ca-cert=\$PKIDIR/testpki-cacert.pem \\
          list Connection"
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:7735"
( $at_check_trace; ovn-nbctl --db=ssl:127.0.0.1:$TCP_PORT \
                    --private-key=$PKIDIR/testpki-privkey.pem \
                    --certificate=$PKIDIR/testpki-cert.pem \
                    --ca-cert=$PKIDIR/testpki-cacert.pem \
          list Connection
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7735"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:7741: ovn-nbctl --db=ssl:127.0.0.1:\$TCP_PORT \\
                    --private-key=\$PKIDIR/testpki-privkey.pem \\
                    --certificate=\$PKIDIR/testpki-cert.pem \\
                    --ca-cert=\$PKIDIR/testpki-cacert.pem \\
          get-connection"
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:7741"
( $at_check_trace; ovn-nbctl --db=ssl:127.0.0.1:$TCP_PORT \
                    --private-key=$PKIDIR/testpki-privkey.pem \
                    --certificate=$PKIDIR/testpki-cert.pem \
                    --ca-cert=$PKIDIR/testpki-cacert.pem \
          get-connection
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7741"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn.at:7748: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:7748"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7748"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7748: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:7748"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7748"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7748" "while kill -0 \$TMPPID 2>/dev/null"

ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_71
#AT_START_72
at_fn_group_banner 72 'ovn.at:7751' \
  "ovn -- sb connection/ssl commands" "              " 2
at_xfail=no
(
  $as_echo "72. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

$as_echo "ovn.at:7752" >"$at_check_line_file"
(test "$HAVE_OPENSSL" = no) \
  && at_fn_check_skip 77 "$at_srcdir/ovn.at:7752"
PKIDIR="$(cd $abs_top_builddir/tests && pwd)"
$as_echo "ovn.at:7754" >"$at_check_line_file"
(expr "$PKIDIR" : ".* 	'\"
\\") \
  && at_fn_check_skip 77 "$at_srcdir/ovn.at:7754"

: > .$1.db.~lock~
ovsdb-tool create ovn-sb.db "$abs_top_srcdir"/ovn-sb.ovsschema

# Start sb db server using db connection/ssl entries (unpopulated initially)
start_daemon ovsdb-server --remote=punix:ovnsb_db.sock \
                          --remote=db:OVN_Southbound,SB_Global,connections \
                          --private-key=db:OVN_Southbound,SSL,private_key \
                          --certificate=db:OVN_Southbound,SSL,certificate \
                          --ca-cert=db:OVN_Southbound,SSL,ca_cert \
                          ovn-sb.db

# Populate SSL configuration entries in sb db
{ set +x
$as_echo "$at_srcdir/ovn.at:7769: ovn-sbctl set-ssl \$PKIDIR/testpki-privkey.pem \\
                       \$PKIDIR/testpki-cert.pem \\
                       \$PKIDIR/testpki-cacert.pem"
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:7769"
( $at_check_trace; ovn-sbctl set-ssl $PKIDIR/testpki-privkey.pem \
                       $PKIDIR/testpki-cert.pem \
                       $PKIDIR/testpki-cacert.pem
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7769"
$at_failed && at_fn_log_failure
$at_traceon; }


# Populate a passive SSL connection in sb db
{ set +x
$as_echo "$at_srcdir/ovn.at:7775: ovn-sbctl set-connection pssl:0:127.0.0.1"
at_fn_check_prepare_trace "ovn.at:7775"
( $at_check_trace; ovn-sbctl set-connection pssl:0:127.0.0.1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7775"
$at_failed && at_fn_log_failure
$at_traceon; }


ovs_wait_cond () {
    TCP_PORT=`sed -n 's/.*0:.*: listening on port \([0-9]*\)$/\1/p' "ovsdb-server.log"` && test X != X"$TCP_PORT"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7777" "until TCP_PORT=\`sed -n 's/.*0:.*: listening on port \\([0-9]*\\)\$/\\1/p' \"ovsdb-server.log\"\` && test X != X\"\$TCP_PORT\""


# Verify SSL connetivity to sb db server
{ set +x
$as_echo "$at_srcdir/ovn.at:7780: ovn-sbctl --db=ssl:127.0.0.1:\$TCP_PORT \\
                    --private-key=\$PKIDIR/testpki-privkey.pem \\
                    --certificate=\$PKIDIR/testpki-cert.pem \\
                    --ca-cert=\$PKIDIR/testpki-cacert.pem \\
          list SB_Global"
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:7780"
( $at_check_trace; ovn-sbctl --db=ssl:127.0.0.1:$TCP_PORT \
                    --private-key=$PKIDIR/testpki-privkey.pem \
                    --certificate=$PKIDIR/testpki-cert.pem \
                    --ca-cert=$PKIDIR/testpki-cacert.pem \
          list SB_Global
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7780"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:7786: ovn-sbctl --db=ssl:127.0.0.1:\$TCP_PORT \\
                    --private-key=\$PKIDIR/testpki-privkey.pem \\
                    --certificate=\$PKIDIR/testpki-cert.pem \\
                    --ca-cert=\$PKIDIR/testpki-cacert.pem \\
          list Connection"
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:7786"
( $at_check_trace; ovn-sbctl --db=ssl:127.0.0.1:$TCP_PORT \
                    --private-key=$PKIDIR/testpki-privkey.pem \
                    --certificate=$PKIDIR/testpki-cert.pem \
                    --ca-cert=$PKIDIR/testpki-cacert.pem \
          list Connection
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7786"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:7792: ovn-sbctl --db=ssl:127.0.0.1:\$TCP_PORT \\
                    --private-key=\$PKIDIR/testpki-privkey.pem \\
                    --certificate=\$PKIDIR/testpki-cert.pem \\
                    --ca-cert=\$PKIDIR/testpki-cacert.pem \\
          get-connection"
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:7792"
( $at_check_trace; ovn-sbctl --db=ssl:127.0.0.1:$TCP_PORT \
                    --private-key=$PKIDIR/testpki-privkey.pem \
                    --certificate=$PKIDIR/testpki-cert.pem \
                    --ca-cert=$PKIDIR/testpki-cacert.pem \
          get-connection
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; tee stdout <"$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7792"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn.at:7799: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:7799"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7799"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:7799: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:7799"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7799"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:7799" "while kill -0 \$TMPPID 2>/dev/null"

ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_72
#AT_START_73
at_fn_group_banner 73 'ovn.at:7802' \
  "ovn -- nested containers" "                       " 2
at_xfail=no
(
  $as_echo "73. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

# Physical network:
# 2 HVs. HV1 has 2 VMs - "VM1" and "bar3". HV2 has 1 VM - "VM2"

# Logical network:
# 3 Logical switches - "mgmt" (172.16.1.0/24), "foo" (192.168.1.0/24)
# and "bar" (192.168.2.0/24). They are all connected to router R1.

ovn-nbctl lr-add R1
ovn-nbctl ls-add mgmt
ovn-nbctl ls-add foo
ovn-nbctl ls-add bar

# Connect mgmt to R1
ovn-nbctl lrp-add R1 mgmt 00:00:00:01:02:02 172.16.1.1/24
ovn-nbctl lsp-add mgmt rp-mgmt -- set Logical_Switch_Port rp-mgmt type=router \
          options:router-port=mgmt addresses=\"00:00:00:01:02:02\"

# Connect foo to R1
ovn-nbctl lrp-add R1 foo 00:00:00:01:02:03 192.168.1.1/24
ovn-nbctl lsp-add foo rp-foo -- set Logical_Switch_Port rp-foo type=router \
          options:router-port=foo addresses=\"00:00:00:01:02:03\"

# Connect bar to R1
ovn-nbctl lrp-add R1 bar 00:00:00:01:02:04 192.168.2.1/24
ovn-nbctl lsp-add bar rp-bar -- set Logical_Switch_Port rp-bar type=router \
          options:router-port=bar addresses=\"00:00:00:01:02:04\"

# "mgmt" has VM1 and VM2 connected
ovn-nbctl lsp-add mgmt vm1 \
-- lsp-set-addresses vm1 "f0:00:00:01:02:03 172.16.1.2"

ovn-nbctl lsp-add mgmt vm2 \
-- lsp-set-addresses vm2 "f0:00:00:01:02:04 172.16.1.3"

# "foo1" and "foo2" are containers belonging to switch "foo"
# "foo1" has "VM1" as parent_port and "foo2" has "VM2" as parent_port.
ovn-nbctl lsp-add foo foo1 vm1 1 \
-- lsp-set-addresses foo1 "f0:00:00:01:02:05 192.168.1.2"

ovn-nbctl lsp-add foo foo2 vm2 2 \
-- lsp-set-addresses foo2 "f0:00:00:01:02:06 192.168.1.3"

# "bar1" and "bar2" are containers belonging to switch "bar"
# "bar1" has "VM1" as parent_port and "bar2" has "VM2" as parent_port.
ovn-nbctl lsp-add bar bar1 vm1 2 \
-- lsp-set-addresses bar1 "f0:00:00:01:02:07 192.168.2.2"

ovn-nbctl lsp-add bar bar2 vm2 1 \
-- lsp-set-addresses bar2 "f0:00:00:01:02:08 192.168.2.3"

# bar3 is a standalone VM belonging to switch "bar"
ovn-nbctl lsp-add bar bar3 \
-- lsp-set-addresses bar3 "f0:00:00:01:02:09 192.168.2.4"

# Create two hypervisor and create OVS ports corresponding to logical ports.
net_add n1

sim_add hv1
as hv1
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.1
ovs-vsctl -- add-port br-int vm1 -- \
    set interface vm1 external-ids:iface-id=vm1 \
    options:tx_pcap=hv1/vm1-tx.pcap \
    options:rxq_pcap=hv1/vm1-rx.pcap \
    ofport-request=1

ovs-vsctl -- add-port br-int bar3 -- \
    set interface bar3 external-ids:iface-id=bar3 \
    options:tx_pcap=hv1/bar3-tx.pcap \
    options:rxq_pcap=hv1/bar3-rx.pcap \
    ofport-request=2

sim_add hv2
as hv2
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.2
ovs-vsctl -- add-port br-int vm2 -- \
    set interface vm2 external-ids:iface-id=vm2 \
    options:tx_pcap=hv2/vm2-tx.pcap \
    options:rxq_pcap=hv2/vm2-rx.pcap \
    ofport-request=1

# Pre-populate the hypervisors' ARP tables so that we don't lose any
# packets for ARP resolution (native tunneling doesn't queue packets
# for ARP resolution).
{ set +x
$as_echo "$at_srcdir/ovn.at:7891: ovn_populate_arp__"
at_fn_check_prepare_trace "ovn.at:7891"
( $at_check_trace; ovn_populate_arp__
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7891"
$at_failed && at_fn_log_failure
$at_traceon; }


# Allow some time for ovn-northd and ovn-controller to catch up.
# XXX This should be more systematic.
sleep 1

ip_to_hex() {
    printf "%02x%02x%02x%02x" "$@"
}

# Send ip packets between foo1 and foo2 (same switch, different HVs and
# different VLAN tags).
src_mac="f00000010205"
dst_mac="f00000010206"
src_ip=`ip_to_hex 192 168 1 2`
dst_ip=`ip_to_hex 192 168 1 3`
packet=${dst_mac}${src_mac}8100000108004500001c0000000040110000${src_ip}${dst_ip}0035111100080000
as hv1 ovs-appctl netdev-dummy/receive vm1 $packet

# expected packet at foo2
packet=${dst_mac}${src_mac}8100000208004500001c0000000040110000${src_ip}${dst_ip}0035111100080000
echo  $packet > expected
ovn_check_packets__ "hv2/vm2-tx.pcap" "expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:7913: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:7913"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7913"
$at_failed && at_fn_log_failure
$at_traceon; }


# Send ip packets between foo1 and bar2 (different switch, different HV)
src_mac="f00000010205"
dst_mac="000000010203"
src_ip=`ip_to_hex 192 168 1 2`
dst_ip=`ip_to_hex 192 168 2 3`
packet=${dst_mac}${src_mac}8100000108004500001c0000000040110000${src_ip}${dst_ip}0035111100080000
as hv1 ovs-appctl netdev-dummy/receive vm1 $packet

# expected packet at bar2
src_mac="000000010204"
dst_mac="f00000010208"
packet=${dst_mac}${src_mac}8100000108004500001c000000003f110100${src_ip}${dst_ip}0035111100080000
echo  $packet >> expected
ovn_check_packets__ "hv2/vm2-tx.pcap" "expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:7928: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:7928"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7928"
$at_failed && at_fn_log_failure
$at_traceon; }


# Send ip packets between foo1 and bar1
# (different switch, loopback to same vm but different tag)
src_mac="f00000010205"
dst_mac="000000010203"
src_ip=`ip_to_hex 192 168 1 2`
dst_ip=`ip_to_hex 192 168 2 2`
packet=${dst_mac}${src_mac}8100000108004500001c0000000040110000${src_ip}${dst_ip}0035111100080000
as hv1 ovs-appctl netdev-dummy/receive vm1 $packet

# expected packet at bar1
src_mac="000000010204"
dst_mac="f00000010207"
packet=${dst_mac}${src_mac}8100000208004500001c000000003f110100${src_ip}${dst_ip}0035111100080000
echo  $packet > expected1
ovn_check_packets__ "hv1/vm1-tx.pcap" "expected1"
   { set +x
$as_echo "$at_srcdir/ovn.at:7944: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:7944"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7944"
$at_failed && at_fn_log_failure
$at_traceon; }


# Send ip packets between bar1 and bar3
# (same switch. But one is container and another is a standalone VM)
src_mac="f00000010207"
dst_mac="f00000010209"
src_ip=`ip_to_hex 192 168 2 2`
dst_ip=`ip_to_hex 192 168 2 3`
packet=${dst_mac}${src_mac}8100000208004500001c0000000040110000${src_ip}${dst_ip}0035111100080000
as hv1 ovs-appctl netdev-dummy/receive vm1 $packet

# expected packet at bar3
packet=${dst_mac}${src_mac}08004500001c0000000040110000${src_ip}${dst_ip}0035111100080000
echo  $packet > expected
ovn_check_packets__ "hv1/bar3-tx.pcap" "expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:7958: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:7958"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7958"
$at_failed && at_fn_log_failure
$at_traceon; }


# Send ip packets between foo1 and vm1.
(different switch, container to the VM hosting it.)
src_mac="f00000010205"
dst_mac="000000010203"
src_ip=`ip_to_hex 192 168 1 2`
dst_ip=`ip_to_hex 172 16 1 2`
packet=${dst_mac}${src_mac}8100000108004500001c0000000040110000${src_ip}${dst_ip}0035111100080000
as hv1 ovs-appctl netdev-dummy/receive vm1 $packet

# expected packet at vm1
src_mac="000000010202"
dst_mac="f00000010203"
packet=${dst_mac}${src_mac}08004500001c000000003f110100${src_ip}${dst_ip}0035111100080000
echo  $packet >> expected1
ovn_check_packets__ "hv1/vm1-tx.pcap" "expected1"
   { set +x
$as_echo "$at_srcdir/ovn.at:7974: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:7974"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7974"
$at_failed && at_fn_log_failure
$at_traceon; }


# Send packets from vm1 to bar1.
(different switch, A hosting VM to a container inside it)
src_mac="f00000010203"
dst_mac="000000010202"
src_ip=`ip_to_hex 172 16 1 2`
dst_ip=`ip_to_hex 192 168 2 2`
packet=${dst_mac}${src_mac}08004500001c0000000040110000${src_ip}${dst_ip}0035111100080000
as hv1 ovs-appctl netdev-dummy/receive vm1 $packet

# expected packet at vm1
src_mac="000000010204"
dst_mac="f00000010207"
packet=${dst_mac}${src_mac}8100000208004500001c000000003f110100${src_ip}${dst_ip}0035111100080000
echo  $packet >> expected1
ovn_check_packets__ "hv1/vm1-tx.pcap" "expected1"
   { set +x
$as_echo "$at_srcdir/ovn.at:7990: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:7990"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:7990"
$at_failed && at_fn_log_failure
$at_traceon; }


# Send broadcast packet from foo1. foo1 should not receive the same packet.
src_mac="f00000010205"
dst_mac="ffffffffffff"
src_ip=`ip_to_hex 192 168 1 2`
dst_ip=`ip_to_hex 255 255 255 255`
packet=${dst_mac}${src_mac}8100000108004500001c0000000040110000${src_ip}${dst_ip}0035111100080000
as hv1 ovs-appctl netdev-dummy/receive vm1 $packet

# expected packet at VM1
ovn_check_packets__ "hv1/vm1-tx.pcap" "expected1"
   { set +x
$as_echo "$at_srcdir/ovn.at:8001: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:8001"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8001"
$at_failed && at_fn_log_failure
$at_traceon; }





    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:8003: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:8003"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8003"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8003: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:8003"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8003"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8003" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:8003: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:8003"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8003"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8003: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:8003"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8003"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8003" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:8003: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:8003"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8003"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8003: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:8003"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8003"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8003" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:8003: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:8003"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8003"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8003: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:8003"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8003"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8003" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:8003: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:8003"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8003"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8003: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:8003"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8003"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8003" "while kill -0 \$TMPPID 2>/dev/null"





    as hv2
    if test "hv2" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:8003: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:8003"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8003"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8003: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:8003"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8003"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8003" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:8003: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:8003"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8003"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8003: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:8003"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8003"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8003" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:8003: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:8003"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8003"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8003: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:8003"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8003"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8003" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv2
    { set +x
$as_echo "$at_srcdir/ovn.at:8003: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:8003"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8003"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8003: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:8003"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8003"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8003" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:8003: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:8003"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8003"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8003: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:8003"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8003"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8003" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:8003: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:8003"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8003"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8003: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:8003"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8003"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8003" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:8003: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:8003"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8003"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8003: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:8003"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8003"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8003" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:8003: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:8003"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8003"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8003: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:8003"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8003"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8003" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:8003: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:8003"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8003"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8003: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:8003"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8003"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8003" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:8003: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:8003"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8003"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8003: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:8003"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8003"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8003" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:8003: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:8003"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8003"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8003: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:8003"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8003"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8003" "while kill -0 \$TMPPID 2>/dev/null"




ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_73
#AT_START_74
at_fn_group_banner 74 'ovn.at:8007' \
  "ovn -- 3 HVs, 3 LRs connected via LS, source IP based routes" "" 2
at_xfail=no
(
  $as_echo "74. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

# Logical network:
# Three LRs - R1, R2 and R3 that are connected to each other via LS "join"
# in 20.0.0.0/24 network. R1 has switchess foo (192.168.1.0/24) and bar
# (192.168.2.0/24) connected to it.
#
# R2 and R3 are gateway routers.
# R2 has alice (172.16.1.0/24) and R3 has bob (172.16.1.0/24)
# connected to it. Note how both alice and bob have the same subnet behind it.
# We are trying to simulate external network via those 2 switches. In real
# world the switch ports of these switches will have addresses set as "unknown"
# to make them learning switches. Or those switches will be "localnet" ones.

# Create three hypervisors and create OVS ports corresponding to logical ports.
net_add n1

sim_add hv1
as hv1
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.1
ovs-vsctl -- add-port br-int hv1-vif1 -- \
    set interface hv1-vif1 external-ids:iface-id=foo1 \
    options:tx_pcap=hv1/vif1-tx.pcap \
    options:rxq_pcap=hv1/vif1-rx.pcap \
    ofport-request=1

ovs-vsctl -- add-port br-int hv1-vif2 -- \
    set interface hv1-vif2 external-ids:iface-id=bar1 \
    options:tx_pcap=hv1/vif2-tx.pcap \
    options:rxq_pcap=hv1/vif2-rx.pcap \
    ofport-request=2

sim_add hv2
as hv2
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.2
ovs-vsctl -- add-port br-int hv2-vif1 -- \
    set interface hv2-vif1 external-ids:iface-id=alice1 \
    options:tx_pcap=hv2/vif1-tx.pcap \
    options:rxq_pcap=hv2/vif1-rx.pcap \
    ofport-request=1

sim_add hv3
as hv3
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.3
ovs-vsctl -- add-port br-int hv3-vif1 -- \
    set interface hv3-vif1 external-ids:iface-id=bob1 \
    options:tx_pcap=hv3/vif1-tx.pcap \
    options:rxq_pcap=hv3/vif1-rx.pcap \
    ofport-request=1


ovn-nbctl create Logical_Router name=R1
ovn-nbctl create Logical_Router name=R2 options:chassis="hv2"
ovn-nbctl create Logical_Router name=R3 options:chassis="hv3"

ovn-nbctl ls-add foo
ovn-nbctl ls-add bar
ovn-nbctl ls-add alice
ovn-nbctl ls-add bob
ovn-nbctl ls-add join

# Connect foo to R1
ovn-nbctl lrp-add R1 foo 00:00:01:01:02:03 192.168.1.1/24
ovn-nbctl lsp-add foo rp-foo -- set Logical_Switch_Port rp-foo type=router \
    options:router-port=foo addresses=\"00:00:01:01:02:03\"

# Connect bar to R1
ovn-nbctl lrp-add R1 bar 00:00:01:01:02:04 192.168.2.1/24
ovn-nbctl lsp-add bar rp-bar -- set Logical_Switch_Port rp-bar type=router \
    options:router-port=bar addresses=\"00:00:01:01:02:04\"

# Connect alice to R2
ovn-nbctl lrp-add R2 alice 00:00:02:01:02:03 172.16.1.1/24
ovn-nbctl lsp-add alice rp-alice -- set Logical_Switch_Port rp-alice \
    type=router options:router-port=alice addresses=\"00:00:02:01:02:03\"

# Connect bob to R3
ovn-nbctl lrp-add R3 bob 00:00:03:01:02:03 172.16.1.2/24
ovn-nbctl lsp-add bob rp-bob -- set Logical_Switch_Port rp-bob \
    type=router options:router-port=bob addresses=\"00:00:03:01:02:03\"

# Connect R1 to join
ovn-nbctl lrp-add R1 R1_join 00:00:04:01:02:03 20.0.0.1/24
ovn-nbctl lsp-add join r1-join -- set Logical_Switch_Port r1-join \
    type=router options:router-port=R1_join addresses='"00:00:04:01:02:03"'

# Connect R2 to join
ovn-nbctl lrp-add R2 R2_join 00:00:04:01:02:04 20.0.0.2/24
ovn-nbctl lsp-add join r2-join -- set Logical_Switch_Port r2-join \
    type=router options:router-port=R2_join addresses='"00:00:04:01:02:04"'

# Connect R3 to join
ovn-nbctl lrp-add R3 R3_join 00:00:04:01:02:05 20.0.0.3/24
ovn-nbctl lsp-add join r3-join -- set Logical_Switch_Port r3-join \
    type=router options:router-port=R3_join addresses='"00:00:04:01:02:05"'

# Install static routes with source ip address as the policy for routing.
# We want traffic from 'foo' to go via R2 and traffic of 'bar' to go via R3.
ovn-nbctl --policy="src-ip" lr-route-add R1 192.168.1.0/24 20.0.0.2
ovn-nbctl --policy="src-ip" lr-route-add R1 192.168.2.0/24 20.0.0.3

# Install static routes with destination ip address as the policy for routing.
ovn-nbctl lr-route-add R2 192.168.0.0/16 20.0.0.1

ovn-nbctl lr-route-add R3 192.168.0.0/16 20.0.0.1

# Create logical port foo1 in foo
ovn-nbctl lsp-add foo foo1 \
-- lsp-set-addresses foo1 "f0:00:00:01:02:03 192.168.1.2"

# Create logical port bar1 in bar
ovn-nbctl lsp-add bar bar1 \
-- lsp-set-addresses bar1 "f0:00:00:01:02:04 192.168.2.2"

# Create logical port alice1 in alice
ovn-nbctl lsp-add alice alice1 \
-- lsp-set-addresses alice1 "f0:00:00:01:02:05 172.16.1.3"

# Create logical port bob1 in bob
ovn-nbctl --wait=hv lsp-add bob bob1 \
-- lsp-set-addresses bob1 "f0:00:00:01:02:06 172.16.1.4"

# Pre-populate the hypervisors' ARP tables so that we don't lose any
# packets for ARP resolution (native tunneling doesn't queue packets
# for ARP resolution).
{ set +x
$as_echo "$at_srcdir/ovn.at:8136: ovn_populate_arp__"
at_fn_check_prepare_trace "ovn.at:8136"
( $at_check_trace; ovn_populate_arp__
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8136"
$at_failed && at_fn_log_failure
$at_traceon; }


# Allow some time for ovn-northd and ovn-controller to catch up.
# XXX This should be more systematic.
sleep 1

ip_to_hex() {
    printf "%02x%02x%02x%02x" "$@"
}
trim_zeros() {
    sed 's/\(00\)\{1,\}$//'
}

# Send ip packets between foo1 and bar1
# (East-west traffic should flow normally)
src_mac="f00000010203"
dst_mac="000001010203"
src_ip=`ip_to_hex 192 168 1 2`
dst_ip=`ip_to_hex 192 168 2 2`
packet=${dst_mac}${src_mac}08004500001c0000000040110000${src_ip}${dst_ip}0035111100080000
as hv1 ovs-appctl netdev-dummy/receive hv1-vif1 $packet

# Send ip packets between foo1 and alice1
src_mac="f00000010203"
dst_mac="000001010203"
src_ip=`ip_to_hex 192 168 1 2`
dst_ip=`ip_to_hex 172 16 1 3`
packet=${dst_mac}${src_mac}08004500001c0000000040110000${src_ip}${dst_ip}0035111100080000
as hv1 ovs-appctl netdev-dummy/receive hv1-vif1 $packet
as hv1 ovs-appctl ofproto/trace br-int in_port=1 $packet

# Send ip packets between bar1 and bob1
src_mac="f00000010204"
dst_mac="000001010204"
src_ip=`ip_to_hex 192 168 2 2`
dst_ip=`ip_to_hex 172 16 1 4`
packet=${dst_mac}${src_mac}08004500001c0000000040110000${src_ip}${dst_ip}0035111100080000
as hv1 ovs-appctl netdev-dummy/receive hv1-vif2 $packet
#as hv1 ovs-appctl ofproto/trace br-int in_port=2 $packet

# Packet to expect at bar1
src_mac="000001010204"
dst_mac="f00000010204"
src_ip=`ip_to_hex 192 168 1 2`
dst_ip=`ip_to_hex 192 168 2 2`
expected=${dst_mac}${src_mac}08004500001c000000003f110100${src_ip}${dst_ip}0035111100080000
echo $expected > expected
ovn_check_packets__ "hv1/vif2-tx.pcap" "expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:8183: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:8183"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8183"
$at_failed && at_fn_log_failure
$at_traceon; }


# Packet to Expect at alice1
src_mac="000002010203"
dst_mac="f00000010205"
src_ip=`ip_to_hex 192 168 1 2`
dst_ip=`ip_to_hex 172 16 1 3`
expected=${dst_mac}${src_mac}08004500001c000000003e110200${src_ip}${dst_ip}0035111100080000
echo $expected > expected
ovn_check_packets__ "hv2/vif1-tx.pcap" "expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:8192: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:8192"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8192"
$at_failed && at_fn_log_failure
$at_traceon; }


# Packet to Expect at bob1
src_mac="000003010203"
dst_mac="f00000010206"
src_ip=`ip_to_hex 192 168 2 2`
dst_ip=`ip_to_hex 172 16 1 4`
expected=${dst_mac}${src_mac}08004500001c000000003e110200${src_ip}${dst_ip}0035111100080000
echo $expected > expected
ovn_check_packets__ "hv3/vif1-tx.pcap" "expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:8201: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:8201"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8201"
$at_failed && at_fn_log_failure
$at_traceon; }





    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:8203: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:8203"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8203"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8203: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:8203"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8203"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8203" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:8203: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:8203"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8203"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8203: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:8203"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8203"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8203" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:8203: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:8203"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8203"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8203: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:8203"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8203"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8203" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:8203: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:8203"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8203"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8203: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:8203"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8203"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8203" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:8203: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:8203"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8203"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8203: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:8203"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8203"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8203" "while kill -0 \$TMPPID 2>/dev/null"





    as hv2
    if test "hv2" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:8203: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:8203"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8203"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8203: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:8203"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8203"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8203" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:8203: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:8203"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8203"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8203: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:8203"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8203"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8203" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:8203: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:8203"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8203"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8203: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:8203"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8203"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8203" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv2
    { set +x
$as_echo "$at_srcdir/ovn.at:8203: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:8203"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8203"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8203: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:8203"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8203"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8203" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:8203: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:8203"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8203"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8203: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:8203"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8203"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8203" "while kill -0 \$TMPPID 2>/dev/null"





    as hv3
    if test "hv3" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:8203: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:8203"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8203"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8203: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:8203"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8203"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8203" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:8203: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:8203"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8203"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8203: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:8203"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8203"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8203" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:8203: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:8203"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8203"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8203: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:8203"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8203"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8203" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv3
    { set +x
$as_echo "$at_srcdir/ovn.at:8203: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:8203"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8203"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8203: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:8203"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8203"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8203" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:8203: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:8203"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8203"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8203: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:8203"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8203"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8203" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:8203: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:8203"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8203"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8203: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:8203"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8203"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8203" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:8203: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:8203"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8203"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8203: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:8203"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8203"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8203" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:8203: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:8203"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8203"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8203: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:8203"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8203"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8203" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:8203: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:8203"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8203"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8203: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:8203"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8203"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8203" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:8203: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:8203"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8203"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8203: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:8203"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8203"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8203" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:8203: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:8203"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8203"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8203: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:8203"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8203"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8203" "while kill -0 \$TMPPID 2>/dev/null"




ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_74
#AT_START_75
at_fn_group_banner 75 'ovn.at:8207' \
  "ovn -- dns lookup : 1 HV, 2 LS, 2 LSPs/LS" "      " 2
at_xfail=no
(
  $as_echo "75. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

ovn-nbctl ls-add ls1

ovn-nbctl lsp-add ls1 ls1-lp1 \
-- lsp-set-addresses ls1-lp1 "f0:00:00:00:00:01 10.0.0.4 aef0::4"

ovn-nbctl lsp-set-port-security ls1-lp1 "f0:00:00:00:00:01 10.0.0.4 aef0::4"

ovn-nbctl lsp-add ls1 ls1-lp2 \
-- lsp-set-addresses ls1-lp2 "f0:00:00:00:00:02 10.0.0.6 20.0.0.4"

ovn-nbctl lsp-set-port-security ls1-lp2 "f0:00:00:00:00:02 10.0.0.6 20.0.0.4"

DNS1=`ovn-nbctl create DNS records={}`
DNS2=`ovn-nbctl create DNS records={}`

ovn-nbctl set DNS $DNS1 records:vm1.ovn.org="10.0.0.4 aef0::4"
ovn-nbctl set DNS $DNS1 records:vm2.ovn.org="10.0.0.6 20.0.0.4"
ovn-nbctl set DNS $DNS2 records:vm3.ovn.org="40.0.0.4"

ovn-nbctl set Logical_switch ls1 dns_records="$DNS1"

net_add n1
sim_add hv1

as hv1
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.1
ovs-vsctl -- add-port br-int hv1-vif1 -- \
    set interface hv1-vif1 external-ids:iface-id=ls1-lp1 \
    options:tx_pcap=hv1/vif1-tx.pcap \
    options:rxq_pcap=hv1/vif1-rx.pcap \
    ofport-request=1

ovs-vsctl -- add-port br-int hv1-vif2 -- \
    set interface hv1-vif2 external-ids:iface-id=ls1-lp2 \
    options:tx_pcap=hv1/vif2-tx.pcap \
    options:rxq_pcap=hv1/vif2-rx.pcap \
    ofport-request=2

{ set +x
$as_echo "$at_srcdir/ovn.at:8249: ovn_populate_arp__"
at_fn_check_prepare_trace "ovn.at:8249"
( $at_check_trace; ovn_populate_arp__
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8249"
$at_failed && at_fn_log_failure
$at_traceon; }

sleep 2
as hv1 ovs-vsctl show

echo "*************************"
ovn-sbctl list DNS
echo "*************************"

ip_to_hex() {
    printf "%02x%02x%02x%02x" "$@"
}

reset_pcap_file() {
    local iface=$1
    local pcap_file=$2
    ovs-vsctl -- set Interface $iface options:tx_pcap=dummy-tx.pcap \
options:rxq_pcap=dummy-rx.pcap
    rm -f ${pcap_file}*.pcap
    ovs-vsctl -- set Interface $iface options:tx_pcap=${pcap_file}-tx.pcap \
options:rxq_pcap=${pcap_file}-rx.pcap
}

# set_dns_params host_name
# Sets the dns_req_data and dns_resp_data
set_dns_params() {
    local hname=$1
    local ttl=00000e10
    an_count=0001
    type=0001
    case $hname in
    vm1)
        # vm1.ovn.org
        query_name=03766d31036f766e036f726700
        # IPv4 address - 10.0.0.4
        expected_dns_answer=${query_name}00010001${ttl}00040a000004
        ;;
    vm2)
        # vm2.ovn.org
        query_name=03766d32036f766e036f726700
        # IPv4 address - 10.0.0.6
        expected_dns_answer=${query_name}00010001${ttl}00040a000006
        # IPv4 address - 20.0.0.4
        expected_dns_answer=${expected_dns_answer}${query_name}00010001${ttl}000414000004
        an_count=0002
        ;;
    vm3)
        # vm3.ovn.org
        query_name=03766d33036f766e036f726700
        # IPv4 address - 40.0.0.4
        expected_dns_answer=${query_name}00010001${ttl}000428000004
        ;;
    vm1_ipv6_only)
        # vm1.ovn.org
        query_name=03766d31036f766e036f726700
        # IPv6 address - aef0::4
        type=001c
        expected_dns_answer=${query_name}${type}0001${ttl}0010aef00000000000000000000000000004
        ;;
    vm1_ipv4_v6)
        # vm1.ovn.org
        query_name=03766d31036f766e036f726700
        type=00ff
        an_count=0002
        # IPv4 address - 10.0.0.4
        # IPv6 address - aef0::4
        expected_dns_answer=${query_name}00010001${ttl}00040a000004
        expected_dns_answer=${expected_dns_answer}${query_name}001c0001${ttl}0010
        expected_dns_answer=${expected_dns_answer}aef00000000000000000000000000004
        ;;
    vm1_invalid_type)
        # vm1.ovn.org
        query_name=03766d31036f766e036f726700
        # IPv6 address - aef0::4
        type=0002
        ;;
    vm1_incomplete)
        # set type to none
        type=''
    esac
    # TTL - 3600
    local dns_req_header=010201200001000000000000
    local dns_resp_header=010281200001${an_count}00000000
    dns_req_data=${dns_req_header}${query_name}${type}0001
    dns_resp_data=${dns_resp_header}${query_name}${type}0001${expected_dns_answer}
}

# This shell function sends a DNS request packet
# test_dns INPORT SRC_MAC DST_MAC SRC_IP DST_IP DNS_QUERY EXPEC
test_dns() {
    local inport=$1 src_mac=$2 dst_mac=$3 src_ip=$4 dst_ip=$5 dns_reply=$6
    local dns_query_data=$7
    shift; shift; shift; shift; shift; shift; shift;
    # Packet size => IPv4 header (20) + UDP header (8) +
    #                DNS data (header + query)
    ip_len=`expr 28 + ${#dns_query_data} / 2`
    udp_len=`expr $ip_len - 20`
    ip_len=$(printf "%x" $ip_len)
    udp_len=$(printf "%x" $udp_len)
    local request=${dst_mac}${src_mac}0800450000${ip_len}0000000080110000
    request=${request}${src_ip}${dst_ip}9234003500${udp_len}0000
    # dns data
    request=${request}${dns_query_data}

    if test $dns_reply != 0; then
        local dns_reply=$1
        ip_len=`expr 28 + ${#dns_reply} / 2`
        udp_len=`expr $ip_len - 20`
        ip_len=$(printf "%x" $ip_len)
        udp_len=$(printf "%x" $udp_len)
        local reply=${src_mac}${dst_mac}0800450000${ip_len}0000000080110000
        reply=${reply}${dst_ip}${src_ip}0035923400${udp_len}0000${dns_reply}
        echo $reply >> $inport.expected
    else
        for outport; do
            echo $request >> $outport.expected
        done
    fi
    as hv1 ovs-appctl netdev-dummy/receive hv1-vif$inport $request
}

test_dns6() {
    local inport=$1 src_mac=$2 dst_mac=$3 src_ip=$4 dst_ip=$5 dns_reply=$6
    local dns_query_data=$7
    shift; shift; shift; shift; shift; shift; shift;
    # Packet size => UDP header (8) +
    #                DNS data (header + query)
    ip_len=`expr 8 + ${#dns_query_data} / 2`
    udp_len=$ip_len
    ip_len=$(printf "%x" $ip_len)
    udp_len=$(printf "%x" $udp_len)
    local request=${dst_mac}${src_mac}86dd6000000000${ip_len}11ff${src_ip}${dst_ip}
    request=${request}9234003500${udp_len}0000
    #dns data
    request=${request}${dns_query_data}

    if test $dns_reply != 0; then
        local dns_reply=$1
        ip_len=`expr 8 + ${#dns_reply} / 2`
        udp_len=$ip_len
        ip_len=$(printf "%x" $ip_len)
        udp_len=$(printf "%x" $udp_len)
        local reply=${src_mac}${dst_mac}86dd6000000000${ip_len}11ff${dst_ip}${src_ip}
        reply=${reply}0035923400${udp_len}0000${dns_reply}
        echo $reply >> $inport.expected
    else
        for outport; do
            echo $request >> $outport.expected
        done
    fi
    as hv1 ovs-appctl netdev-dummy/receive hv1-vif$inport $request
}


as hv1 ovs-ofctl monitor br-int resume --detach --no-chdir \
--pidfile=ovs-ofctl0.pid 2> ofctl_monitor0.log

set_dns_params vm2
src_ip=`ip_to_hex 10 0 0 4`
dst_ip=`ip_to_hex 10 0 0 1`
dns_reply=1
test_dns 1 f00000000001 f000000000f0 $src_ip $dst_ip $dns_reply $dns_req_data $dns_resp_data

# NXT_RESUMEs should be 1.
ovs_wait_cond () {
    test 1 = `cat ofctl_monitor*.log | grep -c NXT_RESUME`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8412" "until test 1 = \`cat ofctl_monitor*.log | grep -c NXT_RESUME\`"


$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/vif1-tx.pcap > 1.packets
cat 1.expected | cut -c -48 > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:8416: cat 1.packets | cut -c -48"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:8416"
( $at_check_trace; cat 1.packets | cut -c -48
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8416"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

# Skipping the IPv4 checksum.
cat 1.expected | cut -c 53- > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:8419: cat 1.packets | cut -c 53-"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:8419"
( $at_check_trace; cat 1.packets | cut -c 53-
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8419"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }


reset_pcap_file hv1-vif1 hv1/vif1
reset_pcap_file hv1-vif2 hv1/vif2
rm -f 1.expected
rm -f 2.expected

set_dns_params vm1
src_ip=`ip_to_hex 10 0 0 6`
dst_ip=`ip_to_hex 10 0 0 1`
dns_reply=1
test_dns 2 f00000000002 f000000000f0 $src_ip $dst_ip $dns_reply $dns_req_data $dns_resp_data

# NXT_RESUMEs should be 2.
ovs_wait_cond () {
    test 2 = `cat ofctl_monitor*.log | grep -c NXT_RESUME`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8433" "until test 2 = \`cat ofctl_monitor*.log | grep -c NXT_RESUME\`"


$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/vif2-tx.pcap > 2.packets
cat 2.expected | cut -c -48 > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:8437: cat 2.packets | cut -c -48"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:8437"
( $at_check_trace; cat 2.packets | cut -c -48
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8437"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

# Skipping the IPv4 checksum.
cat 2.expected | cut -c 53- > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:8440: cat 2.packets | cut -c 53-"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:8440"
( $at_check_trace; cat 2.packets | cut -c 53-
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8440"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }


reset_pcap_file hv1-vif1 hv1/vif1
reset_pcap_file hv1-vif2 hv1/vif2
rm -f 1.expected
rm -f 2.expected

# Clear the query name options for ls1-lp2
ovn-nbctl --wait=hv remove DNS $DNS1 records vm2.ovn.org

set_dns_params vm2
src_ip=`ip_to_hex 10 0 0 4`
dst_ip=`ip_to_hex 10 0 0 1`
dns_reply=0
test_dns 1 f00000000001 f00000000002 $src_ip $dst_ip $dns_reply $dns_req_data

# NXT_RESUMEs should be 3.
ovs_wait_cond () {
    test 3 = `cat ofctl_monitor*.log | grep -c NXT_RESUME`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8457" "until test 3 = \`cat ofctl_monitor*.log | grep -c NXT_RESUME\`"


$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/vif1-tx.pcap > 1.packets
{ set +x
$as_echo "$at_srcdir/ovn.at:8460: cat 1.packets"
at_fn_check_prepare_trace "ovn.at:8460"
( $at_check_trace; cat 1.packets
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8460"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }


reset_pcap_file hv1-vif1 hv1/vif1
reset_pcap_file hv1-vif2 hv1/vif2
rm -f 1.expected
rm -f 2.expected

# Clear the query name for ls1-lp1
# Since ls1 has no query names configued,
# ovn-northd should not add the DNS flows.
ovn-nbctl --wait=hv remove DNS $DNS1 records vm1.ovn.org

set_dns_params vm1
src_ip=`ip_to_hex 10 0 0 6`
dst_ip=`ip_to_hex 10 0 0 1`
dns_reply=0
test_dns 2 f00000000002 f000000000f0 $src_ip $dst_ip $dns_reply $dns_req_data

# NXT_RESUMEs should be 3 only.
ovs_wait_cond () {
    test 3 = `cat ofctl_monitor*.log | grep -c NXT_RESUME`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8479" "until test 3 = \`cat ofctl_monitor*.log | grep -c NXT_RESUME\`"


$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/vif2-tx.pcap > 2.packets
{ set +x
$as_echo "$at_srcdir/ovn.at:8482: cat 2.packets"
at_fn_check_prepare_trace "ovn.at:8482"
( $at_check_trace; cat 2.packets
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8482"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }


reset_pcap_file hv1-vif1 hv1/vif1
reset_pcap_file hv1-vif2 hv1/vif2
rm -f 1.expected
rm -f 2.expected

# Test IPv6 (AAAA records) using IPv4 packet.
# Add back the DNS options for ls1-lp1.
ovn-nbctl --wait=hv set DNS $DNS1 records:vm1.ovn.org="10.0.0.4 aef0::4"

set_dns_params vm1_ipv6_only
src_ip=`ip_to_hex 10 0 0 6`
dst_ip=`ip_to_hex 10 0 0 1`
dns_reply=1
test_dns 2 f00000000002 f000000000f0 $src_ip $dst_ip $dns_reply $dns_req_data $dns_resp_data

# NXT_RESUMEs should be 4.
ovs_wait_cond () {
    test 4 = `cat ofctl_monitor*.log | grep -c NXT_RESUME`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8500" "until test 4 = \`cat ofctl_monitor*.log | grep -c NXT_RESUME\`"


$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/vif2-tx.pcap > 2.packets
cat 2.expected | cut -c -48 > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:8504: cat 2.packets | cut -c -48"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:8504"
( $at_check_trace; cat 2.packets | cut -c -48
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8504"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

# Skipping the IPv4 checksum.
cat 2.expected | cut -c 53- > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:8507: cat 2.packets | cut -c 53-"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:8507"
( $at_check_trace; cat 2.packets | cut -c 53-
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8507"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }


reset_pcap_file hv1-vif1 hv1/vif1
reset_pcap_file hv1-vif2 hv1/vif2
rm -f 1.expected
rm -f 2.expected

# Test both IPv4 (A) and IPv6 (AAAA records) using IPv4 packet.
set_dns_params vm1_ipv4_v6
src_ip=`ip_to_hex 10 0 0 6`
dst_ip=`ip_to_hex 10 0 0 1`
dns_reply=1
test_dns 2 f00000000002 f000000000f0 $src_ip $dst_ip $dns_reply $dns_req_data $dns_resp_data

# NXT_RESUMEs should be 5.
ovs_wait_cond () {
    test 5 = `cat ofctl_monitor*.log | grep -c NXT_RESUME`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8522" "until test 5 = \`cat ofctl_monitor*.log | grep -c NXT_RESUME\`"


$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/vif2-tx.pcap > 2.packets
cat 2.expected | cut -c -48 > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:8526: cat 2.packets | cut -c -48"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:8526"
( $at_check_trace; cat 2.packets | cut -c -48
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8526"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

# Skipping the IPv4 checksum.
cat 2.expected | cut -c 53- > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:8529: cat 2.packets | cut -c 53-"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:8529"
( $at_check_trace; cat 2.packets | cut -c 53-
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8529"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }


reset_pcap_file hv1-vif1 hv1/vif1
reset_pcap_file hv1-vif2 hv1/vif2
rm -f 1.expected
rm -f 2.expected

# Invalid type.
set_dns_params vm1_invalid_type
src_ip=`ip_to_hex 10 0 0 6`
dst_ip=`ip_to_hex 10 0 0 1`
dns_reply=0
test_dns 2 f00000000002 f000000000f0 $src_ip $dst_ip $dns_reply $dns_req_data

# NXT_RESUMEs should be 6.
ovs_wait_cond () {
    test 6 = `cat ofctl_monitor*.log | grep -c NXT_RESUME`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8544" "until test 6 = \`cat ofctl_monitor*.log | grep -c NXT_RESUME\`"


$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/vif2-tx.pcap > 2.packets
{ set +x
$as_echo "$at_srcdir/ovn.at:8547: cat 2.packets"
at_fn_check_prepare_trace "ovn.at:8547"
( $at_check_trace; cat 2.packets
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8547"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }


reset_pcap_file hv1-vif1 hv1/vif1
reset_pcap_file hv1-vif2 hv1/vif2
rm -f 1.expected
rm -f 2.expected

# Incomplete DNS packet.
set_dns_params vm1_incomplete
src_ip=`ip_to_hex 10 0 0 6`
dst_ip=`ip_to_hex 10 0 0 1`
dns_reply=0
test_dns 2 f00000000002 f000000000f0 $src_ip $dst_ip $dns_reply $dns_req_data

# NXT_RESUMEs should be 7.
ovs_wait_cond () {
    test 7 = `cat ofctl_monitor*.log | grep -c NXT_RESUME`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8562" "until test 7 = \`cat ofctl_monitor*.log | grep -c NXT_RESUME\`"


$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/vif2-tx.pcap > 2.packets
{ set +x
$as_echo "$at_srcdir/ovn.at:8565: cat 2.packets"
at_fn_check_prepare_trace "ovn.at:8565"
( $at_check_trace; cat 2.packets
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8565"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }


reset_pcap_file hv1-vif1 hv1/vif1
reset_pcap_file hv1-vif2 hv1/vif2
rm -f 1.expected
rm -f 2.expected

# Add one more DNS record to the ls1.
ovn-nbctl --wait=hv set Logical_switch ls1 dns_records="$DNS1 $DNS2"

set_dns_params vm3
src_ip=`ip_to_hex 10 0 0 4`
dst_ip=`ip_to_hex 10 0 0 1`
dns_reply=1
test_dns 1 f00000000001 f000000000f0 $src_ip $dst_ip $dns_reply $dns_req_data $dns_resp_data

# NXT_RESUMEs should be 8.
ovs_wait_cond () {
    test 8 = `cat ofctl_monitor*.log | grep -c NXT_RESUME`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8582" "until test 8 = \`cat ofctl_monitor*.log | grep -c NXT_RESUME\`"


$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/vif1-tx.pcap > 1.packets
cat 1.expected | cut -c -48 > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:8586: cat 1.packets | cut -c -48"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:8586"
( $at_check_trace; cat 1.packets | cut -c -48
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8586"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

# Skipping the IPv4 checksum.
cat 1.expected | cut -c 53- > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:8589: cat 1.packets | cut -c 53-"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:8589"
( $at_check_trace; cat 1.packets | cut -c 53-
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8589"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }


reset_pcap_file hv1-vif1 hv1/vif1
reset_pcap_file hv1-vif2 hv1/vif2
rm -f 1.expected
rm -f 2.expected

# Try DNS query over IPv6
set_dns_params vm1
src_ip=aef00000000000000000000000000004
dst_ip=aef00000000000000000000000000001
dns_reply=1
test_dns6 1 f00000000001 f000000000f0 $src_ip $dst_ip $dns_reply $dns_req_data $dns_resp_data

# NXT_RESUMEs should be 9.
ovs_wait_cond () {
    test 9 = `cat ofctl_monitor*.log | grep -c NXT_RESUME`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8604" "until test 9 = \`cat ofctl_monitor*.log | grep -c NXT_RESUME\`"


$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/vif1-tx.pcap > 1.packets
# Skipping the UDP checksum.
cat 1.expected | cut -c 1-120,125- > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:8609: cat 1.packets | cut -c 1-120,125-"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:8609"
( $at_check_trace; cat 1.packets | cut -c 1-120,125-
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8609"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }


reset_pcap_file hv1-vif1 hv1/vif1
reset_pcap_file hv1-vif2 hv1/vif2
rm -f 1.expected
rm -f 2.expected




    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:8616: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:8616"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8616"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8616: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:8616"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8616"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8616" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:8616: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:8616"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8616"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8616: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:8616"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8616"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8616" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:8616: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:8616"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8616"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8616: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:8616"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8616"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8616" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:8616: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:8616"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8616"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8616: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:8616"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8616"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8616" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:8616: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:8616"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8616"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8616: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:8616"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8616"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8616" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:8616: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:8616"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8616"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8616: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:8616"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8616"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8616" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:8616: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:8616"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8616"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8616: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:8616"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8616"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8616" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:8616: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:8616"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8616"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8616: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:8616"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8616"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8616" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:8616: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:8616"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8616"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8616: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:8616"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8616"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8616" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:8616: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:8616"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8616"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8616: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:8616"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8616"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8616" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:8616: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:8616"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8616"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8616: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:8616"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8616"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8616" "while kill -0 \$TMPPID 2>/dev/null"




ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_75
#AT_START_76
at_fn_group_banner 76 'ovn.at:8620' \
  "ovn -- 4 HV, 1 LS, 1 LR, packet test with HA distributed router gateway port" "" 2
at_xfail=no
(
  $as_echo "76. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

net_add n1

sim_add hv1
as hv1
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.1
ovs-vsctl -- add-port br-int hv1-vif1 -- \
    set interface hv1-vif1 external-ids:iface-id=foo1 \
    options:tx_pcap=hv1/vif1-tx.pcap \
    options:rxq_pcap=hv1/vif1-rx.pcap \
    ofport-request=1

sim_add gw1
as gw1
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.2

sim_add gw2
as gw2
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.4

sim_add ext1
as ext1
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.3
ovs-vsctl -- add-port br-int ext1-vif1 -- \
    set interface ext1-vif1 external-ids:iface-id=outside1 \
    options:tx_pcap=ext1/vif1-tx.pcap \
    options:rxq_pcap=ext1/vif1-rx.pcap \
    ofport-request=1

# Pre-populate the hypervisors' ARP tables so that we don't lose any
# packets for ARP resolution (native tunneling doesn't queue packets
# for ARP resolution).
{ set +x
$as_echo "$at_srcdir/ovn.at:8658: ovn_populate_arp__"
at_fn_check_prepare_trace "ovn.at:8658"
( $at_check_trace; ovn_populate_arp__
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8658"
$at_failed && at_fn_log_failure
$at_traceon; }


ovn-nbctl create Logical_Router name=R1

ovn-nbctl ls-add foo
ovn-nbctl ls-add alice
ovn-nbctl ls-add outside

# Connect foo to R1
ovn-nbctl lrp-add R1 foo 00:00:01:01:02:03 192.168.1.1/24
ovn-nbctl lsp-add foo rp-foo -- set Logical_Switch_Port rp-foo \
    type=router options:router-port=foo \
    -- lsp-set-addresses rp-foo router

# Connect alice to R1 as distributed router gateway port on gw1
ovn-nbctl lrp-add R1 alice 00:00:02:01:02:03 172.16.1.1/24

ovn-nbctl \
    --id=@gc0 create Gateway_Chassis name=alice_gw1 \
                                     chassis_name=gw1 \
                                     priority=20 -- \
    --id=@gc1 create Gateway_Chassis name=alice_gw2 \
                                     chassis_name=gw2 \
                                     priority=10 -- \
    set Logical_Router_Port alice 'gateway_chassis=@gc0,@gc1'

ovn-nbctl lsp-add alice rp-alice -- set Logical_Switch_Port rp-alice \
    type=router options:router-port=alice \
    -- lsp-set-addresses rp-alice router

# Create logical port foo1 in foo
ovn-nbctl lsp-add foo foo1 \
-- lsp-set-addresses foo1 "f0:00:00:01:02:03 192.168.1.2"

# Create logical port outside1 in outside
ovn-nbctl lsp-add outside outside1 \
-- lsp-set-addresses outside1 "f0:00:00:01:02:04 172.16.1.3"

# Create localnet port in alice
ovn-nbctl lsp-add alice ln-alice
ovn-nbctl lsp-set-addresses ln-alice unknown
ovn-nbctl lsp-set-type ln-alice localnet
ovn-nbctl lsp-set-options ln-alice network_name=phys

# Create localnet port in outside
ovn-nbctl lsp-add outside ln-outside
ovn-nbctl lsp-set-addresses ln-outside unknown
ovn-nbctl lsp-set-type ln-outside localnet
ovn-nbctl lsp-set-options ln-outside network_name=phys

# Create bridge-mappings on gw1, gw2 and ext1, hv1 doesn't need
# mapping to the external network, is the one generating packets
as gw1 ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys
as gw2 ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys
as ext1 ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys

{ set +x
$as_echo "$at_srcdir/ovn.at:8714: ovn-nbctl --timeout=3 --wait=sb sync"
at_fn_check_prepare_trace "ovn.at:8714"
( $at_check_trace; ovn-nbctl --timeout=3 --wait=sb sync
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8714"
$at_failed && at_fn_log_failure
$at_traceon; }


# Allow some time for ovn-northd and ovn-controller to catch up.
# XXX This should be more systematic.
sleep 2

ip_to_hex() {
    printf "%02x%02x%02x%02x" "$@"
}

reset_pcap_file() {
    local iface=$1
    local pcap_file=$2
    ovs-vsctl -- set Interface $iface options:tx_pcap=dummy-tx.pcap \
options:rxq_pcap=dummy-rx.pcap
    rm -f ${pcap_file}*.pcap
    ovs-vsctl -- set Interface $iface options:tx_pcap=${pcap_file}-tx.pcap \
options:rxq_pcap=${pcap_file}-rx.pcap
}

test_ip_packet()
{
    local active_gw=$1
    local backup_gw=$2
    local backup_vswitchd_dead=$3

    # Send ip packet between foo1 and outside1
    src_mac="f00000010203" # foo1 mac
    dst_mac="000001010203" # rp-foo mac (internal router leg)
    src_ip=`ip_to_hex 192 168 1 2`
    dst_ip=`ip_to_hex 172 16 1 3`
    packet=${dst_mac}${src_mac}08004500001c0000000040110000${src_ip}${dst_ip}0035111100080000

    # ARP request packet to expect at outside1
    #arp_request=ffffffffffff${src_mac}08060001080006040001${src_mac}${src_ip}000000000000${dst_ip}

    as hv1 ovs-appctl netdev-dummy/receive hv1-vif1 $packet

    # Send ARP reply from outside1 back to the router
    # XXX: note, we could avoid this if we plug this port into a netns
    # and setup the IP address into the port, so the kernel would simply reply
    src_mac="000002010203"
    reply_mac="f00000010204"
    dst_ip=`ip_to_hex 172 16 1 3`
    src_ip=`ip_to_hex 172 16 1 1`
    arp_reply=${src_mac}${reply_mac}08060001080006040002${reply_mac}${dst_ip}${src_mac}${src_ip}

    as ext1 ovs-appctl netdev-dummy/receive ext1-vif1 $arp_reply

    ovs_wait_cond () {

        test `as $active_gw ovs-ofctl dump-flows br-int | grep table=66 | \
grep actions=mod_dl_dst:f0:00:00:01:02:04 | wc -l` -eq 1

}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8763" "until
        test \`as \$active_gw ovs-ofctl dump-flows br-int | grep table=66 | \\
grep actions=mod_dl_dst:f0:00:00:01:02:04 | wc -l\` -eq 1
    "


    # Packet to Expect at ext1 chassis, outside1 port
    src_mac="000002010203"
    dst_mac="f00000010204"
    src_ip=`ip_to_hex 192 168 1 2`
    dst_ip=`ip_to_hex 172 16 1 3`
    expected=${dst_mac}${src_mac}08004500001c000000003f110100${src_ip}${dst_ip}0035111100080000
    echo $expected > ext1-vif1.expected
    exp_gw_ip_garp=ffffffffffff00000201020308060001080006040001000002010203ac100101000000000000ac100101
    echo $exp_gw_ip_garp >> ext1-vif1.expected
    as $active_gw reset_pcap_file br-phys_n1 $active_gw/br-phys_n1

    if test $backup_vswitchd_dead != 1; then
        # Reset the file only if vswitchd in backup gw is alive
        as $backup_gw reset_pcap_file br-phys_n1 $backup_gw/br-phys_n1
    fi
    as ext1 reset_pcap_file ext1-vif1 ext1/vif1

    # Resend packet from foo1 to outside1
    as hv1 ovs-appctl netdev-dummy/receive hv1-vif1 $packet

    sleep 1

    ovn_check_packets__ "ext1/vif1-tx.pcap" "ext1-vif1.expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:8790: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:8790"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8790"
$at_failed && at_fn_log_failure
$at_traceon; }

    $PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" $active_gw/br-phys_n1-tx.pcap  > packets
    cat packets | grep $expected > exp
    # Its possible that $active_gw/br-phys_n1-tx.pcap may have received multiple
    # garp packets. So consider only the first packet.
    cat packets | grep $exp_gw_ip_garp | head -1 >> exp
    { set +x
$as_echo "$at_srcdir/ovn.at:8796: cat exp"
at_fn_check_prepare_trace "ovn.at:8796"
( $at_check_trace; cat exp
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8796"
$at_failed && at_fn_log_failure
$at_traceon; }

    rm -f expout
    if test $backup_vswitchd_dead != 1; then
        # Check for backup gw only if vswitchd is alive
        $PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" $backup_gw/br-phys_n1-tx.pcap  > packets
        { set +x
$as_echo "$at_srcdir/ovn.at:8801: grep \$expected packets | sort"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:8801"
( $at_check_trace; grep $expected packets | sort
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8801"
$at_failed && at_fn_log_failure
$at_traceon; }

    fi
}

test_ip_packet gw1 gw2 0

ovn-nbctl --timeout=3 --wait=hv \
    --id=@gc0 create Gateway_Chassis name=alice_gw1 \
                                     chassis_name=gw1 \
                                     priority=10 -- \
    --id=@gc1 create Gateway_Chassis name=alice_gw2 \
                                     chassis_name=gw2 \
                                     priority=20 -- \
    set Logical_Router_Port alice 'gateway_chassis=@gc0,@gc1'

test_ip_packet gw2 gw1 0

# Get the claim count of both gw1 and gw2.
gw1_claim_ct=`grep "cr-alice: Claiming" gw1/ovn-controller.log | wc -l`
gw2_claim_ct=`grep "cr-alice: Claiming" gw2/ovn-controller.log | wc -l`

# Stop ovs-vswitchd in gw2. gw1 should claim the gateway port.
as gw2
{ set +x
$as_echo "$at_srcdir/ovn.at:8824: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:8824"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8824"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8824: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:8824"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8824"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8824" "while kill -0 \$TMPPID 2>/dev/null"


# gw1 should claim the cr-alice and the claim count of gw1 should be
# incremented by 1.
gw1_claim_ct=$((gw1_claim_ct+1))

ovs_wait_cond () {
    test $gw1_claim_ct = `cat gw1/ovn-controller.log \
| grep -c "cr-alice: Claiming"`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8830" "until test \$gw1_claim_ct = \`cat gw1/ovn-controller.log \\
| grep -c \"cr-alice: Claiming\"\`"


{ set +x
$as_echo "$at_srcdir/ovn.at:8833: test \$gw2_claim_ct = \`cat gw2/ovn-controller.log | \\
grep -c \"cr-alice: Claiming\"\`"
at_fn_check_prepare_notrace 'a `...` command substitution' "ovn.at:8833"
( $at_check_trace; test $gw2_claim_ct = `cat gw2/ovn-controller.log | \
grep -c "cr-alice: Claiming"`
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8833"
$at_failed && at_fn_log_failure
$at_traceon; }


test_ip_packet gw1 gw2 1

as gw2
{ set +x
$as_echo "$at_srcdir/ovn.at:8839: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:8839"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8839"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8839: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:8839"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8839"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8839" "while kill -0 \$TMPPID 2>/dev/null"

{ set +x
$as_echo "$at_srcdir/ovn.at:8840: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:8840"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8840"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8840: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:8840"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8840"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8840" "while kill -0 \$TMPPID 2>/dev/null"





    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:8842: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:8842"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8842"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8842: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:8842"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8842"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8842" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:8842: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:8842"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8842"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8842: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:8842"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8842"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8842" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:8842: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:8842"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8842"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8842: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:8842"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8842"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8842" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:8842: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:8842"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8842"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8842: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:8842"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8842"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8842" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:8842: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:8842"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8842"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8842: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:8842"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8842"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8842" "while kill -0 \$TMPPID 2>/dev/null"





    as gw1
    if test "gw1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:8842: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:8842"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8842"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8842: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:8842"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8842"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8842" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:8842: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:8842"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8842"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8842: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:8842"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8842"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8842" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:8842: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:8842"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8842"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8842: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:8842"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8842"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8842" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as gw1
    { set +x
$as_echo "$at_srcdir/ovn.at:8842: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:8842"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8842"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8842: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:8842"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8842"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8842" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:8842: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:8842"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8842"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8842: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:8842"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8842"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8842" "while kill -0 \$TMPPID 2>/dev/null"





    as ext1
    if test "ext1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:8842: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:8842"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8842"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8842: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:8842"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8842"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8842" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:8842: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:8842"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8842"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8842: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:8842"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8842"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8842" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:8842: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:8842"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8842"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8842: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:8842"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8842"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8842" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as ext1
    { set +x
$as_echo "$at_srcdir/ovn.at:8842: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:8842"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8842"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8842: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:8842"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8842"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8842" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:8842: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:8842"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8842"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8842: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:8842"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8842"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8842" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:8842: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:8842"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8842"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8842: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:8842"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8842"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8842" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:8842: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:8842"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8842"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8842: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:8842"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8842"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8842" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:8842: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:8842"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8842"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8842: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:8842"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8842"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8842" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:8842: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:8842"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8842"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8842: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:8842"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8842"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8842" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:8842: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:8842"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8842"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8842: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:8842"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8842"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8842" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:8842: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:8842"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8842"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:8842: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:8842"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8842"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8842" "while kill -0 \$TMPPID 2>/dev/null"




ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_76
#AT_START_77
at_fn_group_banner 77 'ovn.at:8846' \
  "ovn -- 4 HV, 3 LS, 2 LR, packet test with HA distributed router gateway port" "" 2
at_xfail=no
(
  $as_echo "77. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

net_add n1

sim_add hv1
as hv1
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.1
ovs-vsctl -- add-port br-int hv1-vif1 -- \
    set interface hv1-vif1 external-ids:iface-id=foo1 \
    options:tx_pcap=hv1/vif1-tx.pcap \
    options:rxq_pcap=hv1/vif1-rx.pcap \
    ofport-request=1

sim_add gw1
as gw1
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.2

sim_add gw2
as gw2
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.4

sim_add ext1
as ext1
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.3
ovs-vsctl -- add-port br-int ext1-vif1 -- \
    set interface ext1-vif1 external-ids:iface-id=outside1 \
    options:tx_pcap=ext1/vif1-tx.pcap \
    options:rxq_pcap=ext1/vif1-rx.pcap \
    ofport-request=1

# Pre-populate the hypervisors' ARP tables so that we don't lose any
# packets for ARP resolution (native tunneling doesn't queue packets
# for ARP resolution).
{ set +x
$as_echo "$at_srcdir/ovn.at:8884: ovn_populate_arp__"
at_fn_check_prepare_trace "ovn.at:8884"
( $at_check_trace; ovn_populate_arp__
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8884"
$at_failed && at_fn_log_failure
$at_traceon; }


ovn-nbctl create Logical_Router name=R0
ovn-nbctl create Logical_Router name=R1

ovn-nbctl ls-add foo
ovn-nbctl ls-add join
ovn-nbctl ls-add alice
ovn-nbctl ls-add outside

#Connect foo to R0
ovn-nbctl lrp-add R0 R0-foo 00:00:01:01:02:03 192.168.1.1/24
ovn-nbctl lsp-add foo foo-R0 -- set Logical_Switch_Port foo-R0 \
    type=router options:router-port=R0-foo \
    -- lsp-set-addresses foo-R0 router

#Connect R0 to join
ovn-nbctl lrp-add R0 R0-join 00:00:0d:01:02:03 100.60.1.1/24
ovn-nbctl lsp-add join join-R0 -- set Logical_Switch_Port join-R0 \
    type=router options:router-port=R0-join \
    -- lsp-set-addresses join-R0 router

#Connect join to R1
ovn-nbctl lrp-add R1 R1-join 00:00:0e:01:02:03 100.60.1.2/24
ovn-nbctl lsp-add join join-R1 -- set Logical_Switch_Port join-R1 \
    type=router options:router-port=R1-join \
    -- lsp-set-addresses join-R1 router

#add route rules
ovn-nbctl lr-route-add R0 0.0.0.0/0 100.60.1.2
ovn-nbctl lr-route-add R1 192.168.0.0/16 100.60.1.1

# Connect alice to R1 as distributed router gateway port on gw1
ovn-nbctl lrp-add R1 alice 00:00:02:01:02:03 172.16.1.1/24

ovn-nbctl \
    --id=@gc0 create Gateway_Chassis name=alice_gw1 \
                                     chassis_name=gw1 \
                                     priority=20 -- \
    --id=@gc1 create Gateway_Chassis name=alice_gw2 \
                                     chassis_name=gw2 \
                                     priority=10 -- \
    set Logical_Router_Port alice 'gateway_chassis=@gc0,@gc1'

ovn-nbctl lsp-add alice rp-alice -- set Logical_Switch_Port rp-alice \
    type=router options:router-port=alice \
    -- lsp-set-addresses rp-alice router

# Create logical port foo1 in foo
ovn-nbctl lsp-add foo foo1 \
-- lsp-set-addresses foo1 "f0:00:00:01:02:03 192.168.1.2"

# Create logical port outside1 in outside
ovn-nbctl lsp-add outside outside1 \
-- lsp-set-addresses outside1 "f0:00:00:01:02:04 172.16.1.3"

# Create localnet port in alice
ovn-nbctl lsp-add alice ln-alice
ovn-nbctl lsp-set-addresses ln-alice unknown
ovn-nbctl lsp-set-type ln-alice localnet
ovn-nbctl lsp-set-options ln-alice network_name=phys

# Create localnet port in outside
ovn-nbctl lsp-add outside ln-outside
ovn-nbctl lsp-set-addresses ln-outside unknown
ovn-nbctl lsp-set-type ln-outside localnet
ovn-nbctl lsp-set-options ln-outside network_name=phys

# Create bridge-mappings on gw1, gw2 and ext1, hv1 doesn't need
# mapping to the external network, is the one generating packets
as gw1 ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys
as gw2 ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys
as ext1 ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys

{ set +x
$as_echo "$at_srcdir/ovn.at:8958: ovn-nbctl --timeout=3 --wait=sb sync"
at_fn_check_prepare_trace "ovn.at:8958"
( $at_check_trace; ovn-nbctl --timeout=3 --wait=sb sync
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:8958"
$at_failed && at_fn_log_failure
$at_traceon; }


# hv1 should be in 'ref_chassis' of the ha_chasssi_group as logical
# switch 'foo' can reach the router 'R1' (which has gw router port)
# via foo1 -> foo -> R0 -> join -> R1
hv1_ch_uuid=`ovn-sbctl --bare --columns _uuid find chassis name="hv1"`
ovs_wait_cond () {
    ref_ch_list=`ovn-sbctl --bare --columns ref_chassis find ha_chassis_group | sort`
     # Trim the spaces.
     ref_ch_list=`echo $ref_ch_list | sed 's/ //g'`
     test "$hv1_ch_uuid" = "$ref_ch_list"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:8964" "until ref_ch_list=\`ovn-sbctl --bare --columns ref_chassis find ha_chassis_group | sort\`
     # Trim the spaces.
     ref_ch_list=\`echo \$ref_ch_list | sed 's/ //g'\`
     test \"\$hv1_ch_uuid\" = \"\$ref_ch_list\""


# Allow some time for ovn-northd and ovn-controller to catch up.
# XXX This should be more systematic.
sleep 2

ip_to_hex() {
    printf "%02x%02x%02x%02x" "$@"
}

reset_pcap_file() {
    local iface=$1
    local pcap_file=$2
    ovs-vsctl -- set Interface $iface options:tx_pcap=dummy-tx.pcap \
options:rxq_pcap=dummy-rx.pcap
    rm -f ${pcap_file}*.pcap
    ovs-vsctl -- set Interface $iface options:tx_pcap=${pcap_file}-tx.pcap \
options:rxq_pcap=${pcap_file}-rx.pcap
}

test_ip_packet()
{
    local active_gw=$1
    local backup_gw=$2

    # Send ip packet between foo1 and outside1
    src_mac="f00000010203" # foo1 mac
    dst_mac="000001010203" # foo-R0 mac (internal router leg)
    src_ip=`ip_to_hex 192 168 1 2`
    dst_ip=`ip_to_hex 172 16 1 3`
    packet=${dst_mac}${src_mac}08004500001c0000000040110000${src_ip}${dst_ip}0035111100080000

    # ARP request packet to expect at outside1
    #arp_request=ffffffffffff${src_mac}08060001080006040001${src_mac}${src_ip}000000000000${dst_ip}

    as hv1 ovs-appctl netdev-dummy/receive hv1-vif1 $packet

    # Send ARP reply from outside1 back to the router
    # XXX: note, we could avoid this if we plug this port into a netns
    # and setup the IP address into the port, so the kernel would simply reply
    src_mac="000002010203"
    reply_mac="f00000010204"
    dst_ip=`ip_to_hex 172 16 1 3`
    src_ip=`ip_to_hex 172 16 1 1`
    arp_reply=${src_mac}${reply_mac}08060001080006040002${reply_mac}${dst_ip}${src_mac}${src_ip}

    as ext1 ovs-appctl netdev-dummy/receive ext1-vif1 $arp_reply

    ovs_wait_cond () {

        test `as $active_gw ovs-ofctl dump-flows br-int | grep table=66 | \
grep actions=mod_dl_dst:f0:00:00:01:02:04 | wc -l` -eq 1

}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9016" "until
        test \`as \$active_gw ovs-ofctl dump-flows br-int | grep table=66 | \\
grep actions=mod_dl_dst:f0:00:00:01:02:04 | wc -l\` -eq 1
    "


    # Packet to Expect at ext1 chassis, outside1 port
    src_mac="000002010203"
    dst_mac="f00000010204"
    src_ip=`ip_to_hex 192 168 1 2`
    dst_ip=`ip_to_hex 172 16 1 3`
    expected=${dst_mac}${src_mac}08004500001c000000003e110200${src_ip}${dst_ip}0035111100080000
    echo $expected > ext1-vif1.expected
    exp_gw_ip_garp=ffffffffffff00000201020308060001080006040001000002010203ac100101000000000000ac100101
    echo $exp_gw_ip_garp >> ext1-vif1.expected

    as $active_gw reset_pcap_file br-phys_n1 $active_gw/br-phys_n1
    as $backup_gw reset_pcap_file br-phys_n1 $backup_gw/br-phys_n1
    as ext1 reset_pcap_file ext1-vif1 ext1/vif1

    # Resend packet from foo1 to outside1
    as hv1 ovs-appctl netdev-dummy/receive hv1-vif1 $packet

    ovn_check_packets__ "ext1/vif1-tx.pcap" "ext1-vif1.expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:9038: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:9038"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9038"
$at_failed && at_fn_log_failure
$at_traceon; }

    $PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" $active_gw/br-phys_n1-tx.pcap  > packets
    cat packets | grep $expected > exp
    cat packets | grep $exp_gw_ip_garp | head -1 >> exp
    { set +x
$as_echo "$at_srcdir/ovn.at:9042: cat exp"
at_fn_check_prepare_trace "ovn.at:9042"
( $at_check_trace; cat exp
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9042"
$at_failed && at_fn_log_failure
$at_traceon; }


    $PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" $backup_gw/br-phys_n1-tx.pcap  > packets
    { set +x
$as_echo "$at_srcdir/ovn.at:9045: grep \$expected packets | sort"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:9045"
( $at_check_trace; grep $expected packets | sort
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9045"
$at_failed && at_fn_log_failure
$at_traceon; }

}

test_ip_packet gw1 gw2

ovn-nbctl --timeout=3 --wait=hv \
    --id=@gc0 create Gateway_Chassis name=alice_gw1 \
                                     chassis_name=gw1 \
                                     priority=10 -- \
    --id=@gc1 create Gateway_Chassis name=alice_gw2 \
                                     chassis_name=gw2 \
                                     priority=20 -- \
    set Logical_Router_Port alice 'gateway_chassis=@gc0,@gc1'

test_ip_packet gw2 gw1




    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:9061: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:9061"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9061"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9061: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:9061"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9061"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9061" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:9061: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:9061"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9061"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9061: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:9061"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9061"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9061" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:9061: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:9061"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9061"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9061: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:9061"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9061"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9061" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:9061: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:9061"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9061"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9061: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:9061"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9061"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9061" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:9061: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:9061"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9061"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9061: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:9061"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9061"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9061" "while kill -0 \$TMPPID 2>/dev/null"





    as gw1
    if test "gw1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:9061: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:9061"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9061"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9061: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:9061"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9061"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9061" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:9061: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:9061"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9061"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9061: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:9061"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9061"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9061" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:9061: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:9061"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9061"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9061: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:9061"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9061"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9061" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as gw1
    { set +x
$as_echo "$at_srcdir/ovn.at:9061: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:9061"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9061"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9061: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:9061"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9061"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9061" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:9061: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:9061"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9061"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9061: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:9061"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9061"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9061" "while kill -0 \$TMPPID 2>/dev/null"





    as gw2
    if test "gw2" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:9061: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:9061"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9061"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9061: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:9061"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9061"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9061" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:9061: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:9061"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9061"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9061: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:9061"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9061"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9061" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:9061: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:9061"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9061"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9061: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:9061"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9061"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9061" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as gw2
    { set +x
$as_echo "$at_srcdir/ovn.at:9061: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:9061"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9061"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9061: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:9061"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9061"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9061" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:9061: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:9061"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9061"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9061: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:9061"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9061"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9061" "while kill -0 \$TMPPID 2>/dev/null"





    as ext1
    if test "ext1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:9061: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:9061"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9061"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9061: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:9061"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9061"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9061" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:9061: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:9061"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9061"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9061: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:9061"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9061"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9061" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:9061: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:9061"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9061"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9061: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:9061"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9061"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9061" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as ext1
    { set +x
$as_echo "$at_srcdir/ovn.at:9061: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:9061"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9061"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9061: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:9061"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9061"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9061" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:9061: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:9061"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9061"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9061: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:9061"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9061"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9061" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:9061: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:9061"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9061"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9061: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:9061"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9061"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9061" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:9061: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:9061"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9061"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9061: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:9061"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9061"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9061" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:9061: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:9061"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9061"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9061: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:9061"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9061"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9061" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:9061: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:9061"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9061"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9061: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:9061"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9061"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9061" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:9061: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:9061"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9061"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9061: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:9061"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9061"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9061" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:9061: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:9061"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9061"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9061: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:9061"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9061"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9061" "while kill -0 \$TMPPID 2>/dev/null"



ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_77
#AT_START_78
at_fn_group_banner 78 'ovn.at:9064' \
  "ovn -- 1 LR with distributed router gateway port" "" 2
at_xfail=no
(
  $as_echo "78. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

# Logical network:
# One LR R1 that has switches foo (192.168.1.0/24) and
# alice (172.16.1.0/24) connected to it.  The logical port
# between R1 and alice has a "redirect-chassis" specified,
# i.e. it is the distributed router gateway port.
# Switch alice also has a localnet port defined.
# An additional switch outside has a localnet port and the
# same subnet as alice (172.16.1.0/24).

# Physical network:
# Three hypervisors hv[123].
# hv1 hosts vif foo1.
# hv2 is the "redirect-chassis" that hosts the distributed
# router gateway port.
# hv3 hosts vif outside1.
# In order to show that connectivity works only through hv2,
# an initial round of tests is run without any bridge-mapping
# defined for the localnet on hv2.  These tests are expected
# to fail.
# Subsequent tests are run after defining the bridge-mapping
# for the localnet on hv2. These tests are expected to succeed.

# Create three hypervisors and create OVS ports corresponding
# to logical ports.
net_add n1

sim_add hv1
as hv1
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.1
ovs-vsctl -- add-port br-int hv1-vif1 -- \
    set interface hv1-vif1 external-ids:iface-id=foo1 \
    options:tx_pcap=hv1/vif1-tx.pcap \
    options:rxq_pcap=hv1/vif1-rx.pcap \
    ofport-request=1

sim_add hv2
as hv2
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.2

sim_add hv3
as hv3
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.3
ovs-vsctl -- add-port br-int hv3-vif1 -- \
    set interface hv3-vif1 external-ids:iface-id=outside1 \
    options:tx_pcap=hv3/vif1-tx.pcap \
    options:rxq_pcap=hv3/vif1-rx.pcap \
    ofport-request=1

# Pre-populate the hypervisors' ARP tables so that we don't lose any
# packets for ARP resolution (native tunneling doesn't queue packets
# for ARP resolution).
{ set +x
$as_echo "$at_srcdir/ovn.at:9121: ovn_populate_arp__"
at_fn_check_prepare_trace "ovn.at:9121"
( $at_check_trace; ovn_populate_arp__
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9121"
$at_failed && at_fn_log_failure
$at_traceon; }


ovn-nbctl create Logical_Router name=R1

ovn-nbctl ls-add foo
ovn-nbctl ls-add alice
ovn-nbctl ls-add outside

# Connect foo to R1
ovn-nbctl lrp-add R1 foo 00:00:01:01:02:03 192.168.1.1/24
ovn-nbctl lsp-add foo rp-foo -- set Logical_Switch_Port rp-foo \
    type=router options:router-port=foo \
    -- lsp-set-addresses rp-foo router

# Connect alice to R1 as distributed router gateway port on hv2
ovn-nbctl lrp-add R1 alice 00:00:02:01:02:03 172.16.1.1/24 \
    -- set Logical_Router_Port alice options:redirect-chassis="hv2"
ovn-nbctl lsp-add alice rp-alice -- set Logical_Switch_Port rp-alice \
    type=router options:router-port=alice \
    -- lsp-set-addresses rp-alice router

# Create logical port foo1 in foo
ovn-nbctl lsp-add foo foo1 \
-- lsp-set-addresses foo1 "f0:00:00:01:02:03 192.168.1.2"

# Create logical port outside1 in outside
ovn-nbctl lsp-add outside outside1 \
-- lsp-set-addresses outside1 "f0:00:00:01:02:04 172.16.1.3"

# Create localnet port in alice
ovn-nbctl lsp-add alice ln-alice
ovn-nbctl lsp-set-addresses ln-alice unknown
ovn-nbctl lsp-set-type ln-alice localnet
ovn-nbctl lsp-set-options ln-alice network_name=phys

# Create localnet port in outside
ovn-nbctl lsp-add outside ln-outside
ovn-nbctl lsp-set-addresses ln-outside unknown
ovn-nbctl lsp-set-type ln-outside localnet
ovn-nbctl lsp-set-options ln-outside network_name=phys

# Create bridge-mappings on hv1 and hv3, leaving hv2 for later
as hv1 ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys
as hv3 ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys


# Allow some time for ovn-northd and ovn-controller to catch up.
# XXX This should be more systematic.
sleep 2

echo "---------NB dump-----"
ovn-nbctl show
echo "---------------------"
ovn-nbctl list logical_router
echo "---------------------"
ovn-nbctl list logical_router_port
echo "---------------------"

echo "---------SB dump-----"
ovn-sbctl list datapath_binding
echo "---------------------"
ovn-sbctl list port_binding
echo "---------------------"
ovn-sbctl dump-flows
echo "---------------------"
ovn-sbctl list chassis
ovn-sbctl list encap
echo "------ Gateway_Chassis dump (SBDB) -------"
ovn-sbctl list Gateway_Chassis
echo "------ Port_Binding chassisredirect -------"
ovn-sbctl find Port_Binding type=chassisredirect
echo "-------------------------------------------"

echo "------ hv1 dump ----------"
as hv1 ovs-ofctl show br-int
as hv1 ovs-ofctl dump-flows br-int
echo "------ hv2 dump ----------"
as hv2 ovs-ofctl show br-int
as hv2 ovs-ofctl dump-flows br-int
echo "------ hv3 dump ----------"
as hv3 ovs-ofctl show br-int
as hv3 ovs-ofctl dump-flows br-int
echo "--------------------------"


# Check that redirect mapping is programmed only on hv2
{ set +x
$as_echo "$at_srcdir/ovn.at:9207: as hv1 ovs-ofctl dump-flows br-int table=33 | grep =0x3,metadata=0x1 | wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:9207"
( $at_check_trace; as hv1 ovs-ofctl dump-flows br-int table=33 | grep =0x3,metadata=0x1 | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9207"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:9209: as hv2 ovs-ofctl dump-flows br-int table=33 | grep =0x3,metadata=0x1 | grep load:0x2- | wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:9209"
( $at_check_trace; as hv2 ovs-ofctl dump-flows br-int table=33 | grep =0x3,metadata=0x1 | grep load:0x2- | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9209"
$at_failed && at_fn_log_failure
$at_traceon; }

# Check that hv1 sends chassisredirect port traffic to hv2
{ set +x
$as_echo "$at_srcdir/ovn.at:9212: as hv1 ovs-ofctl dump-flows br-int table=32 | grep =0x3,metadata=0x1 | grep output | wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:9212"
( $at_check_trace; as hv1 ovs-ofctl dump-flows br-int table=32 | grep =0x3,metadata=0x1 | grep output | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9212"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:9214: as hv2 ovs-ofctl dump-flows br-int table=32 | grep =0x3,metadata=0x1 | wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:9214"
( $at_check_trace; as hv2 ovs-ofctl dump-flows br-int table=32 | grep =0x3,metadata=0x1 | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9214"
$at_failed && at_fn_log_failure
$at_traceon; }

# Check that arp reply on distributed gateway port is only programmed on hv2
{ set +x
$as_echo "$at_srcdir/ovn.at:9217: as hv1 ovs-ofctl dump-flows br-int | grep arp | grep load:0x2- | grep =0x2,metadata=0x1 | wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:9217"
( $at_check_trace; as hv1 ovs-ofctl dump-flows br-int | grep arp | grep load:0x2- | grep =0x2,metadata=0x1 | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9217"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:9219: as hv2 ovs-ofctl dump-flows br-int | grep arp | grep load:0x2- | grep =0x2,metadata=0x1 | wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:9219"
( $at_check_trace; as hv2 ovs-ofctl dump-flows br-int | grep arp | grep load:0x2- | grep =0x2,metadata=0x1 | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9219"
$at_failed && at_fn_log_failure
$at_traceon; }



ip_to_hex() {
    printf "%02x%02x%02x%02x" "$@"
}


: > hv2-vif1.expected
: > hv3-vif1.expected

# test_arp INPORT SHA SPA TPA [REPLY_HA]
#
# Causes a packet to be received on INPORT.  The packet is an ARP
# request with SHA, SPA, and TPA as specified.  If REPLY_HA is provided, then
# it should be the hardware address of the target to expect to receive in an
# ARP reply; otherwise no reply is expected.
#
# INPORT is an logical switch port number, e.g. 11 for vif11.
# SHA and REPLY_HA are each 12 hex digits.
# SPA and TPA are each 8 hex digits.
test_arp() {
    local hv=$1 inport=$2 sha=$3 spa=$4 tpa=$5 reply_ha=$6
    local request=ffffffffffff${sha}08060001080006040001${sha}${spa}ffffffffffff${tpa}
    as hv$hv ovs-appctl netdev-dummy/receive hv${hv}-vif$inport $request

    if test X$reply_ha != X; then
        # Expect to receive the reply, if any.
        local reply=${sha}${reply_ha}08060001080006040002${reply_ha}${tpa}${sha}${spa}
        echo $reply >> hv${hv}-vif$inport.expected
    fi
}

rtr_ip=$(ip_to_hex 172 16 1 1)
foo_ip=$(ip_to_hex 192 168 1 2)
outside_ip=$(ip_to_hex 172 16 1 3)

echo $rtr_ip
echo $foo_ip
echo $outside_ip

# ARP for router IP address from outside1, no response expected
test_arp 3 1 f00000010204 $outside_ip $rtr_ip

# Now check the packets actually received against the ones expected.
ovn_check_packets__ "hv3/vif1-tx.pcap" "hv3-vif1.expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:9265: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:9265"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9265"
$at_failed && at_fn_log_failure
$at_traceon; }


# Send ip packet between foo1 and outside1
src_mac="f00000010203"
dst_mac="000001010203"
src_ip=`ip_to_hex 192 168 1 2`
dst_ip=`ip_to_hex 172 16 1 3`
packet=${dst_mac}${src_mac}08004500001c0000000040110000${src_ip}${dst_ip}0035111100080000

# Now check the packets actually received against the ones expected.
ovn_check_packets__ "hv3/vif1-tx.pcap" "hv3-vif1.expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:9275: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:9275"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9275"
$at_failed && at_fn_log_failure
$at_traceon; }


# Now add bridge-mappings on hv2, which should make everything work
as hv2 ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys

# Wait until the patch ports are created in hv2 to connect br-int to br-phys
ovs_wait_cond () {
    test 1 = `as hv2 ovs-vsctl show | \
grep "Port patch-br-int-to-ln-alice" | wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9281" "until test 1 = \`as hv2 ovs-vsctl show | \\
grep \"Port patch-br-int-to-ln-alice\" | wc -l\`"


# ARP for router IP address from outside1
test_arp 3 1 f00000010204 $outside_ip $rtr_ip 000002010203

# hv3-vif1.expected should also have the gw router port garp packet.
exp_gw_ip_garp=ffffffffffff00000201020308060001080006040001000002010203ac100101000000000000ac100101
echo $exp_gw_ip_garp >> hv3-vif1.expected

# Now check the packets actually received against the ones expected.
ovn_check_packets__ "hv3/vif1-tx.pcap" "hv3-vif1.expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:9292: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:9292"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9292"
$at_failed && at_fn_log_failure
$at_traceon; }


# Send ip packet between foo1 and outside1
src_mac="f00000010203"
dst_mac="000001010203"
src_ip=`ip_to_hex 192 168 1 2`
dst_ip=`ip_to_hex 172 16 1 3`
packet=${dst_mac}${src_mac}08004500001c0000000040110000${src_ip}${dst_ip}0035111100080000

# Packet to Expect at outside1
src_mac="000002010203"
dst_mac="f00000010204"
expected=${dst_mac}${src_mac}08004500001c000000003f110100${src_ip}${dst_ip}0035111100080000

as hv1 ovs-appctl netdev-dummy/receive hv1-vif1 $packet

echo "------ hv1 dump ----------"
as hv1 ovs-ofctl show br-int
as hv1 ovs-ofctl dump-flows br-int
echo "------ hv2 dump ----------"
as hv2 ovs-ofctl show br-int
as hv2 ovs-ofctl dump-flows br-int
echo "------ hv3 dump ----------"
as hv3 ovs-ofctl show br-int
as hv3 ovs-ofctl dump-flows br-int
echo "----------------------------"

echo $expected >> hv3-vif1.expected
ovn_check_packets__ "hv3/vif1-tx.pcap" "hv3-vif1.expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:9320: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:9320"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9320"
$at_failed && at_fn_log_failure
$at_traceon; }


#Check ovn-trace over "chassisredirect" port

ovn_trace () {
    ovn-trace --all "$@" | tee trace | sed '1,/Minimal trace/d'
}

echo 'ip.ttl--;' > expout
echo 'eth.src = 00:00:02:01:02:03;' >> expout
echo 'eth.dst = f0:00:00:01:02:04;' >> expout
echo 'output("ln-alice");' >> expout
{ set +x
$as_echo "$at_srcdir/ovn.at:9332: ovn_trace foo 'inport == \"foo1\" && eth.src == f0:00:00:01:02:03 && eth.dst == 00:00:01:01:02:03 && ip4.src == 192.168.1.2 && ip4.dst == 172.16.1.3 && ip.ttl == 0xff'"
at_fn_check_prepare_trace "ovn.at:9332"
( $at_check_trace; ovn_trace foo 'inport == "foo1" && eth.src == f0:00:00:01:02:03 && eth.dst == 00:00:01:01:02:03 && ip4.src == 192.168.1.2 && ip4.dst == 172.16.1.3 && ip.ttl == 0xff'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9332"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }


# Create logical port alice1 in alice on hv1
as hv1 ovs-vsctl -- add-port br-int hv1-vif2 -- \
    set interface hv1-vif2 external-ids:iface-id=alice1 \
    options:tx_pcap=hv1/vif2-tx.pcap \
    options:rxq_pcap=hv1/vif2-rx.pcap \
    ofport-request=1

ovn-nbctl lsp-add alice alice1 \
-- lsp-set-addresses alice1 "f0:00:00:01:02:05 172.16.1.4"

# Create logical port foo2 in foo on hv2
as hv2 ovs-vsctl -- add-port br-int hv2-vif1 -- \
    set interface hv2-vif1 external-ids:iface-id=foo2 \
    options:tx_pcap=hv2/vif1-tx.pcap \
    options:rxq_pcap=hv2/vif1-rx.pcap \
    ofport-request=1

ovn-nbctl lsp-add foo foo2 \
-- lsp-set-addresses foo2 "f0:00:00:01:02:06 192.168.1.3"

# Allow some time for ovn-northd and ovn-controller to catch up.
# XXX This should be more systematic.
sleep 1

: > hv1-vif2.expected

# Send ip packet between alice1 and foo2
src_mac="f00000010205"
dst_mac="000002010203"
src_ip=`ip_to_hex 172 16 1 4`
dst_ip=`ip_to_hex 192 168 1 3`
packet=${dst_mac}${src_mac}08004500001c0000000040110000${src_ip}${dst_ip}0035111100080000

as hv1 ovs-appctl netdev-dummy/receive hv1-vif2 $packet

# Packet to Expect at foo2
src_mac="000001010203"
dst_mac="f00000010206"
src_ip=`ip_to_hex 172 16 1 4`
dst_ip=`ip_to_hex 192 168 1 3`
expected=${dst_mac}${src_mac}08004500001c000000003f110100${src_ip}${dst_ip}0035111100080000

echo $expected >> hv2-vif1.expected
ovn_check_packets__ "hv2/vif1-tx.pcap" "hv2-vif1.expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:9377: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:9377"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9377"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn.at:9379: ovn-sbctl --bare --columns _uuid find Port_Binding logical_port=cr-alice | wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:9379"
( $at_check_trace; ovn-sbctl --bare --columns _uuid find Port_Binding logical_port=cr-alice | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9379"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }


ovn-nbctl --timeout=3 --wait=sb remove Logical_Router_Port alice options redirect-chassis

{ set +x
$as_echo "$at_srcdir/ovn.at:9384: ovn-sbctl find Port_Binding logical_port=cr-alice | wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:9384"
( $at_check_trace; ovn-sbctl find Port_Binding logical_port=cr-alice | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9384"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }





    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:9387: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:9387"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9387"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9387: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:9387"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9387"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9387" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:9387: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:9387"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9387"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9387: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:9387"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9387"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9387" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:9387: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:9387"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9387"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9387: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:9387"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9387"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9387" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:9387: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:9387"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9387"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9387: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:9387"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9387"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9387" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:9387: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:9387"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9387"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9387: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:9387"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9387"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9387" "while kill -0 \$TMPPID 2>/dev/null"





    as hv2
    if test "hv2" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:9387: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:9387"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9387"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9387: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:9387"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9387"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9387" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:9387: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:9387"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9387"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9387: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:9387"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9387"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9387" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:9387: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:9387"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9387"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9387: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:9387"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9387"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9387" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv2
    { set +x
$as_echo "$at_srcdir/ovn.at:9387: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:9387"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9387"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9387: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:9387"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9387"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9387" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:9387: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:9387"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9387"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9387: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:9387"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9387"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9387" "while kill -0 \$TMPPID 2>/dev/null"





    as hv3
    if test "hv3" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:9387: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:9387"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9387"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9387: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:9387"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9387"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9387" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:9387: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:9387"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9387"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9387: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:9387"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9387"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9387" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:9387: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:9387"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9387"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9387: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:9387"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9387"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9387" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv3
    { set +x
$as_echo "$at_srcdir/ovn.at:9387: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:9387"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9387"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9387: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:9387"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9387"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9387" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:9387: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:9387"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9387"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9387: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:9387"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9387"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9387" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:9387: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:9387"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9387"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9387: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:9387"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9387"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9387" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:9387: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:9387"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9387"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9387: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:9387"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9387"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9387" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:9387: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:9387"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9387"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9387: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:9387"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9387"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9387" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:9387: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:9387"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9387"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9387: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:9387"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9387"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9387" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:9387: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:9387"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9387"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9387: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:9387"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9387"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9387" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:9387: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:9387"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9387"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9387: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:9387"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9387"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9387" "while kill -0 \$TMPPID 2>/dev/null"




ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_78
#AT_START_79
at_fn_group_banner 79 'ovn.at:9391' \
  "ovn -- send gratuitous arp for NAT rules on distributed router" "" 2
at_xfail=no
(
  $as_echo "79. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start
# Create logical switches
ovn-nbctl ls-add ls0
ovn-nbctl ls-add ls1
# Create distributed router
ovn-nbctl create Logical_Router name=lr0
# Add distributed gateway port to distributed router
ovn-nbctl lrp-add lr0 lrp0 f0:00:00:00:00:01 192.168.0.1/24 \
    -- set Logical_Router_Port lrp0 options:redirect-chassis="hv2"
ovn-nbctl lsp-add ls0 lrp0-rp -- set Logical_Switch_Port lrp0-rp \
    type=router options:router-port=lrp0 addresses="router"
# Add router port to ls1
ovn-nbctl lrp-add lr0 lrp1 f0:00:00:00:00:02 10.0.0.1/24
ovn-nbctl lsp-add ls1 lrp1-rp -- set Logical_Switch_Port lrp1-rp \
    type=router options:router-port=lrp1 addresses="router"
# Add logical ports for NAT rules
ovn-nbctl lsp-add ls1 foo1 \
-- lsp-set-addresses foo1 "00:00:00:00:00:03 10.0.0.3"
ovn-nbctl lsp-add ls1 foo2 \
-- lsp-set-addresses foo2 "00:00:00:00:00:04 10.0.0.4"
# Add nat-addresses option
ovn-nbctl lsp-set-options lrp0-rp router-port=lrp0 nat-addresses="router"
# Add NAT rules
{ set +x
$as_echo "$at_srcdir/ovn.at:9415: ovn-nbctl lr-nat-add lr0 snat 192.168.0.1 10.0.0.0/24"
at_fn_check_prepare_trace "ovn.at:9415"
( $at_check_trace; ovn-nbctl lr-nat-add lr0 snat 192.168.0.1 10.0.0.0/24
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9415"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:9416: ovn-nbctl lr-nat-add lr0 dnat 192.168.0.2 10.0.0.2"
at_fn_check_prepare_trace "ovn.at:9416"
( $at_check_trace; ovn-nbctl lr-nat-add lr0 dnat 192.168.0.2 10.0.0.2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9416"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:9417: ovn-nbctl lr-nat-add lr0 dnat_and_snat 192.168.0.3 10.0.0.3 foo1 f0:00:00:00:00:03"
at_fn_check_prepare_trace "ovn.at:9417"
( $at_check_trace; ovn-nbctl lr-nat-add lr0 dnat_and_snat 192.168.0.3 10.0.0.3 foo1 f0:00:00:00:00:03
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9417"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:9418: ovn-nbctl lr-nat-add lr0 dnat_and_snat 192.168.0.4 10.0.0.4 foo2 f0:00:00:00:00:04"
at_fn_check_prepare_trace "ovn.at:9418"
( $at_check_trace; ovn-nbctl lr-nat-add lr0 dnat_and_snat 192.168.0.4 10.0.0.4 foo2 f0:00:00:00:00:04
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9418"
$at_failed && at_fn_log_failure
$at_traceon; }


net_add n1
sim_add hv1
as hv1
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.1

{ set +x
$as_echo "$at_srcdir/ovn.at:9426: ovs-vsctl set Open_vSwitch . external-ids:ovn-bridge-mappings=physnet1:br-phys"
at_fn_check_prepare_trace "ovn.at:9426"
( $at_check_trace; ovs-vsctl set Open_vSwitch . external-ids:ovn-bridge-mappings=physnet1:br-phys
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9426"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:9427: ovs-vsctl add-port br-phys snoopvif -- set Interface snoopvif options:tx_pcap=hv1/snoopvif-tx.pcap options:rxq_pcap=hv1/snoopvif-rx.pcap"
at_fn_check_prepare_trace "ovn.at:9427"
( $at_check_trace; ovs-vsctl add-port br-phys snoopvif -- set Interface snoopvif options:tx_pcap=hv1/snoopvif-tx.pcap options:rxq_pcap=hv1/snoopvif-rx.pcap
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9427"
$at_failed && at_fn_log_failure
$at_traceon; }


sim_add hv2
as hv2
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.2
# Initially test with no bridge-mapping on hv2, expect to receive no packets

sim_add hv3
as hv3
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.3
# Initially test with no bridge-mapping on hv3

# Create a localnet port.
{ set +x
$as_echo "$at_srcdir/ovn.at:9442: ovn-nbctl lsp-add ls0 ln_port"
at_fn_check_prepare_trace "ovn.at:9442"
( $at_check_trace; ovn-nbctl lsp-add ls0 ln_port
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9442"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:9443: ovn-nbctl lsp-set-addresses ln_port unknown"
at_fn_check_prepare_trace "ovn.at:9443"
( $at_check_trace; ovn-nbctl lsp-set-addresses ln_port unknown
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9443"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:9444: ovn-nbctl lsp-set-type ln_port localnet"
at_fn_check_prepare_trace "ovn.at:9444"
( $at_check_trace; ovn-nbctl lsp-set-type ln_port localnet
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9444"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:9445: ovn-nbctl --wait=hv lsp-set-options ln_port network_name=physnet1"
at_fn_check_prepare_trace "ovn.at:9445"
( $at_check_trace; ovn-nbctl --wait=hv lsp-set-options ln_port network_name=physnet1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9445"
$at_failed && at_fn_log_failure
$at_traceon; }


# Allow some time for ovn-northd and ovn-controller to catch up.
# XXX This should be more systematic.
sleep 2

# Expect no packets when hv2 bridge-mapping is not present
: > packets
ovn_check_packets__ "hv1/snoopvif-tx.pcap" "packets"
   { set +x
$as_echo "$at_srcdir/ovn.at:9453: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:9453"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9453"
$at_failed && at_fn_log_failure
$at_traceon; }


# Add bridge-mapping on hv2
{ set +x
$as_echo "$at_srcdir/ovn.at:9456: as hv2 ovs-vsctl set Open_vSwitch . external-ids:ovn-bridge-mappings=physnet1:br-phys"
at_fn_check_prepare_trace "ovn.at:9456"
( $at_check_trace; as hv2 ovs-vsctl set Open_vSwitch . external-ids:ovn-bridge-mappings=physnet1:br-phys
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9456"
$at_failed && at_fn_log_failure
$at_traceon; }


# Wait until the patch ports are created in hv2 to connect br-int to br-phys
ovs_wait_cond () {
    test 1 = `as hv2 ovs-vsctl show | \
grep "Port patch-br-int-to-ln_port" | wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9459" "until test 1 = \`as hv2 ovs-vsctl show | \\
grep \"Port patch-br-int-to-ln_port\" | wc -l\`"


# Wait for packets to be received.
ovs_wait_cond () {
    test `wc -c < "hv1/snoopvif-tx.pcap"` -ge 100
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9463" "until test \`wc -c < \"hv1/snoopvif-tx.pcap\"\` -ge 100"

trim_zeros() {
    sed 's/\(00\)\{1,\}$//'
}
$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/snoopvif-tx.pcap | trim_zeros > packets
expected="fffffffffffff0000000000108060001080006040001f00000000001c0a80001000000000000c0a80001"
echo $expected > expout
expected="fffffffffffff0000000000108060001080006040001f00000000001c0a80002000000000000c0a80002"
echo $expected >> expout
{ set +x
$as_echo "$at_srcdir/ovn.at:9472: sort packets"
at_fn_check_prepare_trace "ovn.at:9472"
( $at_check_trace; sort packets
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9472"
$at_failed && at_fn_log_failure
$at_traceon; }

sort packets | cat

# Temporarily remove nat-addresses option to avoid race conditions
# due to GARP backoff
ovn-nbctl lsp-set-options lrp0-rp router-port=lrp0 nat-addresses=""

reset_pcap_file() {
    local iface=$1
    local pcap_file=$2
    ovs-vsctl -- set Interface $iface options:tx_pcap=dummy-tx.pcap \
options:rxq_pcap=dummy-rx.pcap
    rm -f ${pcap_file}*.pcap
    ovs-vsctl -- set Interface $iface options:tx_pcap=${pcap_file}-tx.pcap \
options:rxq_pcap=${pcap_file}-rx.pcap
}

as hv1 reset_pcap_file snoopvif hv1/snoopvif

# Add OVS ports for foo1 and foo2 on hv3
ovs-vsctl -- add-port br-int hv3-vif1 -- \
    set interface hv3-vif1 external-ids:iface-id=foo1 \
    ofport-request=1
ovs-vsctl -- add-port br-int hv3-vif2 -- \
    set interface hv3-vif2 external-ids:iface-id=foo2 \
    ofport-request=2

# Add bridge-mapping on hv3
{ set +x
$as_echo "$at_srcdir/ovn.at:9500: as hv3 ovs-vsctl set Open_vSwitch . external-ids:ovn-bridge-mappings=physnet1:br-phys"
at_fn_check_prepare_trace "ovn.at:9500"
( $at_check_trace; as hv3 ovs-vsctl set Open_vSwitch . external-ids:ovn-bridge-mappings=physnet1:br-phys
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9500"
$at_failed && at_fn_log_failure
$at_traceon; }


# Wait until the patch ports are created in hv3 to connect br-int to br-phys
ovs_wait_cond () {
    test 1 = `as hv3 ovs-vsctl show | \
grep "Port patch-br-int-to-ln_port" | wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9503" "until test 1 = \`as hv3 ovs-vsctl show | \\
grep \"Port patch-br-int-to-ln_port\" | wc -l\`"


{ set +x
$as_echo "$at_srcdir/ovn.at:9506: test 1 = \`ovn-sbctl dump-flows lr0 | grep lr_in_ip_routing | \\
grep \"ip4.src == 10.0.0.3 && is_chassis_resident(\\\"foo1\\\")\" -c\`"
at_fn_check_prepare_notrace 'a `...` command substitution' "ovn.at:9506"
( $at_check_trace; test 1 = `ovn-sbctl dump-flows lr0 | grep lr_in_ip_routing | \
grep "ip4.src == 10.0.0.3 && is_chassis_resident(\"foo1\")" -c`
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9506"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:9508: test 1 = \`ovn-sbctl dump-flows lr0 | grep lr_in_ip_routing | \\
grep \"ip4.src == 10.0.0.4 && is_chassis_resident(\\\"foo2\\\")\" -c\`"
at_fn_check_prepare_notrace 'a `...` command substitution' "ovn.at:9508"
( $at_check_trace; test 1 = `ovn-sbctl dump-flows lr0 | grep lr_in_ip_routing | \
grep "ip4.src == 10.0.0.4 && is_chassis_resident(\"foo2\")" -c`
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9508"
$at_failed && at_fn_log_failure
$at_traceon; }


key=`ovn-sbctl --bare --columns tunnel_key list datapath_Binding lr0`
# Check that the OVS flows appear for the dnat_and_snat entries in
# lr_in_ip_routing table.
ovs_wait_cond () {
    test 1 = `as hv3 ovs-ofctl dump-flows br-int table=17 | \
grep "priority=400,ip,metadata=0x$key,nw_src=10.0.0.3" -c`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9514" "until test 1 = \`as hv3 ovs-ofctl dump-flows br-int table=17 | \\
grep \"priority=400,ip,metadata=0x\$key,nw_src=10.0.0.3\" -c\`"


ovs_wait_cond () {
    test 1 = `as hv3 ovs-ofctl dump-flows br-int table=17 | \
grep "priority=400,ip,metadata=0x$key,nw_src=10.0.0.4" -c`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9517" "until test 1 = \`as hv3 ovs-ofctl dump-flows br-int table=17 | \\
grep \"priority=400,ip,metadata=0x\$key,nw_src=10.0.0.4\" -c\`"


# Re-add nat-addresses option
ovn-nbctl lsp-set-options lrp0-rp router-port=lrp0 nat-addresses="router"

# Wait for packets to be received.
ovs_wait_cond () {
    test `wc -c < "hv1/snoopvif-tx.pcap"` -ge 250
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9524" "until test \`wc -c < \"hv1/snoopvif-tx.pcap\"\` -ge 250"

trim_zeros() {
    sed 's/\(00\)\{1,\}$//'
}

$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/snoopvif-tx.pcap | trim_zeros > packets
garp_1="fffffffffffff0000000000308060001080006040001f00000000003c0a80003000000000000c0a80003"
echo $garp_1 > expout
garp_2="fffffffffffff0000000000408060001080006040001f00000000004c0a80004000000000000c0a80004"
echo $garp_2 >> expout

cat packets | grep $garp_1 | head -1 > exp
cat packets | grep $garp_2 | head -1 >> exp
{ set +x
$as_echo "$at_srcdir/ovn.at:9537: cat exp"
at_fn_check_prepare_trace "ovn.at:9537"
( $at_check_trace; cat exp
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9537"
$at_failed && at_fn_log_failure
$at_traceon; }





    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:9539: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:9539"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9539"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9539: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:9539"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9539"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9539" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:9539: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:9539"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9539"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9539: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:9539"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9539"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9539" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:9539: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:9539"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9539"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9539: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:9539"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9539"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9539" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:9539: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:9539"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9539"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9539: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:9539"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9539"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9539" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:9539: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:9539"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9539"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9539: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:9539"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9539"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9539" "while kill -0 \$TMPPID 2>/dev/null"





    as hv2
    if test "hv2" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:9539: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:9539"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9539"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9539: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:9539"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9539"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9539" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:9539: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:9539"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9539"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9539: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:9539"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9539"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9539" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:9539: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:9539"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9539"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9539: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:9539"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9539"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9539" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv2
    { set +x
$as_echo "$at_srcdir/ovn.at:9539: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:9539"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9539"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9539: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:9539"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9539"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9539" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:9539: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:9539"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9539"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9539: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:9539"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9539"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9539" "while kill -0 \$TMPPID 2>/dev/null"





    as hv3
    if test "hv3" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:9539: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:9539"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9539"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9539: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:9539"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9539"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9539" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:9539: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:9539"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9539"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9539: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:9539"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9539"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9539" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:9539: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:9539"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9539"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9539: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:9539"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9539"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9539" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv3
    { set +x
$as_echo "$at_srcdir/ovn.at:9539: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:9539"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9539"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9539: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:9539"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9539"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9539" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:9539: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:9539"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9539"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9539: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:9539"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9539"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9539" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:9539: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:9539"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9539"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9539: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:9539"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9539"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9539" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:9539: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:9539"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9539"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9539: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:9539"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9539"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9539" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:9539: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:9539"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9539"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9539: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:9539"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9539"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9539" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:9539: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:9539"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9539"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9539: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:9539"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9539"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9539" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:9539: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:9539"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9539"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9539: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:9539"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9539"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9539" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:9539: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:9539"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9539"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9539: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:9539"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9539"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9539" "while kill -0 \$TMPPID 2>/dev/null"




ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_79
#AT_START_80
at_fn_group_banner 80 'ovn.at:9546' \
  "ovn -- vlan traffic for external network with distributed router gateway port" "" 2
at_xfail=no
(
  $as_echo "80. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

# Logical network:
# # One LR R1 that has switches foo (192.168.1.0/24) and
# # alice (172.16.1.0/24) connected to it.  The logical port
# # between R1 and alice has a "redirect-chassis" specified,
# # i.e. it is the distributed router gateway port(172.16.1.6).
# # Switch alice also has a localnet port defined.
# # An additional switch outside has the same subnet as alice
# # (172.16.1.0/24), a localnet port and nexthop port(172.16.1.1)
# # which will receive the packet destined for external network
# # (i.e 8.8.8.8 as destination ip).

# Physical network:
# # Four hypervisors hv[1234].
# # hv1 hosts vif foo1.
# # hv2 is the "redirect-chassis" that hosts the distributed router gateway port.
# # Later to test GARPs for the router port - foo, hv2 and hv4 are added to the ha_chassis_group
# # hv3 hosts nexthop port vif outside1.
# # All other tests connect hypervisors to network n1 through br-phys for tunneling.
# # But in this test, hv1 won't connect to n1(and no br-phys in hv1), and
# # in order to show vlans(instead of tunneling) used between hv1 and hv2,
# # a new network n2 created and hv1 and hv2 connected to this network through br-ex.
# # hv2 and hv3 are still connected to n1 network through br-phys.
net_add n1

# We are not calling ovn_attach for hv1, to avoid adding br-phys.
# Tunneling won't work in hv1 as ovn-encap-ip is not added to any bridge in hv1
sim_add hv1
as hv1
ovs-vsctl \
    -- set Open_vSwitch . external-ids:system-id=hv1 \
    -- set Open_vSwitch . external-ids:ovn-remote=unix:$ovs_base/ovn-sb/ovn-sb.sock \
    -- set Open_vSwitch . external-ids:ovn-encap-type=geneve,vxlan \
    -- set Open_vSwitch . external-ids:ovn-encap-ip=192.168.0.1 \
    -- add-br br-int \
    -- set bridge br-int fail-mode=secure other-config:disable-in-band=true \
    -- set Open_vSwitch . external-ids:ovn-bridge-mappings=public:br-ex

start_daemon ovn-controller
ovs-vsctl -- add-port br-int hv1-vif1 -- \
    set interface hv1-vif1 external-ids:iface-id=foo1 \
    options:tx_pcap=hv1/vif1-tx.pcap \
    options:rxq_pcap=hv1/vif1-rx.pcap \
    ofport-request=1

sim_add hv2
as hv2
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.2
ovs-vsctl set Open_vSwitch . external-ids:ovn-bridge-mappings="public:br-ex,phys:br-phys"

sim_add hv3
as hv3
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.3
ovs-vsctl -- add-port br-int hv3-vif1 -- \
    set interface hv3-vif1 external-ids:iface-id=outside1 \
    options:tx_pcap=hv3/vif1-tx.pcap \
    options:rxq_pcap=hv3/vif1-rx.pcap \
    ofport-request=1
ovs-vsctl set Open_vSwitch . external-ids:ovn-bridge-mappings="phys:br-phys"

sim_add hv4
as hv4
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.4
ovs-vsctl set Open_vSwitch . external-ids:ovn-bridge-mappings="public:br-ex,phys:br-phys"

# Create network n2 for vlan connectivity between hv1 and hv2
net_add n2

as hv1
ovs-vsctl add-br br-ex
net_attach n2 br-ex

as hv2
ovs-vsctl add-br br-ex
net_attach n2 br-ex

as hv4
ovs-vsctl add-br br-ex
net_attach n2 br-ex

{ set +x
$as_echo "$at_srcdir/ovn.at:9631: ovn_populate_arp__"
at_fn_check_prepare_trace "ovn.at:9631"
( $at_check_trace; ovn_populate_arp__
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9631"
$at_failed && at_fn_log_failure
$at_traceon; }


ovn-nbctl create Logical_Router name=R1

ovn-nbctl ls-add foo
ovn-nbctl ls-add alice
ovn-nbctl ls-add outside

# Connect foo to R1
ovn-nbctl lrp-add R1 foo 00:00:01:01:02:03 192.168.1.1/24
ovn-nbctl lsp-add foo rp-foo -- set Logical_Switch_Port rp-foo \
    type=router options:router-port=foo \
    -- lsp-set-addresses rp-foo router

# Connect alice to R1 as distributed router gateway port (172.16.1.6) on hv2
ovn-nbctl lrp-add R1 alice 00:00:02:01:02:03 172.16.1.6/24 \
    -- set Logical_Router_Port alice options:redirect-chassis="hv2"
ovn-nbctl lsp-add alice rp-alice -- set Logical_Switch_Port rp-alice \
    type=router options:router-port=alice \
    -- lsp-set-addresses rp-alice router \

# Create logical port foo1 in foo
ovn-nbctl lsp-add foo foo1 \
-- lsp-set-addresses foo1 "f0:00:00:01:02:03 192.168.1.2"

# Create logical port outside1 in outside, which is a nexthop address
# for 172.16.1.0/24
ovn-nbctl lsp-add outside outside1 \
-- lsp-set-addresses outside1 "f0:00:00:01:02:04 172.16.1.1"

# Set default gateway (nexthop) to 172.16.1.1
ovn-nbctl lr-route-add R1 "0.0.0.0/0" 172.16.1.1 alice
{ set +x
$as_echo "$at_srcdir/ovn.at:9663: ovn-nbctl lr-nat-add R1 snat 172.16.1.6 192.168.1.1/24"
at_fn_check_prepare_trace "ovn.at:9663"
( $at_check_trace; ovn-nbctl lr-nat-add R1 snat 172.16.1.6 192.168.1.1/24
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9663"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn-nbctl set Logical_Switch_Port rp-alice options:nat-addresses=router

ovn-nbctl lsp-add foo ln-foo
ovn-nbctl lsp-set-addresses ln-foo unknown
ovn-nbctl lsp-set-options ln-foo network_name=public
ovn-nbctl lsp-set-type ln-foo localnet
{ set +x
$as_echo "$at_srcdir/ovn.at:9670: ovn-nbctl set Logical_Switch_Port ln-foo tag=2"
at_fn_check_prepare_trace "ovn.at:9670"
( $at_check_trace; ovn-nbctl set Logical_Switch_Port ln-foo tag=2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9670"
$at_failed && at_fn_log_failure
$at_traceon; }


# Create localnet port in alice
ovn-nbctl lsp-add alice ln-alice
ovn-nbctl lsp-set-addresses ln-alice unknown
ovn-nbctl lsp-set-type ln-alice localnet
ovn-nbctl lsp-set-options ln-alice network_name=phys

# Create localnet port in outside
ovn-nbctl lsp-add outside ln-outside
ovn-nbctl lsp-set-addresses ln-outside unknown
ovn-nbctl lsp-set-type ln-outside localnet
ovn-nbctl lsp-set-options ln-outside network_name=phys

# Allow some time for ovn-northd and ovn-controller to catch up.
# XXX This should be more systematic.
ovn-nbctl --wait=hv --timeout=3 sync

# Check that there is a logical flow in logical switch foo's pipeline
# to set the outport to rp-foo (which is expected).
ovs_wait_cond () {
    test 1 = `ovn-sbctl dump-flows foo | grep ls_in_l2_lkup | \
grep rp-foo | grep -v is_chassis_resident | grep priority=50 -c`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9690" "until test 1 = \`ovn-sbctl dump-flows foo | grep ls_in_l2_lkup | \\
grep rp-foo | grep -v is_chassis_resident | grep priority=50 -c\`"


# Set the option 'reside-on-redirect-chassis' for foo
ovn-nbctl set logical_router_port foo options:reside-on-redirect-chassis=true
# Check that there is a logical flow in logical switch foo's pipeline
# to set the outport to rp-foo with the condition is_chassis_redirect.
ovn-sbctl dump-flows foo
ovs_wait_cond () {
    test 1 = `ovn-sbctl dump-flows foo | grep ls_in_l2_lkup | \
grep rp-foo | grep is_chassis_resident | grep priority=50 -c`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9698" "until test 1 = \`ovn-sbctl dump-flows foo | grep ls_in_l2_lkup | \\
grep rp-foo | grep is_chassis_resident | grep priority=50 -c\`"


echo "---------NB dump-----"
ovn-nbctl show
echo "---------------------"
ovn-nbctl list logical_router
echo "---------------------"
ovn-nbctl list nat
echo "---------------------"
ovn-nbctl list logical_router_port
echo "---------------------"

echo "---------SB dump-----"
ovn-sbctl list datapath_binding
echo "---------------------"
ovn-sbctl list port_binding
echo "---------------------"
ovn-sbctl dump-flows
echo "---------------------"
ovn-sbctl list chassis
echo "---------------------"

for chassis in hv1 hv2 hv3; do
    as $chassis
    echo "------ $chassis dump ----------"
    ovs-vsctl show br-int
    ovs-ofctl show br-int
    ovs-ofctl dump-flows br-int
    echo "--------------------------"
done

ip_to_hex() {
    printf "%02x%02x%02x%02x" "$@"
}

foo1_ip=$(ip_to_hex 192 168 1 2)
gw_ip=$(ip_to_hex 172 16 1 6)
dst_ip=$(ip_to_hex 8 8 8 8)
nexthop_ip=$(ip_to_hex 172 16 1 1)

foo1_mac="f00000010203"
foo_mac="000001010203"
gw_mac="000002010203"
nexthop_mac="f00000010204"

# Send ip packet from foo1 to 8.8.8.8
src_mac="f00000010203"
dst_mac="000001010203"
packet=${foo_mac}${foo1_mac}08004500001c0000000040110000${foo1_ip}${dst_ip}0035111100080000

# Wait for GARPs announcing gw IP to arrive
ovs_wait_cond () {

    test `as hv2 ovs-ofctl dump-flows br-int | grep table=66 | \
grep actions=mod_dl_dst:f0:00:00:01:02:04 | wc -l` -eq 1

}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9750" "until
    test \`as hv2 ovs-ofctl dump-flows br-int | grep table=66 | \\
grep actions=mod_dl_dst:f0:00:00:01:02:04 | wc -l\` -eq 1
    "


# VLAN tagged packet with router port(192.168.1.1) MAC as destination MAC
# is expected on bridge connecting hv1 and hv2
expected=${foo_mac}${foo1_mac}8100000208004500001c0000000040110000${foo1_ip}${dst_ip}0035111100080000
echo $expected > hv1-br-ex_n2.expected

# Packet to Expect at outside1 i.e nexthop(172.16.1.1) port.
# As connection tracking not enabled for this test, snat can't be done on the packet.
# We still see foo1 as the source ip address. But source mac(gateway MAC) and
# dest mac(nexthop mac) are properly configured.
expected=${nexthop_mac}${gw_mac}08004500001c000000003f110100${foo1_ip}${dst_ip}0035111100080000
echo $expected > hv3-vif1.expected

reset_pcap_file() {
    local iface=$1
    local pcap_file=$2
    ovs-vsctl -- set Interface $iface options:tx_pcap=dummy-tx.pcap \
options:rxq_pcap=dummy-rx.pcap
    rm -f ${pcap_file}*.pcap
    ovs-vsctl -- set Interface $iface options:tx_pcap=${pcap_file}-tx.pcap \
options:rxq_pcap=${pcap_file}-rx.pcap
}

as hv1 reset_pcap_file br-ex_n2 hv1/br-ex_n2
as hv3 reset_pcap_file hv3-vif1 hv3/vif1
as hv1 ovs-appctl netdev-dummy/receive hv1-vif1 $packet
sleep 2

# On hv1, table 32 check that no packet goes via the tunnel port
{ set +x
$as_echo "$at_srcdir/ovn.at:9783: as hv1 ovs-ofctl dump-flows br-int table=32 \\
| grep \"NXM_NX_TUN_ID\" | grep -v n_packets=0 | wc -l"
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:9783"
( $at_check_trace; as hv1 ovs-ofctl dump-flows br-int table=32 \
| grep "NXM_NX_TUN_ID" | grep -v n_packets=0 | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9783"
$at_failed && at_fn_log_failure
$at_traceon; }


ip_packet() {
    grep "1010203f00000010203"
}

# Check vlan tagged packet on the bridge connecting hv1 and hv2 with the
# foo1's mac.
$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/br-ex_n2-tx.pcap | ip_packet | uniq > hv1-br-ex_n2
cat hv1-br-ex_n2.expected > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:9795: sort hv1-br-ex_n2"
at_fn_check_prepare_trace "ovn.at:9795"
( $at_check_trace; sort hv1-br-ex_n2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9795"
$at_failed && at_fn_log_failure
$at_traceon; }


# Check expected packet on nexthop interface
$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv3/vif1-tx.pcap | grep ${foo1_ip}${dst_ip} | uniq > hv3-vif1
cat hv3-vif1.expected > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:9800: sort hv3-vif1"
at_fn_check_prepare_trace "ovn.at:9800"
( $at_check_trace; sort hv3-vif1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9800"
$at_failed && at_fn_log_failure
$at_traceon; }


# Test the GARP for the router port ip - 192.168.1.1
ovn-nbctl --wait=sb ha-chassis-group-add hagrp1

as hv1 reset_pcap_file hv1-vif1 hv1/vif1
as hv2 reset_pcap_file br-ex_n2 hv2/br-ex_n2
as hv4 reset_pcap_file br-ex_n2 hv4/br-ex_n2

ovn-nbctl --wait=sb ha-chassis-group-add-chassis hagrp1 hv2 30
ovn-nbctl --wait=sb ha-chassis-group-add-chassis hagrp1 hv4 20

hagrp1_uuid=`ovn-nbctl --bare --columns _uuid find ha_chassis_group name=hagrp1`
ovn-nbctl remove logical_router_port alice options redirect-chassis
ovn-nbctl --wait=sb set logical_router_port alice ha_chassis_group=$hagrp1_uuid

# When hv2 claims the gw router port cr-alice, it should send out
# GARP for 192.168.1.1 and it should be received by foo1 on hv1.

# foo1 (on hv1) should receive GARP without VLAN tag
exp_garp_on_foo1="ffffffffffff00000101020308060001080006040001000001010203c0a80101000000000000c0a80101"
echo $exp_garp_on_foo1 > foo1.expout

# ovn-controller on hv2 should send garp with VLAN tag
sent_garp="ffffffffffff0000010102038100000208060001080006040001000001010203c0a80101000000000000c0a80101"

ovn_check_packets__ "hv1/vif1-tx.pcap" "foo1.expout"
   { set +x
$as_echo "$at_srcdir/ovn.at:9826: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:9826"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9826"
$at_failed && at_fn_log_failure
$at_traceon; }

# Wait until we receive atleast 1 packet
ovs_wait_cond () {
    test 1=`$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv2/br-ex_n2-tx.pcap | wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9828" "until test 1=\`\$PYTHON \"\$ovs_srcdir/utilities/ovs-pcap.in\" hv2/br-ex_n2-tx.pcap | wc -l\`"

$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv2/br-ex_n2-tx.pcap | head -1 > packets
echo $sent_garp > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:9831: cat packets"
at_fn_check_prepare_trace "ovn.at:9831"
( $at_check_trace; cat packets
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9831"
$at_failed && at_fn_log_failure
$at_traceon; }

$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv4/br-ex_n2-tx.pcap > empty
{ set +x
$as_echo "$at_srcdir/ovn.at:9833: cat empty"
at_fn_check_prepare_trace "ovn.at:9833"
( $at_check_trace; cat empty
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9833"
$at_failed && at_fn_log_failure
$at_traceon; }


# Make hv4 master
as hv1 reset_pcap_file hv1-vif1 hv1/vif1
as hv4 reset_pcap_file br-ex_n2 hv4/br-ex_n2
ovn-nbctl --wait=sb ha-chassis-group-add-chassis hagrp1 hv4 40

# Wait till cr-alice is claimed by hv4
hv4_chassis=$(ovn-sbctl --bare --columns=_uuid find Chassis name=hv4)
# check that the chassis redirect port has been claimed by the gw1 chassis
ovs_wait_cond () {
    ovn-sbctl --columns chassis --bare find Port_Binding \
logical_port=cr-alice | grep $hv4_chassis | wc -l
}
ovs_wait_failed () {
    :
    0
}
ovs_wait "ovn.at:9843" "until ovn-sbctl --columns chassis --bare find Port_Binding \\
logical_port=cr-alice | grep \$hv4_chassis | wc -l"


# Reset the pcap file for hv2/br-ex_n2. From now on ovn-controller in hv2
# should not send GARPs for the router ports.
as hv2 reset_pcap_file br-ex_n2 hv2/br-ex_n2

echo $sent_garp > br-ex_n2.expout
ovn_check_packets__ "hv1/vif1-tx.pcap" "foo1.expout"
   { set +x
$as_echo "$at_srcdir/ovn.at:9852: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:9852"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9852"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv4/br-ex_n2-tx.pcap" "br-ex_n2.expout"
   { set +x
$as_echo "$at_srcdir/ovn.at:9853: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:9853"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9853"
$at_failed && at_fn_log_failure
$at_traceon; }


sleep 2

$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv2/br-ex_n2-tx.pcap > empty
{ set +x
$as_echo "$at_srcdir/ovn.at:9858: cat empty"
at_fn_check_prepare_trace "ovn.at:9858"
( $at_check_trace; cat empty
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9858"
$at_failed && at_fn_log_failure
$at_traceon; }





    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:9860: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:9860"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9860"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9860: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:9860"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9860"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9860" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:9860: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:9860"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9860"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9860: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:9860"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9860"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9860" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:9860: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:9860"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9860"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9860: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:9860"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9860"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9860" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:9860: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:9860"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9860"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9860: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:9860"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9860"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9860" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:9860: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:9860"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9860"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9860: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:9860"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9860"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9860" "while kill -0 \$TMPPID 2>/dev/null"





    as hv2
    if test "hv2" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:9860: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:9860"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9860"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9860: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:9860"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9860"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9860" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:9860: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:9860"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9860"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9860: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:9860"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9860"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9860" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:9860: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:9860"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9860"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9860: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:9860"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9860"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9860" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv2
    { set +x
$as_echo "$at_srcdir/ovn.at:9860: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:9860"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9860"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9860: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:9860"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9860"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9860" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:9860: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:9860"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9860"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9860: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:9860"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9860"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9860" "while kill -0 \$TMPPID 2>/dev/null"





    as hv3
    if test "hv3" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:9860: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:9860"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9860"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9860: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:9860"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9860"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9860" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:9860: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:9860"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9860"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9860: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:9860"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9860"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9860" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:9860: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:9860"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9860"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9860: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:9860"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9860"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9860" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv3
    { set +x
$as_echo "$at_srcdir/ovn.at:9860: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:9860"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9860"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9860: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:9860"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9860"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9860" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:9860: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:9860"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9860"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9860: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:9860"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9860"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9860" "while kill -0 \$TMPPID 2>/dev/null"





    as hv4
    if test "hv4" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:9860: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:9860"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9860"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9860: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:9860"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9860"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9860" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:9860: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:9860"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9860"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9860: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:9860"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9860"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9860" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:9860: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:9860"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9860"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9860: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:9860"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9860"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9860" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv4
    { set +x
$as_echo "$at_srcdir/ovn.at:9860: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:9860"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9860"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9860: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:9860"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9860"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9860" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:9860: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:9860"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9860"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9860: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:9860"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9860"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9860" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:9860: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:9860"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9860"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9860: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:9860"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9860"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9860" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:9860: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:9860"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9860"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9860: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:9860"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9860"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9860" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:9860: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:9860"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9860"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9860: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:9860"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9860"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9860" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:9860: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:9860"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9860"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9860: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:9860"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9860"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9860" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:9860: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:9860"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9860"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9860: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:9860"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9860"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9860" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:9860: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:9860"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9860"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:9860: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:9860"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9860"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9860" "while kill -0 \$TMPPID 2>/dev/null"



ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_80
#AT_START_81
at_fn_group_banner 81 'ovn.at:9863' \
  "ovn -- IPv6 ND Router Solicitation responder" "   " 2
at_xfail=no
(
  $as_echo "81. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init


ovn_start

# In this test case we create 1 lswitch with 3 VIF ports attached,
# and a lrouter connected to the lswitch.
# We generate the Router solicitation packet and verify the Router Advertisement
# reply packet from the ovn-controller.

# Create hypervisor and logical switch lsw0, logical router lr0, attach lsw0
# onto lr0, set Logical_Router_Port.ipv6_ra_configs:address_mode column to
# 'slaac' to allow lrp0 send RA for SLAAC mode.
ovn-nbctl ls-add lsw0
ovn-nbctl lr-add lr0
ovn-nbctl lrp-add lr0 lrp0 fa:16:3e:00:00:01 fdad:1234:5678::1/64
ovn-nbctl set Logical_Router_Port lrp0 ipv6_ra_configs:address_mode="slaac"
ovn-nbctl \
    -- lsp-add lsw0 lsp0 \
    -- set Logical_Switch_Port lsp0 type=router \
                     options:router-port=lrp0 \
                     addresses='"fa:16:3e:00:00:01 fdad:1234:5678::1"'
net_add n1
sim_add hv1
as hv1
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.2

ovn-nbctl lsp-add lsw0 lp1
ovn-nbctl lsp-set-addresses lp1 "fa:16:3e:00:00:02 10.0.0.12 fdad:1234:5678:0:f816:3eff:fe:2"
ovn-nbctl lsp-set-port-security lp1 "fa:16:3e:00:00:02 10.0.0.12 fdad:1234:5678:0:f816:3eff:fe:2"

ovn-nbctl lsp-add lsw0 lp2
ovn-nbctl lsp-set-addresses lp2 "fa:16:3e:00:00:03 10.0.0.13 fdad:1234:5678:0:f816:3eff:fe:3"
ovn-nbctl lsp-set-port-security lp2 "fa:16:3e:00:00:03 10.0.0.13 fdad:1234:5678:0:f816:3eff:fe:3"

ovn-nbctl lsp-add lsw0 lp3
ovn-nbctl lsp-set-addresses lp3 "fa:16:3e:00:00:04 10.0.0.14 fdad:1234:5678:0:f816:3eff:fe:4"
ovn-nbctl lsp-set-port-security lp3 "fa:16:3e:00:00:04 10.0.0.14 fdad:1234:5678:0:f816:3eff:fe:4"

# Add ACL rule for ICMPv6 on lsw0
ovn-nbctl acl-add lsw0 from-lport 1002 'ip6 && icmp6'  allow-related
ovn-nbctl acl-add lsw0 to-lport 1002 'outport == "lp1" && ip6 && icmp6'  allow-related
ovn-nbctl acl-add lsw0 to-lport 1002 'outport == "lp2" && ip6 && icmp6'  allow-related
ovn-nbctl acl-add lsw0 to-lport 1002 'outport == "lp3" && ip6 && icmp6'  allow-related

ovs-vsctl -- add-port br-int hv1-vif1 -- \
    set interface hv1-vif1 external-ids:iface-id=lp1 \
    options:tx_pcap=hv1/vif1-tx.pcap \
    options:rxq_pcap=hv1/vif1-rx.pcap \
    ofport-request=1

ovs-vsctl -- add-port br-int hv1-vif2 -- \
    set interface hv1-vif2 external-ids:iface-id=lp2 \
    options:tx_pcap=hv1/vif2-tx.pcap \
    options:rxq_pcap=hv1/vif2-rx.pcap \
    ofport-request=2

ovs-vsctl -- add-port br-int hv1-vif3 -- \
    set interface hv1-vif3 external-ids:iface-id=lp3 \
    options:tx_pcap=hv1/vif3-tx.pcap \
    options:rxq_pcap=hv1/vif3-rx.pcap \
    ofport-request=3

# Allow some time for ovn-northd and ovn-controller to catch up.
# XXX This should be more systematic.
sleep 1

reset_pcap_file() {
    local iface=$1
    local pcap_file=$2
    ovs-vsctl -- set Interface $iface options:tx_pcap=dummy-tx.pcap \
options:rxq_pcap=dummy-rx.pcap
    rm -f ${pcap_file}*.pcap
    ovs-vsctl -- set Interface $iface options:tx_pcap=${pcap_file}-tx.pcap \
options:rxq_pcap=${pcap_file}-rx.pcap
}

# Make sure that ovn-controller has installed the corresponding OF Flow.
ovs_wait_cond () {
    test 1 = `as hv1 ovs-ofctl dump-flows br-int | grep -c "ipv6_dst=ff02::2,nw_ttl=255,icmp_type=133,icmp_code=0"`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9941" "until test 1 = \`as hv1 ovs-ofctl dump-flows br-int | grep -c \"ipv6_dst=ff02::2,nw_ttl=255,icmp_type=133,icmp_code=0\"\`"


# This shell function sends a Router Solicitation packet.
# test_ipv6_ra INPORT SRC_MAC SRC_LLA ADDR_MODE MTU RA_PREFIX_OPT
test_ipv6_ra() {
    local inport=$1 src_mac=$2 src_lla=$3 addr_mode=$4 mtu=$5 prefix_opt=$6
    local request=333300000002${src_mac}86dd6000000000103aff${src_lla}ff02000000000000000000000000000285000efc000000000101${src_mac}

    local len=24
    local mtu_opt=""
    if test $mtu != 0; then
        len=`expr $len + 8`
        mtu_opt=05010000${mtu}
    fi

    if test ${#prefix_opt} != 0; then
        prefix_opt=${prefix_opt}fdad1234567800000000000000000000
        len=`expr $len + ${#prefix_opt} / 2`
    fi

    len=$(printf "%x" $len)
    local lrp_mac=fa163e000001
    local lrp_lla=fe80000000000000f8163efffe000001
    local reply=${src_mac}${lrp_mac}86dd6000000000${len}3aff${lrp_lla}${src_lla}8600XXXXff${addr_mode}ffff00000000000000000101${lrp_mac}${mtu_opt}${prefix_opt}
    echo $reply >> $inport.expected

    as hv1 ovs-appctl netdev-dummy/receive hv1-vif${inport} $request
}


as hv1 ovs-ofctl monitor br-int resume --detach --no-chdir \
--pidfile=ovs-ofctl0.pid 2> ofctl_monitor0.log

# MTU is not set and the address mode is set to slaac
addr_mode=00
default_prefix_option_config=030440c0ffffffffffffffff00000000
src_mac=fa163e000002
src_lla=fe80000000000000f8163efffe000002
test_ipv6_ra 1 $src_mac $src_lla $addr_mode 0 $default_prefix_option_config

# NXT_RESUME should be 1.
ovs_wait_cond () {
    test 1 = `cat ofctl_monitor*.log | grep -c NXT_RESUME`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:9982" "until test 1 = \`cat ofctl_monitor*.log | grep -c NXT_RESUME\`"


$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/vif1-tx.pcap  > 1.packets

cat 1.expected | cut -c -112 > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:9987: cat 1.packets | cut -c -112"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:9987"
( $at_check_trace; cat 1.packets | cut -c -112
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9987"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }


# Skipping the ICMPv6 checksum.
cat 1.expected | cut -c 117- > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:9991: cat 1.packets | cut -c 117-"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:9991"
( $at_check_trace; cat 1.packets | cut -c 117-
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:9991"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }


rm -f *.expected
reset_pcap_file hv1-vif1 hv1/vif1
reset_pcap_file hv1-vif2 hv1/vif2
reset_pcap_file hv1-vif3 hv1/vif3

# Set the MTU to 1500
ovn-nbctl --wait=hv set Logical_Router_Port lrp0 ipv6_ra_configs:mtu=1500

# Make sure that ovn-controller has installed the corresponding OF Flow.
ovs_wait_cond () {
    test 1 = `as hv1 ovs-ofctl dump-flows br-int | grep -c "ipv6_dst=ff02::2,nw_ttl=255,icmp_type=133,icmp_code=0"`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10002" "until test 1 = \`as hv1 ovs-ofctl dump-flows br-int | grep -c \"ipv6_dst=ff02::2,nw_ttl=255,icmp_type=133,icmp_code=0\"\`"


addr_mode=00
default_prefix_option_config=030440c0ffffffffffffffff00000000
src_mac=fa163e000003
src_lla=fe80000000000000f8163efffe000003
mtu=000005dc

test_ipv6_ra 2 $src_mac $src_lla $addr_mode $mtu $default_prefix_option_config

# NXT_RESUME should be 2.
ovs_wait_cond () {
    test 2 = `cat ofctl_monitor*.log | grep -c NXT_RESUME`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10013" "until test 2 = \`cat ofctl_monitor*.log | grep -c NXT_RESUME\`"


$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/vif2-tx.pcap  > 2.packets

cat 2.expected | cut -c -112 > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:10018: cat 2.packets | cut -c -112"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:10018"
( $at_check_trace; cat 2.packets | cut -c -112
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10018"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }


# Skipping the ICMPv6 checksum.
cat 2.expected | cut -c 117- > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:10022: cat 2.packets | cut -c 117-"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:10022"
( $at_check_trace; cat 2.packets | cut -c 117-
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10022"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }


rm -f *.expected
reset_pcap_file hv1-vif1 hv1/vif1
reset_pcap_file hv1-vif2 hv1/vif2
reset_pcap_file hv1-vif3 hv1/vif3

# Set the address mode to dhcpv6_stateful
ovn-nbctl --wait=hv set Logical_Router_Port lrp0 ipv6_ra_configs:address_mode=dhcpv6_stateful
# Make sure that ovn-controller has installed the corresponding OF Flow.
ovs_wait_cond () {
    test 1 = `as hv1 ovs-ofctl dump-flows br-int | grep -c "ipv6_dst=ff02::2,nw_ttl=255,icmp_type=133,icmp_code=0"`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10032" "until test 1 = \`as hv1 ovs-ofctl dump-flows br-int | grep -c \"ipv6_dst=ff02::2,nw_ttl=255,icmp_type=133,icmp_code=0\"\`"


addr_mode=80
default_prefix_option_config=03044080ffffffffffffffff00000000
src_mac=fa163e000004
src_lla=fe80000000000000f8163efffe000004
mtu=000005dc

test_ipv6_ra 3 $src_mac $src_lla $addr_mode $mtu $default_prefix_option_config

# NXT_RESUME should be 3.
ovs_wait_cond () {
    test 3 = `cat ofctl_monitor*.log | grep -c NXT_RESUME`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10043" "until test 3 = \`cat ofctl_monitor*.log | grep -c NXT_RESUME\`"


$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/vif3-tx.pcap  > 3.packets

cat 3.expected | cut -c -112 > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:10048: cat 3.packets | cut -c -112"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:10048"
( $at_check_trace; cat 3.packets | cut -c -112
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10048"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }


# Skipping the ICMPv6 checksum.
cat 3.expected | cut -c 117- > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:10052: cat 3.packets | cut -c 117-"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:10052"
( $at_check_trace; cat 3.packets | cut -c 117-
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10052"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }


rm -f *.expected
reset_pcap_file hv1-vif1 hv1/vif1
reset_pcap_file hv1-vif2 hv1/vif2
reset_pcap_file hv1-vif3 hv1/vif3

# Set the address mode to dhcpv6_stateless
ovn-nbctl --wait=hv set Logical_Router_Port lrp0 ipv6_ra_configs:address_mode=dhcpv6_stateless
# Make sure that ovn-controller has installed the corresponding OF Flow.
ovs_wait_cond () {
    test 1 = `as hv1 ovs-ofctl dump-flows br-int | grep -c "ipv6_dst=ff02::2,nw_ttl=255,icmp_type=133,icmp_code=0"`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10062" "until test 1 = \`as hv1 ovs-ofctl dump-flows br-int | grep -c \"ipv6_dst=ff02::2,nw_ttl=255,icmp_type=133,icmp_code=0\"\`"


addr_mode=40
default_prefix_option_config=030440c0ffffffffffffffff00000000
src_mac=fa163e000002
src_lla=fe80000000000000f8163efffe000002
mtu=000005dc

test_ipv6_ra 1 $src_mac $src_lla $addr_mode $mtu $default_prefix_option_config

# NXT_RESUME should be 4.
ovs_wait_cond () {
    test 4 = `cat ofctl_monitor*.log | grep -c NXT_RESUME`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10073" "until test 4 = \`cat ofctl_monitor*.log | grep -c NXT_RESUME\`"


$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/vif1-tx.pcap  > 1.packets

cat 1.expected | cut -c -112 > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:10078: cat 1.packets | cut -c -112"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:10078"
( $at_check_trace; cat 1.packets | cut -c -112
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10078"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }


# Skipping the ICMPv6 checksum.
cat 1.expected | cut -c 117- > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:10082: cat 1.packets | cut -c 117-"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:10082"
( $at_check_trace; cat 1.packets | cut -c 117-
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10082"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }


rm -f *.expected
reset_pcap_file hv1-vif1 hv1/vif1
reset_pcap_file hv1-vif2 hv1/vif2
reset_pcap_file hv1-vif3 hv1/vif3

# Set the address mode to invalid.
ovn-nbctl --wait=hv set Logical_Router_Port lrp0 ipv6_ra_configs:address_mode=invalid
# Make sure that ovn-controller has not installed any OF Flow for IPv6 ND RA.
ovs_wait_cond () {
    test 0 = `as hv1 ovs-ofctl dump-flows br-int | grep -c "ipv6_dst=ff02::2,nw_ttl=255,icmp_type=133,icmp_code=0"`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10092" "until test 0 = \`as hv1 ovs-ofctl dump-flows br-int | grep -c \"ipv6_dst=ff02::2,nw_ttl=255,icmp_type=133,icmp_code=0\"\`"


addr_mode=40
default_prefix_option_config=""
src_mac=fa163e000002
src_lla=fe80000000000000f8163efffe000002
mtu=000005dc

test_ipv6_ra 1 $src_mac $src_lla $addr_mode $mtu $default_prefix_option_config

# NXT_RESUME should be 4 only.
ovs_wait_cond () {
    test 4 = `cat ofctl_monitor*.log | grep -c NXT_RESUME`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10103" "until test 4 = \`cat ofctl_monitor*.log | grep -c NXT_RESUME\`"


$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/vif1-tx.pcap  > 1.packets
{ set +x
$as_echo "$at_srcdir/ovn.at:10106: cat 1.packets"
at_fn_check_prepare_trace "ovn.at:10106"
( $at_check_trace; cat 1.packets
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10106"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }





    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:10108: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:10108"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10108"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10108: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:10108"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10108"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10108" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:10108: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:10108"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10108"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10108: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:10108"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10108"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10108" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:10108: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:10108"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10108"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10108: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:10108"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10108"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10108" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:10108: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:10108"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10108"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10108: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:10108"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10108"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10108" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:10108: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:10108"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10108"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10108: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:10108"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10108"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10108" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:10108: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:10108"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10108"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10108: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:10108"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10108"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10108" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:10108: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:10108"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10108"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10108: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:10108"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10108"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10108" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:10108: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:10108"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10108"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10108: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:10108"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10108"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10108" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:10108: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:10108"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10108"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10108: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:10108"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10108"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10108" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:10108: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:10108"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10108"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10108: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:10108"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10108"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10108" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:10108: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:10108"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10108"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10108: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:10108"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10108"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10108" "while kill -0 \$TMPPID 2>/dev/null"



ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_81
#AT_START_82
at_fn_group_banner 82 'ovn.at:10111' \
  "ovn -- /32 router IP address" "                   " 2
at_xfail=no
(
  $as_echo "82. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

# Logical network:
# 2 LS 'foo' and 'alice' connected via router R1.
# R1 connects to 'alice' with a /32 IP address. We use static routes and
# nexthop to push traffic to a logical port in switch 'alice'

ovn-nbctl lr-add R1

ovn-nbctl ls-add foo
ovn-nbctl ls-add alice

# Connect foo to R1
ovn-nbctl lrp-add R1 foo 00:00:00:01:02:03 192.168.1.1/24
ovn-nbctl lsp-add foo rp-foo -- set Logical_Switch_Port rp-foo type=router \
          options:router-port=foo addresses=\"00:00:00:01:02:03\"

# Connect alice to R1.
ovn-nbctl lrp-add R1 alice 00:00:00:01:02:04 172.16.1.1/32
ovn-nbctl lsp-add alice rp-alice -- set Logical_Switch_Port rp-alice \
          type=router options:router-port=alice addresses=\"00:00:00:01:02:04\"

# Create logical port foo1 in foo
ovn-nbctl lsp-add foo foo1 \
-- lsp-set-addresses foo1 "f0:00:00:01:02:03 192.168.1.2"

# Create logical port alice1 in alice
ovn-nbctl lsp-add alice alice1 \
-- lsp-set-addresses alice1 "f0:00:00:01:02:04 10.0.0.2"

#install default route in R1 to use alice1's IP address as nexthop
ovn-nbctl lr-route-add R1 0.0.0.0/0 10.0.0.2 alice

# Create two hypervisor and create OVS ports corresponding to logical ports.
net_add n1

sim_add hv1
as hv1
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.1
ovs-vsctl -- add-port br-int hv1-vif1 -- \
    set interface hv1-vif1 external-ids:iface-id=foo1 \
    options:tx_pcap=hv1/vif1-tx.pcap \
    options:rxq_pcap=hv1/vif1-rx.pcap \
    ofport-request=1

sim_add hv2
as hv2
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.2
ovs-vsctl -- add-port br-int hv2-vif1 -- \
    set interface hv2-vif1 external-ids:iface-id=alice1 \
    options:tx_pcap=hv2/vif1-tx.pcap \
    options:rxq_pcap=hv2/vif1-rx.pcap \
    ofport-request=1


# Pre-populate the hypervisors' ARP tables so that we don't lose any
# packets for ARP resolution (native tunneling doesn't queue packets
# for ARP resolution).
{ set +x
$as_echo "$at_srcdir/ovn.at:10172: ovn_populate_arp__"
at_fn_check_prepare_trace "ovn.at:10172"
( $at_check_trace; ovn_populate_arp__
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10172"
$at_failed && at_fn_log_failure
$at_traceon; }


# Allow some time for ovn-northd and ovn-controller to catch up.
# XXX This should be more systematic.
sleep 1

ip_to_hex() {
    printf "%02x%02x%02x%02x" "$@"
}

# Send ip packets between foo1 and alice1
src_mac="f00000010203"
dst_mac="000000010203"
src_ip=`ip_to_hex 192 168 1 2`
dst_ip=`ip_to_hex 10 0 0 2`
packet=${dst_mac}${src_mac}08004500001c0000000040110000${src_ip}${dst_ip}0035111100080000

# Send the first packet to trigger a ARP response and population of
# mac_bindings table.
as hv1 ovs-appctl netdev-dummy/receive hv1-vif1 $packet
ovs_wait_cond () {
    test `ovn-sbctl find mac_binding ip="10.0.0.2" | wc -l` -gt 0
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10192" "until test \`ovn-sbctl find mac_binding ip=\"10.0.0.2\" | wc -l\` -gt 0"

ovn-nbctl --wait=hv sync

# Packet to Expect at 'alice1'
src_mac="000000010204"
dst_mac="f00000010204"
src_ip=`ip_to_hex 192 168 1 2`
dst_ip=`ip_to_hex 10 0 0 2`
echo "${dst_mac}${src_mac}08004500001c000000003f110100${src_ip}${dst_ip}0035111100080000" > expected

ovn_check_packets__ "hv2/vif1-tx.pcap" "expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:10202: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:10202"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10202"
$at_failed && at_fn_log_failure
$at_traceon; }





    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:10204: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:10204"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10204"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10204: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:10204"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10204"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10204" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:10204: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:10204"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10204"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10204: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:10204"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10204"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10204" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:10204: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:10204"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10204"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10204: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:10204"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10204"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10204" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:10204: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:10204"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10204"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10204: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:10204"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10204"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10204" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:10204: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:10204"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10204"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10204: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:10204"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10204"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10204" "while kill -0 \$TMPPID 2>/dev/null"





    as hv2
    if test "hv2" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:10204: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:10204"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10204"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10204: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:10204"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10204"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10204" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:10204: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:10204"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10204"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10204: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:10204"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10204"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10204" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:10204: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:10204"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10204"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10204: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:10204"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10204"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10204" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv2
    { set +x
$as_echo "$at_srcdir/ovn.at:10204: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:10204"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10204"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10204: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:10204"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10204"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10204" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:10204: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:10204"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10204"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10204: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:10204"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10204"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10204" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:10204: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:10204"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10204"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10204: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:10204"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10204"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10204" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:10204: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:10204"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10204"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10204: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:10204"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10204"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10204" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:10204: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:10204"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10204"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10204: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:10204"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10204"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10204" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:10204: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:10204"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10204"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10204: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:10204"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10204"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10204" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:10204: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:10204"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10204"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10204: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:10204"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10204"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10204" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:10204: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:10204"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10204"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10204: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:10204"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10204"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10204" "while kill -0 \$TMPPID 2>/dev/null"




ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_82
#AT_START_83
at_fn_group_banner 83 'ovn.at:10208' \
  "ovn -- 2 HVs, 1 lport/HV, localport ports" "      " 2
at_xfail=no
(
  $as_echo "83. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

ovn-nbctl ls-add ls1

# Add localport to the switch
ovn-nbctl lsp-add ls1 lp01
ovn-nbctl lsp-set-addresses lp01 f0:00:00:00:00:01
ovn-nbctl lsp-set-type lp01 localport

net_add n1

for i in 1 2; do
    sim_add hv$i
    as hv$i
    ovs-vsctl add-br br-phys
    ovn_attach n1 br-phys 192.168.0.$i
    ovs-vsctl add-port br-int vif01 -- \
        set Interface vif01 external-ids:iface-id=lp01 \
                              options:tx_pcap=hv${i}/vif01-tx.pcap \
                              options:rxq_pcap=hv${i}/vif01-rx.pcap \
                              ofport-request=${i}0

    ovs-vsctl add-port br-int vif${i}1 -- \
        set Interface vif${i}1 external-ids:iface-id=lp${i}1 \
                              options:tx_pcap=hv${i}/vif${i}1-tx.pcap \
                              options:rxq_pcap=hv${i}/vif${i}1-rx.pcap \
                              ofport-request=${i}1

    ovn-nbctl lsp-add ls1 lp${i}1
    ovn-nbctl lsp-set-addresses lp${i}1 f0:00:00:00:00:${i}1
    ovn-nbctl lsp-set-port-security lp${i}1 f0:00:00:00:00:${i}1

        ovs_wait_cond () {
    test x`ovn-nbctl lsp-get-up lp${i}1` = xup
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10241" "until test x\`ovn-nbctl lsp-get-up lp\${i}1\` = xup"

done

ovn-nbctl --wait=sb sync
ovn-sbctl dump-flows

{ set +x
$as_echo "$at_srcdir/ovn.at:10247: ovn_populate_arp__"
at_fn_check_prepare_trace "ovn.at:10247"
( $at_check_trace; ovn_populate_arp__
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10247"
$at_failed && at_fn_log_failure
$at_traceon; }


# Given the name of a logical port, prints the name of the hypervisor
# on which it is located.
vif_to_hv() {
    echo hv${1%?}
}
#
# test_packet INPORT DST SRC ETHTYPE EOUT LOUT DEFHV
#
# This shell function causes a packet to be received on INPORT.  The packet's
# content has Ethernet destination DST and source SRC (each exactly 12 hex
# digits) and Ethernet type ETHTYPE (4 hex digits).  INPORT is specified as
# logical switch port numbers, e.g. 11 for vif11.
#
# EOUT is the end-to-end output port, that is, where the packet will end up
# after possibly bouncing through one or more localnet ports.  LOUT is the
# logical output port, which might be a localnet port, as seen by ovn-trace
# (which doesn't know what localnet ports are connected to and therefore can't
# figure out the end-to-end answer).
#
# DEFHV is the default hypervisor from where the packet is going to be sent
# if the source port is a localport.
for i in 1 2; do
    for j in 0 1; do
        : > $i$j.expected
    done
done
test_packet() {
    local inport=$1 dst=$2 src=$3 eth=$4 eout=$5 lout=$6 defhv=$7
    echo "$@"

    # First try tracing the packet.
    uflow="inport==\"lp$inport\" && eth.dst==$dst && eth.src==$src && eth.type==0x$eth"
    if test $lout != drop; then
        echo "output(\"$lout\");"
    fi > expout

    { set +x
$as_echo "$at_srcdir/ovn.at:10285: ovn-trace --all ls1 \"\$uflow\" | tee trace | sed '1,/Minimal trace/d'"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:10285"
( $at_check_trace; ovn-trace --all ls1 "$uflow" | tee trace | sed '1,/Minimal trace/d'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10285"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }


    # Then actually send a packet, for an end-to-end test.
    local packet=$(echo $dst$src | sed 's/://g')${eth}
    hv=`vif_to_hv $inport`
    # If hypervisor 0 (localport) use the defhv parameter
    if test $hv = hv0; then
        hv=$defhv
    fi
    vif=vif$inport
    as $hv ovs-appctl netdev-dummy/receive $vif $packet
    if test $eout != drop; then
        echo $packet >> ${eout#lp}.expected
    fi
}


# lp11 and lp21 are on different hypervisors
test_packet 11 f0:00:00:00:00:21 f0:00:00:00:00:11 1121 lp21 lp21
test_packet 21 f0:00:00:00:00:11 f0:00:00:00:00:21 2111 lp11 lp11

# Both VIFs should be able to reach the localport on their own HV
test_packet 11 f0:00:00:00:00:01 f0:00:00:00:00:11 1101 lp01 lp01
test_packet 21 f0:00:00:00:00:01 f0:00:00:00:00:21 2101 lp01 lp01

# Packet sent from localport on same hv should reach the vif
test_packet 01 f0:00:00:00:00:11 f0:00:00:00:00:01 0111 lp11 lp11 hv1
test_packet 01 f0:00:00:00:00:21 f0:00:00:00:00:01 0121 lp21 lp21 hv2

# Packet sent from localport on different hv should be dropped
test_packet 01 f0:00:00:00:00:21 f0:00:00:00:00:01 0121 drop lp21 hv1
test_packet 01 f0:00:00:00:00:11 f0:00:00:00:00:01 0111 drop lp11 hv2

# Now check the packets actually received against the ones expected.
for i in 1 2; do
    for j in 0 1; do
        ovn_check_packets__ "hv$i/vif$i$j-tx.pcap" "$i$j.expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:10321: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:10321"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10321"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

    done
done




    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:10325: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:10325"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10325"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10325: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:10325"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10325"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10325" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:10325: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:10325"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10325"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10325: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:10325"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10325"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10325" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:10325: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:10325"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10325"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10325: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:10325"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10325"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10325" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:10325: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:10325"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10325"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10325: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:10325"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10325"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10325" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:10325: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:10325"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10325"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10325: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:10325"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10325"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10325" "while kill -0 \$TMPPID 2>/dev/null"





    as hv2
    if test "hv2" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:10325: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:10325"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10325"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10325: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:10325"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10325"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10325" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:10325: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:10325"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10325"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10325: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:10325"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10325"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10325" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:10325: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:10325"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10325"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10325: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:10325"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10325"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10325" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv2
    { set +x
$as_echo "$at_srcdir/ovn.at:10325: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:10325"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10325"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10325: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:10325"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10325"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10325" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:10325: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:10325"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10325"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10325: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:10325"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10325"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10325" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:10325: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:10325"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10325"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10325: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:10325"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10325"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10325" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:10325: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:10325"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10325"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10325: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:10325"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10325"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10325" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:10325: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:10325"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10325"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10325: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:10325"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10325"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10325" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:10325: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:10325"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10325"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10325: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:10325"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10325"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10325" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:10325: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:10325"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10325"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10325: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:10325"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10325"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10325" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:10325: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:10325"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10325"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10325: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:10325"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10325"
$at_failed && at_fn_log_failure  \
"trace"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10325" "while kill -0 \$TMPPID 2>/dev/null"




ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_83
#AT_START_84
at_fn_group_banner 84 'ovn.at:10329' \
  "ovn -- 1 LR with HA distributed router gateway port" "" 2
at_xfail=no
(
  $as_echo "84. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

net_add n1

# create gateways with external network connectivity

for i in 1 2; do
    sim_add gw$i
    as gw$i
    ovs-vsctl add-br br-phys
    ovn_attach n1 br-phys 192.168.0.$i
    ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys
done

ovn-nbctl ls-add inside
ovn-nbctl ls-add outside

# create hypervisors with a vif port each to an internal network

for i in 1 2; do
    sim_add hv$i
    as hv$i
    ovs-vsctl add-br br-phys
    ovn_attach n1 br-phys 192.168.0.1$i
    ovs-vsctl -- add-port br-int hv$i-vif1 -- \
        set interface hv$i-vif1 external-ids:iface-id=inside$i \
        options:tx_pcap=hv$i/vif1-tx.pcap \
        options:rxq_pcap=hv$i/vif1-rx.pcap \
        ofport-request=1

        ovn-nbctl lsp-add inside inside$i \
            -- lsp-set-addresses inside$i "f0:00:00:01:22:$i 192.168.1.10$i"

done

{ set +x
$as_echo "$at_srcdir/ovn.at:10365: ovn_populate_arp__"
at_fn_check_prepare_trace "ovn.at:10365"
( $at_check_trace; ovn_populate_arp__
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10365"
$at_failed && at_fn_log_failure
$at_traceon; }


ovn-nbctl create Logical_Router name=R1

# Connect inside to R1
ovn-nbctl lrp-add R1 inside 00:00:01:01:02:03 192.168.1.1/24
ovn-nbctl lsp-add inside rp-inside -- set Logical_Switch_Port rp-inside \
    type=router options:router-port=inside \
    -- lsp-set-addresses rp-inside router

# Connect outside to R1 as distributed router gateway port on gw1+gw2
ovn-nbctl lrp-add R1 outside 00:00:02:01:02:04 192.168.0.101/24

ovn-nbctl --id=@gc0 create Gateway_Chassis \
                    name=outside_gw1 chassis_name=gw1 priority=20 -- \
          --id=@gc1 create Gateway_Chassis \
                    name=outside_gw2 chassis_name=gw2 priority=10 -- \
          set Logical_Router_Port outside 'gateway_chassis=@gc0,@gc1'

ovn-nbctl lsp-add outside rp-outside -- set Logical_Switch_Port rp-outside \
    type=router options:router-port=outside \
    -- lsp-set-addresses rp-outside router

# Create localnet port in outside
ovn-nbctl lsp-add outside ln-outside
ovn-nbctl lsp-set-addresses ln-outside unknown
ovn-nbctl lsp-set-type ln-outside localnet
ovn-nbctl lsp-set-options ln-outside network_name=phys

# Allow some time for ovn-northd and ovn-controller to catch up.
# XXX This should be more systematic.
ovn-nbctl --wait=hv --timeout=3 sync

echo "---------NB dump-----"
ovn-nbctl show
echo "---------------------"
ovn-nbctl list logical_router
echo "---------------------"
ovn-nbctl list logical_router_port
echo "---------------------"

echo "---------SB dump-----"
ovn-sbctl list datapath_binding
echo "---------------------"
ovn-sbctl list port_binding
echo "---------------------"
ovn-sbctl dump-flows
echo "---------------------"
ovn-sbctl list chassis
ovn-sbctl list encap
echo "---------------------"
echo "------ Gateway_Chassis dump (SBDB) -------"
ovn-sbctl list Gateway_Chassis
echo "------ Port_Binding chassisredirect -------"
ovn-sbctl find Port_Binding type=chassisredirect
echo "-------------------------------------------"

# There should be one ha_chassis_group with the name "outside"
ha_chassi_grp_name=`ovn-sbctl --bare --columns name find \
ha_chassis_group name="outside"`

{ set +x
$as_echo "$at_srcdir/ovn.at:10426: test \$ha_chassi_grp_name = outside"
at_fn_check_prepare_dynamic "test $ha_chassi_grp_name = outside" "ovn.at:10426"
( $at_check_trace; test $ha_chassi_grp_name = outside
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10426"
$at_failed && at_fn_log_failure
$at_traceon; }


# There should be 2 ha_chassis rows in SB DB.
{ set +x
$as_echo "$at_srcdir/ovn.at:10429: ovn-sbctl list ha_chassis | grep chassis | \\
grep -v chassis-name | awk '{print \$3}' \\
| grep '-' | wc -l "
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:10429"
( $at_check_trace; ovn-sbctl list ha_chassis | grep chassis | \
grep -v chassis-name | awk '{print $3}' \
| grep '-' | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "2
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10429"
$at_failed && at_fn_log_failure
$at_traceon; }


ha_ch=`ovn-sbctl --bare --columns ha_chassis  find ha_chassis_group`
# Trim the spaces.
ha_ch=`echo $ha_ch | sed 's/ //g'`

ha_ch_list=''
for i in `ovn-sbctl --bare --columns _uuid list ha_chassis | sort`
do
    ha_ch_list="$ha_ch_list $i"
done

# Trim the spaces.
ha_ch_list=`echo $ha_ch_list | sed 's/ //g'`

{ set +x
$as_echo "$at_srcdir/ovn.at:10447: test \"\$ha_ch_list\" = \"\$ha_ch\""
at_fn_check_prepare_dynamic "test \"$ha_ch_list\" = \"$ha_ch\"" "ovn.at:10447"
( $at_check_trace; test "$ha_ch_list" = "$ha_ch"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10447"
$at_failed && at_fn_log_failure
$at_traceon; }


for chassis in gw1 gw2 hv1 hv2; do
    as $chassis
    echo "------ $chassis dump ----------"
    ovs-ofctl show br-int
    ovs-ofctl dump-flows br-int
    echo "--------------------------"
done
bfd_dump() {
    for chassis in gw1 gw2 hv1 hv2; do
        as $chassis
        echo "------ $chassis dump (BFD)----"
        echo "BFD (from $chassis):"
        # dump BFD config and status to the other chassis
        for chassis2 in gw1 gw2 hv1 hv2; do
            if [ "$chassis" != "$chassis2" ]; then
                echo " -> $chassis2:"
                echo "   $(ovs-vsctl --bare --columns bfd,bfd_status find Interface name=ovn-$chassis2-0)"
            fi
        done
        echo "--------------------------"
    done
}

bfd_dump

hv1_gw1_ofport=$(as hv1 ovs-vsctl --bare --columns ofport find Interface name=ovn-gw1-0)
hv1_gw2_ofport=$(as hv1 ovs-vsctl --bare --columns ofport find Interface name=ovn-gw2-0)
hv2_gw1_ofport=$(as hv2 ovs-vsctl --bare --columns ofport find Interface name=ovn-gw1-0)
hv2_gw2_ofport=$(as hv2 ovs-vsctl --bare --columns ofport find Interface name=ovn-gw2-0)

echo $hv1_gw1_ofport
echo $hv1_gw2_ofport
echo $hv2_gw1_ofport
echo $hv2_gw2_ofport

echo "--- hv1 ---"
as hv1 ovs-ofctl dump-flows br-int table=32

echo "--- hv2 ---"
as hv2 ovs-ofctl dump-flows br-int table=32

gw1_chassis=$(ovn-sbctl --bare --columns=_uuid find Chassis name=gw1)
gw2_chassis=$(ovn-sbctl --bare --columns=_uuid find Chassis name=gw2)

ovs_wait_cond () {
    as hv1 ovs-ofctl dump-flows br-int table=32 | \
grep active_backup | grep slaves:$hv1_gw1_ofport,$hv1_gw2_ofport \
| wc -l
}
ovs_wait_failed () {
    :
    0
}
ovs_wait "ovn.at:10493" "until as hv1 ovs-ofctl dump-flows br-int table=32 | \\
grep active_backup | grep slaves:\$hv1_gw1_ofport,\$hv1_gw2_ofport \\
| wc -l"


ovs_wait_cond () {
    as hv2 ovs-ofctl dump-flows br-int table=32 | \
grep active_backup | grep slaves:$hv2_gw1_ofport,$hv2_gw2_ofport \
| wc -l
}
ovs_wait_failed () {
    :
    0
}
ovs_wait "ovn.at:10498" "until as hv2 ovs-ofctl dump-flows br-int table=32 | \\
grep active_backup | grep slaves:\$hv2_gw1_ofport,\$hv2_gw2_ofport \\
| wc -l"


# make sure that flows for handling the outside router port reside on gw1
ovs_wait_cond () {
    as gw1 ovs-ofctl dump-flows br-int table=25 | \
grep 00:00:02:01:02:04 | wc -l
}
ovs_wait_failed () {
    :
    0
}
ovs_wait "ovn.at:10504" "until as gw1 ovs-ofctl dump-flows br-int table=25 | \\
grep 00:00:02:01:02:04 | wc -l"

ovs_wait_cond () {
    as gw2 ovs-ofctl dump-flows br-int table=25 | \
grep 00:00:02:01:02:04 | wc -l
}
ovs_wait_failed () {
    :
    0
}
ovs_wait "ovn.at:10507" "until as gw2 ovs-ofctl dump-flows br-int table=25 | \\
grep 00:00:02:01:02:04 | wc -l"


# make sure ARP responder flows for outside router port reside on gw1 too
ovs_wait_cond () {
    as gw1 ovs-ofctl dump-flows br-int table=9 | \
grep arp_tpa=192.168.0.101 | wc -l
}
ovs_wait_failed () {
    :
    0
}
ovs_wait "ovn.at:10512" "until as gw1 ovs-ofctl dump-flows br-int table=9 | \\
grep arp_tpa=192.168.0.101 | wc -l"

ovs_wait_cond () {
    as gw2 ovs-ofctl dump-flows br-int table=9 | grep arp_tpa=192.168.0.101 | wc -l
}
ovs_wait_failed () {
    :
    0
}
ovs_wait "ovn.at:10515" "until as gw2 ovs-ofctl dump-flows br-int table=9 | grep arp_tpa=192.168.0.101 | wc -l"


# check that the chassis redirect port has been claimed by the gw1 chassis
ovs_wait_cond () {
    ovn-sbctl --columns chassis --bare find Port_Binding \
logical_port=cr-outside | grep $gw1_chassis | wc -l
}
ovs_wait_failed () {
    :
    0
}
ovs_wait "ovn.at:10519" "until ovn-sbctl --columns chassis --bare find Port_Binding \\
logical_port=cr-outside | grep \$gw1_chassis | wc -l"


hv1_ch_uuid=`ovn-sbctl --bare --columns _uuid find chassis name="hv1"`
hv2_ch_uuid=`ovn-sbctl --bare --columns _uuid find chassis name="hv2"`

exp_ref_ch_list=''
for i in `ovn-sbctl --bare --columns _uuid list chassis | sort`
do
    if test $i = $hv1_ch_uuid; then
        exp_ref_ch_list="${exp_ref_ch_list}$i"
    elif test $i = $hv2_ch_uuid; then
        exp_ref_ch_list="${exp_ref_ch_list}$i"
    fi
done

ovs_wait_cond () {
    ref_ch_list=`ovn-sbctl --bare --columns ref_chassis find ha_chassis_group | sort`
     # Trim the spaces.
     ref_ch_list=`echo $ref_ch_list | sed 's/ //g'`
     test "$exp_ref_ch_list" = "$ref_ch_list"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10536" "until ref_ch_list=\`ovn-sbctl --bare --columns ref_chassis find ha_chassis_group | sort\`
     # Trim the spaces.
     ref_ch_list=\`echo \$ref_ch_list | sed 's/ //g'\`
     test \"\$exp_ref_ch_list\" = \"\$ref_ch_list\""



# at this point, we invert the priority of the gw chassis between gw1 and gw2

ovn-nbctl --id=@gc0 create Gateway_Chassis \
                    name=outside_gw1 chassis_name=gw1 priority=10 -- \
          --id=@gc1 create Gateway_Chassis \
                    name=outside_gw2 chassis_name=gw2 priority=20 -- \
          set Logical_Router_Port outside 'gateway_chassis=@gc0,@gc1'


# XXX: Let the change propagate down to the ovn-controllers
ovn-nbctl --wait=hv --timeout=3 sync

# we make sure that the hypervisors noticed, and inverted the slave ports
ovs_wait_cond () {
    as hv1 ovs-ofctl dump-flows br-int table=32 | \
grep active_backup | grep slaves:$hv1_gw2_ofport,$hv1_gw1_ofport \
| wc -l
}
ovs_wait_failed () {
    :
    0
}
ovs_wait "ovn.at:10556" "until as hv1 ovs-ofctl dump-flows br-int table=32 | \\
grep active_backup | grep slaves:\$hv1_gw2_ofport,\$hv1_gw1_ofport \\
| wc -l"


ovs_wait_cond () {
    as hv2 ovs-ofctl dump-flows br-int table=32 | \
grep active_backup | grep slaves:$hv2_gw2_ofport,$hv2_gw1_ofport \
| wc -l
}
ovs_wait_failed () {
    :
    0
}
ovs_wait "ovn.at:10561" "until as hv2 ovs-ofctl dump-flows br-int table=32 | \\
grep active_backup | grep slaves:\$hv2_gw2_ofport,\$hv2_gw1_ofport \\
| wc -l"


# check that the chassis redirect port has been reclaimed by the gw2 chassis
ovs_wait_cond () {
    ovn-sbctl --columns chassis --bare find Port_Binding \
logical_port=cr-outside | grep $gw2_chassis | wc -l
}
ovs_wait_failed () {
    :
    0
}
ovs_wait "ovn.at:10567" "until ovn-sbctl --columns chassis --bare find Port_Binding \\
logical_port=cr-outside | grep \$gw2_chassis | wc -l"


# check BFD enablement on tunnel ports from gw1 #########
as gw1
for chassis in gw2 hv1 hv2; do
    echo "checking gw1 -> $chassis"
    { set +x
$as_echo "$at_srcdir/ovn.at:10575: ovs-vsctl --bare --columns bfd find Interface name=ovn-\$chassis-0"
at_fn_check_prepare_dynamic "ovs-vsctl --bare --columns bfd find Interface name=ovn-$chassis-0" "ovn.at:10575"
( $at_check_trace; ovs-vsctl --bare --columns bfd find Interface name=ovn-$chassis-0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "enable=true
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10575"
$at_failed && at_fn_log_failure
$at_traceon; }

done


# check BFD enablement on tunnel ports from gw2 ##########
as gw2
for chassis in gw1 hv1 hv2; do
    echo "checking gw2 -> $chassis"
    { set +x
$as_echo "$at_srcdir/ovn.at:10585: ovs-vsctl --bare --columns bfd find Interface name=ovn-\$chassis-0"
at_fn_check_prepare_dynamic "ovs-vsctl --bare --columns bfd find Interface name=ovn-$chassis-0" "ovn.at:10585"
( $at_check_trace; ovs-vsctl --bare --columns bfd find Interface name=ovn-$chassis-0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "enable=true
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10585"
$at_failed && at_fn_log_failure
$at_traceon; }

done

# check BFD enablement on tunnel ports from hv1 ###########
as hv1
for chassis in gw1 gw2; do
    echo "checking hv1 -> $chassis"
    { set +x
$as_echo "$at_srcdir/ovn.at:10594: ovs-vsctl --bare --columns bfd find Interface name=ovn-\$chassis-0"
at_fn_check_prepare_dynamic "ovs-vsctl --bare --columns bfd find Interface name=ovn-$chassis-0" "ovn.at:10594"
( $at_check_trace; ovs-vsctl --bare --columns bfd find Interface name=ovn-$chassis-0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "enable=true
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10594"
$at_failed && at_fn_log_failure
$at_traceon; }

done
# make sure BFD is not enabled to hv2, we don't need it
{ set +x
$as_echo "$at_srcdir/ovn.at:10599: ovs-vsctl --bare --columns bfd find Interface name=ovn-hv2-0"
at_fn_check_prepare_trace "ovn.at:10599"
( $at_check_trace; ovs-vsctl --bare --columns bfd find Interface name=ovn-hv2-0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10599"
$at_failed && at_fn_log_failure
$at_traceon; }



# check BFD enablement on tunnel ports from hv2 ##########
as hv2
for chassis in gw1 gw2; do
    echo "checking hv2 -> $chassis"
    { set +x
$as_echo "$at_srcdir/ovn.at:10608: ovs-vsctl --bare --columns bfd find Interface name=ovn-\$chassis-0"
at_fn_check_prepare_dynamic "ovs-vsctl --bare --columns bfd find Interface name=ovn-$chassis-0" "ovn.at:10608"
( $at_check_trace; ovs-vsctl --bare --columns bfd find Interface name=ovn-$chassis-0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "enable=true
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10608"
$at_failed && at_fn_log_failure
$at_traceon; }

done
# make sure BFD is not enabled to hv1, we don't need it
{ set +x
$as_echo "$at_srcdir/ovn.at:10613: ovs-vsctl --bare --columns bfd find Interface name=ovn-hv1-0"
at_fn_check_prepare_trace "ovn.at:10613"
( $at_check_trace; ovs-vsctl --bare --columns bfd find Interface name=ovn-hv1-0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10613"
$at_failed && at_fn_log_failure
$at_traceon; }


# make sure that flows for handling the outside router port reside on gw2 now
ovs_wait_cond () {
    as gw2 ovs-ofctl dump-flows br-int table=25 | \
grep 00:00:02:01:02:04 | wc -l
}
ovs_wait_failed () {
    :
    0
}
ovs_wait "ovn.at:10618" "until as gw2 ovs-ofctl dump-flows br-int table=25 | \\
grep 00:00:02:01:02:04 | wc -l"

ovs_wait_cond () {
    as gw1 ovs-ofctl dump-flows br-int table=25 | \
grep 00:00:02:01:02:04 | wc -l
}
ovs_wait_failed () {
    :
    0
}
ovs_wait "ovn.at:10621" "until as gw1 ovs-ofctl dump-flows br-int table=25 | \\
grep 00:00:02:01:02:04 | wc -l"


# disconnect GW2 from the network, GW1 should take over
as gw2
port=${sandbox}_br-phys
as main ovs-vsctl del-port n1 $port

bfd_dump

# make sure that flows for handling the outside router port reside on gw2 now
ovs_wait_cond () {
    as gw1 ovs-ofctl dump-flows br-int table=25 | \
grep 00:00:02:01:02:04 | wc -l
}
ovs_wait_failed () {
    :
    0
}
ovs_wait "ovn.at:10633" "until as gw1 ovs-ofctl dump-flows br-int table=25 | \\
grep 00:00:02:01:02:04 | wc -l"

ovs_wait_cond () {
    as gw2 ovs-ofctl dump-flows br-int table=25 | \
grep 00:00:02:01:02:04 | wc -l
}
ovs_wait_failed () {
    :
    0
}
ovs_wait "ovn.at:10636" "until as gw2 ovs-ofctl dump-flows br-int table=25 | \\
grep 00:00:02:01:02:04 | wc -l"


# check that the chassis redirect port has been reclaimed by the gw1 chassis
ovs_wait_cond () {
    ovn-sbctl --columns chassis --bare find Port_Binding \
logical_port=cr-outside | grep $gw1_chassis | wc -l
}
ovs_wait_failed () {
    :
    0
}
ovs_wait "ovn.at:10641" "until ovn-sbctl --columns chassis --bare find Port_Binding \\
logical_port=cr-outside | grep \$gw1_chassis | wc -l"


ovn-nbctl --wait=hv set NB_Global . options:"bfd-min-rx"=2000
as gw2
for chassis in gw1 hv1 hv2; do
    echo "checking gw2 -> $chassis"
    ovs_wait_cond () {

    bfd_cfg=$(ovs-vsctl --bare --columns bfd find Interface name=ovn-$chassis-0)
    test "$bfd_cfg" = "enable=true min_rx=2000"

}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10649" "until
    bfd_cfg=\$(ovs-vsctl --bare --columns bfd find Interface name=ovn-\$chassis-0)
    test \"\$bfd_cfg\" = \"enable=true min_rx=2000\"
"

done
ovn-nbctl --wait=hv set NB_Global . options:"bfd-min-tx"=1500
for chassis in gw1 hv1 hv2; do
    echo "checking gw2 -> $chassis"
    ovs_wait_cond () {

    bfd_cfg=$(ovs-vsctl --bare --columns bfd find Interface name=ovn-$chassis-0)
    test "$bfd_cfg" = "enable=true min_rx=2000 min_tx=1500"

}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10657" "until
    bfd_cfg=\$(ovs-vsctl --bare --columns bfd find Interface name=ovn-\$chassis-0)
    test \"\$bfd_cfg\" = \"enable=true min_rx=2000 min_tx=1500\"
"

done
ovn-nbctl remove NB_Global . options "bfd-min-rx"
ovn-nbctl --wait=hv set NB_Global . options:"bfd-mult"=5
for chassis in gw1 hv1 hv2; do
    echo "checking gw2 -> $chassis"
    ovs_wait_cond () {

    bfd_cfg=$(ovs-vsctl --bare --columns bfd find Interface name=ovn-$chassis-0)
    test "$bfd_cfg" = "enable=true min_tx=1500 mult=5"

}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10666" "until
    bfd_cfg=\$(ovs-vsctl --bare --columns bfd find Interface name=ovn-\$chassis-0)
    test \"\$bfd_cfg\" = \"enable=true min_tx=1500 mult=5\"
"

done

# Delete the inside1 vif. The ref_chassis in ha_chassis_group shouldn't have
# reference to hv1.
as hv1 ovs-vsctl del-port hv1-vif1

ovs_wait_cond () {
    ref_ch_list=`ovn-sbctl --bare --columns ref_chassis find ha_chassis_group | sort`
     # Trim the spaces.
     ref_ch_list=`echo $ref_ch_list | sed 's/ //g'`
     test "$hv2_ch_uuid" = "$ref_ch_list"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10676" "until ref_ch_list=\`ovn-sbctl --bare --columns ref_chassis find ha_chassis_group | sort\`
     # Trim the spaces.
     ref_ch_list=\`echo \$ref_ch_list | sed 's/ //g'\`
     test \"\$hv2_ch_uuid\" = \"\$ref_ch_list\""


# Delete the inside2 vif.
ovn-sbctl show

echo "Deleting hv2-vif1"
as hv2 ovs-vsctl del-port hv2-vif1

# ref_chassis of ha_chassis_group should be empty
ovs_wait_cond () {
    ref_ch_list=`ovn-sbctl --bare --columns ref_chassis find ha_chassis_group | sort`
     # Trim the spaces.
     ref_ch_list=`echo $ref_ch_list | sed 's/ //g'`
     exp_ref_ch_list=""
     test "$exp_ref_ch_list" = "$ref_ch_list"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10689" "until ref_ch_list=\`ovn-sbctl --bare --columns ref_chassis find ha_chassis_group | sort\`
     # Trim the spaces.
     ref_ch_list=\`echo \$ref_ch_list | sed 's/ //g'\`
     exp_ref_ch_list=\"\"
     test \"\$exp_ref_ch_list\" = \"\$ref_ch_list\""


# Delete the Gateway_Chassis for lrp - outside
ovn-nbctl clear Logical_Router_Port outside gateway_chassis

# There shoud be no ha_chassis_group rows in SB DB.
ovs_wait_cond () {
    test 0 = `ovn-sbctl list ha_chassis_group | wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10700" "until test 0 = \`ovn-sbctl list ha_chassis_group | wc -l\`"

ovs_wait_cond () {
    test 0 = `ovn-sbctl list ha_chassis | wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10701" "until test 0 = \`ovn-sbctl list ha_chassis | wc -l\`"


ovn-nbctl remove NB_Global . options "bfd-min-rx"
ovn-nbctl remove NB_Global . options "bfd-min-tx"
ovn-nbctl remove NB_Global . options "bfd-mult"

# Now test with HA chassis group instead of Gateway chassis in NB DB
ovn-nbctl --wait=sb ha-chassis-group-add hagrp1

ovn-nbctl list ha_chassis_group
ovn-nbctl --bare --columns _uuid find ha_chassis_group name=hagrp1
hagrp1_uuid=`ovn-nbctl --bare --columns _uuid find ha_chassis_group name=hagrp1`
ovn-nbctl --wait=sb ha-chassis-group-add-chassis hagrp1 gw1 30
ovn-nbctl --wait=sb ha-chassis-group-add-chassis hagrp1 gw2 20

# ovn-northd should not create HA chassis group and HA chassis rows
# unless the HA chassis group in OVN NB DB is associated to
# a logical router port.
ovs_wait_cond () {
    test 0 = `ovn-sbctl list ha_chassis | wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10719" "until test 0 = \`ovn-sbctl list ha_chassis | wc -l\`"


# Associate hagrp1 to outside logical router port
ovn-nbctl set Logical_Router_Port outside ha_chassis_group=$hagrp1_uuid

ovs_wait_cond () {
    test 1 = `ovn-sbctl --bare --columns _uuid \
find ha_chassis_group | wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10724" "until test 1 = \`ovn-sbctl --bare --columns _uuid \\
find ha_chassis_group | wc -l\`"


ovs_wait_cond () {
    test 2 = `ovn-sbctl list ha_chassis | grep chassis | \
grep -v chassis-name | wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10727" "until test 2 = \`ovn-sbctl list ha_chassis | grep chassis | \\
grep -v chassis-name | wc -l\`"


ovs_wait_cond () {
    as hv1 ovs-ofctl dump-flows br-int table=32 | \
grep active_backup | grep slaves:$hv1_gw1_ofport,$hv1_gw2_ofport \
| wc -l
}
ovs_wait_failed () {
    :
    0
}
ovs_wait "ovn.at:10730" "until as hv1 ovs-ofctl dump-flows br-int table=32 | \\
grep active_backup | grep slaves:\$hv1_gw1_ofport,\$hv1_gw2_ofport \\
| wc -l"


ovs_wait_cond () {
    as hv2 ovs-ofctl dump-flows br-int table=32 | \
grep active_backup | grep slaves:$hv2_gw1_ofport,$hv2_gw2_ofport \
| wc -l
}
ovs_wait_failed () {
    :
    0
}
ovs_wait "ovn.at:10735" "until as hv2 ovs-ofctl dump-flows br-int table=32 | \\
grep active_backup | grep slaves:\$hv2_gw1_ofport,\$hv2_gw2_ofport \\
| wc -l"


# make sure that flows for handling the outside router port reside on gw1
ovs_wait_cond () {
    as gw1 ovs-ofctl dump-flows br-int table=24 | \
grep 00:00:02:01:02:04 | wc -l
}
ovs_wait_failed () {
    :
    0
}
ovs_wait "ovn.at:10741" "until as gw1 ovs-ofctl dump-flows br-int table=24 | \\
grep 00:00:02:01:02:04 | wc -l"

ovs_wait_cond () {
    as gw2 ovs-ofctl dump-flows br-int table=24 | \
grep 00:00:02:01:02:04 | wc -l
}
ovs_wait_failed () {
    :
    0
}
ovs_wait "ovn.at:10744" "until as gw2 ovs-ofctl dump-flows br-int table=24 | \\
grep 00:00:02:01:02:04 | wc -l"


# make sure ARP responder flows for outside router port reside on gw1 too
ovs_wait_cond () {
    as gw1 ovs-ofctl dump-flows br-int table=9 | \
grep arp_tpa=192.168.0.101 | wc -l
}
ovs_wait_failed () {
    :
    0
}
ovs_wait "ovn.at:10749" "until as gw1 ovs-ofctl dump-flows br-int table=9 | \\
grep arp_tpa=192.168.0.101 | wc -l"

ovs_wait_cond () {
    as gw2 ovs-ofctl dump-flows br-int table=9 | grep arp_tpa=192.168.0.101 | wc -l
}
ovs_wait_failed () {
    :
    0
}
ovs_wait "ovn.at:10752" "until as gw2 ovs-ofctl dump-flows br-int table=9 | grep arp_tpa=192.168.0.101 | wc -l"


# check that the chassis redirect port has been claimed by the gw1 chassis
ovs_wait_cond () {
    ovn-sbctl --columns chassis --bare find Port_Binding \
logical_port=cr-outside | grep $gw1_chassis | wc -l
}
ovs_wait_failed () {
    :
    0
}
ovs_wait "ovn.at:10756" "until ovn-sbctl --columns chassis --bare find Port_Binding \\
logical_port=cr-outside | grep \$gw1_chassis | wc -l"


# Re add the ovs ports.
for i in 1 2; do
    as hv$i
    ovs-vsctl -- add-port br-int hv$i-vif1 -- \
        set interface hv$i-vif1 external-ids:iface-id=inside$i \
        options:tx_pcap=hv$i/vif1-tx.pcap \
        options:rxq_pcap=hv$i/vif1-rx.pcap \
        ofport-request=1
done

hv1_ch_uuid=`ovn-sbctl --bare --columns _uuid find chassis name="hv1"`
hv2_ch_uuid=`ovn-sbctl --bare --columns _uuid find chassis name="hv2"`

exp_ref_ch_list=''
for i in `ovn-sbctl --bare --columns _uuid list chassis | sort`
do
    if test $i = $hv1_ch_uuid; then
        exp_ref_ch_list="${exp_ref_ch_list}$i"
    elif test $i = $hv2_ch_uuid; then
        exp_ref_ch_list="${exp_ref_ch_list}$i"
    fi
done

ovs_wait_cond () {
    ref_ch_list=`ovn-sbctl --bare --columns ref_chassis find ha_chassis_group | sort`
     # Trim the spaces.
     ref_ch_list=`echo $ref_ch_list | sed 's/ //g'`
     test "$exp_ref_ch_list" = "$ref_ch_list"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10783" "until ref_ch_list=\`ovn-sbctl --bare --columns ref_chassis find ha_chassis_group | sort\`
     # Trim the spaces.
     ref_ch_list=\`echo \$ref_ch_list | sed 's/ //g'\`
     test \"\$exp_ref_ch_list\" = \"\$ref_ch_list\""


# Increase the priority of gw2
ovn-nbctl --wait=sb ha-chassis-group-add-chassis hagrp1 gw2 40

ovs_wait_cond () {
    as hv1 ovs-ofctl dump-flows br-int table=32 | \
grep active_backup | grep slaves:$hv1_gw2_ofport,$hv1_gw1_ofport \
| wc -l
}
ovs_wait_failed () {
    :
    0
}
ovs_wait "ovn.at:10792" "until as hv1 ovs-ofctl dump-flows br-int table=32 | \\
grep active_backup | grep slaves:\$hv1_gw2_ofport,\$hv1_gw1_ofport \\
| wc -l"


ovs_wait_cond () {
    as hv2 ovs-ofctl dump-flows br-int table=32 | \
grep active_backup | grep slaves:$hv2_gw2_ofport,$hv2_gw1_ofport \
| wc -l
}
ovs_wait_failed () {
    :
    0
}
ovs_wait "ovn.at:10797" "until as hv2 ovs-ofctl dump-flows br-int table=32 | \\
grep active_backup | grep slaves:\$hv2_gw2_ofport,\$hv2_gw1_ofport \\
| wc -l"


# check that the chassis redirect port has been reclaimed by the gw2 chassis
ovs_wait_cond () {
    ovn-sbctl --columns chassis --bare find Port_Binding \
logical_port=cr-outside | grep $gw2_chassis | wc -l
}
ovs_wait_failed () {
    :
    0
}
ovs_wait "ovn.at:10803" "until ovn-sbctl --columns chassis --bare find Port_Binding \\
logical_port=cr-outside | grep \$gw2_chassis | wc -l"


# check BFD enablement on tunnel ports from gw1 #########
as gw1
for chassis in gw2 hv1 hv2; do
    echo "checking gw1 -> $chassis"
    { set +x
$as_echo "$at_srcdir/ovn.at:10811: ovs-vsctl --bare --columns bfd find Interface name=ovn-\$chassis-0"
at_fn_check_prepare_dynamic "ovs-vsctl --bare --columns bfd find Interface name=ovn-$chassis-0" "ovn.at:10811"
( $at_check_trace; ovs-vsctl --bare --columns bfd find Interface name=ovn-$chassis-0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "enable=true
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10811"
$at_failed && at_fn_log_failure
$at_traceon; }

done

# check BFD enablement on tunnel ports from gw2 ##########
as gw2
for chassis in gw1 hv1 hv2; do
    echo "checking gw2 -> $chassis"
    { set +x
$as_echo "$at_srcdir/ovn.at:10820: ovs-vsctl --bare --columns bfd find Interface name=ovn-\$chassis-0"
at_fn_check_prepare_dynamic "ovs-vsctl --bare --columns bfd find Interface name=ovn-$chassis-0" "ovn.at:10820"
( $at_check_trace; ovs-vsctl --bare --columns bfd find Interface name=ovn-$chassis-0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "enable=true
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10820"
$at_failed && at_fn_log_failure
$at_traceon; }

done

# check BFD enablement on tunnel ports from hv1 ###########
as hv1
for chassis in gw1 gw2; do
    echo "checking hv1 -> $chassis"
    { set +x
$as_echo "$at_srcdir/ovn.at:10829: ovs-vsctl --bare --columns bfd find Interface name=ovn-\$chassis-0"
at_fn_check_prepare_dynamic "ovs-vsctl --bare --columns bfd find Interface name=ovn-$chassis-0" "ovn.at:10829"
( $at_check_trace; ovs-vsctl --bare --columns bfd find Interface name=ovn-$chassis-0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "enable=true
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10829"
$at_failed && at_fn_log_failure
$at_traceon; }

done
# make sure BFD is not enabled to hv2, we don't need it
{ set +x
$as_echo "$at_srcdir/ovn.at:10834: ovs-vsctl --bare --columns bfd find Interface name=ovn-hv2-0"
at_fn_check_prepare_trace "ovn.at:10834"
( $at_check_trace; ovs-vsctl --bare --columns bfd find Interface name=ovn-hv2-0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10834"
$at_failed && at_fn_log_failure
$at_traceon; }


# check BFD enablement on tunnel ports from hv2 ##########
as hv2
for chassis in gw1 gw2; do
    echo "checking hv2 -> $chassis"
    { set +x
$as_echo "$at_srcdir/ovn.at:10842: ovs-vsctl --bare --columns bfd find Interface name=ovn-\$chassis-0"
at_fn_check_prepare_dynamic "ovs-vsctl --bare --columns bfd find Interface name=ovn-$chassis-0" "ovn.at:10842"
( $at_check_trace; ovs-vsctl --bare --columns bfd find Interface name=ovn-$chassis-0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "enable=true
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10842"
$at_failed && at_fn_log_failure
$at_traceon; }

done
# make sure BFD is not enabled to hv1, we don't need it
{ set +x
$as_echo "$at_srcdir/ovn.at:10847: ovs-vsctl --bare --columns bfd find Interface name=ovn-hv1-0"
at_fn_check_prepare_trace "ovn.at:10847"
( $at_check_trace; ovs-vsctl --bare --columns bfd find Interface name=ovn-hv1-0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10847"
$at_failed && at_fn_log_failure
$at_traceon; }


# make sure that flows for handling the outside router port reside on gw2 now
ovs_wait_cond () {
    as gw2 ovs-ofctl dump-flows br-int table=24 | \
grep 00:00:02:01:02:04 | wc -l
}
ovs_wait_failed () {
    :
    0
}
ovs_wait "ovn.at:10852" "until as gw2 ovs-ofctl dump-flows br-int table=24 | \\
grep 00:00:02:01:02:04 | wc -l"

ovs_wait_cond () {
    as gw1 ovs-ofctl dump-flows br-int table=24 | \
grep 00:00:02:01:02:04 | wc -l
}
ovs_wait_failed () {
    :
    0
}
ovs_wait "ovn.at:10855" "until as gw1 ovs-ofctl dump-flows br-int table=24 | \\
grep 00:00:02:01:02:04 | wc -l"


# disconnect GW2 from the network, GW1 should take over
as gw2
port=${sandbox}_br-phys
as main ovs-vsctl del-port n1 $port

bfd_dump

# make sure that flows for handling the outside router port reside on gw2 now
ovs_wait_cond () {
    as gw1 ovs-ofctl dump-flows br-int table=24 | \
grep 00:00:02:01:02:04 | wc -l
}
ovs_wait_failed () {
    :
    0
}
ovs_wait "ovn.at:10867" "until as gw1 ovs-ofctl dump-flows br-int table=24 | \\
grep 00:00:02:01:02:04 | wc -l"

ovs_wait_cond () {
    as gw2 ovs-ofctl dump-flows br-int table=24 | \
grep 00:00:02:01:02:04 | wc -l
}
ovs_wait_failed () {
    :
    0
}
ovs_wait "ovn.at:10870" "until as gw2 ovs-ofctl dump-flows br-int table=24 | \\
grep 00:00:02:01:02:04 | wc -l"


# check that the chassis redirect port has been reclaimed by the gw1 chassis
ovs_wait_cond () {
    ovn-sbctl --columns chassis --bare find Port_Binding \
logical_port=cr-outside | grep $gw1_chassis | wc -l
}
ovs_wait_failed () {
    :
    0
}
ovs_wait "ovn.at:10875" "until ovn-sbctl --columns chassis --bare find Port_Binding \\
logical_port=cr-outside | grep \$gw1_chassis | wc -l"





    as gw1
    if test "gw1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:10879: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:10879"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10879"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10879: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:10879"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10879"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10879" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:10879: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:10879"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10879"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10879: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:10879"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10879"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10879" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:10879: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:10879"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10879"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10879: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:10879"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10879"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10879" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as gw1
    { set +x
$as_echo "$at_srcdir/ovn.at:10879: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:10879"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10879"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10879: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:10879"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10879"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10879" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:10879: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:10879"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10879"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10879: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:10879"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10879"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10879" "while kill -0 \$TMPPID 2>/dev/null"





    as gw2
    if test "gw2" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:10879: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:10879"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10879"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10879: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:10879"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10879"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10879" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:10879: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:10879"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10879"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10879: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:10879"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10879"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10879" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:10879: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:10879"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10879"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10879: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:10879"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10879"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10879" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as gw2
    { set +x
$as_echo "$at_srcdir/ovn.at:10879: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:10879"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10879"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10879: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:10879"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10879"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10879" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:10879: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:10879"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10879"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10879: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:10879"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10879"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10879" "while kill -0 \$TMPPID 2>/dev/null"





    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:10879: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:10879"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10879"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10879: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:10879"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10879"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10879" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:10879: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:10879"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10879"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10879: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:10879"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10879"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10879" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:10879: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:10879"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10879"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10879: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:10879"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10879"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10879" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:10879: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:10879"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10879"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10879: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:10879"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10879"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10879" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:10879: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:10879"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10879"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10879: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:10879"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10879"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10879" "while kill -0 \$TMPPID 2>/dev/null"





    as hv2
    if test "hv2" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:10879: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:10879"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10879"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10879: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:10879"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10879"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10879" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:10879: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:10879"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10879"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10879: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:10879"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10879"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10879" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:10879: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:10879"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10879"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10879: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:10879"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10879"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10879" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv2
    { set +x
$as_echo "$at_srcdir/ovn.at:10879: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:10879"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10879"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10879: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:10879"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10879"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10879" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:10879: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:10879"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10879"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10879: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:10879"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10879"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10879" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:10879: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:10879"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10879"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10879: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:10879"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10879"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10879" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:10879: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:10879"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10879"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10879: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:10879"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10879"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10879" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:10879: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:10879"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10879"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10879: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:10879"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10879"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10879" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:10879: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:10879"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10879"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10879: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:10879"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10879"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10879" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:10879: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:10879"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10879"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10879: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:10879"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10879"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10879" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:10879: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:10879"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10879"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:10879: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:10879"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10879"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10879" "while kill -0 \$TMPPID 2>/dev/null"




ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_84
#AT_START_85
at_fn_group_banner 85 'ovn.at:10883' \
  "ovn -- send gratuitous ARP for NAT rules on HA distributed router" "" 2
at_xfail=no
(
  $as_echo "85. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start
ovn-nbctl ls-add ls0
ovn-nbctl ls-add ls1
ovn-nbctl create Logical_Router name=lr0
ovn-nbctl lrp-add lr0 lrp0 f0:00:00:00:00:01 192.168.0.100/24

ovn-nbctl --id=@gc0 create Gateway_Chassis \
                    name=outside_gw1 chassis_name=hv2 priority=10 -- \
          --id=@gc1 create Gateway_Chassis \
                    name=outside_gw2 chassis_name=hv3 priority=1 -- \
          set Logical_Router_Port lrp0 'gateway_chassis=@gc0,@gc1'

ovn-nbctl lsp-add ls0 lrp0-rp -- set Logical_Switch_Port lrp0-rp \
    type=router options:router-port=lrp0 addresses="router"
ovn-nbctl lrp-add lr0 lrp1 f0:00:00:00:00:02 10.0.0.1/24
ovn-nbctl lsp-add ls1 lrp1-rp -- set Logical_Switch_Port lrp1-rp \
    type=router options:router-port=lrp1 addresses="router"

# Add NAT rules
{ set +x
$as_echo "$at_srcdir/ovn.at:10903: ovn-nbctl lr-nat-add lr0 snat 192.168.0.100 10.0.0.0/24"
at_fn_check_prepare_trace "ovn.at:10903"
( $at_check_trace; ovn-nbctl lr-nat-add lr0 snat 192.168.0.100 10.0.0.0/24
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10903"
$at_failed && at_fn_log_failure
$at_traceon; }


net_add n1
sim_add hv1
as hv1
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.1
{ set +x
$as_echo "$at_srcdir/ovn.at:10910: ovs-vsctl set Open_vSwitch . external-ids:ovn-bridge-mappings=physnet1:br-phys"
at_fn_check_prepare_trace "ovn.at:10910"
( $at_check_trace; ovs-vsctl set Open_vSwitch . external-ids:ovn-bridge-mappings=physnet1:br-phys
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10910"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:10911: ovs-vsctl add-port br-phys snoopvif -- set Interface snoopvif options:tx_pcap=hv1/snoopvif-tx.pcap options:rxq_pcap=hv1/snoopvif-rx.pcap"
at_fn_check_prepare_trace "ovn.at:10911"
( $at_check_trace; ovs-vsctl add-port br-phys snoopvif -- set Interface snoopvif options:tx_pcap=hv1/snoopvif-tx.pcap options:rxq_pcap=hv1/snoopvif-rx.pcap
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10911"
$at_failed && at_fn_log_failure
$at_traceon; }


sim_add hv2
as hv2
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.2
{ set +x
$as_echo "$at_srcdir/ovn.at:10917: as hv2 ovs-vsctl set Open_vSwitch . external-ids:ovn-bridge-mappings=physnet1:br-phys"
at_fn_check_prepare_trace "ovn.at:10917"
( $at_check_trace; as hv2 ovs-vsctl set Open_vSwitch . external-ids:ovn-bridge-mappings=physnet1:br-phys
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10917"
$at_failed && at_fn_log_failure
$at_traceon; }


sim_add hv3
as hv3
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.3
{ set +x
$as_echo "$at_srcdir/ovn.at:10923: as hv3 ovs-vsctl set Open_vSwitch . external-ids:ovn-bridge-mappings=physnet1:br-phys"
at_fn_check_prepare_trace "ovn.at:10923"
( $at_check_trace; as hv3 ovs-vsctl set Open_vSwitch . external-ids:ovn-bridge-mappings=physnet1:br-phys
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10923"
$at_failed && at_fn_log_failure
$at_traceon; }


# Create a localnet port.
{ set +x
$as_echo "$at_srcdir/ovn.at:10926: ovn-nbctl lsp-add ls0 ln_port"
at_fn_check_prepare_trace "ovn.at:10926"
( $at_check_trace; ovn-nbctl lsp-add ls0 ln_port
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10926"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:10927: ovn-nbctl lsp-set-addresses ln_port unknown"
at_fn_check_prepare_trace "ovn.at:10927"
( $at_check_trace; ovn-nbctl lsp-set-addresses ln_port unknown
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10927"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:10928: ovn-nbctl lsp-set-type ln_port localnet"
at_fn_check_prepare_trace "ovn.at:10928"
( $at_check_trace; ovn-nbctl lsp-set-type ln_port localnet
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10928"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:10929: ovn-nbctl lsp-set-options ln_port network_name=physnet1"
at_fn_check_prepare_trace "ovn.at:10929"
( $at_check_trace; ovn-nbctl lsp-set-options ln_port network_name=physnet1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10929"
$at_failed && at_fn_log_failure
$at_traceon; }


# wait for earlier changes to take effect
{ set +x
$as_echo "$at_srcdir/ovn.at:10932: ovn-nbctl --timeout=3 --wait=hv sync"
at_fn_check_prepare_trace "ovn.at:10932"
( $at_check_trace; ovn-nbctl --timeout=3 --wait=hv sync
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10932"
$at_failed && at_fn_log_failure
$at_traceon; }


reset_pcap_file() {
    local iface=$1
    local pcap_file=$2
    ovs-vsctl -- set Interface $iface options:tx_pcap=dummy-tx.pcap \
options:rxq_pcap=dummy-rx.pcap
    rm -f ${pcap_file}*.pcap
    ovs-vsctl -- set Interface $iface options:tx_pcap=${pcap_file}-tx.pcap \
options:rxq_pcap=${pcap_file}-rx.pcap
}

as hv1 reset_pcap_file snoopvif hv1/snoopvif
as hv2 reset_pcap_file br-phys_n1 hv2/br-phys_n1
as hv3 reset_pcap_file br-phys_n1 hv3/br-phys_n1
# add nat-addresses option
ovn-nbctl --wait=hv lsp-set-options lrp0-rp router-port=lrp0 nat-addresses="router"

# Wait for packets to be received through hv2.
ovs_wait_cond () {
    test `wc -c < "hv1/snoopvif-tx.pcap"` -ge 100
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10951" "until test \`wc -c < \"hv1/snoopvif-tx.pcap\"\` -ge 100"

trim_zeros() {
    sed 's/\(00\)\{1,\}$//'
}

only_broadcast_from_lrp1() {
    grep "fffffffffffff00000000001"
}

garp="fffffffffffff0000000000108060001080006040001f00000000001c0a80064000000000000c0a80064"
echo $garp > expout

$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/snoopvif-tx.pcap | trim_zeros | only_broadcast_from_lrp1 | uniq > hv1_snoop_tx
echo "packets on hv1-snoopvif:"
cat hv1_snoop_tx
{ set +x
$as_echo "$at_srcdir/ovn.at:10966: sort hv1_snoop_tx"
at_fn_check_prepare_trace "ovn.at:10966"
( $at_check_trace; sort hv1_snoop_tx
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10966"
$at_failed && at_fn_log_failure
$at_traceon; }

$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv2/br-phys_n1-tx.pcap | trim_zeros | only_broadcast_from_lrp1 | uniq > hv2_br_phys_tx
echo "packets on hv2 br-phys tx"
cat hv2_br_phys_tx
{ set +x
$as_echo "$at_srcdir/ovn.at:10970: grep \$garp hv2_br_phys_tx | sort"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:10970"
( $at_check_trace; grep $garp hv2_br_phys_tx | sort
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10970"
$at_failed && at_fn_log_failure
$at_traceon; }

$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv3/br-phys_n1-tx.pcap | trim_zeros | only_broadcast_from_lrp1 | uniq > hv3_br_phys_tx
echo "packets on hv3 br-phys tx"
cat hv3_br_phys_tx
{ set +x
$as_echo "$at_srcdir/ovn.at:10974: grep \$garp hv3_br_phys_tx | sort"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:10974"
( $at_check_trace; grep $garp hv3_br_phys_tx | sort
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10974"
$at_failed && at_fn_log_failure
$at_traceon; }



# at this point, we invert the priority of the gw chassis between hv2 and hv3

ovn-nbctl --wait=hv \
          --id=@gc0 create Gateway_Chassis \
                    name=outside_gw1 chassis_name=hv2 priority=1 -- \
          --id=@gc1 create Gateway_Chassis \
                    name=outside_gw2 chassis_name=hv3 priority=10 -- \
          set Logical_Router_Port lrp0 'gateway_chassis=@gc0,@gc1'


as hv1 reset_pcap_file snoopvif hv1/snoopvif
as hv2 reset_pcap_file br-phys_n1 hv2/br-phys_n1
as hv3 reset_pcap_file br-phys_n1 hv3/br-phys_n1

# Wait for packets to be received.
ovs_wait_cond () {
    test `wc -c < "hv1/snoopvif-tx.pcap"` -ge 100
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:10992" "until test \`wc -c < \"hv1/snoopvif-tx.pcap\"\` -ge 100"

trim_zeros() {
    sed 's/\(00\)\{1,\}$//'
}

$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/snoopvif-tx.pcap | trim_zeros | only_broadcast_from_lrp1 | uniq >  hv1_snoopvif_tx
{ set +x
$as_echo "$at_srcdir/ovn.at:10998: sort hv1_snoopvif_tx"
at_fn_check_prepare_trace "ovn.at:10998"
( $at_check_trace; sort hv1_snoopvif_tx
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:10998"
$at_failed && at_fn_log_failure
$at_traceon; }

$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv3/br-phys_n1-tx.pcap | trim_zeros | only_broadcast_from_lrp1 | uniq > hv3_br_phys_tx
{ set +x
$as_echo "$at_srcdir/ovn.at:11000: grep \$garp hv3_br_phys_tx | sort"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:11000"
( $at_check_trace; grep $garp hv3_br_phys_tx | sort
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11000"
$at_failed && at_fn_log_failure
$at_traceon; }

$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv2/br-phys_n1-tx.pcap | trim_zeros | only_broadcast_from_lrp1 | uniq > hv2_br_phys_tx
{ set +x
$as_echo "$at_srcdir/ovn.at:11002: grep \$garp hv2_br_phys_tx | sort"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:11002"
( $at_check_trace; grep $garp hv2_br_phys_tx | sort
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11002"
$at_failed && at_fn_log_failure
$at_traceon; }


# change localnet port tag.
{ set +x
$as_echo "$at_srcdir/ovn.at:11005: ovn-nbctl set Logical_Switch_Port ln_port tag=2014"
at_fn_check_prepare_trace "ovn.at:11005"
( $at_check_trace; ovn-nbctl set Logical_Switch_Port ln_port tag=2014
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11005"
$at_failed && at_fn_log_failure
$at_traceon; }


# wait for earlier changes to take effect
ovs_wait_cond () {
    test 1 = `as hv2 ovs-ofctl dump-flows br-int table=65 | \
grep "actions=mod_vlan_vid:2014" | wc -l`

}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11008" "until test 1 = \`as hv2 ovs-ofctl dump-flows br-int table=65 | \\
grep \"actions=mod_vlan_vid:2014\" | wc -l\`
"


ovs_wait_cond () {
    test 1 = `as hv3 ovs-ofctl dump-flows br-int table=65 | \
grep "actions=mod_vlan_vid:2014" | wc -l`

}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11012" "until test 1 = \`as hv3 ovs-ofctl dump-flows br-int table=65 | \\
grep \"actions=mod_vlan_vid:2014\" | wc -l\`
"


# update nat-addresses option
ovn-nbctl --wait=hv clear logical_switch_port lrp0-rp options

#Wait until the Port_Binding.nat_addresses is cleared.
ovs_wait_cond () {
    test 0 = `ovn-sbctl --bare --columns nat_addresses find port_binding \
logical_port=lrp0-rp | grep is_chassis | wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11020" "until test 0 = \`ovn-sbctl --bare --columns nat_addresses find port_binding \\
logical_port=lrp0-rp | grep is_chassis | wc -l\`"


as hv1 reset_pcap_file snoopvif hv1/snoopvif
as hv2 reset_pcap_file br-phys_n1 hv2/br-phys_n1
as hv3 reset_pcap_file br-phys_n1 hv3/br-phys_n1

ovn-nbctl --wait=hv lsp-set-options lrp0-rp router-port=lrp0 nat-addresses="router"

#Wait until the Port_Binding.nat_addresses is set.
ovs_wait_cond () {
    test 1 = `ovn-sbctl --bare --columns nat_addresses find port_binding \
logical_port=lrp0-rp | grep is_chassis | wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11030" "until test 1 = \`ovn-sbctl --bare --columns nat_addresses find port_binding \\
logical_port=lrp0-rp | grep is_chassis | wc -l\`"


# Wait for packets to be received.
ovs_wait_cond () {
    test `wc -c < "hv1/snoopvif-tx.pcap"` -ge 100
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11034" "until test \`wc -c < \"hv1/snoopvif-tx.pcap\"\` -ge 100"

trim_zeros() {
    sed 's/\(00\)\{1,\}$//'
}

garp="fffffffffffff00000000001810007de08060001080006040001f00000000001c0a80064000000000000c0a80064"
echo $garp > expout

$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/snoopvif-tx.pcap | trim_zeros | only_broadcast_from_lrp1 | uniq >  hv1_snoopvif_tx
{ set +x
$as_echo "$at_srcdir/ovn.at:11043: sort hv1_snoopvif_tx"
at_fn_check_prepare_trace "ovn.at:11043"
( $at_check_trace; sort hv1_snoopvif_tx
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11043"
$at_failed && at_fn_log_failure
$at_traceon; }

$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv3/br-phys_n1-tx.pcap | trim_zeros | only_broadcast_from_lrp1 | uniq > hv3_br_phys_tx
{ set +x
$as_echo "$at_srcdir/ovn.at:11045: grep \$garp hv3_br_phys_tx | sort"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:11045"
( $at_check_trace; grep $garp hv3_br_phys_tx | sort
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11045"
$at_failed && at_fn_log_failure
$at_traceon; }

$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv2/br-phys_n1-tx.pcap | trim_zeros | only_broadcast_from_lrp1 | uniq > hv2_br_phys_tx
{ set +x
$as_echo "$at_srcdir/ovn.at:11047: grep \$garp hv2_br_phys_tx | sort"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:11047"
( $at_check_trace; grep $garp hv2_br_phys_tx | sort
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11047"
$at_failed && at_fn_log_failure
$at_traceon; }





    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:11049: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:11049"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11049"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11049: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:11049"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11049"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11049" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:11049: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:11049"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11049"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11049: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:11049"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11049"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11049" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:11049: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:11049"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11049"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11049: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:11049"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11049"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11049" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:11049: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:11049"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11049"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11049: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:11049"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11049"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11049" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:11049: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:11049"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11049"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11049: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:11049"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11049"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11049" "while kill -0 \$TMPPID 2>/dev/null"





    as hv2
    if test "hv2" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:11049: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:11049"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11049"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11049: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:11049"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11049"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11049" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:11049: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:11049"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11049"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11049: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:11049"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11049"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11049" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:11049: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:11049"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11049"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11049: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:11049"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11049"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11049" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv2
    { set +x
$as_echo "$at_srcdir/ovn.at:11049: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:11049"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11049"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11049: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:11049"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11049"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11049" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:11049: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:11049"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11049"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11049: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:11049"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11049"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11049" "while kill -0 \$TMPPID 2>/dev/null"





    as hv3
    if test "hv3" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:11049: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:11049"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11049"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11049: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:11049"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11049"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11049" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:11049: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:11049"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11049"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11049: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:11049"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11049"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11049" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:11049: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:11049"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11049"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11049: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:11049"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11049"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11049" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv3
    { set +x
$as_echo "$at_srcdir/ovn.at:11049: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:11049"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11049"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11049: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:11049"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11049"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11049" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:11049: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:11049"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11049"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11049: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:11049"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11049"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11049" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:11049: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:11049"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11049"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11049: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:11049"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11049"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11049" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:11049: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:11049"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11049"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11049: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:11049"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11049"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11049" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:11049: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:11049"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11049"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11049: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:11049"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11049"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11049" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:11049: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:11049"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11049"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11049: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:11049"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11049"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11049" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:11049: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:11049"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11049"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11049: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:11049"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11049"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11049" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:11049: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:11049"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11049"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11049: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:11049"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11049"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11049" "while kill -0 \$TMPPID 2>/dev/null"




ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_85
#AT_START_86
at_fn_group_banner 86 'ovn.at:11053' \
  "ovn -- ensure one gw controller restart in HA doesn't bounce the master" "" 2
at_xfail=no
(
  $as_echo "86. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

net_add n1

# create two gateways with external network connectivity
for i in 1 2; do
    sim_add gw$i
    as gw$i
    ovs-vsctl add-br br-phys
    ovn_attach n1 br-phys 192.168.0.$i
    ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys
done

ovn-nbctl ls-add inside
ovn-nbctl ls-add outside

# create one hypervisors with a vif port the internal network
sim_add hv1
as hv1
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.11
ovs-vsctl -- add-port br-int hv1-vif1 -- \
    set interface hv1-vif1 external-ids:iface-id=inside1 \
    options:tx_pcap=hv1/vif1-tx.pcap \
    options:rxq_pcap=hv1/vif1-rx.pcap \
    ofport-request=1

ovn-nbctl lsp-add inside inside1 \
        -- lsp-set-addresses inside1 "f0:00:00:01:22:01 192.168.1.101"


{ set +x
$as_echo "$at_srcdir/ovn.at:11085: ovn_populate_arp__"
at_fn_check_prepare_trace "ovn.at:11085"
( $at_check_trace; ovn_populate_arp__
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11085"
$at_failed && at_fn_log_failure
$at_traceon; }


ovn-nbctl create Logical_Router name=R1

# Connect inside to R1
ovn-nbctl lrp-add R1 inside 00:00:01:01:02:03 192.168.1.1/24
ovn-nbctl lsp-add inside rp-inside -- set Logical_Switch_Port rp-inside \
    type=router options:router-port=inside \
    -- lsp-set-addresses rp-inside router

# Connect outside to R1 as distributed router gateway port on gw1+gw2
ovn-nbctl lrp-add R1 outside 00:00:02:01:02:04 192.168.0.101/24

ovn-nbctl --id=@gc0 create Gateway_Chassis \
                    name=outside_gw1 chassis_name=gw1 priority=20 -- \
          --id=@gc1 create Gateway_Chassis \
                    name=outside_gw2 chassis_name=gw2 priority=10 -- \
          set Logical_Router_Port outside 'gateway_chassis=@gc0,@gc1'

ovn-nbctl lsp-add outside rp-outside -- set Logical_Switch_Port rp-outside \
    type=router options:router-port=outside \
    -- lsp-set-addresses rp-outside router

# Create localnet port in outside
ovn-nbctl lsp-add outside ln-outside
ovn-nbctl lsp-set-addresses ln-outside unknown
ovn-nbctl lsp-set-type ln-outside localnet
ovn-nbctl lsp-set-options ln-outside network_name=phys

# Allow some time for ovn-northd and ovn-controller to catch up.
ovn-nbctl --wait=hv --timeout=3 sync

# currently when ovn-controller is restarted, the old entry is deleted
# and a new one is created, which leaves the Gateway_Chassis with
# an empty chassis for a while. NOTE: restarting ovn-controller in tests
# doesn't have the same effect because "name" is conserved, and the
# Chassis entry is not replaced.

gw2_chassis=$(ovn-sbctl --bare --columns=_uuid find Chassis name=gw2)
ovn-sbctl destroy Chassis $gw2_chassis

# Wait for the gw2_chassis row is recreated.
ovs_wait_cond () {
    test 1 = `ovn-sbctl --bare --columns=_uuid find Chassis name=gw2 | wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11127" "until test 1 = \`ovn-sbctl --bare --columns=_uuid find Chassis name=gw2 | wc -l\`"


gw1_chassis=$(ovn-sbctl --bare --columns=_uuid find Chassis name=gw1)
gw2_chassis=$(ovn-sbctl --bare --columns=_uuid find Chassis name=gw2)

# When gw2 chassis row is destroyed, it gets recreated. There
# is a small window in which gw2 may claim the cr-outside port if
# it has not established bfd tunnel with gw1.
# So make sure that, cr-outside is claimed by gw1 finally.
ovs_wait_cond () {
    if cr_outside_ch=`ovn-sbctl --bare --columns=chassis find Port_binding logical_port=cr-outside`
     test $cr_outside_ch = $gw2_chassis; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11136" "while cr_outside_ch=\`ovn-sbctl --bare --columns=chassis find Port_binding logical_port=cr-outside\`
     test \$cr_outside_ch = \$gw2_chassis"


ovs_wait_cond () {
    cr_outside_ch=`ovn-sbctl --bare --columns=chassis find Port_binding logical_port=cr-outside`
     test $cr_outside_ch = $gw1_chassis
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11140" "until cr_outside_ch=\`ovn-sbctl --bare --columns=chassis find Port_binding logical_port=cr-outside\`
     test \$cr_outside_ch = \$gw1_chassis"





    as gw1
    if test "gw1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:11144: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:11144"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11144"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11144: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:11144"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11144"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11144" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:11144: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:11144"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11144"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11144: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:11144"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11144"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11144" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:11144: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:11144"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11144"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11144: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:11144"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11144"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11144" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as gw1
    { set +x
$as_echo "$at_srcdir/ovn.at:11144: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:11144"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11144"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11144: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:11144"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11144"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11144" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:11144: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:11144"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11144"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11144: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:11144"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11144"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11144" "while kill -0 \$TMPPID 2>/dev/null"





    as gw2
    if test "gw2" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:11144: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:11144"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11144"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11144: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:11144"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11144"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11144" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:11144: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:11144"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11144"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11144: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:11144"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11144"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11144" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:11144: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:11144"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11144"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11144: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:11144"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11144"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11144" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as gw2
    { set +x
$as_echo "$at_srcdir/ovn.at:11144: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:11144"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11144"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11144: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:11144"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11144"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11144" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:11144: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:11144"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11144"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11144: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:11144"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11144"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11144" "while kill -0 \$TMPPID 2>/dev/null"





    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:11144: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:11144"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11144"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11144: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:11144"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11144"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11144" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:11144: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:11144"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11144"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11144: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:11144"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11144"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11144" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:11144: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:11144"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11144"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11144: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:11144"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11144"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11144" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:11144: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:11144"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11144"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11144: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:11144"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11144"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11144" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:11144: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:11144"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11144"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11144: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:11144"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11144"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11144" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:11144: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:11144"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11144"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11144: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:11144"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11144"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11144" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:11144: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:11144"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11144"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11144: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:11144"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11144"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11144" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:11144: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:11144"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11144"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11144: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:11144"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11144"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11144" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:11144: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:11144"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11144"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11144: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:11144"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11144"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11144" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:11144: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:11144"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11144"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11144: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:11144"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11144"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11144" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:11144: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:11144"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11144"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11144: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:11144"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11144"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11144" "while kill -0 \$TMPPID 2>/dev/null"




ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_86
#AT_START_87
at_fn_group_banner 87 'ovn.at:11148' \
  "ovn -- IPv6 Neighbor Solicitation for unknown MAC" "" 2
at_xfail=no
(
  $as_echo "87. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init


ovn_start

ovn-nbctl ls-add sw0_ip6
ovn-nbctl lsp-add sw0_ip6 sw0_ip6-port1
ovn-nbctl lsp-set-addresses sw0_ip6-port1 \
"50:64:00:00:00:02 aef0::5264:00ff:fe00:0002"

ovn-nbctl lsp-set-port-security sw0_ip6-port1 \
"50:64:00:00:00:02 aef0::5264:00ff:fe00:0002"

ovn-nbctl lr-add lr0_ip6
ovn-nbctl lrp-add lr0_ip6 lrp0_ip6 00:00:00:00:af:01 aef0:0:0:0:0:0:0:0/64
ovn-nbctl lsp-add sw0_ip6 lrp0_ip6-attachment
ovn-nbctl lsp-set-type lrp0_ip6-attachment router
ovn-nbctl lsp-set-addresses lrp0_ip6-attachment router
ovn-nbctl lsp-set-options lrp0_ip6-attachment router-port=lrp0_ip6
ovn-nbctl set logical_router_port lrp0_ip6 ipv6_ra_configs:address_mode=slaac

ovn-nbctl ls-add public
ovn-nbctl lsp-add public ln-public
ovn-nbctl lsp-set-addresses ln-public unknown
ovn-nbctl lsp-set-type ln-public localnet
ovn-nbctl lsp-set-options ln-public network_name=phys

ovn-nbctl lrp-add lr0_ip6 ip6_public 00:00:02:01:02:04 \
2001:db8:1:0:200:02ff:fe01:0204/64 \
-- set Logical_Router_port ip6_public options:redirect-chassis="hv1"

#install static route
ovn-nbctl -- --id=@lrt create Logical_Router_Static_Route \
ip_prefix="\:\:/0" nexthop="2001\:db8\:1\:0\:200\:02ff\:fe01\:1305" \
-- add Logical_Router lr0_ip6 static_routes @lrt

ovn-nbctl lsp-add public rp-ip6_public -- set Logical_Switch_Port \
rp-ip6_public  type=router options:router-port=ip6_public \
-- lsp-set-addresses rp-ip6_public router

net_add n1
sim_add hv1
as hv1
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.2

ovs-vsctl -- add-port br-int hv1-vif1 -- \
    set interface hv1-vif1 external-ids:iface-id=sw0_ip6-port1 \
    options:tx_pcap=hv1/vif1-tx.pcap \
    options:rxq_pcap=hv1/vif1-rx.pcap \
    ofport-request=1
ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys

ovs_wait_cond () {
    test x`ovn-nbctl lsp-get-up sw0_ip6-port1` = xup
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11200" "until test x\`ovn-nbctl lsp-get-up sw0_ip6-port1\` = xup"


# There should be 2 Neighbor Advertisement flows for the router port
# aef0:: ip address in logical switch pipeline with action nd_na_router.
{ set +x
$as_echo "$at_srcdir/ovn.at:11204: ovn-sbctl dump-flows sw0_ip6 | grep ls_in_arp_rsp | \\
grep \"nd_na_router\" | wc -l"
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:11204"
( $at_check_trace; ovn-sbctl dump-flows sw0_ip6 | grep ls_in_arp_rsp | \
grep "nd_na_router" | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "2
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11204"
$at_failed && at_fn_log_failure
$at_traceon; }


# There should be 4 Neighbor Advertisement flows with action nd_na_router
# in the router pipeline for the router lr0_ip6.
{ set +x
$as_echo "$at_srcdir/ovn.at:11210: ovn-sbctl dump-flows lr0_ip6 | grep nd_na_router | \\
wc -l"
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:11210"
( $at_check_trace; ovn-sbctl dump-flows lr0_ip6 | grep nd_na_router | \
wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "4
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11210"
$at_failed && at_fn_log_failure
$at_traceon; }


cr_uuid=`ovn-sbctl find port_binding logical_port=cr-ip6_public | grep _uuid | cut -f2 -d ":"`

# There is only one chassis.
chassis_uuid=`ovn-sbctl list chassis | grep _uuid | cut -f2 -d ":"`
ovs_wait_cond () {
    test $chassis_uuid = `ovn-sbctl get port_binding $cr_uuid chassis`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11218" "until test \$chassis_uuid = \`ovn-sbctl get port_binding \$cr_uuid chassis\`"


trim_zeros() {
    sed 's/\(00\)\{1,\}$//'
}

reset_pcap_file() {
    local iface=$1
    local pcap_file=$2
    ovs-vsctl -- set Interface $iface options:tx_pcap=dummy-tx.pcap \
options:rxq_pcap=dummy-rx.pcap
    rm -f ${pcap_file}*.pcap
    ovs-vsctl -- set Interface $iface options:tx_pcap=${pcap_file}-tx.pcap \
options:rxq_pcap=${pcap_file}-rx.pcap
}

# Test the IPv6 Neighbor Solicitation (NS) - nd_ns action for unknown MAC
# addresses. ovn-controller should generate an IPv6 NS request for IPv6
# packets whose MAC is unknown (in the ARP_REQUEST router pipeline stage.
# test_ipv6 INPORT SRC_MAC DST_MAC SRC_IP DST_IP OUTPORT...
# This function sends ipv6 packet
test_ipv6() {
    local inport=$1 src_mac=$2 dst_mac=$3 src_ip=$4 dst_ip=$5
    local dst_mcast_mac=$6 mcast_node_ip=$7 nd_target=$8

    local packet=${dst_mac}${src_mac}86dd6000000000083aff${src_ip}${dst_ip}
    packet=${packet}8000000000000000

    src_mac=000002010204
    expected_packet=${dst_mcast_mac}${src_mac}86dd6000000000203aff${src_ip}
    expected_packet=${expected_packet}${mcast_node_ip}8700XXXX00000000
    expected_packet=${expected_packet}${nd_target}0101${src_mac}

    as hv1 ovs-appctl netdev-dummy/receive hv1-vif${inport} $packet
    rm -f ipv6_ns.expected
    echo $expected_packet >> ipv6_ns.expected
}

src_mac=506400000002
dst_mac=00000000af01
src_ip=aef0000000000000526400fffe000002
dst_ip=20010db800010000020002fffe010205
dst_mcast_mac=3333ff010205
mcast_node_ip=ff0200000000000000000001ff010205
nd_target=20010db800010000020002fffe010205
# Send an IPv6 packet. Generated IPv6 Neighbor solicitation packet
# should be received by the ports attached to br-phys.
test_ipv6 1 $src_mac $dst_mac $src_ip $dst_ip $dst_mcast_mac \
$mcast_node_ip $nd_target

ovs_wait_cond () {
    if test 24 = $(wc -c hv1/br-phys_n1-tx.pcap | cut -d " " -f1); then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11268" "while test 24 = \$(wc -c hv1/br-phys_n1-tx.pcap | cut -d \" \" -f1)"

ovs_wait_cond () {
    if test 24 = $(wc -c hv1/br-phys-tx.pcap | cut -d " " -f1); then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11269" "while test 24 = \$(wc -c hv1/br-phys-tx.pcap | cut -d \" \" -f1)"


$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/br-phys_n1-tx.pcap | \
trim_zeros > 1.packets
$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/br-phys-tx.pcap | \
trim_zeros > 2.packets

cat ipv6_ns.expected | cut -c -112 > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:11277: cat 1.packets | cut -c -112"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:11277"
( $at_check_trace; cat 1.packets | cut -c -112
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11277"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:11278: cat 2.packets | cut -c -112"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:11278"
( $at_check_trace; cat 2.packets | cut -c -112
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11278"
$at_failed && at_fn_log_failure
$at_traceon; }


# Skipping the ICMPv6 checksum
cat ipv6_ns.expected | cut -c 117- > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:11282: cat 1.packets | cut -c 117-"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:11282"
( $at_check_trace; cat 1.packets | cut -c 117-
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11282"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:11283: cat 2.packets | cut -c 117-"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:11283"
( $at_check_trace; cat 2.packets | cut -c 117-
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11283"
$at_failed && at_fn_log_failure
$at_traceon; }


# Now send a packet with destination ip other than
# 2001:db8:1:0:200:02ff:fe01:0204/64 prefix.
reset_pcap_file br-phys_n1 hv1/br-phys_n1
reset_pcap_file br-phys hv1/br-phys

src_mac=506400000002
dst_mac=00000000af01
src_ip=aef0000000000000526400fffe000002
dst_ip=20020ab8000100000200020000020306
# multicast mac of the nexthop IP - 2001:db8:1:0:200:02ff:fe01:1305
dst_mcast_mac=3333ff011305
mcast_node_ip=ff0200000000000000000001ff011305
nd_target=20010db800010000020002fffe011305
test_ipv6 1 $src_mac $dst_mac $src_ip $dst_ip $dst_mcast_mac \
$mcast_node_ip $nd_target

ovs_wait_cond () {
    if test 24 = $(wc -c hv1/br-phys_n1-tx.pcap | cut -d " " -f1); then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11301" "while test 24 = \$(wc -c hv1/br-phys_n1-tx.pcap | cut -d \" \" -f1)"

ovs_wait_cond () {
    if test 24 = $(wc -c hv1/br-phys-tx.pcap | cut -d " " -f1); then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11302" "while test 24 = \$(wc -c hv1/br-phys-tx.pcap | cut -d \" \" -f1)"


$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/br-phys_n1-tx.pcap | \
trim_zeros > 1.packets
$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/br-phys-tx.pcap | \
trim_zeros > 2.packets

cat ipv6_ns.expected | cut -c -112 > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:11310: cat 1.packets | cut -c -112"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:11310"
( $at_check_trace; cat 1.packets | cut -c -112
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11310"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:11311: cat 2.packets | cut -c -112"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:11311"
( $at_check_trace; cat 2.packets | cut -c -112
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11311"
$at_failed && at_fn_log_failure
$at_traceon; }


# Skipping the ICMPv6 checksum
cat ipv6_ns.expected | cut -c 117- > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:11315: cat 1.packets | cut -c 117-"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:11315"
( $at_check_trace; cat 1.packets | cut -c 117-
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11315"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:11316: cat 2.packets | cut -c 117-"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:11316"
( $at_check_trace; cat 2.packets | cut -c 117-
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11316"
$at_failed && at_fn_log_failure
$at_traceon; }





    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:11318: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:11318"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11318"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11318: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:11318"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11318"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11318" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:11318: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:11318"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11318"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11318: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:11318"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11318"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11318" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:11318: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:11318"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11318"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11318: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:11318"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11318"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11318" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:11318: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:11318"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11318"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11318: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:11318"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11318"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11318" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:11318: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:11318"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11318"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11318: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:11318"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11318"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11318" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:11318: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:11318"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11318"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11318: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:11318"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11318"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11318" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:11318: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:11318"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11318"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11318: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:11318"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11318"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11318" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:11318: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:11318"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11318"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11318: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:11318"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11318"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11318" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:11318: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:11318"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11318"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11318: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:11318"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11318"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11318" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:11318: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:11318"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11318"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11318: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:11318"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11318"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11318" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:11318: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:11318"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11318"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11318: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:11318"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11318"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11318" "while kill -0 \$TMPPID 2>/dev/null"




ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_87
#AT_START_88
at_fn_group_banner 88 'ovn.at:11322' \
  "ovn -- options:requested-chassis for logical port" "" 2
at_xfail=no
(
  $as_echo "88. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

net_add n1

ovn-nbctl ls-add ls0
ovn-nbctl lsp-add ls0 lsp0

# create two hypervisors, each with one vif port
sim_add hv1
as hv1
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.11
ovs-vsctl -- add-port br-int hv1-vif0 -- \
set Interface hv1-vif0 ofport-request=1

sim_add hv2
as hv2
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.12
ovs-vsctl -- add-port br-int hv2-vif0 -- \
set Interface hv2-vif0 ofport-request=1

# Allow only chassis hv1 to bind logical port lsp0.
ovn-nbctl lsp-set-options lsp0 requested-chassis=hv1

# Allow some time for ovn-northd and ovn-controller to catch up.
ovn-nbctl --wait=hv --timeout=3 sync

# Retrieve hv1 and hv2 chassis UUIDs from southbound database
ovn-sbctl wait-until chassis hv1
ovn-sbctl wait-until chassis hv2
hv1_uuid=$(ovn-sbctl --bare --columns _uuid find chassis name=hv1)
hv2_uuid=$(ovn-sbctl --bare --columns _uuid find chassis name=hv2)

# (1) Chassis hv2 should not bind lsp0 when requested-chassis is hv1.
echo "verifying that hv2 does not bind lsp0 when hv2 physical/logical mapping is added"
as hv2
ovs-vsctl set interface hv2-vif0 external-ids:iface-id=lsp0

ovs_wait_cond () {
    test 1 = $(grep -c "Not claiming lport lsp0" hv2/ovn-controller.log)
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11362" "until test 1 = \$(grep -c \"Not claiming lport lsp0\" hv2/ovn-controller.log)"

{ set +x
$as_echo "$at_srcdir/ovn.at:11363: test x\$(ovn-sbctl --bare --columns chassis find port_binding logical_port=lsp0) = x"
at_fn_check_prepare_notrace 'a $(...) command substitution' "ovn.at:11363"
( $at_check_trace; test x$(ovn-sbctl --bare --columns chassis find port_binding logical_port=lsp0) = x
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11363"
$at_failed && at_fn_log_failure
$at_traceon; }


# (2) Chassis hv2 should not add flows in OFTABLE_PHY_TO_LOG and OFTABLE_LOG_TO_PHY tables.
{ set +x
$as_echo "$at_srcdir/ovn.at:11366: as hv2 ovs-ofctl dump-flows br-int table=0 | grep in_port=1"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:11366"
( $at_check_trace; as hv2 ovs-ofctl dump-flows br-int table=0 | grep in_port=1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn.at:11366"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:11367: as hv2 ovs-ofctl dump-flows br-int table=65 | grep output"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:11367"
( $at_check_trace; as hv2 ovs-ofctl dump-flows br-int table=65 | grep output
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn.at:11367"
$at_failed && at_fn_log_failure
$at_traceon; }


# (3) Chassis hv1 should bind lsp0 when physical to logical mapping exists on hv1.
echo "verifying that hv1 binds lsp0 when hv1 physical/logical mapping is added"
as hv1
ovs-vsctl set interface hv1-vif0 external-ids:iface-id=lsp0

ovs_wait_cond () {
    test 1 = $(grep -c "Claiming lport lsp0" hv1/ovn-controller.log)
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11374" "until test 1 = \$(grep -c \"Claiming lport lsp0\" hv1/ovn-controller.log)"

{ set +x
$as_echo "$at_srcdir/ovn.at:11375: test x\$(ovn-sbctl --bare --columns chassis find port_binding logical_port=lsp0) = x\"\$hv1_uuid\""
at_fn_check_prepare_notrace 'a $(...) command substitution' "ovn.at:11375"
( $at_check_trace; test x$(ovn-sbctl --bare --columns chassis find port_binding logical_port=lsp0) = x"$hv1_uuid"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11375"
$at_failed && at_fn_log_failure
$at_traceon; }


# (4) Chassis hv1 should add flows in OFTABLE_PHY_TO_LOG and OFTABLE_LOG_TO_PHY tables.
as hv1 ovs-ofctl dump-flows br-int
{ set +x
$as_echo "$at_srcdir/ovn.at:11379: as hv1 ovs-ofctl dump-flows br-int table=0 | grep in_port=1"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:11379"
( $at_check_trace; as hv1 ovs-ofctl dump-flows br-int table=0 | grep in_port=1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11379"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:11380: as hv1 ovs-ofctl dump-flows br-int table=65 | grep actions=output:1"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:11380"
( $at_check_trace; as hv1 ovs-ofctl dump-flows br-int table=65 | grep actions=output:1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11380"
$at_failed && at_fn_log_failure
$at_traceon; }


# (5) Chassis hv1 should release lsp0 binding and chassis hv2 should bind lsp0 when
# the requested chassis for lsp0 is changed from hv1 to hv2.
echo "verifying that lsp0 binding moves when requested-chassis is changed"

ovn-nbctl lsp-set-options lsp0 requested-chassis=hv2
ovs_wait_cond () {
    test 1 = $(grep -c "Releasing lport lsp0 from this chassis" hv1/ovn-controller.log)
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11387" "until test 1 = \$(grep -c \"Releasing lport lsp0 from this chassis\" hv1/ovn-controller.log)"

ovs_wait_cond () {
    test x$(ovn-sbctl --bare --columns chassis find port_binding logical_port=lsp0) = x"$hv2_uuid"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11388" "until test x\$(ovn-sbctl --bare --columns chassis find port_binding logical_port=lsp0) = x\"\$hv2_uuid\""


# (6) Chassis hv2 should add flows and hv1 should not.
{ set +x
$as_echo "$at_srcdir/ovn.at:11391: as hv2 ovs-ofctl dump-flows br-int table=0 | grep in_port=1"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:11391"
( $at_check_trace; as hv2 ovs-ofctl dump-flows br-int table=0 | grep in_port=1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11391"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:11392: as hv2 ovs-ofctl dump-flows br-int table=65 | grep actions=output:1"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:11392"
( $at_check_trace; as hv2 ovs-ofctl dump-flows br-int table=65 | grep actions=output:1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11392"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn.at:11394: as hv1 ovs-ofctl dump-flows br-int table=0 | grep in_port=1"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:11394"
( $at_check_trace; as hv1 ovs-ofctl dump-flows br-int table=0 | grep in_port=1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn.at:11394"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:11395: as hv1 ovs-ofctl dump-flows br-int table=65 | grep output"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:11395"
( $at_check_trace; as hv1 ovs-ofctl dump-flows br-int table=65 | grep output
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn.at:11395"
$at_failed && at_fn_log_failure
$at_traceon; }





    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:11397: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:11397"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11397"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11397: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:11397"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11397"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11397" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:11397: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:11397"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11397"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11397: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:11397"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11397"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11397" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:11397: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:11397"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11397"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11397: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:11397"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11397"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11397" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:11397: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:11397"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11397"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11397: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:11397"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11397"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11397" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:11397: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:11397"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11397"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11397: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:11397"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11397"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11397" "while kill -0 \$TMPPID 2>/dev/null"





    as hv2
    if test "hv2" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:11397: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:11397"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11397"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11397: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:11397"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11397"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11397" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:11397: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:11397"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11397"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11397: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:11397"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11397"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11397" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:11397: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:11397"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11397"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11397: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:11397"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11397"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11397" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv2
    { set +x
$as_echo "$at_srcdir/ovn.at:11397: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:11397"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11397"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11397: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:11397"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11397"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11397" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:11397: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:11397"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11397"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11397: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:11397"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11397"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11397" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:11397: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:11397"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11397"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11397: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:11397"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11397"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11397" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:11397: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:11397"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11397"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11397: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:11397"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11397"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11397" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:11397: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:11397"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11397"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11397: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:11397"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11397"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11397" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:11397: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:11397"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11397"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11397: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:11397"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11397"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11397" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:11397: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:11397"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11397"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11397: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:11397"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11397"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11397" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:11397: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:11397"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11397"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11397: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:11397"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11397"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11397" "while kill -0 \$TMPPID 2>/dev/null"




ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_88
#AT_START_89
at_fn_group_banner 89 'ovn.at:11401' \
  "ovn -- options:requested-chassis with hostname" " " 2
at_xfail=no
(
  $as_echo "89. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init


ovn_start

ovn-nbctl ls-add ls0
ovn-nbctl lsp-add ls0 lsp0

net_add n1
sim_add hv1
as hv1
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.11
ovs-vsctl -- add-port br-int hv1-vif0 -- set Interface hv1-vif0 ofport-request=1

ovn-sbctl wait-until chassis hv1
hv1_hostname=$(ovn-sbctl --bare --columns hostname find Chassis name=hv1)
echo "hv1_hostname=${hv1_hostname}"
ovn-nbctl --wait=hv --timeout=3 lsp-set-options lsp0 requested-chassis=${hv1_hostname}
as hv1 ovs-vsctl set interface hv1-vif0 external-ids:iface-id=lsp0

hv1_uuid=$(ovn-sbctl --bare --columns _uuid find Chassis name=hv1)
echo "hv1_uuid=${hv1_uuid}"
ovs_wait_cond () {
    test 1 = $(grep -c "Claiming lport lsp0" hv1/ovn-controller.log)
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11423" "until test 1 = \$(grep -c \"Claiming lport lsp0\" hv1/ovn-controller.log)"

{ set +x
$as_echo "$at_srcdir/ovn.at:11424: test x\$(ovn-sbctl --bare --columns chassis find port_binding logical_port=lsp0) = x\"\$hv1_uuid\""
at_fn_check_prepare_notrace 'a $(...) command substitution' "ovn.at:11424"
( $at_check_trace; test x$(ovn-sbctl --bare --columns chassis find port_binding logical_port=lsp0) = x"$hv1_uuid"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11424"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:11425: as hv1 ovs-ofctl dump-flows br-int table=0 | grep in_port=1"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:11425"
( $at_check_trace; as hv1 ovs-ofctl dump-flows br-int table=0 | grep in_port=1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11425"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:11426: as hv1 ovs-ofctl dump-flows br-int table=65 | grep actions=output:1"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:11426"
( $at_check_trace; as hv1 ovs-ofctl dump-flows br-int table=65 | grep actions=output:1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11426"
$at_failed && at_fn_log_failure
$at_traceon; }


ovn-nbctl --wait=hv --timeout=3 lsp-set-options lsp0 requested-chassis=non-existant-chassis
ovs_wait_cond () {
    test 1 = $(grep -c "Releasing lport lsp0 from this chassis" hv1/ovn-controller.log)
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11429" "until test 1 = \$(grep -c \"Releasing lport lsp0 from this chassis\" hv1/ovn-controller.log)"

ovn-nbctl --wait=hv --timeout=3 sync
{ set +x
$as_echo "$at_srcdir/ovn.at:11431: test x\$(ovn-sbctl --bare --columns chassis find port_binding logical_port=lsp0) = x"
at_fn_check_prepare_notrace 'a $(...) command substitution' "ovn.at:11431"
( $at_check_trace; test x$(ovn-sbctl --bare --columns chassis find port_binding logical_port=lsp0) = x
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11431"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:11432: as hv1 ovs-ofctl dump-flows br-int table=0 | grep in_port=1"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:11432"
( $at_check_trace; as hv1 ovs-ofctl dump-flows br-int table=0 | grep in_port=1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn.at:11432"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:11433: as hv1 ovs-ofctl dump-flows br-int table=65 | grep output"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:11433"
( $at_check_trace; as hv1 ovs-ofctl dump-flows br-int table=65 | grep output
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn.at:11433"
$at_failed && at_fn_log_failure
$at_traceon; }





    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:11435: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:11435"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11435"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11435: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:11435"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11435"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11435" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:11435: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:11435"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11435"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11435: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:11435"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11435"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11435" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:11435: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:11435"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11435"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11435: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:11435"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11435"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11435" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:11435: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:11435"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11435"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11435: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:11435"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11435"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11435" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:11435: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:11435"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11435"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11435: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:11435"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11435"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11435" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:11435: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:11435"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11435"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11435: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:11435"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11435"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11435" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:11435: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:11435"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11435"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11435: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:11435"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11435"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11435" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:11435: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:11435"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11435"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11435: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:11435"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11435"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11435" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:11435: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:11435"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11435"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11435: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:11435"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11435"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11435" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:11435: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:11435"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11435"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11435: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:11435"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11435"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11435" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:11435: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:11435"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11435"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11435: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:11435"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11435"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11435" "while kill -0 \$TMPPID 2>/dev/null"




ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_89
#AT_START_90
at_fn_group_banner 90 'ovn.at:11439' \
  "ovn -- IPv6 periodic RA" "                        " 2
at_xfail=no
(
  $as_echo "90. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

# This test sets up two hypervisors.
# hv1 and hv2 run ovn-controllers, and
# each has a VIF connected to the same
# logical switch in OVN. The logical
# switch is connected to a logical
# router port that is configured to send
# periodic router advertisements.
#
# The reason for having two ovn-controller
# hypervisors is to ensure that the
# periodic RAs being sent by each ovn-controller
# are kept to their local hypervisors. If the
# packets are not kept local, then each port
# will receive too many RAs.

net_add n1
sim_add hv1
sim_add hv2
as hv1
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.2
as hv2
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.3

ovn-nbctl lr-add ro
ovn-nbctl lrp-add ro ro-sw 00:00:00:00:00:01 aef0:0:0:0:0:0:0:1/64

ovn-nbctl ls-add sw
ovn-nbctl lsp-add sw sw-ro
ovn-nbctl lsp-set-type sw-ro router
ovn-nbctl lsp-set-options sw-ro router-port=ro-sw
ovn-nbctl lsp-set-addresses sw-ro 00:00:00:00:00:01
ovn-nbctl lsp-add sw sw-p1
ovn-nbctl lsp-set-addresses sw-p1 "00:00:00:00:00:02 aef0::200:ff:fe00:2"
ovn-nbctl lsp-add sw sw-p2
ovn-nbctl lsp-set-addresses sw-p2 "00:00:00:00:00:03 aef0::200:ff:fe00:3"

ovn-nbctl set Logical_Router_Port ro-sw ipv6_ra_configs:send_periodic=true
ovn-nbctl set Logical_Router_Port ro-sw ipv6_ra_configs:address_mode=slaac
ovn-nbctl set Logical_Router_Port ro-sw ipv6_ra_configs:max_interval=4
ovn-nbctl set Logical_Router_Port ro-sw ipv6_ra_configs:min_interval=3

for i in 1 2 ; do
    as hv$i
    ovs-vsctl -- add-port br-int hv$i-vif1 -- \
        set interface hv$i-vif1 external-ids:iface-id=sw-p$i \
        options:tx_pcap=hv$i/vif1-tx.pcap \
        options:rxq_pcap=hv$i/vif1-rx.pcap \
        ofport-request=1
done

ovs_wait_cond () {
    test x`ovn-nbctl lsp-get-up sw-p1` = xup
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11494" "until test x\`ovn-nbctl lsp-get-up sw-p1\` = xup"

ovs_wait_cond () {
    test x`ovn-nbctl lsp-get-up sw-p2` = xup
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11495" "until test x\`ovn-nbctl lsp-get-up sw-p2\` = xup"


reset_pcap_file() {
    local iface=$1
    local pcap_file=$2
    ovs-vsctl -- set Interface $iface options:tx_pcap=dummy-tx.pcap \
options:rxq_pcap=dummy-rx.pcap
    rm -f ${pcap_file}*.pcap
    ovs-vsctl -- set Interface $iface options:tx_pcap=${pcap_file}-tx.pcap \
options:rxq_pcap=${pcap_file}-rx.pcap

}

construct_expected_ra() {
    local src_mac=000000000001
    local dst_mac=333300000001
    local src_addr=fe80000000000000020000fffe000001
    local dst_addr=ff020000000000000000000000000001

    local mtu=$1
    local ra_mo=$2
    local rdnss=$3
    local dnssl=$4
    local route_info=$5
    local ra_prefix_la=$6

    local slla=0101${src_mac}
    local mtu_opt=""
    if test $mtu != 0; then
        mtu_opt=05010000${mtu}
    fi
    shift 6

    local prefix=""
    while [ $# -gt 0 ] ; do
        local size=$1
        local net=$2
        prefix=${prefix}0304${size}${ra_prefix_la}ffffffffffffffff00000000${net}
        shift 2
    done

    local rdnss_opt=""
    if test $rdnss != 0; then
        rdnss_opt=19030000ffffffff${rdnss}
    fi
    local dnssl_opt=""
    if test $dnssl != 0; then
        dnssl_opt=1f030000ffffffff${dnssl}
    fi
    local route_info_opt=""
    if test $route_info != 0; then
        route_info_opt=${route_info}
    fi

    local ra=ff${ra_mo}ffff0000000000000000${slla}${mtu_opt}${prefix}${rdnss_opt}${dnssl_opt}${route_info_opt}
    local icmp=8600XXXX${ra}

    local ip_len=$(expr ${#icmp} / 2)
    ip_len=$(echo "$ip_len" | awk '{printf "%0.4x\n", $0}')

    local ip=60000000${ip_len}3aff${src_addr}${dst_addr}${icmp}
    local eth=${dst_mac}${src_mac}86dd${ip}
    local packet=${eth}
    echo $packet >> expected
}

ra_test() {
    construct_expected_ra $@

    for i in hv1 hv2 ; do
        as $i reset_pcap_file $i-vif1 $i/vif1

        ovs_wait_cond () {
    if test 24 = $(wc -c $i/vif1-tx.pcap | cut -d " " -f1); then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11567" "while test 24 = \$(wc -c \$i/vif1-tx.pcap | cut -d \" \" -f1)"


        $PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" $i/vif1-tx.pcap > packets

        cat expected | cut -c -112 > expout
        { set +x
$as_echo "$at_srcdir/ovn.at:11572: cat packets | cut -c -112"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:11572"
( $at_check_trace; cat packets | cut -c -112
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11572"
$at_failed && at_fn_log_failure
$at_traceon; }


        # Skip ICMPv6 checksum.
        cat expected | cut -c 117- > expout
        { set +x
$as_echo "$at_srcdir/ovn.at:11576: cat packets | cut -c 117-"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:11576"
( $at_check_trace; cat packets | cut -c 117-
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11576"
$at_failed && at_fn_log_failure
$at_traceon; }


        rm -f packets
        as $i reset_pcap_file $i-vif1 $i/vif1
    done

    rm -f expected
}

# Baseline test with no MTU
ra_test 0 00 0 0 0 c0 40 aef00000000000000000000000000000

# Now make sure an MTU option makes it
ovn-nbctl --wait=hv set Logical_Router_Port ro-sw ipv6_ra_configs:mtu=1500
ra_test 000005dc 00 0 0 0 c0 40 aef00000000000000000000000000000

# Now test for multiple network prefixes
ovn-nbctl --wait=hv set Logical_Router_port ro-sw networks='aef0\:\:1/64 fd0f\:\:1/48'
ra_test 000005dc 00 0 0 0 c0 40 aef00000000000000000000000000000 30 fd0f0000000000000000000000000000

# Test PRF for default gw
ovn-nbctl --wait=hv set Logical_Router_port ro-sw ipv6_ra_configs:router_preference="LOW"
ra_test 000005dc 18 0 0 0 c0 40 aef00000000000000000000000000000 30 fd0f0000000000000000000000000000

# Now test for RDNSS
ovn-nbctl --wait=hv set Logical_Router_port ro-sw ipv6_ra_configs:rdnss='aef0::11'
dns_addr=aef00000000000000000000000000011
ra_test 000005dc 18 $dns_addr 0 0 c0 40 aef00000000000000000000000000000 30 fd0f0000000000000000000000000000

# Now test for DNSSL
ovn-nbctl --wait=hv set Logical_Router_port ro-sw ipv6_ra_configs:dnssl="aa.bb.cc"
ovn-nbctl --wait=hv set Logical_Router_port ro-sw ipv6_ra_configs:router_preference="HIGH"
dnssl=02616102626202636300000000000000
ra_test 000005dc 08 $dns_addr $dnssl 0 c0 40 aef00000000000000000000000000000 30 fd0f0000000000000000000000000000

# Now test Route Info option
ovn-nbctl --wait=hv set Logical_Router_port ro-sw ipv6_ra_configs:route_info="HIGH-aef1::11/48,LOW-aef2::11/96"
route_info=18023008ffffffffaef100000000000018036018ffffffffaef20000000000000000000000000000
ra_test 000005dc 08 $dns_addr $dnssl $route_info c0 40 aef00000000000000000000000000000 30 fd0f0000000000000000000000000000

## Test a different address mode now
ovn-nbctl --wait=hv set Logical_Router_Port ro-sw ipv6_ra_configs:address_mode=dhcpv6_stateful
ra_test 000005dc 88 $dns_addr $dnssl $route_info 80 40 aef00000000000000000000000000000 30 fd0f0000000000000000000000000000

# And the other address mode
ovn-nbctl --wait=hv set Logical_Router_Port ro-sw ipv6_ra_configs:address_mode=dhcpv6_stateless
ra_test 000005dc 48 $dns_addr $dnssl $route_info c0 40 aef00000000000000000000000000000 30 fd0f0000000000000000000000000000




    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:11624: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:11624"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11624"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11624: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:11624"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11624"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11624" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:11624: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:11624"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11624"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11624: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:11624"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11624"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11624" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:11624: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:11624"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11624"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11624: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:11624"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11624"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11624" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:11624: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:11624"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11624"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11624: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:11624"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11624"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11624" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:11624: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:11624"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11624"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11624: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:11624"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11624"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11624" "while kill -0 \$TMPPID 2>/dev/null"





    as hv2
    if test "hv2" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:11624: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:11624"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11624"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11624: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:11624"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11624"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11624" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:11624: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:11624"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11624"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11624: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:11624"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11624"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11624" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:11624: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:11624"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11624"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11624: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:11624"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11624"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11624" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv2
    { set +x
$as_echo "$at_srcdir/ovn.at:11624: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:11624"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11624"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11624: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:11624"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11624"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11624" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:11624: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:11624"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11624"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11624: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:11624"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11624"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11624" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:11624: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:11624"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11624"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11624: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:11624"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11624"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11624" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:11624: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:11624"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11624"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11624: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:11624"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11624"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11624" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:11624: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:11624"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11624"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11624: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:11624"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11624"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11624" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:11624: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:11624"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11624"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11624: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:11624"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11624"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11624" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:11624: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:11624"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11624"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11624: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:11624"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11624"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11624" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:11624: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:11624"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11624"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11624: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:11624"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11624"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11624" "while kill -0 \$TMPPID 2>/dev/null"



ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_90
#AT_START_91
at_fn_group_banner 91 'ovn.at:11627' \
  "ovn -- ACL reject rule test" "                    " 2
at_xfail=no
(
  $as_echo "91. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init


ovn_start

# test_ip_packet INPORT HV ETH_SRC ETH_DST IPV4_SRC IPV4_DST IP_CHKSUM EXP_IP_CHKSUM EXP_ICMP_CHKSUM
#
# Causes a packet to be received on INPORT of the hypervisor HV. The packet is an IPv4 packet with
# ETH_SRC, ETH_DST, IPV4_SRC, IPV4_DST, IP_CHKSUM as specified.
# EXP_IP_CHKSUM and EXP_ICMP_CHKSUM are the ip and icmp checksums of the icmp destination
# unreachable frame generated from ACL rule hit
#
# INPORT is a lport number, e.g. 11 for vif11.
# HV is a hypervisor number
# ETH_SRC and ETH_DST are each 12 hex digits.
# IPV4_SRC and IPV4_DST are each 8 hex digits.
# IP_CHKSUM, EXP_IP_CHSUM and EXP_ICMP_CHKSUM are each 4 hex digits
test_ip_packet() {
    local inport=$1 hv=$2 eth_src=$3 eth_dst=$4 ipv4_src=$5 ipv4_dst=$6 ip_chksum=$7
    local exp_ip_chksum=$8 exp_icmp_chksum=$9
    shift 9

    local ip_ttl=ff
    local packet=${eth_dst}${eth_src}08004500001400004000${ip_ttl}01${ip_chksum}${ipv4_src}${ipv4_dst}

    local reply_icmp_ttl=ff
    local icmp_type_code_response=0301
    local icmp_data=00000000
    local reply_icmp_payload=${icmp_type_code_response}${exp_icmp_chksum}${icmp_data}
    local reply=${eth_src}${eth_dst}08004500001c00004000${reply_icmp_ttl}01${exp_ip_chksum}${ipv4_dst}${ipv4_src}${reply_icmp_payload}
    echo $reply >> vif$inport.expected

    as hv$hv ovs-appctl netdev-dummy/receive vif$inport $packet
}

# test_ipv6_packet INPORT HV ETH_SRC ETH_DST IPV4_SRC IPV4_DST EXP_ICMP_CHKSUM
#
# Causes a packet to be received on INPORT of the hypervisor HV. The packet is an IPv6 packet with
# ETH_SRC, ETH_DST, IPV6_SRC, IPV6_DST as specified.
# EXP_ICMP_CHKSUM is the icmp6 checksums of the icmp6 destination unreachable frame generated from ACL rule hit
test_ipv6_packet() {
    local inport=$1 hv=$2 eth_src=$3 eth_dst=$4 ipv6_src=$5 ipv6_dst=$6 exp_icmp_chksum=$7
    shift 7

    local ip6_hdr=6000000000083aff${ipv6_src}${ipv6_dst}
    local packet=${eth_dst}${eth_src}86dd${ip6_hdr}0000000000000000

    local reply=${eth_src}${eth_dst}86dd6000000000303aff${ipv6_dst}${ipv6_src}0101${exp_icmp_chksum}00000000${ip6_hdr}
    echo $reply >> vif$inport.expected

    as hv$hv ovs-appctl netdev-dummy/receive vif$inport $packet
}

# test_tcp_syn_packet INPORT HV ETH_SRC ETH_DST IPV4_SRC IPV4_DST IP_CHKSUM TCP_SPORT TCP_DPORT TCP_CHKSUM EXP_IP_CHKSUM EXP_TCP_RST_CHKSUM
#
# Causes a packet to be received on INPORT of the hypervisor HV. The packet is an TCP syn segment with
# ETH_SRC, ETH_DST, IPV4_SRC, IPV4_DST, IP_CHKSUM, TCP_SPORT, TCP_DPORT, TCP_CHKSUM  as specified.
# EXP_IP_CHKSUM and EXP_TCP_RST_CHKSUM are the ip and tcp checksums of the tcp reset segment generated from ACL rule hit
#
# INPORT is an lport number, e.g. 11 for vif11.
# HV is an hypervisor number
# ETH_SRC and ETH_DST are each 12 hex digits.
# IPV4_SRC and IPV4_DST are each 8 hex digits.
# TCP_SPORT and TCP_DPORT are 4 hex digits.
# IP_CHKSUM, TCP_CHKSUM, EXP_IP_CHSUM and EXP_TCP_RST_CHKSUM are each 4 hex digits
test_tcp_syn_packet() {
    local inport=$1 hv=$2 eth_src=$3 eth_dst=$4 ipv4_src=$5 ipv4_dst=$6 ip_chksum=$7
    local tcp_sport=$8 tcp_dport=$9 tcp_chksum=${10}
    local exp_ip_chksum=${11} exp_tcp_rst_chksum=${12}
    shift 12

    local ip_ttl=ff
    local packet=${eth_dst}${eth_src}08004500002800004000${ip_ttl}06${ip_chksum}${ipv4_src}${ipv4_dst}${tcp_sport}${tcp_dport}000000010000000050027210${tcp_chksum}0000

    local tcp_rst_ttl=3f
    local reply=${eth_src}${eth_dst}08004500002800004000${tcp_rst_ttl}06${exp_ip_chksum}${ipv4_dst}${ipv4_src}${tcp_dport}${tcp_sport}000000000000000250140000${exp_tcp_rst_chksum}0000
    echo $reply >> vif$inport.expected

    as hv$hv ovs-appctl netdev-dummy/receive vif$inport $packet
}

# Create hypervisors hv[123].
# Add vif1[123] to hv1, vif2[123] to hv2, vif3[123] to hv3.
# Add all of the vifs to a single logical switch sw0.

net_add n1
ovn-nbctl ls-add sw0
for i in 1 2 3; do
    sim_add hv$i
    as hv$i
    ovs-vsctl add-br br-phys
    ovn_attach n1 br-phys 192.168.0.$i

    for j in 1 2 3; do
        ovn-nbctl lsp-add sw0 sw0-p$i$j -- \
                lsp-set-addresses sw0-p$i$j "00:00:00:00:00:$i$j 192.168.1.$i$j"

        ovs-vsctl -- add-port br-int vif$i$j -- \
                set interface vif$i$j \
                external-ids:iface-id=sw0-p$i$j \
                options:tx_pcap=hv$i/vif$i$j-tx.pcap \
                options:rxq_pcap=hv$i/vif$i$j-rx.pcap \
                ofport-request=$i$j
    done
done

{ set +x
$as_echo "$at_srcdir/ovn.at:11732: ovn_populate_arp__"
at_fn_check_prepare_trace "ovn.at:11732"
( $at_check_trace; ovn_populate_arp__
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11732"
$at_failed && at_fn_log_failure
$at_traceon; }

# allow some time for ovn-northd and ovn-controller to catch up.
sleep 1

ip_to_hex() {
    printf "%02x%02x%02x%02x" "$@"
}

for i in 1 2 3; do
    : > vif${i}1.expected
done

ovn-nbctl --log acl-add sw0 to-lport 1000 "outport == \"sw0-p12\"" reject
ovn-nbctl --log acl-add sw0 from-lport 1000 "inport == \"sw0-p11\"" reject
ovn-nbctl --log acl-add sw0 from-lport 1000 "inport == \"sw0-p21\"" reject

# Allow some time for ovn-northd and ovn-controller to catch up.
ovn-nbctl --timeout=3 --wait=hv sync

test_ip_packet 11 1 000000000011 000000000021 $(ip_to_hex 192 168 1 11) $(ip_to_hex 192 168 1 21) 0000 7d8d fcfe
test_ip_packet 21 2 000000000021 000000000011 $(ip_to_hex 192 168 1 21) $(ip_to_hex 192 168 1 11) 0000 7d8d fcfe
test_ip_packet 31 3 000000000031 000000000012 $(ip_to_hex 192 168 1 31) $(ip_to_hex 192 168 1 12) 0000 7d82 fcfe

test_ipv6_packet 11 1 000000000011 000000000021 fe80000000000000020001fffe000001 fe80000000000000020001fffe000002 6183

test_tcp_syn_packet 11 1 000000000011 000000000021 $(ip_to_hex 192 168 1 11) $(ip_to_hex 192 168 1 21) 0000 8b40 3039 0000 b85f 70e4
test_tcp_syn_packet 21 2 000000000021 000000000011 $(ip_to_hex 192 168 1 21) $(ip_to_hex 192 168 1 11) 0000 8b40 3039 0000 b85f 70e4
test_tcp_syn_packet 31 3 000000000031 000000000012 $(ip_to_hex 192 168 1 31) $(ip_to_hex 192 168 1 12) 0000 8b40 3039 0000 b854 70d9

for i in 1 2 3; do
    ovn_check_packets__ "hv$i/vif${i}1-tx.pcap" "vif${i}1.expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:11762: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:11762"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11762"
$at_failed && at_fn_log_failure
$at_traceon; }

done




    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:11765: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:11765"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11765"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11765: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:11765"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11765"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11765" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:11765: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:11765"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11765"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11765: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:11765"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11765"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11765" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:11765: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:11765"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11765"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11765: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:11765"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11765"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11765" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:11765: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:11765"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11765"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11765: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:11765"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11765"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11765" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:11765: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:11765"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11765"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11765: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:11765"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11765"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11765" "while kill -0 \$TMPPID 2>/dev/null"





    as hv2
    if test "hv2" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:11765: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:11765"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11765"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11765: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:11765"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11765"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11765" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:11765: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:11765"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11765"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11765: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:11765"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11765"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11765" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:11765: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:11765"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11765"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11765: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:11765"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11765"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11765" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv2
    { set +x
$as_echo "$at_srcdir/ovn.at:11765: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:11765"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11765"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11765: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:11765"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11765"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11765" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:11765: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:11765"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11765"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11765: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:11765"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11765"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11765" "while kill -0 \$TMPPID 2>/dev/null"





    as hv3
    if test "hv3" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:11765: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:11765"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11765"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11765: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:11765"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11765"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11765" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:11765: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:11765"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11765"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11765: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:11765"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11765"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11765" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:11765: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:11765"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11765"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11765: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:11765"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11765"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11765" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv3
    { set +x
$as_echo "$at_srcdir/ovn.at:11765: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:11765"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11765"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11765: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:11765"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11765"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11765" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:11765: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:11765"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11765"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11765: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:11765"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11765"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11765" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:11765: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:11765"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11765"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11765: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:11765"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11765"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11765" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:11765: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:11765"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11765"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11765: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:11765"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11765"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11765" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:11765: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:11765"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11765"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11765: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:11765"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11765"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11765" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:11765: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:11765"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11765"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11765: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:11765"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11765"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11765" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:11765: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:11765"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11765"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11765: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:11765"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11765"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11765" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:11765: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:11765"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11765"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11765: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:11765"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11765"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11765" "while kill -0 \$TMPPID 2>/dev/null"



ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_91
#AT_START_92
at_fn_group_banner 92 'ovn.at:11768' \
  "ovn -- Port Groups" "                             " 2
at_xfail=no
(
  $as_echo "92. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init


ovn_start

# Logical network:
#
# Three logical switches ls1, ls2, ls3.
# One logical router lr0 connected to ls[123],
# with nine subnets, three per logical switch:
#
#    lrp11 on ls1 for subnet 192.168.11.0/24
#    lrp12 on ls1 for subnet 192.168.12.0/24
#    lrp13 on ls1 for subnet 192.168.13.0/24
#    ...
#    lrp33 on ls3 for subnet 192.168.33.0/24
#
# 27 VIFs, 9 per LS, 3 per subnet: lp[123][123][123], where the first two
# digits are the subnet and the last digit distinguishes the VIF.
#
# This test will create two port groups and uses them in ACL.

get_lsp_uuid () {
    ovn-nbctl lsp-list ls${1%??} | grep lp$1 | awk '{ print $1 }'
}

pg1_ports=
pg2_ports=
for i in 1 2 3; do
    ovn-nbctl ls-add ls$i
    for j in 1 2 3; do
        for k in 1 2 3; do
            ovn-nbctl \
                -- lsp-add ls$i lp$i$j$k \
                -- lsp-set-addresses lp$i$j$k \
                   "f0:00:00:00:0$i:$j$k 192.168.$i$j.$k"
            # logical ports lp[12]?1 belongs to port group pg1
            if test $i != 3 && test $k == 1; then
                pg1_ports="$pg1_ports `get_lsp_uuid $i$j$k`"
            fi
            # logical ports lp[23]?2 belongs to port group pg2
            if test $i != 1 && test $k == 2; then
                pg2_ports="$pg2_ports `get_lsp_uuid $i$j$k`"
            fi
        done
    done
done

ovn-nbctl lr-add lr0
for i in 1 2 3; do
    for j in 1 2 3; do
        ovn-nbctl lrp-add lr0 lrp$i$j 00:00:00:00:ff:$i$j 192.168.$i$j.254/24
        ovn-nbctl \
            -- lsp-add ls$i lrp$i$j-attachment \
            -- set Logical_Switch_Port lrp$i$j-attachment type=router \
                             options:router-port=lrp$i$j \
                             addresses='"00:00:00:00:ff:'$i$j'"'
    done
done

ovn-nbctl create Port_Group name=pg1 ports="$pg1_ports"
ovn-nbctl create Port_Group name=pg2 ports="$pg2_ports"

# create ACLs on all lswitches to drop traffic from pg2 to pg1
ovn-nbctl acl-add ls1 to-lport 1001 'outport == @pg1 && ip4.src == $pg2_ip4' drop
ovn-nbctl acl-add ls2 to-lport 1001 'outport == @pg1 && ip4.src == $pg2_ip4' drop
ovn-nbctl acl-add ls3 to-lport 1001 'outport == @pg1 && ip4.src == $pg2_ip4' drop

# Physical network:
#
# Three hypervisors hv[123].
# lp?1[123] spread across hv[123]: lp?11 on hv1, lp?12 on hv2, lp?13 on hv3.
# lp?2[123] spread across hv[23]: lp?21 and lp?22 on hv2, lp?23 on hv3.
# lp?3[123] all on hv3.

# Given the name of a logical port, prints the name of the hypervisor
# on which it is located.
vif_to_hv() {
    case $1 in         ?11) echo 1 ;;         ?12 | ?21 | ?22) echo 2 ;;         ?13 | ?23 | ?3?) echo 3 ;;
    esac
}

# Given the name of a logical port, prints the name of its logical router
# port, e.g. "vif_to_lrp 123" yields 12.
vif_to_lrp() {
    echo ${1%?}
}

# Given the name of a logical port, prints the name of its logical
# switch, e.g. "vif_to_ls 123" yields 1.
vif_to_ls() {
    echo ${1%??}
}

net_add n1
for i in 1 2 3; do
    sim_add hv$i
    as hv$i
    ovs-vsctl add-br br-phys
    ovn_attach n1 br-phys 192.168.0.$i
done
for i in 1 2 3; do
    for j in 1 2 3; do
        for k in 1 2 3; do
            hv=`vif_to_hv $i$j$k`
                as hv$hv ovs-vsctl \
                -- add-port br-int vif$i$j$k \
                -- set Interface vif$i$j$k \
                    external-ids:iface-id=lp$i$j$k \
                    options:tx_pcap=hv$hv/vif$i$j$k-tx.pcap \
                    options:rxq_pcap=hv$hv/vif$i$j$k-rx.pcap \
                    ofport-request=$i$j$k
        done
    done
done

# Pre-populate the hypervisors' ARP tables so that we don't lose any
# packets for ARP resolution (native tunneling doesn't queue packets
# for ARP resolution).
{ set +x
$as_echo "$at_srcdir/ovn.at:11889: ovn_populate_arp__"
at_fn_check_prepare_trace "ovn.at:11889"
( $at_check_trace; ovn_populate_arp__
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11889"
$at_failed && at_fn_log_failure
$at_traceon; }


# Allow some time for ovn-northd and ovn-controller to catch up.
# XXX This should be more systematic.
sleep 1

# test_ip INPORT SRC_MAC DST_MAC SRC_IP DST_IP OUTPORT...
#
# This shell function causes a packet to be received on INPORT.  The packet's
# content has Ethernet destination DST and source SRC (each exactly 12 hex
# digits) and Ethernet type ETHTYPE (4 hex digits).  The OUTPORTs (zero or
# more) list the VIFs on which the packet should be received.  INPORT and the
# OUTPORTs are specified as logical switch port numbers, e.g. 123 for vif123.
for i in 1 2 3; do
    for j in 1 2 3; do
        for k in 1 2 3; do
            : > $i$j$k.expected
        done
    done
done
test_ip() {
    # This packet has bad checksums but logical L3 routing doesn't check.
    local inport=$1 src_mac=$2 dst_mac=$3 src_ip=$4 dst_ip=$5
    local packet=${dst_mac}${src_mac}08004500001c0000000040110000${src_ip}${dst_ip}0035111100080000
    shift; shift; shift; shift; shift
    hv=hv`vif_to_hv $inport`
    as $hv ovs-appctl netdev-dummy/receive vif$inport $packet
    #as $hv ovs-appctl ofproto/trace br-int in_port=$inport $packet
    in_ls=`vif_to_ls $inport`
    in_lrp=`vif_to_lrp $inport`
    for outport; do
        out_ls=`vif_to_ls $outport`
        if test $in_ls = $out_ls; then
            # Ports on the same logical switch receive exactly the same packet.
            echo $packet
        else
            # Routing decrements TTL and updates source and dest MAC
            # (and checksum).
            out_lrp=`vif_to_lrp $outport`
            echo f00000000${outport}00000000ff${out_lrp}08004500001c00000000"3f1101"00${src_ip}${dst_ip}0035111100080000
        fi >> $outport.expected
    done
}

as hv1 ovs-vsctl --columns=name,ofport list interface
as hv1 ovn-sbctl list port_binding
as hv1 ovn-sbctl list datapath_binding
as hv1 ovn-sbctl list port_group
as hv1 ovn-sbctl list address_set
as hv1 ovn-sbctl dump-flows
as hv1 ovs-ofctl dump-flows br-int

# Send IP packets between all pairs of source and destination ports,
# packets matches ACL (pg2 to pg1) should be dropped
ip_to_hex() {
    printf "%02x%02x%02x%02x" "$@"
}
for is in 1 2 3; do
  for js in 1 2 3; do
    for ks in 1 2 3; do
      bcast=
      s=$is$js$ks
      smac=f00000000$s
      sip=`ip_to_hex 192 168 $is$js $ks`
      for id in 1 2 3; do
          for jd in 1 2 3; do
              for kd in 1 2 3; do
                d=$id$jd$kd
                dip=`ip_to_hex 192 168 $id$jd $kd`
                if test $is = $id; then dmac=f00000000$d; else dmac=00000000ff$is$js; fi
                if test $d != $s; then unicast=$d; else unicast=; fi

                # packets matches ACL should be dropped
                if test $id != 3 && test $kd == 1; then
                    if test $is != 1 && test $ks == 2; then
                        unicast=
                    fi
                fi
                test_ip $s $smac $dmac $sip $dip $unicast #1
              done
          done
        done
      done
  done
done

# Allow some time for packet forwarding.
# XXX This can be improved.
sleep 1

# Now check the packets actually received against the ones expected.
for i in 1 2 3; do
    for j in 1 2 3; do
        for k in 1 2 3; do
            ovn_check_packets__ "hv`vif_to_hv $i$j$k`/vif$i$j$k-tx.pcap" "$i$j$k.expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:11983: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:11983"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11983"
$at_failed && at_fn_log_failure
$at_traceon; }

        done
    done
done

# Gracefully terminate daemons



    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:11990: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:11990"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11990"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11990: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:11990"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11990"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11990" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:11990: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:11990"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11990"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11990: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:11990"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11990"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11990" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:11990: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:11990"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11990"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11990: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:11990"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11990"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11990" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:11990: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:11990"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11990"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11990: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:11990"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11990"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11990" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:11990: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:11990"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11990"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11990: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:11990"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11990"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11990" "while kill -0 \$TMPPID 2>/dev/null"





    as hv2
    if test "hv2" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:11990: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:11990"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11990"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11990: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:11990"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11990"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11990" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:11990: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:11990"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11990"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11990: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:11990"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11990"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11990" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:11990: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:11990"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11990"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11990: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:11990"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11990"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11990" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv2
    { set +x
$as_echo "$at_srcdir/ovn.at:11990: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:11990"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11990"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11990: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:11990"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11990"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11990" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:11990: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:11990"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11990"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11990: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:11990"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11990"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11990" "while kill -0 \$TMPPID 2>/dev/null"





    as hv3
    if test "hv3" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:11990: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:11990"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11990"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11990: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:11990"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11990"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11990" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:11990: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:11990"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11990"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11990: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:11990"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11990"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11990" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:11990: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:11990"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11990"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11990: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:11990"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11990"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11990" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv3
    { set +x
$as_echo "$at_srcdir/ovn.at:11990: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:11990"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11990"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11990: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:11990"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11990"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11990" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:11990: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:11990"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11990"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11990: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:11990"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11990"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11990" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:11990: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:11990"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11990"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11990: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:11990"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11990"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11990" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:11990: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:11990"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11990"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11990: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:11990"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11990"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11990" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:11990: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:11990"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11990"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11990: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:11990"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11990"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11990" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:11990: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:11990"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11990"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11990: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:11990"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11990"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11990" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:11990: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:11990"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11990"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11990: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:11990"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11990"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11990" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:11990: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:11990"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11990"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:11990: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:11990"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:11990"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:11990" "while kill -0 \$TMPPID 2>/dev/null"



ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_92
#AT_START_93
at_fn_group_banner 93 'ovn.at:11993' \
  "ovn -- ACLs on Port Groups" "                     " 2
at_xfail=no
(
  $as_echo "93. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init


ovn_start

# Logical network:
#
# Three logical switches ls1, ls2, ls3.
# One logical router lr0 connected to ls[123],
# with nine subnets, three per logical switch:
#
#    lrp11 on ls1 for subnet 192.168.11.0/24
#    lrp12 on ls1 for subnet 192.168.12.0/24
#    lrp13 on ls1 for subnet 192.168.13.0/24
#    ...
#    lrp33 on ls3 for subnet 192.168.33.0/24
#
# 27 VIFs, 9 per LS, 3 per subnet: lp[123][123][123], where the first two
# digits are the subnet and the last digit distinguishes the VIF.
#
# This test will create two port groups and ACLs will be applied on them.

get_lsp_uuid () {
    ovn-nbctl lsp-list ls${1%??} | grep lp$1 | awk '{ print $1 }'
}

pg1_ports=
pg2_ports=
for i in 1 2 3; do
    ovn-nbctl ls-add ls$i
    for j in 1 2 3; do
        for k in 1 2 3; do
            ovn-nbctl \
                -- lsp-add ls$i lp$i$j$k \
                -- lsp-set-addresses lp$i$j$k \
                   "f0:00:00:00:0$i:$j$k 192.168.$i$j.$k"
            # logical ports lp[12]?1 belongs to port group pg1
            if test $i != 3 && test $k == 1; then
                pg1_ports="$pg1_ports `get_lsp_uuid $i$j$k`"
            fi
            # logical ports lp[23]?2 belongs to port group pg2
            if test $i != 1 && test $k == 2; then
                pg2_ports="$pg2_ports `get_lsp_uuid $i$j$k`"
            fi
        done
    done
done

ovn-nbctl lr-add lr0
for i in 1 2 3; do
    for j in 1 2 3; do
        ovn-nbctl lrp-add lr0 lrp$i$j 00:00:00:00:ff:$i$j 192.168.$i$j.254/24
        ovn-nbctl \
            -- lsp-add ls$i lrp$i$j-attachment \
            -- set Logical_Switch_Port lrp$i$j-attachment type=router \
                             options:router-port=lrp$i$j \
                             addresses='"00:00:00:00:ff:'$i$j'"'
    done
done

ovn-nbctl create Port_Group name=pg1 ports="$pg1_ports"
ovn-nbctl create Port_Group name=pg2 ports="$pg2_ports"

# create ACLs on pg1 to drop traffic from pg2 to pg1
ovn-nbctl acl-add pg1 to-lport 1001 'outport == @pg1' drop
ovn-nbctl --type=port-group acl-add pg1 to-lport 1002 \
        'outport == @pg1 && ip4.src == $pg2_ip4' allow-related

# Physical network:
#
# Three hypervisors hv[123].
# lp?1[123] spread across hv[123]: lp?11 on hv1, lp?12 on hv2, lp?13 on hv3.
# lp?2[123] spread across hv[23]: lp?21 and lp?22 on hv2, lp?23 on hv3.
# lp?3[123] all on hv3.

# Given the name of a logical port, prints the name of the hypervisor
# on which it is located.
vif_to_hv() {
    case $1 in         ?11) echo 1 ;;         ?12 | ?21 | ?22) echo 2 ;;         ?13 | ?23 | ?3?) echo 3 ;;
    esac
}

# Given the name of a logical port, prints the name of its logical router
# port, e.g. "vif_to_lrp 123" yields 12.
vif_to_lrp() {
    echo ${1%?}
}

# Given the name of a logical port, prints the name of its logical
# switch, e.g. "vif_to_ls 123" yields 1.
vif_to_ls() {
    echo ${1%??}
}

net_add n1
for i in 1 2 3; do
    sim_add hv$i
    as hv$i
    ovs-vsctl add-br br-phys
    ovn_attach n1 br-phys 192.168.0.$i
done
for i in 1 2 3; do
    for j in 1 2 3; do
        for k in 1 2 3; do
            hv=`vif_to_hv $i$j$k`
                as hv$hv ovs-vsctl \
                -- add-port br-int vif$i$j$k \
                -- set Interface vif$i$j$k \
                    external-ids:iface-id=lp$i$j$k \
                    options:tx_pcap=hv$hv/vif$i$j$k-tx.pcap \
                    options:rxq_pcap=hv$hv/vif$i$j$k-rx.pcap \
                    ofport-request=$i$j$k
        done
    done
done

# Pre-populate the hypervisors' ARP tables so that we don't lose any
# packets for ARP resolution (native tunneling doesn't queue packets
# for ARP resolution).
{ set +x
$as_echo "$at_srcdir/ovn.at:12114: ovn_populate_arp__"
at_fn_check_prepare_trace "ovn.at:12114"
( $at_check_trace; ovn_populate_arp__
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12114"
$at_failed && at_fn_log_failure
$at_traceon; }


# Allow some time for ovn-northd and ovn-controller to catch up.
# XXX This should be more systematic.
sleep 1

lsp_to_mac() {
    echo f0:00:00:00:0${1:0:1}:${1:1:2}
}

lrp_to_mac() {
    echo 00:00:00:00:ff:$1
}

# test_icmp INPORT SRC_MAC DST_MAC SRC_IP DST_IP ICMP_TYPE OUTPORT...
#
# This shell function causes a ICMP packet to be received on INPORT.
# The OUTPORTs (zero or more) list the VIFs on which the packet should
# be received.  INPORT and the OUTPORTs are specified as logical switch
# port numbers, e.g. 123 for vif123.
for i in 1 2 3; do
    for j in 1 2 3; do
        for k in 1 2 3; do
            : > $i$j$k.expected
        done
    done
done

test_icmp() {
    local inport=$1 src_mac=$2 dst_mac=$3 src_ip=$4 dst_ip=$5 icmp_type=$6
    local packet="inport==\"lp$inport\" && eth.src==$src_mac &&
                  eth.dst==$dst_mac && ip.ttl==64 && ip4.src==$src_ip
                  && ip4.dst==$dst_ip && icmp4.type==$icmp_type &&
                  icmp4.code==0"
    shift; shift; shift; shift; shift; shift
    hv=hv`vif_to_hv $inport`
    as $hv ovs-appctl -t ovn-controller inject-pkt "$packet"
    in_ls=`vif_to_ls $inport`
    in_lrp=`vif_to_lrp $inport`
    for outport; do
        out_ls=`vif_to_ls $outport`
        if test $in_ls = $out_ls; then
            # Ports on the same logical switch receive exactly the same packet.
            echo $packet | ovstest test-ovn expr-to-packets
        else
            # Routing decrements TTL and updates source and dest MAC
            # (and checksum).
            out_lrp=`vif_to_lrp $outport`
            exp_smac=`lrp_to_mac $out_lrp`
            exp_dmac=`lsp_to_mac $outport`
            exp_packet="eth.src==$exp_smac && eth.dst==$exp_dmac &&
                ip.ttl==63 && ip4.src==$src_ip && ip4.dst==$dst_ip &&
                icmp4.type==$icmp_type && icmp4.code==0"
            echo $exp_packet | ovstest test-ovn expr-to-packets

        fi >> $outport.expected
    done
}

as hv1 ovs-vsctl --columns=name,ofport list interface
as hv1 ovn-sbctl list port_binding
as hv1 ovn-sbctl list datapath_binding
as hv1 ovn-sbctl list port_group
as hv1 ovn-sbctl list address_set
as hv1 ovn-sbctl dump-flows
as hv1 ovs-ofctl dump-flows br-int

# Send IP packets between all pairs of source and destination ports,
# packets matches ACL1 but not ACL2 should be dropped
ip_to_hex() {
    printf "%02x%02x%02x%02x" "$@"
}
for is in 1 2 3; do
  for js in 1 2 3; do
    for ks in 1 2 3; do
      bcast=
      s=$is$js$ks
      slsp_mac=`lsp_to_mac $s`
      slrp_mac=`lrp_to_mac $is$js`
      sip=192.168.$is$js.$ks
      for id in 1 2 3; do
          for jd in 1 2 3; do
              for kd in 1 2 3; do
                d=$id$jd$kd
                dlsp_mac=`lsp_to_mac $d`
                dlrp_mac=`lrp_to_mac $id$jd`
                dip=192.168.$id$jd.$kd
                if test $is = $id; then dmac=$dlsp_mac; else dmac=$slrp_mac; fi
                if test $d != $s; then unicast=$d; else unicast=; fi

                # packets matches ACL1 but not ACL2 should be dropped
                if test $id != 3 && test $kd == 1; then
                    if test $is == 1 || test $ks != 2; then
                        unicast=
                    fi
                fi
                # icmp request (type = 8)
                test_icmp $s $slsp_mac $dmac $sip $dip 8 $unicast

                # if packets are not dropped, test the return traffic (icmp echo)
                # to make sure stateful works, too.
                if test x$unicast != x; then
                    if test $is = $id; then dmac=$slsp_mac; else dmac=$dlrp_mac; fi
                    # icmp echo (type = 0)
                    test_icmp $unicast $dlsp_mac $dmac $dip $sip 0 $s
                fi
              done
          done
        done
      done
  done
done

# Allow some time for packet forwarding.
# XXX This can be improved.
sleep 1

# Now check the packets actually received against the ones expected.
for i in 1 2 3; do
    for j in 1 2 3; do
        for k in 1 2 3; do
            ovn_check_packets__ "hv`vif_to_hv $i$j$k`/vif$i$j$k-tx.pcap" "$i$j$k.expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:12235: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:12235"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12235"
$at_failed && at_fn_log_failure
$at_traceon; }

        done
    done
done

# Gracefully terminate daemons



    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:12242: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:12242"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12242"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12242: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:12242"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12242"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12242" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:12242: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:12242"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12242"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12242: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:12242"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12242"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12242" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:12242: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:12242"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12242"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12242: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:12242"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12242"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12242" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:12242: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:12242"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12242"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12242: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:12242"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12242"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12242" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:12242: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:12242"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12242"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12242: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:12242"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12242"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12242" "while kill -0 \$TMPPID 2>/dev/null"





    as hv2
    if test "hv2" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:12242: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:12242"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12242"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12242: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:12242"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12242"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12242" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:12242: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:12242"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12242"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12242: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:12242"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12242"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12242" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:12242: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:12242"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12242"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12242: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:12242"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12242"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12242" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv2
    { set +x
$as_echo "$at_srcdir/ovn.at:12242: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:12242"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12242"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12242: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:12242"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12242"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12242" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:12242: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:12242"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12242"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12242: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:12242"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12242"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12242" "while kill -0 \$TMPPID 2>/dev/null"





    as hv3
    if test "hv3" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:12242: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:12242"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12242"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12242: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:12242"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12242"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12242" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:12242: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:12242"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12242"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12242: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:12242"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12242"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12242" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:12242: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:12242"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12242"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12242: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:12242"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12242"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12242" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv3
    { set +x
$as_echo "$at_srcdir/ovn.at:12242: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:12242"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12242"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12242: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:12242"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12242"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12242" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:12242: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:12242"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12242"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12242: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:12242"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12242"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12242" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:12242: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:12242"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12242"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12242: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:12242"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12242"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12242" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:12242: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:12242"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12242"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12242: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:12242"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12242"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12242" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:12242: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:12242"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12242"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12242: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:12242"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12242"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12242" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:12242: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:12242"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12242"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12242: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:12242"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12242"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12242" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:12242: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:12242"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12242"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12242: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:12242"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12242"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12242" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:12242: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:12242"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12242"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12242: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:12242"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12242"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12242" "while kill -0 \$TMPPID 2>/dev/null"



ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_93
#AT_START_94
at_fn_group_banner 94 'ovn.at:12245' \
  "ovn -- Address Set generation from Port Groups (static addressing)" "" 2
at_xfail=no
(
  $as_echo "94. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

ovn-nbctl ls-add ls1

ovn-nbctl lsp-add ls1 lp1
ovn-nbctl lsp-add ls1 lp2
ovn-nbctl lsp-add ls1 lp3

ovn-nbctl lsp-set-addresses lp1 "02:00:00:00:00:01 10.0.0.1 2001:db8::1"
ovn-nbctl lsp-set-addresses lp2 "02:00:00:00:00:02 10.0.0.2 2001:db8::2"
ovn-nbctl lsp-set-addresses lp3 "02:00:00:00:00:03 10.0.0.3 2001:db8::3"

ovn-nbctl create Port_Group name=pg1
ovn-nbctl create Port_Group name=pg2

ovn-nbctl --id=@p get Logical_Switch_Port lp1 -- add Port_Group pg1 ports @p
ovn-nbctl --id=@p get Logical_Switch_Port lp2 -- add Port_Group pg1 ports @p
ovn-nbctl --id=@p get Logical_Switch_Port lp2 -- add Port_Group pg2 ports @p
ovn-nbctl --id=@p get Logical_Switch_Port lp3 -- add Port_Group pg2 ports @p

ovn-nbctl --wait=sb sync

{ set +x
$as_echo "$at_srcdir/ovn.at:12269: ovn-sbctl get Address_Set pg1_ip4 addresses"
at_fn_check_prepare_trace "ovn.at:12269"
( $at_check_trace; ovn-sbctl get Address_Set pg1_ip4 addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "[\"10.0.0.1\", \"10.0.0.2\"]
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12269"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:12272: ovn-sbctl get Address_Set pg2_ip4 addresses"
at_fn_check_prepare_trace "ovn.at:12272"
( $at_check_trace; ovn-sbctl get Address_Set pg2_ip4 addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "[\"10.0.0.2\", \"10.0.0.3\"]
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12272"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:12275: ovn-sbctl get Address_Set pg1_ip6 addresses"
at_fn_check_prepare_trace "ovn.at:12275"
( $at_check_trace; ovn-sbctl get Address_Set pg1_ip6 addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "[\"2001:db8::1\", \"2001:db8::2\"]
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12275"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:12278: ovn-sbctl get Address_Set pg2_ip6 addresses"
at_fn_check_prepare_trace "ovn.at:12278"
( $at_check_trace; ovn-sbctl get Address_Set pg2_ip6 addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "[\"2001:db8::2\", \"2001:db8::3\"]
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12278"
$at_failed && at_fn_log_failure
$at_traceon; }


ovn-nbctl --wait=sb lsp-set-addresses lp1 \
    "02:00:00:00:00:01 10.0.0.11 2001:db8::11"

{ set +x
$as_echo "$at_srcdir/ovn.at:12286: ovn-sbctl get Address_Set pg1_ip4 addresses"
at_fn_check_prepare_trace "ovn.at:12286"
( $at_check_trace; ovn-sbctl get Address_Set pg1_ip4 addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "[\"10.0.0.11\", \"10.0.0.2\"]
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12286"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:12289: ovn-sbctl get Address_Set pg1_ip6 addresses"
at_fn_check_prepare_trace "ovn.at:12289"
( $at_check_trace; ovn-sbctl get Address_Set pg1_ip6 addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "[\"2001:db8::11\", \"2001:db8::2\"]
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12289"
$at_failed && at_fn_log_failure
$at_traceon; }


ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_94
#AT_START_95
at_fn_group_banner 95 'ovn.at:12295' \
  "ovn -- Address Set generation from Port Groups (dynamic addressing)" "" 2
at_xfail=no
(
  $as_echo "95. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

ovn-nbctl ls-add ls1
ovn-nbctl ls-add ls2
ovn-nbctl ls-add ls3

ovn-nbctl set Logical_Switch ls1 \
    other_config:subnet=10.1.0.0/24 other_config:ipv6_prefix="2001:db8:1::"
ovn-nbctl set Logical_Switch ls2 \
    other_config:subnet=10.2.0.0/24 other_config:ipv6_prefix="2001:db8:2::"

# A prefix length may be specified, but only if it is /64.
ovn-nbctl set Logical_Switch ls3 \
    other_config:subnet=10.3.0.0/24 other_config:ipv6_prefix="2001:db8:3::/64"

ovn-nbctl lsp-add ls1 lp1
ovn-nbctl lsp-add ls2 lp2
ovn-nbctl lsp-add ls3 lp3

ovn-nbctl lsp-set-addresses lp1 "02:00:00:00:00:01 dynamic"
ovn-nbctl lsp-set-addresses lp2 "02:00:00:00:00:02 dynamic"
ovn-nbctl lsp-set-addresses lp3 "02:00:00:00:00:03 dynamic"

ovn-nbctl create Port_Group name=pg1
ovn-nbctl create Port_Group name=pg2

ovn-nbctl --id=@p get Logical_Switch_Port lp1 -- add Port_Group pg1 ports @p
ovn-nbctl --id=@p get Logical_Switch_Port lp2 -- add Port_Group pg1 ports @p
ovn-nbctl --id=@p get Logical_Switch_Port lp2 -- add Port_Group pg2 ports @p
ovn-nbctl --id=@p get Logical_Switch_Port lp3 -- add Port_Group pg2 ports @p

ovn-nbctl --wait=sb sync

{ set +x
$as_echo "$at_srcdir/ovn.at:12330: ovn-sbctl get Address_Set pg1_ip4 addresses"
at_fn_check_prepare_trace "ovn.at:12330"
( $at_check_trace; ovn-sbctl get Address_Set pg1_ip4 addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "[\"10.1.0.2\", \"10.2.0.2\"]
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12330"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:12333: ovn-sbctl get Address_Set pg2_ip4 addresses"
at_fn_check_prepare_trace "ovn.at:12333"
( $at_check_trace; ovn-sbctl get Address_Set pg2_ip4 addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "[\"10.2.0.2\", \"10.3.0.2\"]
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12333"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:12336: ovn-sbctl get Address_Set pg1_ip6 addresses"
at_fn_check_prepare_trace "ovn.at:12336"
( $at_check_trace; ovn-sbctl get Address_Set pg1_ip6 addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "[\"2001:db8:1::ff:fe00:1\", \"2001:db8:2::ff:fe00:2\"]
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12336"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:12339: ovn-sbctl get Address_Set pg2_ip6 addresses"
at_fn_check_prepare_trace "ovn.at:12339"
( $at_check_trace; ovn-sbctl get Address_Set pg2_ip6 addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "[\"2001:db8:2::ff:fe00:2\", \"2001:db8:3::ff:fe00:3\"]
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12339"
$at_failed && at_fn_log_failure
$at_traceon; }


ovn-nbctl --wait=sb set Logical_Switch ls1 \
    other_config:subnet=10.11.0.0/24 other_config:ipv6_prefix="2001:db8:11::"

{ set +x
$as_echo "$at_srcdir/ovn.at:12347: ovn-sbctl get Address_Set pg1_ip4 addresses"
at_fn_check_prepare_trace "ovn.at:12347"
( $at_check_trace; ovn-sbctl get Address_Set pg1_ip4 addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "[\"10.11.0.2\", \"10.2.0.2\"]
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12347"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:12350: ovn-sbctl get Address_Set pg1_ip6 addresses"
at_fn_check_prepare_trace "ovn.at:12350"
( $at_check_trace; ovn-sbctl get Address_Set pg1_ip6 addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "[\"2001:db8:11::ff:fe00:1\", \"2001:db8:2::ff:fe00:2\"]
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12350"
$at_failed && at_fn_log_failure
$at_traceon; }


ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_95
#AT_START_96
at_fn_group_banner 96 'ovn.at:12356' \
  "ovn -- ACL conjunction" "                         " 2
at_xfail=no
(
  $as_echo "96. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

ovn-nbctl ls-add ls1

ovn-nbctl lsp-add ls1 ls1-lp1 \
-- lsp-set-addresses ls1-lp1 "f0:00:00:00:00:01 10.0.0.4"

ovn-nbctl lsp-set-port-security ls1-lp1 "f0:00:00:00:00:01 10.0.0.4"

ovn-nbctl lsp-add ls1 ls1-lp2 \
-- lsp-set-addresses ls1-lp2 "f0:00:00:00:00:02 10.0.0.6"

ovn-nbctl lsp-set-port-security ls1-lp2 "f0:00:00:00:00:02 10.0.0.6"

net_add n1
sim_add hv1

as hv1
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.1
ovs-vsctl -- add-port br-int hv1-vif1 -- \
    set interface hv1-vif1 external-ids:iface-id=ls1-lp1 \
    options:tx_pcap=hv1/vif1-tx.pcap \
    options:rxq_pcap=hv1/vif1-rx.pcap \
    ofport-request=1

ovs-vsctl -- add-port br-int hv1-vif2 -- \
    set interface hv1-vif2 external-ids:iface-id=ls1-lp2 \
    options:tx_pcap=hv1/vif2-tx.pcap \
    options:rxq_pcap=hv1/vif2-rx.pcap \
    ofport-request=2

ovn-nbctl create Address_Set name=set1 \
addresses=\"10.0.0.4\",\"10.0.0.5\",\"10.0.0.6\"
ovn-nbctl create Address_Set name=set2 \
addresses=\"10.0.0.7\",\"10.0.0.8\",\"10.0.0.9\"
ovn-nbctl acl-add ls1 to-lport 1001 \
'ip4 && ip4.src == $set1 && ip4.dst == $set1' allow
ovn-nbctl acl-add ls1 to-lport 1001 \
'ip4 && ip4.src == $set1 && ip4.dst == $set2' drop

# test_ip INPORT SRC_MAC DST_MAC SRC_IP DST_IP OUTPORT...
#
# This shell function causes an ip packet to be received on INPORT.
# The packet's content has Ethernet destination DST and source SRC
# (each exactly 12 hex digits) and Ethernet type ETHTYPE (4 hex digits).
# The OUTPORTs (zero or more) list the VIFs on which the packet should
# be received.  INPORT and the OUTPORTs are specified as logical switch
# port numbers, e.g. 11 for vif11.
test_ip() {
    # This packet has bad checksums but logical L3 routing doesn't check.
    local inport=$1 src_mac=$2 dst_mac=$3 src_ip=$4 dst_ip=$5
    local packet=${dst_mac}${src_mac}08004500001c0000000040110000${src_ip}\
${dst_ip}0035111100080000
    shift; shift; shift; shift; shift
    as hv1 ovs-appctl netdev-dummy/receive hv1-vif1 $packet
    for outport; do
        echo $packet >> $outport.expected
    done
}

ip_to_hex() {
    printf "%02x%02x%02x%02x" "$@"
}

reset_pcap_file() {
    local iface=$1
    local pcap_file=$2
    ovs-vsctl -- set Interface $iface options:tx_pcap=dummy-tx.pcap \
options:rxq_pcap=dummy-rx.pcap
    rm -f ${pcap_file}*.pcap
    ovs-vsctl -- set Interface $iface options:tx_pcap=${pcap_file}-tx.pcap \
options:rxq_pcap=${pcap_file}-rx.pcap
}


sip=`ip_to_hex 10 0 0 4`
dip=`ip_to_hex 10 0 0 6`

test_ip 1 f00000000001 f00000000002 $sip $dip 2

cat 2.expected > expout
$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/vif2-tx.pcap > 2.packets
{ set +x
$as_echo "$at_srcdir/ovn.at:12440: cat 2.packets"
at_fn_check_prepare_trace "ovn.at:12440"
( $at_check_trace; cat 2.packets
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12440"
$at_failed && at_fn_log_failure
$at_traceon; }


# There should be total of 9 flows present with conjunction action and 2 flows
# with conj match. Eg.
# table=44, priority=2002,conj_id=2,metadata=0x1 actions=resubmit(,45)
# table=44, priority=2001,conj_id=3,metadata=0x1 actions=drop
# priority=2002,ip,metadata=0x1,nw_dst=10.0.0.6 actions=conjunction(2,2/2)
# priority=2002,ip,metadata=0x1,nw_dst=10.0.0.4 actions=conjunction(2,2/2)
# priority=2002,ip,metadata=0x1,nw_dst=10.0.0.5 actions=conjunction(2,2/2)
# priority=2001,ip,metadata=0x1,nw_dst=10.0.0.7 actions=conjunction(3,2/2)
# priority=2001,ip,metadata=0x1,nw_dst=10.0.0.9 actions=conjunction(3,2/2)
# priority=2001,ip,metadata=0x1,nw_dst=10.0.0.8 actions=conjunction(3,2/2)
# priority=2002,ip,metadata=0x1,nw_src=10.0.0.6 actions=conjunction(2,1/2),conjunction(3,1/2)
# priority=2002,ip,metadata=0x1,nw_src=10.0.0.4 actions=conjunction(2,1/2),conjunction(3,1/2)
# priority=2002,ip,metadata=0x1,nw_src=10.0.0.5 actions=conjunction(2,1/2),conjunction(3,1/2)

ovs_wait_cond () {
    test 9 = `as hv1 ovs-ofctl dump-flows br-int | \
grep conjunction | wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12456" "until test 9 = \`as hv1 ovs-ofctl dump-flows br-int | \\
grep conjunction | wc -l\`"

ovs_wait_cond () {
    test 2 = `as hv1 ovs-ofctl dump-flows br-int | \
grep conj_id | wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12458" "until test 2 = \`as hv1 ovs-ofctl dump-flows br-int | \\
grep conj_id | wc -l\`"


as hv1 ovs-ofctl dump-flows br-int

# Set the ip address for ls1-lp2 from set2 so that the drop ACL flow is hit.
ovn-nbctl lsp-set-addresses ls1-lp2 "f0:00:00:00:00:02 10.0.0.7 20.0.0.4"
ovn-nbctl lsp-set-port-security ls1-lp2 "f0:00:00:00:00:02 10.0.0.7 20.0.0.4"

reset_pcap_file hv1-vif2 hv1/vif2

rm -f 2.packets

sip=`ip_to_hex 10 0 0 4`
dip=`ip_to_hex 10 0 0 7`

test_ip 1 f00000000001 f00000000002 $sip $dip
$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/vif2-tx.pcap > 2.packets
{ set +x
$as_echo "$at_srcdir/ovn.at:12476: cat 2.packets"
at_fn_check_prepare_trace "ovn.at:12476"
( $at_check_trace; cat 2.packets
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12476"
$at_failed && at_fn_log_failure
$at_traceon; }


ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_96
#AT_START_97
at_fn_group_banner 97 'ovn.at:12481' \
  "ovn -- L2 Drop and Allow ACL w/ Stateful ACL" "   " 2
at_xfail=no
(
  $as_echo "97. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

# Create hypervisors hv[123].
# Add vif11 to hv1, vif21 to hv2, vif31 to hv3.
# Add all of the vifs to a single logical switch lsw0.
# Create Port Group with vif11 and vif21
# Create Address Set with vif11 and vif21's MAC addresses
# Test 1:
#  Create Drop ACL to drop all packets with ethertype 1234 between 11 and 21
#  No ACL for 31
#  Validate the drop ACL with and without any stateful rule on lsw0.
# Test 2:
#  Create Drop ACL to drop all packets between 11 and 21
#  Create higher priority ACL to allow packet with ethertype 1234 between 11 and 21
#  No ACL for 31
#  Validate the allow ACL with and without any stateful rule on lsw0.
#
ovn-nbctl ls-add lsw0
net_add n1
for i in 1 2 3; do
    sim_add hv$i
    as hv$i
    ovs-vsctl add-br br-phys
    ovn_attach n1 br-phys 192.168.0.$i

    ovs-vsctl add-port br-int vif${i}1 -- set Interface vif${i}1 external-ids:iface-id=lp${i}1 options:tx_pcap=hv$i/vif${i}1-tx.pcap options:rxq_pcap=hv$i/vif${i}1-rx.pcap ofport-request=${i}1
    ovn-nbctl lsp-add lsw0 lp${i}1
    ovn-nbctl lsp-set-addresses lp${i}1 "f0:00:00:00:00:${i}1 192.168.0.${i}1" unknown
done
#

get_lsp_uuid () {
    ovn-nbctl lsp-list lsw0 | grep $1 | awk '{ print $1 }'
}

# Create Port Group and corresponding Address set.
ovn-nbctl create Port_Group name=pg1 ports=`get_lsp_uuid lp11`,`get_lsp_uuid lp21`
ovn-nbctl create Address_Set name=set1 addresses=\"f0:00:00:00:00:11\",\"f0:00:00:00:00:21\"

# Pre-populate the hypervisors' ARP tables so that we don't lose any
# packets for ARP resolution (native tunneling doesn't queue packets
# for ARP resolution).
{ set +x
$as_echo "$at_srcdir/ovn.at:12524: ovn_populate_arp__"
at_fn_check_prepare_trace "ovn.at:12524"
( $at_check_trace; ovn_populate_arp__
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12524"
$at_failed && at_fn_log_failure
$at_traceon; }


# Allow some time for ovn-northd and ovn-controller to catch up.
# XXX This should be more systematic.
sleep 1

# Make sure there is no attempt to adding duplicated flows by ovn-controller
$as_echo "ovn.at:12531" >"$at_check_line_file"
(test -n "`grep duplicate hv1/ovn-controller.log`") \
  && at_fn_check_skip 99 "$at_srcdir/ovn.at:12531"
$as_echo "ovn.at:12532" >"$at_check_line_file"
(test -n "`grep duplicate hv2/ovn-controller.log`") \
  && at_fn_check_skip 99 "$at_srcdir/ovn.at:12532"
$as_echo "ovn.at:12533" >"$at_check_line_file"
(test -n "`grep duplicate hv3/ovn-controller.log`") \
  && at_fn_check_skip 99 "$at_srcdir/ovn.at:12533"

# Given the name of a logical port, prints the name of the hypervisor
# on which it is located.
vif_to_hv() {
    echo hv${1%?}
}

# test_packet INPORT DST SRC ETHTYPE OUTPORT...
#
# This shell function causes a packet to be received on INPORT.  The packet's
# content has Ethernet destination DST and source SRC (each exactly 12 hex
# digits) and Ethernet type ETHTYPE (4 hex digits).  The OUTPORTs (zero or
# more) list the VIFs on which the packet should be received.  INPORT and the
# OUTPORTs are specified as logical switch port numbers, e.g. 11 for vif11.
for i in 1 2 3; do
    : > ${i}1.expected
done
test_packet() {
    local inport=$1 packet=$2$3$4; shift; shift; shift; shift
    hv=`vif_to_hv $inport`
    vif=vif$inport
    as $hv ovs-appctl netdev-dummy/receive $vif $packet
    for outport; do
        echo $packet >> $outport.expected
    done
}

# Test drop rule
# --------------
ovn-nbctl acl-del lsw0
ovn-nbctl --log --severity=info --name=drop-acl acl-add lsw0 to-lport 5000 'outport == @pg1 && eth.src == $set1 && eth.type == 0x1234' drop
for sf in 0 1; do
    if test ${sf} = 1; then
        # Add a stateful rule and re-run the check to make sure the
        # drop rule is still effective..
        ovn-nbctl acl-add lsw0 from-lport 2000  "inport == lp31 && ip" allow-related
    fi
    for is in 1 2 3; do
        s=${is}1
        for id in 1 2 3; do
            d=${id}1

            if test $d != $s;
            then
                if test ${is} = 3 || test ${id} = 3; then
                    test_packet $s f000000000$d f000000000$s 1234 $d # Allow to/from 31
                else
                    test_packet $s f000000000$d f000000000$s 1234    # Drop between 11 and 21
                fi
            fi
        done

        # Broadcast and multicast.
        if test ${is} = 3; then
            bcast="11 21" # Allow from 3
        else
            bcast="31"   # Allow only to 31 from 11 or 21.
        fi
        test_packet $s ffffffffffff f000000000$s 1234 $bcast
        test_packet $s 010000000000 f000000000$s 1234 $bcast
    done
done

# Test allow rule
#----------------
ovn-nbctl acl-del lsw0
# drop all packets to 11 and 21.
ovn-nbctl acl-add lsw0 to-lport 5000 'outport == @pg1 && eth.src == $set1' drop
# allow 0x1234 between 11 and 21
ovn-nbctl --log --severity=info --name=allow-acl acl-add lsw0 to-lport 6000 'outport == @pg1 && eth.src == $set1 && eth.type == 0x1234' allow
for sf in 0 1; do
    if test ${sf} = 1; then
        # Add a stateful rule and re-run the check to make sure the
        # allow rule is still effective..
        ovn-nbctl acl-add lsw0 from-lport 2000  "inport == lp31 && ip" allow-related
    fi
    for is in 1 2 3; do
        s=${is}1
        for id in 1 2 3; do
            d=${id}1

            if test $d != $s;
            then
                test_packet $s f000000000$d f000000000$s 1234 $d # allow 1234 to 11, 21, and 31
            fi
        done

        # Broadcast and multicast. Allow from one to the other 2.
        if test ${is} = 1; then
            bcast="21 31"
        elif test ${is} = 2; then
            bcast="11 31"
        else
            bcast="11 21"
        fi
        test_packet $s ffffffffffff f000000000$s 1234 $bcast
        test_packet $s 010000000000 f000000000$s 1234 $bcast
    done
done

# Clean up the ACL
ovn-nbctl acl-del lsw0

# dump information and flows with counters
ovn-sbctl dump-flows -- list multicast_group

echo "------ hv1 dump ------"
as hv1 ovs-vsctl show
as hv1 ovs-ofctl -O OpenFlow13 dump-flows br-int

echo "------ hv2 dump ------"
as hv2 ovs-vsctl show
as hv2 ovs-ofctl -O OpenFlow13 dump-flows br-int

echo "------ hv3 dump ------"
as hv3 ovs-vsctl show
as hv3 ovs-ofctl -O OpenFlow13 dump-flows br-int

# Now check the packets actually received against the ones expected.
for i in 1 2 3; do
    ovn_check_packets__ "hv$i/vif${i}1-tx.pcap" "${i}1.expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:12654: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:12654"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12654"
$at_failed && at_fn_log_failure
$at_traceon; }

done

# need to verify the log for ACL hit as well, since in the allow case
# (unlike the drop case) it is tricky to pass just with the expected;
# since with the stateful rule the packet will still get by (default
# rule) even if it doesn't hit the allow rule.
# The hit count for the ACL is 6 (1 unicast + 2 non-unicast) * 2
# (with/without stateful rule) for hv1 and hv2, each.

hv1_drop_acl_hit=`grep acl_log hv1/ovn-controller.log | grep "|INFO|name=\"drop-acl\"" | wc -l`
hv2_drop_acl_hit=`grep acl_log hv2/ovn-controller.log | grep "|INFO|name=\"drop-acl\"" | wc -l`

hv1_allow_acl_hit=`grep acl_log hv1/ovn-controller.log | grep "|INFO|name=\"allow-acl\"" | wc -l`
hv2_allow_acl_hit=`grep acl_log hv2/ovn-controller.log | grep "|INFO|name=\"allow-acl\"" | wc -l`

echo "hv1_drop hit $hv1_drop_acl_hit"
echo "hv2_drop hit $hv2_drop_acl_hit"
echo "hv1_allow hit $hv1_allow_acl_hit"
echo "hv2_allow hit $hv2_allow_acl_hit"

{ set +x
$as_echo "$at_srcdir/ovn.at:12675: test \$hv1_drop_acl_hit = 6"
at_fn_check_prepare_dynamic "test $hv1_drop_acl_hit = 6" "ovn.at:12675"
( $at_check_trace; test $hv1_drop_acl_hit = 6
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12675"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:12676: test \$hv2_drop_acl_hit = 6"
at_fn_check_prepare_dynamic "test $hv2_drop_acl_hit = 6" "ovn.at:12676"
( $at_check_trace; test $hv2_drop_acl_hit = 6
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12676"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn.at:12678: test \$hv1_allow_acl_hit = 6"
at_fn_check_prepare_dynamic "test $hv1_allow_acl_hit = 6" "ovn.at:12678"
( $at_check_trace; test $hv1_allow_acl_hit = 6
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12678"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:12679: test \$hv2_allow_acl_hit = 6"
at_fn_check_prepare_dynamic "test $hv2_allow_acl_hit = 6" "ovn.at:12679"
( $at_check_trace; test $hv2_allow_acl_hit = 6
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12679"
$at_failed && at_fn_log_failure
$at_traceon; }





    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:12681: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:12681"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12681"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12681: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:12681"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12681"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12681" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:12681: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:12681"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12681"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12681: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:12681"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12681"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12681" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:12681: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:12681"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12681"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12681: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:12681"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12681"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12681" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:12681: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:12681"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12681"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12681: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:12681"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12681"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12681" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:12681: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:12681"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12681"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12681: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:12681"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12681"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12681" "while kill -0 \$TMPPID 2>/dev/null"





    as hv2
    if test "hv2" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:12681: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:12681"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12681"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12681: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:12681"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12681"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12681" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:12681: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:12681"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12681"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12681: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:12681"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12681"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12681" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:12681: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:12681"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12681"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12681: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:12681"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12681"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12681" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv2
    { set +x
$as_echo "$at_srcdir/ovn.at:12681: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:12681"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12681"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12681: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:12681"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12681"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12681" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:12681: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:12681"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12681"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12681: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:12681"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12681"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12681" "while kill -0 \$TMPPID 2>/dev/null"





    as hv3
    if test "hv3" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:12681: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:12681"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12681"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12681: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:12681"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12681"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12681" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:12681: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:12681"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12681"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12681: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:12681"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12681"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12681" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:12681: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:12681"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12681"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12681: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:12681"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12681"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12681" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv3
    { set +x
$as_echo "$at_srcdir/ovn.at:12681: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:12681"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12681"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12681: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:12681"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12681"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12681" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:12681: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:12681"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12681"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12681: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:12681"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12681"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12681" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:12681: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:12681"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12681"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12681: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:12681"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12681"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12681" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:12681: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:12681"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12681"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12681: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:12681"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12681"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12681" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:12681: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:12681"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12681"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12681: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:12681"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12681"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12681" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:12681: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:12681"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12681"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12681: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:12681"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12681"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12681" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:12681: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:12681"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12681"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12681: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:12681"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12681"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12681" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:12681: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:12681"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12681"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12681: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:12681"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12681"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12681" "while kill -0 \$TMPPID 2>/dev/null"




ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_97
#AT_START_98
at_fn_group_banner 98 'ovn.at:12685' \
  "ovn -- TTL exceeded" "                            " 2
at_xfail=no
(
  $as_echo "98. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init


ovn_start

# test_ip_packet INPORT HV ETH_SRC ETH_DST IPV4_SRC IPV4_DST IPV4_ROUTER IP_CHKSUM EXP_IP_CHKSUM EXP_ICMP_CHKSUM
#
# Causes a packet to be received on INPORT of the hypervisor HV. The packet is an IPv4 packet with
# ETH_SRC, ETH_DST, IPV4_SRC, IPV4_DST, IP_CHKSUM as specified and TTL set to 1.
# EXP_IP_CHKSUM and EXP_ICMP_CHKSUM are the ip and icmp checksums of the icmp time exceeded frame
# generated by OVN logical router
#
# INPORT is a lport number, e.g. 11 for vif11.
# HV is a hypervisor number
# ETH_SRC and ETH_DST are each 12 hex digits.
# IPV4_SRC, IPV4_DST and IPV4_ROUTER are each 8 hex digits.
# IP_CHKSUM, EXP_IP_CHSUM and EXP_ICMP_CHKSUM are each 4 hex digits
test_ip_packet() {
    local inport=$1 hv=$2 eth_src=$3 eth_dst=$4 ipv4_src=$5 ipv4_dst=$6 ip_router=$7 ip_chksum=$8
    local exp_ip_chksum=$9 exp_icmp_chksum=${10}
    shift 10

    local ip_ttl=01
    local packet=${eth_dst}${eth_src}08004500001400004000${ip_ttl}01${ip_chksum}${ipv4_src}${ipv4_dst}

    local reply_icmp_ttl=fe
    local icmp_type_code_response=0b00
    local icmp_data=00000000
    local reply_icmp_payload=${icmp_type_code_response}${exp_icmp_chksum}${icmp_data}
    local reply=${eth_src}${eth_dst}08004500001c00004000${reply_icmp_ttl}01${exp_ip_chksum}${ip_router}${ipv4_src}${reply_icmp_payload}
    echo $reply >> vif$inport.expected

    as hv$hv ovs-appctl netdev-dummy/receive vif$inport $packet
}

# test_ip6_packet INPORT HV ETH_SRC ETH_DST IPV6_SRC IPV6_DST IPV6_ROUTER EXP_ICMP_CHKSUM
#
# Causes a packet to be received on INPORT of the hypervisor HV. The packet is an IPv6
# packet with ETH_SRC, ETH_DST, IPV6_SRC and IPV6_DST as specified.
# IPV6_ROUTER and EXP_ICMP_CHKSUM are the source IP and checksum of the icmpv6 ttl exceeded
# packet sent by OVN logical router
test_ip6_packet() {
    local inport=$1 hv=$2 eth_src=$3 eth_dst=$4 ipv6_src=$5 ipv6_dst=$6 ipv6_router=$7 exp_icmp_chksum=$8
    shift 8

    local ip6_hdr=6000000000151101${ipv6_src}${ipv6_dst}
    local packet=${eth_dst}${eth_src}86dd${ip6_hdr}dbb8303900155bac6b646f65206676676e6d66720a

    local reply=${eth_src}${eth_dst}86dd6000000000303afe${ipv6_router}${ipv6_src}0300${exp_icmp_chksum}00000000${ip6_hdr}
    echo $reply >> vif$inport.expected

    as hv$hv ovs-appctl netdev-dummy/receive vif$inport $packet
}

ip_to_hex() {
    printf "%02x%02x%02x%02x" "$@"
}

for i in 1 2; do
    net_add n$i
    ovn-nbctl ls-add sw$i

    sim_add hv$i
    as hv$i
    ovs-vsctl add-br br-phys
    ovn_attach n$i br-phys 192.168.$i.1

    ovn-nbctl lsp-add sw$i sw$i-p${i}0 -- \
        lsp-set-addresses sw$i-p${i}0 "00:00:00:00:00:0$i 192.168.$i.1 2001:db8:$i::11"

    ovs-vsctl -- add-port br-int vif$i -- \
        set interface vif$i \
        external-ids:iface-id=sw$i-p${i}0 \
            options:tx_pcap=hv$i/vif$i-tx.pcap \
            options:rxq_pcap=hv$i/vif$i-rx.pcap \
            ofport-request=$i
done

ovn-nbctl lr-add lr0
for i in 1 2; do
    ovn-nbctl lrp-add lr0 lrp$i 00:00:00:00:ff:0$i 192.168.$i.254/24 2001:db8:$i::1/64
    ovn-nbctl -- lsp-add sw$i lrp$i-attachment \
              -- set Logical_Switch_Port lrp$i-attachment type=router \
                options:router-port=lrp$i addresses='"00:00:00:00:ff:0'$i' 192.168.'$i'.254 2001:db8:'$i'::1"'
done

{ set +x
$as_echo "$at_srcdir/ovn.at:12770: ovn_populate_arp__"
at_fn_check_prepare_trace "ovn.at:12770"
( $at_check_trace; ovn_populate_arp__
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12770"
$at_failed && at_fn_log_failure
$at_traceon; }

# allow some time for ovn-northd and ovn-controller to catch up.
ovn-nbctl --wait=hv sync

test_ip_packet 1 1 000000000001 00000000ff01 $(ip_to_hex 192 168 1 1) $(ip_to_hex 192 168 2 1) $(ip_to_hex 192 168 1 254) 0000 7dae f4ff
test_ip6_packet 1 1 000000000001 00000000ff01 20010db8000100000000000000000011 20010db8000200000000000000000011 20010db8000100000000000000000001 d461
ovn_check_packets__ "hv1/vif1-tx.pcap" "vif1.expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:12776: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:12776"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12776"
$at_failed && at_fn_log_failure
$at_traceon; }





    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:12778: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:12778"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12778"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12778: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:12778"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12778"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12778" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:12778: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:12778"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12778"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12778: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:12778"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12778"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12778" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:12778: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:12778"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12778"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12778: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:12778"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12778"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12778" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:12778: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:12778"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12778"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12778: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:12778"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12778"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12778" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:12778: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:12778"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12778"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12778: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:12778"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12778"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12778" "while kill -0 \$TMPPID 2>/dev/null"





    as hv2
    if test "hv2" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:12778: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:12778"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12778"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12778: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:12778"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12778"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12778" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:12778: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:12778"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12778"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12778: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:12778"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12778"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12778" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:12778: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:12778"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12778"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12778: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:12778"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12778"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12778" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv2
    { set +x
$as_echo "$at_srcdir/ovn.at:12778: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:12778"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12778"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12778: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:12778"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12778"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12778" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:12778: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:12778"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12778"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12778: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:12778"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12778"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12778" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:12778: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:12778"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12778"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12778: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:12778"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12778"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12778" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:12778: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:12778"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12778"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12778: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:12778"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12778"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12778" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:12778: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:12778"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12778"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12778: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:12778"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12778"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12778" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:12778: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:12778"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12778"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12778: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:12778"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12778"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12778" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:12778: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:12778"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12778"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12778: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:12778"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12778"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12778" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:12778: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:12778"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12778"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12778: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:12778"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12778"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12778" "while kill -0 \$TMPPID 2>/dev/null"



ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_98
#AT_START_99
at_fn_group_banner 99 'ovn.at:12781' \
  "ovn -- router port unreachable" "                 " 2
at_xfail=no
(
  $as_echo "99. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init


ovn_start

# test_ip_packet INPORT HV ETH_SRC ETH_DST IPV4_SRC IPV4_ROUTER L4_PROTCOL IP_CHKSUM EXP_IP_CHKSUM EXP_ICMP_CHKSUM EXP_ICMP_CODE
#
# Causes a packet to be received on INPORT of the hypervisor HV. The packet is an IPv4 packet with
# ETH_SRC, ETH_DST, IPV4_SRC, IPV4_ROUTER, L4_PROTCOL, IP_CHKSUM as specified.
# EXP_IP_CHKSUM and EXP_ICMP_CHKSUM are the ip and icmp checksums of the icmp frame generated by OVN logical router
# EXP_ICMP_CODE are code and type of the icmp frame generated by OVN logical router
#
# INPORT is a lport number, e.g. 11 for vif11.
# HV is a hypervisor number
# ETH_SRC and ETH_DST are each 12 hex digits.
# IPV4_SRC and IPV4_ROUTER are each 8 hex digits.
# IP_CHKSUM, EXP_IP_CHSUM and EXP_ICMP_CHKSUM are each 4 hex digits
test_ip_packet() {
    local inport=$1 hv=$2 eth_src=$3 eth_dst=$4 ipv4_src=$5 ip_router=$6 l4_proto=$7 ip_chksum=$8
    local exp_ip_chksum=$9 exp_icmp_chksum=${10} exp_icmp_code=${11}
    shift 11

    local ip_ttl=ff
    local packet=${eth_dst}${eth_src}08004500001400004000${ip_ttl}${l4_proto}${ip_chksum}${ipv4_src}${ip_router}

    local reply_icmp_ttl=fe
    local icmp_data=00000000
    local reply_icmp_payload=${exp_icmp_code}${exp_icmp_chksum}${icmp_data}
    local reply=${eth_src}${eth_dst}08004500001c00004000${reply_icmp_ttl}01${exp_ip_chksum}${ip_router}${ipv4_src}${reply_icmp_payload}
    echo $reply >> vif$inport.expected

    as hv$hv ovs-appctl netdev-dummy/receive vif$inport $packet
}

# test_tcp_syn_packet INPORT HV ETH_SRC ETH_DST IPV4_SRC IPV4_ROUTER IP_CHKSUM TCP_SPORT TCP_DPORT TCP_CHKSUM EXP_IP_CHKSUM EXP_TCP_RST_CHKSUM
#
# Causes a packet to be received on INPORT of the hypervisor HV. The packet is an TCP syn segment with
# ETH_SRC, ETH_DST, IPV4_SRC, IPV4_ROUTER, IP_CHKSUM, TCP_SPORT, TCP_DPORT, TCP_CHKSUM  as specified.
# EXP_IP_CHKSUM and EXP_TCP_RST_CHKSUM are the ip and tcp checksums of the tcp reset segment generated by OVN logical router
#
# INPORT is an lport number, e.g. 11 for vif11.
# HV is an hypervisor number
# ETH_SRC and ETH_DST are each 12 hex digits.
# IPV4_SRC and IPV4_ROUTER are each 8 hex digits.
# TCP_SPORT and TCP_DPORT are 4 hex digits.
# IP_CHKSUM, TCP_CHKSUM, EXP_IP_CHSUM and EXP_TCP_RST_CHKSUM are each 4 hex digits
test_tcp_syn_packet() {
    local inport=$1 hv=$2 eth_src=$3 eth_dst=$4 ipv4_src=$5 ip_router=$6 ip_chksum=$7
    local tcp_sport=$8 tcp_dport=$9 tcp_chksum=${10}
    local exp_ip_chksum=${11} exp_tcp_rst_chksum=${12}
    shift 12

    local ip_ttl=ff
    local packet=${eth_dst}${eth_src}08004500002800004000${ip_ttl}06${ip_chksum}${ipv4_src}${ip_router}${tcp_sport}${tcp_dport}000000010000000050027210${tcp_chksum}0000

    local tcp_rst_ttl=3e
    local reply=${eth_src}${eth_dst}08004500002800004000${tcp_rst_ttl}06${exp_ip_chksum}${ip_router}${ipv4_src}${tcp_dport}${tcp_sport}000000000000000250140000${exp_tcp_rst_chksum}0000
    echo $reply >> vif$inport.expected

    as hv$hv ovs-appctl netdev-dummy/receive vif$inport $packet
}

# test_tcp6_packet INPORT HV ETH_SRC ETH_DST IPV6_SRC IPV6_ROUTER TCP_SPORT TCP_DPORT TCP_CHKSUM EXP_TCP_RST_CHKSUM
#
# Causes a packet to be received on INPORT of the hypervisor HV. The packet is a TCP syn segment with
# ETH_SRC, ETH_DST, IPV6_SRC, IPV6_ROUTER, TCP_SPORT, TCP_DPORT and TCP_CHKSUM as specified.
# EXP_TCP_RST_CHKSUM is the tcp checksums of the tcp reset segment generated by OVN logical router
test_tcp6_packet() {
    local inport=$1 hv=$2 eth_src=$3 eth_dst=$4 ipv6_src=$5 ipv6_router=$6
    local tcp_sport=$7 tcp_dport=$8 tcp_chksum=$9
    local exp_tcp_rst_chksum=${10}
    shift 10

    local ip6_hdr=60000000001406ff${ipv6_src}${ipv6_router}
    local packet=${eth_dst}${eth_src}86dd${ip6_hdr}${tcp_sport}${tcp_dport}000000010000000050027210${tcp_chksum}0000

    local reply=${eth_src}${eth_dst}86dd600000000014063e${ipv6_router}${ipv6_src}${tcp_dport}${tcp_sport}000000000000000250140000${exp_tcp_rst_chksum}0000
    echo $reply >> vif$inport.expected

    as hv$hv ovs-appctl netdev-dummy/receive vif$inport $packet
}

# test_ip6_packet INPORT HV ETH_SRC ETH_DST IPV6_SRC IPV6_DST IPV6_PROTO IPV6_LEN DATA EXP_ICMP_CODE EXP_ICMP_CHKSUM
#
# Causes a packet to be received on INPORT of the hypervisor HV. The packet is an IPv6
# packet with ETH_SRC, ETH_DST, IPV6_SRC, IPV6_DST, IPV6_PROTO, IPV6_LEN and DATA as specified.
# EXP_ICMP_CODE and EXP_ICMP_CHKSUM are the code and checksum of the icmp6 packet sent by OVN logical router
test_ip6_packet() {
    local inport=$1 hv=$2 eth_src=$3 eth_dst=$4 ipv6_src=$5 ipv6_dst=$6 ipv6_proto=$7 ipv6_len=$8 data=$9
    local exp_icmp_code=${10} exp_icmp_chksum=${11}
    shift 11

    local ip6_hdr=60000000${ipv6_len}${ipv6_proto}ff${ipv6_src}${ipv6_dst}
    local packet=${eth_dst}${eth_src}86dd${ip6_hdr}${data}

    local reply=${eth_src}${eth_dst}86dd6000000000303afe${ipv6_dst}${ipv6_src}${exp_icmp_code}${exp_icmp_chksum}00000000${ip6_hdr}
    echo $reply >> vif$inport.expected

    as hv$hv ovs-appctl netdev-dummy/receive vif$inport $packet
}

ip_to_hex() {
    printf "%02x%02x%02x%02x" "$@"
}

for i in 1 2; do
    net_add n$i
    ovn-nbctl ls-add sw$i

    sim_add hv$i
    as hv$i
    ovs-vsctl add-br br-phys
    ovn_attach n$i br-phys 192.168.$i.1

    ovn-nbctl lsp-add sw$i sw$i-p${i}0 -- \
        lsp-set-addresses sw$i-p${i}0 "00:00:00:00:00:0$i 192.168.$i.1 2001:db8:$i::11"

    ovs-vsctl -- add-port br-int vif$i -- \
        set interface vif$i \
        external-ids:iface-id=sw$i-p${i}0 \
            options:tx_pcap=hv$i/vif$i-tx.pcap \
            options:rxq_pcap=hv$i/vif$i-rx.pcap \
            ofport-request=$i
done

ovn-nbctl lr-add lr0
for i in 1 2; do
    ovn-nbctl lrp-add lr0 lrp$i 00:00:00:00:ff:0$i 192.168.$i.254/24 2001:db8:$i::1/64
    ovn-nbctl -- lsp-add sw$i lrp$i-attachment \
              -- set Logical_Switch_Port lrp$i-attachment type=router \
                options:router-port=lrp$i addresses='"00:00:00:00:ff:0'$i' 192.168.'$i'.254 2001:db8:'$i'::1"'
done

{ set +x
$as_echo "$at_srcdir/ovn.at:12913: ovn_populate_arp__"
at_fn_check_prepare_trace "ovn.at:12913"
( $at_check_trace; ovn_populate_arp__
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12913"
$at_failed && at_fn_log_failure
$at_traceon; }

# allow some time for ovn-northd and ovn-controller to catch up.
ovn-nbctl --wait=hv sync

test_ip_packet 1 1 000000000001 00000000ff01 $(ip_to_hex 192 168 1 1) $(ip_to_hex 192 168 1 254) 11 0000 7dae fcfc 0303
test_ip_packet 1 1 000000000001 00000000ff01 $(ip_to_hex 192 168 1 1) $(ip_to_hex 192 168 1 254) 84 0000 7dae fcfd 0302
test_ip6_packet 1 1 000000000001 00000000ff01 20010db8000100000000000000000011 20010db8000100000000000000000001 11 0015 dbb8303900155bac6b646f65206676676e6d66720a 0104 d570
ovn_check_packets__ "hv1/vif1-tx.pcap" "vif1.expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:12920: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:12920"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12920"
$at_failed && at_fn_log_failure
$at_traceon; }


test_tcp_syn_packet 2 2 000000000002 00000000ff02 $(ip_to_hex 192 168 2 1) $(ip_to_hex 192 168 2 254) 0000 8b40 3039 0000 b680 6e05
test_ip6_packet 2 2 000000000002 00000000ff02 20010db8000200000000000000000011 20010db8000200000000000000000001 84 0004 01020304 0103 627e
test_tcp6_packet 2 2 000000000002 00000000ff02 20010db8000200000000000000000011 20010db8000200000000000000000001 8b40 3039 0000 98cd
ovn_check_packets__ "hv2/vif2-tx.pcap" "vif2.expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:12925: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:12925"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12925"
$at_failed && at_fn_log_failure
$at_traceon; }





    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:12927: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:12927"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12927"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12927: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:12927"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12927"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12927" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:12927: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:12927"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12927"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12927: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:12927"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12927"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12927" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:12927: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:12927"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12927"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12927: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:12927"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12927"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12927" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:12927: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:12927"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12927"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12927: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:12927"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12927"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12927" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:12927: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:12927"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12927"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12927: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:12927"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12927"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12927" "while kill -0 \$TMPPID 2>/dev/null"





    as hv2
    if test "hv2" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:12927: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:12927"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12927"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12927: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:12927"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12927"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12927" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:12927: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:12927"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12927"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12927: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:12927"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12927"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12927" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:12927: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:12927"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12927"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12927: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:12927"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12927"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12927" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv2
    { set +x
$as_echo "$at_srcdir/ovn.at:12927: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:12927"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12927"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12927: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:12927"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12927"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12927" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:12927: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:12927"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12927"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12927: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:12927"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12927"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12927" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:12927: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:12927"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12927"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12927: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:12927"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12927"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12927" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:12927: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:12927"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12927"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12927: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:12927"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12927"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12927" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:12927: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:12927"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12927"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12927: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:12927"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12927"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12927" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:12927: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:12927"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12927"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12927: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:12927"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12927"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12927" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:12927: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:12927"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12927"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12927: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:12927"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12927"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12927" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:12927: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:12927"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12927"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:12927: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:12927"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12927"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:12927" "while kill -0 \$TMPPID 2>/dev/null"



ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_99
#AT_START_100
at_fn_group_banner 100 'ovn.at:12930' \
  "ovn -- ovn-controller exit" "                     " 2
at_xfail=no
(
  $as_echo "100. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start
# Logical network:
# One Logical Router: ro, with two logical switches sw1 and sw2.
# sw1 is for subnet 10.0.0.0/8
# sw2 is for subnet 20.0.0.0/8
# sw1 has a single port bound on hv1
# sw2 has a single port bound on hv2

ovn-nbctl lr-add ro
ovn-nbctl ls-add sw1
ovn-nbctl ls-add sw2

sw1_ro_mac=00:00:10:00:00:01
sw1_ro_ip=10.0.0.1
sw2_ro_mac=00:00:20:00:00:01
sw2_ro_ip=20.0.0.1
sw1_p1_mac=00:00:10:00:00:02
sw1_p1_ip=10.0.0.2
sw2_p1_mac=00:00:20:00:00:02
sw2_p1_ip=20.0.0.2

ovn-nbctl lrp-add ro ro-sw1 $sw1_ro_mac ${sw1_ro_ip}/8
ovn-nbctl lrp-add ro ro-sw2 $sw2_ro_mac ${sw2_ro_ip}/8
ovn-nbctl lsp-add sw1 sw1-ro -- set Logical_Switch_Port sw1-ro type=router \
  options:router-port=ro-sw1 addresses=\"$sw1_ro_mac\"
ovn-nbctl lsp-add sw2 sw2-ro -- set Logical_Switch_Port sw2-ro type=router \
  options:router-port=ro-sw2 addresses=\"$sw2_ro_mac\"

ovn-nbctl lsp-add sw1 sw1-p1 \
-- lsp-set-addresses sw1-p1 "$sw1_p1_mac $sw1_p1_ip"

ovn-nbctl lsp-add sw2 sw2-p1 \
-- lsp-set-addresses sw2-p1 "$sw2_p1_mac $sw2_p1_ip"

net_add n1

sim_add hv1
as hv1
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.1
ovs-vsctl -- add-port br-int hv1-vif1 -- \
    set interface hv1-vif1 external-ids:iface-id=sw1-p1 \
    options:tx_pcap=hv1/vif1-tx.pcap \
    options:rxq_pcap=hv1/vif1-rx.pcap \
    ofport-request=1

sim_add hv2
as hv2
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.2
ovs-vsctl -- add-port br-int hv2-vif1 -- \
    set interface hv2-vif1 external-ids:iface-id=sw2-p1 \
    options:tx_pcap=hv2/vif1-tx.pcap \
    options:rxq_pcap=hv2/vif1-rx.pcap \
    ofport-request=1

{ set +x
$as_echo "$at_srcdir/ovn.at:12987: ovn_populate_arp__"
at_fn_check_prepare_trace "ovn.at:12987"
( $at_check_trace; ovn_populate_arp__
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:12987"
$at_failed && at_fn_log_failure
$at_traceon; }


sleep 1

packet="inport==\"sw1-p1\" && eth.src==$sw1_p1_mac && eth.dst==$sw1_ro_mac &&
       ip4 && ip.ttl==64 && ip4.src==$sw1_p1_ip && ip4.dst==$sw2_p1_ip &&
       udp && udp.src==53 && udp.dst==4369"

# Start by Sending the packet and make sure it makes it there as expected
as hv1 ovs-appctl -t ovn-controller inject-pkt "$packet"

# Expected packet has TTL decreased by 1
expected="eth.src==$sw2_ro_mac && eth.dst==$sw2_p1_mac &&
       ip4 && ip.ttl==63 && ip4.src==$sw1_p1_ip && ip4.dst==$sw2_p1_ip &&
       udp && udp.src==53 && udp.dst==4369"
echo $expected | ovstest test-ovn expr-to-packets > expected

ovn_check_packets__ "hv2/vif1-tx.pcap" "expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:13004: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:13004"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13004"
$at_failed && at_fn_log_failure
$at_traceon; }


# Stop ovn-controller on hv2
as hv2 ovs-appctl -t ovn-controller exit

# Now send the packet again. This time, it should not arrive.
as hv1 ovs-appctl -t ovn-controller inject-pkt "$packet"

ovn_check_packets__ "hv2/vif1-tx.pcap" "expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:13012: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:13012"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13012"
$at_failed && at_fn_log_failure
$at_traceon; }


# Start ovn-controller again just so OVN_CLEANUP doesn't complain
as hv2 start_daemon ovn-controller




    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:13017: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:13017"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13017"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:13017: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:13017"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13017"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13017" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:13017: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:13017"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13017"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:13017: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:13017"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13017"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13017" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:13017: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:13017"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13017"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:13017: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:13017"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13017"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13017" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:13017: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:13017"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13017"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:13017: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:13017"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13017"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13017" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:13017: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:13017"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13017"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:13017: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:13017"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13017"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13017" "while kill -0 \$TMPPID 2>/dev/null"





    as hv2
    if test "hv2" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:13017: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:13017"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13017"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:13017: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:13017"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13017"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13017" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:13017: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:13017"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13017"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:13017: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:13017"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13017"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13017" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:13017: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:13017"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13017"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:13017: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:13017"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13017"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13017" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv2
    { set +x
$as_echo "$at_srcdir/ovn.at:13017: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:13017"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13017"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:13017: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:13017"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13017"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13017" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:13017: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:13017"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13017"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:13017: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:13017"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13017"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13017" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:13017: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:13017"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13017"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:13017: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:13017"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13017"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13017" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:13017: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:13017"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13017"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:13017: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:13017"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13017"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13017" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:13017: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:13017"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13017"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:13017: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:13017"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13017"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13017" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:13017: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:13017"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13017"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:13017: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:13017"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13017"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13017" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:13017: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:13017"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13017"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:13017: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:13017"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13017"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13017" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:13017: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:13017"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13017"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:13017: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:13017"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13017"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13017" "while kill -0 \$TMPPID 2>/dev/null"



ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_100
#AT_START_101
at_fn_group_banner 101 'ovn.at:13020' \
  "ovn -- external logical port" "                   " 2
at_xfail=no
(
  $as_echo "101. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

net_add n1
sim_add hv1
sim_add hv2
sim_add hv3

ovn-nbctl ls-add ls1
ovn-nbctl lsp-add ls1 ls1-lp1 \
-- lsp-set-addresses ls1-lp1 "f0:00:00:00:00:01 10.0.0.4 ae70::4"

# Add a couple of external logical port
ovn-nbctl lsp-add ls1 ls1-lp_ext1 \
-- lsp-set-addresses ls1-lp_ext1 "f0:00:00:00:00:03 10.0.0.6 ae70::6"
ovn-nbctl lsp-set-port-security ls1-lp_ext1 \
"f0:00:00:00:00:03 10.0.0.6 ae70::6"
ovn-nbctl lsp-set-type ls1-lp_ext1 external

ovn-nbctl lsp-add ls1 ls1-lp_ext2 \
-- lsp-set-addresses ls1-lp_ext2 "f0:00:00:00:00:04 10.0.0.7 ae70::7"
ovn-nbctl lsp-set-port-security ls1-lp_ext2 \
"f0:00:00:00:00:04 10.0.0.7 ae70::8"
ovn-nbctl lsp-set-type ls1-lp_ext2 external

d1="$(ovn-nbctl create DHCP_Options cidr=10.0.0.0/24 \
options="\"server_id\"=\"10.0.0.1\" \"server_mac\"=\"ff:10:00:00:00:01\" \
\"lease_time\"=\"3600\" \"router\"=\"10.0.0.1\"")"

d2="$(ovn-nbctl create DHCP_Options cidr="ae70\:\:/64" \
options="\"server_id\"=\"00:00:00:10:00:01\"")"

ovn-nbctl lsp-set-dhcpv4-options ls1-lp1 ${d1}
ovn-nbctl lsp-set-dhcpv4-options ls1-lp_ext1 ${d1}
ovn-nbctl lsp-set-dhcpv4-options ls1-lp_ext2 ${d1}

ovn-nbctl lsp-set-dhcpv6-options ls1-lp1 ${d2}
ovn-nbctl lsp-set-dhcpv6-options ls1-lp_ext1 ${d2}
ovn-nbctl lsp-set-dhcpv6-options ls1-lp_ext2 ${d2}

# Create a logical router and connect it to ls1
ovn-nbctl lr-add lr0
ovn-nbctl lrp-add lr0 lr0-ls1 a0:10:00:00:00:01 10.0.0.1/24
ovn-nbctl lsp-add ls1 ls1-lr0
ovn-nbctl set Logical_Switch_Port ls1-lr0 type=router \
    options:router-port=lr0-ls1 addresses=router

# Create HA chassis group
ovn-nbctl ha-chassis-group-add hagrp1
ovn-nbctl ha-chassis-group-add-chassis hagrp1 hv1 30

hagrp1_uuid=`ovn-nbctl --bare --columns _uuid find ha_chassis_group name="hagrp1"`

# There should be 1 HA_Chassis rows with chassis sets
ovs_wait_cond () {
    ovn-sbctl list ha_chassis | grep chassis | awk '{print $3}' \
| grep '-' | wc -l
}
ovs_wait_failed () {
    :
    0
}
ovs_wait "ovn.at:13074" "until ovn-sbctl list ha_chassis | grep chassis | awk '{print \$3}' \\
| grep '-' | wc -l "


as hv1
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.1
ovs-vsctl -- add-port br-phys hv1-ext1 -- \
    set interface hv1-ext1 options:tx_pcap=hv1/ext1-tx.pcap \
    options:rxq_pcap=hv1/ext1-rx.pcap \
    ofport-request=2
ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys

as hv2
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.2
ovs-vsctl -- add-port br-phys hv2-ext2 -- \
    set interface hv2-ext2 options:tx_pcap=hv2/ext2-tx.pcap \
    options:rxq_pcap=hv2/ext2-rx.pcap \
    ofport-request=2
ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys

as hv3
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.3
ovs-vsctl -- add-port br-phys hv3-ext3 -- \
    set interface hv3-ext3 options:tx_pcap=hv3/ext3-tx.pcap \
    options:rxq_pcap=hv3/ext3-rx.pcap \
    ofport-request=2
ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys

# No DHCPv4/v6 flows for the external port - ls1-lp_ext1 - 10.0.0.6 in hv1 and
# hv2 as ha-chassis-group is not set and no localnet port added to ls1.
{ set +x
$as_echo "$at_srcdir/ovn.at:13107: ovn-sbctl dump-flows ls1 | grep \"offerip = 10.0.0.6\" | \\
wc -l"
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:13107"
( $at_check_trace; ovn-sbctl dump-flows ls1 | grep "offerip = 10.0.0.6" | \
wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13107"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:13110: as hv1 ovs-ofctl dump-flows br-int | grep table=22 | \\
grep controller | grep \"0a.00.00.06\" | wc -l"
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:13110"
( $at_check_trace; as hv1 ovs-ofctl dump-flows br-int | grep table=22 | \
grep controller | grep "0a.00.00.06" | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13110"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:13113: as hv2 ovs-ofctl dump-flows br-int | grep table=22 | \\
grep controller | grep \"0a.00.00.06\" | wc -l"
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:13113"
( $at_check_trace; as hv2 ovs-ofctl dump-flows br-int | grep table=22 | \
grep controller | grep "0a.00.00.06" | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13113"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:13116: as hv1 ovs-ofctl dump-flows br-int | grep table=22 | \\
grep controller | grep tp_src=546 | grep \\
\"ae.70.00.00.00.00.00.00.00.00.00.00.00.00.00.06\" | wc -l"
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:13116"
( $at_check_trace; as hv1 ovs-ofctl dump-flows br-int | grep table=22 | \
grep controller | grep tp_src=546 | grep \
"ae.70.00.00.00.00.00.00.00.00.00.00.00.00.00.06" | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13116"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:13120: as hv2 ovs-ofctl dump-flows br-int | grep table=22 | \\
grep controller | grep tp_src=546 | grep \\
\"ae.70.00.00.00.00.00.00.00.00.00.00.00.00.00.06\" | wc -l"
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:13120"
( $at_check_trace; as hv2 ovs-ofctl dump-flows br-int | grep table=22 | \
grep controller | grep tp_src=546 | grep \
"ae.70.00.00.00.00.00.00.00.00.00.00.00.00.00.06" | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13120"
$at_failed && at_fn_log_failure
$at_traceon; }


hv1_uuid=$(ovn-sbctl list chassis hv1 | grep uuid | awk '{print $3}')
hv2_uuid=$(ovn-sbctl list chassis hv2 | grep uuid | awk '{print $3}')
hv3_uuid=$(ovn-sbctl list chassis hv3 | grep uuid | awk '{print $3}')

# The port_binding row for ls1-lp_ext1 should have empty chassis
chassis=`ovn-sbctl --bare --columns chassis find port_binding \
logical_port=ls1-lp_ext1`

{ set +x
$as_echo "$at_srcdir/ovn.at:13133: test x\$chassis == x"
at_fn_check_prepare_dynamic "test x$chassis == x" "ovn.at:13133"
( $at_check_trace; test x$chassis == x
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13133"
$at_failed && at_fn_log_failure
$at_traceon; }


# Associate hagrp1 ha-chassis-group to ls1-lp_ext1
ovn-nbctl --wait=hv set Logical_Switch_Port ls1-lp_ext1 \
ha-chassis-group=$hagrp1_uuid

# Get the hagrp1 uuid in SB DB.
sb_hagrp1_uuid=`ovn-sbctl --bare --columns _uuid find ha_chassis_group \
name="hagrp1"`

# Wait till ls1-lp_ext1 port_binding has ha_chassis_group set
ovs_wait_cond () {
    sb_pb_hagrp=`ovn-sbctl --bare --columns ha_chassis_group find \
port_binding logical_port=ls1-lp_ext1`
     test "$sb_pb_hagrp" = "$sb_hagrp1_uuid"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13144" "until sb_pb_hagrp=\`ovn-sbctl --bare --columns ha_chassis_group find \\
port_binding logical_port=ls1-lp_ext1\`
     test \"\$sb_pb_hagrp\" = \"\$sb_hagrp1_uuid\""


# No DHCPv4/v6 flows for the external port - ls1-lp_ext1 - 10.0.0.6 in hv1 and hv2
# as no localnet port added to ls1 yet.
{ set +x
$as_echo "$at_srcdir/ovn.at:13151: as hv1 ovs-ofctl dump-flows br-int | grep table=22 | \\
grep controller | grep \"0a.00.00.06\" | wc -l"
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:13151"
( $at_check_trace; as hv1 ovs-ofctl dump-flows br-int | grep table=22 | \
grep controller | grep "0a.00.00.06" | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13151"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:13154: as hv2 ovs-ofctl dump-flows br-int | grep table=22 | \\
grep controller | grep \"0a.00.00.06\" | wc -l"
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:13154"
( $at_check_trace; as hv2 ovs-ofctl dump-flows br-int | grep table=22 | \
grep controller | grep "0a.00.00.06" | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13154"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:13157: as hv1 ovs-ofctl dump-flows br-int | grep table=22 | \\
grep controller | grep tp_src=546 | grep \\
\"ae.70.00.00.00.00.00.00.00.00.00.00.00.00.00.06\" | wc -l"
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:13157"
( $at_check_trace; as hv1 ovs-ofctl dump-flows br-int | grep table=22 | \
grep controller | grep tp_src=546 | grep \
"ae.70.00.00.00.00.00.00.00.00.00.00.00.00.00.06" | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13157"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:13161: as hv2 ovs-ofctl dump-flows br-int | grep table=22 | \\
grep controller | grep tp_src=546 | grep \\
\"ae.70.00.00.00.00.00.00.00.00.00.00.00.00.00.06\" | wc -l"
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:13161"
( $at_check_trace; as hv2 ovs-ofctl dump-flows br-int | grep table=22 | \
grep controller | grep tp_src=546 | grep \
"ae.70.00.00.00.00.00.00.00.00.00.00.00.00.00.06" | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13161"
$at_failed && at_fn_log_failure
$at_traceon; }


# Add the localnet port to the logical switch ls1
ovn-nbctl lsp-add ls1 ln-public
ovn-nbctl lsp-set-addresses ln-public unknown
ovn-nbctl lsp-set-type ln-public localnet
ovn-nbctl --wait=hv lsp-set-options ln-public network_name=phys

ln_public_key=$(ovn-sbctl list port_binding ln-public | grep  tunnel_key | \
awk '{print $3}')

# The ls1-lp_ext1 should be bound to hv1 as only hv1 is part of the
# ha chassis group.
ovs_wait_cond () {
    chassis=`ovn-sbctl --bare --columns chassis find port_binding \
logical_port=ls1-lp_ext1`
    test "$chassis" = "$hv1_uuid"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13177" "until chassis=\`ovn-sbctl --bare --columns chassis find port_binding \\
logical_port=ls1-lp_ext1\`
    test \"\$chassis\" = \"\$hv1_uuid\""


# There should be DHCPv4/v6 OF flows for the ls1-lp_ext1 port in hv1
{ set +x
$as_echo "$at_srcdir/ovn.at:13183: as hv1 ovs-ofctl dump-flows br-int | grep table=22 | \\
grep controller | grep \"0a.00.00.06\" | grep reg14=0x\$ln_public_key | \\
wc -l"
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:13183"
( $at_check_trace; as hv1 ovs-ofctl dump-flows br-int | grep table=22 | \
grep controller | grep "0a.00.00.06" | grep reg14=0x$ln_public_key | \
wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "3
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13183"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:13187: as hv1 ovs-ofctl dump-flows br-int | grep table=22 | \\
grep controller | grep tp_src=546 | grep \\
\"ae.70.00.00.00.00.00.00.00.00.00.00.00.00.00.06\" | \\
grep reg14=0x\$ln_public_key | wc -l"
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:13187"
( $at_check_trace; as hv1 ovs-ofctl dump-flows br-int | grep table=22 | \
grep controller | grep tp_src=546 | grep \
"ae.70.00.00.00.00.00.00.00.00.00.00.00.00.00.06" | \
grep reg14=0x$ln_public_key | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13187"
$at_failed && at_fn_log_failure
$at_traceon; }


# There should be no DHCPv4/v6 flows for ls1-lp_ext1 on hv2
{ set +x
$as_echo "$at_srcdir/ovn.at:13194: as hv2 ovs-ofctl dump-flows br-int | grep table=22 | \\
grep controller | grep \"0a.00.00.06\" | wc -l"
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:13194"
( $at_check_trace; as hv2 ovs-ofctl dump-flows br-int | grep table=22 | \
grep controller | grep "0a.00.00.06" | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13194"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:13197: as hv2 ovs-ofctl dump-flows br-int | grep table=22 | \\
grep controller | grep tp_src=546 | grep \\
\"ae.70.00.00.00.00.00.00.00.00.00.00.00.00.00.06\" | wc -l"
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:13197"
( $at_check_trace; as hv2 ovs-ofctl dump-flows br-int | grep table=22 | \
grep controller | grep tp_src=546 | grep \
"ae.70.00.00.00.00.00.00.00.00.00.00.00.00.00.06" | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13197"
$at_failed && at_fn_log_failure
$at_traceon; }


# No DHCPv4/v6 flows for the external port - ls1-lp_ext2 - 10.0.0.7 in hv1 and
# hv2 as requested-chassis option is not set.
{ set +x
$as_echo "$at_srcdir/ovn.at:13204: as hv1 ovs-ofctl dump-flows br-int | grep table=22 | \\
grep controller | grep \"0a.00.00.07\" | wc -l"
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:13204"
( $at_check_trace; as hv1 ovs-ofctl dump-flows br-int | grep table=22 | \
grep controller | grep "0a.00.00.07" | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13204"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:13207: as hv2 ovs-ofctl dump-flows br-int | grep table=22 | \\
grep controller | grep \"0a.00.00.07\" | wc -l"
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:13207"
( $at_check_trace; as hv2 ovs-ofctl dump-flows br-int | grep table=22 | \
grep controller | grep "0a.00.00.07" | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13207"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:13210: as hv1 ovs-ofctl dump-flows br-int | grep table=22 | \\
grep controller | grep tp_src=546 | grep \\
\"ae.70.00.00.00.00.00.00.00.00.00.00.00.00.00.07\" | wc -l"
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:13210"
( $at_check_trace; as hv1 ovs-ofctl dump-flows br-int | grep table=22 | \
grep controller | grep tp_src=546 | grep \
"ae.70.00.00.00.00.00.00.00.00.00.00.00.00.00.07" | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13210"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:13214: as hv2 ovs-ofctl dump-flows br-int | grep table=22 | \\
grep controller | grep tp_src=546 | grep \\
\"ae.70.00.00.00.00.00.00.00.00.00.00.00.00.00.07\" | wc -l"
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:13214"
( $at_check_trace; as hv2 ovs-ofctl dump-flows br-int | grep table=22 | \
grep controller | grep tp_src=546 | grep \
"ae.70.00.00.00.00.00.00.00.00.00.00.00.00.00.07" | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13214"
$at_failed && at_fn_log_failure
$at_traceon; }


as hv1
ovs-vsctl show

# This shell function sends a DHCP request packet
# test_dhcp INPORT SRC_MAC DHCP_TYPE OFFER_IP ...
test_dhcp() {
    local inport=$1 src_mac=$2 dhcp_type=$3 offer_ip=$4 use_ip=$5
    shift; shift; shift; shift; shift;
    if test $use_ip != 0; then
        src_ip=$1
        dst_ip=$2
        shift; shift;
    else
        src_ip=`ip_to_hex 0 0 0 0`
        dst_ip=`ip_to_hex 255 255 255 255`
    fi
    local request=ffffffffffff${src_mac}0800451001100000000080110000${src_ip}${dst_ip}
    # udp header and dhcp header
    request=${request}0044004300fc0000
    request=${request}010106006359aa760000000000000000000000000000000000000000${src_mac}
    # client hardware padding
    request=${request}00000000000000000000
    # server hostname
    request=${request}0000000000000000000000000000000000000000000000000000000000000000
    request=${request}0000000000000000000000000000000000000000000000000000000000000000
    # boot file name
    request=${request}0000000000000000000000000000000000000000000000000000000000000000
    request=${request}0000000000000000000000000000000000000000000000000000000000000000
    request=${request}0000000000000000000000000000000000000000000000000000000000000000
    request=${request}0000000000000000000000000000000000000000000000000000000000000000
    # dhcp magic cookie
    request=${request}63825363
    # dhcp message type
    request=${request}3501${dhcp_type}ff

    local srv_mac=$1 srv_ip=$2 expected_dhcp_opts=$3
    # total IP length will be the IP length of the request packet
    # (which is 272 in our case) + 8 (padding bytes) + (expected_dhcp_opts / 2)
    ip_len=`expr 280 + ${#expected_dhcp_opts} / 2`
    udp_len=`expr $ip_len - 20`
    ip_len=$(printf "%x" $ip_len)
    udp_len=$(printf "%x" $udp_len)
    # $ip_len var will be in 3 digits i.e 134. So adding a '0' before $ip_len
    local reply=${src_mac}${srv_mac}080045100${ip_len}000000008011XXXX${srv_ip}${offer_ip}
    # udp header and dhcp header.
    # $udp_len var will be in 3 digits. So adding a '0' before $udp_len
    reply=${reply}004300440${udp_len}0000020106006359aa760000000000000000
    # your ip address
    reply=${reply}${offer_ip}
    # next server ip address, relay agent ip address, client mac address
    reply=${reply}0000000000000000${src_mac}
    # client hardware padding
    reply=${reply}00000000000000000000
    # server hostname
    reply=${reply}0000000000000000000000000000000000000000000000000000000000000000
    reply=${reply}0000000000000000000000000000000000000000000000000000000000000000
    # boot file name
    reply=${reply}0000000000000000000000000000000000000000000000000000000000000000
    reply=${reply}0000000000000000000000000000000000000000000000000000000000000000
    reply=${reply}0000000000000000000000000000000000000000000000000000000000000000
    reply=${reply}0000000000000000000000000000000000000000000000000000000000000000
    # dhcp magic cookie
    reply=${reply}63825363
    # dhcp message type
    local dhcp_reply_type=02
    if test $dhcp_type = 03; then
        dhcp_reply_type=05
    fi
    reply=${reply}3501${dhcp_reply_type}${expected_dhcp_opts}00000000ff00000000
    echo $reply >> ext1_v4.expected

    as hv1 ovs-appctl netdev-dummy/receive hv${inport}-ext${inport} $request
}


trim_zeros() {
    sed 's/\(00\)\{1,\}$//'
}

# This shell function sends a DHCPv6 request packet
# test_dhcpv6 INPORT SRC_MAC SRC_LLA DHCPv6_MSG_TYPE OFFER_IP OUTPORT...
# The OUTPORTs (zero or more) list the VIFs on which the original DHCPv6
# packet should be received twice (one from ovn-controller and the other
# from the "ovs-ofctl monitor br-int resume"
test_dhcpv6() {
    local inport=$1 src_mac=$2 src_lla=$3 msg_code=$4 offer_ip=$5
    local req_pkt_in_expected=$6
    local request=ffffffffffff${src_mac}86dd00000000002a1101${src_lla}
    # dst ip ff02::1:2
    request=${request}ff020000000000000000000000010002
    # udp header and dhcpv6 header
    request=${request}02220223002affff${msg_code}010203
    # Client identifier
    request=${request}0001000a00030001${src_mac}
    # IA-NA (Identity Association for Non Temporary Address)
    request=${request}0003000c0102030400000e1000001518
    shift; shift; shift; shift; shift;

    local server_mac=000000100001
    local server_lla=fe80000000000000020000fffe100001
    local reply_code=07
    if test $msg_code = 01; then
        reply_code=02
    fi
    local msg_len=54
    if test $offer_ip = 1; then
        msg_len=28
    fi
    local reply=${src_mac}${server_mac}86dd0000000000${msg_len}1101
    reply=${reply}${server_lla}${src_lla}

    # udp header and dhcpv6 header
    reply=${reply}0223022200${msg_len}ffff${reply_code}010203
    # Client identifier
    reply=${reply}0001000a00030001${src_mac}
    # IA-NA
    if test $offer_ip != 1; then
        reply=${reply}0003002801020304ffffffffffffffff00050018${offer_ip}
        reply=${reply}ffffffffffffffff
    fi
    # Server identifier
    reply=${reply}0002000a00030001${server_mac}

    echo $reply | trim_zeros >> ext${inport}_v6.expected
    # The inport also receives the request packet since it is connected
    # to the br-phys.
    #echo $request >> ext${inport}_v6.expected

    as hv1 ovs-appctl netdev-dummy/receive hv${inport}-ext${inport} $request
}

reset_pcap_file() {
    local iface=$1
    local pcap_file=$2
    ovs-vsctl -- set Interface $iface options:tx_pcap=dummy-tx.pcap \
options:rxq_pcap=dummy-rx.pcap
    rm -f ${pcap_file}*.pcap
    ovs-vsctl -- set Interface $iface options:tx_pcap=${pcap_file}-tx.pcap \
options:rxq_pcap=${pcap_file}-rx.pcap
}

ip_to_hex() {
    printf "%02x%02x%02x%02x" "$@"
}


as hv1 ovs-ofctl monitor br-int resume --detach --no-chdir \
--pidfile=ovs-ofctl0.pid 2> ofctl_monitor0_hv1.log


as hv2 ovs-ofctl monitor br-int resume --detach --no-chdir \
--pidfile=ovs-ofctl0.pid 2> ofctl_monitor0_hv2.log


as hv3 ovs-ofctl monitor br-int resume --detach --no-chdir \
--pidfile=ovs-ofctl0.pid 2> ofctl_monitor0_hv3.log

as hv1
reset_pcap_file hv1-ext1 hv1/ext1

# Send DHCPDISCOVER.
offer_ip=`ip_to_hex 10 0 0 6`
server_ip=`ip_to_hex 10 0 0 1`
server_mac=ff1000000001
expected_dhcp_opts=330400000e100104ffffff0003040a00000136040a000001
test_dhcp 1 f00000000003 01 $offer_ip 0 $server_mac $server_ip \
$expected_dhcp_opts

# NXT_RESUMEs should be 1 in hv1.
ovs_wait_cond () {
    test 1 = `cat ofctl_monitor0_hv1.log | grep -c NXT_RESUME`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13388" "until test 1 = \`cat ofctl_monitor0_hv1.log | grep -c NXT_RESUME\`"


# NXT_RESUMEs should be 0 in hv2.
ovs_wait_cond () {
    test 0 = `cat ofctl_monitor0_hv2.log | grep -c NXT_RESUME`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13391" "until test 0 = \`cat ofctl_monitor0_hv2.log | grep -c NXT_RESUME\`"


$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/ext1-tx.pcap > ext1_v4.packets
cat ext1_v4.expected | cut -c -48 > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:13395: cat ext1_v4.packets | cut -c -48"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:13395"
( $at_check_trace; cat ext1_v4.packets | cut -c -48
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13395"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0_hv1.log" \
"ofctl_monitor0_hv2.log" \
"ofctl_monitor0_hv3.log"
$at_traceon; }

# Skipping the IPv4 checksum.
cat ext1_v4.expected | cut -c 53- > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:13398: cat ext1_v4.packets | cut -c 53-"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:13398"
( $at_check_trace; cat ext1_v4.packets | cut -c 53-
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13398"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0_hv1.log" \
"ofctl_monitor0_hv2.log" \
"ofctl_monitor0_hv3.log"
$at_traceon; }


# ovs-ofctl also resumes the packets and this causes other ports to receive
# the DHCP request packet. So reset the pcap files so that its easier to test.
as hv1
reset_pcap_file hv1-ext1 hv1/ext1

rm -f ext1_v4.expected
rm -f ext1_v4.packets

# Send DHCPv6 request
src_mac=f00000000003
src_lla=fe80000000000000f20000fffe000003
offer_ip=ae700000000000000000000000000006
test_dhcpv6 1 $src_mac $src_lla 01 $offer_ip

# NXT_RESUMEs should be 2 in hv1.
ovs_wait_cond () {
    test 2 = `cat ofctl_monitor0_hv1.log | grep -c NXT_RESUME`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13415" "until test 2 = \`cat ofctl_monitor0_hv1.log | grep -c NXT_RESUME\`"


# NXT_RESUMEs should be 0 in hv2.
ovs_wait_cond () {
    test 0 = `cat ofctl_monitor0_hv2.log | grep -c NXT_RESUME`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13418" "until test 0 = \`cat ofctl_monitor0_hv2.log | grep -c NXT_RESUME\`"


$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/ext1-tx.pcap | \
sort > ext1_v6.packets
cat ext1_v6.expected | cut -c -120 > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:13423: cat ext1_v6.packets | cut -c -120"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:13423"
( $at_check_trace; cat ext1_v6.packets | cut -c -120
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13423"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0_hv1.log" \
"ofctl_monitor0_hv2.log" \
"ofctl_monitor0_hv3.log"
$at_traceon; }

# Skipping the UDP checksum
cat ext1_v6.expected | cut -c 125- > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:13426: cat ext1_v6.packets | cut -c 125-"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:13426"
( $at_check_trace; cat ext1_v6.packets | cut -c 125-
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13426"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0_hv1.log" \
"ofctl_monitor0_hv2.log" \
"ofctl_monitor0_hv3.log"
$at_traceon; }


rm -f ext1_v6.expected
rm -f ext1_v6.packets

as hv1
reset_pcap_file hv1-ext1 hv1/ext1

# Delete the ha-chassis hv1.
ovn-nbctl ha-chassis-group-remove-chassis hagrp1 hv1
ovs_wait_cond () {
    chassis=`ovn-sbctl --bare --columns chassis find port_binding \
logical_port=ls1-lp_ext1`
    test "$chassis" = ""
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13436" "until chassis=\`ovn-sbctl --bare --columns chassis find port_binding \\
logical_port=ls1-lp_ext1\`
    test \"\$chassis\" = \"\""


# Add hv2 to the ha chassis group
ovn-nbctl --wait=hv ha-chassis-group-add-chassis hagrp1 hv2 20

ovn-sbctl list ha_chassis_group
ovn-sbctl list ha_chassis

ovn-sbctl find port_binding logical_port=ls1-lp_ext1

# The ls1-lp_ext1 should be bound to hv2
ovs_wait_cond () {
    chassis=`ovn-sbctl --bare --columns chassis find port_binding \
logical_port=ls1-lp_ext1`
    test "$chassis" = "$hv2_uuid"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13450" "until chassis=\`ovn-sbctl --bare --columns chassis find port_binding \\
logical_port=ls1-lp_ext1\`
    test \"\$chassis\" = \"\$hv2_uuid\""


# There should be OF flows for DHCP4/v6 for the ls1-lp_ext1 port in hv2
{ set +x
$as_echo "$at_srcdir/ovn.at:13456: as hv2 ovs-ofctl dump-flows br-int | grep table=22 | \\
grep controller | grep \"0a.00.00.06\" | grep reg14=0x\$ln_public_key | \\
wc -l"
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:13456"
( $at_check_trace; as hv2 ovs-ofctl dump-flows br-int | grep table=22 | \
grep controller | grep "0a.00.00.06" | grep reg14=0x$ln_public_key | \
wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "3
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13456"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0_hv1.log" \
"ofctl_monitor0_hv2.log" \
"ofctl_monitor0_hv3.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:13460: as hv2 ovs-ofctl dump-flows br-int | grep table=22 | \\
grep controller | grep tp_src=546 | grep \\
\"ae.70.00.00.00.00.00.00.00.00.00.00.00.00.00.06\" | \\
grep reg14=0x\$ln_public_key | wc -l"
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:13460"
( $at_check_trace; as hv2 ovs-ofctl dump-flows br-int | grep table=22 | \
grep controller | grep tp_src=546 | grep \
"ae.70.00.00.00.00.00.00.00.00.00.00.00.00.00.06" | \
grep reg14=0x$ln_public_key | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13460"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0_hv1.log" \
"ofctl_monitor0_hv2.log" \
"ofctl_monitor0_hv3.log"
$at_traceon; }


# There should be no DHCPv4/v6 flows for ls1-lp_ext1 on hv1
{ set +x
$as_echo "$at_srcdir/ovn.at:13467: as hv1 ovs-ofctl dump-flows br-int | grep table=22 | \\
grep controller | grep \"0a.00.00.06\" | wc -l"
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:13467"
( $at_check_trace; as hv1 ovs-ofctl dump-flows br-int | grep table=22 | \
grep controller | grep "0a.00.00.06" | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13467"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0_hv1.log" \
"ofctl_monitor0_hv2.log" \
"ofctl_monitor0_hv3.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:13470: as hv1 ovs-ofctl dump-flows br-int | grep table=22 | \\
grep controller | grep tp_src=546 | grep \\
\"ae.70.00.00.00.00.00.00.00.00.00.00.00.00.00.06\" | \\
grep reg14=0x\$ln_public_key | wc -l"
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:13470"
( $at_check_trace; as hv1 ovs-ofctl dump-flows br-int | grep table=22 | \
grep controller | grep tp_src=546 | grep \
"ae.70.00.00.00.00.00.00.00.00.00.00.00.00.00.06" | \
grep reg14=0x$ln_public_key | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13470"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0_hv1.log" \
"ofctl_monitor0_hv2.log" \
"ofctl_monitor0_hv3.log"
$at_traceon; }


# Send DHCPDISCOVER again for hv1/ext1. The DHCP response should come from
# hv2 ovn-controller.
offer_ip=`ip_to_hex 10 0 0 6`
server_ip=`ip_to_hex 10 0 0 1`
server_mac=ff1000000001
expected_dhcp_opts=330400000e100104ffffff0003040a00000136040a000001
test_dhcp 1 f00000000003 01 $offer_ip 0 $server_mac $server_ip \
$expected_dhcp_opts

# NXT_RESUMEs should be 2 in hv1.
ovs_wait_cond () {
    test 2 = `cat ofctl_monitor0_hv1.log | grep -c NXT_RESUME`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13486" "until test 2 = \`cat ofctl_monitor0_hv1.log | grep -c NXT_RESUME\`"


# NXT_RESUMEs should be 1 in hv2.
ovs_wait_cond () {
    test 1 = `cat ofctl_monitor0_hv2.log | grep -c NXT_RESUME`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13489" "until test 1 = \`cat ofctl_monitor0_hv2.log | grep -c NXT_RESUME\`"


$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/ext1-tx.pcap > ext1_v4.packets
cat ext1_v4.expected | cut -c -48 > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:13493: cat ext1_v4.packets | cut -c -48"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:13493"
( $at_check_trace; cat ext1_v4.packets | cut -c -48
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13493"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0_hv1.log" \
"ofctl_monitor0_hv2.log" \
"ofctl_monitor0_hv3.log"
$at_traceon; }

# Skipping the IPv4 checksum.
cat ext1_v4.expected | cut -c 53- > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:13496: cat ext1_v4.packets | cut -c 53-"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:13496"
( $at_check_trace; cat ext1_v4.packets | cut -c 53-
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13496"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0_hv1.log" \
"ofctl_monitor0_hv2.log" \
"ofctl_monitor0_hv3.log"
$at_traceon; }


# ovs-ofctl also resumes the packets and this causes other ports to receive
# the DHCP request packet. So reset the pcap files so that its easier to test.
as hv1
reset_pcap_file hv1-ext1 hv1/ext1

rm -f ext1_v4.expected

# Send DHCPv6 request again
src_mac=f00000000003
src_lla=fe80000000000000f20000fffe000003
offer_ip=ae700000000000000000000000000006
test_dhcpv6 1 $src_mac $src_lla 01 $offer_ip 1

# NXT_RESUMEs should be 2 in hv1.
ovs_wait_cond () {
    test 2 = `cat ofctl_monitor0_hv1.log | grep -c NXT_RESUME`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13512" "until test 2 = \`cat ofctl_monitor0_hv1.log | grep -c NXT_RESUME\`"


# NXT_RESUMEs should be 2 in hv2.
ovs_wait_cond () {
    test 2 = `cat ofctl_monitor0_hv2.log | grep -c NXT_RESUME`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13515" "until test 2 = \`cat ofctl_monitor0_hv2.log | grep -c NXT_RESUME\`"


$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/ext1-tx.pcap | \
sort > ext1_v6.packets
cat ext1_v6.expected | cut -c -120 > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:13520: cat ext1_v6.packets | cut -c -120"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:13520"
( $at_check_trace; cat ext1_v6.packets | cut -c -120
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13520"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0_hv1.log" \
"ofctl_monitor0_hv2.log" \
"ofctl_monitor0_hv3.log"
$at_traceon; }

# Skipping the UDP checksum
cat ext1_v6.expected | cut -c 125- > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:13523: cat ext1_v6.packets | cut -c 125-"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:13523"
( $at_check_trace; cat ext1_v6.packets | cut -c 125-
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13523"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0_hv1.log" \
"ofctl_monitor0_hv2.log" \
"ofctl_monitor0_hv3.log"
$at_traceon; }


rm -f ext1_v6.expected
rm -f ext1_v6.packets

as hv1
ovs-vsctl show
reset_pcap_file hv1-ext1 hv1/ext1
reset_pcap_file br-phys_n1 hv1/br-phys_n1
reset_pcap_file br-phys hv1/br-phys

as hv2
ovs-vsctl show
reset_pcap_file hv2-ext2 hv2/ext2
reset_pcap_file br-phys_n1 hv2/br-phys_n1
reset_pcap_file br-phys hv2/br-phys

# From  ls1-lp_ext1, send ARP request for the router ip. The ARP
# response should come from the router pipeline of hv2.
ext1_mac=f00000000003
router_mac=a01000000001
ext1_ip=`ip_to_hex 10 0 0 6`
router_ip=`ip_to_hex 10 0 0 1`
arp_request=ffffffffffff${ext1_mac}08060001080006040001${ext1_mac}${ext1_ip}000000000000${router_ip}

as hv1 ovs-appctl netdev-dummy/receive hv1-ext1 $arp_request
expected_response=${src_mac}${router_mac}08060001080006040002${router_mac}${router_ip}${ext1_mac}${ext1_ip}
echo $expected_response > expout
$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/ext1-tx.pcap > ext1_arp_resp
{ set +x
$as_echo "$at_srcdir/ovn.at:13552: cat ext1_arp_resp"
at_fn_check_prepare_trace "ovn.at:13552"
( $at_check_trace; cat ext1_arp_resp
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13552"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0_hv1.log" \
"ofctl_monitor0_hv2.log" \
"ofctl_monitor0_hv3.log"
$at_traceon; }


# Verify that the response came from hv2
$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv2/br-phys_n1-tx.pcap > ext1_arp_resp
{ set +x
$as_echo "$at_srcdir/ovn.at:13556: cat ext1_arp_resp"
at_fn_check_prepare_trace "ovn.at:13556"
( $at_check_trace; cat ext1_arp_resp
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13556"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0_hv1.log" \
"ofctl_monitor0_hv2.log" \
"ofctl_monitor0_hv3.log"
$at_traceon; }


# Now add 3 ha chassis to the ha chassis group
ovn-nbctl ha-chassis-group-add-chassis hagrp1 hv1 30
ovn-nbctl ha-chassis-group-add-chassis hagrp1 hv2 20
ovn-nbctl ha-chassis-group-add-chassis hagrp1 hv3 10

# hv1 should be master and claim ls1-lp_ext1
ovs_wait_cond () {
    chassis=`ovn-sbctl --bare --columns chassis find port_binding \
logical_port=ls1-lp_ext1`
    test "$chassis" = "$hv1_uuid"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13564" "until chassis=\`ovn-sbctl --bare --columns chassis find port_binding \\
logical_port=ls1-lp_ext1\`
    test \"\$chassis\" = \"\$hv1_uuid\""


as hv1
ovs-vsctl show
reset_pcap_file hv1-ext1 hv1/ext1
reset_pcap_file br-phys_n1 hv1/br-phys_n1
reset_pcap_file br-phys hv1/br-phys

as hv2
ovs-vsctl show
reset_pcap_file hv2-ext2 hv2/ext2
reset_pcap_file br-phys_n1 hv2/br-phys_n1
reset_pcap_file br-phys hv2/br-phys

as hv3
ovs-vsctl show
reset_pcap_file hv3-ext3 hv3/ext3
reset_pcap_file br-phys_n1 hv3/br-phys_n1
reset_pcap_file br-phys hv3/br-phys

# Send DHCPDISCOVER.
offer_ip=`ip_to_hex 10 0 0 6`
server_ip=`ip_to_hex 10 0 0 1`
server_mac=ff1000000001
expected_dhcp_opts=330400000e100104ffffff0003040a00000136040a000001
test_dhcp 1 f00000000003 01 $offer_ip 0 $server_mac $server_ip \
$expected_dhcp_opts

# NXT_RESUMEs should be 3 in hv1.
ovs_wait_cond () {
    test 3 = `cat ofctl_monitor0_hv1.log | grep -c NXT_RESUME`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13596" "until test 3 = \`cat ofctl_monitor0_hv1.log | grep -c NXT_RESUME\`"


# NXT_RESUMEs should be 2 in hv2.
ovs_wait_cond () {
    test 2 = `cat ofctl_monitor0_hv2.log | grep -c NXT_RESUME`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13599" "until test 2 = \`cat ofctl_monitor0_hv2.log | grep -c NXT_RESUME\`"


$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/ext1-tx.pcap > ext1_v4.packets
cat ext1_v4.expected | cut -c -48 > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:13603: cat ext1_v4.packets | cut -c -48"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:13603"
( $at_check_trace; cat ext1_v4.packets | cut -c -48
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13603"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0_hv1.log" \
"ofctl_monitor0_hv2.log" \
"ofctl_monitor0_hv3.log"
$at_traceon; }

# Skipping the IPv4 checksum.
cat ext1_v4.expected | cut -c 53- > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:13606: cat ext1_v4.packets | cut -c 53-"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:13606"
( $at_check_trace; cat ext1_v4.packets | cut -c 53-
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13606"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0_hv1.log" \
"ofctl_monitor0_hv2.log" \
"ofctl_monitor0_hv3.log"
$at_traceon; }


# ovs-ofctl also resumes the packets and this causes other ports to receive
# the DHCP request packet. So reset the pcap files so that its easier to test.
as hv1
reset_pcap_file hv1-ext1 hv1/ext1

rm -f ext1_v4.expected
rm -f ext1_v4.packets

# Send DHCPv6 request
src_mac=f00000000003
src_lla=fe80000000000000f20000fffe000003
offer_ip=ae700000000000000000000000000006
test_dhcpv6 1 $src_mac $src_lla 01 $offer_ip

# NXT_RESUMEs should be 4 in hv1.
ovs_wait_cond () {
    test 4 = `cat ofctl_monitor0_hv1.log | grep -c NXT_RESUME`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13623" "until test 4 = \`cat ofctl_monitor0_hv1.log | grep -c NXT_RESUME\`"


# NXT_RESUMEs should be 2 in hv2.
ovs_wait_cond () {
    test 2 = `cat ofctl_monitor0_hv2.log | grep -c NXT_RESUME`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13626" "until test 2 = \`cat ofctl_monitor0_hv2.log | grep -c NXT_RESUME\`"


$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/ext1-tx.pcap | \
sort > ext1_v6.packets
cat ext1_v6.expected | cut -c -120 > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:13631: cat ext1_v6.packets | cut -c -120"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:13631"
( $at_check_trace; cat ext1_v6.packets | cut -c -120
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13631"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0_hv1.log" \
"ofctl_monitor0_hv2.log" \
"ofctl_monitor0_hv3.log"
$at_traceon; }

# Skipping the UDP checksum
cat ext1_v6.expected | cut -c 125- > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:13634: cat ext1_v6.packets | cut -c 125-"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:13634"
( $at_check_trace; cat ext1_v6.packets | cut -c 125-
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13634"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0_hv1.log" \
"ofctl_monitor0_hv2.log" \
"ofctl_monitor0_hv3.log"
$at_traceon; }


rm -f ext1_v6.expected
rm -f ext1_v6.packets
as hv1 reset_pcap_file hv1-ext1 hv1/ext1

# Now increase the priority of hv3 so it becomes master.
ovn-nbctl ha-chassis-group-add-chassis hagrp1 hv3 50

# hv3 should be master and claim ls1-lp_ext1
ovs_wait_cond () {
    chassis=`ovn-sbctl --bare --columns chassis find port_binding \
logical_port=ls1-lp_ext1`
    test "$chassis" = "$hv3_uuid"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13644" "until chassis=\`ovn-sbctl --bare --columns chassis find port_binding \\
logical_port=ls1-lp_ext1\`
    test \"\$chassis\" = \"\$hv3_uuid\""


as hv1
ovs-vsctl show
reset_pcap_file hv1-ext1 hv1/ext1
reset_pcap_file br-phys_n1 hv1/br-phys_n1
reset_pcap_file br-phys hv1/br-phys

as hv2
ovs-vsctl show
reset_pcap_file hv2-ext2 hv2/ext2
reset_pcap_file br-phys_n1 hv2/br-phys_n1
reset_pcap_file br-phys hv2/br-phys

as hv2
ovs-vsctl show
reset_pcap_file hv3-ext3 hv3/ext3
reset_pcap_file br-phys_n1 hv3/br-phys_n1
reset_pcap_file br-phys hv3/br-phys

# Send DHCPDISCOVER.
offer_ip=`ip_to_hex 10 0 0 6`
server_ip=`ip_to_hex 10 0 0 1`
server_mac=ff1000000001
expected_dhcp_opts=330400000e100104ffffff0003040a00000136040a000001
test_dhcp 1 f00000000003 01 $offer_ip 0 $server_mac $server_ip \
$expected_dhcp_opts

# NXT_RESUMEs should be 4 in hv1.
ovs_wait_cond () {
    test 4 = `cat ofctl_monitor0_hv1.log | grep -c NXT_RESUME`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13676" "until test 4 = \`cat ofctl_monitor0_hv1.log | grep -c NXT_RESUME\`"


# NXT_RESUMEs should be 2 in hv2.
ovs_wait_cond () {
    test 2 = `cat ofctl_monitor0_hv2.log | grep -c NXT_RESUME`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13679" "until test 2 = \`cat ofctl_monitor0_hv2.log | grep -c NXT_RESUME\`"


# NXT_RESUMEs should be 1 in hv3.
ovs_wait_cond () {
    test 1 = `cat ofctl_monitor0_hv3.log | grep -c NXT_RESUME`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13682" "until test 1 = \`cat ofctl_monitor0_hv3.log | grep -c NXT_RESUME\`"


$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/ext1-tx.pcap > ext1_v4.packets
cat ext1_v4.expected | cut -c -48 > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:13686: cat ext1_v4.packets | cut -c -48"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:13686"
( $at_check_trace; cat ext1_v4.packets | cut -c -48
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13686"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0_hv1.log" \
"ofctl_monitor0_hv2.log" \
"ofctl_monitor0_hv3.log"
$at_traceon; }

# Skipping the IPv4 checksum.
cat ext1_v4.expected | cut -c 53- > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:13689: cat ext1_v4.packets | cut -c 53-"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:13689"
( $at_check_trace; cat ext1_v4.packets | cut -c 53-
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13689"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0_hv1.log" \
"ofctl_monitor0_hv2.log" \
"ofctl_monitor0_hv3.log"
$at_traceon; }


# ovs-ofctl also resumes the packets and this causes other ports to receive
# the DHCP request packet. So reset the pcap files so that its easier to test.
as hv1
reset_pcap_file hv1-ext1 hv1/ext1

rm -f ext1_v4.expected
rm -f ext1_v4.packets

# Send DHCPv6 request
src_mac=f00000000003
src_lla=fe80000000000000f20000fffe000003
offer_ip=ae700000000000000000000000000006
test_dhcpv6 1 $src_mac $src_lla 01 $offer_ip

# NXT_RESUMEs should be 4 in hv1.
ovs_wait_cond () {
    test 4 = `cat ofctl_monitor0_hv1.log | grep -c NXT_RESUME`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13706" "until test 4 = \`cat ofctl_monitor0_hv1.log | grep -c NXT_RESUME\`"


# NXT_RESUMEs should be 2 in hv2.
ovs_wait_cond () {
    test 2 = `cat ofctl_monitor0_hv2.log | grep -c NXT_RESUME`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13709" "until test 2 = \`cat ofctl_monitor0_hv2.log | grep -c NXT_RESUME\`"


# NXT_RESUMEs should be 2 in hv3.
ovs_wait_cond () {
    test 2 = `cat ofctl_monitor0_hv3.log | grep -c NXT_RESUME`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13712" "until test 2 = \`cat ofctl_monitor0_hv3.log | grep -c NXT_RESUME\`"


$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/ext1-tx.pcap | \
sort > ext1_v6.packets
cat ext1_v6.expected | cut -c -120 > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:13717: cat ext1_v6.packets | cut -c -120"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:13717"
( $at_check_trace; cat ext1_v6.packets | cut -c -120
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13717"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0_hv1.log" \
"ofctl_monitor0_hv2.log" \
"ofctl_monitor0_hv3.log"
$at_traceon; }

# Skipping the UDP checksum
cat ext1_v6.expected | cut -c 125- > expout
{ set +x
$as_echo "$at_srcdir/ovn.at:13720: cat ext1_v6.packets | cut -c 125-"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:13720"
( $at_check_trace; cat ext1_v6.packets | cut -c 125-
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13720"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0_hv1.log" \
"ofctl_monitor0_hv2.log" \
"ofctl_monitor0_hv3.log"
$at_traceon; }


# disconnect hv3 from the network, hv1 should take over
as hv3
port=${sandbox}_br-phys
as main ovs-vsctl del-port n1 $port

# hv1 should be master and claim ls1-lp_ext1
ovs_wait_cond () {
    chassis=`ovn-sbctl --bare --columns chassis find port_binding \
logical_port=ls1-lp_ext1`
    test "$chassis" = "$hv1_uuid"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13728" "until chassis=\`ovn-sbctl --bare --columns chassis find port_binding \\
logical_port=ls1-lp_ext1\`
    test \"\$chassis\" = \"\$hv1_uuid\""


# Stop ovn-controllers on hv1 and hv3.
as hv1 ovn-appctl -t ovn-controller exit
as hv3 ovn-appctl -t ovn-controller exit

# hv2 should be master and claim ls1-lp_ext1
ovs_wait_cond () {
    chassis=`ovn-sbctl --bare --columns chassis find port_binding \
logical_port=ls1-lp_ext1`
    test "$chassis" = "$hv2_uuid"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13738" "until chassis=\`ovn-sbctl --bare --columns chassis find port_binding \\
logical_port=ls1-lp_ext1\`
    test \"\$chassis\" = \"\$hv2_uuid\""


as hv1
{ set +x
$as_echo "$at_srcdir/ovn.at:13744: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:13744"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13744"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0_hv1.log" \
"ofctl_monitor0_hv2.log" \
"ofctl_monitor0_hv3.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:13744: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:13744"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13744"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0_hv1.log" \
"ofctl_monitor0_hv2.log" \
"ofctl_monitor0_hv3.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13744" "while kill -0 \$TMPPID 2>/dev/null"

{ set +x
$as_echo "$at_srcdir/ovn.at:13745: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:13745"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13745"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0_hv1.log" \
"ofctl_monitor0_hv2.log" \
"ofctl_monitor0_hv3.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:13745: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:13745"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13745"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0_hv1.log" \
"ofctl_monitor0_hv2.log" \
"ofctl_monitor0_hv3.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13745" "while kill -0 \$TMPPID 2>/dev/null"


as hv3
{ set +x
$as_echo "$at_srcdir/ovn.at:13748: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:13748"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13748"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0_hv1.log" \
"ofctl_monitor0_hv2.log" \
"ofctl_monitor0_hv3.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:13748: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:13748"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13748"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0_hv1.log" \
"ofctl_monitor0_hv2.log" \
"ofctl_monitor0_hv3.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13748" "while kill -0 \$TMPPID 2>/dev/null"

{ set +x
$as_echo "$at_srcdir/ovn.at:13749: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:13749"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13749"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0_hv1.log" \
"ofctl_monitor0_hv2.log" \
"ofctl_monitor0_hv3.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:13749: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:13749"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13749"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0_hv1.log" \
"ofctl_monitor0_hv2.log" \
"ofctl_monitor0_hv3.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13749" "while kill -0 \$TMPPID 2>/dev/null"





    as hv2
    if test "hv2" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:13751: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:13751"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13751"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0_hv1.log" \
"ofctl_monitor0_hv2.log" \
"ofctl_monitor0_hv3.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:13751: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:13751"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13751"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0_hv1.log" \
"ofctl_monitor0_hv2.log" \
"ofctl_monitor0_hv3.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13751" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:13751: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:13751"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13751"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0_hv1.log" \
"ofctl_monitor0_hv2.log" \
"ofctl_monitor0_hv3.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:13751: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:13751"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13751"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0_hv1.log" \
"ofctl_monitor0_hv2.log" \
"ofctl_monitor0_hv3.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13751" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:13751: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:13751"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13751"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0_hv1.log" \
"ofctl_monitor0_hv2.log" \
"ofctl_monitor0_hv3.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:13751: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:13751"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13751"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0_hv1.log" \
"ofctl_monitor0_hv2.log" \
"ofctl_monitor0_hv3.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13751" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv2
    { set +x
$as_echo "$at_srcdir/ovn.at:13751: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:13751"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13751"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0_hv1.log" \
"ofctl_monitor0_hv2.log" \
"ofctl_monitor0_hv3.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:13751: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:13751"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13751"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0_hv1.log" \
"ofctl_monitor0_hv2.log" \
"ofctl_monitor0_hv3.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13751" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:13751: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:13751"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13751"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0_hv1.log" \
"ofctl_monitor0_hv2.log" \
"ofctl_monitor0_hv3.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:13751: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:13751"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13751"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0_hv1.log" \
"ofctl_monitor0_hv2.log" \
"ofctl_monitor0_hv3.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13751" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:13751: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:13751"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13751"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0_hv1.log" \
"ofctl_monitor0_hv2.log" \
"ofctl_monitor0_hv3.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:13751: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:13751"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13751"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0_hv1.log" \
"ofctl_monitor0_hv2.log" \
"ofctl_monitor0_hv3.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13751" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:13751: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:13751"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13751"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0_hv1.log" \
"ofctl_monitor0_hv2.log" \
"ofctl_monitor0_hv3.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:13751: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:13751"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13751"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0_hv1.log" \
"ofctl_monitor0_hv2.log" \
"ofctl_monitor0_hv3.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13751" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:13751: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:13751"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13751"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0_hv1.log" \
"ofctl_monitor0_hv2.log" \
"ofctl_monitor0_hv3.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:13751: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:13751"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13751"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0_hv1.log" \
"ofctl_monitor0_hv2.log" \
"ofctl_monitor0_hv3.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13751" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:13751: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:13751"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13751"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0_hv1.log" \
"ofctl_monitor0_hv2.log" \
"ofctl_monitor0_hv3.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:13751: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:13751"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13751"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0_hv1.log" \
"ofctl_monitor0_hv2.log" \
"ofctl_monitor0_hv3.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13751" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:13751: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:13751"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13751"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0_hv1.log" \
"ofctl_monitor0_hv2.log" \
"ofctl_monitor0_hv3.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:13751: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:13751"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13751"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0_hv1.log" \
"ofctl_monitor0_hv2.log" \
"ofctl_monitor0_hv3.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13751" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:13751: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:13751"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13751"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0_hv1.log" \
"ofctl_monitor0_hv2.log" \
"ofctl_monitor0_hv3.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:13751: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:13751"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13751"
$at_failed && at_fn_log_failure  \
"ofctl_monitor0_hv1.log" \
"ofctl_monitor0_hv2.log" \
"ofctl_monitor0_hv3.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13751" "while kill -0 \$TMPPID 2>/dev/null"



ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_101
#AT_START_102
at_fn_group_banner 102 'ovn.at:13754' \
  "ovn -- Address Set Incremental Processing" "      " 2
at_xfail=no
(
  $as_echo "102. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init


ovn_start

net_add n1
sim_add hv1
as hv1
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.10

ovn-nbctl ls-add ls1
for i in 1 2; do
    ovn-nbctl lsp-add ls1 lp$i \
        -- lsp-set-addresses lp$i "f0:00:00:00:00:0$i 192.168.1.$i"
    as hv1 ovs-vsctl \
        -- add-port br-int vif$i \
        -- set Interface vif$i \
            external-ids:iface-id=lp$i
done

for i in 1 2 3; do
    as1_uuid=`ovn-nbctl --wait=hv create addr name=as1`
    as2_uuid=`ovn-nbctl --wait=hv create addr name=as2`
    ovn-nbctl --wait=hv acl-add ls1 to-lport 200 \
            'outport=="lp1" && ip4 && ip4.src == {$as1, $as2}' allow-related
    ovn-nbctl --wait=hv set addr as1 addresses="10.1.2.10"
    { set +x
$as_echo "$at_srcdir/ovn.at:13780: ovs-ofctl dump-flows br-int | grep \"10.1.2.10\""
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:13780"
( $at_check_trace; ovs-ofctl dump-flows br-int | grep "10.1.2.10"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13780"
$at_failed && at_fn_log_failure
$at_traceon; }


    # Update address set as1
    ovn-nbctl --wait=hv set addr as1 addresses="10.1.2.10 10.1.2.11"
    { set +x
$as_echo "$at_srcdir/ovn.at:13784: ovs-ofctl dump-flows br-int | grep \"10.1.2.11\""
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:13784"
( $at_check_trace; ovs-ofctl dump-flows br-int | grep "10.1.2.11"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13784"
$at_failed && at_fn_log_failure
$at_traceon; }


    # Update address set as2
    ovn-nbctl --wait=hv set addr as2 addresses="10.1.2.12 10.1.2.13"
    { set +x
$as_echo "$at_srcdir/ovn.at:13788: ovs-ofctl dump-flows br-int | grep \"10.1.2.12\""
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:13788"
( $at_check_trace; ovs-ofctl dump-flows br-int | grep "10.1.2.12"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13788"
$at_failed && at_fn_log_failure
$at_traceon; }


    # Add another ACL referencing as1
    n_flows_before=`ovs-ofctl dump-flows br-int | grep "10.1.2.10" | wc -l`
    ovn-nbctl --wait=hv acl-add ls1 to-lport 200 \
            'outport=="lp2" && ip4 && ip4.src == $as1' allow-related
    n_flows_after=`ovs-ofctl dump-flows br-int | grep "10.1.2.10" | wc -l`
    { set +x
$as_echo "$at_srcdir/ovn.at:13795: test \$(expr \$n_flows_before \\* 2) = \$n_flows_after"
at_fn_check_prepare_notrace 'a $(...) command substitution' "ovn.at:13795"
( $at_check_trace; test $(expr $n_flows_before \* 2) = $n_flows_after
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13795"
$at_failed && at_fn_log_failure
$at_traceon; }


    # Trigger full recompute. Creating a chassis would trigger full recompute.
    ovn-sbctl chassis-add tst geneve 127.0.0.4
    ovn-sbctl chassis-del tst

    # Remove an ACL
    ovn-nbctl --wait=hv acl-del ls1 to-lport 200 \
            'outport=="lp2" && ip4 && ip4.src == $as1'
    n_flows_after=`ovs-ofctl dump-flows br-int | grep "10.1.2.10" | wc -l`
    { set +x
$as_echo "$at_srcdir/ovn.at:13805: test \$n_flows_before = \$n_flows_after"
at_fn_check_prepare_dynamic "test $n_flows_before = $n_flows_after" "ovn.at:13805"
( $at_check_trace; test $n_flows_before = $n_flows_after
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13805"
$at_failed && at_fn_log_failure
$at_traceon; }


    # Remove as1 while it is still used by an ACL, the lflows should be reparsed and
    # parsing should fail.
    echo "before del as1"
    ovn-nbctl list addr | grep as1
    ovn-nbctl --wait=hv destroy addr $as1_uuid
    echo "after del as1"
    ovn-nbctl list addr | grep as1
    { set +x
$as_echo "$at_srcdir/ovn.at:13814: ovs-ofctl dump-flows br-int | grep \"10.1.2.10\""
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:13814"
( $at_check_trace; ovs-ofctl dump-flows br-int | grep "10.1.2.10"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 1 $at_status "$at_srcdir/ovn.at:13814"
$at_failed && at_fn_log_failure
$at_traceon; }

    { set +x
$as_echo "$at_srcdir/ovn.at:13815: ovs-ofctl dump-flows br-int | grep \"10.1.2.12\""
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:13815"
( $at_check_trace; ovs-ofctl dump-flows br-int | grep "10.1.2.12"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 1 $at_status "$at_srcdir/ovn.at:13815"
$at_failed && at_fn_log_failure
$at_traceon; }


    # Recreate as1
    as1_uuid=`ovn-nbctl --wait=hv create addr name=as1`
    { set +x
$as_echo "$at_srcdir/ovn.at:13819: ovs-ofctl dump-flows br-int | grep \"10.1.2.12\""
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:13819"
( $at_check_trace; ovs-ofctl dump-flows br-int | grep "10.1.2.12"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13819"
$at_failed && at_fn_log_failure
$at_traceon; }


    # Remove ACLs and address sets
    ovn-nbctl --wait=hv destroy addr $as1_uuid -- destroy addr $as2_uuid
    { set +x
$as_echo "$at_srcdir/ovn.at:13823: ovs-ofctl dump-flows br-int | grep \"10.1.2.12\""
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:13823"
( $at_check_trace; ovs-ofctl dump-flows br-int | grep "10.1.2.12"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 1 $at_status "$at_srcdir/ovn.at:13823"
$at_failed && at_fn_log_failure
$at_traceon; }


    ovn-nbctl --wait=hv acl-del ls1
done

# Gracefully terminate daemons



    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:13829: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:13829"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13829"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:13829: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:13829"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13829"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13829" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:13829: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:13829"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13829"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:13829: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:13829"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13829"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13829" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:13829: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:13829"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13829"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:13829: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:13829"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13829"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13829" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:13829: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:13829"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13829"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:13829: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:13829"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13829"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13829" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:13829: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:13829"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13829"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:13829: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:13829"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13829"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13829" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:13829: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:13829"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13829"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:13829: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:13829"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13829"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13829" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:13829: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:13829"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13829"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:13829: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:13829"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13829"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13829" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:13829: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:13829"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13829"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:13829: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:13829"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13829"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13829" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:13829: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:13829"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13829"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:13829: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:13829"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13829"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13829" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:13829: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:13829"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13829"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:13829: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:13829"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13829"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13829" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:13829: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:13829"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13829"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:13829: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:13829"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13829"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13829" "while kill -0 \$TMPPID 2>/dev/null"



ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_102
#AT_START_103
at_fn_group_banner 103 'ovn.at:13832' \
  "ovn -- ovn-controller restart" "                  " 2
at_xfail=no
(
  $as_echo "103. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

# Logical network:
# One Logical Router: ro, with two logical switches sw1 and sw2.
# sw1 is for subnet 10.0.0.0/8
# sw2 is for subnet 20.0.0.0/8
# sw1 has a single port bound on hv1
# sw2 has a single port bound on hv2

ovn-nbctl lr-add ro
ovn-nbctl ls-add sw1
ovn-nbctl ls-add sw2

sw1_ro_mac=00:00:10:00:00:01
sw1_ro_ip=10.0.0.1
sw2_ro_mac=00:00:20:00:00:01
sw2_ro_ip=20.0.0.1
sw1_p1_mac=00:00:10:00:00:02
sw1_p1_ip=10.0.0.2
sw2_p1_mac=00:00:20:00:00:02
sw2_p1_ip=20.0.0.2

ovn-nbctl lrp-add ro ro-sw1 $sw1_ro_mac ${sw1_ro_ip}/8
ovn-nbctl lrp-add ro ro-sw2 $sw2_ro_mac ${sw2_ro_ip}/8
ovn-nbctl lsp-add sw1 sw1-ro -- set Logical_Switch_Port sw1-ro type=router \
  options:router-port=ro-sw1 addresses=\"$sw1_ro_mac\"
ovn-nbctl lsp-add sw2 sw2-ro -- set Logical_Switch_Port sw2-ro type=router \
  options:router-port=ro-sw2 addresses=\"$sw2_ro_mac\"

ovn-nbctl lsp-add sw1 sw1-p1 \
-- lsp-set-addresses sw1-p1 "$sw1_p1_mac $sw1_p1_ip"

ovn-nbctl lsp-add sw2 sw2-p1 \
-- lsp-set-addresses sw2-p1 "$sw2_p1_mac $sw2_p1_ip"

net_add n1

sim_add hv1
as hv1
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.1
ovs-vsctl -- add-port br-int hv1-vif1 -- \
    set interface hv1-vif1 external-ids:iface-id=sw1-p1 \
    options:tx_pcap=hv1/vif1-tx.pcap \
    options:rxq_pcap=hv1/vif1-rx.pcap \
    ofport-request=1

sim_add hv2
as hv2
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.2
ovs-vsctl -- add-port br-int hv2-vif1 -- \
    set interface hv2-vif1 external-ids:iface-id=sw2-p1 \
    options:tx_pcap=hv2/vif1-tx.pcap \
    options:rxq_pcap=hv2/vif1-rx.pcap \
    ofport-request=1

{ set +x
$as_echo "$at_srcdir/ovn.at:13890: ovn_populate_arp__"
at_fn_check_prepare_trace "ovn.at:13890"
( $at_check_trace; ovn_populate_arp__
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13890"
$at_failed && at_fn_log_failure
$at_traceon; }


sleep 1

packet="inport==\"sw1-p1\" && eth.src==$sw1_p1_mac && eth.dst==$sw1_ro_mac &&
       ip4 && ip.ttl==64 && ip4.src==$sw1_p1_ip && ip4.dst==$sw2_p1_ip &&
       udp && udp.src==53 && udp.dst==4369"

# Start by Sending the packet and make sure it makes it there as expected
as hv1 ovs-appctl -t ovn-controller inject-pkt "$packet"

# Expected packet has TTL decreased by 1
expected="eth.src==$sw2_ro_mac && eth.dst==$sw2_p1_mac &&
       ip4 && ip.ttl==63 && ip4.src==$sw1_p1_ip && ip4.dst==$sw2_p1_ip &&
       udp && udp.src==53 && udp.dst==4369"
echo $expected | ovstest test-ovn expr-to-packets > expected

ovn_check_packets__ "hv2/vif1-tx.pcap" "expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:13907: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:13907"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13907"
$at_failed && at_fn_log_failure
$at_traceon; }


# Stop ovn-controller on hv2 with --restart flag
as hv2 ovs-appctl -t ovn-controller exit --restart

# Now send the packet again. This time, it should still arrive
as hv1 ovs-appctl -t ovn-controller inject-pkt "$packet"

cat expected expected > expected2

ovn_check_packets__ "hv2/vif1-tx.pcap" "expected2"
   { set +x
$as_echo "$at_srcdir/ovn.at:13917: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:13917"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13917"
$at_failed && at_fn_log_failure
$at_traceon; }


# Start ovn-controller again just so OVN_CLEANUP doesn't complain
as hv2 start_daemon ovn-controller




    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:13922: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:13922"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13922"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:13922: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:13922"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13922"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13922" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:13922: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:13922"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13922"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:13922: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:13922"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13922"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13922" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:13922: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:13922"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13922"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:13922: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:13922"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13922"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13922" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:13922: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:13922"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13922"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:13922: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:13922"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13922"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13922" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:13922: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:13922"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13922"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:13922: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:13922"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13922"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13922" "while kill -0 \$TMPPID 2>/dev/null"





    as hv2
    if test "hv2" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:13922: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:13922"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13922"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:13922: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:13922"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13922"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13922" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:13922: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:13922"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13922"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:13922: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:13922"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13922"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13922" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:13922: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:13922"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13922"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:13922: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:13922"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13922"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13922" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv2
    { set +x
$as_echo "$at_srcdir/ovn.at:13922: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:13922"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13922"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:13922: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:13922"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13922"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13922" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:13922: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:13922"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13922"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:13922: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:13922"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13922"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13922" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:13922: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:13922"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13922"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:13922: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:13922"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13922"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13922" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:13922: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:13922"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13922"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:13922: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:13922"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13922"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13922" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:13922: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:13922"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13922"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:13922: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:13922"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13922"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13922" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:13922: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:13922"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13922"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:13922: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:13922"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13922"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13922" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:13922: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:13922"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13922"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:13922: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:13922"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13922"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13922" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:13922: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:13922"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13922"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:13922: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:13922"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13922"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:13922" "while kill -0 \$TMPPID 2>/dev/null"





ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_103
#AT_START_104
at_fn_group_banner 104 'ovn.at:13927' \
  "ovn -- ovn-nbctl duplicate addresses" "           " 2
at_xfail=no
(
  $as_echo "104. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

# Set up a switch with some switch ports of varying address types
ovn-nbctl ls-add sw1
ovn-nbctl set logical_switch sw1 other_config:subnet=192.168.0.0/24

ovn-nbctl lsp-add sw1 sw1-p1
ovn-nbctl lsp-add sw1 sw1-p2
ovn-nbctl lsp-add sw1 sw1-p3
ovn-nbctl lsp-add sw1 sw1-p4

ovn-nbctl lsp-set-addresses sw1-p1 "00:00:00:00:00:01 10.0.0.1 aef0::1" "00:00:00:00:00:02 10.0.0.2 aef0::2"
ovn-nbctl lsp-set-addresses sw1-p2 "00:00:00:00:00:03 dynamic"
ovn-nbctl lsp-set-addresses sw1-p3 "dynamic"
ovn-nbctl lsp-set-addresses sw1-p4 "router"
ovn-nbctl lsp-set-addresses sw1-p5 "unknown"

ovn-nbctl list logical_switch_port

# Now try to add duplicate addresses on a new port. These should all fail
ovn-nbctl --wait=sb lsp-add sw1 sw1-p5
{ set +x
$as_echo "$at_srcdir/ovn.at:13949: ovn-nbctl lsp-set-addresses sw1-p5 \"00:00:00:00:00:04 10.0.0.1\""
at_fn_check_prepare_trace "ovn.at:13949"
( $at_check_trace; ovn-nbctl lsp-set-addresses sw1-p5 "00:00:00:00:00:04 10.0.0.1"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: Error on switch sw1: duplicate IPv4 address '10.0.0.1' found on logical switch port 'sw1-p1'
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn.at:13949"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:13952: ovn-nbctl lsp-set-addresses sw1-p5 \"00:00:00:00:00:04 10.0.0.2\""
at_fn_check_prepare_trace "ovn.at:13952"
( $at_check_trace; ovn-nbctl lsp-set-addresses sw1-p5 "00:00:00:00:00:04 10.0.0.2"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: Error on switch sw1: duplicate IPv4 address '10.0.0.2' found on logical switch port 'sw1-p1'
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn.at:13952"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:13955: ovn-nbctl lsp-set-addresses sw1-p5 \"00:00:00:00:00:04 aef0::1\""
at_fn_check_prepare_trace "ovn.at:13955"
( $at_check_trace; ovn-nbctl lsp-set-addresses sw1-p5 "00:00:00:00:00:04 aef0::1"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: Error on switch sw1: duplicate IPv6 address 'aef0::1' found on logical switch port 'sw1-p1'
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn.at:13955"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:13958: ovn-nbctl lsp-set-addresses sw1-p5 \"00:00:00:00:00:04 aef0::2\""
at_fn_check_prepare_trace "ovn.at:13958"
( $at_check_trace; ovn-nbctl lsp-set-addresses sw1-p5 "00:00:00:00:00:04 aef0::2"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: Error on switch sw1: duplicate IPv6 address 'aef0::2' found on logical switch port 'sw1-p1'
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn.at:13958"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:13961: ovn-nbctl lsp-set-addresses sw1-p5 \"00:00:00:00:00:04 192.168.0.2\""
at_fn_check_prepare_trace "ovn.at:13961"
( $at_check_trace; ovn-nbctl lsp-set-addresses sw1-p5 "00:00:00:00:00:04 192.168.0.2"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: Error on switch sw1: duplicate IPv4 address '192.168.0.2' found on logical switch port 'sw1-p2'
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn.at:13961"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:13964: ovn-nbctl lsp-set-addresses sw1-p5 \"00:00:00:00:00:04 192.168.0.3\""
at_fn_check_prepare_trace "ovn.at:13964"
( $at_check_trace; ovn-nbctl lsp-set-addresses sw1-p5 "00:00:00:00:00:04 192.168.0.3"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: Error on switch sw1: duplicate IPv4 address '192.168.0.3' found on logical switch port 'sw1-p3'
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn.at:13964"
$at_failed && at_fn_log_failure
$at_traceon; }


# Now try re-setting sw1-p1. This should succeed
{ set +x
$as_echo "$at_srcdir/ovn.at:13969: ovn-nbctl lsp-set-addresses sw1-p1 \"00:00:00:00:00:01 10.0.0.1 aef0::1\""
at_fn_check_prepare_trace "ovn.at:13969"
( $at_check_trace; ovn-nbctl lsp-set-addresses sw1-p1 "00:00:00:00:00:01 10.0.0.1 aef0::1"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13969"
$at_failed && at_fn_log_failure
$at_traceon; }


# Now create a new switch and try setting IP addresses the same as the
# first switch. This should succeed.
ovn-nbctl ls-add sw2
ovn-nbctl lsp-add sw2 sw2-p1

{ set +x
$as_echo "$at_srcdir/ovn.at:13976: ovn-nbctl lsp-set-addresses sw2-p1 \"00:00:00:00:00:04 10.0.0.1\""
at_fn_check_prepare_trace "ovn.at:13976"
( $at_check_trace; ovn-nbctl lsp-set-addresses sw2-p1 "00:00:00:00:00:04 10.0.0.1"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13976"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:13977: ovn-nbctl lsp-set-addresses sw2-p1 \"00:00:00:00:00:04 192.168.0.2\""
at_fn_check_prepare_trace "ovn.at:13977"
( $at_check_trace; ovn-nbctl lsp-set-addresses sw2-p1 "00:00:00:00:00:04 192.168.0.2"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13977"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:13978: ovn-nbctl lsp-set-addresses sw2-p1 \"00:00:00:00:00:04 192.168.0.3\""
at_fn_check_prepare_trace "ovn.at:13978"
( $at_check_trace; ovn-nbctl lsp-set-addresses sw2-p1 "00:00:00:00:00:04 192.168.0.3"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13978"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:13979: ovn-nbctl lsp-set-addresses sw2-p1 \"00:00:00:00:00:04 aef0::1\""
at_fn_check_prepare_trace "ovn.at:13979"
( $at_check_trace; ovn-nbctl lsp-set-addresses sw2-p1 "00:00:00:00:00:04 aef0::1"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:13979"
$at_failed && at_fn_log_failure
$at_traceon; }


ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_104
#AT_START_105
at_fn_group_banner 105 'ovn.at:13983' \
  "ovn -- router - check packet length - icmp defrag" "" 2
at_xfail=no
(
  $as_echo "105. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init


ovn_start

ovn-nbctl ls-add sw0
ovn-nbctl lsp-add sw0 sw0-port1
ovn-nbctl lsp-set-addresses sw0-port1 "50:54:00:00:00:01 10.0.0.3"

ovn-nbctl lr-add lr0
ovn-nbctl lrp-add lr0 lr0-sw0 00:00:00:00:ff:01 10.0.0.1/24
ovn-nbctl lsp-add sw0 sw0-lr0
ovn-nbctl lsp-set-type sw0-lr0 router
ovn-nbctl lsp-set-addresses sw0-lr0 router
ovn-nbctl lsp-set-options sw0-lr0 router-port=lr0-sw0

ovn-nbctl ls-add public
ovn-nbctl lrp-add lr0 lr0-public 00:00:20:20:12:13 172.168.0.100/24
ovn-nbctl lsp-add public public-lr0
ovn-nbctl lsp-set-type public-lr0 router
ovn-nbctl lsp-set-addresses public-lr0 router
ovn-nbctl lsp-set-options public-lr0 router-port=lr0-public

# localnet port
ovn-nbctl lsp-add public ln-public
ovn-nbctl lsp-set-type ln-public localnet
ovn-nbctl lsp-set-addresses ln-public unknown
ovn-nbctl lsp-set-options ln-public network_name=phys

ovn-nbctl lrp-set-gateway-chassis lr0-public hv1 20
ovn-nbctl lr-nat-add lr0 snat 172.168.0.100 10.0.0.0/24

net_add n1

sim_add hv1
as hv1
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.1
ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys
ovs-vsctl -- add-port br-int hv1-vif1 -- \
    set interface hv1-vif1 external-ids:iface-id=sw0-port1 \
    options:tx_pcap=hv1/vif1-tx.pcap \
    options:rxq_pcap=hv1/vif1-rx.pcap \
    ofport-request=1

reset_pcap_file() {
     local iface=$1
     local pcap_file=$2
     ovs-vsctl -- set Interface $iface options:tx_pcap=dummy-tx.pcap \
 options:rxq_pcap=dummy-rx.pcap
     rm -f ${pcap_file}*.pcap
     ovs-vsctl -- set Interface $iface options:tx_pcap=${pcap_file}-tx.pcap \
 options:rxq_pcap=${pcap_file}-rx.pcap
}

ip_to_hex() {
     printf "%02x%02x%02x%02x" "$@"
}

test_ip_packet_larger() {
    local icmp_pmtu_reply_expected=$1

    # Send ip packet from sw0-port1 to outside
    src_mac="505400000001" # sw-port1 mac
    dst_mac="00000000ff01" # sw0-lr0 mac (internal router leg)
    src_ip=`ip_to_hex 10 0 0 3`
    dst_ip=`ip_to_hex 172 168 0 3`
    # Set the packet length to 100.
    pkt_len=0064
    packet=${dst_mac}${src_mac}08004500${pkt_len}0000000040010000
    orig_packet_l3=${src_ip}${dst_ip}0304000000000000
    orig_packet_l3=${orig_packet_l3}000000000000000000000000000000000000
    orig_packet_l3=${orig_packet_l3}000000000000000000000000000000000000
    orig_packet_l3=${orig_packet_l3}000000000000000000000000000000000000
    orig_packet_l3=${orig_packet_l3}000000000000000000000000000000000000
    packet=${packet}${orig_packet_l3}

    gw_ip_garp=ffffffffffff00002020121308060001080006040001000020201213aca80064000000000000aca80064

    # If icmp_pmtu_reply_expected is 0, it means the packet is lesser than
    # the gateway mtu and should be delivered to the provider bridge via the
    # localnet port.
    # If icmp_pmtu_reply_expected is 1, it means the packet is larger than
    # the gateway mtu and ovn-controller should drop the packet and instead
    # generate ICMPv4  Destination Unreachable message with pmtu set to 42.
    if test $icmp_pmtu_reply_expected = 0; then
        # Packet to expect at br-phys.
        src_mac="000020201213"
        dst_mac="00000012af11"
        src_ip=`ip_to_hex 10 0 0 3`
        dst_ip=`ip_to_hex 172 168 0 3`
        expected=${dst_mac}${src_mac}08004500${pkt_len}000000003f010100
        expected=${expected}${src_ip}${dst_ip}0304000000000000
        expected=${expected}000000000000000000000000000000000000
        expected=${expected}000000000000000000000000000000000000
        expected=${expected}000000000000000000000000000000000000
        expected=${expected}000000000000000000000000000000000000
        echo $expected > br_phys_n1.expected
        echo $gw_ip_garp >> br_phys_n1.expected
    else
        # MTU would be 100 - 18 = 82 (hex 0052)
        mtu=0052
        src_ip=`ip_to_hex 10 0 0 1`
        dst_ip=`ip_to_hex 10 0 0 3`
        # pkt len should be 128 (28 (icmp packet) + 100 (orig ip + payload))
        reply_pkt_len=0080
        ip_csum=bd91
        icmp_reply=${src_mac}${dst_mac}08004500${reply_pkt_len}00004000fe016879
        icmp_reply=${icmp_reply}${src_ip}${dst_ip}0304${ip_csum}0000${mtu}
        icmp_reply=${icmp_reply}4500${pkt_len}000000003f010100
        icmp_reply=${icmp_reply}${orig_packet_l3}
        echo $icmp_reply > hv1-vif1.expected
    fi

    as hv1 reset_pcap_file br-phys_n1 hv1/br-phys_n1
    as hv1 reset_pcap_file hv1-vif1 hv1/vif1

    # Send packet from sw0-port1 to outside
    as hv1 ovs-appctl netdev-dummy/receive hv1-vif1 $packet

    if test $icmp_pmtu_reply_expected = 0; then
        ovn_check_packets__ "hv1/br-phys_n1-tx.pcap" "br_phys_n1.expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:14103: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:14103"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14103"
$at_failed && at_fn_log_failure
$at_traceon; }

        $PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/vif1-tx.pcap  > pkts
        # hv1/vif1-tx.pcap can receive the GARP packet generated by ovn-controller
        # for the gateway router port. So ignore this packet.
        cat pkts | grep -v $gw_ip_garp > packets
        { set +x
$as_echo "$at_srcdir/ovn.at:14108: cat packets"
at_fn_check_prepare_trace "ovn.at:14108"
( $at_check_trace; cat packets
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14108"
$at_failed && at_fn_log_failure
$at_traceon; }

    else
        ovn_check_packets__ "hv1/vif1-tx.pcap" "hv1-vif1.expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:14110: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:14110"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14110"
$at_failed && at_fn_log_failure
$at_traceon; }

        $PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/br-phys_n1-tx.pcap  > \
        pkts
        # hv1/br-phys_n1-tx.pcap can receive the GARP packet generated by ovn-controller
        # for the gateway router port. So ignore this packet.
        cat pkts | grep -v $gw_ip_garp > packets
        { set +x
$as_echo "$at_srcdir/ovn.at:14116: cat packets"
at_fn_check_prepare_trace "ovn.at:14116"
( $at_check_trace; cat packets
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14116"
$at_failed && at_fn_log_failure
$at_traceon; }

    fi
}

ovn-nbctl show
ovn-sbctl show

{ set +x
$as_echo "$at_srcdir/ovn.at:14123: as hv1 ovs-ofctl dump-flows br-int  \\
| grep \"check_pkt_larger\" | wc -l"
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:14123"
( $at_check_trace; as hv1 ovs-ofctl dump-flows br-int  \
| grep "check_pkt_larger" | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14123"
$at_failed && at_fn_log_failure
$at_traceon; }

dp_uuid=$(ovn-sbctl find datapath_binding | grep sw0 -B2 | grep _uuid | \
awk '{print $3}')
ovn-sbctl create MAC_Binding ip=172.168.0.3 datapath=$dp_uuid \
logical_port=lr0-public mac="00\:00\:00\:12\:af\:11"

# Set the gateway mtu to 100. If the packet length is > 100, ovn-controller
# should send icmp host not reachable with pmtu set to 100.
ovn-nbctl --wait=hv set logical_router_port lr0-public options:gateway_mtu=100
as hv3 ovs-appctl netdev-dummy/receive hv3-vif1 $arp_reply
ovs_wait_cond () {

    test `as hv1 ovs-ofctl dump-flows br-int | grep "check_pkt_larger(100)" | \
    wc -l` -eq 1

}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14135" "until
    test \`as hv1 ovs-ofctl dump-flows br-int | grep \"check_pkt_larger(100)\" | \\
    wc -l\` -eq 1
"


icmp_reply_expected=1
test_ip_packet_larger $icmp_reply_expected

# Set the gateway mtu to 500.
ovn-nbctl --wait=hv set logical_router_port lr0-public options:gateway_mtu=500
as hv3 ovs-appctl netdev-dummy/receive hv3-vif1 $arp_reply
ovs_wait_cond () {

    test `as hv1 ovs-ofctl dump-flows br-int | grep "check_pkt_larger(500)" | \
    wc -l` -eq 1

}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14146" "until
    test \`as hv1 ovs-ofctl dump-flows br-int | grep \"check_pkt_larger(500)\" | \\
    wc -l\` -eq 1
"


# Now the packet should be sent via the localnet port to br-phys.
icmp_reply_expected=0
test_ip_packet_larger $icmp_reply_expected



    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:14154: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:14154"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14154"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14154: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:14154"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14154"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14154" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:14154: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:14154"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14154"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14154: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:14154"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14154"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14154" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:14154: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:14154"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14154"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14154: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:14154"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14154"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14154" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:14154: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:14154"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14154"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14154: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:14154"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14154"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14154" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:14154: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:14154"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14154"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14154: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:14154"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14154"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14154" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:14154: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:14154"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14154"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14154: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:14154"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14154"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14154" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:14154: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:14154"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14154"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14154: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:14154"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14154"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14154" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:14154: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:14154"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14154"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14154: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:14154"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14154"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14154" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:14154: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:14154"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14154"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14154: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:14154"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14154"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14154" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:14154: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:14154"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14154"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14154: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:14154"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14154"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14154" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:14154: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:14154"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14154"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14154: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:14154"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14154"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14154" "while kill -0 \$TMPPID 2>/dev/null"



ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_105
#AT_START_106
at_fn_group_banner 106 'ovn.at:14157' \
  "ovn -- IP packet buffering" "                     " 2
at_xfail=no
(
  $as_echo "106. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init


ovn_start

# Logical network:
# One LR lr0 that has switches sw0 (192.168.1.0/24) and
# sw1 (172.16.1.0/24) connected to it.
#
# Physical network:
# Tw0 hypervisors hv[12].
# hv1 hosts vif sw0-p0.
# hv1 hosts vif sw1-p0.

send_icmp_packet() {
    local inport=$1 hv=$2 eth_src=$3 eth_dst=$4 ipv4_src=$5 ipv4_dst=$6 ip_chksum=$7 data=$8
    shift 8

    local ip_ttl=ff
    local ip_len=001c
    local packet=${eth_dst}${eth_src}08004500${ip_len}00004000${ip_ttl}01${ip_chksum}${ipv4_src}${ipv4_dst}${data}
    as hv$hv ovs-appctl netdev-dummy/receive hv$hv-vif$inport $packet
}

send_icmp6_packet() {
    local inport=$1 hv=$2 eth_src=$3 eth_dst=$4 ipv6_src=$5 ipv6_dst=$6 ipv6_router=$7 exp_icmp_chksum=$8
    shift 8

    local ip6_hdr=6000000000083aff${ipv6_src}${ipv6_dst}
    local packet=${eth_dst}${eth_src}86dd${ip6_hdr}8000dcb662f00001

    as hv$hv ovs-appctl netdev-dummy/receive hv$hv-vif$inport $packet
}

get_arp_req() {
    local eth_src=$1 spa=$2 tpa=$3
    local request=ffffffffffff${eth_src}08060001080006040001${eth_src}${spa}000000000000${tpa}
    echo $request
}

send_arp_reply() {
    local hv=$1 inport=$2 eth_src=$3 eth_dst=$4 spa=$5 tpa=$6
    local request=${eth_dst}${eth_src}08060001080006040002${eth_src}${spa}${eth_dst}${tpa}
    as hv$hv ovs-appctl netdev-dummy/receive hv${hv}-vif$inport $request
}

send_na() {
    local hv=$1 inport=$2 eth_src=$3 eth_dst=$4 src_ip=$5 dst_ip=$6
    local ip6_hdr=6000000000203aff${src_ip}${dst_ip}
    local request=${eth_dst}${eth_src}86dd${ip6_hdr}8800d78440000000${src_ip}0201${eth_src}

    as hv$hv ovs-appctl netdev-dummy/receive hv${hv}-vif$inport $request
}

get_nd() {
    local eth_src=$1 src_ip=$2 dst_ip=$3 ta=$4
    local ip6_hdr=6000000000203aff${src_ip}${dst_ip}
    request=3333ff000010${eth_src}86dd${ip6_hdr}8700357600000000${ta}0101${eth_src}

    echo $request
}

net_add n1

sim_add hv1
as hv1
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.1
ovs-vsctl -- add-port br-int hv1-vif1 -- \
    set interface hv1-vif1 external-ids:iface-id=sw0-p0 \
    options:tx_pcap=hv1/vif1-tx.pcap \
    options:rxq_pcap=hv1/vif1-rx.pcap \
    ofport-request=1

sim_add hv2
as hv2
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.2
ovs-vsctl -- add-port br-int hv2-vif1 -- \
    set interface hv2-vif1 external-ids:iface-id=sw1-p0 \
    options:tx_pcap=hv2/vif1-tx.pcap \
    options:rxq_pcap=hv2/vif1-rx.pcap \
    ofport-request=1

ovn-nbctl create Logical_Router name=lr0 options:chassis=hv1
ovn-nbctl ls-add sw0
ovn-nbctl ls-add sw1

ovn-nbctl lrp-add lr0 sw0 00:00:01:01:02:03 192.168.1.1/24 2001:0:0:0:0:0:0:1/64
ovn-nbctl lsp-add sw0 rp-sw0 -- set Logical_Switch_Port rp-sw0 \
    type=router options:router-port=sw0 \
    -- lsp-set-addresses rp-sw0 router

ovn-nbctl lrp-add lr0 sw1 00:00:02:01:02:03 172.16.1.1/24 2002:0:0:0:0:0:0:1/64
ovn-nbctl lsp-add sw1 rp-sw1 -- set Logical_Switch_Port rp-sw1 \
    type=router options:router-port=sw1 \
    -- lsp-set-addresses rp-sw1 router

ovn-nbctl lsp-add sw0 sw0-p0 \
    -- lsp-set-addresses sw0-p0 "f0:00:00:01:02:03 192.168.1.2 2001::2"

ovn-nbctl lsp-add sw1 sw1-p0 \
    -- lsp-set-addresses sw1-p0 unknown

{ set +x
$as_echo "$at_srcdir/ovn.at:14260: ovn_populate_arp__"
at_fn_check_prepare_trace "ovn.at:14260"
( $at_check_trace; ovn_populate_arp__
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14260"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn-nbctl --wait=hv sync

ip_to_hex() {
    printf "%02x%02x%02x%02x" "$@"
}

src_mac=f00000010203
src_ip=$(ip_to_hex 192 168 1 2)
src_ip6=20010000000000000000000000000002

router_mac0=000001010203
router_mac1=000002010203
router_ip=$(ip_to_hex 172 16 1 1)
router_ip6=20020000000000000000000000000001

dst_mac=001122334455
dst_ip=$(ip_to_hex 172 16 1 10)
dst_ip6=20020000000000000000000000000010

data=0800bee4391a0001

send_icmp_packet 1 1 $src_mac $router_mac0 $src_ip $dst_ip 0000 $data
send_arp_reply 2 1 $dst_mac $router_mac1 $dst_ip $router_ip
echo $(get_arp_req $router_mac1 $router_ip $dst_ip) > expected
echo "${dst_mac}${router_mac1}08004500001c00004000fe010100${src_ip}${dst_ip}${data}" >> expected

ovn_check_packets__ "hv2/vif1-tx.pcap" "expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:14287: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:14287"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14287"
$at_failed && at_fn_log_failure
$at_traceon; }


nd_ip=ff0200000000000000000001ff000010
ip6_hdr=6000000000083afe${src_ip6}${dst_ip6}

send_icmp6_packet 1 1 $src_mac $router_mac0 $src_ip6 $dst_ip6
echo $(get_nd $router_mac1 $src_ip6 $nd_ip $dst_ip6) >> expected
echo "${dst_mac}${router_mac1}86dd${ip6_hdr}8000dcb662f00001" >> expected
send_na 2 1 $dst_mac $router_mac1 $dst_ip6 $router_ip6

ovn_check_packets__ "hv2/vif1-tx.pcap" "expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:14297: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:14297"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14297"
$at_failed && at_fn_log_failure
$at_traceon; }





    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:14299: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:14299"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14299"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14299: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:14299"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14299"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14299" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:14299: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:14299"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14299"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14299: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:14299"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14299"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14299" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:14299: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:14299"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14299"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14299: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:14299"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14299"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14299" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:14299: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:14299"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14299"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14299: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:14299"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14299"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14299" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:14299: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:14299"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14299"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14299: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:14299"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14299"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14299" "while kill -0 \$TMPPID 2>/dev/null"





    as hv2
    if test "hv2" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:14299: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:14299"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14299"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14299: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:14299"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14299"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14299" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:14299: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:14299"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14299"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14299: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:14299"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14299"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14299" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:14299: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:14299"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14299"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14299: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:14299"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14299"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14299" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv2
    { set +x
$as_echo "$at_srcdir/ovn.at:14299: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:14299"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14299"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14299: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:14299"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14299"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14299" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:14299: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:14299"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14299"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14299: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:14299"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14299"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14299" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:14299: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:14299"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14299"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14299: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:14299"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14299"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14299" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:14299: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:14299"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14299"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14299: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:14299"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14299"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14299" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:14299: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:14299"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14299"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14299: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:14299"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14299"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14299" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:14299: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:14299"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14299"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14299: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:14299"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14299"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14299" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:14299: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:14299"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14299"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14299: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:14299"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14299"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14299" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:14299: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:14299"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14299"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14299: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:14299"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14299"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14299" "while kill -0 \$TMPPID 2>/dev/null"



ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_106
#AT_START_107
at_fn_group_banner 107 'ovn.at:14302' \
  "ovn -- neighbor update on same HV" "              " 2
at_xfail=no
(
  $as_echo "107. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

# Logical network:
# A public switch (pub) with a localnet port connected to two LRs (lr0 and lr1)
# each with a distributed gateway port.
# Two VMs: lp0 on sw0 connected to lr0
#          lp1 on sw1 connected to lr1
#
# This test adds a floating IP to each VM so when they are bound to the same
# hypervisor, it checks that the GARP sent by ovn-controller causes the
# MAC_Binding entries to be updated properly on each logical router.
# It will also capture packets on the physical interface to make sure that the
# GARPs have been sent out to the external network as well.

# Create logical switches
ovn-nbctl ls-add sw0
ovn-nbctl ls-add sw1
ovn-nbctl ls-add pub

# Created localnet port on public switch
ovn-nbctl lsp-add pub ln-pub
ovn-nbctl lsp-set-type ln-pub localnet
ovn-nbctl lsp-set-addresses ln-pub unknown
ovn-nbctl lsp-set-options ln-pub network_name=phys

# Create logical routers and connect them to public switch
ovn-nbctl create Logical_Router name=lr0
ovn-nbctl create Logical_Router name=lr1

ovn-nbctl lrp-add lr0 lr0-pub f0:00:00:00:00:01 172.24.4.220/24
ovn-nbctl lsp-add pub pub-lr0 -- set Logical_Switch_Port pub-lr0 \
    type=router options:router-port=lr0-pub options:nat-addresses="router" addresses="router"
ovn-nbctl lrp-add lr1 lr1-pub f0:00:00:00:01:01 172.24.4.221/24
ovn-nbctl lsp-add pub pub-lr1 -- set Logical_Switch_Port pub-lr1 \
    type=router options:router-port=lr1-pub options:nat-addresses="router" addresses="router"

ovn-nbctl lrp-set-gateway-chassis lr0-pub hv1 10
ovn-nbctl lrp-set-gateway-chassis lr1-pub hv1 10

# Connect sw0 and sw1 to lr0 and lr1
ovn-nbctl lrp-add lr0 lr0-sw0 00:00:00:00:ff:01 10.0.0.254/24
ovn-nbctl lsp-add sw0 sw0-lr0 -- set Logical_Switch_Port sw0-lr0 type=router \
    options:router-port=lr0-sw0 addresses="router"
ovn-nbctl lrp-add lr1 lr1-sw1 00:00:00:00:ff:02 20.0.0.254/24
ovn-nbctl lsp-add sw1 sw1-lr1 -- set Logical_Switch_Port sw1-lr1 type=router \
    options:router-port=lr1-sw1 addresses="router"


# Add SNAT rules
ovn-nbctl lr-nat-add lr0 snat 172.24.4.220 10.0.0.0/24
ovn-nbctl lr-nat-add lr1 snat 172.24.4.221 20.0.0.0/24

net_add n1
sim_add hv1
as hv1
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 172.24.4.1
ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys

ovs-vsctl add-port br-int vif0 -- set Interface vif0 external-ids:iface-id=lp0
ovs-vsctl add-port br-int vif1 -- set Interface vif1 external-ids:iface-id=lp1

ovn-nbctl lsp-add sw0 lp0
ovn-nbctl lsp-add sw1 lp1
ovn-nbctl lsp-set-addresses lp0 "50:54:00:00:00:01 10.0.0.10"
ovn-nbctl lsp-set-addresses lp1 "50:54:00:00:00:02 20.0.0.10"

ovs_wait_cond () {
    test x`ovn-nbctl lsp-get-up lp0` = xup
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14370" "until test x\`ovn-nbctl lsp-get-up lp0\` = xup"

ovs_wait_cond () {
    test x`ovn-nbctl lsp-get-up lp1` = xup
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14371" "until test x\`ovn-nbctl lsp-get-up lp1\` = xup"


# Create two floating IPs, one for each VIF
ovn-nbctl lr-nat-add lr0 dnat_and_snat 172.24.4.100 10.0.0.10
ovn-nbctl lr-nat-add lr1 dnat_and_snat 172.24.4.200 20.0.0.10

# Check that the MAC_Binding entries have been properly created
ovs_wait_cond () {
    test `ovn-sbctl find mac_binding logical_port="lr0-pub" ip="172.24.4.200" | wc -l` -gt 0
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14378" "until test \`ovn-sbctl find mac_binding logical_port=\"lr0-pub\" ip=\"172.24.4.200\" | wc -l\` -gt 0"

ovs_wait_cond () {
    test `ovn-sbctl find mac_binding logical_port="lr1-pub" ip="172.24.4.100" | wc -l` -gt 0
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14379" "until test \`ovn-sbctl find mac_binding logical_port=\"lr1-pub\" ip=\"172.24.4.100\" | wc -l\` -gt 0"


# Check that the GARPs went also to the external physical network
# Wait until at least 4 packets have arrived and copy them to a separate file as
# more GARPs are expected in the capture in order to avoid race conditions.
ovs_wait_cond () {
    test `$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/br-phys-tx.pcap | wc -l` -gt 4
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14384" "until test \`\$PYTHON \"\$ovs_srcdir/utilities/ovs-pcap.in\" hv1/br-phys-tx.pcap | wc -l\` -gt 4"

$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/br-phys-tx.pcap | head -n4 > hv1/br-phys-tx4.pcap

# GARP for lp0 172.24.4.100 on lr0-pub MAC (f0:00:00:00:00:01)
echo "fffffffffffff0000000000108060001080006040001f00000000001ac180464000000000000ac180464" > expout
# GARP for 172.24.4.220 on lr0-pub (f0:00:00:00:00:01)
echo "fffffffffffff0000000000108060001080006040001f00000000001ac1804dc000000000000ac1804dc" >> expout
# GARP for lp1 172.24.4.200 on lr1-pub MAC (f0:00:00:00:01:01)
echo "fffffffffffff0000000010108060001080006040001f00000000101ac1804c8000000000000ac1804c8" >> expout
# GARP for 172.24.4.221 on lr1-pub (f0:00:00:00:01:01)
echo "fffffffffffff0000000010108060001080006040001f00000000101ac1804dd000000000000ac1804dd" >> expout
{ set +x
$as_echo "$at_srcdir/ovn.at:14395: sort hv1/br-phys-tx4.pcap"
at_fn_check_prepare_trace "ovn.at:14395"
( $at_check_trace; sort hv1/br-phys-tx4.pcap
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14395"
$at_failed && at_fn_log_failure
$at_traceon; }

#OVN_CHECK_PACKETS([hv1/br-phys-tx4.pcap], [br-phys.expected])




    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:14398: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:14398"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14398"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14398: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:14398"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14398"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14398" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:14398: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:14398"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14398"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14398: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:14398"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14398"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14398" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:14398: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:14398"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14398"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14398: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:14398"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14398"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14398" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:14398: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:14398"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14398"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14398: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:14398"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14398"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14398" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:14398: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:14398"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14398"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14398: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:14398"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14398"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14398" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:14398: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:14398"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14398"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14398: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:14398"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14398"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14398" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:14398: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:14398"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14398"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14398: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:14398"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14398"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14398" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:14398: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:14398"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14398"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14398: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:14398"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14398"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14398" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:14398: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:14398"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14398"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14398: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:14398"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14398"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14398" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:14398: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:14398"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14398"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14398: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:14398"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14398"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14398" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:14398: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:14398"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14398"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14398: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:14398"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14398"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14398" "while kill -0 \$TMPPID 2>/dev/null"



ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_107
#AT_START_108
at_fn_group_banner 108 'ovn.at:14401' \
  "ovn -- ipam to non-ipam" "                        " 2
at_xfail=no
(
  $as_echo "108. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

ovn-nbctl --wait=hv set NB_Global . options:mac_prefix="0a:00:00:00:00:00"
ovn-nbctl ls-add sw0
ovn-nbctl lsp-add sw0 p0 -- lsp-set-addresses p0 dynamic
ovn-nbctl --wait=sb add Logical-Switch sw0 other_config subnet=192.168.1.0/24

{ set +x
$as_echo "$at_srcdir/ovn.at:14409: ovn-nbctl get Logical-Switch-Port p0 dynamic_addresses"
at_fn_check_prepare_trace "ovn.at:14409"
( $at_check_trace; ovn-nbctl get Logical-Switch-Port p0 dynamic_addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"0a:00:00:a8:01:03 192.168.1.2\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14409"
$at_failed && at_fn_log_failure
$at_traceon; }


ovn-nbctl --wait=sb lsp-set-addresses p0 router

ovn-nbctl get Logical-Switch-Port p0 dynamic_addresses

{ set +x
$as_echo "$at_srcdir/ovn.at:14417: ovn-nbctl get Logical-Switch-Port p0 dynamic_addresses"
at_fn_check_prepare_trace "ovn.at:14417"
( $at_check_trace; ovn-nbctl get Logical-Switch-Port p0 dynamic_addresses
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "[]
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14417"
$at_failed && at_fn_log_failure
$at_traceon; }

ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_108
#AT_START_109
at_fn_group_banner 109 'ovn.at:14421' \
  "ovn -- ipam router ports" "                       " 2
at_xfail=no
(
  $as_echo "109. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

ovn-nbctl ls-add sw
ovn-nbctl set logical_switch sw other-config:subnet=192.168.1.0/24

for i in 2 3 4; do
    ovn-nbctl lr-add ro$i
    ovn-nbctl lsp-add sw swp$i
    ovn-nbctl --wait=sb lsp-set-addresses swp$i "02:00:00:00:00:0$i dynamic"
    cidr=$(ovn-nbctl get logical_switch_port swp$i dynamic_addresses |cut -f2 -d' '|cut -f1 -d\")
    ovn-nbctl lrp-add ro$i rop$i 02:00:00:00:00:0$i $cidr/24 -- set logical_switch_port swp$i type=router options:router-port=rop$i addresses=router;
    { set +x
$as_echo "$at_srcdir/ovn.at:14433: ovn-nbctl get logical_router_port rop\$i networks"
at_fn_check_prepare_dynamic "ovn-nbctl get logical_router_port rop$i networks" "ovn.at:14433"
( $at_check_trace; ovn-nbctl get logical_router_port rop$i networks
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "[\"192.168.1.$i/24\"]
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14433"
$at_failed && at_fn_log_failure
$at_traceon; }

done

ovn-nbctl list logical_switch_port
ovn-nbctl list logical_router_port

ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_109
#AT_START_110
at_fn_group_banner 110 'ovn.at:14442' \
  "ovn -- test transport zones" "                    " 2
at_xfail=no
(
  $as_echo "110. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

net_add n1
for i in 1 2 3 4 5; do
    sim_add hv$i
    as hv$i
    ovs-vsctl add-br br-phys
    ovn_attach n1 br-phys 192.168.$i.1
done

ovn-nbctl --wait=sb --timeout=3 sync
ovn-nbctl --wait=hv --timeout=3 sync

as hv1
{ set +x
$as_echo "$at_srcdir/ovn.at:14459: ovs-vsctl --bare --columns=name find interface type=\"geneve\" | awk NF | sort"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:14459"
( $at_check_trace; ovs-vsctl --bare --columns=name find interface type="geneve" | awk NF | sort
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "ovn-hv2-0
ovn-hv3-0
ovn-hv4-0
ovn-hv5-0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14459"
$at_failed && at_fn_log_failure
$at_traceon; }


as hv2
{ set +x
$as_echo "$at_srcdir/ovn.at:14467: ovs-vsctl --bare --columns=name find interface type=\"geneve\" | awk NF | sort"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:14467"
( $at_check_trace; ovs-vsctl --bare --columns=name find interface type="geneve" | awk NF | sort
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "ovn-hv1-0
ovn-hv3-0
ovn-hv4-0
ovn-hv5-0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14467"
$at_failed && at_fn_log_failure
$at_traceon; }


as hv3
{ set +x
$as_echo "$at_srcdir/ovn.at:14475: ovs-vsctl --bare --columns=name find interface type=\"geneve\" | awk NF | sort"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:14475"
( $at_check_trace; ovs-vsctl --bare --columns=name find interface type="geneve" | awk NF | sort
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "ovn-hv1-0
ovn-hv2-0
ovn-hv4-0
ovn-hv5-0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14475"
$at_failed && at_fn_log_failure
$at_traceon; }


as hv4
{ set +x
$as_echo "$at_srcdir/ovn.at:14483: ovs-vsctl --bare --columns=name find interface type=\"geneve\" | awk NF | sort"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:14483"
( $at_check_trace; ovs-vsctl --bare --columns=name find interface type="geneve" | awk NF | sort
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "ovn-hv1-0
ovn-hv2-0
ovn-hv3-0
ovn-hv5-0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14483"
$at_failed && at_fn_log_failure
$at_traceon; }


as hv5
{ set +x
$as_echo "$at_srcdir/ovn.at:14491: ovs-vsctl --bare --columns=name find interface type=\"geneve\" | awk NF | sort"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:14491"
( $at_check_trace; ovs-vsctl --bare --columns=name find interface type="geneve" | awk NF | sort
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "ovn-hv1-0
ovn-hv2-0
ovn-hv3-0
ovn-hv4-0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14491"
$at_failed && at_fn_log_failure
$at_traceon; }


as hv1
ovs-vsctl set open . external-ids:ovn-transport-zones=tz1,tz2

as hv2
ovs-vsctl set open . external-ids:ovn-transport-zones=tz1

as hv3
ovs-vsctl set open . external-ids:ovn-transport-zones=tz2

ovn-nbctl --wait=sb --timeout=3 sync
ovn-nbctl --wait=hv --timeout=3 sync

as hv1
{ set +x
$as_echo "$at_srcdir/ovn.at:14526: ovs-vsctl --bare --columns=name find interface type=\"geneve\" | awk NF | sort"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:14526"
( $at_check_trace; ovs-vsctl --bare --columns=name find interface type="geneve" | awk NF | sort
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "ovn-hv2-0
ovn-hv3-0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14526"
$at_failed && at_fn_log_failure
$at_traceon; }


as hv2
{ set +x
$as_echo "$at_srcdir/ovn.at:14532: ovs-vsctl --bare --columns=name find interface type=\"geneve\" | awk NF | sort"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:14532"
( $at_check_trace; ovs-vsctl --bare --columns=name find interface type="geneve" | awk NF | sort
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "ovn-hv1-0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14532"
$at_failed && at_fn_log_failure
$at_traceon; }


as hv3
{ set +x
$as_echo "$at_srcdir/ovn.at:14537: ovs-vsctl --bare --columns=name find interface type=\"geneve\" | awk NF | sort"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:14537"
( $at_check_trace; ovs-vsctl --bare --columns=name find interface type="geneve" | awk NF | sort
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "ovn-hv1-0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14537"
$at_failed && at_fn_log_failure
$at_traceon; }


as hv4
{ set +x
$as_echo "$at_srcdir/ovn.at:14542: ovs-vsctl --bare --columns=name find interface type=\"geneve\" | awk NF | sort"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:14542"
( $at_check_trace; ovs-vsctl --bare --columns=name find interface type="geneve" | awk NF | sort
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "ovn-hv5-0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14542"
$at_failed && at_fn_log_failure
$at_traceon; }


as hv5
{ set +x
$as_echo "$at_srcdir/ovn.at:14547: ovs-vsctl --bare --columns=name find interface type=\"geneve\" | awk NF | sort"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:14547"
( $at_check_trace; ovs-vsctl --bare --columns=name find interface type="geneve" | awk NF | sort
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "ovn-hv4-0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14547"
$at_failed && at_fn_log_failure
$at_traceon; }


for i in 1 2 3; do
    as hv$i
    ovs-vsctl remove open . external-ids ovn-transport-zones
done

ovn-nbctl --wait=sb --timeout=3 sync
ovn-nbctl --wait=hv --timeout=3 sync

as hv1
{ set +x
$as_echo "$at_srcdir/ovn.at:14563: ovs-vsctl --bare --columns=name find interface type=\"geneve\" | awk NF | sort"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:14563"
( $at_check_trace; ovs-vsctl --bare --columns=name find interface type="geneve" | awk NF | sort
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "ovn-hv2-0
ovn-hv3-0
ovn-hv4-0
ovn-hv5-0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14563"
$at_failed && at_fn_log_failure
$at_traceon; }


as hv2
{ set +x
$as_echo "$at_srcdir/ovn.at:14571: ovs-vsctl --bare --columns=name find interface type=\"geneve\" | awk NF | sort"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:14571"
( $at_check_trace; ovs-vsctl --bare --columns=name find interface type="geneve" | awk NF | sort
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "ovn-hv1-0
ovn-hv3-0
ovn-hv4-0
ovn-hv5-0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14571"
$at_failed && at_fn_log_failure
$at_traceon; }


as hv3
{ set +x
$as_echo "$at_srcdir/ovn.at:14579: ovs-vsctl --bare --columns=name find interface type=\"geneve\" | awk NF | sort"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:14579"
( $at_check_trace; ovs-vsctl --bare --columns=name find interface type="geneve" | awk NF | sort
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "ovn-hv1-0
ovn-hv2-0
ovn-hv4-0
ovn-hv5-0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14579"
$at_failed && at_fn_log_failure
$at_traceon; }


as hv4
{ set +x
$as_echo "$at_srcdir/ovn.at:14587: ovs-vsctl --bare --columns=name find interface type=\"geneve\" | awk NF | sort"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:14587"
( $at_check_trace; ovs-vsctl --bare --columns=name find interface type="geneve" | awk NF | sort
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "ovn-hv1-0
ovn-hv2-0
ovn-hv3-0
ovn-hv5-0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14587"
$at_failed && at_fn_log_failure
$at_traceon; }


as hv5
{ set +x
$as_echo "$at_srcdir/ovn.at:14595: ovs-vsctl --bare --columns=name find interface type=\"geneve\" | awk NF | sort"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:14595"
( $at_check_trace; ovs-vsctl --bare --columns=name find interface type="geneve" | awk NF | sort
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "ovn-hv1-0
ovn-hv2-0
ovn-hv3-0
ovn-hv4-0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14595"
$at_failed && at_fn_log_failure
$at_traceon; }





    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:14602: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:14602"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14602"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14602: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:14602"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14602"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14602" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:14602: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:14602"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14602"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14602: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:14602"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14602"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14602" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:14602: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:14602"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14602"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14602: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:14602"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14602"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14602" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:14602: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:14602"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14602"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14602: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:14602"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14602"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14602" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:14602: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:14602"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14602"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14602: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:14602"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14602"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14602" "while kill -0 \$TMPPID 2>/dev/null"





    as hv2
    if test "hv2" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:14602: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:14602"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14602"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14602: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:14602"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14602"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14602" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:14602: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:14602"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14602"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14602: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:14602"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14602"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14602" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:14602: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:14602"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14602"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14602: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:14602"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14602"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14602" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv2
    { set +x
$as_echo "$at_srcdir/ovn.at:14602: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:14602"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14602"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14602: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:14602"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14602"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14602" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:14602: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:14602"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14602"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14602: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:14602"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14602"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14602" "while kill -0 \$TMPPID 2>/dev/null"





    as hv3
    if test "hv3" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:14602: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:14602"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14602"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14602: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:14602"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14602"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14602" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:14602: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:14602"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14602"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14602: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:14602"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14602"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14602" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:14602: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:14602"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14602"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14602: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:14602"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14602"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14602" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv3
    { set +x
$as_echo "$at_srcdir/ovn.at:14602: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:14602"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14602"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14602: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:14602"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14602"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14602" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:14602: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:14602"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14602"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14602: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:14602"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14602"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14602" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:14602: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:14602"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14602"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14602: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:14602"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14602"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14602" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:14602: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:14602"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14602"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14602: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:14602"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14602"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14602" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:14602: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:14602"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14602"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14602: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:14602"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14602"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14602" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:14602: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:14602"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14602"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14602: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:14602"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14602"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14602" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:14602: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:14602"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14602"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14602: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:14602"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14602"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14602" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:14602: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:14602"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14602"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14602: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:14602"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14602"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14602" "while kill -0 \$TMPPID 2>/dev/null"



ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_110
#AT_START_111
at_fn_group_banner 111 'ovn.at:14605' \
  "ovn -- 2 HVs, 2 lports/HV, localnet ports, DVR chassis mac" "" 2
at_xfail=no
(
  $as_echo "111. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start


# In this test cases we create 2 switches, all connected to same
# physical network (through br-phys on each HV). Each switch has
# 1 VIF. Each HV has 1 VIF port. The first digit
# of VIF port name indicates the hypervisor it is bound to, e.g.
# lp23 means VIF 3 on hv2.
#
# Each switch's VLAN tag and their logical switch ports are:
#   - ls1:
#       - tagged with VLAN 101
#       - ports: lp11
#   - ls2:
#       - tagged with VLAN 201
#       - ports: lp22
#
# Note: a localnet port is created for each switch to connect to
# physical network.

for i in 1 2; do
    ls_name=ls$i
    ovn-nbctl ls-add $ls_name
    ln_port_name=ln$i
    if test $i -eq 1; then
        ovn-nbctl lsp-add $ls_name $ln_port_name "" 101
    elif test $i -eq 2; then
        ovn-nbctl lsp-add $ls_name $ln_port_name "" 201
    fi
    ovn-nbctl lsp-set-addresses $ln_port_name unknown
    ovn-nbctl lsp-set-type $ln_port_name localnet
    ovn-nbctl lsp-set-options $ln_port_name network_name=phys
done

# lsp_to_ls LSP
#
# Prints the name of the logical switch that contains LSP.
lsp_to_ls () {
    case $1 in         lp?[11]) echo ls1 ;;         lp?[12]) echo ls2 ;;         *) $as_echo "ovn.at:14647" >"$at_check_line_file"
at_fn_check_skip 99 "$at_srcdir/ovn.at:14647" ;;
    esac
}

vif_to_ls () {
    case $1 in         vif?[11]) echo ls1 ;;         vif?[12]) echo ls2 ;;         *) $as_echo "ovn.at:14655" >"$at_check_line_file"
at_fn_check_skip 99 "$at_srcdir/ovn.at:14655" ;;
    esac
}

hv_to_num () {
    case $1 in         hv1) echo 1 ;;         hv2) echo 2 ;;         *) $as_echo "ovn.at:14663" >"$at_check_line_file"
at_fn_check_skip 99 "$at_srcdir/ovn.at:14663" ;;
    esac
}

vif_to_num () {
    case $1 in         vif22) echo 22 ;;         vif21) echo 21 ;;         *) $as_echo "ovn.at:14671" >"$at_check_line_file"
at_fn_check_skip 99 "$at_srcdir/ovn.at:14671" ;;
    esac
}

vif_to_hv () {
    case $1 in         vif[1]?) echo hv1 ;;         vif[2]?) echo hv2 ;;         *) $as_echo "ovn.at:14679" >"$at_check_line_file"
at_fn_check_skip 99 "$at_srcdir/ovn.at:14679" ;;
    esac
}

vif_to_lrp () {
    echo router-to-`vif_to_ls $1`
}

hv_to_chassis_mac () {
     case $1 in         hv[1]) echo aa:bb:cc:dd:ee:11 ;;         hv[2]) echo aa:bb:cc:dd:ee:22 ;;         *) $as_echo "ovn.at:14691" >"$at_check_line_file"
at_fn_check_skip 99 "$at_srcdir/ovn.at:14691" ;;
    esac
}

lrp_to_lrp_mac () {
     case $1 in         router-to-ls[1]) echo 000001010203 ;;         router-to-ls[2]) echo 000001010205 ;;         *) $as_echo "ovn.at:14699" >"$at_check_line_file"
at_fn_check_skip 99 "$at_srcdir/ovn.at:14699" ;;
    esac
}

ip_to_hex() {
       printf "%02x%02x%02x%02x" "$@"
}

net_add n1
for i in 1 2; do
    sim_add hv$i
    as hv$i
    ovs-vsctl add-br br-phys
    ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys
    ovs-vsctl set open . external-ids:ovn-chassis-mac-mappings="phys:aa:bb:cc:dd:ee:$i$i"
    ovn_attach n1 br-phys 192.168.0.$i

    ovs-vsctl add-port br-int vif$i$i -- \
        set Interface vif$i$i external-ids:iface-id=lp$i$i \
                              options:tx_pcap=hv$i/vif$i$i-tx.pcap \
                              options:rxq_pcap=hv$i/vif$i$i-rx.pcap \
                              ofport-request=$i$i

    lsp_name=lp$i$i
    ls_name=$(lsp_to_ls $lsp_name)

    ovn-nbctl lsp-add $ls_name $lsp_name
    ovn-nbctl lsp-set-addresses $lsp_name "f0:00:00:00:00:$i$i 192.168.$i.$i"
    ovn-nbctl lsp-set-port-security $lsp_name f0:00:00:00:00:$i$i

    ovs_wait_cond () {
    test x`ovn-nbctl lsp-get-up $lsp_name` = xup
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14729" "until test x\`ovn-nbctl lsp-get-up \$lsp_name\` = xup"


done

ovn-nbctl lr-add router
ovn-nbctl lrp-add router router-to-ls1 00:00:01:01:02:03 192.168.1.3/24
ovn-nbctl lrp-add router router-to-ls2 00:00:01:01:02:05 192.168.2.3/24

ovn-nbctl lsp-add ls1 ls1-to-router -- set Logical_Switch_Port ls1-to-router type=router options:router-port=router-to-ls1 -- lsp-set-addresses ls1-to-router router
ovn-nbctl lsp-add ls2 ls2-to-router -- set Logical_Switch_Port ls2-to-router type=router options:router-port=router-to-ls2 -- lsp-set-addresses ls2-to-router router

ovn-nbctl --wait=sb sync
#ovn-sbctl dump-flows

ovn-nbctl show
ovn-sbctl show

{ set +x
$as_echo "$at_srcdir/ovn.at:14746: ovn_populate_arp__"
at_fn_check_prepare_trace "ovn.at:14746"
( $at_check_trace; ovn_populate_arp__
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14746"
$at_failed && at_fn_log_failure
$at_traceon; }


test_ip() {
    # This packet has bad checksums but logical L3 routing doesn't check.
    local inport=$1 src_mac=$2 dst_mac=$3 src_ip=$4 dst_ip=$5
    local packet=${dst_mac}${src_mac}08004500001c0000000040110000${src_ip}${dst_ip}0035111100080000
    shift; shift; shift; shift; shift
    hv=`vif_to_hv $inport`
    hv_num=`hv_to_num $hv`
    chassis_mac=`hv_to_chassis_mac $hv`
    as $hv ovs-appctl netdev-dummy/receive $inport $packet
    #as $hv ovs-appctl ofproto/trace br-int in_port=$inport $packet
    in_ls=`vif_to_ls $inport`
    in_lrp=`vif_to_lrp $inport`
    for outport; do
        out_ls=`vif_to_ls $outport`
        if test $in_ls = $out_ls; then
            # Ports on the same logical switch receive exactly the same packet.
            echo $packet
        else
            # Routing decrements TTL and updates source and dest MAC
            # (and checksum).
            outport_num=`vif_to_num $outport`
            out_lrp=`vif_to_lrp $outport`
            lrp_mac=`lrp_to_lrp_mac $out_lrp`
            echo f000000000${outport_num}${lrp_mac}08004500001c00000000"3f1101"00${src_ip}${dst_ip}0035111100080000

        fi >> $outport.expected
    done
}

# Dump a bunch of info helpful for debugging if there's a failure.

echo "------ OVN dump ------"
ovn-nbctl show
ovn-sbctl show

echo "------ hv1 dump ------"
as hv1 ovs-vsctl show
as hv1 ovs-vsctl list Open_Vswitch

echo "------ hv2 dump ------"
as hv2 ovs-vsctl show
as hv2 ovs-vsctl list Open_Vswitch

echo "Send traffic"
sip=`ip_to_hex 192 168 1 1`
dip=`ip_to_hex 192 168 2 2`
test_ip vif11 f00000000011  000001010203 $sip $dip vif22

echo "----------- Post Traffic hv1 dump -----------"
as hv1 ovs-ofctl -O OpenFlow13 dump-flows br-int
as hv1 ovs-appctl fdb/show br-phys

echo "----------- Post Traffic hv2 dump -----------"
as hv2 ovs-ofctl -O OpenFlow13 dump-flows br-int
as hv2 ovs-appctl fdb/show br-phys

ovn_check_packets__ "hv2/vif22-tx.pcap" "vif22.expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:14804: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:14804"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14804"
$at_failed && at_fn_log_failure
$at_traceon; }





    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:14806: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:14806"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14806"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14806: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:14806"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14806"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14806" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:14806: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:14806"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14806"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14806: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:14806"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14806"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14806" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:14806: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:14806"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14806"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14806: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:14806"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14806"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14806" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:14806: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:14806"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14806"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14806: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:14806"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14806"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14806" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:14806: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:14806"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14806"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14806: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:14806"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14806"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14806" "while kill -0 \$TMPPID 2>/dev/null"





    as hv2
    if test "hv2" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:14806: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:14806"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14806"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14806: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:14806"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14806"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14806" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:14806: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:14806"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14806"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14806: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:14806"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14806"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14806" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:14806: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:14806"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14806"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14806: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:14806"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14806"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14806" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv2
    { set +x
$as_echo "$at_srcdir/ovn.at:14806: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:14806"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14806"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14806: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:14806"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14806"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14806" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:14806: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:14806"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14806"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14806: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:14806"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14806"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14806" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:14806: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:14806"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14806"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14806: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:14806"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14806"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14806" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:14806: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:14806"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14806"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14806: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:14806"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14806"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14806" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:14806: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:14806"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14806"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14806: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:14806"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14806"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14806" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:14806: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:14806"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14806"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14806: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:14806"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14806"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14806" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:14806: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:14806"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14806"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14806: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:14806"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14806"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14806" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:14806: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:14806"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14806"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:14806: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:14806"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14806"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14806" "while kill -0 \$TMPPID 2>/dev/null"




ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_111
#AT_START_112
at_fn_group_banner 112 'ovn.at:14810' \
  "ovn -- virtual ports" "                           " 2
at_xfail=no
(
  $as_echo "112. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init


ovn_start

send_garp() {
    local hv=$1 inport=$2 eth_src=$3 eth_dst=$4 spa=$5 tpa=$6
    local request=${eth_dst}${eth_src}08060001080006040001${eth_src}${spa}${eth_dst}${tpa}
    as hv$hv ovs-appctl netdev-dummy/receive hv${hv}-vif$inport $request
}

send_arp_reply() {
    local hv=$1 inport=$2 eth_src=$3 eth_dst=$4 spa=$5 tpa=$6
    local request=${eth_dst}${eth_src}08060001080006040002${eth_src}${spa}${eth_dst}${tpa}
    as hv$hv ovs-appctl netdev-dummy/receive hv${hv}-vif$inport $request
}

net_add n1

sim_add hv1
as hv1
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.1
ovs-vsctl -- add-port br-int hv1-vif1 -- \
    set interface hv1-vif1 external-ids:iface-id=sw0-p1 \
    options:tx_pcap=hv1/vif1-tx.pcap \
    options:rxq_pcap=hv1/vif1-rx.pcap \
    ofport-request=1
ovs-vsctl -- add-port br-int hv1-vif2 -- \
    set interface hv1-vif2 external-ids:iface-id=sw0-p3 \
    options:tx_pcap=hv1/vif2-tx.pcap \
    options:rxq_pcap=hv1/vif2-rx.pcap \
    ofport-request=2

sim_add hv2
as hv2
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.2
ovs-vsctl -- add-port br-int hv2-vif1 -- \
    set interface hv2-vif1 external-ids:iface-id=sw0-p2 \
    options:tx_pcap=hv2/vif1-tx.pcap \
    options:rxq_pcap=hv2/vif1-rx.pcap \
    ofport-request=1
ovs-vsctl -- add-port br-int hv2-vif2 -- \
    set interface hv2-vif2 external-ids:iface-id=sw1-p1 \
    options:tx_pcap=hv2/vif2-tx.pcap \
    options:rxq_pcap=hv2/vif2-rx.pcap \
    ofport-request=2

ovn-nbctl ls-add sw0

ovn-nbctl lsp-add sw0 sw0-vir
ovn-nbctl lsp-set-addresses sw0-vir "50:54:00:00:00:10 10.0.0.10"
ovn-nbctl lsp-set-port-security sw0-vir "50:54:00:00:00:10 10.0.0.10"
ovn-nbctl lsp-set-type sw0-vir virtual
ovn-nbctl set logical_switch_port sw0-vir options:virtual-ip=10.0.0.10
ovn-nbctl set logical_switch_port sw0-vir options:virtual-parents=sw0-p1,sw0-p2,sw0-p3

ovn-nbctl lsp-add sw0 sw0-p1
ovn-nbctl lsp-set-addresses sw0-p1 "50:54:00:00:00:03 10.0.0.3"
ovn-nbctl lsp-set-port-security sw0-p1 "50:54:00:00:00:03 10.0.0.3 10.0.0.10"

ovn-nbctl lsp-add sw0 sw0-p2
ovn-nbctl lsp-set-addresses sw0-p2 "50:54:00:00:00:04 10.0.0.4"
ovn-nbctl lsp-set-port-security sw0-p2 "50:54:00:00:00:04 10.0.0.4 10.0.0.10"

ovn-nbctl lsp-add sw0 sw0-p3
ovn-nbctl lsp-set-addresses sw0-p3 "50:54:00:00:00:05 10.0.0.5"
ovn-nbctl lsp-set-port-security sw0-p3 "50:54:00:00:00:05 10.0.0.5 10.0.0.10"

# Create the second logical switch with one port
ovn-nbctl ls-add sw1
ovn-nbctl lsp-add sw1 sw1-p1
ovn-nbctl lsp-set-addresses sw1-p1 "40:54:00:00:00:03 20.0.0.3"
ovn-nbctl lsp-set-port-security sw1-p1 "40:54:00:00:00:03 20.0.0.3"

# Create a logical router and attach both logical switches
ovn-nbctl lr-add lr0
ovn-nbctl lrp-add lr0 lr0-sw0 00:00:00:00:ff:01 10.0.0.1/24
ovn-nbctl lsp-add sw0 sw0-lr0
ovn-nbctl lsp-set-type sw0-lr0 router
ovn-nbctl lsp-set-addresses sw0-lr0 00:00:00:00:ff:01
ovn-nbctl lsp-set-options sw0-lr0 router-port=lr0-sw0

ovn-nbctl lrp-add lr0 lr0-sw1 00:00:00:00:ff:02 20.0.0.1/24
ovn-nbctl lsp-add sw1 sw1-lr0
ovn-nbctl lsp-set-type sw1-lr0 router
ovn-nbctl lsp-set-addresses sw1-lr0 00:00:00:00:ff:02
ovn-nbctl lsp-set-options sw1-lr0 router-port=lr0-sw1

{ set +x
$as_echo "$at_srcdir/ovn.at:14899: ovn_populate_arp__"
at_fn_check_prepare_trace "ovn.at:14899"
( $at_check_trace; ovn_populate_arp__
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14899"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn-nbctl --wait=hv sync

# Check that logical flows are added for sw0-vir in lsp_in_arp_rsp pipeline
# with bind_vport action.

ovn-sbctl dump-flows sw0 | grep ls_in_arp_rsp | grep bind_vport > lflows.txt

{ set +x
$as_echo "$at_srcdir/ovn.at:14907: cat lflows.txt"
at_fn_check_prepare_trace "ovn.at:14907"
( $at_check_trace; cat lflows.txt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "  table=13(ls_in_arp_rsp      ), priority=100  , match=(inport == \"sw0-p1\" && ((arp.op == 1 && arp.spa == 10.0.0.10 && arp.tpa == 10.0.0.10) || (arp.op == 2 && arp.spa == 10.0.0.10))), action=(bind_vport(\"sw0-vir\", inport); next;)
  table=13(ls_in_arp_rsp      ), priority=100  , match=(inport == \"sw0-p2\" && ((arp.op == 1 && arp.spa == 10.0.0.10 && arp.tpa == 10.0.0.10) || (arp.op == 2 && arp.spa == 10.0.0.10))), action=(bind_vport(\"sw0-vir\", inport); next;)
  table=13(ls_in_arp_rsp      ), priority=100  , match=(inport == \"sw0-p3\" && ((arp.op == 1 && arp.spa == 10.0.0.10 && arp.tpa == 10.0.0.10) || (arp.op == 2 && arp.spa == 10.0.0.10))), action=(bind_vport(\"sw0-vir\", inport); next;)
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14907"
$at_failed && at_fn_log_failure
$at_traceon; }


ovn-sbctl dump-flows lr0 | grep lr_in_arp_resolve | grep "reg0 == 10.0.0.10" \
> lflows.txt

# Since the sw0-vir is not claimed by any chassis, eth.dst should be set to
# zero if the ip4.dst is the virtual ip in the router pipeline.
{ set +x
$as_echo "$at_srcdir/ovn.at:14918: cat lflows.txt"
at_fn_check_prepare_trace "ovn.at:14918"
( $at_check_trace; cat lflows.txt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "  table=12(lr_in_arp_resolve  ), priority=100  , match=(outport == \"lr0-sw0\" && reg0 == 10.0.0.10), action=(eth.dst = 00:00:00:00:00:00; next;)
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14918"
$at_failed && at_fn_log_failure
$at_traceon; }


ip_to_hex() {
    printf "%02x%02x%02x%02x" "$@"
}

hv1_ch_uuid=`ovn-sbctl --bare --columns _uuid find chassis name="hv1"`
hv2_ch_uuid=`ovn-sbctl --bare --columns _uuid find chassis name="hv2"`

{ set +x
$as_echo "$at_srcdir/ovn.at:14929: test x\$(ovn-sbctl --bare --columns chassis find port_binding \\
logical_port=sw0-vir) = x"
at_fn_check_prepare_notrace 'a $(...) command substitution' "ovn.at:14929"
( $at_check_trace; test x$(ovn-sbctl --bare --columns chassis find port_binding \
logical_port=sw0-vir) = x
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14929"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn.at:14932: test x\$(ovn-sbctl --bare --columns virtual_parent find port_binding \\
logical_port=sw0-vir) = x"
at_fn_check_prepare_notrace 'a $(...) command substitution' "ovn.at:14932"
( $at_check_trace; test x$(ovn-sbctl --bare --columns virtual_parent find port_binding \
logical_port=sw0-vir) = x
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14932"
$at_failed && at_fn_log_failure
$at_traceon; }


# From sw0-p0 send GARP for 10.0.0.10. hv1 should claim sw0-vir
# and sw0-p1 should be its virtual_parent.
eth_src=505400000003
eth_dst=ffffffffffff
spa=$(ip_to_hex 10 0 0 10)
tpa=$(ip_to_hex 10 0 0 10)
send_garp 1 1 $eth_src $eth_dst $spa $tpa

ovs_wait_cond () {
    test x$(ovn-sbctl --bare --columns chassis find port_binding \
logical_port=sw0-vir) = x$hv1_ch_uuid
}
ovs_wait_failed () {
    :
    0
}
ovs_wait "ovn.at:14943" "until test x\$(ovn-sbctl --bare --columns chassis find port_binding \\
logical_port=sw0-vir) = x\$hv1_ch_uuid"


{ set +x
$as_echo "$at_srcdir/ovn.at:14946: test x\$(ovn-sbctl --bare --columns virtual_parent find port_binding \\
logical_port=sw0-vir) = xsw0-p1"
at_fn_check_prepare_notrace 'a $(...) command substitution' "ovn.at:14946"
( $at_check_trace; test x$(ovn-sbctl --bare --columns virtual_parent find port_binding \
logical_port=sw0-vir) = xsw0-p1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14946"
$at_failed && at_fn_log_failure
$at_traceon; }


ovn-sbctl dump-flows lr0 | grep lr_in_arp_resolve | grep "reg0 == 10.0.0.10" \
> lflows.txt

# There should be an arp resolve flow to resolve the virtual_ip with the
# sw0-p1's MAC.
{ set +x
$as_echo "$at_srcdir/ovn.at:14954: cat lflows.txt"
at_fn_check_prepare_trace "ovn.at:14954"
( $at_check_trace; cat lflows.txt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "  table=12(lr_in_arp_resolve  ), priority=100  , match=(outport == \"lr0-sw0\" && reg0 == 10.0.0.10), action=(eth.dst = 50:54:00:00:00:03; next;)
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14954"
$at_failed && at_fn_log_failure
$at_traceon; }


# From sw0-p3 send GARP for 10.0.0.10. hv1 should claim sw0-vir
# and sw0-p3 should be its virtual_parent.
eth_src=505400000005
eth_dst=ffffffffffff
spa=$(ip_to_hex 10 0 0 10)
tpa=$(ip_to_hex 10 0 0 10)
send_garp 1 2 $eth_src $eth_dst $spa $tpa

ovs_wait_cond () {
    test x$(ovn-sbctl --bare --columns chassis find port_binding \
logical_port=sw0-vir) = x$hv1_ch_uuid
}
ovs_wait_failed () {
    :
    0
}
ovs_wait "ovn.at:14966" "until test x\$(ovn-sbctl --bare --columns chassis find port_binding \\
logical_port=sw0-vir) = x\$hv1_ch_uuid"


ovs_wait_cond () {
    test x$(ovn-sbctl --bare --columns virtual_parent find port_binding \
logical_port=sw0-vir) = xsw0-p3
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:14969" "until test x\$(ovn-sbctl --bare --columns virtual_parent find port_binding \\
logical_port=sw0-vir) = xsw0-p3"


ovn-sbctl dump-flows lr0 | grep lr_in_arp_resolve | grep "reg0 == 10.0.0.10" \
> lflows.txt

# There should be an arp resolve flow to resolve the virtual_ip with the
# sw0-p2's MAC.
{ set +x
$as_echo "$at_srcdir/ovn.at:14977: cat lflows.txt"
at_fn_check_prepare_trace "ovn.at:14977"
( $at_check_trace; cat lflows.txt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "  table=12(lr_in_arp_resolve  ), priority=100  , match=(outport == \"lr0-sw0\" && reg0 == 10.0.0.10), action=(eth.dst = 50:54:00:00:00:05; next;)
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14977"
$at_failed && at_fn_log_failure
$at_traceon; }


# send the garp from sw0-p2 (in hv2). hv2 should claim sw0-vir
# and sw0-p2 shpuld be its virtual_parent.
eth_src=505400000004
eth_dst=ffffffffffff
spa=$(ip_to_hex 10 0 0 10)
tpa=$(ip_to_hex 10 0 0 10)
send_garp 2 1 $eth_src $eth_dst $spa $tpa

ovs_wait_cond () {
    test x$(ovn-sbctl --bare --columns chassis find port_binding \
logical_port=sw0-vir) = x$hv2_ch_uuid
}
ovs_wait_failed () {
    :
    0
}
ovs_wait "ovn.at:14989" "until test x\$(ovn-sbctl --bare --columns chassis find port_binding \\
logical_port=sw0-vir) = x\$hv2_ch_uuid"


{ set +x
$as_echo "$at_srcdir/ovn.at:14992: test x\$(ovn-sbctl --bare --columns virtual_parent find port_binding \\
logical_port=sw0-vir) = xsw0-p2"
at_fn_check_prepare_notrace 'a $(...) command substitution' "ovn.at:14992"
( $at_check_trace; test x$(ovn-sbctl --bare --columns virtual_parent find port_binding \
logical_port=sw0-vir) = xsw0-p2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:14992"
$at_failed && at_fn_log_failure
$at_traceon; }


ovn-sbctl dump-flows lr0 | grep lr_in_arp_resolve | grep "reg0 == 10.0.0.10" \
> lflows.txt

# There should be an arp resolve flow to resolve the virtual_ip with the
# sw0-p3's MAC.
{ set +x
$as_echo "$at_srcdir/ovn.at:15000: cat lflows.txt"
at_fn_check_prepare_trace "ovn.at:15000"
( $at_check_trace; cat lflows.txt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "  table=12(lr_in_arp_resolve  ), priority=100  , match=(outport == \"lr0-sw0\" && reg0 == 10.0.0.10), action=(eth.dst = 50:54:00:00:00:04; next;)
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15000"
$at_failed && at_fn_log_failure
$at_traceon; }


# Now send arp reply from sw0-p1. hv1 should claim sw0-vir
# and sw0-p1 shpuld be its virtual_parent.
eth_src=505400000003
eth_dst=ffffffffffff
spa=$(ip_to_hex 10 0 0 10)
tpa=$(ip_to_hex 10 0 0 4)
send_arp_reply 1 1 $eth_src $eth_dst $spa $tpa

ovs_wait_cond () {
    test x$(ovn-sbctl --bare --columns chassis find port_binding \
logical_port=sw0-vir) = x$hv1_ch_uuid
}
ovs_wait_failed () {
    :
    0
}
ovs_wait "ovn.at:15012" "until test x\$(ovn-sbctl --bare --columns chassis find port_binding \\
logical_port=sw0-vir) = x\$hv1_ch_uuid"


{ set +x
$as_echo "$at_srcdir/ovn.at:15015: test x\$(ovn-sbctl --bare --columns virtual_parent find port_binding \\
logical_port=sw0-vir) = xsw0-p1"
at_fn_check_prepare_notrace 'a $(...) command substitution' "ovn.at:15015"
( $at_check_trace; test x$(ovn-sbctl --bare --columns virtual_parent find port_binding \
logical_port=sw0-vir) = xsw0-p1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15015"
$at_failed && at_fn_log_failure
$at_traceon; }


ovn-sbctl dump-flows lr0 | grep lr_in_arp_resolve | grep "reg0 == 10.0.0.10" \
> lflows.txt

{ set +x
$as_echo "$at_srcdir/ovn.at:15021: cat lflows.txt"
at_fn_check_prepare_trace "ovn.at:15021"
( $at_check_trace; cat lflows.txt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "  table=12(lr_in_arp_resolve  ), priority=100  , match=(outport == \"lr0-sw0\" && reg0 == 10.0.0.10), action=(eth.dst = 50:54:00:00:00:03; next;)
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15021"
$at_failed && at_fn_log_failure
$at_traceon; }


# Delete hv1-vif1 port. hv1 should release sw0-vir
as hv1 ovs-vsctl del-port hv1-vif1

ovs_wait_cond () {
    test x$(ovn-sbctl --bare --columns chassis find port_binding \
logical_port=sw0-vir) = x
}
ovs_wait_failed () {
    :
    0
}
ovs_wait "ovn.at:15028" "until test x\$(ovn-sbctl --bare --columns chassis find port_binding \\
logical_port=sw0-vir) = x"


{ set +x
$as_echo "$at_srcdir/ovn.at:15031: test x\$(ovn-sbctl --bare --columns virtual_parent find port_binding \\
logical_port=sw0-vir) = x"
at_fn_check_prepare_notrace 'a $(...) command substitution' "ovn.at:15031"
( $at_check_trace; test x$(ovn-sbctl --bare --columns virtual_parent find port_binding \
logical_port=sw0-vir) = x
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15031"
$at_failed && at_fn_log_failure
$at_traceon; }


# Since the sw0-vir is not claimed by any chassis, eth.dst should be set to
# zero if the ip4.dst is the virtual ip.
ovn-sbctl dump-flows lr0 | grep lr_in_arp_resolve | grep "reg0 == 10.0.0.10" \
> lflows.txt

{ set +x
$as_echo "$at_srcdir/ovn.at:15039: cat lflows.txt"
at_fn_check_prepare_trace "ovn.at:15039"
( $at_check_trace; cat lflows.txt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "  table=12(lr_in_arp_resolve  ), priority=100  , match=(outport == \"lr0-sw0\" && reg0 == 10.0.0.10), action=(eth.dst = 00:00:00:00:00:00; next;)
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15039"
$at_failed && at_fn_log_failure
$at_traceon; }


# Now send arp reply from sw0-p2. hv2 should claim sw0-vir
# and sw0-p2 should be its virtual_parent.
eth_src=505400000004
eth_dst=ffffffffffff
spa=$(ip_to_hex 10 0 0 10)
tpa=$(ip_to_hex 10 0 0 3)
send_arp_reply 2 1 $eth_src $eth_dst $spa $tpa

ovs_wait_cond () {
    test x$(ovn-sbctl --bare --columns chassis find port_binding \
logical_port=sw0-vir) = x$hv2_ch_uuid
}
ovs_wait_failed () {
    :
    0
}
ovs_wait "ovn.at:15051" "until test x\$(ovn-sbctl --bare --columns chassis find port_binding \\
logical_port=sw0-vir) = x\$hv2_ch_uuid"


{ set +x
$as_echo "$at_srcdir/ovn.at:15054: test x\$(ovn-sbctl --bare --columns virtual_parent find port_binding \\
logical_port=sw0-vir) = xsw0-p2"
at_fn_check_prepare_notrace 'a $(...) command substitution' "ovn.at:15054"
( $at_check_trace; test x$(ovn-sbctl --bare --columns virtual_parent find port_binding \
logical_port=sw0-vir) = xsw0-p2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15054"
$at_failed && at_fn_log_failure
$at_traceon; }


ovn-sbctl dump-flows lr0 | grep lr_in_arp_resolve | grep "reg0 == 10.0.0.10" \
> lflows.txt

{ set +x
$as_echo "$at_srcdir/ovn.at:15060: cat lflows.txt"
at_fn_check_prepare_trace "ovn.at:15060"
( $at_check_trace; cat lflows.txt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "  table=12(lr_in_arp_resolve  ), priority=100  , match=(outport == \"lr0-sw0\" && reg0 == 10.0.0.10), action=(eth.dst = 50:54:00:00:00:04; next;)
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15060"
$at_failed && at_fn_log_failure
$at_traceon; }


# Delete sw0-p2 logical port
ovn-nbctl lsp-del sw0-p2

ovs_wait_cond () {
    test x$(ovn-sbctl --bare --columns chassis find port_binding \
logical_port=sw0-vir) = x
}
ovs_wait_failed () {
    :
    0
}
ovs_wait "ovn.at:15067" "until test x\$(ovn-sbctl --bare --columns chassis find port_binding \\
logical_port=sw0-vir) = x"


{ set +x
$as_echo "$at_srcdir/ovn.at:15070: test x\$(ovn-sbctl --bare --columns virtual_parent find port_binding \\
logical_port=sw0-vir) = x"
at_fn_check_prepare_notrace 'a $(...) command substitution' "ovn.at:15070"
( $at_check_trace; test x$(ovn-sbctl --bare --columns virtual_parent find port_binding \
logical_port=sw0-vir) = x
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15070"
$at_failed && at_fn_log_failure
$at_traceon; }


# Clear virtual_ip column of sw0-vir. There should be no bind_vport flows.
ovn-nbctl --wait=hv remove logical_switch_port sw0-vir options virtual-ip

ovn-sbctl dump-flows sw0 | grep ls_in_arp_rsp | grep bind_vport > lflows.txt

{ set +x
$as_echo "$at_srcdir/ovn.at:15078: cat lflows.txt"
at_fn_check_prepare_trace "ovn.at:15078"
( $at_check_trace; cat lflows.txt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15078"
$at_failed && at_fn_log_failure
$at_traceon; }


# Add back virtual_ip and clear virtual_parents.
ovn-nbctl --wait=hv set logical_switch_port sw0-vir options:virtual-ip=10.0.0.10

ovn-sbctl dump-flows sw0 | grep ls_in_arp_rsp | grep bind_vport > lflows.txt

{ set +x
$as_echo "$at_srcdir/ovn.at:15086: cat lflows.txt"
at_fn_check_prepare_trace "ovn.at:15086"
( $at_check_trace; cat lflows.txt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "  table=13(ls_in_arp_rsp      ), priority=100  , match=(inport == \"sw0-p1\" && ((arp.op == 1 && arp.spa == 10.0.0.10 && arp.tpa == 10.0.0.10) || (arp.op == 2 && arp.spa == 10.0.0.10))), action=(bind_vport(\"sw0-vir\", inport); next;)
  table=13(ls_in_arp_rsp      ), priority=100  , match=(inport == \"sw0-p3\" && ((arp.op == 1 && arp.spa == 10.0.0.10 && arp.tpa == 10.0.0.10) || (arp.op == 2 && arp.spa == 10.0.0.10))), action=(bind_vport(\"sw0-vir\", inport); next;)
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15086"
$at_failed && at_fn_log_failure
$at_traceon; }


ovn-nbctl --wait=hv remove logical_switch_port sw0-vir options virtual-parents
ovn-sbctl dump-flows sw0 | grep ls_in_arp_rsp | grep bind_vport > lflows.txt

{ set +x
$as_echo "$at_srcdir/ovn.at:15094: cat lflows.txt"
at_fn_check_prepare_trace "ovn.at:15094"
( $at_check_trace; cat lflows.txt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15094"
$at_failed && at_fn_log_failure
$at_traceon; }


ovn-sbctl dump-flows lr0 | grep lr_in_arp_resolve | grep "reg0 == 10.0.0.10" \
> lflows.txt

{ set +x
$as_echo "$at_srcdir/ovn.at:15100: cat lflows.txt"
at_fn_check_prepare_trace "ovn.at:15100"
( $at_check_trace; cat lflows.txt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15100"
$at_failed && at_fn_log_failure
$at_traceon; }





    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:15103: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:15103"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15103"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:15103: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:15103"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15103"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:15103" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:15103: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:15103"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15103"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:15103: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:15103"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15103"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:15103" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:15103: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:15103"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15103"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:15103: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:15103"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15103"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:15103" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:15103: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:15103"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15103"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:15103: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:15103"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15103"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:15103" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:15103: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:15103"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15103"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:15103: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:15103"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15103"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:15103" "while kill -0 \$TMPPID 2>/dev/null"





    as hv2
    if test "hv2" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:15103: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:15103"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15103"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:15103: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:15103"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15103"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:15103" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:15103: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:15103"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15103"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:15103: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:15103"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15103"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:15103" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:15103: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:15103"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15103"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:15103: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:15103"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15103"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:15103" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv2
    { set +x
$as_echo "$at_srcdir/ovn.at:15103: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:15103"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15103"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:15103: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:15103"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15103"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:15103" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:15103: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:15103"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15103"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:15103: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:15103"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15103"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:15103" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:15103: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:15103"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15103"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:15103: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:15103"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15103"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:15103" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:15103: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:15103"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15103"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:15103: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:15103"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15103"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:15103" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:15103: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:15103"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15103"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:15103: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:15103"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15103"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:15103" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:15103: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:15103"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15103"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:15103: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:15103"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15103"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:15103" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:15103: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:15103"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15103"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:15103: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:15103"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15103"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:15103" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:15103: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:15103"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15103"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:15103: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:15103"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15103"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:15103" "while kill -0 \$TMPPID 2>/dev/null"



ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_112
#AT_START_113
at_fn_group_banner 113 'ovn.at:15108' \
  "ovn -- can't write to a backup database server instance" "" 2
at_xfail=no
(
  $as_echo "113. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start
on_exit 'kill $(cat ovn-nbctl.pid)'
export OVN_NB_DAEMON=$(ovn-nbctl --pidfile --detach)

{ set +x
$as_echo "$at_srcdir/ovn.at:15113: ovn-nbctl ls-add sw0"
at_fn_check_prepare_trace "ovn.at:15113"
( $at_check_trace; ovn-nbctl ls-add sw0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15113"
$at_failed && at_fn_log_failure
$at_traceon; }

as ovn-nb
{ set +x
$as_echo "$at_srcdir/ovn.at:15115: ovs-appctl -t ovsdb-server ovsdb-server/sync-status | grep active | wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:15115"
( $at_check_trace; ovs-appctl -t ovsdb-server ovsdb-server/sync-status | grep active | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15115"
$at_failed && at_fn_log_failure
$at_traceon; }

ovs-appctl -t ovsdb-server ovsdb-server/set-active-ovsdb-server tcp:192.0.2.2:6641
ovs-appctl -t ovsdb-server ovsdb-server/connect-active-ovsdb-server
{ set +x
$as_echo "$at_srcdir/ovn.at:15119: ovs-appctl -t ovsdb-server ovsdb-server/sync-status | grep -c backup"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:15119"
( $at_check_trace; ovs-appctl -t ovsdb-server ovsdb-server/sync-status | grep -c backup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15119"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:15121: ovn-nbctl ls-add sw1"
at_fn_check_prepare_trace "ovn.at:15121"
( $at_check_trace; ovn-nbctl ls-add sw1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-nbctl: transaction error: {\"details\":\"insert operation not allowed when database server is in read only mode\",\"error\":\"not allowed\"}
" | \
  $at_diff - "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 1 $at_status "$at_srcdir/ovn.at:15121"
$at_failed && at_fn_log_failure
$at_traceon; }


ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_113
#AT_START_114
at_fn_group_banner 114 'ovn.at:15127' \
  "ovn -- controller event" "                        " 2
at_xfail=no
(
  $as_echo "114. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init


ovn_start

# Create hypervisors hv[12].
# Add vif1[12] to hv1, vif2[12] to hv2
# Add all of the vifs to a single logical switch sw0.
# Create logical router lr0

net_add n1

ovn-nbctl create Logical_Router name=lr0 options:chassis=hv1
for i in 0 1; do
    idx=$((i+1))
    ovn-nbctl ls-add sw$i
    ovn-nbctl lrp-add lr0 lrp$i 00:00:00:00:ff:0$idx 192.168.$idx.254/24
    ovn-nbctl \
        -- lsp-add sw$i lrp$i-attachment \
        -- set Logical_Switch_Port lrp$i-attachment type=router \
                         options:router-port=lrp$i \
                         addresses='"00:00:00:00:ff:'0$idx'"'
done

for i in 1 2; do
    sim_add hv$i
    as hv$i
    ovs-vsctl add-br br-phys
    ovn_attach n1 br-phys 192.168.0.$i

    for j in 1 2; do
        ovn-nbctl lsp-add sw0 sw0-p$i$j -- \
                lsp-set-addresses sw0-p$i$j "00:00:00:00:00:$i$j 192.168.1.$i$j"

        ovs-vsctl -- add-port br-int vif$i$j -- \
                set interface vif$i$j \
                external-ids:iface-id=sw0-p$i$j \
                options:tx_pcap=hv$i/vif$i$j-tx.pcap \
                options:rxq_pcap=hv$i/vif$i$j-rx.pcap \
                ofport-request=$i$j
    done
done

as hv1
ovn-nbctl lsp-add sw1 sw1-p0 \
    -- lsp-set-addresses sw1-p0 "00:00:00:00:00:33 192.168.2.11"
ovs-vsctl -- add-port br-int vif33 -- \
        set interface vif33 \
        external-ids:iface-id=sw1-p0 \
        options:tx_pcap=hv$i/vif33-tx.pcap \
        options:rxq_pcap=hv$i/vif33-rx.pcap \
        ofport-request=33

ovn-nbctl --wait=hv set NB_Global . options:controller_event=true
ovn-nbctl lb-add lb0 192.168.1.100:80 ""
ovn-nbctl ls-lb-add sw0 lb0
uuid_lb0=$(ovn-nbctl --bare --columns=_uuid find load_balancer name=lb0)

ovn-nbctl lb-add lb1 192.168.2.100:80 ""
ovn-nbctl lr-lb-add lr0 lb1
uuid_lb1=$(ovn-nbctl --bare --columns=_uuid find load_balancer name=lb1)
ovn-nbctl --wait=hv meter-add event-elb drop 100 pktps 10

{ set +x
$as_echo "$at_srcdir/ovn.at:15189: ovn_populate_arp__"
at_fn_check_prepare_trace "ovn.at:15189"
( $at_check_trace; ovn_populate_arp__
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15189"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn-nbctl --timeout=3 --wait=hv sync
ovn-sbctl lflow-list
as hv1 ovs-ofctl dump-flows br-int

packet0="inport==\"sw0-p11\" && eth.src==00:00:00:00:00:11 && eth.dst==00:00:00:00:00:21 &&
         ip4 && ip.ttl==64 && ip4.src==192.168.1.11 && ip4.dst==192.168.1.100 &&
         tcp && tcp.src==10000 && tcp.dst==80"
as hv1 ovs-appctl -t ovn-controller inject-pkt "$packet0"

ovn-sbctl list controller_event
uuid=$(ovn-sbctl list controller_event | awk '/_uuid/{print $3}')
{ set +x
$as_echo "$at_srcdir/ovn.at:15201: ovn-sbctl get controller_event \$uuid event_type"
at_fn_check_prepare_dynamic "ovn-sbctl get controller_event $uuid event_type" "ovn.at:15201"
( $at_check_trace; ovn-sbctl get controller_event $uuid event_type
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "empty_lb_backends
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15201"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:15204: ovn-sbctl get controller_event \$uuid event_info:vip"
at_fn_check_prepare_dynamic "ovn-sbctl get controller_event $uuid event_info:vip" "ovn.at:15204"
( $at_check_trace; ovn-sbctl get controller_event $uuid event_info:vip
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"192.168.1.100:80\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15204"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:15207: ovn-sbctl get controller_event \$uuid event_info:protocol"
at_fn_check_prepare_dynamic "ovn-sbctl get controller_event $uuid event_info:protocol" "ovn.at:15207"
( $at_check_trace; ovn-sbctl get controller_event $uuid event_info:protocol
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "tcp
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15207"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:15210: ovn-sbctl get controller_event \$uuid event_info:load_balancer"
at_fn_check_prepare_dynamic "ovn-sbctl get controller_event $uuid event_info:load_balancer" "ovn.at:15210"
( $at_check_trace; ovn-sbctl get controller_event $uuid event_info:load_balancer
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"$uuid_lb0\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15210"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:15213: ovn-sbctl get controller_event \$uuid seq_num"
at_fn_check_prepare_dynamic "ovn-sbctl get controller_event $uuid seq_num" "ovn.at:15213"
( $at_check_trace; ovn-sbctl get controller_event $uuid seq_num
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15213"
$at_failed && at_fn_log_failure
$at_traceon; }


ovn-sbctl destroy controller_event $uuid
packet1="inport==\"sw1-p0\" && eth.src==00:00:00:00:00:33 && eth.dst==00:00:00:00:ff:02 &&
         ip4 && ip.ttl==64 && ip4.src==192.168.2.11 && ip4.dst==192.168.2.100 &&
         tcp && tcp.src==10000 && tcp.dst==80"

as hv1 ovs-appctl -t ovn-controller inject-pkt "$packet1"
ovn-sbctl list controller_event
uuid=$(ovn-sbctl list controller_event | awk '/_uuid/{print $3}')
{ set +x
$as_echo "$at_srcdir/ovn.at:15225: ovn-sbctl get controller_event \$uuid event_type"
at_fn_check_prepare_dynamic "ovn-sbctl get controller_event $uuid event_type" "ovn.at:15225"
( $at_check_trace; ovn-sbctl get controller_event $uuid event_type
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "empty_lb_backends
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15225"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:15228: ovn-sbctl get controller_event \$uuid event_info:vip"
at_fn_check_prepare_dynamic "ovn-sbctl get controller_event $uuid event_info:vip" "ovn.at:15228"
( $at_check_trace; ovn-sbctl get controller_event $uuid event_info:vip
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"192.168.2.100:80\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15228"
$at_failed && at_fn_log_failure
$at_traceon; }





    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:15232: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:15232"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15232"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:15232: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:15232"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15232"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:15232" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:15232: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:15232"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15232"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:15232: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:15232"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15232"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:15232" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:15232: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:15232"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15232"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:15232: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:15232"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15232"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:15232" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:15232: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:15232"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15232"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:15232: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:15232"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15232"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:15232" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:15232: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:15232"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15232"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:15232: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:15232"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15232"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:15232" "while kill -0 \$TMPPID 2>/dev/null"





    as hv2
    if test "hv2" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:15232: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:15232"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15232"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:15232: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:15232"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15232"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:15232" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:15232: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:15232"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15232"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:15232: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:15232"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15232"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:15232" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:15232: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:15232"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15232"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:15232: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:15232"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15232"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:15232" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv2
    { set +x
$as_echo "$at_srcdir/ovn.at:15232: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:15232"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15232"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:15232: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:15232"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15232"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:15232" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:15232: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:15232"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15232"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:15232: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:15232"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15232"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:15232" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:15232: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:15232"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15232"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:15232: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:15232"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15232"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:15232" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:15232: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:15232"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15232"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:15232: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:15232"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15232"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:15232" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:15232: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:15232"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15232"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:15232: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:15232"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15232"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:15232" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:15232: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:15232"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15232"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:15232: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:15232"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15232"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:15232" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:15232: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:15232"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15232"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:15232: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:15232"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15232"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:15232" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:15232: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:15232"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15232"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:15232: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:15232"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15232"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:15232" "while kill -0 \$TMPPID 2>/dev/null"



ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_114
#AT_START_115
at_fn_group_banner 115 'ovn.at:15235' \
  "ovn -- IGMP snoop/querier/relay" "                " 2
at_xfail=no
(
  $as_echo "115. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

# Logical network:
# Three logical switches (sw1-sw3) connected to a logical router (rtr).
# sw1:
#   - subnet 10.0.0.0/8
#   - 2 ports bound on hv1 (sw1-p11, sw1-p12)
#   - 2 ports bound on hv2 (sw1-p21, sw1-p22)
# sw2:
#   - subnet 20.0.0.0/8
#   - 1 port bound on hv1 (sw2-p1)
#   - 1 port bound on hv2 (sw2-p2)
#   - IGMP Querier from 20.0.0.254
# sw3:
#   - subnet 30.0.0.0/8
#   - 1 port bound on hv1 (sw3-p1)
#   - 1 port bound on hv2 (sw3-p2)

reset_pcap_file() {
    local iface=$1
    local pcap_file=$2
    ovs-vsctl -- set Interface $iface options:tx_pcap=dummy-tx.pcap \
options:rxq_pcap=dummy-rx.pcap
    rm -f ${pcap_file}*.pcap
    ovs-vsctl -- set Interface $iface options:tx_pcap=${pcap_file}-tx.pcap \
options:rxq_pcap=${pcap_file}-rx.pcap
}

ip_to_hex() {
     printf "%02x%02x%02x%02x" "$@"
}

#
# send_igmp_v3_report INPORT HV ETH_SRC IP_SRC IP_CSUM GROUP REC_TYPE
#                     IGMP_CSUM OUTFILE
#
# This shell function causes an IGMPv3 report to be received on INPORT of HV.
# The packet's content has Ethernet destination 01:00:5E:00:00:22 and source
# ETH_SRC (exactly 12 hex digits). Ethernet type is set to IP.
# GROUP is the IP multicast group to be joined/to leave (based on REC_TYPE).
# REC_TYPE == 04: join GROUP
# REC_TYPE == 03: leave GROUP
# The packet hexdump is also stored in OUTFILE.
#
send_igmp_v3_report() {
    local inport=$1 hv=$2 eth_src=$3 ip_src=$4 ip_chksum=$5 group=$6
    local rec_type=$7 igmp_chksum=$8 outfile=$9

    local eth_dst=01005e000016
    local ip_dst=$(ip_to_hex 224 0 0 22)
    local ip_ttl=01
    local ip_ra_opt=94040000

    local igmp_type=2200
    local num_rec=00000001
    local aux_dlen=00
    local num_src=0000

    local eth=${eth_dst}${eth_src}0800
    local ip=46c0002800004000${ip_ttl}02${ip_chksum}${ip_src}${ip_dst}${ip_ra_opt}
    local igmp=${igmp_type}${igmp_chksum}${num_rec}${rec_type}${aux_dlen}${num_src}${group}
    local packet=${eth}${ip}${igmp}

    echo ${packet} >> ${outfile}
    as $hv ovs-appctl netdev-dummy/receive ${inport} ${packet}
}

#
# store_igmp_v3_query ETH_SRC IP_SRC IP_CSUM OUTFILE
#
# This shell function builds an IGMPv3 general query from ETH_SRC and IP_SRC
# and stores the hexdump of the packet in OUTFILE.
#
store_igmp_v3_query() {
    local eth_src=$1 ip_src=$2 ip_chksum=$3 outfile=$4

    local eth_dst=01005e000001
    local ip_dst=$(ip_to_hex 224 0 0 1)
    local ip_ttl=01
    local igmp_type=11
    local max_resp=0a
    local igmp_chksum=eeeb
    local addr=00000000

    local eth=${eth_dst}${eth_src}0800
    local ip=4500002000004000${ip_ttl}02${ip_chksum}${ip_src}${ip_dst}
    local igmp=${igmp_type}${max_resp}${igmp_chksum}${addr}000a0000
    local packet=${eth}${ip}${igmp}

    echo ${packet} >> ${outfile}
}

#
# send_ip_multicast_pkt INPORT HV ETH_SRC ETH_DST IP_SRC IP_DST IP_LEN TTL
#    IP_CHKSUM IP_PROTO DATA
#
# This shell function causes an IP multicast packet to be received on INPORT
# of HV.
# The hexdump of the packet is stored in OUTFILE.
#
send_ip_multicast_pkt() {
    local inport=$1 hv=$2 eth_src=$3 eth_dst=$4
    local ip_src=$5 ip_dst=$6 ip_len=$7 ip_ttl=$8 ip_chksum=$9 proto=${10}
    local data=${11}

    local eth=${eth_dst}${eth_src}0800
    local ip=450000${ip_len}95f14000${ip_ttl}${proto}${ip_chksum}${ip_src}${ip_dst}
    local packet=${eth}${ip}${data}

    as $hv ovs-appctl netdev-dummy/receive ${inport} ${packet}
}

#
# store_ip_multicast_pkt ETH_SRC ETH_DST IP_SRC IP_DST IP_LEN TTL
#    IP_CHKSUM IP_PROTO DATA OUTFILE
#
# This shell function builds an IP multicast packet and stores the hexdump of
# the packet in OUTFILE.
#
store_ip_multicast_pkt() {
    local eth_src=$1 eth_dst=$2
    local ip_src=$3 ip_dst=$4 ip_len=$5 ip_ttl=$6 ip_chksum=$7 proto=$8
    local data=$9 outfile=${10}

    local eth=${eth_dst}${eth_src}0800
    local ip=450000${ip_len}95f14000${ip_ttl}${proto}${ip_chksum}${ip_src}${ip_dst}
    local packet=${eth}${ip}${data}

    echo ${packet} >> ${outfile}
}

ovn-nbctl ls-add sw1
ovn-nbctl ls-add sw2
ovn-nbctl ls-add sw3

ovn-nbctl lsp-add sw1 sw1-p11
ovn-nbctl lsp-add sw1 sw1-p12
ovn-nbctl lsp-add sw1 sw1-p21
ovn-nbctl lsp-add sw1 sw1-p22
ovn-nbctl lsp-add sw2 sw2-p1
ovn-nbctl lsp-add sw2 sw2-p2
ovn-nbctl lsp-add sw3 sw3-p1
ovn-nbctl lsp-add sw3 sw3-p2

ovn-nbctl lr-add rtr
ovn-nbctl lrp-add rtr rtr-sw1 00:00:00:00:01:00 10.0.0.254/24
ovn-nbctl lrp-add rtr rtr-sw2 00:00:00:00:02:00 20.0.0.254/24
ovn-nbctl lrp-add rtr rtr-sw3 00:00:00:00:03:00 30.0.0.254/24

ovn-nbctl lsp-add sw1 sw1-rtr                      \
    -- lsp-set-type sw1-rtr router                 \
    -- lsp-set-addresses sw1-rtr 00:00:00:00:01:00 \
    -- lsp-set-options sw1-rtr router-port=rtr-sw1
ovn-nbctl lsp-add sw2 sw2-rtr                      \
    -- lsp-set-type sw2-rtr router                 \
    -- lsp-set-addresses sw2-rtr 00:00:00:00:02:00 \
    -- lsp-set-options sw2-rtr router-port=rtr-sw2
ovn-nbctl lsp-add sw3 sw3-rtr                      \
    -- lsp-set-type sw3-rtr router                 \
    -- lsp-set-addresses sw3-rtr 00:00:00:00:03:00 \
    -- lsp-set-options sw3-rtr router-port=rtr-sw3

net_add n1
sim_add hv1
as hv1
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.1
ovs-vsctl -- add-port br-int hv1-vif1 -- \
    set interface hv1-vif1 external-ids:iface-id=sw1-p11 \
    options:tx_pcap=hv1/vif1-tx.pcap \
    options:rxq_pcap=hv1/vif1-rx.pcap \
    ofport-request=1
ovs-vsctl -- add-port br-int hv1-vif2 -- \
    set interface hv1-vif2 external-ids:iface-id=sw1-p12 \
    options:tx_pcap=hv1/vif2-tx.pcap \
    options:rxq_pcap=hv1/vif2-rx.pcap \
    ofport-request=1
ovs-vsctl -- add-port br-int hv1-vif3 -- \
    set interface hv1-vif3 external-ids:iface-id=sw2-p1 \
    options:tx_pcap=hv1/vif3-tx.pcap \
    options:rxq_pcap=hv1/vif3-rx.pcap \
    ofport-request=1
ovs-vsctl -- add-port br-int hv1-vif4 -- \
    set interface hv1-vif4 external-ids:iface-id=sw3-p1 \
    options:tx_pcap=hv1/vif4-tx.pcap \
    options:rxq_pcap=hv1/vif4-rx.pcap \
    ofport-request=1

sim_add hv2
as hv2
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.2
ovs-vsctl -- add-port br-int hv2-vif1 -- \
    set interface hv2-vif1 external-ids:iface-id=sw1-p21 \
    options:tx_pcap=hv2/vif1-tx.pcap \
    options:rxq_pcap=hv2/vif1-rx.pcap \
    ofport-request=1
ovs-vsctl -- add-port br-int hv2-vif2 -- \
    set interface hv2-vif2 external-ids:iface-id=sw1-p22 \
    options:tx_pcap=hv2/vif2-tx.pcap \
    options:rxq_pcap=hv2/vif2-rx.pcap \
    ofport-request=1
ovs-vsctl -- add-port br-int hv2-vif3 -- \
    set interface hv2-vif3 external-ids:iface-id=sw2-p2 \
    options:tx_pcap=hv2/vif3-tx.pcap \
    options:rxq_pcap=hv2/vif3-rx.pcap \
    ofport-request=1
ovs-vsctl -- add-port br-int hv2-vif4 -- \
    set interface hv2-vif4 external-ids:iface-id=sw3-p2 \
    options:tx_pcap=hv2/vif4-tx.pcap \
    options:rxq_pcap=hv2/vif4-rx.pcap \
    ofport-request=1

{ set +x
$as_echo "$at_srcdir/ovn.at:15449: ovn_populate_arp__"
at_fn_check_prepare_trace "ovn.at:15449"
( $at_check_trace; ovn_populate_arp__
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15449"
$at_failed && at_fn_log_failure
$at_traceon; }


# Enable IGMP snooping on sw1.
ovn-nbctl set Logical_Switch sw1       \
    other_config:mcast_querier="false" \
    other_config:mcast_snoop="true"

# No IGMP query should be generated by sw1 (mcast_querier="false").
> expected
ovn_check_packets__ "hv1/vif1-tx.pcap" "expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:15458: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:15458"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15458"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv1/vif2-tx.pcap" "expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:15459: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:15459"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15459"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv2/vif1-tx.pcap" "expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:15460: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:15460"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15460"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv2/vif2-tx.pcap" "expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:15461: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:15461"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15461"
$at_failed && at_fn_log_failure
$at_traceon; }


ovn-nbctl --wait=hv sync

# Inject IGMP Join for 239.0.1.68 on sw1-p11.
send_igmp_v3_report hv1-vif1 hv1 \
    000000000001 $(ip_to_hex 10 0 0 1) f9f8 \
    $(ip_to_hex 239 0 1 68) 04 e9b9 \
    /dev/null
# Inject IGMP Join for 239.0.1.68 on sw1-p21.
send_igmp_v3_report hv2-vif1 hv2 000000000002 $(ip_to_hex 10 0 0 2) f9f9 \
    $(ip_to_hex 239 0 1 68) 04 e9b9 \
    /dev/null

# Check that the IGMP Group is learned on both hv.
ovs_wait_cond () {

    total_entries=`ovn-sbctl find IGMP_Group | grep "239.0.1.68" -c`
    test "${total_entries}" = "2"

}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:15476" "until
    total_entries=\`ovn-sbctl find IGMP_Group | grep \"239.0.1.68\" -c\`
    test \"\${total_entries}\" = \"2\"
"


# Send traffic and make sure it gets forwarded only on the two ports that
# joined.
> expected
> expected_empty
send_ip_multicast_pkt hv1-vif2 hv1 \
    000000000001 01005e000144 \
    $(ip_to_hex 10 0 0 42) $(ip_to_hex 239 0 1 68) 1e 20 ca70 11 \
    e518e518000a3b3a0000
store_ip_multicast_pkt \
    000000000001 01005e000144 \
    $(ip_to_hex 10 0 0 42) $(ip_to_hex 239 0 1 68) 1e 20 ca70 11 \
    e518e518000a3b3a0000 expected

ovn_check_packets__ "hv1/vif1-tx.pcap" "expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:15494: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:15494"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15494"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv2/vif1-tx.pcap" "expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:15495: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:15495"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15495"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv1/vif2-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:15496: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:15496"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15496"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv2/vif2-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:15497: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:15497"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15497"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv1/vif3-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:15498: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:15498"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15498"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv2/vif3-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:15499: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:15499"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15499"
$at_failed && at_fn_log_failure
$at_traceon; }


# Inject IGMP Leave for 239.0.1.68 on sw1-p11.
send_igmp_v3_report hv1-vif1 hv1 \
    000000000001 $(ip_to_hex 10 0 0 1) f9f8 \
    $(ip_to_hex 239 0 1 68) 03 eab9 \
    /dev/null

# Check IGMP_Group table on both HV.
ovs_wait_cond () {

    total_entries=`ovn-sbctl find IGMP_Group | grep "239.0.1.68" -c`
    test "${total_entries}" = "1"

}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:15508" "until
    total_entries=\`ovn-sbctl find IGMP_Group | grep \"239.0.1.68\" -c\`
    test \"\${total_entries}\" = \"1\"
"


# Send traffic and make sure it gets forwarded only on the port that joined.
as hv1 reset_pcap_file hv1-vif1 hv1/vif1
as hv2 reset_pcap_file hv2-vif1 hv2/vif1
> expected
> expected_empty
send_ip_multicast_pkt hv1-vif2 hv1 \
    000000000001 01005e000144 \
    $(ip_to_hex 10 0 0 42) $(ip_to_hex 239 0 1 68) 1e 20 ca70 11 \
    e518e518000a3b3a0000
store_ip_multicast_pkt \
    000000000001 01005e000144 \
    $(ip_to_hex 10 0 0 42) $(ip_to_hex 239 0 1 68) 1e 20 ca70 11 \
    e518e518000a3b3a0000 expected

ovn_check_packets__ "hv1/vif1-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:15527: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:15527"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15527"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv2/vif1-tx.pcap" "expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:15528: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:15528"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15528"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv1/vif2-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:15529: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:15529"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15529"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv2/vif2-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:15530: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:15530"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15530"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv1/vif3-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:15531: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:15531"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15531"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv2/vif3-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:15532: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:15532"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15532"
$at_failed && at_fn_log_failure
$at_traceon; }


# Flush IGMP groups.
ovn-sbctl ip-multicast-flush sw1
ovs_wait_cond () {

    total_entries=`ovn-sbctl find IGMP_Group | grep "239.0.1.68" -c`
    test "${total_entries}" = "0"

}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:15536" "until
    total_entries=\`ovn-sbctl find IGMP_Group | grep \"239.0.1.68\" -c\`
    test \"\${total_entries}\" = \"0\"
"


# Check that traffic for 224.0.0.X is flooded even if some hosts register for
# it.
# Inject IGMP Join for 224.0.0.42 on sw1-p11.
send_igmp_v3_report hv1-vif1 hv1 \
    000000000001 $(ip_to_hex 10 0 0 1) f9f8 \
    $(ip_to_hex 224 0 0 42) 04 f9d3 \
    /dev/null

# Check that the IGMP Group is learned.
ovs_wait_cond () {

    total_entries=`ovn-sbctl find IGMP_Group | grep "224.0.0.42" -c`
    test "${total_entries}" = "1"

}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:15550" "until
    total_entries=\`ovn-sbctl find IGMP_Group | grep \"224.0.0.42\" -c\`
    test \"\${total_entries}\" = \"1\"
"


# Send traffic and make sure it gets flooded to all ports.
as hv1 reset_pcap_file hv1-vif1 hv1/vif1
as hv1 reset_pcap_file hv1-vif2 hv1/vif2
as hv2 reset_pcap_file hv2-vif1 hv2/vif1
as hv2 reset_pcap_file hv2-vif2 hv2/vif2
> expected
send_ip_multicast_pkt hv1-vif2 hv1 \
    000000000001 01005e000144 \
    $(ip_to_hex 10 0 0 42) $(ip_to_hex 224 0 0 42) 1e 01 f989 11 \
    e518e518000a4b540000
store_ip_multicast_pkt \
    000000000001 01005e000144 \
    $(ip_to_hex 10 0 0 42) $(ip_to_hex 224 0 0 42) 1e 01 f989 11 \
    e518e518000a4b540000 expected

ovn_check_packets__ "hv1/vif1-tx.pcap" "expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:15570: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:15570"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15570"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv2/vif1-tx.pcap" "expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:15571: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:15571"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15571"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv2/vif2-tx.pcap" "expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:15572: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:15572"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15572"
$at_failed && at_fn_log_failure
$at_traceon; }


# Enable IGMP snooping and querier on sw2 and set query interval to minimum.
ovn-nbctl set Logical_Switch sw2 \
    other_config:mcast_snoop="true" \
    other_config:mcast_querier="true" \
    other_config:mcast_query_interval=1 \
    other_config:mcast_eth_src="00:00:00:00:02:fe" \
    other_config:mcast_ip4_src="20.0.0.254"

# Wait for 1 query interval (1 sec) and check that two queries are generated.
> expected
store_igmp_v3_query 0000000002fe $(ip_to_hex 20 0 0 254) 84dd expected
store_igmp_v3_query 0000000002fe $(ip_to_hex 20 0 0 254) 84dd expected

sleep 1
ovn_check_packets__ "hv1/vif3-tx.pcap" "expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:15588: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:15588"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15588"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv2/vif3-tx.pcap" "expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:15589: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:15589"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15589"
$at_failed && at_fn_log_failure
$at_traceon; }


# Disable IGMP querier on sw2.
ovn-nbctl set Logical_Switch sw2 \
    other_config:mcast_querier="false"

# Enable IGMP snooping on sw3.
ovn-nbctl set Logical_Switch sw3       \
    other_config:mcast_querier="false" \
    other_config:mcast_snoop="true"

# Send traffic from sw3 and make sure rtr doesn't relay it.
> expected_empty

as hv1 reset_pcap_file hv1-vif1 hv1/vif1
as hv1 reset_pcap_file hv1-vif2 hv1/vif2
as hv1 reset_pcap_file hv1-vif3 hv1/vif3
as hv1 reset_pcap_file hv1-vif4 hv1/vif4
as hv2 reset_pcap_file hv2-vif1 hv2/vif1
as hv2 reset_pcap_file hv2-vif2 hv2/vif2
as hv2 reset_pcap_file hv2-vif3 hv2/vif3
as hv2 reset_pcap_file hv2-vif4 hv2/vif4

send_ip_multicast_pkt hv2-vif4 hv2 \
    000000000001 01005e000144 \
    $(ip_to_hex 10 0 0 42) $(ip_to_hex 239 0 1 68) 1e 20 ca70 11 \
    e518e518000a3b3a0000

# Sleep a bit to make sure no traffic is received and then check.
sleep 1
ovn_check_packets__ "hv1/vif1-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:15619: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:15619"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15619"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv1/vif2-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:15620: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:15620"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15620"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv1/vif3-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:15621: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:15621"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15621"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv1/vif4-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:15622: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:15622"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15622"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv2/vif1-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:15623: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:15623"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15623"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv2/vif2-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:15624: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:15624"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15624"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv2/vif3-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:15625: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:15625"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15625"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv2/vif4-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:15626: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:15626"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15626"
$at_failed && at_fn_log_failure
$at_traceon; }


# Enable IGMP relay on rtr
ovn-nbctl set logical_router rtr \
    options:mcast_relay="true"

# Inject IGMP Join for 239.0.1.68 on sw1-p11.
send_igmp_v3_report hv1-vif1 hv1 \
    000000000001 $(ip_to_hex 10 0 0 1) f9f8 \
    $(ip_to_hex 239 0 1 68) 04 e9b9 \
    /dev/null
# Inject IGMP Join for 239.0.1.68 on sw2-p2.
send_igmp_v3_report hv2-vif3 hv2 \
    000000000001 $(ip_to_hex 10 0 0 1) f9f8 \
    $(ip_to_hex 239 0 1 68) 04 e9b9 \
    /dev/null

# Check that the IGMP Group is learned by all switches.
ovs_wait_cond () {

    total_entries=`ovn-sbctl find IGMP_Group | grep "239.0.1.68" -c`
    test "${total_entries}" = "2"

}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:15644" "until
    total_entries=\`ovn-sbctl find IGMP_Group | grep \"239.0.1.68\" -c\`
    test \"\${total_entries}\" = \"2\"
"


# Send traffic from sw3 and make sure it is relayed by rtr.
# to ports that joined.
> expected_routed_sw1
> expected_routed_sw2
> expected_empty

as hv1 reset_pcap_file hv1-vif1 hv1/vif1
as hv1 reset_pcap_file hv1-vif2 hv1/vif2
as hv1 reset_pcap_file hv1-vif3 hv1/vif3
as hv1 reset_pcap_file hv1-vif4 hv1/vif4
as hv2 reset_pcap_file hv2-vif1 hv2/vif1
as hv2 reset_pcap_file hv2-vif2 hv2/vif2
as hv2 reset_pcap_file hv2-vif3 hv2/vif3
as hv2 reset_pcap_file hv2-vif4 hv2/vif4

send_ip_multicast_pkt hv2-vif4 hv2 \
    000000000001 01005e000144 \
    $(ip_to_hex 10 0 0 42) $(ip_to_hex 239 0 1 68) 1e 20 ca70 11 \
    e518e518000a3b3a0000
store_ip_multicast_pkt \
    000000000100 01005e000144 \
    $(ip_to_hex 10 0 0 42) $(ip_to_hex 239 0 1 68) 1e 1f cb70 11 \
    e518e518000a3b3a0000 expected_routed_sw1
store_ip_multicast_pkt \
    000000000200 01005e000144 \
    $(ip_to_hex 10 0 0 42) $(ip_to_hex 239 0 1 68) 1e 1f cb70 11 \
    e518e518000a3b3a0000 expected_routed_sw2

ovn_check_packets__ "hv1/vif1-tx.pcap" "expected_routed_sw1"
   { set +x
$as_echo "$at_srcdir/ovn.at:15677: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:15677"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15677"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv2/vif3-tx.pcap" "expected_routed_sw2"
   { set +x
$as_echo "$at_srcdir/ovn.at:15678: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:15678"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15678"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv1/vif4-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:15679: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:15679"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15679"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv1/vif2-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:15680: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:15680"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15680"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv1/vif3-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:15681: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:15681"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15681"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv2/vif1-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:15682: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:15682"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15682"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv2/vif2-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:15683: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:15683"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15683"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv2/vif4-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:15684: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:15684"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15684"
$at_failed && at_fn_log_failure
$at_traceon; }


# Inject IGMP Join for 239.0.1.68 on sw3-p1.
send_igmp_v3_report hv1-vif4 hv1 \
    000000000001 $(ip_to_hex 10 0 0 1) f9f8 \
    $(ip_to_hex 239 0 1 68) 04 e9b9 \
    /dev/null

# Check that the IGMP Group is learned by all switches.
ovs_wait_cond () {

    total_entries=`ovn-sbctl find IGMP_Group | grep "239.0.1.68" -c`
    test "${total_entries}" = "3"

}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:15693" "until
    total_entries=\`ovn-sbctl find IGMP_Group | grep \"239.0.1.68\" -c\`
    test \"\${total_entries}\" = \"3\"
"


# Send traffic from sw3 and make sure it is relayed by rtr
# to ports that joined.
> expected_routed_sw1
> expected_routed_sw2
> expected_switched
> expected_empty

as hv1 reset_pcap_file hv1-vif1 hv1/vif1
as hv1 reset_pcap_file hv1-vif2 hv1/vif2
as hv1 reset_pcap_file hv1-vif3 hv1/vif3
as hv1 reset_pcap_file hv1-vif4 hv1/vif4
as hv2 reset_pcap_file hv2-vif1 hv2/vif1
as hv2 reset_pcap_file hv2-vif2 hv2/vif2
as hv2 reset_pcap_file hv2-vif3 hv2/vif3
as hv2 reset_pcap_file hv2-vif4 hv2/vif4

send_ip_multicast_pkt hv2-vif4 hv2 \
    000000000001 01005e000144 \
    $(ip_to_hex 10 0 0 42) $(ip_to_hex 239 0 1 68) 1e 20 ca70 11 \
    e518e518000a3b3a0000
store_ip_multicast_pkt \
    000000000100 01005e000144 \
    $(ip_to_hex 10 0 0 42) $(ip_to_hex 239 0 1 68) 1e 1f cb70 11 \
    e518e518000a3b3a0000 expected_routed_sw1
store_ip_multicast_pkt \
    000000000200 01005e000144 \
    $(ip_to_hex 10 0 0 42) $(ip_to_hex 239 0 1 68) 1e 1f cb70 11 \
    e518e518000a3b3a0000 expected_routed_sw2
store_ip_multicast_pkt \
    000000000001 01005e000144 \
    $(ip_to_hex 10 0 0 42) $(ip_to_hex 239 0 1 68) 1e 20 ca70 11 \
    e518e518000a3b3a0000 expected_switched

ovn_check_packets__ "hv1/vif1-tx.pcap" "expected_routed_sw1"
   { set +x
$as_echo "$at_srcdir/ovn.at:15731: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:15731"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15731"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv2/vif3-tx.pcap" "expected_routed_sw2"
   { set +x
$as_echo "$at_srcdir/ovn.at:15732: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:15732"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15732"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv1/vif4-tx.pcap" "expected_switched"
   { set +x
$as_echo "$at_srcdir/ovn.at:15733: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:15733"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15733"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv1/vif2-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:15734: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:15734"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15734"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv1/vif3-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:15735: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:15735"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15735"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv2/vif1-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:15736: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:15736"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15736"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv2/vif2-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:15737: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:15737"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15737"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv2/vif4-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:15738: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:15738"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15738"
$at_failed && at_fn_log_failure
$at_traceon; }


# Flush IGMP groups.
ovn-sbctl ip-multicast-flush sw1
ovn-sbctl ip-multicast-flush sw2
ovn-sbctl ip-multicast-flush sw3
ovs_wait_cond () {

    total_entries=`ovn-sbctl find IGMP_Group | grep "239.0.1.68" -c`
    test "${total_entries}" = "0"

}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:15744" "until
    total_entries=\`ovn-sbctl find IGMP_Group | grep \"239.0.1.68\" -c\`
    test \"\${total_entries}\" = \"0\"
"


as hv1 reset_pcap_file hv1-vif1 hv1/vif1
as hv1 reset_pcap_file hv1-vif2 hv1/vif2
as hv1 reset_pcap_file hv1-vif3 hv1/vif3
as hv1 reset_pcap_file hv1-vif4 hv1/vif4
as hv2 reset_pcap_file hv2-vif1 hv2/vif1
as hv2 reset_pcap_file hv2-vif2 hv2/vif2
as hv2 reset_pcap_file hv2-vif3 hv2/vif3
as hv2 reset_pcap_file hv2-vif4 hv2/vif4

> expected_empty
> expected_switched
> expected_routed
> expected_reports

# Enable mcast_flood on sw1-p11
ovn-nbctl set Logical_Switch_Port sw1-p11 options:mcast_flood='true'

# Enable mcast_flood_reports on sw1-p21
ovn-nbctl set Logical_Switch_Port sw1-p21 options:mcast_flood_reports='true'
# Enable mcast_flood on rtr-sw2
ovn-nbctl set Logical_Router_Port rtr-sw2 options:mcast_flood='true'
# Enable mcast_flood on sw2-p1
ovn-nbctl set Logical_Switch_Port sw2-p1 options:mcast_flood='true'

ovn-nbctl --wait=hv sync

# Inject IGMP Join for 239.0.1.68 on sw1-p12.
send_igmp_v3_report hv1-vif2 hv1 \
    000000000001 $(ip_to_hex 10 0 0 1) f9f8 \
    $(ip_to_hex 239 0 1 68) 04 e9b9 \
    expected_reports

# Check that the IGMP Group is learned.
ovs_wait_cond () {

    total_entries=`ovn-sbctl find IGMP_Group | grep "239.0.1.68" -c`
    test "${total_entries}" = "1"

}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:15782" "until
    total_entries=\`ovn-sbctl find IGMP_Group | grep \"239.0.1.68\" -c\`
    test \"\${total_entries}\" = \"1\"
"


# Send traffic from sw1-p21
send_ip_multicast_pkt hv2-vif1 hv2 \
    000000000001 01005e000144 \
    $(ip_to_hex 10 0 0 42) $(ip_to_hex 239 0 1 68) 1e 20 ca70 11 \
    e518e518000a3b3a0000
store_ip_multicast_pkt \
    000000000001 01005e000144 \
    $(ip_to_hex 10 0 0 42) $(ip_to_hex 239 0 1 68) 1e 20 ca70 11 \
    e518e518000a3b3a0000 expected_switched
store_ip_multicast_pkt \
    000000000200 01005e000144 \
    $(ip_to_hex 10 0 0 42) $(ip_to_hex 239 0 1 68) 1e 1f cb70 11 \
    e518e518000a3b3a0000 expected_routed

# Sleep a bit to make sure no duplicate traffic is received
sleep 1

# Check that traffic is switched to sw1-p11 and sw1-p12
# Check that IGMP join is flooded on sw1-p21
# Check that traffic is routed by rtr to rtr-sw2 and then switched to sw2-p1
ovn_check_packets__ "hv1/vif1-tx.pcap" "expected_switched"
   { set +x
$as_echo "$at_srcdir/ovn.at:15807: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:15807"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15807"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv1/vif2-tx.pcap" "expected_switched"
   { set +x
$as_echo "$at_srcdir/ovn.at:15808: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:15808"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15808"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv1/vif3-tx.pcap" "expected_routed"
   { set +x
$as_echo "$at_srcdir/ovn.at:15809: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:15809"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15809"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv1/vif4-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:15810: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:15810"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15810"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv2/vif1-tx.pcap" "expected_reports"
   { set +x
$as_echo "$at_srcdir/ovn.at:15811: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:15811"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15811"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv2/vif2-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:15812: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:15812"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15812"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv2/vif3-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:15813: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:15813"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15813"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv2/vif4-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:15814: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:15814"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15814"
$at_failed && at_fn_log_failure
$at_traceon; }





    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:15816: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:15816"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15816"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:15816: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:15816"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15816"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:15816" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:15816: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:15816"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15816"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:15816: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:15816"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15816"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:15816" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:15816: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:15816"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15816"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:15816: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:15816"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15816"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:15816" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:15816: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:15816"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15816"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:15816: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:15816"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15816"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:15816" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:15816: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:15816"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15816"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:15816: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:15816"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15816"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:15816" "while kill -0 \$TMPPID 2>/dev/null"





    as hv2
    if test "hv2" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:15816: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:15816"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15816"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:15816: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:15816"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15816"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:15816" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:15816: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:15816"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15816"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:15816: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:15816"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15816"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:15816" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:15816: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:15816"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15816"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:15816: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:15816"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15816"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:15816" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv2
    { set +x
$as_echo "$at_srcdir/ovn.at:15816: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:15816"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15816"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:15816: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:15816"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15816"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:15816" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:15816: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:15816"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15816"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:15816: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:15816"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15816"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:15816" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:15816: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:15816"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15816"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:15816: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:15816"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15816"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:15816" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:15816: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:15816"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15816"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:15816: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:15816"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15816"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:15816" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:15816: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:15816"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15816"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:15816: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:15816"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15816"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:15816" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:15816: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:15816"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15816"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:15816: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:15816"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15816"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:15816" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:15816: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:15816"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15816"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:15816: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:15816"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15816"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:15816" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:15816: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:15816"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15816"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:15816: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:15816"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:15816"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:15816" "while kill -0 \$TMPPID 2>/dev/null"



ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_115
#AT_START_116
at_fn_group_banner 116 'ovn.at:15819' \
  "ovn -- MLD snoop/querier/relay" "                 " 2
at_xfail=no
(
  $as_echo "116. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

# Logical network:
# Three logical switches (sw1-sw3) connected to a logical router (rtr).
# sw1:
#   - subnet 10::/64
#   - 2 ports bound on hv1 (sw1-p11, sw1-p12)
#   - 2 ports bound on hv2 (sw1-p21, sw1-p22)
# sw2:
#   - subnet 20::/64
#   - 1 port bound on hv1 (sw2-p1)
#   - 1 port bound on hv2 (sw2-p2)
#   - MLD Querier from 20::fe
# sw3:
#   - subnet 30::/64
#   - 1 port bound on hv1 (sw3-p1)
#   - 1 port bound on hv2 (sw3-p2)

reset_pcap_file() {
    local iface=$1
    local pcap_file=$2
    ovs-vsctl -- set Interface $iface options:tx_pcap=dummy-tx.pcap \
options:rxq_pcap=dummy-rx.pcap
    rm -f ${pcap_file}*.pcap
    ovs-vsctl -- set Interface $iface options:tx_pcap=${pcap_file}-tx.pcap \
options:rxq_pcap=${pcap_file}-rx.pcap
}

#
# send_mld_v2_report INPORT HV ETH_SRC IP_SRC GROUP REC_TYPE
#                    MLD_CSUM OUTFILE
#
# This shell function causes an MLDv2 report to be received on INPORT of HV.
# The packet's content has Ethernet destination 33:33:00:00:00:16 and source
# ETH_SRC (exactly 12 hex digits). Ethernet type is set to IPv6.
# GROUP is the IPv6 multicast group to be joined/to leave (based on REC_TYPE).
# REC_TYPE == 04: join GROUP
# REC_TYPE == 03: leave GROUP
# The packet hexdump is also stored in OUTFILE.
#
send_mld_v2_report() {
    local inport=$1 hv=$2 eth_src=$3 ip_src=$4 group=$5
    local rec_type=$6 mld_chksum=$7 outfile=$8

    local eth_dst=333300000016
    local ip_dst=ff020000000000000000000000000016
    local ip_ttl=01
    local ip_ra_opt=3a00050200000100

    local mld_type=8f
    local mld_code=00
    local num_rec=0001
    local aux_dlen=00
    local num_src=0000

    local eth=${eth_dst}${eth_src}86dd
    local ip=60000000002400${ip_ttl}${ip_src}${ip_dst}${ip_ra_opt}
    local mld=${mld_type}${mld_code}${mld_chksum}0000${num_rec}${rec_type}${aux_dlen}${num_src}${group}
    local packet=${eth}${ip}${mld}

    echo ${packet} >> ${outfile}
    as $hv ovs-appctl netdev-dummy/receive ${inport} ${packet}
}

#
# store_mld_query ETH_SRC IP_SRC OUTFILE
#
# This shell function builds an MLD general query from ETH_SRC and IP_SRC
# and stores the hexdump of the packet in OUTFILE.
#
store_mld_query() {
    local eth_src=$1 ip_src=$2 outfile=$3

    local eth_dst=333300000000
    local ip_dst=ff020000000000000000000000000001
    local ip_ttl=01
    local ip_ra_opt=3a00050200000000

    local mld_type=82
    local mld_code=00
    local max_resp=03e8
    local mld_chksum=59be
    local addr=00000000000000000000000000000000

    local eth=${eth_dst}${eth_src}86dd
    local ip=60000000002400${ip_ttl}${ip_src}${ip_dst}${ip_ra_opt}
    local mld=${mld_type}${mld_code}${mld_chksum}${max_resp}0000${addr}00010000
    local packet=${eth}${ip}${mld}

    echo ${packet} >> ${outfile}
}

#
# send_ip_multicast_pkt INPORT HV ETH_SRC ETH_DST IP_SRC IP_DST IP_LEN TTL
#    IP_PROTO DATA
#
# This shell function causes an IP multicast packet to be received on INPORT
# of HV.
#
send_ip_multicast_pkt() {
    local inport=$1 hv=$2 eth_src=$3 eth_dst=$4
    local ip_src=$5 ip_dst=$6 ip_len=$7 ip_ttl=$8 proto=$9
    local data=${10}

    local eth=${eth_dst}${eth_src}86dd
    local ip=60000000${ip_len}${proto}${ip_ttl}${ip_src}${ip_dst}
    local packet=${eth}${ip}${data}

    as $hv ovs-appctl netdev-dummy/receive ${inport} ${packet}
}

#
# store_ip_multicast_pkt ETH_SRC ETH_DST IP_SRC IP_DST IP_LEN TTL
#    IP_PROTO DATA OUTFILE
#
# This shell function builds an IP multicast packet and stores the hexdump of
# the packet in OUTFILE.
#
store_ip_multicast_pkt() {
    local eth_src=$1 eth_dst=$2
    local ip_src=$3 ip_dst=$4 ip_len=$5 ip_ttl=$6 proto=$7
    local data=$8 outfile=$9

    local eth=${eth_dst}${eth_src}86dd
    local ip=60000000${ip_len}${proto}${ip_ttl}${ip_src}${ip_dst}
    local packet=${eth}${ip}${data}

    echo ${packet} >> ${outfile}
}

ovn-nbctl ls-add sw1
ovn-nbctl ls-add sw2
ovn-nbctl ls-add sw3

ovn-nbctl lsp-add sw1 sw1-p11
ovn-nbctl lsp-add sw1 sw1-p12
ovn-nbctl lsp-add sw1 sw1-p21
ovn-nbctl lsp-add sw1 sw1-p22
ovn-nbctl lsp-add sw2 sw2-p1
ovn-nbctl lsp-add sw2 sw2-p2
ovn-nbctl lsp-add sw3 sw3-p1
ovn-nbctl lsp-add sw3 sw3-p2

ovn-nbctl lr-add rtr
ovn-nbctl lrp-add rtr rtr-sw1 00:00:00:00:01:00 10::fe/64
ovn-nbctl lrp-add rtr rtr-sw2 00:00:00:00:02:00 20::fe/64
ovn-nbctl lrp-add rtr rtr-sw3 00:00:00:00:03:00 30::fe/64

ovn-nbctl lsp-add sw1 sw1-rtr                      \
    -- lsp-set-type sw1-rtr router                 \
    -- lsp-set-addresses sw1-rtr 00:00:00:00:01:00 \
    -- lsp-set-options sw1-rtr router-port=rtr-sw1
ovn-nbctl lsp-add sw2 sw2-rtr                      \
    -- lsp-set-type sw2-rtr router                 \
    -- lsp-set-addresses sw2-rtr 00:00:00:00:02:00 \
    -- lsp-set-options sw2-rtr router-port=rtr-sw2
ovn-nbctl lsp-add sw3 sw3-rtr                      \
    -- lsp-set-type sw3-rtr router                 \
    -- lsp-set-addresses sw3-rtr 00:00:00:00:03:00 \
    -- lsp-set-options sw3-rtr router-port=rtr-sw3

net_add n1
sim_add hv1
as hv1
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.1
ovs-vsctl -- add-port br-int hv1-vif1 -- \
    set interface hv1-vif1 external-ids:iface-id=sw1-p11 \
    options:tx_pcap=hv1/vif1-tx.pcap \
    options:rxq_pcap=hv1/vif1-rx.pcap \
    ofport-request=1
ovs-vsctl -- add-port br-int hv1-vif2 -- \
    set interface hv1-vif2 external-ids:iface-id=sw1-p12 \
    options:tx_pcap=hv1/vif2-tx.pcap \
    options:rxq_pcap=hv1/vif2-rx.pcap \
    ofport-request=1
ovs-vsctl -- add-port br-int hv1-vif3 -- \
    set interface hv1-vif3 external-ids:iface-id=sw2-p1 \
    options:tx_pcap=hv1/vif3-tx.pcap \
    options:rxq_pcap=hv1/vif3-rx.pcap \
    ofport-request=1
ovs-vsctl -- add-port br-int hv1-vif4 -- \
    set interface hv1-vif4 external-ids:iface-id=sw3-p1 \
    options:tx_pcap=hv1/vif4-tx.pcap \
    options:rxq_pcap=hv1/vif4-rx.pcap \
    ofport-request=1

sim_add hv2
as hv2
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.2
ovs-vsctl -- add-port br-int hv2-vif1 -- \
    set interface hv2-vif1 external-ids:iface-id=sw1-p21 \
    options:tx_pcap=hv2/vif1-tx.pcap \
    options:rxq_pcap=hv2/vif1-rx.pcap \
    ofport-request=1
ovs-vsctl -- add-port br-int hv2-vif2 -- \
    set interface hv2-vif2 external-ids:iface-id=sw1-p22 \
    options:tx_pcap=hv2/vif2-tx.pcap \
    options:rxq_pcap=hv2/vif2-rx.pcap \
    ofport-request=1
ovs-vsctl -- add-port br-int hv2-vif3 -- \
    set interface hv2-vif3 external-ids:iface-id=sw2-p2 \
    options:tx_pcap=hv2/vif3-tx.pcap \
    options:rxq_pcap=hv2/vif3-rx.pcap \
    ofport-request=1
ovs-vsctl -- add-port br-int hv2-vif4 -- \
    set interface hv2-vif4 external-ids:iface-id=sw3-p2 \
    options:tx_pcap=hv2/vif4-tx.pcap \
    options:rxq_pcap=hv2/vif4-rx.pcap \
    ofport-request=1

{ set +x
$as_echo "$at_srcdir/ovn.at:16032: ovn_populate_arp__"
at_fn_check_prepare_trace "ovn.at:16032"
( $at_check_trace; ovn_populate_arp__
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16032"
$at_failed && at_fn_log_failure
$at_traceon; }


# Enable multicast snooping on sw1.
ovn-nbctl set Logical_Switch sw1       \
    other_config:mcast_querier="false" \
    other_config:mcast_snoop="true"

# No IGMP/MLD query should be generated by sw1 (mcast_querier="false").
> expected
ovn_check_packets__ "hv1/vif1-tx.pcap" "expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:16041: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:16041"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16041"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv1/vif2-tx.pcap" "expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:16042: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:16042"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16042"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv2/vif1-tx.pcap" "expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:16043: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:16043"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16043"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv2/vif2-tx.pcap" "expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:16044: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:16044"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16044"
$at_failed && at_fn_log_failure
$at_traceon; }


ovn-nbctl --wait=hv sync

# Inject MLD Join for ff0a:dead:beef::1 on sw1-p11.
send_mld_v2_report hv1-vif1 hv1 \
    000000000001 10000000000000000000000000000001 \
    ff0adeadbeef00000000000000000001 04 c0e4 \
    /dev/null
# Inject MLD Join for ff0a:dead:beef::1 on sw1-p21.
send_mld_v2_report hv2-vif1 hv2 \
    000000000002 10000000000000000000000000000002 \
    ff0adeadbeef00000000000000000001 04 c0e3 \
    /dev/null

# Check that the IP multicast group is learned on both hv.
ovs_wait_cond () {

    total_entries=`ovn-sbctl find IGMP_Group | grep "ff0a:dead:beef::1" -c`
    test "${total_entries}" = "2"

}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:16060" "until
    total_entries=\`ovn-sbctl find IGMP_Group | grep \"ff0a:dead:beef::1\" -c\`
    test \"\${total_entries}\" = \"2\"
"


# Send traffic and make sure it gets forwarded only on the two ports that
# joined.
> expected
> expected_empty
send_ip_multicast_pkt hv1-vif2 hv1 \
    000000000001 333300000001 \
    10000000000000000000000000000042 ff0adeadbeef00000000000000000001 \
    000e 01 11 \
    93407a69000e1b5e61736461640a

store_ip_multicast_pkt \
    000000000001 333300000001 \
    10000000000000000000000000000042 ff0adeadbeef00000000000000000001 \
    000e 01 11 \
    93407a69000e1b5e61736461640a \
    expected

ovn_check_packets__ "hv1/vif1-tx.pcap" "expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:16082: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:16082"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16082"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv2/vif1-tx.pcap" "expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:16083: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:16083"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16083"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv1/vif2-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:16084: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:16084"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16084"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv2/vif2-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:16085: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:16085"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16085"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv1/vif3-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:16086: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:16086"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16086"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv2/vif3-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:16087: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:16087"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16087"
$at_failed && at_fn_log_failure
$at_traceon; }


# Inject MLD Leave for ff0a:dead:beef::1 on sw1-p11.
send_mld_v2_report hv1-vif1 hv1 \
    000000000001 10000000000000000000000000000001 \
    ff0adeadbeef00000000000000000001 03 c1e4 \
    /dev/null

# Check IGMP_Group table on both HV.
ovs_wait_cond () {

    total_entries=`ovn-sbctl find IGMP_Group | grep "ff0a:dead:beef::1" -c`
    test "${total_entries}" = "1"

}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:16096" "until
    total_entries=\`ovn-sbctl find IGMP_Group | grep \"ff0a:dead:beef::1\" -c\`
    test \"\${total_entries}\" = \"1\"
"


# Send traffic and make sure it gets forwarded only on the port that joined.
as hv1 reset_pcap_file hv1-vif1 hv1/vif1
as hv2 reset_pcap_file hv2-vif1 hv2/vif1
> expected
> expected_empty
send_ip_multicast_pkt hv1-vif2 hv1 \
    000000000001 333300000001 \
    10000000000000000000000000000042 ff0adeadbeef00000000000000000001 \
    000e 01 11 \
    93407a69000e1b5e61736461640a

store_ip_multicast_pkt \
    000000000001 333300000001 \
    10000000000000000000000000000042 ff0adeadbeef00000000000000000001 \
    000e 01 11 \
    93407a69000e1b5e61736461640a \
    expected

ovn_check_packets__ "hv1/vif1-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:16119: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:16119"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16119"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv2/vif1-tx.pcap" "expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:16120: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:16120"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16120"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv1/vif2-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:16121: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:16121"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16121"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv2/vif2-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:16122: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:16122"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16122"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv1/vif3-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:16123: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:16123"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16123"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv2/vif3-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:16124: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:16124"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16124"
$at_failed && at_fn_log_failure
$at_traceon; }


# Flush IP multicast groups.
ovn-sbctl ip-multicast-flush sw1
ovs_wait_cond () {

    total_entries=`ovn-sbctl find IGMP_Group | grep " ff0a:dead:beef::1" -c`
    test "${total_entries}" = "0"

}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:16128" "until
    total_entries=\`ovn-sbctl find IGMP_Group | grep \" ff0a:dead:beef::1\" -c\`
    test \"\${total_entries}\" = \"0\"
"


# Check that traffic for "all-hosts" is flooded even if some hosts register
# for it.
# Inject MLD Join for ff02::1 on sw1-p11.
send_mld_v2_report hv1-vif1 hv1 \
    000000000001 10000000000000000000000000000001 \
    ff020000000000000000000000000001 04 5e8a \
    /dev/null

# Check that the Multicast Group is learned.
ovs_wait_cond () {

    total_entries=`ovn-sbctl find IGMP_Group | grep "ff02::1" -c`
    test "${total_entries}" = "1"

}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:16142" "until
    total_entries=\`ovn-sbctl find IGMP_Group | grep \"ff02::1\" -c\`
    test \"\${total_entries}\" = \"1\"
"


# Send traffic and make sure it gets flooded to all ports.
as hv1 reset_pcap_file hv1-vif1 hv1/vif1
as hv1 reset_pcap_file hv1-vif2 hv1/vif2
as hv2 reset_pcap_file hv2-vif1 hv2/vif1
as hv2 reset_pcap_file hv2-vif2 hv2/vif2
> expected
send_ip_multicast_pkt hv1-vif2 hv1 \
    000000000001 333300000001 \
    10000000000000000000000000000042 ff020000000000000000000000000001 \
    000e 01 11 \
    93407a69000eb90361736461640a
store_ip_multicast_pkt \
    000000000001 333300000001 \
    10000000000000000000000000000042 ff020000000000000000000000000001 \
    000e 01 11 \
    93407a69000eb90361736461640a \
    expected

ovn_check_packets__ "hv1/vif1-tx.pcap" "expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:16165: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:16165"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16165"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv2/vif1-tx.pcap" "expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:16166: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:16166"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16166"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv2/vif2-tx.pcap" "expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:16167: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:16167"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16167"
$at_failed && at_fn_log_failure
$at_traceon; }


# Enable multicast snooping and querier on sw2 and set query interval to
# minimum.
ovn-nbctl set Logical_Switch sw2 \
    other_config:mcast_snoop="true" \
    other_config:mcast_querier="true" \
    other_config:mcast_query_interval=1 \
    other_config:mcast_eth_src="00:00:00:00:02:fe" \
    other_config:mcast_ip6_src="2000::fe"

# Wait for 1 query interval (1 sec) and check that two queries are generated.
> expected
store_mld_query 0000000002fe 200000000000000000000000000000fe expected
store_mld_query 0000000002fe 200000000000000000000000000000fe expected
sleep 1

ovn_check_packets__ "hv1/vif3-tx.pcap" "expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:16184: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:16184"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16184"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv2/vif3-tx.pcap" "expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:16185: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:16185"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16185"
$at_failed && at_fn_log_failure
$at_traceon; }


# Disable multicast querier on sw2.
ovn-nbctl set Logical_Switch sw2 \
    other_config:mcast_querier="false"

# Enable multicast snooping on sw3.
ovn-nbctl set Logical_Switch sw3       \
    other_config:mcast_querier="false" \
    other_config:mcast_snoop="true"

# Send traffic from sw3 and make sure rtr doesn't relay it.
> expected_empty

as hv1 reset_pcap_file hv1-vif1 hv1/vif1
as hv1 reset_pcap_file hv1-vif2 hv1/vif2
as hv1 reset_pcap_file hv1-vif3 hv1/vif3
as hv1 reset_pcap_file hv1-vif4 hv1/vif4
as hv2 reset_pcap_file hv2-vif1 hv2/vif1
as hv2 reset_pcap_file hv2-vif2 hv2/vif2
as hv2 reset_pcap_file hv2-vif3 hv2/vif3
as hv2 reset_pcap_file hv2-vif4 hv2/vif4

send_ip_multicast_pkt hv2-vif4 hv2 \
    000000000001 333300000001 \
    00100000000000000000000000000042 ff0adeadbeef00000000000000000001 \
    000e 02 11 \
    93407a69000e2b4e61736461640a

# Sleep a bit to make sure no traffic is received and then check.
sleep 1
ovn_check_packets__ "hv1/vif1-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:16216: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:16216"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16216"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv1/vif2-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:16217: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:16217"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16217"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv1/vif3-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:16218: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:16218"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16218"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv1/vif4-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:16219: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:16219"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16219"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv2/vif1-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:16220: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:16220"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16220"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv2/vif2-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:16221: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:16221"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16221"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv2/vif3-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:16222: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:16222"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16222"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv2/vif4-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:16223: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:16223"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16223"
$at_failed && at_fn_log_failure
$at_traceon; }


# Enable multicast relay on rtr
ovn-nbctl set logical_router rtr \
    options:mcast_relay="true"

# Inject MLD Join for ff0a:dead:beef::1 on sw1-p11.
send_mld_v2_report hv1-vif1 hv1 \
    000000000001 10000000000000000000000000000001 \
    ff0adeadbeef00000000000000000001 04 c0e4 \
    /dev/null

# Inject MLD Join for ff0a:dead:beef::1 on sw2-p2.
send_mld_v2_report hv2-vif3 hv2 \
    000000000001 10000000000000000000000000000001 \
    ff0adeadbeef00000000000000000001 04 c0e4 \
    /dev/null

# Check that the IGMP Group is learned by all switches.
ovs_wait_cond () {

    total_entries=`ovn-sbctl find IGMP_Group | grep "ff0a:dead:beef::1" -c`
    test "${total_entries}" = "2"

}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:16242" "until
    total_entries=\`ovn-sbctl find IGMP_Group | grep \"ff0a:dead:beef::1\" -c\`
    test \"\${total_entries}\" = \"2\"
"


# Send traffic from sw3 and make sure it is relayed by rtr.
# to ports that joined.
> expected_routed_sw1
> expected_routed_sw2
> expected_empty

as hv1 reset_pcap_file hv1-vif1 hv1/vif1
as hv1 reset_pcap_file hv1-vif2 hv1/vif2
as hv1 reset_pcap_file hv1-vif3 hv1/vif3
as hv1 reset_pcap_file hv1-vif4 hv1/vif4
as hv2 reset_pcap_file hv2-vif1 hv2/vif1
as hv2 reset_pcap_file hv2-vif2 hv2/vif2
as hv2 reset_pcap_file hv2-vif3 hv2/vif3
as hv2 reset_pcap_file hv2-vif4 hv2/vif4

send_ip_multicast_pkt hv2-vif4 hv2 \
    000000000001 333300000001 \
    10000000000000000000000000000042 ff0adeadbeef00000000000000000001 \
    000e 02 11 \
    93407a69000e1b5e61736461640a
store_ip_multicast_pkt \
    000000000100 333300000001 \
    10000000000000000000000000000042 ff0adeadbeef00000000000000000001 \
    000e 01 11 \
    93407a69000e1b5e61736461640a \
    expected_routed_sw1
store_ip_multicast_pkt \
    000000000200 333300000001 \
    10000000000000000000000000000042 ff0adeadbeef00000000000000000001 \
    000e 01 11 \
    93407a69000e1b5e61736461640a \
    expected_routed_sw2

ovn_check_packets__ "hv1/vif1-tx.pcap" "expected_routed_sw1"
   { set +x
$as_echo "$at_srcdir/ovn.at:16280: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:16280"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16280"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv2/vif3-tx.pcap" "expected_routed_sw2"
   { set +x
$as_echo "$at_srcdir/ovn.at:16281: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:16281"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16281"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv1/vif4-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:16282: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:16282"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16282"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv1/vif2-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:16283: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:16283"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16283"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv1/vif3-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:16284: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:16284"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16284"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv2/vif1-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:16285: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:16285"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16285"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv2/vif2-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:16286: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:16286"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16286"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv2/vif4-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:16287: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:16287"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16287"
$at_failed && at_fn_log_failure
$at_traceon; }


# Inject MLD Join for 239.0.1.68 on sw3-p1.
send_mld_v2_report hv1-vif4 hv1 \
    000000000001 10000000000000000000000000000001 \
    ff0adeadbeef00000000000000000001 04 c0e4 \
    /dev/null

# Check that the Multicast Group is learned by all switches.
ovs_wait_cond () {

    total_entries=`ovn-sbctl find IGMP_Group | grep "ff0a:dead:beef::1" -c`
    test "${total_entries}" = "3"

}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:16296" "until
    total_entries=\`ovn-sbctl find IGMP_Group | grep \"ff0a:dead:beef::1\" -c\`
    test \"\${total_entries}\" = \"3\"
"


# Send traffic from sw3 and make sure it is relayed by rtr
# to ports that joined.
> expected_routed_sw1
> expected_routed_sw2
> expected_switched
> expected_empty

as hv1 reset_pcap_file hv1-vif1 hv1/vif1
as hv1 reset_pcap_file hv1-vif2 hv1/vif2
as hv1 reset_pcap_file hv1-vif3 hv1/vif3
as hv1 reset_pcap_file hv1-vif4 hv1/vif4
as hv2 reset_pcap_file hv2-vif1 hv2/vif1
as hv2 reset_pcap_file hv2-vif2 hv2/vif2
as hv2 reset_pcap_file hv2-vif3 hv2/vif3
as hv2 reset_pcap_file hv2-vif4 hv2/vif4

send_ip_multicast_pkt hv2-vif4 hv2 \
    000000000001 333300000001 \
    10000000000000000000000000000042 ff0adeadbeef00000000000000000001 \
    000e 02 11 \
    93407a69000e1b5e61736461640a
store_ip_multicast_pkt \
    000000000100 333300000001 \
    10000000000000000000000000000042 ff0adeadbeef00000000000000000001 \
    000e 01 11 \
    93407a69000e1b5e61736461640a \
    expected_routed_sw1
store_ip_multicast_pkt \
    000000000200 333300000001 \
    10000000000000000000000000000042 ff0adeadbeef00000000000000000001 \
    000e 01 11 \
    93407a69000e1b5e61736461640a \
    expected_routed_sw2
store_ip_multicast_pkt \
    000000000001 333300000001 \
    10000000000000000000000000000042 ff0adeadbeef00000000000000000001 \
    000e 02 11 \
    93407a69000e1b5e61736461640a \
    expected_switched

ovn_check_packets__ "hv1/vif1-tx.pcap" "expected_routed_sw1"
   { set +x
$as_echo "$at_srcdir/ovn.at:16341: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:16341"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16341"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv2/vif3-tx.pcap" "expected_routed_sw2"
   { set +x
$as_echo "$at_srcdir/ovn.at:16342: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:16342"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16342"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv1/vif4-tx.pcap" "expected_switched"
   { set +x
$as_echo "$at_srcdir/ovn.at:16343: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:16343"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16343"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv1/vif2-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:16344: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:16344"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16344"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv1/vif3-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:16345: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:16345"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16345"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv2/vif1-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:16346: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:16346"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16346"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv2/vif2-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:16347: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:16347"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16347"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv2/vif4-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:16348: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:16348"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16348"
$at_failed && at_fn_log_failure
$at_traceon; }


# Flush multicast groups.
ovn-sbctl ip-multicast-flush sw1
ovn-sbctl ip-multicast-flush sw2
ovn-sbctl ip-multicast-flush sw3
ovs_wait_cond () {

    total_entries=`ovn-sbctl find IGMP_Group | grep "ff0a:dead:beef::1" -c`
    test "${total_entries}" = "0"

}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:16354" "until
    total_entries=\`ovn-sbctl find IGMP_Group | grep \"ff0a:dead:beef::1\" -c\`
    test \"\${total_entries}\" = \"0\"
"


as hv1 reset_pcap_file hv1-vif1 hv1/vif1
as hv1 reset_pcap_file hv1-vif2 hv1/vif2
as hv1 reset_pcap_file hv1-vif3 hv1/vif3
as hv1 reset_pcap_file hv1-vif4 hv1/vif4
as hv2 reset_pcap_file hv2-vif1 hv2/vif1
as hv2 reset_pcap_file hv2-vif2 hv2/vif2
as hv2 reset_pcap_file hv2-vif3 hv2/vif3
as hv2 reset_pcap_file hv2-vif4 hv2/vif4

> expected_empty
> expected_switched
> expected_routed
> expected_reports

# Enable mcast_flood on sw1-p11
ovn-nbctl set Logical_Switch_Port sw1-p11 options:mcast_flood='true'

# Enable mcast_flood_reports on sw1-p21
ovn-nbctl set Logical_Switch_Port sw1-p21 options:mcast_flood_reports='true'
# Enable mcast_flood on rtr-sw2
ovn-nbctl set Logical_Router_Port rtr-sw2 options:mcast_flood='true'
# Enable mcast_flood on sw2-p1
ovn-nbctl set Logical_Switch_Port sw2-p1 options:mcast_flood='true'

ovn-nbctl --wait=hv sync

# Inject MLD Join for ff0a:dead:beef::1 on sw1-p12.
send_mld_v2_report hv1-vif2 hv1 \
    000000000001 10000000000000000000000000000001 \
    ff0adeadbeef00000000000000000001 04 c0e4 \
    expected_reports

# Check that the IP multicast group is learned.
ovs_wait_cond () {

    total_entries=`ovn-sbctl find IGMP_Group | grep "ff0a:dead:beef::1" -c`
    test "${total_entries}" = "1"

}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:16392" "until
    total_entries=\`ovn-sbctl find IGMP_Group | grep \"ff0a:dead:beef::1\" -c\`
    test \"\${total_entries}\" = \"1\"
"


# Send traffic from sw1-p21
send_ip_multicast_pkt hv2-vif1 hv2 \
    000000000001 333300000001 \
    00100000000000000000000000000042 ff0adeadbeef00000000000000000001 \
    000e 02 11 \
    93407a69000e2b4e61736461640a
store_ip_multicast_pkt \
    000000000001 333300000001 \
    00100000000000000000000000000042 ff0adeadbeef00000000000000000001 \
    000e 02 11 \
    93407a69000e2b4e61736461640a \
    expected_switched
store_ip_multicast_pkt \
    000000000200 333300000001 \
    00100000000000000000000000000042 ff0adeadbeef00000000000000000001 \
    000e 01 11 \
    93407a69000e2b4e61736461640a \
    expected_routed

# Sleep a bit to make sure no duplicate traffic is received
sleep 1

# Check that traffic is switched to sw1-p11 and sw1-p12
# Check that MLD join is flooded on sw1-p21
# Check that traffic is routed by rtr to rtr-sw2 and then switched to sw2-p1
ovn_check_packets__ "hv1/vif1-tx.pcap" "expected_switched"
   { set +x
$as_echo "$at_srcdir/ovn.at:16422: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:16422"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16422"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv1/vif2-tx.pcap" "expected_switched"
   { set +x
$as_echo "$at_srcdir/ovn.at:16423: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:16423"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16423"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv1/vif3-tx.pcap" "expected_routed"
   { set +x
$as_echo "$at_srcdir/ovn.at:16424: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:16424"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16424"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv1/vif4-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:16425: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:16425"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16425"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv2/vif1-tx.pcap" "expected_reports"
   { set +x
$as_echo "$at_srcdir/ovn.at:16426: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:16426"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16426"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv2/vif2-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:16427: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:16427"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16427"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv2/vif3-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:16428: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:16428"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16428"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn_check_packets__ "hv2/vif4-tx.pcap" "expected_empty"
   { set +x
$as_echo "$at_srcdir/ovn.at:16429: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:16429"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16429"
$at_failed && at_fn_log_failure
$at_traceon; }





    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:16431: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:16431"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16431"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:16431: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:16431"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16431"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:16431" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:16431: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:16431"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16431"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:16431: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:16431"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16431"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:16431" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:16431: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:16431"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16431"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:16431: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:16431"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16431"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:16431" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:16431: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:16431"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16431"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:16431: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:16431"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16431"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:16431" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:16431: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:16431"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16431"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:16431: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:16431"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16431"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:16431" "while kill -0 \$TMPPID 2>/dev/null"





    as hv2
    if test "hv2" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:16431: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:16431"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16431"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:16431: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:16431"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16431"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:16431" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:16431: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:16431"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16431"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:16431: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:16431"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16431"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:16431" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:16431: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:16431"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16431"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:16431: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:16431"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16431"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:16431" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv2
    { set +x
$as_echo "$at_srcdir/ovn.at:16431: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:16431"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16431"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:16431: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:16431"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16431"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:16431" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:16431: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:16431"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16431"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:16431: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:16431"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16431"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:16431" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:16431: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:16431"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16431"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:16431: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:16431"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16431"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:16431" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:16431: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:16431"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16431"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:16431: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:16431"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16431"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:16431" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:16431: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:16431"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16431"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:16431: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:16431"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16431"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:16431" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:16431: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:16431"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16431"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:16431: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:16431"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16431"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:16431" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:16431: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:16431"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16431"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:16431: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:16431"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16431"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:16431" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:16431: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:16431"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16431"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:16431: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:16431"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16431"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:16431" "while kill -0 \$TMPPID 2>/dev/null"



ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_116
#AT_START_117
at_fn_group_banner 117 'ovn.at:16434' \
  "ovn -- unixctl socket" "                          " 2
at_xfail=no
(
  $as_echo "117. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

sockfile="$at_group_dir/my_sock.ctl"

# Specifying -u should fail since we have no daemon running
{ set +x
$as_echo "$at_srcdir/ovn.at:16440: ovn-nbctl -u \$sockfile show"
at_fn_check_prepare_dynamic "ovn-nbctl -u $sockfile show" "ovn.at:16440"
( $at_check_trace; ovn-nbctl -u $sockfile show
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; cat "$at_stderr"
echo stdout:; cat "$at_stdout"
at_fn_check_status 1 $at_status "$at_srcdir/ovn.at:16440"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn.at:16442: ovn-nbctl --detach -u \$sockfile --pidfile"
at_fn_check_prepare_dynamic "ovn-nbctl --detach -u $sockfile --pidfile" "ovn.at:16442"
( $at_check_trace; ovn-nbctl --detach -u $sockfile --pidfile
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "$sockfile
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16442"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:16444: if test -f \"\$sockfile\" ; then exit 99 ; fi"
at_fn_check_prepare_dynamic "if test -f \"$sockfile\" ; then exit 99 ; fi" "ovn.at:16444"
( $at_check_trace; if test -f "$sockfile" ; then exit 99 ; fi
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16444"
$at_failed && at_fn_log_failure
$at_traceon; }

on_exit 'kill $(cat ovn-nbctl.pid)'

# We can't confirm that the nbctl client is actually using the sockfile,
# but we can still ensure that the command is successful.
{ set +x
$as_echo "$at_srcdir/ovn.at:16449: ovn-nbctl -u \$sockfile show"
at_fn_check_prepare_dynamic "ovn-nbctl -u $sockfile show" "ovn.at:16449"
( $at_check_trace; ovn-nbctl -u $sockfile show
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16449"
$at_failed && at_fn_log_failure
$at_traceon; }


ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_117
#AT_START_118
at_fn_group_banner 118 'ovn.at:16454' \
  "ovn -- 2 HVs, 2 lports/HV, localnet ports, DVR N-S ARP handling" "" 2
at_xfail=no
(
  $as_echo "118. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

# In this test cases we create 3 switches, all connected to same
# physical network (through br-phys on each HV). LS1 and LS2 have
# 1 VIF each. Each HV has 1 VIF port. The first digit
# of VIF port name indicates the hypervisor it is bound to, e.g.
# lp23 means VIF 3 on hv2.
#
# All the switches are connected to a logical router "router".
#
# Each switch's VLAN tag and their logical switch ports are:
#   - ls1:
#       - tagged with VLAN 101
#       - ports: lp11
#   - ls2:
#       - tagged with VLAN 201
#       - ports: lp22
#   - ls-underlay:
#       - tagged with VLAN 1000
# Note: a localnet port is created for each switch to connect to
# physical network.

for i in 1 2; do
    ls_name=ls$i
    ovn-nbctl ls-add $ls_name
    ln_port_name=ln$i
    if test $i -eq 1; then
        ovn-nbctl lsp-add $ls_name $ln_port_name "" 101
    elif test $i -eq 2; then
        ovn-nbctl lsp-add $ls_name $ln_port_name "" 201
    fi
    ovn-nbctl lsp-set-addresses $ln_port_name unknown
    ovn-nbctl lsp-set-type $ln_port_name localnet
    ovn-nbctl lsp-set-options $ln_port_name network_name=phys
done

# lsp_to_ls LSP
#
# Prints the name of the logical switch that contains LSP.
lsp_to_ls () {
    case $1 in         lp?[11]) echo ls1 ;;         lp?[12]) echo ls2 ;;         *) $as_echo "ovn.at:16498" >"$at_check_line_file"
at_fn_check_skip 99 "$at_srcdir/ovn.at:16498" ;;
    esac
}

vif_to_hv () {
    case $1 in         vif[1]?) echo hv1 ;;         vif[2]?) echo hv2 ;;         vif?[north]?) echo hv4 ;;         *) $as_echo "ovn.at:16507" >"$at_check_line_file"
at_fn_check_skip 99 "$at_srcdir/ovn.at:16507" ;;
    esac
}

ip_to_hex() {
       printf "%02x%02x%02x%02x" "$@"
}

net_add n1
for i in 1 2; do
    sim_add hv$i
    as hv$i
    ovs-vsctl add-br br-phys
    ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys
    ovs-vsctl set open . external-ids:ovn-chassis-mac-mappings="phys:aa:bb:cc:dd:ee:$i$i"
    ovn_attach n1 br-phys 192.168.0.$i

    ovs-vsctl add-port br-int vif$i$i -- \
        set Interface vif$i$i external-ids:iface-id=lp$i$i \
                              options:tx_pcap=hv$i/vif$i$i-tx.pcap \
                              options:rxq_pcap=hv$i/vif$i$i-rx.pcap \
                              ofport-request=$i$i

    lsp_name=lp$i$i
    ls_name=$(lsp_to_ls $lsp_name)

    ovn-nbctl lsp-add $ls_name $lsp_name
    ovn-nbctl lsp-set-addresses $lsp_name "f0:00:00:00:00:$i$i 192.168.$i.$i"
    ovn-nbctl lsp-set-port-security $lsp_name f0:00:00:00:00:$i$i

    ovs_wait_cond () {
    test x`ovn-nbctl lsp-get-up $lsp_name` = xup
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:16537" "until test x\`ovn-nbctl lsp-get-up \$lsp_name\` = xup"


done

ovn-nbctl ls-add ls-underlay
ovn-nbctl lsp-add ls-underlay ln3 "" 1000
ovn-nbctl lsp-set-addresses ln3 unknown
ovn-nbctl lsp-set-type ln3 localnet
ovn-nbctl lsp-set-options ln3 network_name=phys

ovn-nbctl ls-add ls-north
ovn-nbctl lsp-add ls-north ln4 "" 1000
ovn-nbctl lsp-set-addresses ln4 unknown
ovn-nbctl lsp-set-type ln4 localnet
ovn-nbctl lsp-set-options ln4 network_name=phys

# Add a VM on ls-north
ovn-nbctl lsp-add ls-north lp-north
ovn-nbctl lsp-set-addresses lp-north "f0:f0:00:00:00:11 172.31.0.10"
ovn-nbctl lsp-set-port-security lp-north f0:f0:00:00:00:11

# Add 3rd hypervisor
sim_add hv3
as hv3 ovs-vsctl add-br br-phys
as hv3 ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys
as hv3 ovs-vsctl set open . external-ids:ovn-chassis-mac-mappings="phys:aa:bb:cc:dd:ee:33"
as hv3 ovn_attach n1 br-phys 192.168.0.3

# Add 4th hypervisor
sim_add hv4
as hv4 ovs-vsctl add-br br-phys
as hv4 ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys
as hv4 ovs-vsctl set open . external-ids:ovn-chassis-mac-mappings="phys:aa:bb:cc:dd:ee:44"
as hv4 ovn_attach n1 br-phys 192.168.0.4

as hv4 ovs-vsctl add-port br-int vif-north -- \
        set Interface vif-north external-ids:iface-id=lp-north \
                              options:tx_pcap=hv4/vif-north-tx.pcap \
                              options:rxq_pcap=hv4/vif-north-rx.pcap \
                              ofport-request=44

ovn-nbctl lr-add router
ovn-nbctl lrp-add router router-to-ls1 00:00:01:01:02:03 192.168.1.3/24
ovn-nbctl lrp-add router router-to-ls2 00:00:01:01:02:05 192.168.2.3/24
ovn-nbctl lrp-add router router-to-underlay 00:00:01:01:02:07 172.31.0.1/24

ovn-nbctl lsp-add ls1 ls1-to-router -- set Logical_Switch_Port ls1-to-router type=router \
          options:router-port=router-to-ls1 -- lsp-set-addresses ls1-to-router router
ovn-nbctl lsp-add ls2 ls2-to-router -- set Logical_Switch_Port ls2-to-router type=router \
          options:router-port=router-to-ls2 -- lsp-set-addresses ls2-to-router router
ovn-nbctl lsp-add ls-underlay underlay-to-router -- set Logical_Switch_Port \
                              underlay-to-router type=router \
                              options:router-port=router-to-underlay \
                              -- lsp-set-addresses underlay-to-router router


{ set +x
$as_echo "$at_srcdir/ovn.at:16593: ovn_populate_arp__"
at_fn_check_prepare_trace "ovn.at:16593"
( $at_check_trace; ovn_populate_arp__
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16593"
$at_failed && at_fn_log_failure
$at_traceon; }


# lsp_to_ls LSP
#
# Prints the name of the logical switch that contains LSP.
lsp_to_ls () {
    case $1 in         lp?[11]) echo ls1 ;;         lp?[12]) echo ls2 ;;         *) $as_echo "ovn.at:16602" >"$at_check_line_file"
at_fn_check_skip 99 "$at_srcdir/ovn.at:16602" ;;
    esac
}

vif_to_ls () {
    case $1 in         vif?[11]) echo ls1 ;;         vif?[12]) echo ls2 ;;         vif-north) echo ls-north ;;         *) $as_echo "ovn.at:16611" >"$at_check_line_file"
at_fn_check_skip 99 "$at_srcdir/ovn.at:16611" ;;
    esac
}

hv_to_num () {
    case $1 in         hv1) echo 1 ;;         hv2) echo 2 ;;         hv3) echo 3 ;;         hv4) echo 4 ;;         *) $as_echo "ovn.at:16621" >"$at_check_line_file"
at_fn_check_skip 99 "$at_srcdir/ovn.at:16621" ;;
    esac
}

vif_to_num () {
    case $1 in         vif22) echo 22 ;;         vif21) echo 21 ;;         vif11) echo 11 ;;         *) $as_echo "ovn.at:16630" >"$at_check_line_file"
at_fn_check_skip 99 "$at_srcdir/ovn.at:16630" ;;
    esac
}

vif_to_hv () {
    case $1 in         vif[1]?) echo hv1 ;;         vif[2]?) echo hv2 ;;         vif-north) echo hv4 ;;         *) $as_echo "ovn.at:16639" >"$at_check_line_file"
at_fn_check_skip 99 "$at_srcdir/ovn.at:16639" ;;
    esac
}

vif_to_lrp () {
    echo router-to-`vif_to_ls $1`
}

ip_to_hex() {
       printf "%02x%02x%02x%02x" "$@"
}

# test_arp INPORT SHA SPA TPA [REPLY_HA]
#
# Causes a packet to be received on INPORT.  The packet is an ARP
# request with SHA, SPA, and TPA as specified.  If REPLY_HA is provided, then
# it should be the hardware address of the target to expect to receive in an
# ARP reply; otherwise no reply is expected.
#
# INPORT is an logical switch port number, e.g. 11 for vif11.
# SHA and REPLY_HA are each 12 hex digits.
# SPA and TPA are each 8 hex digits.
test_arp() {
    local inport=$1 sha=$2 spa=$3 tpa=$4 reply_ha=$5
    local request=ffffffffffff${sha}08060001080006040001${sha}${spa}ffffffffffff${tpa}
    hv=`vif_to_hv $inport`
    as $hv ovs-appctl netdev-dummy/receive $inport $request

    if test X$reply_ha = X; then
        # Expect to receive the broadcast ARP on the other logical switch ports
        # if no reply is expected.
        local i j
        for i in 1 2 3; do
            for j in 1 2 3; do
                if test $i$j != $inport; then
                    echo $request >> $i$j.expected
                fi
            done
        done
    else
        # Expect to receive the reply, if any.
        local reply=${sha}${reply_ha}08060001080006040002${reply_ha}${tpa}${sha}${spa}
        local reply_vid=${sha}${reply_ha}810003e808060001080006040002${reply_ha}${tpa}${sha}${spa}
        echo $reply_vid >> ${inport}_vid.expected
        echo $reply >> $inport.expected
    fi
}

sip=`ip_to_hex 172 31 0 10`
tip=`ip_to_hex 172 31 0 1`

# Set a hypervisor as gateway chassis, for router port 172.31.0.1
ovn-nbctl lrp-set-gateway-chassis router-to-underlay hv3
ovn-nbctl --wait=sb sync

# Dump a bunch of info helpful for debugging if there's a failure.

echo "------ OVN dump ------"
ovn-nbctl show
ovn-sbctl show
ovn-sbctl list port_binding
ovn-sbctl list mac_binding

echo "------ hv1 dump ------"
as hv1 ovs-vsctl show
as hv1 ovs-vsctl list Open_Vswitch

echo "------ hv2 dump ------"
as hv2 ovs-vsctl show
as hv2 ovs-vsctl list Open_Vswitch

echo "------ hv3 dump ------"
as hv3 ovs-vsctl show
as hv3 ovs-vsctl list Open_Vswitch

echo "------ hv4 dump ------"
as hv4 ovs-vsctl show
as hv4 ovs-vsctl list Open_Vswitch

ovs_wait_cond () {
    test x`ovn-sbctl --bare --columns chassis find port_binding  logical_port=cr-router-to-underlay | wc -l` = x1
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:16718" "until test x\`ovn-sbctl --bare --columns chassis find port_binding  logical_port=cr-router-to-underlay | wc -l\` = x1"


test_arp vif-north f0f000000011 $sip $tip 000001010207

# Confirm that vif-north gets a single ARP reply
ovn_check_packets__ () {
   echo "checking packets in hv4/vif-north-tx.pcap against vif-north.expected:"
   rcv_pcap=hv4/vif-north-tx.pcap
   exp_text=vif-north.expected
   exp_n=`wc -l < "$exp_text"`
   ovs_wait_cond () {
    $PYTHON "$top_srcdir/ovs/utilities/ovs-pcap.in" $rcv_pcap > $rcv_text
      sed -i '/ffffffffffff/d' $rcv_text
      rcv_n=`wc -l < "$rcv_text"`
      echo "rcv_n=$rcv_n exp_n=$exp_n"
      test $rcv_n -ge $exp_n
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:16723" "until \$PYTHON \"\$top_srcdir/ovs/utilities/ovs-pcap.in\" \$rcv_pcap > \$rcv_text
      sed -i '/ffffffffffff/d' \$rcv_text
      rcv_n=\`wc -l < \"\$rcv_text\"\`
      echo \"rcv_n=\$rcv_n exp_n=\$exp_n\"
      test \$rcv_n -ge \$exp_n"

   sort $exp_text > expout
 }


# Confirm that only redirect chassis allowed arp resolution.
ovn_check_packets__ () {
   echo "checking packets in hv3/br-phys_n1-tx.pcap against vif-north_vid.expected:"
   rcv_pcap=hv3/br-phys_n1-tx.pcap
   exp_text=vif-north_vid.expected
   exp_n=`wc -l < "$exp_text"`
   ovs_wait_cond () {
    $PYTHON "$top_srcdir/ovs/utilities/ovs-pcap.in" $rcv_pcap > $rcv_text
      sed -i '/ffffffffffff/d' $rcv_text
      rcv_n=`wc -l < "$rcv_text"`
      echo "rcv_n=$rcv_n exp_n=$exp_n"
      test $rcv_n -ge $exp_n
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:16726" "until \$PYTHON \"\$top_srcdir/ovs/utilities/ovs-pcap.in\" \$rcv_pcap > \$rcv_text
      sed -i '/ffffffffffff/d' \$rcv_text
      rcv_n=\`wc -l < \"\$rcv_text\"\`
      echo \"rcv_n=\$rcv_n exp_n=\$exp_n\"
      test \$rcv_n -ge \$exp_n"

   sort $exp_text > expout
 }


# Confirm that other OVN chassis did not generate ARP reply.
$PYTHON "$top_srcdir/utilities/ovs-pcap.in" hv1/br-phys_n1-tx.pcap > hv1/br-phys_n1-tx.packets
$PYTHON "$top_srcdir/utilities/ovs-pcap.in" hv2/br-phys_n1-tx.pcap > hv2/br-phys_n1-tx.packets

{ set +x
$as_echo "$at_srcdir/ovn.at:16732: grep 000001010207 hv1/br-phys_n1-tx.packets | wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:16732"
( $at_check_trace; grep 000001010207 hv1/br-phys_n1-tx.packets | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16732"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:16734: grep 000001010207 hv2/br-phys_n1-tx.packets | wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:16734"
( $at_check_trace; grep 000001010207 hv2/br-phys_n1-tx.packets | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16734"
$at_failed && at_fn_log_failure
$at_traceon; }


echo "----------- Post Traffic hv1 dump -----------"
as hv1 ovs-ofctl -O OpenFlow13 dump-flows br-int
as hv1 ovs-appctl fdb/show br-phys

echo "----------- Post Traffic hv2 dump -----------"
as hv2 ovs-ofctl -O OpenFlow13 dump-flows br-int
as hv2 ovs-appctl fdb/show br-phys

echo "----------- Post Traffic hv3 dump -----------"
as hv3 ovs-ofctl -O OpenFlow13 dump-flows br-int
as hv3 ovs-appctl fdb/show br-phys

echo "----------- Post Traffic hv4 dump -----------"
as hv4 ovs-ofctl -O OpenFlow13 dump-flows br-int
as hv4 ovs-appctl fdb/show br-phys




    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:16753: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:16753"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16753"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:16753: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:16753"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16753"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:16753" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:16753: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:16753"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16753"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:16753: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:16753"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16753"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:16753" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:16753: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:16753"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16753"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:16753: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:16753"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16753"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:16753" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:16753: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:16753"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16753"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:16753: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:16753"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16753"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:16753" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:16753: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:16753"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16753"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:16753: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:16753"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16753"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:16753" "while kill -0 \$TMPPID 2>/dev/null"





    as hv2
    if test "hv2" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:16753: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:16753"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16753"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:16753: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:16753"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16753"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:16753" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:16753: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:16753"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16753"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:16753: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:16753"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16753"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:16753" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:16753: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:16753"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16753"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:16753: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:16753"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16753"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:16753" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv2
    { set +x
$as_echo "$at_srcdir/ovn.at:16753: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:16753"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16753"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:16753: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:16753"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16753"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:16753" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:16753: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:16753"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16753"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:16753: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:16753"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16753"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:16753" "while kill -0 \$TMPPID 2>/dev/null"





    as hv3
    if test "hv3" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:16753: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:16753"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16753"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:16753: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:16753"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16753"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:16753" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:16753: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:16753"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16753"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:16753: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:16753"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16753"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:16753" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:16753: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:16753"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16753"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:16753: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:16753"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16753"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:16753" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv3
    { set +x
$as_echo "$at_srcdir/ovn.at:16753: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:16753"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16753"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:16753: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:16753"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16753"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:16753" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:16753: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:16753"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16753"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:16753: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:16753"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16753"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:16753" "while kill -0 \$TMPPID 2>/dev/null"





    as hv4
    if test "hv4" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:16753: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:16753"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16753"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:16753: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:16753"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16753"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:16753" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:16753: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:16753"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16753"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:16753: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:16753"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16753"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:16753" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:16753: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:16753"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16753"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:16753: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:16753"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16753"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:16753" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv4
    { set +x
$as_echo "$at_srcdir/ovn.at:16753: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:16753"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16753"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:16753: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:16753"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16753"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:16753" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:16753: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:16753"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16753"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:16753: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:16753"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16753"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:16753" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:16753: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:16753"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16753"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:16753: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:16753"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16753"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:16753" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:16753: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:16753"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16753"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:16753: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:16753"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16753"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:16753" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:16753: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:16753"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16753"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:16753: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:16753"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16753"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:16753" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:16753: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:16753"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16753"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:16753: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:16753"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16753"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:16753" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:16753: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:16753"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16753"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:16753: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:16753"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16753"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:16753" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:16753: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:16753"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16753"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:16753: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:16753"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16753"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:16753" "while kill -0 \$TMPPID 2>/dev/null"




ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_118
#AT_START_119
at_fn_group_banner 119 'ovn.at:16757' \
  "ovn -- 2 HVs, 2 lports/HV, localnet ports, DVR N-S Ping" "" 2
at_xfail=no
(
  $as_echo "119. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

# In this test cases we create 3 switches, all connected to same
# physical network (through br-phys on each HV). LS1 and LS2 have
# 1 VIF each. Each HV has 1 VIF port. The first digit
# of VIF port name indicates the hypervisor it is bound to, e.g.
# lp23 means VIF 3 on hv2.
#
# All the switches are connected to a logical router "router".
#
# Each switch's VLAN tag and their logical switch ports are:
#   - ls1:
#       - tagged with VLAN 101
#       - ports: lp11
#   - ls2:
#       - tagged with VLAN 201
#       - ports: lp22
#   - ls-underlay:
#       - tagged with VLAN 1000
# Note: a localnet port is created for each switch to connect to
# physical network.

for i in 1 2; do
    ls_name=ls$i
    ovn-nbctl ls-add $ls_name
    ln_port_name=ln$i
    if test $i -eq 1; then
        ovn-nbctl lsp-add $ls_name $ln_port_name "" 101
    elif test $i -eq 2; then
        ovn-nbctl lsp-add $ls_name $ln_port_name "" 201
    fi
    ovn-nbctl lsp-set-addresses $ln_port_name unknown
    ovn-nbctl lsp-set-type $ln_port_name localnet
    ovn-nbctl lsp-set-options $ln_port_name network_name=phys
done

# lsp_to_ls LSP
#
# Prints the name of the logical switch that contains LSP.
lsp_to_ls () {
    case $1 in         lp?[11]) echo ls1 ;;         lp?[12]) echo ls2 ;;         *) $as_echo "ovn.at:16801" >"$at_check_line_file"
at_fn_check_skip 99 "$at_srcdir/ovn.at:16801" ;;
    esac
}

vif_to_hv () {
    case $1 in         vif[1]?) echo hv1 ;;         vif[2]?) echo hv2 ;;         vif?[north]?) echo hv4 ;;         *) $as_echo "ovn.at:16810" >"$at_check_line_file"
at_fn_check_skip 99 "$at_srcdir/ovn.at:16810" ;;
    esac
}

ip_to_hex() {
       printf "%02x%02x%02x%02x" "$@"
}

net_add n1
for i in 1 2; do
    sim_add hv$i
    as hv$i
    ovs-vsctl add-br br-phys
    ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys
    ovs-vsctl set open . external-ids:ovn-chassis-mac-mappings="phys:aa:bb:cc:dd:ee:$i$i"
    ovn_attach n1 br-phys 192.168.0.$i

    ovs-vsctl add-port br-int vif$i$i -- \
        set Interface vif$i$i external-ids:iface-id=lp$i$i \
                              options:tx_pcap=hv$i/vif$i$i-tx.pcap \
                              options:rxq_pcap=hv$i/vif$i$i-rx.pcap \
                              ofport-request=$i$i

    lsp_name=lp$i$i
    ls_name=$(lsp_to_ls $lsp_name)

    ovn-nbctl lsp-add $ls_name $lsp_name
    ovn-nbctl lsp-set-addresses $lsp_name "f0:00:00:00:00:$i$i 192.168.$i.$i"
    ovn-nbctl lsp-set-port-security $lsp_name f0:00:00:00:00:$i$i

    ovs_wait_cond () {
    test x`ovn-nbctl lsp-get-up $lsp_name` = xup
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:16840" "until test x\`ovn-nbctl lsp-get-up \$lsp_name\` = xup"


done

ovn-nbctl ls-add ls-underlay
ovn-nbctl lsp-add ls-underlay ln3 "" 1000
ovn-nbctl lsp-set-addresses ln3 unknown
ovn-nbctl lsp-set-type ln3 localnet
ovn-nbctl lsp-set-options ln3 network_name=phys

ovn-nbctl ls-add ls-north
ovn-nbctl lsp-add ls-north ln4 "" 1000
ovn-nbctl lsp-set-addresses ln4 unknown
ovn-nbctl lsp-set-type ln4 localnet
ovn-nbctl lsp-set-options ln4 network_name=phys

# Add a VM on ls-north
ovn-nbctl lsp-add ls-north lp-north
ovn-nbctl lsp-set-addresses lp-north "f0:f0:00:00:00:11 172.31.0.10"
ovn-nbctl lsp-set-port-security lp-north f0:f0:00:00:00:11

# Add 3rd hypervisor
sim_add hv3
as hv3 ovs-vsctl add-br br-phys
as hv3 ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys
as hv3 ovs-vsctl set open . external-ids:ovn-chassis-mac-mappings="phys:aa:bb:cc:dd:ee:33"
as hv3 ovn_attach n1 br-phys 192.168.0.3

# Add 4th hypervisor
sim_add hv4
as hv4 ovs-vsctl add-br br-phys
as hv4 ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys
as hv4 ovs-vsctl set open . external-ids:ovn-chassis-mac-mappings="phys:aa:bb:cc:dd:ee:44"
as hv4 ovn_attach n1 br-phys 192.168.0.4

as hv4 ovs-vsctl add-port br-int vif-north -- \
        set Interface vif-north external-ids:iface-id=lp-north \
                              options:tx_pcap=hv4/vif-north-tx.pcap \
                              options:rxq_pcap=hv4/vif-north-rx.pcap \
                              ofport-request=44

ovn-nbctl lr-add router
ovn-nbctl lrp-add router router-to-ls1 00:00:01:01:02:03 192.168.1.3/24
ovn-nbctl lrp-add router router-to-ls2 00:00:01:01:02:05 192.168.2.3/24
ovn-nbctl lrp-add router router-to-underlay 00:00:01:01:02:07 172.31.0.1/24

ovn-nbctl lsp-add ls1 ls1-to-router -- set Logical_Switch_Port ls1-to-router type=router \
          options:router-port=router-to-ls1 -- lsp-set-addresses ls1-to-router router
ovn-nbctl lsp-add ls2 ls2-to-router -- set Logical_Switch_Port ls2-to-router type=router \
          options:router-port=router-to-ls2 -- lsp-set-addresses ls2-to-router router
ovn-nbctl lsp-add ls-underlay underlay-to-router -- set Logical_Switch_Port \
                              underlay-to-router type=router \
                              options:router-port=router-to-underlay \
                              -- lsp-set-addresses underlay-to-router router

ovn-nbctl lrp-set-gateway-chassis router-to-underlay hv3
ovn-nbctl lrp-set-redirect-type router-to-underlay bridged

ovn-nbctl --wait=sb sync


{ set +x
$as_echo "$at_srcdir/ovn.at:16901: ovn_populate_arp__"
at_fn_check_prepare_trace "ovn.at:16901"
( $at_check_trace; ovn_populate_arp__
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:16901"
$at_failed && at_fn_log_failure
$at_traceon; }


# lsp_to_ls LSP
#
# Prints the name of the logical switch that contains LSP.
lsp_to_ls () {
    case $1 in         lp?[11]) echo ls1 ;;         lp?[12]) echo ls2 ;;         *) $as_echo "ovn.at:16910" >"$at_check_line_file"
at_fn_check_skip 99 "$at_srcdir/ovn.at:16910" ;;
    esac
}

vif_to_ls () {
    case $1 in         vif?[11]) echo ls1 ;;         vif?[12]) echo ls2 ;;         vif-north) echo ls-north ;;         *) $as_echo "ovn.at:16919" >"$at_check_line_file"
at_fn_check_skip 99 "$at_srcdir/ovn.at:16919" ;;
    esac
}

hv_to_num () {
    case $1 in         hv1) echo 1 ;;         hv2) echo 2 ;;         hv3) echo 3 ;;         hv4) echo 4 ;;         *) $as_echo "ovn.at:16929" >"$at_check_line_file"
at_fn_check_skip 99 "$at_srcdir/ovn.at:16929" ;;
    esac
}

vif_to_num () {
    case $1 in         vif22) echo 22 ;;         vif21) echo 21 ;;         vif11) echo 11 ;;         *) $as_echo "ovn.at:16938" >"$at_check_line_file"
at_fn_check_skip 99 "$at_srcdir/ovn.at:16938" ;;
    esac
}

vif_to_hv () {
    case $1 in         vif[1]?) echo hv1 ;;         vif[2]?) echo hv2 ;;         vif-north) echo hv4 ;;         *) $as_echo "ovn.at:16947" >"$at_check_line_file"
at_fn_check_skip 99 "$at_srcdir/ovn.at:16947" ;;
    esac
}

vif_to_lrp () {
    echo router-to-`vif_to_ls $1`
}

ip_to_hex() {
       printf "%02x%02x%02x%02x" "$@"
}


test_ip() {
        # This packet has bad checksums but logical L3 routing doesn't check.
        local inport=$1 src_mac=$2 dst_mac=$3 src_ip=$4 dst_ip=$5 outport=$6
        local packet=${dst_mac}${src_mac}08004500001c0000000040110000${src_ip}${dst_ip}0035111100080000
        shift; shift; shift; shift; shift
        hv=`vif_to_hv $inport`
        as $hv ovs-appctl netdev-dummy/receive $inport $packet
        in_ls=`vif_to_ls $inport`
        for outport; do
            out_ls=`vif_to_ls $outport`
            if test $in_ls = $out_ls; then
                # Ports on the same logical switch receive exactly the same packet.
                echo $packet
            else
                # Routing decrements TTL and updates source and dest MAC
                # (and checksum).
                out_lrp=`vif_to_lrp $outport`
                # For North-South, packet will come via gateway chassis, i.e hv3
                if test $inport = vif-north; then
                    echo f0000000001100000101020308004500001c000000003f110100${src_ip}${dst_ip}0035111100080000 >> $outport.expected
                fi
                if test $outport = vif-north; then
                    echo f0f00000001100000101020708004500001c000000003e110200${src_ip}${dst_ip}0035111100080000 >> $outport.expected
                fi
            fi >> $outport.expected
        done
}

# Dump a bunch of info helpful for debugging if there's a failure.

echo "------ OVN dump ------"
ovn-nbctl show
ovn-sbctl show
ovn-sbctl list port_binding
ovn-sbctl list mac_binding

echo "------ hv1 dump ------"
as hv1 ovs-vsctl show
as hv1 ovs-vsctl list Open_Vswitch

echo "------ hv2 dump ------"
as hv2 ovs-vsctl show
as hv2 ovs-vsctl list Open_Vswitch

echo "------ hv3 dump ------"
as hv3 ovs-vsctl show
as hv3 ovs-vsctl list Open_Vswitch

echo "------ hv4 dump ------"
as hv4 ovs-vsctl show
as hv4 ovs-vsctl list Open_Vswitch

echo "Send traffic North to South"

sip=`ip_to_hex 172 31 0 10`
dip=`ip_to_hex 192 168 1 1`
test_ip vif-north f0f000000011 000001010207 $sip $dip vif11

# Confirm that North to south traffic works fine.
ovn_check_packets__ "hv1/vif11-tx.pcap" "vif11.expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:17019: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:17019"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17019"
$at_failed && at_fn_log_failure
$at_traceon; }


echo "Send traffic South to Nouth"
sip=`ip_to_hex 192 168 1 1`
dip=`ip_to_hex 172 31 0 10`
test_ip vif11 f00000000011 000001010203 $sip $dip vif-north

# Confirm that South to North traffic works fine.
ovn_check_packets__ () {
   echo "checking packets in hv4/vif-north-tx.pcap against vif-north.expected:"
   rcv_pcap=hv4/vif-north-tx.pcap
   exp_text=vif-north.expected
   exp_n=`wc -l < "$exp_text"`
   ovs_wait_cond () {
    $PYTHON "$top_srcdir/ovs/utilities/ovs-pcap.in" $rcv_pcap > $rcv_text
      sed -i '/ffffffffffff/d' $rcv_text
      rcv_n=`wc -l < "$rcv_text"`
      echo "rcv_n=$rcv_n exp_n=$exp_n"
      test $rcv_n -ge $exp_n
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17027" "until \$PYTHON \"\$top_srcdir/ovs/utilities/ovs-pcap.in\" \$rcv_pcap > \$rcv_text
      sed -i '/ffffffffffff/d' \$rcv_text
      rcv_n=\`wc -l < \"\$rcv_text\"\`
      echo \"rcv_n=\$rcv_n exp_n=\$exp_n\"
      test \$rcv_n -ge \$exp_n"

   sort $exp_text > expout
 }


# Confirm that packets did not go out via tunnel port.
{ set +x
$as_echo "$at_srcdir/ovn.at:17030: as hv1 ovs-ofctl dump-flows br-int | grep table=32 | grep NXM_NX_TUN_METADATA0 | grep n_packets=0 | wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:17030"
( $at_check_trace; as hv1 ovs-ofctl dump-flows br-int | grep table=32 | grep NXM_NX_TUN_METADATA0 | grep n_packets=0 | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17030"
$at_failed && at_fn_log_failure
$at_traceon; }


# Confirm that packet went out via localnet port
{ set +x
$as_echo "$at_srcdir/ovn.at:17034: as hv1 ovs-ofctl dump-flows br-int | grep table=65 | grep priority=150 | grep src=00:00:01:01:02:07 | grep n_packets=1 | wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:17034"
( $at_check_trace; as hv1 ovs-ofctl dump-flows br-int | grep table=65 | grep priority=150 | grep src=00:00:01:01:02:07 | grep n_packets=1 | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17034"
$at_failed && at_fn_log_failure
$at_traceon; }


echo "----------- Post Traffic hv1 dump -----------"
as hv1 ovs-ofctl dump-flows br-int
as hv1 ovs-ofctl show br-phys
as hv1 ovs-appctl fdb/show br-phys

echo "----------- Post Traffic hv2 dump -----------"
as hv2 ovs-ofctl dump-flows br-int
as hv2 ovs-ofctl show br-phys
as hv2 ovs-appctl fdb/show br-phys

echo "----------- Post Traffic hv3 dump -----------"
as hv3 ovs-ofctl dump-flows br-int
as hv3 ovs-ofctl show br-phys
as hv3 ovs-appctl fdb/show br-phys

echo "----------- Post Traffic hv4 dump -----------"
as hv4 ovs-ofctl dump-flows br-int
as hv4 ovs-ofctl show br-phys
as hv4 ovs-appctl fdb/show br-phys




    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:17057: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:17057"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17057"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17057: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:17057"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17057"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17057" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:17057: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:17057"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17057"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17057: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:17057"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17057"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17057" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:17057: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:17057"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17057"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17057: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:17057"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17057"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17057" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:17057: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:17057"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17057"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17057: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:17057"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17057"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17057" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:17057: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:17057"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17057"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17057: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:17057"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17057"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17057" "while kill -0 \$TMPPID 2>/dev/null"





    as hv2
    if test "hv2" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:17057: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:17057"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17057"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17057: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:17057"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17057"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17057" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:17057: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:17057"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17057"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17057: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:17057"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17057"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17057" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:17057: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:17057"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17057"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17057: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:17057"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17057"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17057" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv2
    { set +x
$as_echo "$at_srcdir/ovn.at:17057: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:17057"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17057"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17057: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:17057"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17057"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17057" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:17057: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:17057"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17057"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17057: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:17057"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17057"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17057" "while kill -0 \$TMPPID 2>/dev/null"





    as hv3
    if test "hv3" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:17057: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:17057"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17057"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17057: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:17057"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17057"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17057" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:17057: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:17057"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17057"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17057: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:17057"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17057"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17057" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:17057: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:17057"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17057"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17057: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:17057"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17057"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17057" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv3
    { set +x
$as_echo "$at_srcdir/ovn.at:17057: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:17057"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17057"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17057: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:17057"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17057"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17057" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:17057: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:17057"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17057"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17057: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:17057"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17057"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17057" "while kill -0 \$TMPPID 2>/dev/null"





    as hv4
    if test "hv4" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:17057: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:17057"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17057"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17057: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:17057"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17057"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17057" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:17057: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:17057"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17057"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17057: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:17057"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17057"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17057" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:17057: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:17057"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17057"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17057: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:17057"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17057"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17057" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv4
    { set +x
$as_echo "$at_srcdir/ovn.at:17057: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:17057"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17057"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17057: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:17057"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17057"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17057" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:17057: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:17057"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17057"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17057: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:17057"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17057"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17057" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:17057: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:17057"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17057"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17057: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:17057"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17057"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17057" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:17057: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:17057"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17057"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17057: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:17057"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17057"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17057" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:17057: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:17057"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17057"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17057: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:17057"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17057"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17057" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:17057: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:17057"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17057"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17057: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:17057"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17057"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17057" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:17057: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:17057"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17057"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17057: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:17057"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17057"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17057" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:17057: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:17057"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17057"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17057: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:17057"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17057"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17057" "while kill -0 \$TMPPID 2>/dev/null"




ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_119
#AT_START_120
at_fn_group_banner 120 'ovn.at:17061' \
  "ovn -- ARP lookup before learning" "              " 2
at_xfail=no
(
  $as_echo "120. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init


ovn_start

send_garp() {
    local hv=$1 inport=$2 eth_src=$3 eth_dst=$4 spa=$5 tpa=$6
    local request=${eth_dst}${eth_src}08060001080006040001${eth_src}${spa}${eth_dst}${tpa}
    as hv$hv ovs-appctl netdev-dummy/receive hv${hv}-vif$inport $request
}

send_arp_reply() {
    local hv=$1 inport=$2 eth_src=$3 eth_dst=$4 spa=$5 tpa=$6
    local request=${eth_dst}${eth_src}08060001080006040002${eth_src}${spa}${eth_dst}${tpa}
    as hv$hv ovs-appctl netdev-dummy/receive hv${hv}-vif$inport $request
}

net_add n1

sim_add hv1
as hv1
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.1
ovs-vsctl -- add-port br-int hv1-vif1 -- \
    set interface hv1-vif1 external-ids:iface-id=sw0-p1 \
    options:tx_pcap=hv1/vif1-tx.pcap \
    options:rxq_pcap=hv1/vif1-rx.pcap \
    ofport-request=1
ovs-vsctl -- add-port br-int hv1-vif2 -- \
    set interface hv1-vif2 external-ids:iface-id=sw0-p3 \
    options:tx_pcap=hv1/vif2-tx.pcap \
    options:rxq_pcap=hv1/vif2-rx.pcap \
    ofport-request=2

sim_add hv2
as hv2
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.2
ovs-vsctl -- add-port br-int hv2-vif1 -- \
    set interface hv2-vif1 external-ids:iface-id=sw1-p1 \
    options:tx_pcap=hv2/vif1-tx.pcap \
    options:rxq_pcap=hv2/vif1-rx.pcap \
    ofport-request=1

ovn-nbctl ls-add sw0

ovn-nbctl lsp-add sw0 sw0-p1
ovn-nbctl lsp-set-addresses sw0-p1 "50:54:00:00:00:03"

# Create the second logical switch with one port
ovn-nbctl ls-add sw1
ovn-nbctl lsp-add sw1 sw1-p1
ovn-nbctl lsp-set-addresses sw1-p1 "40:54:00:00:00:03 20.0.0.3"
ovn-nbctl lsp-set-port-security sw1-p1 "40:54:00:00:00:03 20.0.0.3"

# Create a logical router and attach both logical switches
ovn-nbctl lr-add lr0
ovn-nbctl lrp-add lr0 lr0-sw0 00:00:00:00:ff:01 10.0.0.1/24
ovn-nbctl lsp-add sw0 sw0-lr0
ovn-nbctl lsp-set-type sw0-lr0 router
ovn-nbctl lsp-set-addresses sw0-lr0 00:00:00:00:ff:01
ovn-nbctl lsp-set-options sw0-lr0 router-port=lr0-sw0

ovn-nbctl lrp-add lr0 lr0-sw1 00:00:00:00:ff:02 20.0.0.1/24
ovn-nbctl lsp-add sw1 sw1-lr0
ovn-nbctl lsp-set-type sw1-lr0 router
ovn-nbctl lsp-set-addresses sw1-lr0 00:00:00:00:ff:02
ovn-nbctl lsp-set-options sw1-lr0 router-port=lr0-sw1

{ set +x
$as_echo "$at_srcdir/ovn.at:17129: ovn_populate_arp__"
at_fn_check_prepare_trace "ovn.at:17129"
( $at_check_trace; ovn_populate_arp__
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17129"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn-nbctl --wait=hv sync

as hv1 ovs-appctl -t ovn-controller vlog/set dbg

ip_to_hex() {
    printf "%02x%02x%02x%02x" "$@"
}

# From sw0-p1 send GARP for 10.0.0.30.
# ovn-controller should learn the
#   mac_binding entry
#     port - lr0-sw0
#     ip - 10.0.0.30
#     mac - 50:54:00:00:00:03

{ set +x
$as_echo "$at_srcdir/ovn.at:17145: test 0 = \`ovn-sbctl list mac_binding | wc -l\`"
at_fn_check_prepare_notrace 'a `...` command substitution' "ovn.at:17145"
( $at_check_trace; test 0 = `ovn-sbctl list mac_binding | wc -l`
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17145"
$at_failed && at_fn_log_failure
$at_traceon; }

eth_src=505400000003
eth_dst=ffffffffffff
spa=$(ip_to_hex 10 0 0 30)
tpa=$(ip_to_hex 10 0 0 30)
send_garp 1 1 $eth_src $eth_dst $spa $tpa

ovs_wait_cond () {
    test 1 = `ovn-sbctl --bare --columns _uuid list mac_binding | wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17152" "until test 1 = \`ovn-sbctl --bare --columns _uuid list mac_binding | wc -l\`"


{ set +x
$as_echo "$at_srcdir/ovn.at:17154: ovn-sbctl --format=csv --bare --columns logical_port,ip,mac \\
list mac_binding"
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:17154"
( $at_check_trace; ovn-sbctl --format=csv --bare --columns logical_port,ip,mac \
list mac_binding
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "lr0-sw0
10.0.0.30
50:54:00:00:00:03
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17154"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn.at:17160: test 1 = \`cat hv1/ovn-controller.log | grep NXT_PACKET_IN2 | wc -l\`"
at_fn_check_prepare_notrace 'a `...` command substitution' "ovn.at:17160"
( $at_check_trace; test 1 = `cat hv1/ovn-controller.log | grep NXT_PACKET_IN2 | wc -l`
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17160"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:17161: test 1 = \`as hv1 ovs-ofctl dump-flows br-int table=10 | grep arp | \\
grep controller | grep -v n_packets=0 | wc -l\`"
at_fn_check_prepare_notrace 'a `...` command substitution' "ovn.at:17161"
( $at_check_trace; test 1 = `as hv1 ovs-ofctl dump-flows br-int table=10 | grep arp | \
grep controller | grep -v n_packets=0 | wc -l`
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17161"
$at_failed && at_fn_log_failure
$at_traceon; }


# Wait for an entry in table=67
ovs_wait_cond () {
    test 1 = `as hv1 ovs-ofctl dump-flows br-int table=67 | grep n_packets=0 \
| wc -l`

}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17165" "until test 1 = \`as hv1 ovs-ofctl dump-flows br-int table=67 | grep n_packets=0 \\
| wc -l\`
"


# Send garp again. This time the packet should not be sent to ovn-controller.
send_garp 1 1 $eth_src $eth_dst $spa $tpa
# Wait for an entry in table=67
ovs_wait_cond () {
    test 1 = `as hv1 ovs-ofctl dump-flows br-int table=67 | grep n_packets=1 | wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17173" "until test 1 = \`as hv1 ovs-ofctl dump-flows br-int table=67 | grep n_packets=1 | wc -l\`"


# The packet should not be sent to ovn-controller. The packet
count should be 1 only.
{ set +x
$as_echo "$at_srcdir/ovn.at:17177: test 1 = \`cat hv1/ovn-controller.log | grep NXT_PACKET_IN2 | wc -l\`"
at_fn_check_prepare_notrace 'a `...` command substitution' "ovn.at:17177"
( $at_check_trace; test 1 = `cat hv1/ovn-controller.log | grep NXT_PACKET_IN2 | wc -l`
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17177"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn.at:17178: test 1 = \`as hv1 ovs-ofctl dump-flows br-int table=10 | grep arp | \\
grep controller | grep -v n_packets=0 | wc -l\`"
at_fn_check_prepare_notrace 'a `...` command substitution' "ovn.at:17178"
( $at_check_trace; test 1 = `as hv1 ovs-ofctl dump-flows br-int table=10 | grep arp | \
grep controller | grep -v n_packets=0 | wc -l`
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17178"
$at_failed && at_fn_log_failure
$at_traceon; }


# Now send garp packet with different mac.
eth_src=505400000013
eth_dst=ffffffffffff
spa=$(ip_to_hex 10 0 0 30)
tpa=$(ip_to_hex 10 0 0 30)
send_garp 1 1 $eth_src $eth_dst $spa $tpa

# The garp packet should be sent to ovn-controller and the mac_binding entry
# should be updated.
ovs_wait_cond () {
    test 2 = `cat hv1/ovn-controller.log | grep NXT_PACKET_IN2 | wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17190" "until test 2 = \`cat hv1/ovn-controller.log | grep NXT_PACKET_IN2 | wc -l\`"


{ set +x
$as_echo "$at_srcdir/ovn.at:17192: test 1 = \`ovn-sbctl --bare --columns _uuid list mac_binding | wc -l\`"
at_fn_check_prepare_notrace 'a `...` command substitution' "ovn.at:17192"
( $at_check_trace; test 1 = `ovn-sbctl --bare --columns _uuid list mac_binding | wc -l`
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17192"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn.at:17194: ovn-sbctl --format=csv --bare --columns logical_port,ip,mac \\
list mac_binding"
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:17194"
( $at_check_trace; ovn-sbctl --format=csv --bare --columns logical_port,ip,mac \
list mac_binding
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "lr0-sw0
10.0.0.30
50:54:00:00:00:13
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17194"
$at_failed && at_fn_log_failure
$at_traceon; }


# Send ARP request to lrp - lr0-sw1 (20.0.0.1) using src mac 50:54:00:00:00:33
# and src ip - 10.0.0.50.from sw0-p1.
# ovn-controller should add the mac_binding entry
#   logical_port - lr0
#   IP           - 10.0.0.50
#   MAC          - 50:54:00:00:00:33
eth_src=505400000033
eth_dst=ffffffffffff
spa=$(ip_to_hex 10 0 0 50)
tpa=$(ip_to_hex 20 0 0 1)

send_garp 1 1 $eth_src $eth_dst $spa $tpa

# The garp packet should be sent to ovn-controller and the mac_binding entry
# should be updated.
ovs_wait_cond () {
    test 3 = `cat hv1/ovn-controller.log | grep NXT_PACKET_IN2 | wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17215" "until test 3 = \`cat hv1/ovn-controller.log | grep NXT_PACKET_IN2 | wc -l\`"


ovs_wait_cond () {
    test 1 = `as hv1 ovs-ofctl dump-flows br-int table=67 | grep dl_src=50:54:00:00:00:33 \
| wc -l`

}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17217" "until test 1 = \`as hv1 ovs-ofctl dump-flows br-int table=67 | grep dl_src=50:54:00:00:00:33 \\
| wc -l\`
"


{ set +x
$as_echo "$at_srcdir/ovn.at:17222: ovn-sbctl --format=csv --bare --columns logical_port,ip,mac \\
find mac_binding ip=10.0.0.50"
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:17222"
( $at_check_trace; ovn-sbctl --format=csv --bare --columns logical_port,ip,mac \
find mac_binding ip=10.0.0.50
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "lr0-sw0
10.0.0.50
50:54:00:00:00:33
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17222"
$at_failed && at_fn_log_failure
$at_traceon; }


# Send the same packet again.
send_garp 1 1 $eth_src $eth_dst $spa $tpa

ovs_wait_cond () {
    test 1 = `as hv1 ovs-ofctl dump-flows br-int table=67 | grep dl_src=50:54:00:00:00:33 \
| grep n_packets=1 | wc -l`

}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17231" "until test 1 = \`as hv1 ovs-ofctl dump-flows br-int table=67 | grep dl_src=50:54:00:00:00:33 \\
| grep n_packets=1 | wc -l\`
"


{ set +x
$as_echo "$at_srcdir/ovn.at:17236: test 3 = \`cat hv1/ovn-controller.log | grep NXT_PACKET_IN2 | wc -l\`"
at_fn_check_prepare_notrace 'a `...` command substitution' "ovn.at:17236"
( $at_check_trace; test 3 = `cat hv1/ovn-controller.log | grep NXT_PACKET_IN2 | wc -l`
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17236"
$at_failed && at_fn_log_failure
$at_traceon; }


# Now send ARP reply packet with IP - 10.0.0.40 and mac 505400000023
eth_src=505400000023
eth_dst=ffffffffffff
spa=$(ip_to_hex 10 0 0 40)
tpa=$(ip_to_hex 10 0 0 50)
send_arp_reply 1 1 $eth_src $eth_dst $spa $tpa

# ovn-controller should add the
#   mac_binding entry
#     port - lr0-sw0
#     ip - 10.0.0.40
#     mac - 50:54:00:00:00:23

# The garp packet should be sent to ovn-controller and the mac_binding entry
# should be updated.
ovs_wait_cond () {
    test 4 = `cat hv1/ovn-controller.log | grep NXT_PACKET_IN2 | wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17253" "until test 4 = \`cat hv1/ovn-controller.log | grep NXT_PACKET_IN2 | wc -l\`"


# Wait for an entry in table=67 for the learnt mac_binding entry.

ovs_wait_cond () {
    test 1 = `as hv1 ovs-ofctl dump-flows br-int table=67 | grep dl_src=50:54:00:00:00:23 \
| wc -l`

}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17257" "until test 1 = \`as hv1 ovs-ofctl dump-flows br-int table=67 | grep dl_src=50:54:00:00:00:23 \\
| wc -l\`
"


# Send the same garp reply. This time it should not be sent to ovn-controller.
send_arp_reply 1 1 $eth_src $eth_dst $spa $tpa
ovs_wait_cond () {
    test 1 = `as hv1 ovs-ofctl dump-flows br-int table=67 | grep dl_src=50:54:00:00:00:23 \
| grep n_packets=1 | wc -l`

}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17264" "until test 1 = \`as hv1 ovs-ofctl dump-flows br-int table=67 | grep dl_src=50:54:00:00:00:23 \\
| grep n_packets=1 | wc -l\`
"


{ set +x
$as_echo "$at_srcdir/ovn.at:17269: test 4 = \`cat hv1/ovn-controller.log | grep NXT_PACKET_IN2 | wc -l\`"
at_fn_check_prepare_notrace 'a `...` command substitution' "ovn.at:17269"
( $at_check_trace; test 4 = `cat hv1/ovn-controller.log | grep NXT_PACKET_IN2 | wc -l`
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17269"
$at_failed && at_fn_log_failure
$at_traceon; }


send_arp_reply 1 1 $eth_src $eth_dst $spa $tpa
ovs_wait_cond () {
    test 1 = `as hv1 ovs-ofctl dump-flows br-int table=67 | grep dl_src=50:54:00:00:00:23 \
| grep n_packets=2 | wc -l`

}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17272" "until test 1 = \`as hv1 ovs-ofctl dump-flows br-int table=67 | grep dl_src=50:54:00:00:00:23 \\
| grep n_packets=2 | wc -l\`
"


{ set +x
$as_echo "$at_srcdir/ovn.at:17277: test 4 = \`cat hv1/ovn-controller.log | grep NXT_PACKET_IN2 | wc -l\`"
at_fn_check_prepare_notrace 'a `...` command substitution' "ovn.at:17277"
( $at_check_trace; test 4 = `cat hv1/ovn-controller.log | grep NXT_PACKET_IN2 | wc -l`
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17277"
$at_failed && at_fn_log_failure
$at_traceon; }





    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:17279: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:17279"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17279"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17279: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:17279"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17279"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17279" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:17279: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:17279"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17279"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17279: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:17279"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17279"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17279" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:17279: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:17279"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17279"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17279: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:17279"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17279"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17279" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:17279: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:17279"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17279"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17279: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:17279"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17279"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17279" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:17279: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:17279"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17279"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17279: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:17279"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17279"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17279" "while kill -0 \$TMPPID 2>/dev/null"





    as hv2
    if test "hv2" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:17279: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:17279"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17279"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17279: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:17279"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17279"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17279" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:17279: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:17279"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17279"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17279: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:17279"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17279"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17279" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:17279: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:17279"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17279"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17279: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:17279"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17279"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17279" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv2
    { set +x
$as_echo "$at_srcdir/ovn.at:17279: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:17279"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17279"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17279: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:17279"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17279"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17279" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:17279: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:17279"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17279"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17279: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:17279"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17279"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17279" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:17279: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:17279"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17279"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17279: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:17279"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17279"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17279" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:17279: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:17279"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17279"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17279: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:17279"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17279"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17279" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:17279: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:17279"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17279"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17279: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:17279"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17279"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17279" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:17279: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:17279"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17279"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17279: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:17279"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17279"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17279" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:17279: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:17279"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17279"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17279: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:17279"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17279"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17279" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:17279: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:17279"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17279"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17279: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:17279"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17279"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17279" "while kill -0 \$TMPPID 2>/dev/null"



ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_120
#AT_START_121
at_fn_group_banner 121 'ovn.at:17282' \
  "ovn -- 1 HVs, 1 lport/HV, localnet ports, RARP" " " 2
at_xfail=no
(
  $as_echo "121. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

# In this test case we create 1 switch and bring up a VIF on it.
# Logical switch will have a localnet port also.
# This VIF will be assigned a MAC address only (i.e. no ip).

ovn-nbctl ls-add ls1
ovn-nbctl lsp-add ls1 ln1 "" 101
ovn-nbctl lsp-set-addresses ln1 unknown
ovn-nbctl lsp-set-type ln1 localnet
ovn-nbctl lsp-set-options ln1 network_name=phys

ip_to_hex() {
       printf "%02x%02x%02x%02x" "$@"
}

net_add n1

sim_add hv1
as hv1
ovs-vsctl add-br br-phys
ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys
ovn_attach n1 br-phys 192.168.0.1

ovs-vsctl add-port br-int vif11 -- \
    set Interface vif11 external-ids:iface-id=lp11 \
                          options:tx_pcap=hv1/vif11-tx.pcap \
                          options:rxq_pcap=hv1/vif11-rx.pcap \
                          ofport-request=11

lsp_name=lp11

ovn-nbctl lsp-add ls1 lp11
ovn-nbctl lsp-set-addresses lp11 "f0:00:00:00:00:11"
ovn-nbctl lsp-set-port-security lp11 f0:00:00:00:00:11

ovs_wait_cond () {
    test x`ovn-nbctl lsp-get-up lp11` = xup
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17319" "until test x\`ovn-nbctl lsp-get-up lp11\` = xup"


ovn-nbctl --wait=sb sync

ovn-nbctl show
ovn-sbctl show

# Dump a bunch of info helpful for debugging if there's a failure.

echo "------ OVN dump ------"
ovn-nbctl show
ovn-sbctl show

echo "------ hv1 dump ------"
as hv1 ovs-vsctl show
as hv1 ovs-vsctl list Open_Vswitch

echo "----------- Post Traffic hv1 dump -----------"
as hv1 ovs-ofctl -O OpenFlow13 dump-flows br-int
as hv1 ovs-appctl fdb/show br-phys

ovs_wait_cond () {
    test 1 = `ovs-appctl fdb/show br-phys | grep f0:00:00:00:00:11 | \
grep 101 | wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17340" "until test 1 = \`ovs-appctl fdb/show br-phys | grep f0:00:00:00:00:11 | \\
grep 101 | wc -l\`"





    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:17344: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:17344"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17344"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17344: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:17344"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17344"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17344" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:17344: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:17344"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17344"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17344: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:17344"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17344"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17344" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:17344: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:17344"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17344"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17344: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:17344"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17344"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17344" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:17344: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:17344"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17344"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17344: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:17344"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17344"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17344" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:17344: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:17344"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17344"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17344: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:17344"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17344"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17344" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:17344: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:17344"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17344"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17344: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:17344"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17344"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17344" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:17344: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:17344"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17344"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17344: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:17344"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17344"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17344" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:17344: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:17344"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17344"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17344: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:17344"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17344"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17344" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:17344: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:17344"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17344"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17344: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:17344"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17344"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17344" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:17344: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:17344"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17344"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17344: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:17344"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17344"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17344" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:17344: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:17344"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17344"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17344: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:17344"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17344"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17344" "while kill -0 \$TMPPID 2>/dev/null"




ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_121
#AT_START_122
at_fn_group_banner 122 'ovn.at:17348' \
  "ovn -- Stateless Floating IP" "                   " 2
at_xfail=no
(
  $as_echo "122. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

# In this test cases we create 3 switches, all connected to same
# physical network (through br-phys on each HV). LS1 and LS2 have
# 1 VIF each. Each HV has 1 VIF port. The first digit
# of VIF port name indicates the hypervisor it is bound to, e.g.
# lp23 means VIF 3 on hv2.
#
# All the switches are connected to a logical router "router".
#
# There is an external logical switch, ls-north.
# This test validates the stateless floating ip implementation.
#
# Each switch's VLAN tag and their logical switch ports are:
#   - ls1:
#       - tagged with VLAN 101
#       - ports: lp11
#   - ls2:
#       - tagged with VLAN 201
#       - ports: lp22
#   - ls-north:
#       - tagged with VLAN 1000
# Note: a localnet port is created for each switch to connect to
# physical network.

for i in 1 2; do
    ls_name=ls$i
    ovn-nbctl ls-add $ls_name
    ln_port_name=ln$i
    if test $i -eq 1; then
        ovn-nbctl lsp-add $ls_name $ln_port_name "" 101
    elif test $i -eq 2; then
        ovn-nbctl lsp-add $ls_name $ln_port_name "" 201
    fi
    ovn-nbctl lsp-set-addresses $ln_port_name unknown
    ovn-nbctl lsp-set-type $ln_port_name localnet
    ovn-nbctl lsp-set-options $ln_port_name network_name=phys
done

# lsp_to_ls LSP
#
# Prints the name of the logical switch that contains LSP.
lsp_to_ls () {
    case $1 in         lp?[11]) echo ls1 ;;         lp?[12]) echo ls2 ;;         *) $as_echo "ovn.at:17395" >"$at_check_line_file"
at_fn_check_skip 99 "$at_srcdir/ovn.at:17395" ;;
    esac
}

vif_to_hv () {
    case $1 in         vif[1]?) echo hv1 ;;         vif[2]?) echo hv2 ;;         vif?[north]?) echo hv4 ;;         *) $as_echo "ovn.at:17404" >"$at_check_line_file"
at_fn_check_skip 99 "$at_srcdir/ovn.at:17404" ;;
    esac
}

ip_to_hex() {
       printf "%02x%02x%02x%02x" "$@"
}

net_add n1
for i in 1 2; do
    sim_add hv$i
    as hv$i
    ovs-vsctl add-br br-phys
    ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys
    ovs-vsctl set open . external-ids:ovn-chassis-mac-mappings="phys:aa:bb:cc:dd:ee:$i$i"
    ovn_attach n1 br-phys 192.168.0.$i

    ovs-vsctl add-port br-int vif$i$i -- \
        set Interface vif$i$i external-ids:iface-id=lp$i$i \
                              options:tx_pcap=hv$i/vif$i$i-tx.pcap \
                              options:rxq_pcap=hv$i/vif$i$i-rx.pcap \
                              ofport-request=$i$i

    lsp_name=lp$i$i
    ls_name=$(lsp_to_ls $lsp_name)

    ovn-nbctl lsp-add $ls_name $lsp_name
    ovn-nbctl lsp-set-addresses $lsp_name "f0:00:00:00:00:$i$i 192.168.$i.$i"
    ovn-nbctl lsp-set-port-security $lsp_name f0:00:00:00:00:$i$i

    ovs_wait_cond () {
    test x`ovn-nbctl lsp-get-up $lsp_name` = xup
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17434" "until test x\`ovn-nbctl lsp-get-up \$lsp_name\` = xup"


done

ovn-nbctl ls-add ls-underlay
ovn-nbctl lsp-add ls-underlay ln3 "" 1000
ovn-nbctl lsp-set-addresses ln3 unknown
ovn-nbctl lsp-set-type ln3 localnet
ovn-nbctl lsp-set-options ln3 network_name=phys

ovn-nbctl ls-add ls-north
ovn-nbctl lsp-add ls-north ln4 "" 1000
ovn-nbctl lsp-set-addresses ln4 unknown
ovn-nbctl lsp-set-type ln4 localnet
ovn-nbctl lsp-set-options ln4 network_name=phys

# Add a VM on ls-north
ovn-nbctl lsp-add ls-north lp-north
ovn-nbctl lsp-set-addresses lp-north "f0:f0:00:00:00:11 172.31.0.10"
ovn-nbctl lsp-set-port-security lp-north f0:f0:00:00:00:11

# Add 3rd hypervisor
sim_add hv3
as hv3 ovs-vsctl add-br br-phys
as hv3 ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys
as hv3 ovs-vsctl set open . external-ids:ovn-chassis-mac-mappings="phys:aa:bb:cc:dd:ee:33"
as hv3 ovn_attach n1 br-phys 192.168.0.3

# Add 4th hypervisor
sim_add hv4
as hv4 ovs-vsctl add-br br-phys
as hv4 ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys
as hv4 ovs-vsctl set open . external-ids:ovn-chassis-mac-mappings="phys:aa:bb:cc:dd:ee:44"
as hv4 ovn_attach n1 br-phys 192.168.0.4

as hv4 ovs-vsctl add-port br-int vif-north -- \
        set Interface vif-north external-ids:iface-id=lp-north \
                              options:tx_pcap=hv4/vif-north-tx.pcap \
                              options:rxq_pcap=hv4/vif-north-rx.pcap \
                              ofport-request=44

ovn-nbctl lr-add router
ovn-nbctl lrp-add router router-to-ls1 00:00:01:01:02:03 192.168.1.3/24
ovn-nbctl lrp-add router router-to-ls2 00:00:01:01:02:05 192.168.2.3/24
ovn-nbctl lrp-add router router-to-underlay 00:00:01:01:02:07 172.31.0.1/24

ovn-nbctl lsp-add ls1 ls1-to-router -- set Logical_Switch_Port ls1-to-router type=router \
          options:router-port=router-to-ls1 -- lsp-set-addresses ls1-to-router router
ovn-nbctl lsp-add ls2 ls2-to-router -- set Logical_Switch_Port ls2-to-router type=router \
          options:router-port=router-to-ls2 -- lsp-set-addresses ls2-to-router router
ovn-nbctl lsp-add ls-underlay underlay-to-router -- set Logical_Switch_Port \
                              underlay-to-router type=router \
                              options:router-port=router-to-underlay \
                              -- lsp-set-addresses underlay-to-router router

ovn-nbctl lrp-set-gateway-chassis router-to-underlay hv3
ovn-nbctl --stateless lr-nat-add router dnat_and_snat 172.31.0.100 192.168.1.1
ovn-nbctl lrp-set-redirect-type router-to-underlay bridged

ovn-nbctl --wait=sb sync


{ set +x
$as_echo "$at_srcdir/ovn.at:17496: ovn_populate_arp__"
at_fn_check_prepare_trace "ovn.at:17496"
( $at_check_trace; ovn_populate_arp__
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17496"
$at_failed && at_fn_log_failure
$at_traceon; }


# lsp_to_ls LSP
#
# Prints the name of the logical switch that contains LSP.
lsp_to_ls () {
    case $1 in         lp?[11]) echo ls1 ;;         lp?[12]) echo ls2 ;;         *) $as_echo "ovn.at:17505" >"$at_check_line_file"
at_fn_check_skip 99 "$at_srcdir/ovn.at:17505" ;;
    esac
}

vif_to_ls () {
    case $1 in         vif?[11]) echo ls1 ;;         vif?[12]) echo ls2 ;;         vif-north) echo ls-north ;;         *) $as_echo "ovn.at:17514" >"$at_check_line_file"
at_fn_check_skip 99 "$at_srcdir/ovn.at:17514" ;;
    esac
}

hv_to_num () {
    case $1 in         hv1) echo 1 ;;         hv2) echo 2 ;;         hv3) echo 3 ;;         hv4) echo 4 ;;         *) $as_echo "ovn.at:17524" >"$at_check_line_file"
at_fn_check_skip 99 "$at_srcdir/ovn.at:17524" ;;
    esac
}

vif_to_num () {
    case $1 in         vif22) echo 22 ;;         vif21) echo 21 ;;         vif11) echo 11 ;;         *) $as_echo "ovn.at:17533" >"$at_check_line_file"
at_fn_check_skip 99 "$at_srcdir/ovn.at:17533" ;;
    esac
}

vif_to_hv () {
    case $1 in         vif[1]?) echo hv1 ;;         vif[2]?) echo hv2 ;;         vif-north) echo hv4 ;;         *) $as_echo "ovn.at:17542" >"$at_check_line_file"
at_fn_check_skip 99 "$at_srcdir/ovn.at:17542" ;;
    esac
}

vif_to_lrp () {
    echo router-to-`vif_to_ls $1`
}

ip_to_hex() {
       printf "%02x%02x%02x%02x" "$@"
}


test_ip() {
        # This packet has bad checksums but logical L3 routing doesn't check.
        local inport=$1 src_mac=$2 dst_mac=$3 src_ip=$4 dst_ip=$5 outport=$6
        local packet=${dst_mac}${src_mac}08004500001c0000000040110000${src_ip}${dst_ip}0035111100080000
        shift; shift; shift; shift; shift
        hv=`vif_to_hv $inport`
        as $hv ovs-appctl netdev-dummy/receive $inport $packet
        in_ls=`vif_to_ls $inport`
        for outport; do
            out_ls=`vif_to_ls $outport`
            if test $in_ls = $out_ls; then
                # Ports on the same logical switch receive exactly the same packet.
                echo $packet
            else
                # Routing decrements TTL and updates source and dest MAC
                # (and checksum).
                out_lrp=`vif_to_lrp $outport`
                # For North-South, packet will come via gateway chassis, i.e hv3
                if test $inport = vif-north; then
                    echo f0000000001100000101020308004500001c000000003f110100${src_ip}${dst_ip}0035111100080000 >> $outport.expected
                fi
                if test $outport = vif-north; then
                    echo f0f00000001100000101020708004500001c000000003e111726ac1f0064${dst_ip}0035111100080000 >> $outport.expected
                fi
            fi >> $outport.expected
        done
}

# Dump a bunch of info helpful for debugging if there's a failure.

echo "------ OVN dump ------"
ovn-nbctl show
ovn-nbctl lr-nat-list router
ovn-sbctl show
ovn-sbctl list port_binding
ovn-sbctl list mac_binding
ovn-sbctl dump-flows

echo "------ hv1 dump ------"
as hv1 ovs-vsctl show
as hv1 ovs-vsctl list Open_Vswitch

echo "------ hv2 dump ------"
as hv2 ovs-vsctl show
as hv2 ovs-vsctl list Open_Vswitch

echo "------ hv3 dump ------"
as hv3 ovs-vsctl show
as hv3 ovs-vsctl list Open_Vswitch

echo "------ hv4 dump ------"
as hv4 ovs-vsctl show
as hv4 ovs-vsctl list Open_Vswitch

echo "Send traffic South to Nouth"
sip=`ip_to_hex 192 168 1 1`
dip=`ip_to_hex 172 31 0 10`
test_ip vif11 f00000000011 000001010203 $sip $dip vif-north

# Confirm that South to North traffic works fine.
ovn_check_packets__ () {
   echo "checking packets in hv4/vif-north-tx.pcap against vif-north.expected:"
   rcv_pcap=hv4/vif-north-tx.pcap
   exp_text=vif-north.expected
   exp_n=`wc -l < "$exp_text"`
   ovs_wait_cond () {
    $PYTHON "$top_srcdir/ovs/utilities/ovs-pcap.in" $rcv_pcap > $rcv_text
      sed -i '/ffffffffffff/d' $rcv_text
      rcv_n=`wc -l < "$rcv_text"`
      echo "rcv_n=$rcv_n exp_n=$exp_n"
      test $rcv_n -ge $exp_n
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17615" "until \$PYTHON \"\$top_srcdir/ovs/utilities/ovs-pcap.in\" \$rcv_pcap > \$rcv_text
      sed -i '/ffffffffffff/d' \$rcv_text
      rcv_n=\`wc -l < \"\$rcv_text\"\`
      echo \"rcv_n=\$rcv_n exp_n=\$exp_n\"
      test \$rcv_n -ge \$exp_n"

   sort $exp_text > expout
 }


# Confirm that NATing happened without connection tracker

{ set +x
$as_echo "$at_srcdir/ovn.at:17619: ovn-sbctl dump-flows router | grep ct_snat | wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:17619"
( $at_check_trace; ovn-sbctl dump-flows router | grep ct_snat | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17619"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn.at:17622: ovn-sbctl dump-flows router | grep ct_dnat | wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:17622"
( $at_check_trace; ovn-sbctl dump-flows router | grep ct_dnat | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17622"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn.at:17625: ovn-sbctl dump-flows router | grep ip4.dst=| wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:17625"
( $at_check_trace; ovn-sbctl dump-flows router | grep ip4.dst=| wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "2
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17625"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn.at:17628: ovn-sbctl dump-flows router | grep ip4.src=| wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:17628"
( $at_check_trace; ovn-sbctl dump-flows router | grep ip4.src=| wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "2
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17628"
$at_failed && at_fn_log_failure
$at_traceon; }


echo "----------- Post Traffic hv1 dump -----------"
as hv1 ovs-ofctl dump-flows br-int
as hv1 ovs-ofctl show br-phys
as hv1 ovs-appctl fdb/show br-phys
as hv1 ovs-dpctl dump-flows

echo "----------- Post Traffic hv2 dump -----------"
as hv2 ovs-ofctl dump-flows br-int
as hv2 ovs-ofctl show br-phys
as hv2 ovs-appctl fdb/show br-phys

echo "----------- Post Traffic hv3 dump -----------"
as hv3 ovs-ofctl dump-flows br-int
as hv3 ovs-ofctl show br-phys
as hv3 ovs-appctl dpctl/dump-conntrack
as hv3 ovs-appctl fdb/show br-phys
as hv3 ovs-dpctl dump-flows
as hv3 ovs-ofctl dump-flows br-int

echo "----------- Post Traffic hv4 dump -----------"
as hv4 ovs-ofctl dump-flows br-int
as hv4 ovs-ofctl show br-phys
as hv4 ovs-appctl fdb/show br-phys




    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:17655: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:17655"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17655"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17655: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:17655"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17655"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17655" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:17655: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:17655"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17655"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17655: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:17655"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17655"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17655" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:17655: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:17655"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17655"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17655: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:17655"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17655"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17655" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:17655: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:17655"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17655"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17655: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:17655"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17655"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17655" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:17655: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:17655"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17655"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17655: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:17655"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17655"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17655" "while kill -0 \$TMPPID 2>/dev/null"





    as hv2
    if test "hv2" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:17655: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:17655"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17655"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17655: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:17655"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17655"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17655" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:17655: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:17655"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17655"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17655: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:17655"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17655"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17655" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:17655: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:17655"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17655"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17655: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:17655"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17655"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17655" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv2
    { set +x
$as_echo "$at_srcdir/ovn.at:17655: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:17655"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17655"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17655: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:17655"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17655"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17655" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:17655: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:17655"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17655"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17655: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:17655"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17655"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17655" "while kill -0 \$TMPPID 2>/dev/null"





    as hv3
    if test "hv3" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:17655: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:17655"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17655"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17655: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:17655"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17655"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17655" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:17655: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:17655"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17655"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17655: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:17655"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17655"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17655" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:17655: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:17655"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17655"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17655: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:17655"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17655"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17655" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv3
    { set +x
$as_echo "$at_srcdir/ovn.at:17655: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:17655"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17655"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17655: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:17655"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17655"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17655" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:17655: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:17655"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17655"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17655: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:17655"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17655"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17655" "while kill -0 \$TMPPID 2>/dev/null"





    as hv4
    if test "hv4" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:17655: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:17655"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17655"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17655: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:17655"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17655"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17655" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:17655: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:17655"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17655"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17655: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:17655"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17655"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17655" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:17655: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:17655"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17655"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17655: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:17655"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17655"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17655" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv4
    { set +x
$as_echo "$at_srcdir/ovn.at:17655: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:17655"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17655"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17655: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:17655"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17655"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17655" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:17655: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:17655"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17655"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17655: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:17655"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17655"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17655" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:17655: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:17655"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17655"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17655: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:17655"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17655"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17655" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:17655: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:17655"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17655"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17655: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:17655"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17655"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17655" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:17655: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:17655"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17655"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17655: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:17655"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17655"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17655" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:17655: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:17655"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17655"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17655: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:17655"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17655"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17655" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:17655: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:17655"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17655"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17655: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:17655"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17655"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17655" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:17655: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:17655"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17655"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17655: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:17655"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17655"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17655" "while kill -0 \$TMPPID 2>/dev/null"



ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_122
#AT_START_123
at_fn_group_banner 123 'ovn.at:17658' \
  "ovn -- Load balancer health checks" "             " 2
at_xfail=no
(
  $as_echo "123. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init


ovn_start

net_add n1

sim_add hv1
as hv1
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.1
ovs-vsctl -- add-port br-int hv1-vif1 -- \
    set interface hv1-vif1 external-ids:iface-id=sw0-p1 \
    options:tx_pcap=hv1/vif1-tx.pcap \
    options:rxq_pcap=hv1/vif1-rx.pcap \
    ofport-request=1
ovs-vsctl -- add-port br-int hv1-vif2 -- \
    set interface hv1-vif2 external-ids:iface-id=sw0-p2 \
    options:tx_pcap=hv1/vif2-tx.pcap \
    options:rxq_pcap=hv1/vif2-rx.pcap \
    ofport-request=2

sim_add hv2
as hv2
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.2
ovs-vsctl -- add-port br-int hv2-vif1 -- \
    set interface hv2-vif1 external-ids:iface-id=sw1-p1 \
    options:tx_pcap=hv2/vif1-tx.pcap \
    options:rxq_pcap=hv2/vif1-rx.pcap \
    ofport-request=1

ovn-nbctl ls-add sw0

ovn-nbctl lsp-add sw0 sw0-p1
ovn-nbctl lsp-set-addresses sw0-p1 "50:54:00:00:00:03 10.0.0.3"
ovn-nbctl lsp-set-port-security sw0-p1 "50:54:00:00:00:03 10.0.0.3"

ovn-nbctl lsp-set-addresses sw0-p2 "50:54:00:00:00:04 10.0.0.4"
ovn-nbctl lsp-set-port-security sw0-p2 "50:54:00:00:00:04 10.0.0.4"

# Create the second logical switch with one port
ovn-nbctl ls-add sw1
ovn-nbctl lsp-add sw1 sw1-p1
ovn-nbctl lsp-set-addresses sw1-p1 "40:54:00:00:00:03 20.0.0.3"
ovn-nbctl lsp-set-port-security sw1-p1 "40:54:00:00:00:03 20.0.0.3"

# Create a logical router and attach both logical switches
ovn-nbctl lr-add lr0
ovn-nbctl lrp-add lr0 lr0-sw0 00:00:00:00:ff:01 10.0.0.1/24
ovn-nbctl lsp-add sw0 sw0-lr0
ovn-nbctl lsp-set-type sw0-lr0 router
ovn-nbctl lsp-set-addresses sw0-lr0 router
ovn-nbctl lsp-set-options sw0-lr0 router-port=lr0-sw0

ovn-nbctl lrp-add lr0 lr0-sw1 00:00:00:00:ff:02 20.0.0.1/24
ovn-nbctl lsp-add sw1 sw1-lr0
ovn-nbctl lsp-set-type sw1-lr0 router
ovn-nbctl lsp-set-addresses sw1-lr0 router
ovn-nbctl lsp-set-options sw1-lr0 router-port=lr0-sw1

ovn-nbctl lb-add lb1 10.0.0.10:80 10.0.0.3:80,20.0.0.3:80

ovn-nbctl --wait=sb set load_balancer . ip_port_mappings:10.0.0.3=sw0-p1:10.0.0.2
ovn-nbctl --wait=sb set load_balancer . ip_port_mappings:20.0.0.3=sw1-p1:20.0.0.2

ovn-nbctl --wait=sb -- --id=@hc create \
Load_Balancer_Health_Check vip="10.0.0.10\:80" -- add Load_Balancer . \
health_check @hc

ovn-nbctl --wait=sb ls-lb-add sw0 lb1
ovn-nbctl --wait=sb ls-lb-add sw1 lb1
ovn-nbctl --wait=sb lr-lb-add lr0 lb1

ovn-nbctl ls-add public
ovn-nbctl lrp-add lr0 lr0-public 00:00:20:20:12:13 172.168.0.100/24
ovn-nbctl lsp-add public public-lr0
ovn-nbctl lsp-set-type public-lr0 router
ovn-nbctl lsp-set-addresses public-lr0 router
ovn-nbctl lsp-set-options public-lr0 router-port=lr0-public

# localnet port
ovn-nbctl lsp-add public ln-public
ovn-nbctl lsp-set-type ln-public localnet
ovn-nbctl lsp-set-addresses ln-public unknown
ovn-nbctl lsp-set-options ln-public network_name=public

# schedule the gw router port to a chassis. Change the name of the chassis
ovn-nbctl --wait=hv lrp-set-gateway-chassis lr0-public hv1 20

{ set +x
$as_echo "$at_srcdir/ovn.at:17747: ovn_populate_arp__"
at_fn_check_prepare_trace "ovn.at:17747"
( $at_check_trace; ovn_populate_arp__
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17747"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn-nbctl --wait=hv sync

ovs_wait_cond () {
    test 2 = `ovn-sbctl --bare --columns _uuid find \
service_monitor | sed '/^$/d' | wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17750" "until test 2 = \`ovn-sbctl --bare --columns _uuid find \\
service_monitor | sed '/^\$/d' | wc -l\`"


ovn-sbctl dump-flows sw0 | grep ct_lb | grep priority=120 > lflows.txt
{ set +x
$as_echo "$at_srcdir/ovn.at:17754: cat lflows.txt"
at_fn_check_prepare_trace "ovn.at:17754"
( $at_check_trace; cat lflows.txt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "  table=10(ls_in_stateful     ), priority=120  , match=(ct.new && ip4.dst == 10.0.0.10 && tcp.dst == 80), action=(ct_lb(10.0.0.3:80,20.0.0.3:80);)
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17754"
$at_failed && at_fn_log_failure
$at_traceon; }


ovn-sbctl dump-flows lr0 | grep ct_lb | grep priority=120 > lflows.txt
{ set +x
$as_echo "$at_srcdir/ovn.at:17759: cat lflows.txt"
at_fn_check_prepare_trace "ovn.at:17759"
( $at_check_trace; cat lflows.txt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "  table=6 (lr_in_dnat         ), priority=120  , match=(ct.new && ip && ip4.dst == 10.0.0.10 && tcp && tcp.dst == 80 && is_chassis_resident(\"cr-lr0-public\")), action=(ct_lb(10.0.0.3:80,20.0.0.3:80);)
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17759"
$at_failed && at_fn_log_failure
$at_traceon; }


# get the svc monitor mac.
svc_mon_src_mac=`ovn-nbctl get NB_Global . options:svc_monitor_mac | \
sed s/":"//g | sed s/\"//g`

ovs_wait_cond () {
    test 1 = `$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/vif1-tx.pcap | \
grep "505400000003${svc_mon_src_mac}" | wc -l`

}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17767" "until test 1 = \`\$PYTHON \"\$ovs_srcdir/utilities/ovs-pcap.in\" hv1/vif1-tx.pcap | \\
grep \"505400000003\${svc_mon_src_mac}\" | wc -l\`
"


ovs_wait_cond () {
    test 1 = `$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv2/vif1-tx.pcap | \
grep "405400000003${svc_mon_src_mac}" | wc -l`

}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17772" "until test 1 = \`\$PYTHON \"\$ovs_srcdir/utilities/ovs-pcap.in\" hv2/vif1-tx.pcap | \\
grep \"405400000003\${svc_mon_src_mac}\" | wc -l\`
"


ovs_wait_cond () {
    test 2 = `ovn-sbctl --bare --columns status find \
service_monitor | grep offline | wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17777" "until test 2 = \`ovn-sbctl --bare --columns status find \\
service_monitor | grep offline | wc -l\`"


ovs_wait_cond () {
    test 2 = `$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/vif1-tx.pcap | \
grep "505400000003${svc_mon_src_mac}" | wc -l`

}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17780" "until test 2 = \`\$PYTHON \"\$ovs_srcdir/utilities/ovs-pcap.in\" hv1/vif1-tx.pcap | \\
grep \"505400000003\${svc_mon_src_mac}\" | wc -l\`
"


ovs_wait_cond () {
    test 2 = `$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv2/vif1-tx.pcap | \
grep "405400000003${svc_mon_src_mac}" | wc -l`

}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17785" "until test 2 = \`\$PYTHON \"\$ovs_srcdir/utilities/ovs-pcap.in\" hv2/vif1-tx.pcap | \\
grep \"405400000003\${svc_mon_src_mac}\" | wc -l\`
"


ovn-sbctl dump-flows sw0 | grep "ip4.dst == 10.0.0.10 && tcp.dst == 80" \
| grep priority=120 > lflows.txt
{ set +x
$as_echo "$at_srcdir/ovn.at:17792: cat lflows.txt"
at_fn_check_prepare_trace "ovn.at:17792"
( $at_check_trace; cat lflows.txt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "  table=10(ls_in_stateful     ), priority=120  , match=(ct.new && ip4.dst == 10.0.0.10 && tcp.dst == 80), action=(drop;)
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17792"
$at_failed && at_fn_log_failure
$at_traceon; }


ovn-sbctl dump-flows lr0 | grep lr_in_dnat | grep priority=120 > lflows.txt
{ set +x
$as_echo "$at_srcdir/ovn.at:17797: cat lflows.txt"
at_fn_check_prepare_trace "ovn.at:17797"
( $at_check_trace; cat lflows.txt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "  table=6 (lr_in_dnat         ), priority=120  , match=(ct.est && ip && ip4.dst == 10.0.0.10 && tcp && tcp.dst == 80 && is_chassis_resident(\"cr-lr0-public\")), action=(ct_dnat;)
  table=6 (lr_in_dnat         ), priority=120  , match=(ct.new && ip && ip4.dst == 10.0.0.10 && tcp && tcp.dst == 80 && is_chassis_resident(\"cr-lr0-public\")), action=(drop;)
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17797"
$at_failed && at_fn_log_failure
$at_traceon; }





    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:17802: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:17802"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17802"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17802: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:17802"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17802"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17802" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:17802: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:17802"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17802"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17802: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:17802"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17802"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17802" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:17802: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:17802"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17802"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17802: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:17802"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17802"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17802" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:17802: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:17802"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17802"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17802: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:17802"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17802"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17802" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:17802: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:17802"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17802"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17802: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:17802"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17802"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17802" "while kill -0 \$TMPPID 2>/dev/null"





    as hv2
    if test "hv2" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:17802: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:17802"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17802"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17802: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:17802"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17802"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17802" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:17802: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:17802"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17802"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17802: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:17802"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17802"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17802" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:17802: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:17802"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17802"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17802: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:17802"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17802"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17802" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv2
    { set +x
$as_echo "$at_srcdir/ovn.at:17802: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:17802"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17802"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17802: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:17802"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17802"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17802" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:17802: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:17802"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17802"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17802: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:17802"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17802"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17802" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:17802: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:17802"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17802"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17802: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:17802"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17802"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17802" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:17802: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:17802"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17802"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17802: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:17802"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17802"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17802" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:17802: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:17802"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17802"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17802: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:17802"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17802"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17802" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:17802: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:17802"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17802"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17802: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:17802"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17802"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17802" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:17802: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:17802"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17802"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17802: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:17802"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17802"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17802" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:17802: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:17802"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17802"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:17802: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:17802"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17802"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17802" "while kill -0 \$TMPPID 2>/dev/null"



ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_123
#AT_START_124
at_fn_group_banner 124 'ovn.at:17805' \
  "ovn -- ARP/ND request broadcast limiting" "       " 2
at_xfail=no
(
  $as_echo "124. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

ip_to_hex() {
    printf "%02x%02x%02x%02x" "$@"
}

send_arp_request() {
    local hv=$1 inport=$2 eth_src=$3 spa=$4 tpa=$5
    local eth_dst=ffffffffffff
    local eth_type=0806
    local eth=${eth_dst}${eth_src}${eth_type}

    local arp=0001080006040001${eth_src}${spa}${eth_dst}${tpa}

    local request=${eth}${arp}
    as hv$hv ovs-appctl netdev-dummy/receive hv${hv}-vif$inport $request
}

send_nd_ns() {
    local hv=$1 inport=$2 eth_src=$3 spa=$4 tpa=$5 cksum=$6

    local eth_dst=ffffffffffff
    local eth_type=86dd
    local eth=${eth_dst}${eth_src}${eth_type}

    local ip_vhlen=60000000
    local ip_plen=0020
    local ip_next=3a
    local ip_ttl=ff
    local ip=${ip_vhlen}${ip_plen}${ip_next}${ip_ttl}${spa}${tpa}

    # Neighbor Solicitation
    local icmp6_type=87
    local icmp6_code=00
    local icmp6_rsvd=00000000
    # ICMPv6 source lla option
    local icmp6_opt=01
    local icmp6_optlen=01
    local icmp6=${icmp6_type}${icmp6_code}${cksum}${icmp6_rsvd}${tpa}${icmp6_opt}${icmp6_optlen}${eth_src}

    local request=${eth}${ip}${icmp6}

    as hv$hv ovs-appctl netdev-dummy/receive hv${hv}-vif$inport $request
}

src_mac=000000000001

net_add n1
sim_add hv1
as hv1
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.1

ovs-vsctl -- add-port br-int hv1-vif1 -- \
    set interface hv1-vif1 external-ids:iface-id=sw-agg-ext \
    options:tx_pcap=hv1/vif1-tx.pcap \
    options:rxq_pcap=hv1/vif1-rx.pcap \
    ofport-request=1

# One Aggregation Switch connected to two Logical networks (routers).
ovn-nbctl ls-add sw-agg
ovn-nbctl lsp-add sw-agg sw-agg-ext \
    -- lsp-set-addresses sw-agg-ext 00:00:00:00:00:01

ovn-nbctl lsp-add sw-agg sw-rtr1                   \
    -- lsp-set-type sw-rtr1 router                 \
    -- lsp-set-addresses sw-rtr1 00:00:00:00:01:00 \
    -- lsp-set-options sw-rtr1 router-port=rtr1-sw
ovn-nbctl lsp-add sw-agg sw-rtr2                   \
    -- lsp-set-type sw-rtr2 router                 \
    -- lsp-set-addresses sw-rtr2 00:00:00:00:02:00 \
    -- lsp-set-options sw-rtr2 router-port=rtr2-sw

# Configure L3 interface IPv4 & IPv6 on both routers
ovn-nbctl lr-add rtr1
ovn-nbctl lrp-add rtr1 rtr1-sw 00:00:00:00:01:00 10.0.0.1/24 10::1/64

ovn-nbctl lr-add rtr2
ovn-nbctl lrp-add rtr2 rtr2-sw 00:00:00:00:02:00 10.0.0.2/24 10::2/64

{ set +x
$as_echo "$at_srcdir/ovn.at:17886: ovn_populate_arp__"
at_fn_check_prepare_trace "ovn.at:17886"
( $at_check_trace; ovn_populate_arp__
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:17886"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn-nbctl --wait=hv sync

sw_dp_uuid=$(ovn-sbctl --bare --columns _uuid list datapath_binding sw-agg)
sw_dp_key=$(ovn-sbctl --bare --columns tunnel_key list datapath_binding sw-agg)

r1_tnl_key=$(ovn-sbctl --bare --columns tunnel_key list port_binding sw-rtr1)
r2_tnl_key=$(ovn-sbctl --bare --columns tunnel_key list port_binding sw-rtr2)

mc_key=$(ovn-sbctl --bare --columns tunnel_key find multicast_group datapath=${sw_dp_uuid} name="_MC_flood")
mc_key=$(printf "%04x" $mc_key)

match_sw_metadata="metadata=0x${sw_dp_key}"

# Inject ARP request for first router owned IP address.
send_arp_request 1 1 ${src_mac} $(ip_to_hex 10 0 0 254) $(ip_to_hex 10 0 0 1)

# Verify that the ARP request is sent only to rtr1.
match_arp_req="priority=75.*${match_sw_metadata}.*arp_tpa=10.0.0.1,arp_op=1"
match_send_rtr1="load:0x${r1_tnl_key}->NXM_NX_REG15"
match_send_rtr2="load:0x${r2_tnl_key}->NXM_NX_REG15"

as hv1
ovs_wait_cond () {

    pkts_to_rtr1=$(ovs-ofctl dump-flows br-int | \
    grep -E "${match_arp_req}" | grep "${match_send_rtr1}" | \
    grep n_packets=1 -c)
    test "1" = "${pkts_to_rtr1}"

}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17909" "until
    pkts_to_rtr1=\$(ovs-ofctl dump-flows br-int | \\
    grep -E \"\${match_arp_req}\" | grep \"\${match_send_rtr1}\" | \\
    grep n_packets=1 -c)
    test \"1\" = \"\${pkts_to_rtr1}\"
"

ovs_wait_cond () {

    pkts_to_rtr2=$(ovs-ofctl dump-flows br-int | \
    grep -E "${match_arp_req}" | grep "${match_send_rtr2}" | \
    grep n_packets=1 -c)
    test "0" = "${pkts_to_rtr2}"

}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17915" "until
    pkts_to_rtr2=\$(ovs-ofctl dump-flows br-int | \\
    grep -E \"\${match_arp_req}\" | grep \"\${match_send_rtr2}\" | \\
    grep n_packets=1 -c)
    test \"0\" = \"\${pkts_to_rtr2}\"
"

ovs_wait_cond () {

    pkts_flooded=$(ovs-ofctl dump-flows br-int | \
    grep -E "${match_sw_metadata}" | grep ${mc_key} | grep -v n_packets=0 -c)
    test "0" = "${pkts_flooded}"

}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17921" "until
    pkts_flooded=\$(ovs-ofctl dump-flows br-int | \\
    grep -E \"\${match_sw_metadata}\" | grep \${mc_key} | grep -v n_packets=0 -c)
    test \"0\" = \"\${pkts_flooded}\"
"


# Inject ND_NS for ofirst router owned IP address.
src_ipv6=00100000000000000000000000000254
dst_ipv6=00100000000000000000000000000001
send_nd_ns 1 1 ${src_mac} ${src_ipv6} ${dst_ipv6} 751d

# Verify that the ND_NS is sent only to rtr1.
match_nd_ns="priority=75.*${match_sw_metadata}.*icmp_type=135.*nd_target=10::1"

as hv1
ovs_wait_cond () {

    pkts_to_rtr1=$(ovs-ofctl dump-flows br-int | \
    grep -E "${match_nd_ns}" | grep "${match_send_rtr1}" | \
    grep n_packets=1 -c)
    test "1" = "${pkts_to_rtr1}"

}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17936" "until
    pkts_to_rtr1=\$(ovs-ofctl dump-flows br-int | \\
    grep -E \"\${match_nd_ns}\" | grep \"\${match_send_rtr1}\" | \\
    grep n_packets=1 -c)
    test \"1\" = \"\${pkts_to_rtr1}\"
"

ovs_wait_cond () {

    pkts_to_rtr2=$(ovs-ofctl dump-flows br-int | \
    grep -E "${match_nd_ns}" | grep "${match_send_rtr2}" | \
    grep n_packets=1 -c)
    test "0" = "${pkts_to_rtr2}"

}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17942" "until
    pkts_to_rtr2=\$(ovs-ofctl dump-flows br-int | \\
    grep -E \"\${match_nd_ns}\" | grep \"\${match_send_rtr2}\" | \\
    grep n_packets=1 -c)
    test \"0\" = \"\${pkts_to_rtr2}\"
"

ovs_wait_cond () {

    pkts_flooded=$(ovs-ofctl dump-flows br-int | \
    grep -E "${match_sw_metadata}" | grep ${mc_key} | grep -v n_packets=0 -c)
    test "0" = "${pkts_flooded}"

}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17948" "until
    pkts_flooded=\$(ovs-ofctl dump-flows br-int | \\
    grep -E \"\${match_sw_metadata}\" | grep \${mc_key} | grep -v n_packets=0 -c)
    test \"0\" = \"\${pkts_flooded}\"
"


# Configure load balancing on both routers.
ovn-nbctl lb-add lb1-v4 10.0.0.11 42.42.42.1
ovn-nbctl lb-add lb1-v6 10::11 42::1
ovn-nbctl lr-lb-add rtr1 lb1-v4
ovn-nbctl lr-lb-add rtr1 lb1-v6

ovn-nbctl lb-add lb2-v4 10.0.0.22 42.42.42.2
ovn-nbctl lb-add lb2-v6 10::22 42::2
ovn-nbctl lr-lb-add rtr2 lb2-v4
ovn-nbctl lr-lb-add rtr2 lb2-v6
ovn-nbctl --wait=hv sync

# Inject ARP request for first router owned VIP address.
send_arp_request 1 1 ${src_mac} $(ip_to_hex 10 0 0 254) $(ip_to_hex 10 0 0 11)

# Verify that the ARP request is sent only to rtr1.
match_arp_req="priority=75.*${match_sw_metadata}.*arp_tpa=10.0.0.11,arp_op=1"
match_send_rtr1="load:0x${r1_tnl_key}->NXM_NX_REG15"
match_send_rtr2="load:0x${r2_tnl_key}->NXM_NX_REG15"

as hv1
ovs_wait_cond () {

    pkts_to_rtr1=$(ovs-ofctl dump-flows br-int | \
    grep -E "${match_arp_req}" | grep "${match_send_rtr1}" | \
    grep n_packets=1 -c)
    test "1" = "${pkts_to_rtr1}"

}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17975" "until
    pkts_to_rtr1=\$(ovs-ofctl dump-flows br-int | \\
    grep -E \"\${match_arp_req}\" | grep \"\${match_send_rtr1}\" | \\
    grep n_packets=1 -c)
    test \"1\" = \"\${pkts_to_rtr1}\"
"

ovs_wait_cond () {

    pkts_to_rtr2=$(ovs-ofctl dump-flows br-int | \
    grep -E "${match_arp_req}" | grep "${match_send_rtr2}" | \
    grep n_packets=1 -c)
    test "0" = "${pkts_to_rtr2}"

}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17981" "until
    pkts_to_rtr2=\$(ovs-ofctl dump-flows br-int | \\
    grep -E \"\${match_arp_req}\" | grep \"\${match_send_rtr2}\" | \\
    grep n_packets=1 -c)
    test \"0\" = \"\${pkts_to_rtr2}\"
"

ovs_wait_cond () {

    pkts_flooded=$(ovs-ofctl dump-flows br-int | \
    grep -E "${match_sw_metadata}" | grep ${mc_key} | grep -v n_packets=0 -c)
    test "0" = "${pkts_flooded}"

}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:17987" "until
    pkts_flooded=\$(ovs-ofctl dump-flows br-int | \\
    grep -E \"\${match_sw_metadata}\" | grep \${mc_key} | grep -v n_packets=0 -c)
    test \"0\" = \"\${pkts_flooded}\"
"


# Inject ND_NS for first router owned VIP address.
src_ipv6=00100000000000000000000000000254
dst_ipv6=00100000000000000000000000000011
send_nd_ns 1 1 ${src_mac} ${src_ipv6} ${dst_ipv6} 751d

# Verify that the ND_NS is sent only to rtr1.
match_nd_ns="priority=75.*${match_sw_metadata}.*icmp_type=135.*nd_target=10::11"

as hv1
ovs_wait_cond () {

    pkts_to_rtr1=$(ovs-ofctl dump-flows br-int | \
    grep -E "${match_nd_ns}" | grep "${match_send_rtr1}" | \
    grep n_packets=1 -c)
    test "1" = "${pkts_to_rtr1}"

}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18002" "until
    pkts_to_rtr1=\$(ovs-ofctl dump-flows br-int | \\
    grep -E \"\${match_nd_ns}\" | grep \"\${match_send_rtr1}\" | \\
    grep n_packets=1 -c)
    test \"1\" = \"\${pkts_to_rtr1}\"
"

ovs_wait_cond () {

    pkts_to_rtr2=$(ovs-ofctl dump-flows br-int | \
    grep -E "${match_nd_ns}" | grep "${match_send_rtr2}" | \
    grep n_packets=1 -c)
    test "0" = "${pkts_to_rtr2}"

}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18008" "until
    pkts_to_rtr2=\$(ovs-ofctl dump-flows br-int | \\
    grep -E \"\${match_nd_ns}\" | grep \"\${match_send_rtr2}\" | \\
    grep n_packets=1 -c)
    test \"0\" = \"\${pkts_to_rtr2}\"
"

ovs_wait_cond () {

    pkts_flooded=$(ovs-ofctl dump-flows br-int | \
    grep -E "${match_sw_metadata}" | grep ${mc_key} | grep -v n_packets=0 -c)
    test "0" = "${pkts_flooded}"

}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18014" "until
    pkts_flooded=\$(ovs-ofctl dump-flows br-int | \\
    grep -E \"\${match_sw_metadata}\" | grep \${mc_key} | grep -v n_packets=0 -c)
    test \"0\" = \"\${pkts_flooded}\"
"


# Configure NAT on both routers
ovn-nbctl lr-nat-add rtr1 dnat_and_snat 10.0.0.111 42.42.42.1
ovn-nbctl lr-nat-add rtr1 dnat_and_snat 10::111 42::1
ovn-nbctl lr-nat-add rtr2 dnat_and_snat 10.0.0.222 42.42.42.2
ovn-nbctl lr-nat-add rtr2 dnat_and_snat 10::222 42::2

# Inject ARP request for first router owned NAT address.
send_arp_request 1 1 ${src_mac} $(ip_to_hex 10 0 0 254) $(ip_to_hex 10 0 0 111)

# Verify that the ARP request is sent only to rtr1.
match_arp_req="priority=75.*${match_sw_metadata}.*arp_tpa=10.0.0.111,arp_op=1"
match_send_rtr1="load:0x${r1_tnl_key}->NXM_NX_REG15"
match_send_rtr2="load:0x${r2_tnl_key}->NXM_NX_REG15"

as hv1
ovs_wait_cond () {

    pkts_to_rtr1=$(ovs-ofctl dump-flows br-int | \
    grep -E "${match_arp_req}" | grep "${match_send_rtr1}" | \
    grep n_packets=1 -c)
    test "1" = "${pkts_to_rtr1}"

}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18035" "until
    pkts_to_rtr1=\$(ovs-ofctl dump-flows br-int | \\
    grep -E \"\${match_arp_req}\" | grep \"\${match_send_rtr1}\" | \\
    grep n_packets=1 -c)
    test \"1\" = \"\${pkts_to_rtr1}\"
"

ovs_wait_cond () {

    pkts_to_rtr2=$(ovs-ofctl dump-flows br-int | \
    grep -E "${match_arp_req}" | grep "${match_send_rtr2}" | \
    grep n_packets=1 -c)
    test "0" = "${pkts_to_rtr2}"

}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18041" "until
    pkts_to_rtr2=\$(ovs-ofctl dump-flows br-int | \\
    grep -E \"\${match_arp_req}\" | grep \"\${match_send_rtr2}\" | \\
    grep n_packets=1 -c)
    test \"0\" = \"\${pkts_to_rtr2}\"
"

ovs_wait_cond () {

    pkts_flooded=$(ovs-ofctl dump-flows br-int | \
    grep -E "${match_sw_metadata}" | grep ${mc_key} | grep -v n_packets=0 -c)
    test "0" = "${pkts_flooded}"

}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18047" "until
    pkts_flooded=\$(ovs-ofctl dump-flows br-int | \\
    grep -E \"\${match_sw_metadata}\" | grep \${mc_key} | grep -v n_packets=0 -c)
    test \"0\" = \"\${pkts_flooded}\"
"


# Inject ND_NS for first router owned IP address.
src_ipv6=00100000000000000000000000000254
dst_ipv6=00100000000000000000000000000111
send_nd_ns 1 1 ${src_mac} ${src_ipv6} ${dst_ipv6} 751d

# Verify that the ND_NS is sent only to rtr1.
match_nd_ns="priority=75.*${match_sw_metadata}.*icmp_type=135.*nd_target=10::111"

as hv1
ovs_wait_cond () {

    pkts_to_rtr1=$(ovs-ofctl dump-flows br-int | \
    grep -E "${match_nd_ns}" | grep "${match_send_rtr1}" | \
    grep n_packets=1 -c)
    test "1" = "${pkts_to_rtr1}"

}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18062" "until
    pkts_to_rtr1=\$(ovs-ofctl dump-flows br-int | \\
    grep -E \"\${match_nd_ns}\" | grep \"\${match_send_rtr1}\" | \\
    grep n_packets=1 -c)
    test \"1\" = \"\${pkts_to_rtr1}\"
"

ovs_wait_cond () {

    pkts_to_rtr2=$(ovs-ofctl dump-flows br-int | \
    grep -E "${match_nd_ns}" | grep "${match_send_rtr2}" | \
    grep n_packets=1 -c)
    test "0" = "${pkts_to_rtr2}"

}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18068" "until
    pkts_to_rtr2=\$(ovs-ofctl dump-flows br-int | \\
    grep -E \"\${match_nd_ns}\" | grep \"\${match_send_rtr2}\" | \\
    grep n_packets=1 -c)
    test \"0\" = \"\${pkts_to_rtr2}\"
"

ovs_wait_cond () {

    pkts_flooded=$(ovs-ofctl dump-flows br-int | \
    grep -E "${match_sw_metadata}" | grep ${mc_key} | grep -v n_packets=0 -c)
    test "0" = "${pkts_flooded}"

}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18074" "until
    pkts_flooded=\$(ovs-ofctl dump-flows br-int | \\
    grep -E \"\${match_sw_metadata}\" | grep \${mc_key} | grep -v n_packets=0 -c)
    test \"0\" = \"\${pkts_flooded}\"
"





    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:18080: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:18080"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18080"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18080: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:18080"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18080"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18080" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:18080: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:18080"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18080"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18080: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:18080"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18080"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18080" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:18080: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:18080"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18080"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18080: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:18080"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18080"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18080" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:18080: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:18080"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18080"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18080: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:18080"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18080"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18080" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:18080: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:18080"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18080"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18080: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:18080"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18080"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18080" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:18080: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:18080"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18080"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18080: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:18080"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18080"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18080" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:18080: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:18080"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18080"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18080: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:18080"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18080"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18080" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:18080: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:18080"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18080"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18080: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:18080"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18080"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18080" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:18080: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:18080"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18080"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18080: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:18080"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18080"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18080" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:18080: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:18080"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18080"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18080: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:18080"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18080"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18080" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:18080: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:18080"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18080"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18080: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:18080"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18080"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18080" "while kill -0 \$TMPPID 2>/dev/null"



ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_124
#AT_START_125
at_fn_group_banner 125 'ovn.at:18083' \
  "ovn -- trace when flow cookie updated" "          " 2
at_xfail=no
(
  $as_echo "125. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init


ovn_start

net_add n1
sim_add hv1
as hv1
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.1
ovs-vsctl add-port br-int vif1 -- \
    set interface vif1 external-ids:iface-id=lp1 ofport-request=1

ovn-nbctl ls-add lsw0
ovn-nbctl lsp-add lsw0 lp1
ovn-nbctl lsp-set-addresses lp1 "f0:00:00:00:00:01 10.0.0.1"
ovn-nbctl acl-add lsw0 from-lport 1000 'eth.type == 0x1234' drop

ovn-nbctl --wait=hv --timeout=3 sync

# Trace with --ovs should see ovs flow related to the ACL
{ set +x
$as_echo "$at_srcdir/ovn.at:18103: ovn-trace --ovs lsw0 'inport == \"lp1\" && eth.type == 0x1234' | grep \"dl_type=0x1234\" | grep \"cookie\""
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:18103"
( $at_check_trace; ovn-trace --ovs lsw0 'inport == "lp1" && eth.type == 0x1234' | grep "dl_type=0x1234" | grep "cookie"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18103"
$at_failed && at_fn_log_failure
$at_traceon; }


# Replace the ACL with same match but different action.
ovn-nbctl acl-del lsw0 -- \
    acl-add lsw0 from-lport 1000 'eth.type == 0x1234' allow

ovn-nbctl --wait=hv --timeout=3 sync

# Trace with --ovs should still see the ovs flow related to the ACL, which
# means the OVS flow is updated with new cookie corresponding to the new lflow.
{ set +x
$as_echo "$at_srcdir/ovn.at:18113: ovn-trace --ovs lsw0 'inport == \"lp1\" && eth.type == 0x1234' | grep \"dl_type=0x1234 actions=\""
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:18113"
( $at_check_trace; ovn-trace --ovs lsw0 'inport == "lp1" && eth.type == 0x1234' | grep "dl_type=0x1234 actions="
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18113"
$at_failed && at_fn_log_failure
$at_traceon; }





    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:18115: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:18115"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18115"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18115: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:18115"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18115"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18115" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:18115: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:18115"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18115"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18115: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:18115"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18115"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18115" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:18115: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:18115"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18115"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18115: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:18115"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18115"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18115" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:18115: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:18115"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18115"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18115: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:18115"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18115"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18115" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:18115: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:18115"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18115"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18115: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:18115"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18115"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18115" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:18115: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:18115"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18115"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18115: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:18115"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18115"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18115" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:18115: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:18115"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18115"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18115: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:18115"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18115"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18115" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:18115: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:18115"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18115"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18115: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:18115"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18115"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18115" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:18115: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:18115"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18115"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18115: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:18115"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18115"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18115" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:18115: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:18115"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18115"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18115: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:18115"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18115"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18115" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:18115: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:18115"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18115"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18115: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:18115"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18115"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18115" "while kill -0 \$TMPPID 2>/dev/null"



ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_125
#AT_START_126
at_fn_group_banner 126 'ovn.at:18118' \
  "ovn -- interconnection" "                         " 2
at_xfail=no
(
  $as_echo "126. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_init_ic_db
n_az=5
n_ts=5
for i in `seq 1 $n_az`; do
    ovn_start az$i
done

net_add n1

# 1 HV and 1 GW per AZ
for az in `seq 1 $n_az`; do
    sim_add hv$az
    as hv$az
    ovs-vsctl add-br br-phys
    ovn_az_attach az$az n1 br-phys 192.168.$az.1 16
    for p in `seq 1 $n_ts`; do
        ovs-vsctl -- add-port br-int vif$p -- \
            set interface vif$p external-ids:iface-id=lsp$az-$p \
            options:tx_pcap=hv$az/vif$p-tx.pcap \
            options:rxq_pcap=hv$az/vif$p-rx.pcap \
            ofport-request=$p
    done

    sim_add gw$az
    as gw$az
    ovs-vsctl add-br br-phys
    ovn_az_attach az$az n1 br-phys 192.168.$az.2 16
    ovs-vsctl set open . external-ids:ovn-is-interconn=true
done

for ts in `seq 1 $n_ts`; do
    ovn-ic-nbctl create Transit_Switch name=ts$ts
done

for az in `seq 1 $n_az`; do
    ovn_as az$az
    ovn-nbctl set nb_global . options:ic-route-learn=true
    ovn-nbctl set nb_global . options:ic-route-adv=true

    # Each AZ has n_ts LSPi->LSi->LRi connecting to each TSi
    for i in `seq 1 $n_ts`; do
        lsp_mac=00:00:00:0$az:0$i:00
        lrp_ls_mac=00:00:00:0$az:0$i:01
        lrp_ts_mac=00:00:00:0$az:0$i:02
        lsp_ip=10.$az.$i.123
        lrp_ls_ip=10.$az.$i.1
        lrp_ts_ip=169.254.$i.$az

        ovn-nbctl ls-add ls$az-$i
        ovn-nbctl lsp-add ls$az-$i lsp$az-$i
        ovn-nbctl lsp-set-addresses lsp$az-$i "$lsp_mac $lsp_ip"

        ovn-nbctl lr-add lr$az-$i

        ovn-nbctl lrp-add lr$az-$i lrp-lr$az-$i-ls$az-$i $lrp_ls_mac $lrp_ls_ip/24
        ovn-nbctl lsp-add ls$az-$i lsp-ls$az-$i-lr$az-$i
        ovn-nbctl lsp-set-addresses lsp-ls$az-$i-lr$az-$i router
        ovn-nbctl lsp-set-type lsp-ls$az-$i-lr$az-$i router
        ovn-nbctl lsp-set-options lsp-ls$az-$i-lr$az-$i router-port=lrp-lr$az-$i-ls$az-$i

        ovn-nbctl lrp-add lr$az-$i lrp-lr$az-$i-ts$i $lrp_ts_mac $lrp_ts_ip/24
        ovn-nbctl lsp-add ts$i lsp-ts$i-lr$az-$i
        ovn-nbctl lsp-set-addresses lsp-ts$i-lr$az-$i router
        ovn-nbctl lsp-set-type lsp-ts$i-lr$az-$i router
        ovn-nbctl lsp-set-options lsp-ts$i-lr$az-$i router-port=lrp-lr$az-$i-ts$i
        ovn-nbctl lrp-set-gateway-chassis lrp-lr$az-$i-ts$i gw$az
    done
done

# Pre-populate the hypervisors' ARP tables so that we don't lose any
# packets for ARP resolution (native tunneling doesn't queue packets
# for ARP resolution).
{ set +x
$as_echo "$at_srcdir/ovn.at:18191: ovn_populate_arp__"
at_fn_check_prepare_trace "ovn.at:18191"
( $at_check_trace; ovn_populate_arp__
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18191"
$at_failed && at_fn_log_failure
$at_traceon; }


for i in `seq 1 $n_az`; do
    { set +x
$as_echo "$at_srcdir/ovn.at:18194: ovn_as az\$i ovn-nbctl --timeout=3 --wait=sb sync"
at_fn_check_prepare_dynamic "ovn_as az$i ovn-nbctl --timeout=3 --wait=sb sync" "ovn.at:18194"
( $at_check_trace; ovn_as az$i ovn-nbctl --timeout=3 --wait=sb sync
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18194"
$at_failed && at_fn_log_failure
$at_traceon; }

done

# Allow some time for ovn-northd and ovn-controller to catch up.
# XXX This should be more systematic.
sleep 2

# Send packets between AZs on each TS
for s_az in `seq 1 $n_az`; do
    for d_az in `seq 1 $n_az`; do
        if test $s_az = $d_az; then
            continue
        fi

        for i in `seq 1 $n_ts`; do
            lsp_smac=00:00:00:0${s_az}:0$i:00
            lsp_dmac=00:00:00:0${d_az}:0$i:00
            lrp_ls_smac=00:00:00:0${s_az}:0$i:01
            lrp_ls_dmac=00:00:00:0${d_az}:0$i:01
            lsp_sip=10.${s_az}.$i.123
            lsp_dip=10.${d_az}.$i.123

            packet="inport==\"lsp${s_az}-$i\" && eth.src==$lsp_smac && eth.dst==$lrp_ls_smac &&
                    ip4 && ip.ttl==64 && ip4.src==$lsp_sip && ip4.dst==$lsp_dip &&
                    udp && udp.src==53 && udp.dst==4369"
            { set +x
$as_echo "$at_srcdir/ovn.at:18219: as hv\${s_az} ovs-appctl -t ovn-controller inject-pkt \"\$packet\""
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "ovn.at:18219"
( $at_check_trace; as hv${s_az} ovs-appctl -t ovn-controller inject-pkt "$packet"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18219"
$at_failed && at_fn_log_failure
$at_traceon; }


            # Packet to Expect
            # The TTL should be decremented by 2.
            packet="eth.src==$lrp_ls_dmac && eth.dst==$lsp_dmac &&
                    ip4 && ip.ttl==62 && ip4.src==$lsp_sip && ip4.dst==$lsp_dip &&
                    udp && udp.src==53 && udp.dst==4369"
            echo $packet | ovstest test-ovn expr-to-packets >> ${d_az}-$i.expected
        done
    done
done

echo "---------INB dump-----"
ovn-ic-nbctl show
echo "---------------------"

echo "---------ISB dump-----"
ovn-ic-sbctl show
echo "---------------------"
ovn-ic-sbctl list gateway
echo "---------------------"
ovn-ic-sbctl list datapath_binding
echo "---------------------"
ovn-ic-sbctl list port_binding
echo "---------------------"
ovn-ic-sbctl list route
echo "---------------------"

for az in `seq 1 $n_az`; do
    for i in `seq 1 $n_ts`; do
        ovn_check_packets__ "hv$az/vif$i-tx.pcap" "$az-$i.expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:18249: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:18249"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18249"
$at_failed && at_fn_log_failure
$at_traceon; }

    done
done

for az in `seq 1 $n_az`; do

    as hv$az
    if test "hv$az" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:18254: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:18254"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18254"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18254: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:18254"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18254"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18254" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:18254: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:18254"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18254"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18254: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:18254"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18254"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18254" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:18254: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:18254"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18254"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18254: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:18254"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18254"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18254" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv$az
    { set +x
$as_echo "$at_srcdir/ovn.at:18254: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:18254"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18254"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18254: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:18254"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18254"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18254" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:18254: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:18254"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18254"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18254: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:18254"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18254"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18254" "while kill -0 \$TMPPID 2>/dev/null"




    as gw$az
    if test "gw$az" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:18255: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:18255"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18255"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18255: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:18255"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18255"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18255" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:18255: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:18255"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18255"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18255: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:18255"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18255"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18255" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:18255: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:18255"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18255"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18255: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:18255"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18255"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18255" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as gw$az
    { set +x
$as_echo "$at_srcdir/ovn.at:18255: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:18255"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18255"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18255: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:18255"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18255"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18255" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:18255: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:18255"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18255"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18255: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:18255"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18255"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18255" "while kill -0 \$TMPPID 2>/dev/null"




    as az$az/ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:18256: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:18256"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18256"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18256: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:18256"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18256"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18256" "while kill -0 \$TMPPID 2>/dev/null"


    as az$az/ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:18256: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:18256"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18256"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18256: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:18256"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18256"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18256" "while kill -0 \$TMPPID 2>/dev/null"


    as az$az/northd
    { set +x
$as_echo "$at_srcdir/ovn.at:18256: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:18256"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18256"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18256: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:18256"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18256"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18256" "while kill -0 \$TMPPID 2>/dev/null"


    as az$az/northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:18256: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:18256"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18256"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18256: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:18256"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18256"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18256" "while kill -0 \$TMPPID 2>/dev/null"


    as az$az/ic
    { set +x
$as_echo "$at_srcdir/ovn.at:18256: test -e \$OVS_RUNDIR/ovn-ic.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-ic.pid" "ovn.at:18256"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-ic.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18256"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-ic.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18256: ovs-appctl --timeout=10 -t ovn-ic exit"
at_fn_check_prepare_trace "ovn.at:18256"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-ic exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18256"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18256" "while kill -0 \$TMPPID 2>/dev/null"


done



    as ovn-ic-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:18259: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:18259"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18259"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18259: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:18259"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18259"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18259" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-ic-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:18259: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:18259"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18259"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18259: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:18259"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18259"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18259" "while kill -0 \$TMPPID 2>/dev/null"


    if test -d "$ovs_base"/main; then

    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:18259: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:18259"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18259"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18259: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:18259"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18259"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18259" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:18259: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:18259"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18259"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18259: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:18259"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18259"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18259" "while kill -0 \$TMPPID 2>/dev/null"


    fi


ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_126
#AT_START_127
at_fn_group_banner 127 'ovn.at:18264' \
  "ovn -- ECMP static routes" "                      " 2
at_xfail=no
(
  $as_echo "127. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

# Logical network:
# ls1 (192.168.1.0/24) - lr1 - ls2 (192.168.2.0/24)
# lsl has lsp11 (192.168.1.11) and ls2 has lsp21 (192.168.2.21) and lsp22
# (192.168.2.22)
#
# Static routes on lr1:
# 10.0.0.0/24 nexthop 192.168.2.21
# 10.0.0.0/24 nexthop 192.168.2.22
#
# Test:
# lsp11 send packets to 10.0.0.*
#
# Expected result:
# Both lsp21 and lsp22 should received some of the packets.

ovn-nbctl lr-add lr1

ovn-nbctl ls-add ls1
ovn-nbctl ls-add ls2

for i in 1 2; do
    ovn-nbctl lrp-add lr1 lrp-lr1-ls${i} 00:00:00:01:0${i}:01 192.168.${i}.1/24
    ovn-nbctl lsp-add ls${i} lsp-ls${i}-lr1 -- lsp-set-type lsp-ls${i}-lr1 router \
        -- lsp-set-options lsp-ls${i}-lr1 router-port=lrp-lr1-ls${i} \
        -- lsp-set-addresses lsp-ls${i}-lr1 router
done

#install static routes
ovn-nbctl lr-route-add lr1 10.0.0.0/24 192.168.2.21
ovn-nbctl --ecmp lr-route-add lr1 10.0.0.0/24 192.168.2.22

# Create logical ports
ovn-nbctl lsp-add ls1 lsp11 -- \
    lsp-set-addresses lsp11 "f0:00:00:00:01:11 192.168.1.11"
ovn-nbctl lsp-add ls2 lsp21 -- \
    lsp-set-addresses lsp21 "f0:00:00:00:02:21 192.168.2.21"
ovn-nbctl lsp-add ls2 lsp22 -- \
    lsp-set-addresses lsp22 "f0:00:00:00:02:22 192.168.2.22"

net_add n1
sim_add hv1
as hv1
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.1
ovs-vsctl -- add-port br-int hv1-vif1 -- \
    set interface hv1-vif1 external-ids:iface-id=lsp11 \
    options:tx_pcap=hv1/vif1-tx.pcap \
    options:rxq_pcap=hv1/vif1-rx.pcap \
    ofport-request=1

ovs-vsctl -- add-port br-int hv1-vif2 -- \
    set interface hv1-vif2 external-ids:iface-id=lsp21 \
    options:tx_pcap=hv1/vif2-tx.pcap \
    options:rxq_pcap=hv1/vif2-rx.pcap \
    ofport-request=2

ovs-vsctl -- add-port br-int hv1-vif3 -- \
    set interface hv1-vif3 external-ids:iface-id=lsp22 \
    options:tx_pcap=hv1/vif3-tx.pcap \
    options:rxq_pcap=hv1/vif3-rx.pcap \
    ofport-request=3

# wait for earlier changes to take effect
{ set +x
$as_echo "$at_srcdir/ovn.at:18330: ovn-nbctl --timeout=3 --wait=hv sync"
at_fn_check_prepare_trace "ovn.at:18330"
( $at_check_trace; ovn-nbctl --timeout=3 --wait=hv sync
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18330"
$at_failed && at_fn_log_failure
$at_traceon; }


for i in $(seq 5001 5010); do
    packet="inport==\"lsp11\" && eth.src==f0:00:00:00:01:11 && eth.dst==00:00:00:01:01:01 &&
            ip4 && ip.ttl==64 && ip4.src==192.168.1.11 && ip4.dst==10.0.0.123 &&
            tcp && tcp.src==$i && tcp.dst==80"
    { set +x
$as_echo "$at_srcdir/ovn.at:18336: as hv1 ovs-appctl -t ovn-controller inject-pkt \"\$packet\""
at_fn_check_prepare_dynamic "as hv1 ovs-appctl -t ovn-controller inject-pkt \"$packet\"" "ovn.at:18336"
( $at_check_trace; as hv1 ovs-appctl -t ovn-controller inject-pkt "$packet"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18336"
$at_failed && at_fn_log_failure
$at_traceon; }


    for j in 1 2; do
        # Assume all packets go to lsp2${j}.
        exp_packet="eth.src==00:00:00:01:02:01 && eth.dst==f0:00:00:00:02:2${j} &&
                ip4 && ip.ttl==63 && ip4.src==192.168.1.11 && ip4.dst==10.0.0.123 &&
                tcp && tcp.src==$i && tcp.dst==80"
        echo $exp_packet | ovstest test-ovn expr-to-packets >> expected_lsp2${j}
    done
done

# Each port should receive some packets and the total number should be 10
ovs_wait_cond () {

    rcv_n1=`$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/vif2-tx.pcap > lsp21.packets && cat lsp21.packets | wc -l`
    rcv_n2=`$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/vif3-tx.pcap > lsp22.packets && cat lsp22.packets | wc -l`
    echo $rcv_n1 $rcv_n2
    test $rcv_n1 -ge 1 -a $rcv_n2 -ge 1 -a $(($rcv_n1 + $rcv_n2)) -ge 10
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18348" "until
    rcv_n1=\`\$PYTHON \"\$ovs_srcdir/utilities/ovs-pcap.in\" hv1/vif2-tx.pcap > lsp21.packets && cat lsp21.packets | wc -l\`
    rcv_n2=\`\$PYTHON \"\$ovs_srcdir/utilities/ovs-pcap.in\" hv1/vif3-tx.pcap > lsp22.packets && cat lsp22.packets | wc -l\`
    echo \$rcv_n1 \$rcv_n2
    test \$rcv_n1 -ge 1 -a \$rcv_n2 -ge 1 -a \$((\$rcv_n1 + \$rcv_n2)) -ge 10"


# Each port should receive a subset of expected packets
for i in 1 2; do
    sort expected_lsp2$i > expout
    { set +x
$as_echo "$at_srcdir/ovn.at:18357: cat lsp2\${i}.packets expected_lsp2\$i | sort | uniq"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "ovn.at:18357"
( $at_check_trace; cat lsp2${i}.packets expected_lsp2$i | sort | uniq
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18357"
$at_failed && at_fn_log_failure
$at_traceon; }

done




    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:18360: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:18360"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18360"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18360: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:18360"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18360"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18360" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:18360: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:18360"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18360"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18360: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:18360"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18360"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18360" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:18360: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:18360"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18360"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18360: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:18360"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18360"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18360" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:18360: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:18360"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18360"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18360: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:18360"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18360"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18360" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:18360: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:18360"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18360"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18360: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:18360"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18360"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18360" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:18360: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:18360"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18360"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18360: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:18360"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18360"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18360" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:18360: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:18360"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18360"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18360: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:18360"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18360"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18360" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:18360: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:18360"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18360"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18360: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:18360"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18360"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18360" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:18360: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:18360"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18360"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18360: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:18360"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18360"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18360" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:18360: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:18360"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18360"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18360: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:18360"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18360"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18360" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:18360: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:18360"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18360"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18360: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:18360"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18360"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18360" "while kill -0 \$TMPPID 2>/dev/null"




ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_127
#AT_START_128
at_fn_group_banner 128 'ovn.at:18364' \
  "ovn -- forwarding group: 3 HVs, 1 LR, 2 LS" "     " 2
at_xfail=no
(
  $as_echo "128. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init


ovn_start

# Logical network:
# One LR - R1 has a logical switch ls1 and ls2 connected to it.
# Logical switch ls1 has one port while ls2 has two logical switch ports as
# child ports.
ovn-nbctl lr-add R1
ovn-nbctl ls-add ls1
ovn-nbctl ls-add ls2

# Logical switch ls1 to R1 connectivity
ovn-nbctl lrp-add R1 R1-ls1 00:00:00:01:02:f1 192.168.1.1/24
ovn-nbctl lsp-add ls1 ls1-R1 -- set Logical_Switch_Port ls1-R1 \
    type=router options:router-port=R1-ls1 -- lsp-set-addresses ls1-R1 router
ovn-nbctl lsp-add ls1 lsp11 \
    -- lsp-set-addresses lsp11 "00:00:00:01:02:01 192.168.1.2"

# Logical switch ls2 to R1 connectivity
ovn-nbctl lrp-add R1 R1-ls2 00:00:00:01:02:f2 172.16.1.1/24
ovn-nbctl lsp-add ls2 ls2-R1 -- set Logical_Switch_Port ls2-R1 \
    type=router options:router-port=R1-ls2 -- lsp-set-addresses ls2-R1 router
ovn-nbctl lsp-add ls2 lsp21 \
    -- lsp-set-addresses lsp21 "00:00:00:01:02:01 172.16.1.2"
ovn-nbctl lsp-add ls2 lsp22 \
    -- lsp-set-addresses lsp22 "00:00:00:01:02:02 172.16.1.3"

# Create a network
net_add n1

# Create hypervisor hv1 connected to n1
sim_add hv1
as hv1
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.1
ovs-vsctl add-port br-int vif1 -- set Interface vif1 external-ids:iface-id=lsp11 options:tx_pcap=hv1/vif1-tx.pcap options:rxq_pcap=hv1/vif1-rx.pcap ofport-request=1

# Create hypervisor hv2 connected to n1
sim_add hv2
as hv2
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.2
ovs-vsctl add-port br-int vif2 -- set Interface vif2 external-ids:iface-id=lsp21 options:tx_pcap=hv2/vif2-tx.pcap options:rxq_pcap=hv2/vif2-rx.pcap ofport-request=1

# Create hypervisor hv3 connected to n1
sim_add hv3
as hv3
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.3
ovs-vsctl add-port br-int vif3 -- set Interface vif3 external-ids:iface-id=lsp22 options:tx_pcap=hv3/vif3-tx.pcap options:rxq_pcap=hv3/vif3-rx.pcap ofport-request=1

# Add a forwarding group on ls2 with lsp21 and lsp22 as child ports
# virtual IP - 172.16.1.11, virtual MAC - 00:11:de:ad:be:ef
ovn-nbctl fwd-group-add fwd_grp1 ls2 172.16.1.11 00:11:de:ad:be:ef lsp21 lsp22

# Allow some time for ovn-northd and ovn-controller to catch up.
sleep 1

# Check logical flow
{ set +x
$as_echo "$at_srcdir/ovn.at:18424: ovn-sbctl dump-flows | grep ls_in_l2_lkup | grep fwd_group | wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn.at:18424"
( $at_check_trace; ovn-sbctl dump-flows | grep ls_in_l2_lkup | grep fwd_group | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18424"
$at_failed && at_fn_log_failure
$at_traceon; }


# Check openflow rule with "group" on hypervisor
{ set +x
$as_echo "$at_srcdir/ovn.at:18429: as hv1 ovs-ofctl dump-flows br-int | \\
    grep \"dl_dst=00:11:de:ad:be:ef actions=group\" | wc -l"
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:18429"
( $at_check_trace; as hv1 ovs-ofctl dump-flows br-int | \
    grep "dl_dst=00:11:de:ad:be:ef actions=group" | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18429"
$at_failed && at_fn_log_failure
$at_traceon; }


# Verify openflow group members
for child_port in lsp21 lsp22; do
    tunnel_key=`ovn-sbctl --bare --column tunnel_key find port_binding logical_port=$child_port`
    { set +x
$as_echo "$at_srcdir/ovn.at:18437: as hv1 ovs-ofctl -O OpenFlow13 dump-groups br-int | \\
        grep \"bucket=actions=load:0x\"\$tunnel_key | wc -l"
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:18437"
( $at_check_trace; as hv1 ovs-ofctl -O OpenFlow13 dump-groups br-int | \
        grep "bucket=actions=load:0x"$tunnel_key | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18437"
$at_failed && at_fn_log_failure
$at_traceon; }

done

# Send a packet to virtual IP
src_mac=00:00:00:01:02:01
dst_mac=00:00:00:01:02:f1
src_ip=192.168.1.2
dst_ip=172.16.1.11
packet="inport==\"lsp11\" && eth.src==$src_mac && eth.dst==$dst_mac &&
        ip4 && ip.ttl==64 && ip4.src==$src_ip && ip4.dst==$dst_ip &&
        udp && udp.src==53 && udp.dst==4369"
as hv1 ovs-appctl -t ovn-controller inject-pkt "$packet"

# Check if the packet hit the forwarding group policy
{ set +x
$as_echo "$at_srcdir/ovn.at:18454: as hv1 ovs-ofctl dump-flows br-int | \\
    grep \"dl_dst=00:11:de:ad:be:ef actions=group\" | \\
    grep \"n_packets=1\" | wc -l"
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:18454"
( $at_check_trace; as hv1 ovs-ofctl dump-flows br-int | \
    grep "dl_dst=00:11:de:ad:be:ef actions=group" | \
    grep "n_packets=1" | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18454"
$at_failed && at_fn_log_failure
$at_traceon; }


# Delete the forwarding group
ovn-nbctl fwd-group-del fwd_grp1

# Add a forwarding group with liveness on ls2 with lsp21 and lsp22 as child
# ports virtual IP - 172.16.1.11, virtual MAC - 00:11:de:ad:be:ef
ovn-nbctl --liveness fwd-group-add fwd_grp1 ls2 172.16.1.11 00:11:de:ad:be:ef lsp21 lsp22

# Allow some time for ovn-northd and ovn-controller to catch up.
sleep 1

# Verify openflow group members
ofport_lsp21=$(as hv1 ovs-vsctl --bare --columns ofport find Interface name=ovn-hv2-0)
tunnel_key=`ovn-sbctl --bare --column tunnel_key find port_binding logical_port=lsp21`
{ set +x
$as_echo "$at_srcdir/ovn.at:18473: as hv1 ovs-ofctl -O OpenFlow13 dump-groups br-int | \\
    grep \"bucket=watch_port:\$ofport_lsp21,actions=load:0x\"\$tunnel_key | wc -l"
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:18473"
( $at_check_trace; as hv1 ovs-ofctl -O OpenFlow13 dump-groups br-int | \
    grep "bucket=watch_port:$ofport_lsp21,actions=load:0x"$tunnel_key | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18473"
$at_failed && at_fn_log_failure
$at_traceon; }


ofport_lsp22=$(as hv1 ovs-vsctl --bare --columns ofport find Interface name=ovn-hv3-0)
tunnel_key=`ovn-sbctl --bare --column tunnel_key find port_binding logical_port=lsp22`
{ set +x
$as_echo "$at_srcdir/ovn.at:18480: as hv1 ovs-ofctl -O OpenFlow13 dump-groups br-int | \\
    grep \"bucket=watch_port:\$ofport_lsp22,actions=load:0x\"\$tunnel_key | wc -l"
at_fn_check_prepare_notrace 'an embedded newline' "ovn.at:18480"
( $at_check_trace; as hv1 ovs-ofctl -O OpenFlow13 dump-groups br-int | \
    grep "bucket=watch_port:$ofport_lsp22,actions=load:0x"$tunnel_key | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18480"
$at_failed && at_fn_log_failure
$at_traceon; }





    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:18485: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:18485"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18485"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18485: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:18485"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18485"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18485" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:18485: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:18485"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18485"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18485: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:18485"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18485"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18485" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:18485: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:18485"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18485"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18485: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:18485"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18485"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18485" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:18485: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:18485"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18485"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18485: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:18485"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18485"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18485" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:18485: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:18485"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18485"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18485: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:18485"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18485"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18485" "while kill -0 \$TMPPID 2>/dev/null"





    as hv2
    if test "hv2" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:18485: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:18485"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18485"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18485: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:18485"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18485"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18485" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:18485: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:18485"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18485"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18485: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:18485"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18485"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18485" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:18485: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:18485"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18485"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18485: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:18485"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18485"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18485" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv2
    { set +x
$as_echo "$at_srcdir/ovn.at:18485: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:18485"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18485"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18485: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:18485"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18485"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18485" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:18485: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:18485"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18485"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18485: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:18485"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18485"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18485" "while kill -0 \$TMPPID 2>/dev/null"





    as hv3
    if test "hv3" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:18485: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:18485"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18485"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18485: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:18485"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18485"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18485" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:18485: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:18485"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18485"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18485: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:18485"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18485"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18485" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:18485: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:18485"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18485"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18485: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:18485"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18485"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18485" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv3
    { set +x
$as_echo "$at_srcdir/ovn.at:18485: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:18485"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18485"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18485: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:18485"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18485"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18485" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:18485: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:18485"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18485"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18485: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:18485"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18485"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18485" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:18485: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:18485"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18485"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18485: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:18485"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18485"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18485" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:18485: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:18485"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18485"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18485: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:18485"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18485"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18485" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:18485: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:18485"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18485"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18485: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:18485"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18485"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18485" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:18485: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:18485"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18485"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18485: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:18485"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18485"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18485" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:18485: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:18485"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18485"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18485: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:18485"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18485"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18485" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:18485: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:18485"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18485"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18485: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:18485"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18485"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18485" "while kill -0 \$TMPPID 2>/dev/null"



ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_128
#AT_START_129
at_fn_group_banner 129 'ovn.at:18488' \
  "ovn -- Load Balancer LS hairpin" "                " 2
at_xfail=no
(
  $as_echo "129. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

reset_pcap_file() {
    local iface=$1
    local pcap_file=$2
    ovs-vsctl -- set Interface $iface options:tx_pcap=dummy-tx.pcap \
options:rxq_pcap=dummy-rx.pcap
    rm -f ${pcap_file}*.pcap
    ovs-vsctl -- set Interface $iface options:tx_pcap=${pcap_file}-tx.pcap \
options:rxq_pcap=${pcap_file}-rx.pcap
}

ip_to_hex() {
     printf "%02x%02x%02x%02x" "$@"
}

build_udp() {
    local sport=$1 dport=$2 chksum=$3
    local len=000a
    echo ${sport}${dport}${len}${chksum}0000
}

build_tcp_syn() {
    local sport=$1 dport=$2 chksum=$3
    local seq=00000001
    local ack=00000000
    local hlen_flags=5002
    local win=00ff
    local urg=0000
    echo ${sport}${dport}${seq}${ack}${hlen_flags}${win}${chksum}${urg}
}

send_ipv4_pkt() {
    local hv=$1 inport=$2 eth_src=$3 eth_dst=$4
    local ip_src=$5 ip_dst=$6 ip_proto=$7 ip_len=$8 ip_chksum=$9
    local l4_payload=${10}
    local hp_l4_payload=${11}
    local outfile=${12}

    local ip_ttl=40

    local eth=${eth_dst}${eth_src}0800
    local hp_eth=${eth_src}${eth_dst}0800
    local ip=4500${ip_len}00004000${ip_ttl}${ip_proto}${ip_chksum}${ip_src}${ip_dst}
    local hp_ip=4500${ip_len}00004000${ip_ttl}${ip_proto}${ip_chksum}${ip_dst}${ip_src}
    local packet=${eth}${ip}${l4_payload}
    local hp_packet=${hp_eth}${hp_ip}${hp_l4_payload}

    echo ${hp_packet} >> ${outfile}
    as $hv ovs-appctl netdev-dummy/receive ${inport} ${packet}
}

send_ipv6_pkt() {
    local hv=$1 inport=$2 eth_src=$3 eth_dst=$4
    local ip_src=$5 ip_dst=$6 ip_proto=$7 ip_len=$8
    local l4_payload=$9
    local hp_l4_payload=${10}
    local outfile=${11}

    local ip_ttl=40

    local eth=${eth_dst}${eth_src}86dd
    local hp_eth=${eth_src}${eth_dst}86dd
    local ip=60000000${ip_len}${ip_proto}${ip_ttl}${ip_src}${ip_dst}
    local hp_ip=60000000${ip_len}${ip_proto}${ip_ttl}${ip_dst}${ip_src}
    local packet=${eth}${ip}${l4_payload}
    local hp_packet=${hp_eth}${hp_ip}${hp_l4_payload}

    echo ${hp_packet} >> ${outfile}
    as $hv ovs-appctl netdev-dummy/receive ${inport} ${packet}
}

net_add n1
sim_add hv1
as hv1
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.1

ovs-vsctl -- add-port br-int hv1-vif1 -- \
    set interface hv1-vif1 external-ids:iface-id=lsp \
    options:tx_pcap=hv1/vif1-tx.pcap \
    options:rxq_pcap=hv1/vif1-rx.pcap \
    ofport-request=1

# One logical switch with IPv4 and IPv6 load balancers that hairpin the
# traffic.
ovn-nbctl ls-add sw
ovn-nbctl lsp-add sw lsp -- lsp-set-addresses lsp 00:00:00:00:00:01
ovn-nbctl lb-add lb-ipv4-tcp 88.88.88.88:8080 42.42.42.1:4041 tcp
ovn-nbctl lb-add lb-ipv4-udp 88.88.88.88:4040 42.42.42.1:2021 udp
ovn-nbctl lb-add lb-ipv6-tcp [8800::0088]:8080 [4200::1]:4041 tcp
ovn-nbctl lb-add lb-ipv6-udp [8800::0088]:4040 [4200::1]:2021 udp
ovn-nbctl ls-lb-add sw lb-ipv4-tcp
ovn-nbctl ls-lb-add sw lb-ipv4-udp
ovn-nbctl ls-lb-add sw lb-ipv6-tcp
ovn-nbctl ls-lb-add sw lb-ipv6-udp

ovn-nbctl lr-add rtr
ovn-nbctl lrp-add rtr rtr-sw 00:00:00:00:01:00 42.42.42.254/24 4200::00ff/64
ovn-nbctl lsp-add sw sw-rtr                       \
    -- lsp-set-type sw-rtr router                 \
    -- lsp-set-addresses sw-rtr 00:00:00:00:01:00 \
    -- lsp-set-options sw-rtr router-port=rtr-sw

ovn-nbctl --wait=hv sync

# Inject IPv4 TCP packet from lsp.
> expected
tcp_payload=$(build_tcp_syn 84d0 1f90 05a7)
hp_tcp_payload=$(build_tcp_syn 84d0 0fc9 156e)
send_ipv4_pkt hv1 hv1-vif1 000000000001 000000000100 \
    $(ip_to_hex 42 42 42 1) $(ip_to_hex 88 88 88 88) \
    06 0028 35f5 \
    ${tcp_payload} ${hp_tcp_payload} \
    expected

# Check that traffic is hairpinned.
ovn_check_packets__ "hv1/vif1-tx.pcap" "expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:18606: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:18606"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18606"
$at_failed && at_fn_log_failure
$at_traceon; }


# Inject IPv4 UDP packet from lsp.
udp_payload=$(build_udp 84d0 0fc8 6666)
hp_udp_payload=$(build_udp 84d0 07e5 6e49)
send_ipv4_pkt hv1 hv1-vif1 000000000001 000000000100 \
    $(ip_to_hex 42 42 42 1) $(ip_to_hex 88 88 88 88) \
    11 001e 35f4 \
    ${udp_payload} ${hp_udp_payload} \
    expected

# Check that traffic is hairpinned.
ovn_check_packets__ "hv1/vif1-tx.pcap" "expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:18618: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:18618"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18618"
$at_failed && at_fn_log_failure
$at_traceon; }


# Inject IPv6 TCP packet from lsp.
tcp_payload=$(build_tcp_syn 84d0 1f90 3ff9)
hp_tcp_payload=$(build_tcp_syn 84d0 0fc9 4fc0)
send_ipv6_pkt hv1 hv1-vif1 000000000001 000000000100 \
    42000000000000000000000000000001 88000000000000000000000000000088 \
    06 0014 \
    ${tcp_payload} ${hp_tcp_payload} \
    expected

# Check that traffic is hairpinned.
ovn_check_packets__ "hv1/vif1-tx.pcap" "expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:18630: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:18630"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18630"
$at_failed && at_fn_log_failure
$at_traceon; }


# Inject IPv6 UDP packet from lsp.
udp_payload=$(build_udp 84d0 0fc8 a0b8)
hp_udp_payload=$(build_udp 84d0 07e5 a89b)
send_ipv6_pkt hv1 hv1-vif1 000000000001 000000000100 \
    42000000000000000000000000000001 88000000000000000000000000000088 \
    11 000a \
    ${udp_payload} ${hp_udp_payload} \
    expected

# Check that traffic is hairpinned.
ovn_check_packets__ "hv1/vif1-tx.pcap" "expected"
   { set +x
$as_echo "$at_srcdir/ovn.at:18642: sort \$rcv_text"
at_fn_check_prepare_dynamic "sort $rcv_text" "ovn.at:18642"
( $at_check_trace; sort $rcv_text
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
$at_diff expout "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18642"
$at_failed && at_fn_log_failure
$at_traceon; }





    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn.at:18644: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn.at:18644"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18644"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18644: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn.at:18644"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18644"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18644" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn.at:18644: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn.at:18644"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18644"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18644: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn.at:18644"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18644"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18644" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn.at:18644: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn.at:18644"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18644"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18644: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn.at:18644"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18644"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18644" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn.at:18644: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:18644"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18644"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18644: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:18644"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18644"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18644" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:18644: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:18644"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18644"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18644: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:18644"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18644"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18644" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn.at:18644: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:18644"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18644"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18644: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:18644"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18644"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18644" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn.at:18644: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:18644"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18644"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18644: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:18644"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18644"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18644" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn.at:18644: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:18644"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18644"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18644: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:18644"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18644"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18644" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn.at:18644: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn.at:18644"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18644"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18644: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn.at:18644"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18644"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18644" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn.at:18644: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn.at:18644"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18644"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18644: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn.at:18644"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18644"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18644" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn.at:18644: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn.at:18644"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18644"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn.at:18644: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn.at:18644"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn.at:18644"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn.at:18644" "while kill -0 \$TMPPID 2>/dev/null"



ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_129
#AT_START_130
at_fn_group_banner 130 'ovn-performance.at:227' \
  "ovn -- ovn-controller incremental processing" "   " 2
at_xfail=no
(
  $as_echo "130. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

# Check which operations the trigger full logical flow processing.
#
# Create and destroy logical routers, switches, ports, address sets and ACLs
# while counting calls to lflow_run() in ovn-controller.

ovn_start
net_add n1
for i in 1 2; do
    sim_add hv$i
    as hv$i
    ovs-vsctl add-br br-phys
    ovn_attach n1 br-phys 192.168.0.$i
done

# Add router lr1


    rv=$(cmp_counter_delta "hv1 hv2" "ovn-controller" "lflow_run" ">0" "ovn-nbctl --wait=hv lr-add lr1
")
    rc=$?
    { set +x
$as_echo "$at_srcdir/ovn-performance.at:243: test \$rc -eq 0 -a \$rv -eq 1"
at_fn_check_prepare_dynamic "test $rc -eq 0 -a $rv -eq 1" "ovn-performance.at:243"
( $at_check_trace; test $rc -eq 0 -a $rv -eq 1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-performance.at:243"
$at_failed && at_fn_log_failure
$at_traceon; }




for i in 1 2; do
    ls=ls$i
    lsp=$ls-lr1
    lrp=lr1-$ls

    # Add switch $ls


    rv=$(cmp_counter_delta "hv1 hv2" "ovn-controller" "lflow_run" ">0" "ovn-nbctl --wait=hv ls-add $ls
    ")
    rc=$?
    { set +x
$as_echo "$at_srcdir/ovn-performance.at:254: test \$rc -eq 0 -a \$rv -eq 1"
at_fn_check_prepare_dynamic "test $rc -eq 0 -a $rv -eq 1" "ovn-performance.at:254"
( $at_check_trace; test $rc -eq 0 -a $rv -eq 1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-performance.at:254"
$at_failed && at_fn_log_failure
$at_traceon; }





    rv=$(cmp_counter_delta "hv1 hv2" "ovn-controller" "lflow_run" "=0" "ovn-nbctl --wait=hv add Logical_Switch $ls other_config subnet=10.0.$i.0/24
    ")
    rc=$?
    { set +x
$as_echo "$at_srcdir/ovn-performance.at:258: test \$rc -eq 0 -a \$rv -eq 1"
at_fn_check_prepare_dynamic "test $rc -eq 0 -a $rv -eq 1" "ovn-performance.at:258"
( $at_check_trace; test $rc -eq 0 -a $rv -eq 1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-performance.at:258"
$at_failed && at_fn_log_failure
$at_traceon; }




    # Add router port to $ls


    rv=$(cmp_counter_delta "hv1 hv2" "ovn-controller" "lflow_run" ">0" "ovn-nbctl --wait=hv lrp-add lr1 $lrp 02:00:00:00:0$i:01 10.0.$i.1/24
    ")
    rc=$?
    { set +x
$as_echo "$at_srcdir/ovn-performance.at:264: test \$rc -eq 0 -a \$rv -eq 1"
at_fn_check_prepare_dynamic "test $rc -eq 0 -a $rv -eq 1" "ovn-performance.at:264"
( $at_check_trace; test $rc -eq 0 -a $rv -eq 1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-performance.at:264"
$at_failed && at_fn_log_failure
$at_traceon; }





    rv=$(cmp_counter_delta "hv1 hv2" "ovn-controller" "lflow_run" "=0" "ovn-nbctl --wait=hv lsp-add $ls $lsp
    ")
    rc=$?
    { set +x
$as_echo "$at_srcdir/ovn-performance.at:268: test \$rc -eq 0 -a \$rv -eq 1"
at_fn_check_prepare_dynamic "test $rc -eq 0 -a $rv -eq 1" "ovn-performance.at:268"
( $at_check_trace; test $rc -eq 0 -a $rv -eq 1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-performance.at:268"
$at_failed && at_fn_log_failure
$at_traceon; }





    rv=$(cmp_counter_delta "hv1 hv2" "ovn-controller" "lflow_run" ">0" "ovn-nbctl --wait=hv lsp-set-type $lsp router
    ")
    rc=$?
    { set +x
$as_echo "$at_srcdir/ovn-performance.at:272: test \$rc -eq 0 -a \$rv -eq 1"
at_fn_check_prepare_dynamic "test $rc -eq 0 -a $rv -eq 1" "ovn-performance.at:272"
( $at_check_trace; test $rc -eq 0 -a $rv -eq 1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-performance.at:272"
$at_failed && at_fn_log_failure
$at_traceon; }





    rv=$(cmp_counter_delta "hv1 hv2" "ovn-controller" "lflow_run" ">0" "ovn-nbctl --wait=hv lsp-set-options $lsp router-port=$lrp
    ")
    rc=$?
    { set +x
$as_echo "$at_srcdir/ovn-performance.at:276: test \$rc -eq 0 -a \$rv -eq 1"
at_fn_check_prepare_dynamic "test $rc -eq 0 -a $rv -eq 1" "ovn-performance.at:276"
( $at_check_trace; test $rc -eq 0 -a $rv -eq 1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-performance.at:276"
$at_failed && at_fn_log_failure
$at_traceon; }





    rv=$(cmp_counter_delta "hv1 hv2" "ovn-controller" "lflow_run" ">0" "ovn-nbctl --wait=hv lsp-set-addresses $lsp router
    ")
    rc=$?
    { set +x
$as_echo "$at_srcdir/ovn-performance.at:280: test \$rc -eq 0 -a \$rv -eq 1"
at_fn_check_prepare_dynamic "test $rc -eq 0 -a $rv -eq 1" "ovn-performance.at:280"
( $at_check_trace; test $rc -eq 0 -a $rv -eq 1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-performance.at:280"
$at_failed && at_fn_log_failure
$at_traceon; }



done

get_lsp_uuid () {
    ovn-nbctl lsp-list ls${1#lp} | grep $1 | awk '{ print $1 }'
}

pg_ports=

for i in 1 2; do
    j=$((i%2 + 1))
    as=as$i
    ls=ls$i
    lp=lp$i
    vif=vif$i

    # Add port $lp


    rv=$(cmp_counter_delta "hv1 hv2" "ovn-controller" "lflow_run" "=0" "ovn-nbctl --wait=hv lsp-add $ls $lp
    ")
    rc=$?
    { set +x
$as_echo "$at_srcdir/ovn-performance.at:300: test \$rc -eq 0 -a \$rv -eq 1"
at_fn_check_prepare_dynamic "test $rc -eq 0 -a $rv -eq 1" "ovn-performance.at:300"
( $at_check_trace; test $rc -eq 0 -a $rv -eq 1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-performance.at:300"
$at_failed && at_fn_log_failure
$at_traceon; }




    pg_ports="$pg_port `get_lsp_uuid $lp`"



    rv=$(cmp_counter_delta "hv1 hv2" "ovn-controller" "lflow_run" "=0" "ovn-nbctl --wait=hv lsp-set-addresses $lp "dynamic"
    ")
    rc=$?
    { set +x
$as_echo "$at_srcdir/ovn-performance.at:307: test \$rc -eq 0 -a \$rv -eq 1"
at_fn_check_prepare_dynamic "test $rc -eq 0 -a $rv -eq 1" "ovn-performance.at:307"
( $at_check_trace; test $rc -eq 0 -a $rv -eq 1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-performance.at:307"
$at_failed && at_fn_log_failure
$at_traceon; }





    rv=$(cmp_counter_delta "hv1 hv2" "ovn-controller" "lflow_run" "=0" "ovn-nbctl wait-until Logical_Switch_Port $lp dynamic_addresses!=[] &&
         ovn-nbctl --wait=hv sync
    ")
    rc=$?
    { set +x
$as_echo "$at_srcdir/ovn-performance.at:311: test \$rc -eq 0 -a \$rv -eq 1"
at_fn_check_prepare_dynamic "test $rc -eq 0 -a $rv -eq 1" "ovn-performance.at:311"
( $at_check_trace; test $rc -eq 0 -a $rv -eq 1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-performance.at:311"
$at_failed && at_fn_log_failure
$at_traceon; }





    rv=$(cmp_counter_delta "hv1 hv2" "ovn-controller" "lflow_run" "=0" "ovn-nbctl get Logical_Switch_Port $lp dynamic_addresses &&
         ovn-nbctl --wait=hv sync
    ")
    rc=$?
    { set +x
$as_echo "$at_srcdir/ovn-performance.at:316: test \$rc -eq 0 -a \$rv -eq 1"
at_fn_check_prepare_dynamic "test $rc -eq 0 -a $rv -eq 1" "ovn-performance.at:316"
( $at_check_trace; test $rc -eq 0 -a $rv -eq 1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-performance.at:316"
$at_failed && at_fn_log_failure
$at_traceon; }




    # Add address set $as


    rv=$(cmp_counter_delta "hv1 hv2" "ovn-controller" "lflow_run" "=0" "ovn-nbctl --wait=hv create Address_Set name="$as"
    ")
    rc=$?
    { set +x
$as_echo "$at_srcdir/ovn-performance.at:323: test \$rc -eq 0 -a \$rv -eq 1"
at_fn_check_prepare_dynamic "test $rc -eq 0 -a $rv -eq 1" "ovn-performance.at:323"
( $at_check_trace; test $rc -eq 0 -a $rv -eq 1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-performance.at:323"
$at_failed && at_fn_log_failure
$at_traceon; }





    rv=$(cmp_counter_delta "hv1 hv2" "ovn-controller" "lflow_run" "=0" "ovn-nbctl --wait=hv add Address_Set "$as" addresses "10.0.$i.10"
    ")
    rc=$?
    { set +x
$as_echo "$at_srcdir/ovn-performance.at:327: test \$rc -eq 0 -a \$rv -eq 1"
at_fn_check_prepare_dynamic "test $rc -eq 0 -a $rv -eq 1" "ovn-performance.at:327"
( $at_check_trace; test $rc -eq 0 -a $rv -eq 1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-performance.at:327"
$at_failed && at_fn_log_failure
$at_traceon; }




    # Add ACLs for port $lp


    rv=$(cmp_counter_delta "hv1 hv2" "ovn-controller" "lflow_run" "=0" "ovn-nbctl --wait=hv acl-add $ls to-lport 1001 'outport == \"$lp\" && ip4.src == \$$as' allow
    ")
    rc=$?
    { set +x
$as_echo "$at_srcdir/ovn-performance.at:333: test \$rc -eq 0 -a \$rv -eq 1"
at_fn_check_prepare_dynamic "test $rc -eq 0 -a $rv -eq 1" "ovn-performance.at:333"
( $at_check_trace; test $rc -eq 0 -a $rv -eq 1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-performance.at:333"
$at_failed && at_fn_log_failure
$at_traceon; }





    rv=$(cmp_counter_delta "hv1 hv2" "ovn-controller" "lflow_run" "=0" "ovn-nbctl --wait=hv acl-add $ls to-lport 1000 'outport == \"$lp\"' drop
    ")
    rc=$?
    { set +x
$as_echo "$at_srcdir/ovn-performance.at:337: test \$rc -eq 0 -a \$rv -eq 1"
at_fn_check_prepare_dynamic "test $rc -eq 0 -a $rv -eq 1" "ovn-performance.at:337"
( $at_check_trace; test $rc -eq 0 -a $rv -eq 1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-performance.at:337"
$at_failed && at_fn_log_failure
$at_traceon; }




    # Bind port $lp and wait for it to come up


    rv=$(vec_cmp_counter_delta "hv$i hv$j" "ovn-controller" "lflow_run" ">0 =0" "as hv$i ovs-vsctl add-port br-int $vif -- set Interface $vif external-ids:iface-id=$lp &&
         ovn-nbctl wait-until Logical_Switch_Port $lp 'up=true' &&
         ovn-nbctl --wait=hv sync
    ")
    rc=$?
    { set +x
$as_echo "$at_srcdir/ovn-performance.at:343: test \$rc -eq 0 -a \$rv -eq 1"
at_fn_check_prepare_dynamic "test $rc -eq 0 -a $rv -eq 1" "ovn-performance.at:343"
( $at_check_trace; test $rc -eq 0 -a $rv -eq 1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-performance.at:343"
$at_failed && at_fn_log_failure
$at_traceon; }



done

for i in 1 2; do
    j=$((i%2 + 1))
    as=as$i
    ls=ls$i
    lp=lp$i

    # Delete ACLs for port $lp


    rv=$(cmp_counter_delta "hv1 hv2" "ovn-controller" "lflow_run" "=0" "ovn-nbctl --wait=hv acl-del $ls to-lport 1001 'outport == \"$lp\" && ip4.src == \$$as'
    ")
    rc=$?
    { set +x
$as_echo "$at_srcdir/ovn-performance.at:358: test \$rc -eq 0 -a \$rv -eq 1"
at_fn_check_prepare_dynamic "test $rc -eq 0 -a $rv -eq 1" "ovn-performance.at:358"
( $at_check_trace; test $rc -eq 0 -a $rv -eq 1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-performance.at:358"
$at_failed && at_fn_log_failure
$at_traceon; }





    rv=$(cmp_counter_delta "hv1 hv2" "ovn-controller" "lflow_run" "=0" "ovn-nbctl --wait=hv acl-del $ls to-lport 1000 'outport == \"$lp\"'
    ")
    rc=$?
    { set +x
$as_echo "$at_srcdir/ovn-performance.at:362: test \$rc -eq 0 -a \$rv -eq 1"
at_fn_check_prepare_dynamic "test $rc -eq 0 -a $rv -eq 1" "ovn-performance.at:362"
( $at_check_trace; test $rc -eq 0 -a $rv -eq 1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-performance.at:362"
$at_failed && at_fn_log_failure
$at_traceon; }




    # Delete address set $as


    rv=$(cmp_counter_delta "hv1 hv2" "ovn-controller" "lflow_run" "=0" "ovn-nbctl --wait=hv remove Address_Set "$as" addresses "10.0.$i.10"
    ")
    rc=$?
    { set +x
$as_echo "$at_srcdir/ovn-performance.at:368: test \$rc -eq 0 -a \$rv -eq 1"
at_fn_check_prepare_dynamic "test $rc -eq 0 -a $rv -eq 1" "ovn-performance.at:368"
( $at_check_trace; test $rc -eq 0 -a $rv -eq 1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-performance.at:368"
$at_failed && at_fn_log_failure
$at_traceon; }





    rv=$(cmp_counter_delta "hv1 hv2" "ovn-controller" "lflow_run" "=0" "ovn-nbctl --wait=hv destroy Address_Set "$as"
    ")
    rc=$?
    { set +x
$as_echo "$at_srcdir/ovn-performance.at:372: test \$rc -eq 0 -a \$rv -eq 1"
at_fn_check_prepare_dynamic "test $rc -eq 0 -a $rv -eq 1" "ovn-performance.at:372"
( $at_check_trace; test $rc -eq 0 -a $rv -eq 1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-performance.at:372"
$at_failed && at_fn_log_failure
$at_traceon; }



done



    rv=$(cmp_counter_delta "hv1 hv2" "ovn-controller" "lflow_run" "=0" "ovn-nbctl --wait=hv create Port_Group name=pg1 ports=\"$pg_ports\"
")
    rc=$?
    { set +x
$as_echo "$at_srcdir/ovn-performance.at:378: test \$rc -eq 0 -a \$rv -eq 1"
at_fn_check_prepare_dynamic "test $rc -eq 0 -a $rv -eq 1" "ovn-performance.at:378"
( $at_check_trace; test $rc -eq 0 -a $rv -eq 1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-performance.at:378"
$at_failed && at_fn_log_failure
$at_traceon; }




# Add ACLs for port group pg1


    rv=$(cmp_counter_delta "hv1 hv2" "ovn-controller" "lflow_run" "=0" "ovn-nbctl --wait=hv acl-add pg1 to-lport 1001 'outport == @pg1 && ip4.src == $pg1_ip4' allow
")
    rc=$?
    { set +x
$as_echo "$at_srcdir/ovn-performance.at:384: test \$rc -eq 0 -a \$rv -eq 1"
at_fn_check_prepare_dynamic "test $rc -eq 0 -a $rv -eq 1" "ovn-performance.at:384"
( $at_check_trace; test $rc -eq 0 -a $rv -eq 1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-performance.at:384"
$at_failed && at_fn_log_failure
$at_traceon; }




for i in 1 2; do
    j=$((i%2 + 1))
    lp=lp$i

    # Delete port $lp


    rv=$(vec_cmp_counter_delta "hv$i hv$j" "ovn-controller" "lflow_run" ">0 =0" "ovn-nbctl --wait=hv lsp-del $lp
    ")
    rc=$?
    { set +x
$as_echo "$at_srcdir/ovn-performance.at:394: test \$rc -eq 0 -a \$rv -eq 1"
at_fn_check_prepare_dynamic "test $rc -eq 0 -a $rv -eq 1" "ovn-performance.at:394"
( $at_check_trace; test $rc -eq 0 -a $rv -eq 1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-performance.at:394"
$at_failed && at_fn_log_failure
$at_traceon; }



done

# Delete port group pg1


    rv=$(cmp_counter_delta "hv1 hv2" "ovn-controller" "lflow_run" "=0" "ovn-nbctl --wait=hv destroy Port_Group pg1
")
    rc=$?
    { set +x
$as_echo "$at_srcdir/ovn-performance.at:401: test \$rc -eq 0 -a \$rv -eq 1"
at_fn_check_prepare_dynamic "test $rc -eq 0 -a $rv -eq 1" "ovn-performance.at:401"
( $at_check_trace; test $rc -eq 0 -a $rv -eq 1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-performance.at:401"
$at_failed && at_fn_log_failure
$at_traceon; }




for i in 1 2; do
    ls=ls$i

    # Delete switch $ls


    rv=$(cmp_counter_delta "hv1 hv2" "ovn-controller" "lflow_run" ">0" "ovn-nbctl --wait=hv ls-del $ls
    ")
    rc=$?
    { set +x
$as_echo "$at_srcdir/ovn-performance.at:410: test \$rc -eq 0 -a \$rv -eq 1"
at_fn_check_prepare_dynamic "test $rc -eq 0 -a $rv -eq 1" "ovn-performance.at:410"
( $at_check_trace; test $rc -eq 0 -a $rv -eq 1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-performance.at:410"
$at_failed && at_fn_log_failure
$at_traceon; }



done

# Delete router lr1


    rv=$(cmp_counter_delta "hv1 hv2" "ovn-controller" "lflow_run" ">0" "ovn-nbctl --wait=hv lr-del lr1
")
    rc=$?
    { set +x
$as_echo "$at_srcdir/ovn-performance.at:417: test \$rc -eq 0 -a \$rv -eq 1"
at_fn_check_prepare_dynamic "test $rc -eq 0 -a $rv -eq 1" "ovn-performance.at:417"
( $at_check_trace; test $rc -eq 0 -a $rv -eq 1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-performance.at:417"
$at_failed && at_fn_log_failure
$at_traceon; }







    as hv1
    if test "hv1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn-performance.at:422: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn-performance.at:422"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-performance.at:422"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn-performance.at:422: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn-performance.at:422"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-performance.at:422"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-performance.at:422" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn-performance.at:422: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn-performance.at:422"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-performance.at:422"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn-performance.at:422: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn-performance.at:422"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-performance.at:422"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-performance.at:422" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn-performance.at:422: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn-performance.at:422"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-performance.at:422"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn-performance.at:422: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn-performance.at:422"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-performance.at:422"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-performance.at:422" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv1
    { set +x
$as_echo "$at_srcdir/ovn-performance.at:422: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn-performance.at:422"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-performance.at:422"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn-performance.at:422: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn-performance.at:422"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-performance.at:422"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-performance.at:422" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn-performance.at:422: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-performance.at:422"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-performance.at:422"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-performance.at:422: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-performance.at:422"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-performance.at:422"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-performance.at:422" "while kill -0 \$TMPPID 2>/dev/null"





    as hv2
    if test "hv2" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn-performance.at:422: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn-performance.at:422"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-performance.at:422"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn-performance.at:422: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn-performance.at:422"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-performance.at:422"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-performance.at:422" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn-performance.at:422: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn-performance.at:422"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-performance.at:422"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn-performance.at:422: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn-performance.at:422"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-performance.at:422"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-performance.at:422" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn-performance.at:422: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn-performance.at:422"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-performance.at:422"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn-performance.at:422: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn-performance.at:422"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-performance.at:422"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-performance.at:422" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv2
    { set +x
$as_echo "$at_srcdir/ovn-performance.at:422: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn-performance.at:422"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-performance.at:422"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn-performance.at:422: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn-performance.at:422"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-performance.at:422"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-performance.at:422" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn-performance.at:422: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-performance.at:422"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-performance.at:422"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-performance.at:422: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-performance.at:422"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-performance.at:422"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-performance.at:422" "while kill -0 \$TMPPID 2>/dev/null"




    as ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn-performance.at:422: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-performance.at:422"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-performance.at:422"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-performance.at:422: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-performance.at:422"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-performance.at:422"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-performance.at:422" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn-performance.at:422: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-performance.at:422"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-performance.at:422"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-performance.at:422: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-performance.at:422"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-performance.at:422"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-performance.at:422" "while kill -0 \$TMPPID 2>/dev/null"


    as northd
    { set +x
$as_echo "$at_srcdir/ovn-performance.at:422: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn-performance.at:422"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-performance.at:422"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn-performance.at:422: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn-performance.at:422"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-performance.at:422"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-performance.at:422" "while kill -0 \$TMPPID 2>/dev/null"


    as northd-backup
    { set +x
$as_echo "$at_srcdir/ovn-performance.at:422: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn-performance.at:422"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-performance.at:422"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn-performance.at:422: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn-performance.at:422"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-performance.at:422"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-performance.at:422" "while kill -0 \$TMPPID 2>/dev/null"



    as main
    { set +x
$as_echo "$at_srcdir/ovn-performance.at:422: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn-performance.at:422"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-performance.at:422"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn-performance.at:422: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn-performance.at:422"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-performance.at:422"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-performance.at:422" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn-performance.at:422: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-performance.at:422"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-performance.at:422"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-performance.at:422: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-performance.at:422"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-performance.at:422"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-performance.at:422" "while kill -0 \$TMPPID 2>/dev/null"




ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_130
#AT_START_131
at_fn_group_banner 131 'ovn-northd.at:2' \
  "ovn -- check   from NBDB to SBDB" "               " 3
at_xfail=no
(
  $as_echo "131. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

ovn-nbctl create Logical_Router name=R1
ovn-sbctl chassis-add gw1 geneve 127.0.0.1
ovn-sbctl chassis-add gw2 geneve 1.2.4.8

# Connect alice to R1 as distributed router gateway port on hv2
ovn-nbctl lrp-add R1 alice 00:00:02:01:02:03 172.16.1.1/24

ovn-nbctl --wait=sb \
    --id=@gc0 create Gateway_Chassis name=alice_gw1 \
                                     chassis_name=gw1 \
                                     priority=20 -- \
    --id=@gc1 create Gateway_Chassis name=alice_gw2 \
                                     chassis_name=gw2 \
                                     priority=10 -- \
    set Logical_Router_Port alice 'gateway_chassis=@gc0,@gc1'

nb_gwc1_uuid=`ovn-nbctl --bare --columns _uuid find Gateway_Chassis name="alice_gw1"`

# With the new ha_chassis_group table added, there should be no rows in
# gateway_chassis table in SB DB.
{ set +x
$as_echo "$at_srcdir/ovn-northd.at:25: ovn-sbctl list gateway_chassis | wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-northd.at:25"
( $at_check_trace; ovn-sbctl list gateway_chassis | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:25"
$at_failed && at_fn_log_failure
$at_traceon; }


# There should be one ha_chassis_group with the name "alice"
ha_chassi_grp_name=`ovn-sbctl --bare --columns name find \
ha_chassis_group name="alice"`

{ set +x
$as_echo "$at_srcdir/ovn-northd.at:32: test \$ha_chassi_grp_name = alice"
at_fn_check_prepare_dynamic "test $ha_chassi_grp_name = alice" "ovn-northd.at:32"
( $at_check_trace; test $ha_chassi_grp_name = alice
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:32"
$at_failed && at_fn_log_failure
$at_traceon; }


ha_chgrp_uuid=`ovn-sbctl --bare --columns _uuid find ha_chassis_group name=alice`

{ set +x
$as_echo "$at_srcdir/ovn-northd.at:36: ovn-sbctl --bare --columns ha_chassis_group find port_binding \\
logical_port=\"cr-alice\" | grep \$ha_chgrp_uuid | wc -l"
at_fn_check_prepare_notrace 'an embedded newline' "ovn-northd.at:36"
( $at_check_trace; ovn-sbctl --bare --columns ha_chassis_group find port_binding \
logical_port="cr-alice" | grep $ha_chgrp_uuid | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:36"
$at_failed && at_fn_log_failure
$at_traceon; }


# There should be one ha_chassis_group with the name "alice"
ha_chassi_grp_name=`ovn-sbctl --bare --columns name find \
ha_chassis_group name="alice"`

{ set +x
$as_echo "$at_srcdir/ovn-northd.at:44: test \$ha_chassi_grp_name = alice"
at_fn_check_prepare_dynamic "test $ha_chassi_grp_name = alice" "ovn-northd.at:44"
( $at_check_trace; test $ha_chassi_grp_name = alice
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:44"
$at_failed && at_fn_log_failure
$at_traceon; }


ha_chgrp_uuid=`ovn-sbctl --bare --columns _uuid find ha_chassis_group name=alice`

{ set +x
$as_echo "$at_srcdir/ovn-northd.at:48: ovn-sbctl --bare --columns ha_chassis_group find port_binding \\
logical_port=\"cr-alice\" | grep \$ha_chgrp_uuid | wc -l"
at_fn_check_prepare_notrace 'an embedded newline' "ovn-northd.at:48"
( $at_check_trace; ovn-sbctl --bare --columns ha_chassis_group find port_binding \
logical_port="cr-alice" | grep $ha_chgrp_uuid | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:48"
$at_failed && at_fn_log_failure
$at_traceon; }


ha_ch=`ovn-sbctl --bare --columns ha_chassis  find ha_chassis_group`
# Trim the spaces.
ha_ch=`echo $ha_ch | sed 's/ //g'`

ha_ch_list=''
for i in `ovn-sbctl --bare --columns _uuid list ha_chassis | sort`
do
    ha_ch_list="$ha_ch_list $i"
done

# Trim the spaces.
ha_ch_list=`echo $ha_ch_list | sed 's/ //g'`

{ set +x
$as_echo "$at_srcdir/ovn-northd.at:65: test \"\$ha_ch_list\" = \"\$ha_ch\""
at_fn_check_prepare_dynamic "test \"$ha_ch_list\" = \"$ha_ch\"" "ovn-northd.at:65"
( $at_check_trace; test "$ha_ch_list" = "$ha_ch"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:65"
$at_failed && at_fn_log_failure
$at_traceon; }


# Delete chassis - gw2 in SB DB.
# ovn-northd should not recreate ha_chassis rows
# repeatedly when gw2 is deleted.
ovn-sbctl chassis-del gw2

ha_ch_list_1=''
for i in `ovn-sbctl --bare --columns _uuid list ha_chassis | sort`
do
    ha_ch_list_1="$ha_ch_list_1 $i"
done

# Trim the spaces.
ha_ch_list_1=`echo $ha_ch_list_1 | sed 's/ //g'`

ha_ch_list_2=''
for i in `ovn-sbctl --bare --columns _uuid list ha_chassis | sort`
do
    ha_ch_list_2="$ha_ch_list_2 $i"
done

# Trim the spaces.
ha_ch_list_2=`echo $ha_ch_list_2 | sed 's/ //g'`

{ set +x
$as_echo "$at_srcdir/ovn-northd.at:90: test \"\$ha_ch_list_1\" = \"\$ha_ch_list_2\""
at_fn_check_prepare_dynamic "test \"$ha_ch_list_1\" = \"$ha_ch_list_2\"" "ovn-northd.at:90"
( $at_check_trace; test "$ha_ch_list_1" = "$ha_ch_list_2"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:90"
$at_failed && at_fn_log_failure
$at_traceon; }


# Add back the gw2 chassis
ovn-sbctl chassis-add gw2 geneve 1.2.4.8

# delete the 2nd Gateway_Chassis on NBDB for alice port
gw_ch=`ovn-sbctl --bare --columns gateway_chassis find port_binding \
logical_port="cr-alice"`
{ set +x
$as_echo "$at_srcdir/ovn-northd.at:98: test \"\$gw_ch\" = \"\""
at_fn_check_prepare_dynamic "test \"$gw_ch\" = \"\"" "ovn-northd.at:98"
( $at_check_trace; test "$gw_ch" = ""
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:98"
$at_failed && at_fn_log_failure
$at_traceon; }


ha_ch=`ovn-sbctl --bare --columns ha_chassis  find ha_chassis_group`
ha_ch=`echo $ha_ch | sed 's/ //g'`
# Trim the spaces.
echo "ha ch in grp = $ha_ch"

ha_ch_list=''
for i in `ovn-sbctl --bare --columns _uuid list ha_chassis | sort`
do
    ha_ch_list="$ha_ch_list $i"
done

# Trim the spaces.
ha_ch_list=`echo $ha_ch_list | sed 's/ //g'`

{ set +x
$as_echo "$at_srcdir/ovn-northd.at:114: test \"\$ha_ch_list\" = \"\$ha_ch\""
at_fn_check_prepare_dynamic "test \"$ha_ch_list\" = \"$ha_ch\"" "ovn-northd.at:114"
( $at_check_trace; test "$ha_ch_list" = "$ha_ch"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:114"
$at_failed && at_fn_log_failure
$at_traceon; }


# delete the 2nd Gateway_Chassis on NBDB for alice port
ovn-nbctl --wait=sb set Logical_Router_Port alice gateway_chassis=${nb_gwc1_uuid}

# There should be only 1 row in ha_chassis SB DB table.
{ set +x
$as_echo "$at_srcdir/ovn-northd.at:120: ovn-sbctl --bare --columns _uuid list ha_chassis | wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-northd.at:120"
( $at_check_trace; ovn-sbctl --bare --columns _uuid list ha_chassis | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:120"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-northd.at:123: ovn-sbctl list gateway_chassis | wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-northd.at:123"
( $at_check_trace; ovn-sbctl list gateway_chassis | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:123"
$at_failed && at_fn_log_failure
$at_traceon; }


# There should be only 1 row in ha_chassis SB DB table.
{ set +x
$as_echo "$at_srcdir/ovn-northd.at:127: ovn-sbctl --bare --columns _uuid list ha_chassis | wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-northd.at:127"
( $at_check_trace; ovn-sbctl --bare --columns _uuid list ha_chassis | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:127"
$at_failed && at_fn_log_failure
$at_traceon; }


# delete all the gateway_chassis on NBDB for alice port

ovn-nbctl --wait=sb clear Logical_Router_Port alice gateway_chassis

# expect that the ha_chassis doesn't exist anymore
{ set +x
$as_echo "$at_srcdir/ovn-northd.at:135: ovn-sbctl list gateway_chassis | wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-northd.at:135"
( $at_check_trace; ovn-sbctl list gateway_chassis | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:135"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-northd.at:138: ovn-sbctl list ha_chassis | wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-northd.at:138"
( $at_check_trace; ovn-sbctl list ha_chassis | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:138"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-northd.at:141: ovn-sbctl list ha_chassis_group | wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-northd.at:141"
( $at_check_trace; ovn-sbctl list ha_chassis_group | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:141"
$at_failed && at_fn_log_failure
$at_traceon; }


# expect that the ha_chassis doesn't exist anymore
{ set +x
$as_echo "$at_srcdir/ovn-northd.at:145: ovn-sbctl list ha_chassis | wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-northd.at:145"
( $at_check_trace; ovn-sbctl list ha_chassis | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:145"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-northd.at:147: ovn-sbctl list ha_chassis_group | wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-northd.at:147"
( $at_check_trace; ovn-sbctl list ha_chassis_group | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:147"
$at_failed && at_fn_log_failure
$at_traceon; }


ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_131
#AT_START_132
at_fn_group_banner 132 'ovn-northd.at:152' \
  "ovn -- check Gateway_Chassis propagation from NBDB to SBDB backwards compatibility" "" 3
at_xfail=no
(
  $as_echo "132. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

ovn-nbctl create Logical_Router name=R1
ovn-sbctl chassis-add gw1 geneve 127.0.0.1
ovn-sbctl chassis-add gw2 geneve 1.2.4.8

ovn-nbctl --wait=sb lrp-add R1 bob 00:00:02:01:02:03 172.16.1.1/24 \
    -- set Logical_Router_Port bob options:redirect-chassis="gw1"


# It should be converted to ha_chassis_group entries in SBDB, and
# still redirect-chassis is kept for backwards compatibility

{ set +x
$as_echo "$at_srcdir/ovn-northd.at:166: ovn-sbctl list gateway_chassis | wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-northd.at:166"
( $at_check_trace; ovn-sbctl list gateway_chassis | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:166"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-northd.at:169: ovn-sbctl --bare --columns _uuid list ha_chassis | wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-northd.at:169"
( $at_check_trace; ovn-sbctl --bare --columns _uuid list ha_chassis | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:169"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-northd.at:172: ovn-sbctl --bare --columns _uuid list ha_chassis_group | wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-northd.at:172"
( $at_check_trace; ovn-sbctl --bare --columns _uuid list ha_chassis_group | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:172"
$at_failed && at_fn_log_failure
$at_traceon; }


# There should be one ha_chassis_group with the name "bob_gw1"
ha_chassi_grp_name=`ovn-sbctl --bare --columns name find \
ha_chassis_group name="bob_gw1"`

{ set +x
$as_echo "$at_srcdir/ovn-northd.at:179: test \$ha_chassi_grp_name = bob_gw1"
at_fn_check_prepare_dynamic "test $ha_chassi_grp_name = bob_gw1" "ovn-northd.at:179"
( $at_check_trace; test $ha_chassi_grp_name = bob_gw1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:179"
$at_failed && at_fn_log_failure
$at_traceon; }


ha_chgrp_uuid=`ovn-sbctl --bare --columns _uuid find ha_chassis_group name=bob_gw1`

{ set +x
$as_echo "$at_srcdir/ovn-northd.at:183: ovn-sbctl --bare --columns ha_chassis_group find port_binding \\
logical_port=\"cr-bob\" | grep \$ha_chgrp_uuid | wc -l"
at_fn_check_prepare_notrace 'an embedded newline' "ovn-northd.at:183"
( $at_check_trace; ovn-sbctl --bare --columns ha_chassis_group find port_binding \
logical_port="cr-bob" | grep $ha_chgrp_uuid | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:183"
$at_failed && at_fn_log_failure
$at_traceon; }


ovn-nbctl --wait=sb remove Logical_Router_Port bob options redirect-chassis

# expect that the ha_chassis/ha_chassis_group doesn't exist anymore

{ set +x
$as_echo "$at_srcdir/ovn-northd.at:191: ovn-sbctl find Gateway_Chassis name=bob_gw1"
at_fn_check_prepare_trace "ovn-northd.at:191"
( $at_check_trace; ovn-sbctl find Gateway_Chassis name=bob_gw1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:191"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-northd.at:192: ovn-sbctl list ha_chassis | wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-northd.at:192"
( $at_check_trace; ovn-sbctl list ha_chassis | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:192"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-northd.at:195: ovn-sbctl list ha_chassis_group | wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-northd.at:195"
( $at_check_trace; ovn-sbctl list ha_chassis_group | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:195"
$at_failed && at_fn_log_failure
$at_traceon; }


ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_132
#AT_START_133
at_fn_group_banner 133 'ovn-northd.at:200' \
  "ovn -- check up state of VIF LSP" "               " 3
at_xfail=no
(
  $as_echo "133. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

ovn-nbctl ls-add S1
ovn-nbctl --wait=sb lsp-add S1 S1-vm1
{ set +x
$as_echo "$at_srcdir/ovn-northd.at:205: test x\`ovn-nbctl lsp-get-up S1-vm1\` = xdown"
at_fn_check_prepare_notrace 'a `...` command substitution' "ovn-northd.at:205"
( $at_check_trace; test x`ovn-nbctl lsp-get-up S1-vm1` = xdown
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:205"
$at_failed && at_fn_log_failure
$at_traceon; }


ovn-sbctl chassis-add hv1 geneve 127.0.0.1
ovn-sbctl lsp-bind S1-vm1 hv1
{ set +x
$as_echo "$at_srcdir/ovn-northd.at:209: test x\`ovn-nbctl lsp-get-up S1-vm1\` = xup"
at_fn_check_prepare_notrace 'a `...` command substitution' "ovn-northd.at:209"
( $at_check_trace; test x`ovn-nbctl lsp-get-up S1-vm1` = xup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:209"
$at_failed && at_fn_log_failure
$at_traceon; }


ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_133
#AT_START_134
at_fn_group_banner 134 'ovn-northd.at:213' \
  "ovn -- check up state of router LSP linked to a distributed LR" "" 3
at_xfail=no
(
  $as_echo "134. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

ovn-nbctl lr-add R1
ovn-nbctl lrp-add R1 R1-S1 02:ac:10:01:00:01 172.16.1.1/24

ovn-nbctl ls-add S1
ovn-nbctl lsp-add S1 S1-R1
ovn-nbctl lsp-set-type S1-R1 router
ovn-nbctl lsp-set-addresses S1-R1 02:ac:10:01:00:01
ovn-nbctl --wait=sb lsp-set-options S1-R1 router-port=R1-S1
{ set +x
$as_echo "$at_srcdir/ovn-northd.at:224: test x\`ovn-nbctl lsp-get-up S1-R1\` = xup"
at_fn_check_prepare_notrace 'a `...` command substitution' "ovn-northd.at:224"
( $at_check_trace; test x`ovn-nbctl lsp-get-up S1-R1` = xup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:224"
$at_failed && at_fn_log_failure
$at_traceon; }


ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_134
#AT_START_135
at_fn_group_banner 135 'ovn-northd.at:228' \
  "ovn -- check up state of router LSP linked to a gateway LR" "" 3
at_xfail=no
(
  $as_echo "135. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

ovn-sbctl chassis-add gw1 geneve 127.0.0.1

ovn-nbctl create Logical_Router name=R1 options:chassis=gw1
ovn-nbctl lrp-add R1 R1-S1 02:ac:10:01:00:01 172.16.1.1/24

ovn-nbctl ls-add S1
ovn-nbctl lsp-add S1 S1-R1
ovn-nbctl lsp-set-type S1-R1 router
ovn-nbctl lsp-set-addresses S1-R1 02:ac:10:01:00:01
ovn-nbctl --wait=sb lsp-set-options S1-R1 router-port=R1-S1

ovn-sbctl lsp-bind S1-R1 gw1
{ set +x
$as_echo "$at_srcdir/ovn-northd.at:243: test x\`ovn-nbctl lsp-get-up S1-R1\` = xup"
at_fn_check_prepare_notrace 'a `...` command substitution' "ovn-northd.at:243"
( $at_check_trace; test x`ovn-nbctl lsp-get-up S1-R1` = xup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:243"
$at_failed && at_fn_log_failure
$at_traceon; }


ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_135
#AT_START_136
at_fn_group_banner 136 'ovn-northd.at:247' \
  "ovn -- check up state of router LSP linked to an LRP with set Gateway Chassis" "" 3
at_xfail=no
(
  $as_echo "136. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

ovn-sbctl chassis-add gw1 geneve 127.0.0.1

ovn-nbctl lr-add R1
ovn-nbctl lrp-add R1 R1-S1 02:ac:10:01:00:01 172.16.1.1/24
ovn-nbctl lrp-set-gateway-chassis R1-S1 gw1

ovn-nbctl ls-add S1
ovn-nbctl lsp-add S1 S1-R1
ovn-nbctl lsp-set-type S1-R1 router
ovn-nbctl lsp-set-addresses S1-R1 router
ovn-nbctl --wait=sb lsp-set-options S1-R1 router-port=R1-S1
{ set +x
$as_echo "$at_srcdir/ovn-northd.at:261: test x\`ovn-nbctl lsp-get-up S1-R1\` = xup"
at_fn_check_prepare_notrace 'a `...` command substitution' "ovn-northd.at:261"
( $at_check_trace; test x`ovn-nbctl lsp-get-up S1-R1` = xup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:261"
$at_failed && at_fn_log_failure
$at_traceon; }


ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_136
#AT_START_137
at_fn_group_banner 137 'ovn-northd.at:265' \
  "ovn -- check IPv6 RA config propagation to SBDB" "" 3
at_xfail=no
(
  $as_echo "137. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

ovn-nbctl lr-add ro
ovn-nbctl lrp-add ro ro-sw 00:00:00:00:00:01 aef0:0:0:0:0:0:0:1/64
ovn-nbctl ls-add sw
ovn-nbctl lsp-add sw sw-ro
ovn-nbctl lsp-set-type sw-ro router
ovn-nbctl lsp-set-options sw-ro router-port=ro-sw
ovn-nbctl lsp-set-addresses sw-ro 00:00:00:00:00:01
ovn-nbctl set Logical_Router_Port ro-sw ipv6_ra_configs:send_periodic=true
ovn-nbctl set Logical_Router_Port ro-sw ipv6_ra_configs:address_mode=slaac
ovn-nbctl --wait=sb set Logical_Router_Port ro-sw ipv6_ra_configs:mtu=1280

uuid=$(ovn-sbctl --columns=_uuid --bare find Port_Binding logical_port=ro-sw)

{ set +x
$as_echo "$at_srcdir/ovn-northd.at:281: ovn-sbctl get Port_Binding \${uuid} options:ipv6_ra_send_periodic"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "ovn-northd.at:281"
( $at_check_trace; ovn-sbctl get Port_Binding ${uuid} options:ipv6_ra_send_periodic
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"true\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:281"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-northd.at:284: ovn-sbctl get Port_Binding \${uuid} options:ipv6_ra_address_mode"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "ovn-northd.at:284"
( $at_check_trace; ovn-sbctl get Port_Binding ${uuid} options:ipv6_ra_address_mode
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "slaac
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:284"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-northd.at:287: ovn-sbctl get Port_Binding \${uuid} options:ipv6_ra_max_interval"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "ovn-northd.at:287"
( $at_check_trace; ovn-sbctl get Port_Binding ${uuid} options:ipv6_ra_max_interval
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"600\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:287"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-northd.at:290: ovn-sbctl get Port_Binding \${uuid} options:ipv6_ra_min_interval"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "ovn-northd.at:290"
( $at_check_trace; ovn-sbctl get Port_Binding ${uuid} options:ipv6_ra_min_interval
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"200\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:290"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-northd.at:293: ovn-sbctl get Port_Binding \${uuid} options:ipv6_ra_mtu"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "ovn-northd.at:293"
( $at_check_trace; ovn-sbctl get Port_Binding ${uuid} options:ipv6_ra_mtu
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"1280\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:293"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-northd.at:296: ovn-sbctl get Port_Binding \${uuid} options:ipv6_ra_src_eth"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "ovn-northd.at:296"
( $at_check_trace; ovn-sbctl get Port_Binding ${uuid} options:ipv6_ra_src_eth
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"00:00:00:00:00:01\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:296"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-northd.at:299: ovn-sbctl get Port_Binding \${uuid} options:ipv6_ra_src_addr"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "ovn-northd.at:299"
( $at_check_trace; ovn-sbctl get Port_Binding ${uuid} options:ipv6_ra_src_addr
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"fe80::200:ff:fe00:1\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:299"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-northd.at:302: ovn-sbctl get Port_Binding \${uuid} options:ipv6_ra_prefixes"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "ovn-northd.at:302"
( $at_check_trace; ovn-sbctl get Port_Binding ${uuid} options:ipv6_ra_prefixes
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"aef0::/64\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:302"
$at_failed && at_fn_log_failure
$at_traceon; }


ovn-nbctl set Logical_Router_Port ro-sw ipv6_ra_configs:max_interval=300
ovn-nbctl --wait=sb set Logical_Router_Port ro-sw ipv6_ra_configs:min_interval=600

{ set +x
$as_echo "$at_srcdir/ovn-northd.at:309: ovn-sbctl get Port_Binding \${uuid} options:ipv6_ra_max_interval"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "ovn-northd.at:309"
( $at_check_trace; ovn-sbctl get Port_Binding ${uuid} options:ipv6_ra_max_interval
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"300\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:309"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-northd.at:312: ovn-sbctl get Port_Binding \${uuid} options:ipv6_ra_min_interval"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "ovn-northd.at:312"
( $at_check_trace; ovn-sbctl get Port_Binding ${uuid} options:ipv6_ra_min_interval
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"225\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:312"
$at_failed && at_fn_log_failure
$at_traceon; }


ovn-nbctl set Logical_Router_Port ro-sw ipv6_ra_configs:max_interval=300
ovn-nbctl --wait=sb set Logical_Router_Port ro-sw ipv6_ra_configs:min_interval=250

{ set +x
$as_echo "$at_srcdir/ovn-northd.at:319: ovn-sbctl get Port_Binding \${uuid} options:ipv6_ra_max_interval"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "ovn-northd.at:319"
( $at_check_trace; ovn-sbctl get Port_Binding ${uuid} options:ipv6_ra_max_interval
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"300\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:319"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-northd.at:322: ovn-sbctl get Port_Binding \${uuid} options:ipv6_ra_min_interval"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "ovn-northd.at:322"
( $at_check_trace; ovn-sbctl get Port_Binding ${uuid} options:ipv6_ra_min_interval
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"225\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:322"
$at_failed && at_fn_log_failure
$at_traceon; }


ovn-nbctl set Logical_Router_Port ro-sw ipv6_ra_configs:max_interval=0
ovn-nbctl --wait=sb set Logical_Router_Port ro-sw ipv6_ra_configs:min_interval=0

{ set +x
$as_echo "$at_srcdir/ovn-northd.at:329: ovn-sbctl get Port_Binding \${uuid} options:ipv6_ra_max_interval"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "ovn-northd.at:329"
( $at_check_trace; ovn-sbctl get Port_Binding ${uuid} options:ipv6_ra_max_interval
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"4\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:329"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-northd.at:332: ovn-sbctl get Port_Binding \${uuid} options:ipv6_ra_min_interval"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "ovn-northd.at:332"
( $at_check_trace; ovn-sbctl get Port_Binding ${uuid} options:ipv6_ra_min_interval
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"3\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:332"
$at_failed && at_fn_log_failure
$at_traceon; }


ovn-nbctl set Logical_Router_Port ro-sw ipv6_ra_configs:max_interval=3600
ovn-nbctl --wait=sb set Logical_Router_Port ro-sw ipv6_ra_configs:min_interval=2400

{ set +x
$as_echo "$at_srcdir/ovn-northd.at:339: ovn-sbctl get Port_Binding \${uuid} options:ipv6_ra_max_interval"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "ovn-northd.at:339"
( $at_check_trace; ovn-sbctl get Port_Binding ${uuid} options:ipv6_ra_max_interval
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"1800\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:339"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-northd.at:342: ovn-sbctl get Port_Binding \${uuid} options:ipv6_ra_min_interval"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "ovn-northd.at:342"
( $at_check_trace; ovn-sbctl get Port_Binding ${uuid} options:ipv6_ra_min_interval
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"1350\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:342"
$at_failed && at_fn_log_failure
$at_traceon; }


ovn-nbctl --wait=sb set Logical_Router_port ro-sw ipv6_ra_configs:send_periodic=false

{ set +x
$as_echo "$at_srcdir/ovn-northd.at:348: ovn-sbctl get Port_Binding \${uuid} options:ipv6_ra_send_periodic"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "ovn-northd.at:348"
( $at_check_trace; ovn-sbctl get Port_Binding ${uuid} options:ipv6_ra_send_periodic
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-sbctl: no key \"ipv6_ra_send_periodic\" in Port_Binding record \"${uuid}\" column options
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-northd.at:348"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-northd.at:351: ovn-sbctl get Port_Binding \${uuid} options:ipv6_ra_max_interval"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "ovn-northd.at:351"
( $at_check_trace; ovn-sbctl get Port_Binding ${uuid} options:ipv6_ra_max_interval
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-sbctl: no key \"ipv6_ra_max_interval\" in Port_Binding record \"${uuid}\" column options
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-northd.at:351"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-northd.at:354: ovn-sbctl get Port_Binding \${uuid} options:ipv6_ra_min_interval"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "ovn-northd.at:354"
( $at_check_trace; ovn-sbctl get Port_Binding ${uuid} options:ipv6_ra_min_interval
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-sbctl: no key \"ipv6_ra_min_interval\" in Port_Binding record \"${uuid}\" column options
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-northd.at:354"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-northd.at:357: ovn-sbctl get Port_Binding \${uuid} options:ipv6_ra_mtu"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "ovn-northd.at:357"
( $at_check_trace; ovn-sbctl get Port_Binding ${uuid} options:ipv6_ra_mtu
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-sbctl: no key \"ipv6_ra_mtu\" in Port_Binding record \"${uuid}\" column options
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-northd.at:357"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-northd.at:360: ovn-sbctl get Port_Binding \${uuid} options:ipv6_ra_address_mode"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "ovn-northd.at:360"
( $at_check_trace; ovn-sbctl get Port_Binding ${uuid} options:ipv6_ra_address_mode
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-sbctl: no key \"ipv6_ra_address_mode\" in Port_Binding record \"${uuid}\" column options
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-northd.at:360"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-northd.at:363: ovn-sbctl get Port_Binding \${uuid} options:ipv6_ra_src_eth"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "ovn-northd.at:363"
( $at_check_trace; ovn-sbctl get Port_Binding ${uuid} options:ipv6_ra_src_eth
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-sbctl: no key \"ipv6_ra_src_eth\" in Port_Binding record \"${uuid}\" column options
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-northd.at:363"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-northd.at:366: ovn-sbctl get Port_Binding \${uuid} options:ipv6_ra_src_addr"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "ovn-northd.at:366"
( $at_check_trace; ovn-sbctl get Port_Binding ${uuid} options:ipv6_ra_src_addr
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-sbctl: no key \"ipv6_ra_src_addr\" in Port_Binding record \"${uuid}\" column options
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-northd.at:366"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-northd.at:369: ovn-sbctl get Port_Binding \${uuid} options:ipv6_ra_prefixes"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "ovn-northd.at:369"
( $at_check_trace; ovn-sbctl get Port_Binding ${uuid} options:ipv6_ra_prefixes
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-sbctl: no key \"ipv6_ra_prefixes\" in Port_Binding record \"${uuid}\" column options
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-northd.at:369"
$at_failed && at_fn_log_failure
$at_traceon; }


ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_137
#AT_START_138
at_fn_group_banner 138 'ovn-northd.at:375' \
  "ovn -- test unixctl" "                            " 3
at_xfail=no
(
  $as_echo "138. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_init_db ovn-sb; ovn-sbctl init
ovn_init_db ovn-nb; ovn-nbctl init

# test unixctl option
mkdir "$ovs_base"/northd
as northd start_daemon ovn-northd --unixctl="$ovs_base"/northd/ovn-northd.ctl --ovnnb-db=unix:"$ovs_base"/ovn-nb/ovn-nb.sock --ovnsb-db=unix:"$ovs_base"/ovn-sb/ovn-sb.sock
ovn-nbctl ls-add sw
ovn-nbctl --wait=sb lsp-add sw p1
# northd created with unixctl option successfully created port_binding entry
{ set +x
$as_echo "$at_srcdir/ovn-northd.at:385: ovn-sbctl --bare --columns datapath find port_binding logical_port=\"p1\" | wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-northd.at:385"
( $at_check_trace; ovn-sbctl --bare --columns datapath find port_binding logical_port="p1" | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:385"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-northd.at:387: ovn-nbctl --wait=sb lsp-del p1"
at_fn_check_prepare_trace "ovn-northd.at:387"
( $at_check_trace; ovn-nbctl --wait=sb lsp-del p1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:387"
$at_failed && at_fn_log_failure
$at_traceon; }


# ovs-appctl exit with unixctl option
{ set +x
$as_echo "$at_srcdir/ovn-northd.at:390: test -e \"\$ovs_base\"/northd/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e \"$ovs_base\"/northd/ovn-northd.pid" "ovn-northd.at:390"
( $at_check_trace; test -e "$ovs_base"/northd/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:390"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat "$ovs_base"/northd/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn-northd.at:390: ovs-appctl --timeout=10 --target=\"\$ovs_base\"/northd/ovn-northd.ctl exit"
at_fn_check_prepare_dynamic "ovs-appctl --timeout=10 --target=\"$ovs_base\"/northd/ovn-northd.ctl exit" "ovn-northd.at:390"
( $at_check_trace; ovs-appctl --timeout=10 --target="$ovs_base"/northd/ovn-northd.ctl exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:390"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:390" "while kill -0 \$TMPPID 2>/dev/null"


# Check no port_binding entry for new port as ovn-northd is not running
ovn-nbctl lsp-add sw p2
ovn-nbctl --timeout=10 --wait=sb sync
{ set +x
$as_echo "$at_srcdir/ovn-northd.at:395: ovn-sbctl --bare --columns datapath find port_binding logical_port=\"p2\" | wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-northd.at:395"
( $at_check_trace; ovn-sbctl --bare --columns datapath find port_binding logical_port="p2" | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:395"
$at_failed && at_fn_log_failure
$at_traceon; }


# test default unixctl path
as northd start_daemon ovn-northd --ovnnb-db=unix:"$ovs_base"/ovn-nb/ovn-nb.sock --ovnsb-db=unix:"$ovs_base"/ovn-sb/ovn-sb.sock
ovn-nbctl --wait=sb lsp-add sw p3
# northd created with default unixctl path successfully created port_binding entry
{ set +x
$as_echo "$at_srcdir/ovn-northd.at:402: ovn-sbctl --bare --columns datapath find port_binding logical_port=\"p3\" | wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-northd.at:402"
( $at_check_trace; ovn-sbctl --bare --columns datapath find port_binding logical_port="p3" | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:402"
$at_failed && at_fn_log_failure
$at_traceon; }


as ovn-sb
{ set +x
$as_echo "$at_srcdir/ovn-northd.at:406: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-northd.at:406"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:406"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-northd.at:406: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-northd.at:406"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:406"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:406" "while kill -0 \$TMPPID 2>/dev/null"

as ovn-nb
{ set +x
$as_echo "$at_srcdir/ovn-northd.at:408: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-northd.at:408"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:408"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-northd.at:408: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-northd.at:408"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:408"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:408" "while kill -0 \$TMPPID 2>/dev/null"

as northd
{ set +x
$as_echo "$at_srcdir/ovn-northd.at:410: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn-northd.at:410"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:410"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn-northd.at:410: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn-northd.at:410"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:410"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:410" "while kill -0 \$TMPPID 2>/dev/null"


ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_138
#AT_START_139
at_fn_group_banner 139 'ovn-northd.at:414' \
  "ovn -- check HA_Chassis_Group propagation from NBDB to SBDB" "" 3
at_xfail=no
(
  $as_echo "139. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

ovn-nbctl --wait=sb ha-chassis-group-add hagrp1

# ovn-northd should not create HA chassis group and HA chassis rows
# unless the HA chassis group in OVN NB DB is associated to
# a logical router port or logical port of type external.
{ set +x
$as_echo "$at_srcdir/ovn-northd.at:422: ovn-sbctl --bare --columns name find ha_chassis_group name=\"hagrp1\" \\
| wc -l"
at_fn_check_prepare_notrace 'an embedded newline' "ovn-northd.at:422"
( $at_check_trace; ovn-sbctl --bare --columns name find ha_chassis_group name="hagrp1" \
| wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:422"
$at_failed && at_fn_log_failure
$at_traceon; }


ovn-nbctl --wait=sb ha-chassis-group-add-chassis hagrp1 ch1 30
ovn-nbctl --wait=sb ha-chassis-group-add-chassis hagrp1 ch2 20
ovn-nbctl --wait=sb ha-chassis-group-add-chassis hagrp1 ch3 10

# There should be no HA_Chassis rows in SB DB.
{ set +x
$as_echo "$at_srcdir/ovn-northd.at:431: ovn-sbctl list ha_chassis | grep chassis | awk '{print \$3}' \\
| grep -v '-' | wc -l "
at_fn_check_prepare_notrace 'an embedded newline' "ovn-northd.at:431"
( $at_check_trace; ovn-sbctl list ha_chassis | grep chassis | awk '{print $3}' \
| grep -v '-' | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:431"
$at_failed && at_fn_log_failure
$at_traceon; }


# Add chassis ch1.
ovn-sbctl chassis-add ch1 geneve 127.0.0.2

ovs_wait_cond () {
    test 1 = `ovn-sbctl list chassis | grep ch1 | wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:438" "until test 1 = \`ovn-sbctl list chassis | grep ch1 | wc -l\`"


# There should be no HA_Chassis rows
{ set +x
$as_echo "$at_srcdir/ovn-northd.at:441: ovn-sbctl list ha_chassis | grep chassis | awk '{print \$3}' \\
| grep -v '-' | wc -l "
at_fn_check_prepare_notrace 'an embedded newline' "ovn-northd.at:441"
( $at_check_trace; ovn-sbctl list ha_chassis | grep chassis | awk '{print $3}' \
| grep -v '-' | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:441"
$at_failed && at_fn_log_failure
$at_traceon; }


# Create a logical router port and attach ha chassis group.
ovn-nbctl lr-add lr0
ovn-nbctl lrp-add lr0 lr0-public 00:00:20:20:12:13 172.168.0.100/24

hagrp1_uuid=`ovn-nbctl --bare --columns _uuid find ha_chassis_group name=hagrp1`
ovn-nbctl set logical_router_port lr0-public ha_chassis_group=$hagrp1_uuid

ovs_wait_cond () {
    test 1 = `ovn-sbctl --bare --columns name find \
ha_chassis_group name="hagrp1" | wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:452" "until test 1 = \`ovn-sbctl --bare --columns name find \\
ha_chassis_group name=\"hagrp1\" | wc -l\`"


{ set +x
$as_echo "$at_srcdir/ovn-northd.at:455: test 3 = \`ovn-sbctl list ha_chassis | grep chassis | \\
grep -v chassis-name | wc -l\`"
at_fn_check_prepare_notrace 'a `...` command substitution' "ovn-northd.at:455"
( $at_check_trace; test 3 = `ovn-sbctl list ha_chassis | grep chassis | \
grep -v chassis-name | wc -l`
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:455"
$at_failed && at_fn_log_failure
$at_traceon; }


# Make sure that ovn-northd doesn't recreate the ha_chassis
# records if the chassis record is missing in SB DB.

ha_ch_list_1=''
for i in `ovn-sbctl --bare --columns _uuid list ha_chassis | sort`
do
    ha_ch_list_1="$ha_ch_list_1 $i"
done

# Trim the spaces.
ha_ch_list_1=`echo $ha_ch_list_1 | sed 's/ //g'`

ha_ch_list_2=''
for i in `ovn-sbctl --bare --columns _uuid list ha_chassis | sort`
do
    ha_ch_list_2="$ha_ch_list_2 $i"
done

# Trim the spaces.
ha_ch_list_2=`echo $ha_ch_list_2 | sed 's/ //g'`

{ set +x
$as_echo "$at_srcdir/ovn-northd.at:479: test \"\$ha_ch_list_1\" = \"\$ha_ch_list_2\""
at_fn_check_prepare_dynamic "test \"$ha_ch_list_1\" = \"$ha_ch_list_2\"" "ovn-northd.at:479"
( $at_check_trace; test "$ha_ch_list_1" = "$ha_ch_list_2"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:479"
$at_failed && at_fn_log_failure
$at_traceon; }


# 2 HA chassis should be created with 'chassis' column empty because
# we have not added hv1 and hv2 chassis to the SB DB.
{ set +x
$as_echo "$at_srcdir/ovn-northd.at:483: test 2 = \`ovn-sbctl list ha_chassis | grep chassis | awk '{print \$3}' \\
| grep -v '-' | wc -l\`"
at_fn_check_prepare_notrace 'a `...` command substitution' "ovn-northd.at:483"
( $at_check_trace; test 2 = `ovn-sbctl list ha_chassis | grep chassis | awk '{print $3}' \
| grep -v '-' | wc -l`
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:483"
$at_failed && at_fn_log_failure
$at_traceon; }


# We should have 1 ha chassis with 'chassis' column set for hv1
{ set +x
$as_echo "$at_srcdir/ovn-northd.at:487: test 1 = \`ovn-sbctl list ha_chassis | grep chassis | \\
grep -v chassis-name | awk '{print \$3}' \\
| grep '-' | wc -l\`"
at_fn_check_prepare_notrace 'a `...` command substitution' "ovn-northd.at:487"
( $at_check_trace; test 1 = `ovn-sbctl list ha_chassis | grep chassis | \
grep -v chassis-name | awk '{print $3}' \
| grep '-' | wc -l`
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:487"
$at_failed && at_fn_log_failure
$at_traceon; }


# Create another logical router port and associate to the same ha_chasis_group
ovn-nbctl lr-add lr1
ovn-nbctl lrp-add lr1 lr1-public 00:00:20:20:12:14 182.168.0.100/24

ovn-nbctl set logical_router_port lr1-public ha_chassis_group=$hagrp1_uuid

# We should still have 1 HA chassis group and 3 HA chassis in SB DB.
ovs_wait_cond () {
    test 1 = `ovn-sbctl --bare --columns name find \
ha_chassis_group name="hagrp1" | wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:498" "until test 1 = \`ovn-sbctl --bare --columns name find \\
ha_chassis_group name=\"hagrp1\" | wc -l\`"


{ set +x
$as_echo "$at_srcdir/ovn-northd.at:501: test 3 = \`ovn-sbctl list ha_chassis | grep chassis | \\
grep -v chassis-name | wc -l\`"
at_fn_check_prepare_notrace 'a `...` command substitution' "ovn-northd.at:501"
( $at_check_trace; test 3 = `ovn-sbctl list ha_chassis | grep chassis | \
grep -v chassis-name | wc -l`
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:501"
$at_failed && at_fn_log_failure
$at_traceon; }


# Change the priority of ch1 - ha chassis in NB DB. It should get
# reflected in SB DB.
ovn-nbctl --wait=sb ha-chassis-group-add-chassis hagrp1 ch1 100

ovs_wait_cond () {
    test 1 = `ovn-sbctl --bare --columns priority find \
ha_chassis | grep 100 | wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:508" "until test 1 = \`ovn-sbctl --bare --columns priority find \\
ha_chassis | grep 100 | wc -l\`"


# Delete ch1 HA chassis in NB DB.
ovn-nbctl --wait=sb ha-chassis-group-remove-chassis hagrp1 ch1

ovs_wait_cond () {
    test 2 = `ovn-sbctl list ha_chassis | grep chassis | \
grep -v chassis-name | wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:514" "until test 2 = \`ovn-sbctl list ha_chassis | grep chassis | \\
grep -v chassis-name | wc -l\`"


# Add back the ha chassis
ovn-nbctl --wait=sb ha-chassis-group-add-chassis hagrp1 ch1 40
ovs_wait_cond () {
    test 3 = `ovn-sbctl list ha_chassis | grep chassis | \
grep -v chassis-name | wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:519" "until test 3 = \`ovn-sbctl list ha_chassis | grep chassis | \\
grep -v chassis-name | wc -l\`"


# Delete lr0-public. We should still have 1 HA chassis group and
# 3 HA chassis in SB DB.
ovn-nbctl --wait=sb lrp-del lr0-public

ovs_wait_cond () {
    test 1 = `ovn-sbctl --bare --columns name find \
ha_chassis_group name="hagrp1" | wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:526" "until test 1 = \`ovn-sbctl --bare --columns name find \\
ha_chassis_group name=\"hagrp1\" | wc -l\`"


{ set +x
$as_echo "$at_srcdir/ovn-northd.at:529: test 3 = \`ovn-sbctl list ha_chassis | grep chassis | \\
grep -v chassis-name | wc -l\`"
at_fn_check_prepare_notrace 'a `...` command substitution' "ovn-northd.at:529"
( $at_check_trace; test 3 = `ovn-sbctl list ha_chassis | grep chassis | \
grep -v chassis-name | wc -l`
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:529"
$at_failed && at_fn_log_failure
$at_traceon; }


# Delete lr1-public. There should be no HA chassis group in SB DB.
ovn-nbctl --wait=sb lrp-del lr1-public

ovs_wait_cond () {
    test 0 = `ovn-sbctl --bare --columns name find \
ha_chassis_group name="hagrp1" | wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:535" "until test 0 = \`ovn-sbctl --bare --columns name find \\
ha_chassis_group name=\"hagrp1\" | wc -l\`"


{ set +x
$as_echo "$at_srcdir/ovn-northd.at:538: test 0 = \`ovn-sbctl list ha_chassis | grep chassis | wc -l\`"
at_fn_check_prepare_notrace 'a `...` command substitution' "ovn-northd.at:538"
( $at_check_trace; test 0 = `ovn-sbctl list ha_chassis | grep chassis | wc -l`
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:538"
$at_failed && at_fn_log_failure
$at_traceon; }


# Add lr0-public again
ovn-nbctl lrp-add lr0 lr0-public 00:00:20:20:12:13 172.168.0.100/24
ovn-nbctl set logical_router_port lr0-public ha_chassis_group=$hagrp1_uuid

ovs_wait_cond () {
    test 1 = `ovn-sbctl --bare --columns name find \
ha_chassis_group name="hagrp1" | wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:544" "until test 1 = \`ovn-sbctl --bare --columns name find \\
ha_chassis_group name=\"hagrp1\" | wc -l\`"


{ set +x
$as_echo "$at_srcdir/ovn-northd.at:547: test 3 = \`ovn-sbctl list ha_chassis | grep chassis | \\
grep -v chassis-name | wc -l\`"
at_fn_check_prepare_notrace 'a `...` command substitution' "ovn-northd.at:547"
( $at_check_trace; test 3 = `ovn-sbctl list ha_chassis | grep chassis | \
grep -v chassis-name | wc -l`
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:547"
$at_failed && at_fn_log_failure
$at_traceon; }


# Create a Gateway chassis. ovn-northd should ignore this.
ovn-nbctl lrp-set-gateway-chassis lr0-public ch-1 20

# There should be only 1 HA chassis group in SB DB with the
# name hagrp1.
ovs_wait_cond () {
    test 1 = `ovn-sbctl --bare --columns name find \
ha_chassis_group | wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:555" "until test 1 = \`ovn-sbctl --bare --columns name find \\
ha_chassis_group | wc -l\`"


ovs_wait_cond () {
    test 1 = `ovn-sbctl --bare --columns name find \
ha_chassis_group name="hagrp1" | wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:558" "until test 1 = \`ovn-sbctl --bare --columns name find \\
ha_chassis_group name=\"hagrp1\" | wc -l\`"


{ set +x
$as_echo "$at_srcdir/ovn-northd.at:561: test 3 = \`ovn-sbctl list ha_chassis | grep chassis | \\
grep -v chassis-name | wc -l\`"
at_fn_check_prepare_notrace 'a `...` command substitution' "ovn-northd.at:561"
( $at_check_trace; test 3 = `ovn-sbctl list ha_chassis | grep chassis | \
grep -v chassis-name | wc -l`
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:561"
$at_failed && at_fn_log_failure
$at_traceon; }


# Now delete HA chassis group. ovn-northd should create HA chassis group
# with the Gateway chassis name
ovn-nbctl clear logical_router_port lr0-public ha_chassis_group
ovn-nbctl ha-chassis-group-del hagrp1

ovs_wait_cond () {
    test 0 = `ovn-sbctl --bare --columns name find \
ha_chassis_group name="hagrp1" | wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:569" "until test 0 = \`ovn-sbctl --bare --columns name find \\
ha_chassis_group name=\"hagrp1\" | wc -l\`"


ovs_wait_cond () {
    test 1 = `ovn-sbctl --bare --columns name find \
ha_chassis_group name="lr0-public" | wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:572" "until test 1 = \`ovn-sbctl --bare --columns name find \\
ha_chassis_group name=\"lr0-public\" | wc -l\`"


ovs_wait_cond () {
    test 1 = `ovn-sbctl --bare --columns _uuid \
find ha_chassis | wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:575" "until test 1 = \`ovn-sbctl --bare --columns _uuid \\
find ha_chassis | wc -l\`"


ovn-nbctl lrp-set-gateway-chassis lr0-public ch2 10

ovs_wait_cond () {
    test 1 = `ovn-sbctl --bare --columns name find \
ha_chassis_group name="lr0-public" | wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:580" "until test 1 = \`ovn-sbctl --bare --columns name find \\
ha_chassis_group name=\"lr0-public\" | wc -l\`"


ovn-sbctl --bare --columns _uuid find ha_chassis
ovs_wait_cond () {
    test 2 = `ovn-sbctl list ha_chassis | grep chassis | \
grep -v chassis-name | wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:584" "until test 2 = \`ovn-sbctl list ha_chassis | grep chassis | \\
grep -v chassis-name | wc -l\`"


# Test if 'ref_chassis' column is properly set or not in
# SB DB ha_chassis_group.
ovn-nbctl ls-add sw0
ovn-nbctl lsp-add sw0 sw0-p1

ovn-sbctl chassis-add ch2 geneve 127.0.0.3
ovn-sbctl chassis-add ch3 geneve 127.0.0.4
ovn-sbctl chassis-add comp1 geneve 127.0.0.5
ovn-sbctl chassis-add comp2 geneve 127.0.0.6

ovn-nbctl lrp-add lr0 lr0-sw0 00:00:20:20:12:14 10.0.0.1/24
ovn-nbctl lsp-add sw0 sw0-lr0
ovn-nbctl lsp-set-type sw0-lr0 router
ovn-nbctl lsp-set-addresses sw0-lr0 router
ovn-nbctl lsp-set-options sw0-lr0 router-port=lr0-sw0

ovn-sbctl lsp-bind sw0-p1 comp1
ovs_wait_cond () {
    test x`ovn-nbctl lsp-get-up sw0-p1` = xup
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:604" "until test x\`ovn-nbctl lsp-get-up sw0-p1\` = xup"


comp1_ch_uuid=`ovn-sbctl --bare --columns _uuid find chassis name="comp1"`
comp2_ch_uuid=`ovn-sbctl --bare --columns _uuid find chassis name="comp2"`
ch2_ch_uuid=`ovn-sbctl --bare --columns _uuid find chassis name="comp1"`

echo "comp1_ch_uuid = $comp1_ch_uuid"
ovs_wait_cond () {
    ref_ch_list=`ovn-sbctl --bare --columns ref_chassis find ha_chassis_group | sort`
     # Trim the spaces.
     ref_ch_list=`echo $ref_ch_list | sed 's/ //g'`
     test "$comp1_ch_uuid" = "$ref_ch_list"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:611" "until ref_ch_list=\`ovn-sbctl --bare --columns ref_chassis find ha_chassis_group | sort\`
     # Trim the spaces.
     ref_ch_list=\`echo \$ref_ch_list | sed 's/ //g'\`
     test \"\$comp1_ch_uuid\" = \"\$ref_ch_list\""


# unbind sw0-p1
ovn-sbctl lsp-unbind sw0-p1
ovs_wait_cond () {
    test x`ovn-nbctl lsp-get-up sw0-p1` = xdown
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:619" "until test x\`ovn-nbctl lsp-get-up sw0-p1\` = xdown"

ovs_wait_cond () {
    ref_ch_list=`ovn-sbctl --bare --columns ref_chassis find ha_chassis_group | sort`
     # Trim the spaces.
     ref_ch_list=`echo $ref_ch_list | sed 's/ //g'`
     test "" = "$ref_ch_list"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:620" "until ref_ch_list=\`ovn-sbctl --bare --columns ref_chassis find ha_chassis_group | sort\`
     # Trim the spaces.
     ref_ch_list=\`echo \$ref_ch_list | sed 's/ //g'\`
     test \"\" = \"\$ref_ch_list\""


# Bind sw0-p1 in comp2
ovn-sbctl lsp-bind sw0-p1 comp2
ovs_wait_cond () {
    ref_ch_list=`ovn-sbctl --bare --columns ref_chassis find ha_chassis_group | sort`
     # Trim the spaces.
     ref_ch_list=`echo $ref_ch_list | sed 's/ //g'`
     test "$comp2_ch_uuid" = "$ref_ch_list"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:628" "until ref_ch_list=\`ovn-sbctl --bare --columns ref_chassis find ha_chassis_group | sort\`
     # Trim the spaces.
     ref_ch_list=\`echo \$ref_ch_list | sed 's/ //g'\`
     test \"\$comp2_ch_uuid\" = \"\$ref_ch_list\""


ovn-nbctl ls-add sw1
ovn-nbctl lsp-add sw1 sw1-p1
ovn-nbctl lr-add lr1
ovn-nbctl lrp-add lr1 lr1-sw1 00:00:20:20:12:15 20.0.0.1/24
ovn-nbctl lsp-add sw1 sw1-lr1
ovn-nbctl lsp-set-type sw1-lr1 router
ovn-nbctl lsp-set-addresses sw1-lr1 router
ovn-nbctl lsp-set-options sw1-lr1 router-port=lr1-sw1

# Bind sw1-p1 in comp1.
ovn-sbctl lsp-bind sw1-p1 comp1
# Wait until sw1-p1 is up
ovs_wait_cond () {
    test x`ovn-nbctl lsp-get-up sw1-p1` = xup
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:646" "until test x\`ovn-nbctl lsp-get-up sw1-p1\` = xup"


# sw1-p1 is not connected to lr0. So comp1 should not be in 'ref_chassis'
ovs_wait_cond () {
    ref_ch_list=`ovn-sbctl --bare --columns ref_chassis find ha_chassis_group | sort`
     # Trim the spaces.
     ref_ch_list=`echo $ref_ch_list | sed 's/ //g'`
     test "$comp2_ch_uuid" = "$ref_ch_list"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:649" "until ref_ch_list=\`ovn-sbctl --bare --columns ref_chassis find ha_chassis_group | sort\`
     # Trim the spaces.
     ref_ch_list=\`echo \$ref_ch_list | sed 's/ //g'\`
     test \"\$comp2_ch_uuid\" = \"\$ref_ch_list\""


# Now attach sw0 to lr1
ovn-nbctl lrp-add lr1 lr1-sw0 00:00:20:20:12:16 10.0.0.10/24
ovn-nbctl lsp-add sw0 sw0-lr1
ovn-nbctl lsp-set-type sw0-lr1 router
ovn-nbctl lsp-set-addresses sw0-lr1 router
ovn-nbctl lsp-set-options sw0-lr1 router-port=lr1-sw0

# Both comp1 and comp2 should be in 'ref_chassis' as sw1 is indirectly
# connected to lr0
exp_ref_ch_list=''
for i in `ovn-sbctl --bare --columns _uuid list chassis | sort`
do
    if test $i = $comp1_ch_uuid; then
        exp_ref_ch_list="${exp_ref_ch_list}$i"
    elif test $i = $comp2_ch_uuid; then
        exp_ref_ch_list="${exp_ref_ch_list}$i"
    fi
done

ovs_wait_cond () {
    ref_ch_list=`ovn-sbctl --bare --columns ref_chassis find ha_chassis_group | sort`
     # Trim the spaces.
     ref_ch_list=`echo $ref_ch_list | sed 's/ //g'`
     test "$exp_ref_ch_list" = "$ref_ch_list"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:674" "until ref_ch_list=\`ovn-sbctl --bare --columns ref_chassis find ha_chassis_group | sort\`
     # Trim the spaces.
     ref_ch_list=\`echo \$ref_ch_list | sed 's/ //g'\`
     test \"\$exp_ref_ch_list\" = \"\$ref_ch_list\""


# Unind sw1-p1. comp2 should not be in the ref_chassis.
ovn-sbctl lsp-unbind sw1-p1
ovs_wait_cond () {
    test x`ovn-nbctl lsp-get-up sw1-p1` = xdown
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:682" "until test x\`ovn-nbctl lsp-get-up sw1-p1\` = xdown"

ovs_wait_cond () {
    ref_ch_list=`ovn-sbctl --bare --columns ref_chassis find ha_chassis_group | sort`
     # Trim the spaces.
     ref_ch_list=`echo $ref_ch_list | sed 's/ //g'`
     test "$comp2_ch_uuid" = "$ref_ch_list"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:683" "until ref_ch_list=\`ovn-sbctl --bare --columns ref_chassis find ha_chassis_group | sort\`
     # Trim the spaces.
     ref_ch_list=\`echo \$ref_ch_list | sed 's/ //g'\`
     test \"\$comp2_ch_uuid\" = \"\$ref_ch_list\""


# Create sw2 and attach it to lr2
ovn-nbctl ls-add sw2
ovn-nbctl lsp-add sw2 sw2-p1
ovn-nbctl lr-add lr2
ovn-nbctl lrp-add lr2 lr2-sw2 00:00:20:20:12:17 30.0.0.1/24
ovn-nbctl lsp-add sw2 sw2-lr2
ovn-nbctl lsp-set-type sw2-lr2 router
ovn-nbctl lsp-set-addresses sw2-lr2 router
ovn-nbctl lsp-set-options sw2-lr2 router-port=lr2-sw2

# Bind sw2-p1 to comp1
ovn-sbctl lsp-bind sw2-p1 comp1
# Wait until sw2-p1 is up
ovs_wait_cond () {
    test x`ovn-nbctl lsp-get-up sw2-p1` = xup
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:702" "until test x\`ovn-nbctl lsp-get-up sw2-p1\` = xup"


# sw2-p1 is not connected to lr0. So comp1 should not be in 'ref_chassis'
ovs_wait_cond () {
    ref_ch_list=`ovn-sbctl --bare --columns ref_chassis find ha_chassis_group | sort`
     # Trim the spaces.
     ref_ch_list=`echo $ref_ch_list | sed 's/ //g'`
     test "$comp2_ch_uuid" = "$ref_ch_list"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:705" "until ref_ch_list=\`ovn-sbctl --bare --columns ref_chassis find ha_chassis_group | sort\`
     # Trim the spaces.
     ref_ch_list=\`echo \$ref_ch_list | sed 's/ //g'\`
     test \"\$comp2_ch_uuid\" = \"\$ref_ch_list\""


# Now attach sw1 to lr2. With this sw2-p1 is indirectly connected to lr0.
ovn-nbctl lrp-add lr2 lr2-sw1 00:00:20:20:12:18 20.0.0.10/24
ovn-nbctl lsp-add sw1 sw1-lr2
ovn-nbctl lsp-set-type sw1-lr2 router
ovn-nbctl lsp-set-addresses sw1-lr2 router
ovn-nbctl lsp-set-options sw1-lr2 router-port=lr2-sw1

# sw2-p1 is indirectly connected to lr0. So comp1 (and comp2) should be in
# 'ref_chassis'
ovs_wait_cond () {
    ref_ch_list=`ovn-sbctl --bare --columns ref_chassis find ha_chassis_group | sort`
     # Trim the spaces.
     ref_ch_list=`echo $ref_ch_list | sed 's/ //g'`
     test "$exp_ref_ch_list" = "$ref_ch_list"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:720" "until ref_ch_list=\`ovn-sbctl --bare --columns ref_chassis find ha_chassis_group | sort\`
     # Trim the spaces.
     ref_ch_list=\`echo \$ref_ch_list | sed 's/ //g'\`
     test \"\$exp_ref_ch_list\" = \"\$ref_ch_list\""


# Create sw0-p2 and bind it to comp1
ovn-nbctl lsp-add sw0 sw0-p2
ovn-sbctl lsp-bind sw0-p2 comp1
ovs_wait_cond () {
    test x`ovn-nbctl lsp-get-up sw0-p2` = xup
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:729" "until test x\`ovn-nbctl lsp-get-up sw0-p2\` = xup"

ovs_wait_cond () {
    ref_ch_list=`ovn-sbctl --bare --columns ref_chassis find ha_chassis_group | sort`
     # Trim the spaces.
     ref_ch_list=`echo $ref_ch_list | sed 's/ //g'`
     test "$exp_ref_ch_list" = "$ref_ch_list"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:730" "until ref_ch_list=\`ovn-sbctl --bare --columns ref_chassis find ha_chassis_group | sort\`
     # Trim the spaces.
     ref_ch_list=\`echo \$ref_ch_list | sed 's/ //g'\`
     test \"\$exp_ref_ch_list\" = \"\$ref_ch_list\""


# unbind sw0-p2
ovn-sbctl lsp-unbind sw0-p2
ovs_wait_cond () {
    test x`ovn-nbctl lsp-get-up sw0-p2` = xdown
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:738" "until test x\`ovn-nbctl lsp-get-up sw0-p2\` = xdown"

ovs_wait_cond () {
    ref_ch_list=`ovn-sbctl --bare --columns ref_chassis find ha_chassis_group | sort`
     # Trim the spaces.
     ref_ch_list=`echo $ref_ch_list | sed 's/ //g'`
     test "$exp_ref_ch_list" = "$ref_ch_list"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:739" "until ref_ch_list=\`ovn-sbctl --bare --columns ref_chassis find ha_chassis_group | sort\`
     # Trim the spaces.
     ref_ch_list=\`echo \$ref_ch_list | sed 's/ //g'\`
     test \"\$exp_ref_ch_list\" = \"\$ref_ch_list\""


# Delete lr1-sw0. comp1 should be deleted from ref_chassis as there is no link
# from sw1 and sw2 to lr0.
ovn-nbctl lrp-del lr1-sw0

ovs_wait_cond () {
    ref_ch_list=`ovn-sbctl --bare --columns ref_chassis find ha_chassis_group | sort`
     # Trim the spaces.
     ref_ch_list=`echo $ref_ch_list | sed 's/ //g'`
     test "$comp2_ch_uuid" = "$ref_ch_list"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:749" "until ref_ch_list=\`ovn-sbctl --bare --columns ref_chassis find ha_chassis_group | sort\`
     # Trim the spaces.
     ref_ch_list=\`echo \$ref_ch_list | sed 's/ //g'\`
     test \"\$comp2_ch_uuid\" = \"\$ref_ch_list\""


# Set redirect-chassis option to lr0-public. It should be ignored.
ovn-nbctl set logical_router_port lr0-public options:redirect-chassis=ch1

ovs_wait_cond () {
    test 1 = `ovn-sbctl --bare --columns name find \
ha_chassis_group | wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:758" "until test 1 = \`ovn-sbctl --bare --columns name find \\
ha_chassis_group | wc -l\`"


ovs_wait_cond () {
    test 1 = `ovn-sbctl --bare --columns name find \
ha_chassis_group name="lr0-public" | wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:761" "until test 1 = \`ovn-sbctl --bare --columns name find \\
ha_chassis_group name=\"lr0-public\" | wc -l\`"


ovn-sbctl --bare --columns _uuid find ha_chassis
ovs_wait_cond () {
    test 2 = `ovn-sbctl list ha_chassis | grep chassis | \
grep -v chassis-name | wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:765" "until test 2 = \`ovn-sbctl list ha_chassis | grep chassis | \\
grep -v chassis-name | wc -l\`"


# Delete the gateway chassis. HA chassis group should be created in SB DB
# for the redirect-chassis option.
ovn-nbctl clear logical_router_port lr0-public gateway_chassis

ovs_wait_cond () {
    test 1 = `ovn-sbctl --bare --columns name find \
ha_chassis_group | wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:772" "until test 1 = \`ovn-sbctl --bare --columns name find \\
ha_chassis_group | wc -l\`"


ovn-sbctl list ha_chassis_group

ovs_wait_cond () {
    test 1 = `ovn-sbctl --bare --columns name find \
ha_chassis_group name="lr0-public_ch1" | wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:777" "until test 1 = \`ovn-sbctl --bare --columns name find \\
ha_chassis_group name=\"lr0-public_ch1\" | wc -l\`"


ovn-sbctl --bare --columns _uuid find ha_chassis
ovs_wait_cond () {
    test 1 = `ovn-sbctl list ha_chassis | grep chassis |
grep -v chassis-name | wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:781" "until test 1 = \`ovn-sbctl list ha_chassis | grep chassis |
grep -v chassis-name | wc -l\`"


# Clear the redirect-chassis option.
ovn-nbctl clear logical_router_port lr0-public options

ovs_wait_cond () {
    test 0 = `ovn-sbctl list ha_chassis_group |  wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:787" "until test 0 = \`ovn-sbctl list ha_chassis_group |  wc -l\`"

{ set +x
$as_echo "$at_srcdir/ovn-northd.at:788: test 0 = \`ovn-sbctl list ha_chassis | wc -l\`"
at_fn_check_prepare_notrace 'a `...` command substitution' "ovn-northd.at:788"
( $at_check_trace; test 0 = `ovn-sbctl list ha_chassis | wc -l`
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:788"
$at_failed && at_fn_log_failure
$at_traceon; }


# Delete old sw0.
ovn-nbctl ls-del sw0

# Create external logical ports and associate ha_chassis_group
ovn-nbctl ls-add sw0
ovn-nbctl lsp-add sw0 sw0-pext1
ovn-nbctl lsp-add sw0 sw0-pext2
ovn-nbctl lsp-add sw0 sw0-p1

ovn-nbctl lsp-set-addresses sw0-pext1 "00:00:00:00:00:03 10.0.0.3"
ovn-nbctl lsp-set-addresses sw0-pext2 "00:00:00:00:00:03 10.0.0.4"
ovn-nbctl lsp-set-addresses sw0-p1 "00:00:00:00:00:03 10.0.0.5"

ovn-nbctl --wait=sb ha-chassis-group-add hagrp1

ovn-nbctl --wait=sb ha-chassis-group-add-chassis hagrp1 ch1 30
ovn-nbctl --wait=sb ha-chassis-group-add-chassis hagrp1 ch2 20
ovn-nbctl --wait=sb ha-chassis-group-add-chassis hagrp1 ch3 10

# ovn-northd should not create HA chassis group and HA chassis rows
# unless the HA chassis group in OVN NB DB is associated to
# a logical router port or logical port of type external.
ovs_wait_cond () {
    test 0 = `ovn-sbctl list ha_chassis_group |  wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:812" "until test 0 = \`ovn-sbctl list ha_chassis_group |  wc -l\`"

{ set +x
$as_echo "$at_srcdir/ovn-northd.at:813: test 0 = \`ovn-sbctl list ha_chassis | wc -l\`"
at_fn_check_prepare_notrace 'a `...` command substitution' "ovn-northd.at:813"
( $at_check_trace; test 0 = `ovn-sbctl list ha_chassis | wc -l`
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:813"
$at_failed && at_fn_log_failure
$at_traceon; }


hagrp1_uuid=`ovn-nbctl --bare --columns _uuid find ha_chassis_group \
name=hagrp1`

# The type of the lsp - sw0-pext1 is still not set to external.
# So ha_chassis_group should be ignored.
ovn-nbctl set logical_switch_port sw0-pext1 ha_chassis_group=$hagrp1_uuid

ovs_wait_cond () {
    test 0 = `ovn-sbctl --bare --columns name find \
ha_chassis_group name="hagrp1" | wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:822" "until test 0 = \`ovn-sbctl --bare --columns name find \\
ha_chassis_group name=\"hagrp1\" | wc -l\`"


{ set +x
$as_echo "$at_srcdir/ovn-northd.at:825: test 0 = \`ovn-sbctl list ha_chassis | grep chassis | wc -l\`"
at_fn_check_prepare_notrace 'a `...` command substitution' "ovn-northd.at:825"
( $at_check_trace; test 0 = `ovn-sbctl list ha_chassis | grep chassis | wc -l`
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:825"
$at_failed && at_fn_log_failure
$at_traceon; }


# Set the type of sw0-pext1 to external
ovn-nbctl lsp-set-type sw0-pext1 external

ovs_wait_cond () {
    test 1 = `ovn-sbctl --bare --columns name find \
ha_chassis_group name="hagrp1" | wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:830" "until test 1 = \`ovn-sbctl --bare --columns name find \\
ha_chassis_group name=\"hagrp1\" | wc -l\`"


{ set +x
$as_echo "$at_srcdir/ovn-northd.at:833: test 3 = \`ovn-sbctl list ha_chassis | grep chassis | \\
grep -v chassis-name | wc -l\`"
at_fn_check_prepare_notrace 'a `...` command substitution' "ovn-northd.at:833"
( $at_check_trace; test 3 = `ovn-sbctl list ha_chassis | grep chassis | \
grep -v chassis-name | wc -l`
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:833"
$at_failed && at_fn_log_failure
$at_traceon; }


sb_hagrp1_uuid=`ovn-sbctl --bare --columns _uuid find ha_chassis_group \
name=hagrp1`

{ set +x
$as_echo "$at_srcdir/ovn-northd.at:839: test \"\$sb_hagrp1_uuid\" = \`ovn-sbctl --bare --columns \\
ha_chassis_group find port_binding logical_port=sw0-pext1\`"
at_fn_check_prepare_notrace 'a `...` command substitution' "ovn-northd.at:839"
( $at_check_trace; test "$sb_hagrp1_uuid" = `ovn-sbctl --bare --columns \
ha_chassis_group find port_binding logical_port=sw0-pext1`
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:839"
$at_failed && at_fn_log_failure
$at_traceon; }


# Set the type of sw0-pext2 to external and associate ha_chassis_group
ovn-nbctl lsp-set-type sw0-pext2 external
ovn-nbctl set logical_switch_port sw0-pext2 ha_chassis_group=$hagrp1_uuid

ovs_wait_cond () {
    test 1 = `ovn-sbctl --bare --columns name find \
ha_chassis_group name="hagrp1" | wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:846" "until test 1 = \`ovn-sbctl --bare --columns name find \\
ha_chassis_group name=\"hagrp1\" | wc -l\`"


{ set +x
$as_echo "$at_srcdir/ovn-northd.at:849: test 3 = \`ovn-sbctl list ha_chassis | grep chassis |
grep -v chassis-name | wc -l\`"
at_fn_check_prepare_notrace 'a `...` command substitution' "ovn-northd.at:849"
( $at_check_trace; test 3 = `ovn-sbctl list ha_chassis | grep chassis |
grep -v chassis-name | wc -l`
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:849"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-northd.at:851: test \"\$sb_hagrp1_uuid\" = \`ovn-sbctl --bare --columns \\
ha_chassis_group find port_binding logical_port=sw0-pext1\`"
at_fn_check_prepare_notrace 'a `...` command substitution' "ovn-northd.at:851"
( $at_check_trace; test "$sb_hagrp1_uuid" = `ovn-sbctl --bare --columns \
ha_chassis_group find port_binding logical_port=sw0-pext1`
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:851"
$at_failed && at_fn_log_failure
$at_traceon; }


ovs_wait_cond () {
    test "$sb_hagrp1_uuid" = `ovn-sbctl --bare --columns \
ha_chassis_group find port_binding logical_port=sw0-pext2`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:854" "until test \"\$sb_hagrp1_uuid\" = \`ovn-sbctl --bare --columns \\
ha_chassis_group find port_binding logical_port=sw0-pext2\`"


# sw0-p1 is a normal port. So ha_chassis_group should not be set
# in port_binding.
ovn-nbctl --wait=sb set logical_switch_port sw0-p1 \
ha_chassis_group=$hagrp1_uuid

ovs_wait_cond () {
    test x$(ovn-sbctl --bare --columns chassis find port_binding \
logical_port=sw0-p1) = x
}
ovs_wait_failed () {
    :
    0
}
ovs_wait "ovn-northd.at:862" "until test x\$(ovn-sbctl --bare --columns chassis find port_binding \\
logical_port=sw0-p1) = x"


# Clear ha_chassis_group for sw0-pext1
ovn-nbctl --wait=sb clear logical_switch_port sw0-pext1 ha_chassis_group

ovs_wait_cond () {
    test x$(ovn-sbctl --bare --columns chassis find port_binding \
logical_port=sw0-pext1) = x
}
ovs_wait_failed () {
    :
    0
}
ovs_wait "ovn-northd.at:868" "until test x\$(ovn-sbctl --bare --columns chassis find port_binding \\
logical_port=sw0-pext1) = x"


ovs_wait_cond () {
    test 1 = `ovn-sbctl --bare --columns name find \
ha_chassis_group name="hagrp1" | wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:871" "until test 1 = \`ovn-sbctl --bare --columns name find \\
ha_chassis_group name=\"hagrp1\" | wc -l\`"


{ set +x
$as_echo "$at_srcdir/ovn-northd.at:874: test 3 = \`ovn-sbctl list ha_chassis | grep chassis | \\
grep -v chassis-name | wc -l\`"
at_fn_check_prepare_notrace 'a `...` command substitution' "ovn-northd.at:874"
( $at_check_trace; test 3 = `ovn-sbctl list ha_chassis | grep chassis | \
grep -v chassis-name | wc -l`
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:874"
$at_failed && at_fn_log_failure
$at_traceon; }


# Clear ha_chassis_group for sw0-pext2
ovn-nbctl --wait=sb clear logical_switch_port sw0-pext2 ha_chassis_group

ovs_wait_cond () {
    test x$(ovn-sbctl --bare --columns chassis find port_binding \
logical_port=sw0-pext2) = x
}
ovs_wait_failed () {
    :
    0
}
ovs_wait "ovn-northd.at:880" "until test x\$(ovn-sbctl --bare --columns chassis find port_binding \\
logical_port=sw0-pext2) = x"


ovs_wait_cond () {
    test 0 = `ovn-sbctl list ha_chassis_group |  wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:883" "until test 0 = \`ovn-sbctl list ha_chassis_group |  wc -l\`"

{ set +x
$as_echo "$at_srcdir/ovn-northd.at:884: test 0 = \`ovn-sbctl list ha_chassis | wc -l\`"
at_fn_check_prepare_notrace 'a `...` command substitution' "ovn-northd.at:884"
( $at_check_trace; test 0 = `ovn-sbctl list ha_chassis | wc -l`
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:884"
$at_failed && at_fn_log_failure
$at_traceon; }


as ovn-sb
{ set +x
$as_echo "$at_srcdir/ovn-northd.at:887: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-northd.at:887"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:887"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-northd.at:887: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-northd.at:887"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:887"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:887" "while kill -0 \$TMPPID 2>/dev/null"

as ovn-nb
{ set +x
$as_echo "$at_srcdir/ovn-northd.at:889: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-northd.at:889"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:889"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-northd.at:889: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-northd.at:889"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:889"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:889" "while kill -0 \$TMPPID 2>/dev/null"

as northd
{ set +x
$as_echo "$at_srcdir/ovn-northd.at:891: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn-northd.at:891"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:891"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn-northd.at:891: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn-northd.at:891"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:891"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:891" "while kill -0 \$TMPPID 2>/dev/null"


ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_139
#AT_START_140
at_fn_group_banner 140 'ovn-northd.at:895' \
  "ovn -- ovn-northd pause and resume" "             " 3
at_xfail=no
(
  $as_echo "140. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

{ set +x
$as_echo "$at_srcdir/ovn-northd.at:898: test xfalse = x\`as northd ovn-appctl -t ovn-northd is-paused\`"
at_fn_check_prepare_notrace 'a `...` command substitution' "ovn-northd.at:898"
( $at_check_trace; test xfalse = x`as northd ovn-appctl -t ovn-northd is-paused`
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:898"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-northd.at:899: as northd ovn-appctl -t ovn-northd status"
at_fn_check_prepare_trace "ovn-northd.at:899"
( $at_check_trace; as northd ovn-appctl -t ovn-northd status
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "Status: active
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:899"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-northd.at:901: test xfalse = x\`as northd-backup ovn-appctl -t ovn-northd \\
is-paused\`"
at_fn_check_prepare_notrace 'a `...` command substitution' "ovn-northd.at:901"
( $at_check_trace; test xfalse = x`as northd-backup ovn-appctl -t ovn-northd \
is-paused`
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:901"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-northd.at:903: as northd-backup ovn-appctl -t ovn-northd status"
at_fn_check_prepare_trace "ovn-northd.at:903"
( $at_check_trace; as northd-backup ovn-appctl -t ovn-northd status
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "Status: standby
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:903"
$at_failed && at_fn_log_failure
$at_traceon; }


ovn-nbctl ls-add sw0

ovs_wait_cond () {

    ovn-sbctl lflow-list sw0
    test 0 = $?
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:909" "until
    ovn-sbctl lflow-list sw0
    test 0 = \$?"


ovn-nbctl ls-del sw0
ovs_wait_cond () {

    ovn-sbctl lflow-list sw0
    test 1 = $?
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:914" "until
    ovn-sbctl lflow-list sw0
    test 1 = \$?"


# Now pause the ovn-northd
as northd ovs-appctl -t ovn-northd pause
as northd-backup ovs-appctl -t ovn-northd pause
{ set +x
$as_echo "$at_srcdir/ovn-northd.at:921: test xtrue = x\`as northd ovn-appctl -t ovn-northd is-paused\`"
at_fn_check_prepare_notrace 'a `...` command substitution' "ovn-northd.at:921"
( $at_check_trace; test xtrue = x`as northd ovn-appctl -t ovn-northd is-paused`
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:921"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-northd.at:922: as northd ovn-appctl -t ovn-northd status"
at_fn_check_prepare_trace "ovn-northd.at:922"
( $at_check_trace; as northd ovn-appctl -t ovn-northd status
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "Status: paused
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:922"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-northd.at:924: test xtrue = x\`as northd-backup ovn-appctl -t ovn-northd is-paused\`"
at_fn_check_prepare_notrace 'a `...` command substitution' "ovn-northd.at:924"
( $at_check_trace; test xtrue = x`as northd-backup ovn-appctl -t ovn-northd is-paused`
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:924"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-northd.at:925: as northd-backup ovn-appctl -t ovn-northd status"
at_fn_check_prepare_trace "ovn-northd.at:925"
( $at_check_trace; as northd-backup ovn-appctl -t ovn-northd status
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "Status: paused
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:925"
$at_failed && at_fn_log_failure
$at_traceon; }


ovn-nbctl ls-add sw0

# There should be no logical flows for sw0 datapath.
ovs_wait_cond () {

    ovn-sbctl lflow-list sw0
    test 1 = $?
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:932" "until
    ovn-sbctl lflow-list sw0
    test 1 = \$?"


# Now resume ovn-northd
as northd ovs-appctl -t ovn-northd resume
as northd-backup ovs-appctl -t ovn-northd resume
{ set +x
$as_echo "$at_srcdir/ovn-northd.at:939: test xfalse = x\`as northd ovn-appctl -t ovn-northd is-paused\`"
at_fn_check_prepare_notrace 'a `...` command substitution' "ovn-northd.at:939"
( $at_check_trace; test xfalse = x`as northd ovn-appctl -t ovn-northd is-paused`
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:939"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-northd.at:940: as northd ovn-appctl -t ovn-northd status"
at_fn_check_prepare_trace "ovn-northd.at:940"
( $at_check_trace; as northd ovn-appctl -t ovn-northd status
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "Status: active
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:940"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-northd.at:942: test xfalse = x\`as northd-backup ovn-appctl -t ovn-northd \\
is-paused\`"
at_fn_check_prepare_notrace 'a `...` command substitution' "ovn-northd.at:942"
( $at_check_trace; test xfalse = x`as northd-backup ovn-appctl -t ovn-northd \
is-paused`
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:942"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-northd.at:944: as northd-backup ovn-appctl -t ovn-northd status"
at_fn_check_prepare_trace "ovn-northd.at:944"
( $at_check_trace; as northd-backup ovn-appctl -t ovn-northd status
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "Status: standby
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:944"
$at_failed && at_fn_log_failure
$at_traceon; }


ovs_wait_cond () {

    ovn-sbctl lflow-list sw0
    test 0 = $?
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:948" "until
    ovn-sbctl lflow-list sw0
    test 0 = \$?"


ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_140
#AT_START_141
at_fn_group_banner 141 'ovn-northd.at:954' \
  "ovn -- check Redirect Chassis propagation from NB to SB" "" 3
at_xfail=no
(
  $as_echo "141. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

ovn-sbctl chassis-add gw1 geneve 127.0.0.1

ovn-nbctl lr-add R1
ovn-nbctl lrp-add R1 R1-S1 02:ac:10:01:00:01 172.16.1.1/24

ovn-nbctl ls-add S1
ovn-nbctl lsp-add S1 S1-R1
ovn-nbctl lsp-set-type S1-R1 router
ovn-nbctl lsp-set-addresses S1-R1 router
ovn-nbctl --wait=sb lsp-set-options S1-R1 router-port=R1-S1

ovn-nbctl lrp-set-gateway-chassis R1-S1 gw1

uuid=`ovn-sbctl --columns=_uuid --bare find Port_Binding logical_port=cr-R1-S1`
echo "CR-LRP UUID is: " $uuid

ovn-nbctl lrp-set-redirect-type R1-S1 bridged
ovs_wait_cond () {
    ovn-sbctl get Port_Binding ${uuid} options:redirect-type
}
ovs_wait_failed () {
    :
    0
}
ovs_wait "ovn-northd.at:974" "until ovn-sbctl get Port_Binding \${uuid} options:redirect-type"


ovn-nbctl lrp-set-redirect-type R1-S1 overlay
ovs_wait_cond () {
    ovn-sbctl get Port_Binding ${uuid} options:redirect-type
}
ovs_wait_failed () {
    :
    0
}
ovs_wait "ovn-northd.at:978" "until ovn-sbctl get Port_Binding \${uuid} options:redirect-type"


ovs_cleanup
$as_echo "$at_setup_line" >"$at_check_line_file"
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_141
#AT_START_142
at_fn_group_banner 142 'ovn-northd.at:983' \
  "ovn -- check stateless dnat_and_snat rule" "      " 3
at_xfail=no
(
  $as_echo "142. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

ovn_start

ovn-sbctl chassis-add gw1 geneve 127.0.0.1

ovn-nbctl lr-add R1
ovn-nbctl lrp-add R1 R1-S1 02:ac:10:01:00:01 172.16.1.1/24

ovn-nbctl ls-add S1
ovn-nbctl lsp-add S1 S1-R1
ovn-nbctl lsp-set-type S1-R1 router
ovn-nbctl lsp-set-addresses S1-R1 router
ovn-nbctl --wait=sb lsp-set-options S1-R1 router-port=R1-S1

ovn-nbctl lrp-set-gateway-chassis R1-S1 gw1

uuid=`ovn-sbctl --columns=_uuid --bare find Port_Binding logical_port=cr-R1-S1`
echo "CR-LRP UUID is: " $uuid

# IPV4
ovn-nbctl lr-nat-add R1 dnat_and_snat  172.16.1.1 50.0.0.11

ovs_wait_cond () {
    test 2 = `ovn-sbctl dump-flows R1 | grep lr_in_unsnat | \
wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:1005" "until test 2 = \`ovn-sbctl dump-flows R1 | grep lr_in_unsnat | \\
wc -l\`"


{ set +x
$as_echo "$at_srcdir/ovn-northd.at:1008: ovn-sbctl dump-flows R1 | grep ct_snat | wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-northd.at:1008"
( $at_check_trace; ovn-sbctl dump-flows R1 | grep ct_snat | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "2
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:1008"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-northd.at:1011: ovn-sbctl dump-flows R1 | grep ct_dnat | wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-northd.at:1011"
( $at_check_trace; ovn-sbctl dump-flows R1 | grep ct_dnat | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "2
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:1011"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-northd.at:1014: ovn-sbctl dump-flows R1 | grep ip4.dst=| wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-northd.at:1014"
( $at_check_trace; ovn-sbctl dump-flows R1 | grep ip4.dst=| wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:1014"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-northd.at:1017: ovn-sbctl dump-flows R1 | grep ip4.src=| wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-northd.at:1017"
( $at_check_trace; ovn-sbctl dump-flows R1 | grep ip4.src=| wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:1017"
$at_failed && at_fn_log_failure
$at_traceon; }


ovn-nbctl lr-nat-del R1 dnat_and_snat  172.16.1.1

ovn-nbctl --stateless lr-nat-add R1 dnat_and_snat  172.16.1.1 50.0.0.11
ovs_wait_cond () {
    test 2 = `ovn-sbctl dump-flows R1 | grep lr_in_unsnat | \
wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:1023" "until test 2 = \`ovn-sbctl dump-flows R1 | grep lr_in_unsnat | \\
wc -l\`"


{ set +x
$as_echo "$at_srcdir/ovn-northd.at:1026: ovn-sbctl dump-flows R1 | grep ct_snat | wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-northd.at:1026"
( $at_check_trace; ovn-sbctl dump-flows R1 | grep ct_snat | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:1026"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-northd.at:1029: ovn-sbctl dump-flows R1 | grep ct_dnat | wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-northd.at:1029"
( $at_check_trace; ovn-sbctl dump-flows R1 | grep ct_dnat | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:1029"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-northd.at:1032: ovn-sbctl dump-flows R1 | grep ip4.dst=| wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-northd.at:1032"
( $at_check_trace; ovn-sbctl dump-flows R1 | grep ip4.dst=| wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "2
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:1032"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-northd.at:1035: ovn-sbctl dump-flows R1 | grep ip4.src=| wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-northd.at:1035"
( $at_check_trace; ovn-sbctl dump-flows R1 | grep ip4.src=| wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "2
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:1035"
$at_failed && at_fn_log_failure
$at_traceon; }

ovn-nbctl lr-nat-del R1 dnat_and_snat  172.16.1.1

# IPV6
ovn-nbctl lr-nat-add R1 dnat_and_snat fd01::1 fd11::2

ovs_wait_cond () {
    test 2 = `ovn-sbctl dump-flows R1 | grep lr_in_unsnat | \
wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:1042" "until test 2 = \`ovn-sbctl dump-flows R1 | grep lr_in_unsnat | \\
wc -l\`"


{ set +x
$as_echo "$at_srcdir/ovn-northd.at:1045: ovn-sbctl dump-flows R1 | grep ct_snat | wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-northd.at:1045"
( $at_check_trace; ovn-sbctl dump-flows R1 | grep ct_snat | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "2
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:1045"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-northd.at:1048: ovn-sbctl dump-flows R1 | grep ct_dnat | wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-northd.at:1048"
( $at_check_trace; ovn-sbctl dump-flows R1 | grep ct_dnat | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "2
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:1048"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-northd.at:1051: ovn-sbctl dump-flows R1 | grep ip6.dst=| wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-northd.at:1051"
( $at_check_trace; ovn-sbctl dump-flows R1 | grep ip6.dst=| wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:1051"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-northd.at:1054: ovn-sbctl dump-flows R1 | grep ip6.src=| wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-northd.at:1054"
( $at_check_trace; ovn-sbctl dump-flows R1 | grep ip6.src=| wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:1054"
$at_failed && at_fn_log_failure
$at_traceon; }


ovn-nbctl lr-nat-del R1 dnat_and_snat  fd01::1
ovn-nbctl --stateless lr-nat-add R1 dnat_and_snat fd01::1 fd11::2

ovs_wait_cond () {
    test 2 = `ovn-sbctl dump-flows R1 | grep lr_in_unsnat | \
wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:1060" "until test 2 = \`ovn-sbctl dump-flows R1 | grep lr_in_unsnat | \\
wc -l\`"


{ set +x
$as_echo "$at_srcdir/ovn-northd.at:1063: ovn-sbctl dump-flows R1 | grep ct_snat | wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-northd.at:1063"
( $at_check_trace; ovn-sbctl dump-flows R1 | grep ct_snat | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:1063"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-northd.at:1066: ovn-sbctl dump-flows R1 | grep ct_dnat | wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-northd.at:1066"
( $at_check_trace; ovn-sbctl dump-flows R1 | grep ct_dnat | wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:1066"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-northd.at:1069: ovn-sbctl dump-flows R1 | grep ip6.dst=| wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-northd.at:1069"
( $at_check_trace; ovn-sbctl dump-flows R1 | grep ip6.dst=| wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "2
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:1069"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-northd.at:1072: ovn-sbctl dump-flows R1 | grep ip6.src=| wc -l"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-northd.at:1072"
( $at_check_trace; ovn-sbctl dump-flows R1 | grep ip6.src=| wc -l
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "2
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:1072"
$at_failed && at_fn_log_failure
$at_traceon; }


ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_142
#AT_START_143
at_fn_group_banner 143 'ovn-northd.at:1077' \
  "ovn -- check Load balancer health check and Service Monitor sync" "" 3
at_xfail=no
(
  $as_echo "143. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

$as_echo "ovn-northd.at:1078" >"$at_check_line_file"
(test $HAVE_PYTHON = no) \
  && at_fn_check_skip 77 "$at_srcdir/ovn-northd.at:1078"
ovn_start

ovn-nbctl lb-add lb1 10.0.0.10:80 10.0.0.3:80,20.0.0.3:80

ovn-nbctl --wait=sb set load_balancer . ip_port_mappings:10.0.0.3=sw0-p1
ovn-nbctl --wait=sb set load_balancer . ip_port_mappings:20.0.0.3=sw1-p1

ovs_wait_cond () {
    test 0 = `ovn-sbctl list service_monitor |  wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:1086" "until test 0 = \`ovn-sbctl list service_monitor |  wc -l\`"


ovn-nbctl --wait=sb -- --id=@hc create \
Load_Balancer_Health_Check vip="10.0.0.10\:80" -- add Load_Balancer . \
health_check @hc

ovs_wait_cond () {
    test 0 = `ovn-sbctl list service_monitor |  wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:1092" "until test 0 = \`ovn-sbctl list service_monitor |  wc -l\`"


# create logical switches and ports
ovn-nbctl ls-add sw0
ovn-nbctl --wait=sb lsp-add sw0 sw0-p1 -- lsp-set-addresses sw0-p1 \
"00:00:00:00:00:03 10.0.0.3"

ovs_wait_cond () {
    test 0 = `ovn-sbctl --bare --columns _uuid find \
service_monitor | wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:1099" "until test 0 = \`ovn-sbctl --bare --columns _uuid find \\
service_monitor | wc -l\`"


ovn-nbctl ls-add sw1
ovn-nbctl --wait=sb lsp-add sw1 sw1-p1 -- lsp-set-addresses sw1-p1 \
"02:00:00:00:00:03 20.0.0.3"

ovs_wait_cond () {
    test 0 = `ovn-sbctl --bare --columns _uuid find \
service_monitor | sed '/^$/d' | wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:1106" "until test 0 = \`ovn-sbctl --bare --columns _uuid find \\
service_monitor | sed '/^\$/d' | wc -l\`"


ovn-nbctl --wait=sb set load_balancer . ip_port_mappings:10.0.0.3=sw0-p1:10.0.0.2
ovs_wait_cond () {
    test 1 = `ovn-sbctl --bare --columns _uuid find \
service_monitor | wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:1110" "until test 1 = \`ovn-sbctl --bare --columns _uuid find \\
service_monitor | wc -l\`"


ovn-nbctl --wait=sb set load_balancer . ip_port_mappings:20.0.0.3=sw1-p1:20.0.0.2

ovs_wait_cond () {
    test 2 = `ovn-sbctl --bare --columns _uuid find \
service_monitor | sed '/^$/d' | wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:1115" "until test 2 = \`ovn-sbctl --bare --columns _uuid find \\
service_monitor | sed '/^\$/d' | wc -l\`"


ovn-nbctl --wait=sb ls-lb-add sw0 lb1

ovn-sbctl dump-flows sw0 | grep ct_lb | grep priority=120 > lflows.txt
{ set +x
$as_echo "$at_srcdir/ovn-northd.at:1121: cat lflows.txt"
at_fn_check_prepare_trace "ovn-northd.at:1121"
( $at_check_trace; cat lflows.txt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "  table=10(ls_in_stateful     ), priority=120  , match=(ct.new && ip4.dst == 10.0.0.10 && tcp.dst == 80), action=(ct_lb(10.0.0.3:80,20.0.0.3:80);)
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:1121"
$at_failed && at_fn_log_failure
$at_traceon; }


# Delete the Load_Balancer_Health_Check
ovn-nbctl --wait=sb clear load_balancer . health_check
ovs_wait_cond () {
    test 0 = `ovn-sbctl list service_monitor |  wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:1127" "until test 0 = \`ovn-sbctl list service_monitor |  wc -l\`"


ovn-sbctl dump-flows sw0 | grep ct_lb | grep priority=120 > lflows.txt
{ set +x
$as_echo "$at_srcdir/ovn-northd.at:1130: cat lflows.txt"
at_fn_check_prepare_trace "ovn-northd.at:1130"
( $at_check_trace; cat lflows.txt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "  table=10(ls_in_stateful     ), priority=120  , match=(ct.new && ip4.dst == 10.0.0.10 && tcp.dst == 80), action=(ct_lb(10.0.0.3:80,20.0.0.3:80);)
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:1130"
$at_failed && at_fn_log_failure
$at_traceon; }


# Create the Load_Balancer_Health_Check again.
ovn-nbctl --wait=sb -- --id=@hc create \
Load_Balancer_Health_Check vip="10.0.0.10\:80" -- add Load_Balancer . \
health_check @hc

ovs_wait_cond () {
    test 2 = `ovn-sbctl --bare --columns _uuid find \
service_monitor | sed '/^$/d' | wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:1139" "until test 2 = \`ovn-sbctl --bare --columns _uuid find \\
service_monitor | sed '/^\$/d' | wc -l\`"


ovn-sbctl dump-flows sw0 | grep ct_lb | grep priority=120 > lflows.txt
{ set +x
$as_echo "$at_srcdir/ovn-northd.at:1143: cat lflows.txt"
at_fn_check_prepare_trace "ovn-northd.at:1143"
( $at_check_trace; cat lflows.txt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "  table=10(ls_in_stateful     ), priority=120  , match=(ct.new && ip4.dst == 10.0.0.10 && tcp.dst == 80), action=(ct_lb(10.0.0.3:80,20.0.0.3:80);)
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:1143"
$at_failed && at_fn_log_failure
$at_traceon; }


# Get the uuid of both the service_monitor
sm_sw0_p1=`ovn-sbctl --bare --columns _uuid find service_monitor logical_port=sw0-p1`
sm_sw1_p1=`ovn-sbctl --bare --columns _uuid find service_monitor logical_port=sw1-p1`

# Set the service monitor for sw1-p1 to offline
ovn-sbctl set service_monitor $sm_sw1_p1 status=offline

ovs_wait_cond () {

    status=`ovn-sbctl --bare --columns status find service_monitor logical_port=sw1-p1`
    test "$status" = "offline"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:1154" "until
    status=\`ovn-sbctl --bare --columns status find service_monitor logical_port=sw1-p1\`
    test \"\$status\" = \"offline\""


ovn-sbctl dump-flows sw0 | grep ct_lb | grep priority=120 > lflows.txt
{ set +x
$as_echo "$at_srcdir/ovn-northd.at:1159: cat lflows.txt"
at_fn_check_prepare_trace "ovn-northd.at:1159"
( $at_check_trace; cat lflows.txt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "  table=10(ls_in_stateful     ), priority=120  , match=(ct.new && ip4.dst == 10.0.0.10 && tcp.dst == 80), action=(ct_lb(10.0.0.3:80);)
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:1159"
$at_failed && at_fn_log_failure
$at_traceon; }


# Set the service monitor for sw0-p1 to offline
ovn-sbctl set service_monitor $sm_sw0_p1 status=offline

ovs_wait_cond () {

    status=`ovn-sbctl --bare --columns status find service_monitor logical_port=sw0-p1`
    test "$status" = "offline"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:1166" "until
    status=\`ovn-sbctl --bare --columns status find service_monitor logical_port=sw0-p1\`
    test \"\$status\" = \"offline\""


ovn-sbctl dump-flows sw0 | grep ct_lb | grep priority=120 > lflows.txt
{ set +x
$as_echo "$at_srcdir/ovn-northd.at:1171: cat lflows.txt"
at_fn_check_prepare_trace "ovn-northd.at:1171"
( $at_check_trace; cat lflows.txt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:1171"
$at_failed && at_fn_log_failure
$at_traceon; }


ovn-sbctl dump-flows sw0 | grep "ip4.dst == 10.0.0.10 && tcp.dst == 80" \
| grep priority=120 > lflows.txt
{ set +x
$as_echo "$at_srcdir/ovn-northd.at:1176: cat lflows.txt"
at_fn_check_prepare_trace "ovn-northd.at:1176"
( $at_check_trace; cat lflows.txt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "  table=10(ls_in_stateful     ), priority=120  , match=(ct.new && ip4.dst == 10.0.0.10 && tcp.dst == 80), action=(drop;)
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:1176"
$at_failed && at_fn_log_failure
$at_traceon; }


# Set the service monitor for sw0-p1 and sw1-p1 to online
ovn-sbctl set service_monitor $sm_sw0_p1 status=online
ovn-sbctl set service_monitor $sm_sw1_p1 status=online

ovs_wait_cond () {

    status=`ovn-sbctl --bare --columns status find service_monitor logical_port=sw1-p1`
    test "$status" = "online"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:1184" "until
    status=\`ovn-sbctl --bare --columns status find service_monitor logical_port=sw1-p1\`
    test \"\$status\" = \"online\""


ovn-sbctl dump-flows sw0 | grep ct_lb | grep priority=120 > lflows.txt
{ set +x
$as_echo "$at_srcdir/ovn-northd.at:1189: cat lflows.txt"
at_fn_check_prepare_trace "ovn-northd.at:1189"
( $at_check_trace; cat lflows.txt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "  table=10(ls_in_stateful     ), priority=120  , match=(ct.new && ip4.dst == 10.0.0.10 && tcp.dst == 80), action=(ct_lb(10.0.0.3:80,20.0.0.3:80);)
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:1189"
$at_failed && at_fn_log_failure
$at_traceon; }


# Set the service monitor for sw1-p1 to error
ovn-sbctl set service_monitor $sm_sw1_p1 status=error
ovs_wait_cond () {

    status=`ovn-sbctl --bare --columns status find service_monitor logical_port=sw1-p1`
    test "$status" = "error"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:1195" "until
    status=\`ovn-sbctl --bare --columns status find service_monitor logical_port=sw1-p1\`
    test \"\$status\" = \"error\""


ovn-sbctl dump-flows sw0 | grep "ip4.dst == 10.0.0.10 && tcp.dst == 80" \
| grep priority=120 > lflows.txt
{ set +x
$as_echo "$at_srcdir/ovn-northd.at:1201: cat lflows.txt"
at_fn_check_prepare_trace "ovn-northd.at:1201"
( $at_check_trace; cat lflows.txt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "  table=10(ls_in_stateful     ), priority=120  , match=(ct.new && ip4.dst == 10.0.0.10 && tcp.dst == 80), action=(ct_lb(10.0.0.3:80);)
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:1201"
$at_failed && at_fn_log_failure
$at_traceon; }


# Add one more vip to lb1

ovn-nbctl set load_balancer . vip:"10.0.0.40\:1000"="10.0.0.3:1000,20.0.0.3:80"

# create health_check for new vip - 10.0.0.40
ovn-nbctl --wait=sb -- --id=@hc create \
Load_Balancer_Health_Check vip="10.0.0.40\:1000" -- add Load_Balancer . \
health_check @hc

# There should be totally 3 rows in service_monitor for -
#    * 10.0.0.3:80
#    * 10.0.0.3:1000
#    * 20.0.0.3:80

ovs_wait_cond () {
    test 3 = `ovn-sbctl --bare --columns _uuid find \
service_monitor | sed '/^$/d' | wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:1219" "until test 3 = \`ovn-sbctl --bare --columns _uuid find \\
service_monitor | sed '/^\$/d' | wc -l\`"


# There should be 2 rows with logical_port=sw0-p1
ovs_wait_cond () {
    test 2 = `ovn-sbctl --bare --columns _uuid find \
service_monitor logical_port=sw0-p1 | sed '/^$/d' | wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:1223" "until test 2 = \`ovn-sbctl --bare --columns _uuid find \\
service_monitor logical_port=sw0-p1 | sed '/^\$/d' | wc -l\`"


# There should be 1 row1 with port=1000
ovs_wait_cond () {
    test 1 = `ovn-sbctl --bare --columns _uuid find \
service_monitor port=1000 | sed '/^$/d' | wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:1227" "until test 1 = \`ovn-sbctl --bare --columns _uuid find \\
service_monitor port=1000 | sed '/^\$/d' | wc -l\`"


ovn-sbctl dump-flows sw0 | grep ct_lb | grep priority=120 > lflows.txt
{ set +x
$as_echo "$at_srcdir/ovn-northd.at:1231: cat lflows.txt"
at_fn_check_prepare_trace "ovn-northd.at:1231"
( $at_check_trace; cat lflows.txt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "  table=10(ls_in_stateful     ), priority=120  , match=(ct.new && ip4.dst == 10.0.0.10 && tcp.dst == 80), action=(ct_lb(10.0.0.3:80);)
  table=10(ls_in_stateful     ), priority=120  , match=(ct.new && ip4.dst == 10.0.0.40 && tcp.dst == 1000), action=(ct_lb(10.0.0.3:1000);)
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:1231"
$at_failed && at_fn_log_failure
$at_traceon; }


# Set the service monitor for sw1-p1 to online
ovn-sbctl set service_monitor $sm_sw1_p1 status=online

ovs_wait_cond () {

    status=`ovn-sbctl --bare --columns status find service_monitor logical_port=sw1-p1`
    test "$status" = "online"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:1239" "until
    status=\`ovn-sbctl --bare --columns status find service_monitor logical_port=sw1-p1\`
    test \"\$status\" = \"online\""


ovn-sbctl dump-flows sw0 | grep ct_lb | grep priority=120 > lflows.txt
{ set +x
$as_echo "$at_srcdir/ovn-northd.at:1244: cat lflows.txt"
at_fn_check_prepare_trace "ovn-northd.at:1244"
( $at_check_trace; cat lflows.txt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "  table=10(ls_in_stateful     ), priority=120  , match=(ct.new && ip4.dst == 10.0.0.10 && tcp.dst == 80), action=(ct_lb(10.0.0.3:80,20.0.0.3:80);)
  table=10(ls_in_stateful     ), priority=120  , match=(ct.new && ip4.dst == 10.0.0.40 && tcp.dst == 1000), action=(ct_lb(10.0.0.3:1000,20.0.0.3:80);)
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:1244"
$at_failed && at_fn_log_failure
$at_traceon; }


# Associate lb1 to sw1
ovn-nbctl --wait=sb ls-lb-add sw1 lb1
ovn-sbctl dump-flows sw1 | grep ct_lb | grep priority=120 > lflows.txt
{ set +x
$as_echo "$at_srcdir/ovn-northd.at:1252: cat lflows.txt"
at_fn_check_prepare_trace "ovn-northd.at:1252"
( $at_check_trace; cat lflows.txt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "  table=10(ls_in_stateful     ), priority=120  , match=(ct.new && ip4.dst == 10.0.0.10 && tcp.dst == 80), action=(ct_lb(10.0.0.3:80,20.0.0.3:80);)
  table=10(ls_in_stateful     ), priority=120  , match=(ct.new && ip4.dst == 10.0.0.40 && tcp.dst == 1000), action=(ct_lb(10.0.0.3:1000,20.0.0.3:80);)
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-northd.at:1252"
$at_failed && at_fn_log_failure
$at_traceon; }


# Now create lb2 same as lb1 but udp protocol.
ovn-nbctl lb-add lb2 10.0.0.10:80 10.0.0.3:80,20.0.0.3:80 udp
lb2_uuid=`ovn-nbctl lb-list | grep udp | awk '{print $1}'`
ovn-nbctl --wait=sb set load_balancer $lb2_uuid ip_port_mappings:10.0.0.3=sw0-p1:10.0.0.2
ovn-nbctl --wait=sb set load_balancer $lb2_uuid ip_port_mappings:20.0.0.3=sw1-p1:20.0.0.2

ovn-nbctl -- --id=@hc create Load_Balancer_Health_Check vip="10.0.0.10\:80" -- add Load_Balancer $lb2_uuid health_check @hc

ovn-nbctl ls-lb-add sw0 lb2
ovn-nbctl ls-lb-add sw1 lb2
ovn-nbctl lr-lb-add lr0 lb2

ovs_wait_cond () {
    test 5 = `ovn-sbctl --bare --columns _uuid find \
service_monitor | sed '/^$/d' | wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:1269" "until test 5 = \`ovn-sbctl --bare --columns _uuid find \\
service_monitor | sed '/^\$/d' | wc -l\`"


# Change the svc_monitor_mac. This should get reflected in service_monitor table rows.
ovn-nbctl set NB_Global . options:svc_monitor_mac="fe:a0:65:a2:01:03"

ovs_wait_cond () {
    test 5 = `ovn-sbctl --bare --columns src_mac find \
service_monitor | grep "fe:a0:65:a2:01:03" | wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:1275" "until test 5 = \`ovn-sbctl --bare --columns src_mac find \\
service_monitor | grep \"fe:a0:65:a2:01:03\" | wc -l\`"


# Change the source ip for 10.0.0.3 backend ip in lb2
ovn-nbctl --wait=sb set load_balancer $lb2_uuid ip_port_mappings:10.0.0.3=sw0-p1:10.0.0.100

ovs_wait_cond () {
    test 1 = `ovn-sbctl --bare --columns src_ip find \
service_monitor logical_port=sw0-p1 | grep "10.0.0.100" | wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:1281" "until test 1 = \`ovn-sbctl --bare --columns src_ip find \\
service_monitor logical_port=sw0-p1 | grep \"10.0.0.100\" | wc -l\`"


ovn-nbctl --wait=sb lb-del lb1
ovs_wait_cond () {
    test 2 = `ovn-sbctl --bare --columns _uuid find service_monitor | sed '/^$/d' | wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:1285" "until test 2 = \`ovn-sbctl --bare --columns _uuid find service_monitor | sed '/^\$/d' | wc -l\`"


ovn-nbctl --wait=sb lb-del lb2
ovs_wait_cond () {
    test 0 = `ovn-sbctl list service_monitor |  wc -l`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-northd.at:1288" "until test 0 = \`ovn-sbctl list service_monitor |  wc -l\`"


ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_143
#AT_START_144
at_fn_group_banner 144 'ovn-nbctl.at:56' \
  "ovn-nbctl - basic switch commands - direct" "     " 4
at_xfail=no
(
  $as_echo "144. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init



   ovn_nbctl_test_start  direct
    ovn_nbctl_basic_switch
    ovn_nbctl_test_stop
    ovs_cleanup
$as_echo "$at_setup_line" >"$at_check_line_file"
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_144
#AT_START_145
at_fn_group_banner 145 'ovn-nbctl.at:56' \
  "ovn-nbctl - basic switch commands - daemon" "     " 4
at_xfail=no
(
  $as_echo "145. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init



   ovn_nbctl_test_start  daemon
    ovn_nbctl_basic_switch
    ovn_nbctl_test_stop
    ovs_cleanup
$as_echo "$at_setup_line" >"$at_check_line_file"
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_145
#AT_START_146
at_fn_group_banner 146 'ovn-nbctl.at:109' \
  "ovn-nbctl - basic logical switch port commands - direct" "" 4
at_xfail=no
(
  $as_echo "146. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init



   ovn_nbctl_test_start  direct
    ovn_nbctl_basic_lsp
    ovn_nbctl_test_stop
    ovs_cleanup
$as_echo "$at_setup_line" >"$at_check_line_file"
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_146
#AT_START_147
at_fn_group_banner 147 'ovn-nbctl.at:109' \
  "ovn-nbctl - basic logical switch port commands - daemon" "" 4
at_xfail=no
(
  $as_echo "147. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init



   ovn_nbctl_test_start  daemon
    ovn_nbctl_basic_lsp
    ovn_nbctl_test_stop
    ovs_cleanup
$as_echo "$at_setup_line" >"$at_check_line_file"
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_147
#AT_START_148
at_fn_group_banner 148 'ovn-nbctl.at:156' \
  "ovn-nbctl - lsp get ls - direct" "                " 4
at_xfail=no
(
  $as_echo "148. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init



   ovn_nbctl_test_start  direct
    ovn_nbctl_lsp_get_ls
    ovn_nbctl_test_stop
    ovs_cleanup
$as_echo "$at_setup_line" >"$at_check_line_file"
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_148
#AT_START_149
at_fn_group_banner 149 'ovn-nbctl.at:156' \
  "ovn-nbctl - lsp get ls - daemon" "                " 4
at_xfail=no
(
  $as_echo "149. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init



   ovn_nbctl_test_start  daemon
    ovn_nbctl_lsp_get_ls
    ovn_nbctl_test_stop
    ovs_cleanup
$as_echo "$at_setup_line" >"$at_check_line_file"
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_149
#AT_START_150
at_fn_group_banner 150 'ovn-nbctl.at:170' \
  "ovn-nbctl - lport addresses - direct" "           " 4
at_xfail=no
(
  $as_echo "150. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init



   ovn_nbctl_test_start  direct
    ovn_nbctl_lport_addresses
    ovn_nbctl_test_stop
    ovs_cleanup
$as_echo "$at_setup_line" >"$at_check_line_file"
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_150
#AT_START_151
at_fn_group_banner 151 'ovn-nbctl.at:170' \
  "ovn-nbctl - lport addresses - daemon" "           " 4
at_xfail=no
(
  $as_echo "151. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init



   ovn_nbctl_test_start  daemon
    ovn_nbctl_lport_addresses
    ovn_nbctl_test_stop
    ovs_cleanup
$as_echo "$at_setup_line" >"$at_check_line_file"
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_151
#AT_START_152
at_fn_group_banner 152 'ovn-nbctl.at:188' \
  "ovn-nbctl - port security - direct" "             " 4
at_xfail=no
(
  $as_echo "152. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init



   ovn_nbctl_test_start  direct
    ovn_nbctl_port_security
    ovn_nbctl_test_stop
    ovs_cleanup
$as_echo "$at_setup_line" >"$at_check_line_file"
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_152
#AT_START_153
at_fn_group_banner 153 'ovn-nbctl.at:188' \
  "ovn-nbctl - port security - daemon" "             " 4
at_xfail=no
(
  $as_echo "153. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init



   ovn_nbctl_test_start  daemon
    ovn_nbctl_port_security
    ovn_nbctl_test_stop
    ovs_cleanup
$as_echo "$at_setup_line" >"$at_check_line_file"
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_153
#AT_START_154
at_fn_group_banner 154 'ovn-nbctl.at:206' \
  "ovn-nbctl - ACLs - direct" "                      " 4
at_xfail=no
(
  $as_echo "154. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init



   ovn_nbctl_test_start  direct
    ovn_nbctl_acls
    ovn_nbctl_test_stop
    ovs_cleanup
$as_echo "$at_setup_line" >"$at_check_line_file"
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_154
#AT_START_155
at_fn_group_banner 155 'ovn-nbctl.at:206' \
  "ovn-nbctl - ACLs - daemon" "                      " 4
at_xfail=no
(
  $as_echo "155. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init



   ovn_nbctl_test_start  daemon
    ovn_nbctl_acls
    ovn_nbctl_test_stop
    ovs_cleanup
$as_echo "$at_setup_line" >"$at_check_line_file"
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_155
#AT_START_156
at_fn_group_banner 156 'ovn-nbctl.at:273' \
  "ovn-nbctl - QoS - direct" "                       " 4
at_xfail=no
(
  $as_echo "156. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init



   ovn_nbctl_test_start  direct
    ovn_nbctl_qos
    ovn_nbctl_test_stop
    ovs_cleanup
$as_echo "$at_setup_line" >"$at_check_line_file"
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_156
#AT_START_157
at_fn_group_banner 157 'ovn-nbctl.at:273' \
  "ovn-nbctl - QoS - daemon" "                       " 4
at_xfail=no
(
  $as_echo "157. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init



   ovn_nbctl_test_start  daemon
    ovn_nbctl_qos
    ovn_nbctl_test_stop
    ovs_cleanup
$as_echo "$at_setup_line" >"$at_check_line_file"
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_157
#AT_START_158
at_fn_group_banner 158 'ovn-nbctl.at:342' \
  "ovn-nbctl - meters - direct" "                    " 4
at_xfail=no
(
  $as_echo "158. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init



   ovn_nbctl_test_start  direct
    ovn_nbctl_meters
    ovn_nbctl_test_stop
    ovs_cleanup
$as_echo "$at_setup_line" >"$at_check_line_file"
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_158
#AT_START_159
at_fn_group_banner 159 'ovn-nbctl.at:342' \
  "ovn-nbctl - meters - daemon" "                    " 4
at_xfail=no
(
  $as_echo "159. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init



   ovn_nbctl_test_start  daemon
    ovn_nbctl_meters
    ovn_nbctl_test_stop
    ovs_cleanup
$as_echo "$at_setup_line" >"$at_check_line_file"
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_159
#AT_START_160
at_fn_group_banner 160 'ovn-nbctl.at:404' \
  "ovn-nbctl - NATs - direct" "                      " 4
at_xfail=no
(
  $as_echo "160. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init



   ovn_nbctl_test_start  direct
    ovn_nbctl_nats
    ovn_nbctl_test_stop
    ovs_cleanup
$as_echo "$at_setup_line" >"$at_check_line_file"
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_160
#AT_START_161
at_fn_group_banner 161 'ovn-nbctl.at:404' \
  "ovn-nbctl - NATs - daemon" "                      " 4
at_xfail=no
(
  $as_echo "161. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init



   ovn_nbctl_test_start  daemon
    ovn_nbctl_nats
    ovn_nbctl_test_stop
    ovs_cleanup
$as_echo "$at_setup_line" >"$at_check_line_file"
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_161
#AT_START_162
at_fn_group_banner 162 'ovn-nbctl.at:613' \
  "ovn-nbctl - LBs - direct" "                       " 4
at_xfail=no
(
  $as_echo "162. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init



   ovn_nbctl_test_start  direct
    ovn_nbctl_lbs
    ovn_nbctl_test_stop
    ovs_cleanup
$as_echo "$at_setup_line" >"$at_check_line_file"
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_162
#AT_START_163
at_fn_group_banner 163 'ovn-nbctl.at:613' \
  "ovn-nbctl - LBs - daemon" "                       " 4
at_xfail=no
(
  $as_echo "163. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init



   ovn_nbctl_test_start  daemon
    ovn_nbctl_lbs
    ovn_nbctl_test_stop
    ovs_cleanup
$as_echo "$at_setup_line" >"$at_check_line_file"
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_163
#AT_START_164
at_fn_group_banner 164 'ovn-nbctl.at:841' \
  "ovn-nbctl - LBs IPv6 - direct" "                  " 4
at_xfail=no
(
  $as_echo "164. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init



   ovn_nbctl_test_start  direct
    ovn_nbctl_lbs_ipv6
    ovn_nbctl_test_stop
    ovs_cleanup
$as_echo "$at_setup_line" >"$at_check_line_file"
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_164
#AT_START_165
at_fn_group_banner 165 'ovn-nbctl.at:841' \
  "ovn-nbctl - LBs IPv6 - daemon" "                  " 4
at_xfail=no
(
  $as_echo "165. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init



   ovn_nbctl_test_start  daemon
    ovn_nbctl_lbs_ipv6
    ovn_nbctl_test_stop
    ovs_cleanup
$as_echo "$at_setup_line" >"$at_check_line_file"
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_165
#AT_START_166
at_fn_group_banner 166 'ovn-nbctl.at:1100' \
  "ovn-nbctl - basic logical router commands - direct" "" 4
at_xfail=no
(
  $as_echo "166. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init



   ovn_nbctl_test_start  direct
    ovn_nbctl_basic_lr
    ovn_nbctl_test_stop
    ovs_cleanup
$as_echo "$at_setup_line" >"$at_check_line_file"
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_166
#AT_START_167
at_fn_group_banner 167 'ovn-nbctl.at:1100' \
  "ovn-nbctl - basic logical router commands - daemon" "" 4
at_xfail=no
(
  $as_echo "167. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init



   ovn_nbctl_test_start  daemon
    ovn_nbctl_basic_lr
    ovn_nbctl_test_stop
    ovs_cleanup
$as_echo "$at_setup_line" >"$at_check_line_file"
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_167
#AT_START_168
at_fn_group_banner 168 'ovn-nbctl.at:1153' \
  "ovn-nbctl - basic logical router port commands - direct" "" 4
at_xfail=no
(
  $as_echo "168. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init



   ovn_nbctl_test_start  direct
    ovn_nbctl_basic_lrp
    ovn_nbctl_test_stop
    ovs_cleanup
$as_echo "$at_setup_line" >"$at_check_line_file"
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_168
#AT_START_169
at_fn_group_banner 169 'ovn-nbctl.at:1153' \
  "ovn-nbctl - basic logical router port commands - daemon" "" 4
at_xfail=no
(
  $as_echo "169. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init



   ovn_nbctl_test_start  daemon
    ovn_nbctl_basic_lrp
    ovn_nbctl_test_stop
    ovs_cleanup
$as_echo "$at_setup_line" >"$at_check_line_file"
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_169
#AT_START_170
at_fn_group_banner 170 'ovn-nbctl.at:1223' \
  "ovn-nbctl - logical router port gateway chassis - direct" "" 4
at_xfail=no
(
  $as_echo "170. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init



   ovn_nbctl_test_start  direct
    ovn_nbctl_lrp_gw_chassi
    ovn_nbctl_test_stop
    ovs_cleanup
$as_echo "$at_setup_line" >"$at_check_line_file"
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_170
#AT_START_171
at_fn_group_banner 171 'ovn-nbctl.at:1223' \
  "ovn-nbctl - logical router port gateway chassis - daemon" "" 4
at_xfail=no
(
  $as_echo "171. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init



   ovn_nbctl_test_start  daemon
    ovn_nbctl_lrp_gw_chassi
    ovn_nbctl_test_stop
    ovs_cleanup
$as_echo "$at_setup_line" >"$at_check_line_file"
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_171
#AT_START_172
at_fn_group_banner 172 'ovn-nbctl.at:1283' \
  "ovn-nbctl - logical router port redirect type - direct" "" 4
at_xfail=no
(
  $as_echo "172. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init



   ovn_nbctl_test_start  direct
    ovn_nbctl_redirect_type
    ovn_nbctl_test_stop
    ovs_cleanup
$as_echo "$at_setup_line" >"$at_check_line_file"
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_172
#AT_START_173
at_fn_group_banner 173 'ovn-nbctl.at:1283' \
  "ovn-nbctl - logical router port redirect type - daemon" "" 4
at_xfail=no
(
  $as_echo "173. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init



   ovn_nbctl_test_start  daemon
    ovn_nbctl_redirect_type
    ovn_nbctl_test_stop
    ovs_cleanup
$as_echo "$at_setup_line" >"$at_check_line_file"
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_173
#AT_START_174
at_fn_group_banner 174 'ovn-nbctl.at:1308' \
  "ovn-nbctl - logical router port enable and disable - direct" "" 4
at_xfail=no
(
  $as_echo "174. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init



   ovn_nbctl_test_start  direct
    ovn_nbctl_lrp_enable
    ovn_nbctl_test_stop
    ovs_cleanup
$as_echo "$at_setup_line" >"$at_check_line_file"
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_174
#AT_START_175
at_fn_group_banner 175 'ovn-nbctl.at:1308' \
  "ovn-nbctl - logical router port enable and disable - daemon" "" 4
at_xfail=no
(
  $as_echo "175. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init



   ovn_nbctl_test_start  daemon
    ovn_nbctl_lrp_enable
    ovn_nbctl_test_stop
    ovs_cleanup
$as_echo "$at_setup_line" >"$at_check_line_file"
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_175
#AT_START_176
at_fn_group_banner 176 'ovn-nbctl.at:1328' \
  "ovn-nbctl - routes - direct" "                    " 4
at_xfail=no
(
  $as_echo "176. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init



   ovn_nbctl_test_start  direct
    ovn_nbctl_routes
    ovn_nbctl_test_stop
    ovs_cleanup
$as_echo "$at_setup_line" >"$at_check_line_file"
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_176
#AT_START_177
at_fn_group_banner 177 'ovn-nbctl.at:1328' \
  "ovn-nbctl - routes - daemon" "                    " 4
at_xfail=no
(
  $as_echo "177. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init



   ovn_nbctl_test_start  daemon
    ovn_nbctl_routes
    ovn_nbctl_test_stop
    ovs_cleanup
$as_echo "$at_setup_line" >"$at_check_line_file"
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_177
#AT_START_178
at_fn_group_banner 178 'ovn-nbctl.at:1509' \
  "ovn-nbctl - policies - direct" "                  " 4
at_xfail=no
(
  $as_echo "178. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init



   ovn_nbctl_test_start  direct
    ovn_nbctl_policies
    ovn_nbctl_test_stop
    ovs_cleanup
$as_echo "$at_setup_line" >"$at_check_line_file"
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_178
#AT_START_179
at_fn_group_banner 179 'ovn-nbctl.at:1509' \
  "ovn-nbctl - policies - daemon" "                  " 4
at_xfail=no
(
  $as_echo "179. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init



   ovn_nbctl_test_start  daemon
    ovn_nbctl_policies
    ovn_nbctl_test_stop
    ovs_cleanup
$as_echo "$at_setup_line" >"$at_check_line_file"
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_179
#AT_START_180
at_fn_group_banner 180 'ovn-nbctl.at:1566' \
  "ovn-nbctl - lsp types - direct" "                 " 4
at_xfail=no
(
  $as_echo "180. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init



   ovn_nbctl_test_start  direct
    ovn_nbctl_lsp_types
    ovn_nbctl_test_stop
    ovs_cleanup
$as_echo "$at_setup_line" >"$at_check_line_file"
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_180
#AT_START_181
at_fn_group_banner 181 'ovn-nbctl.at:1566' \
  "ovn-nbctl - lsp types - daemon" "                 " 4
at_xfail=no
(
  $as_echo "181. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init



   ovn_nbctl_test_start  daemon
    ovn_nbctl_lsp_types
    ovn_nbctl_test_stop
    ovs_cleanup
$as_echo "$at_setup_line" >"$at_check_line_file"
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_181
#AT_START_182
at_fn_group_banner 182 'ovn-nbctl.at:1634' \
  "ovn-nbctl - connection - direct" "                " 4
at_xfail=no
(
  $as_echo "182. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init



   ovn_nbctl_test_start  direct
    ovn_nbctl_connection
    ovn_nbctl_test_stop
    ovs_cleanup
$as_echo "$at_setup_line" >"$at_check_line_file"
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_182
#AT_START_183
at_fn_group_banner 183 'ovn-nbctl.at:1634' \
  "ovn-nbctl - connection - daemon" "                " 4
at_xfail=no
(
  $as_echo "183. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init



   ovn_nbctl_test_start  daemon
    ovn_nbctl_connection
    ovn_nbctl_test_stop
    ovs_cleanup
$as_echo "$at_setup_line" >"$at_check_line_file"
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_183
#AT_START_184
at_fn_group_banner 184 'ovn-nbctl.at:1643' \
  "ovn-nbctl - dry run mode - direct" "              " 4
at_xfail=no
(
  $as_echo "184. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init



   ovn_nbctl_test_start  direct
    ovn_nbctl_dry_run_mode
    ovn_nbctl_test_stop
    ovs_cleanup
$as_echo "$at_setup_line" >"$at_check_line_file"
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_184
#AT_START_185
at_fn_group_banner 185 'ovn-nbctl.at:1643' \
  "ovn-nbctl - dry run mode - daemon" "              " 4
at_xfail=no
(
  $as_echo "185. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init



   ovn_nbctl_test_start  daemon
    ovn_nbctl_dry_run_mode
    ovn_nbctl_test_stop
    ovs_cleanup
$as_echo "$at_setup_line" >"$at_check_line_file"
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_185
#AT_START_186
at_fn_group_banner 186 'ovn-nbctl.at:1659' \
  "ovn-nbctl - oneline output - direct" "            " 4
at_xfail=no
(
  $as_echo "186. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init



   ovn_nbctl_test_start  direct
    ovn_nbctl_oneline_output
    ovn_nbctl_test_stop
    ovs_cleanup
$as_echo "$at_setup_line" >"$at_check_line_file"
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_186
#AT_START_187
at_fn_group_banner 187 'ovn-nbctl.at:1659' \
  "ovn-nbctl - oneline output - daemon" "            " 4
at_xfail=no
(
  $as_echo "187. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init



   ovn_nbctl_test_start  daemon
    ovn_nbctl_oneline_output
    ovn_nbctl_test_stop
    ovs_cleanup
$as_echo "$at_setup_line" >"$at_check_line_file"
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_187
#AT_START_188
at_fn_group_banner 188 'ovn-nbctl.at:1675' \
  "ovn-nbctl - commands parser error paths - direct" "" 4
at_xfail=no
(
  $as_echo "188. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init



   ovn_nbctl_test_start  direct
    ovn_nbctl_error_paths
    ovn_nbctl_test_stop
    ovs_cleanup
$as_echo "$at_setup_line" >"$at_check_line_file"
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_188
#AT_START_189
at_fn_group_banner 189 'ovn-nbctl.at:1675' \
  "ovn-nbctl - commands parser error paths - daemon" "" 4
at_xfail=no
(
  $as_echo "189. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init



   ovn_nbctl_test_start  daemon
    ovn_nbctl_error_paths
    ovn_nbctl_test_stop
    ovs_cleanup
$as_echo "$at_setup_line" >"$at_check_line_file"
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_189
#AT_START_190
at_fn_group_banner 190 'ovn-nbctl.at:1746' \
  "ovn-nbctl - port groups - direct" "               " 4
at_xfail=no
(
  $as_echo "190. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init



   ovn_nbctl_test_start  direct
    ovn_nbctl_port_groups
    ovn_nbctl_test_stop
    ovs_cleanup
$as_echo "$at_setup_line" >"$at_check_line_file"
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_190
#AT_START_191
at_fn_group_banner 191 'ovn-nbctl.at:1746' \
  "ovn-nbctl - port groups - daemon" "               " 4
at_xfail=no
(
  $as_echo "191. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init



   ovn_nbctl_test_start  daemon
    ovn_nbctl_port_groups
    ovn_nbctl_test_stop
    ovs_cleanup
$as_echo "$at_setup_line" >"$at_check_line_file"
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_191
#AT_START_192
at_fn_group_banner 192 'ovn-nbctl.at:1753' \
  "ovn-nbctl - extra newlines - direct" "            " 4
at_xfail=no
(
  $as_echo "192. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init



   ovn_nbctl_test_start  direct
    ovn_nbctl_extra_newlines
    ovn_nbctl_test_stop
    ovs_cleanup
$as_echo "$at_setup_line" >"$at_check_line_file"
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_192
#AT_START_193
at_fn_group_banner 193 'ovn-nbctl.at:1753' \
  "ovn-nbctl - extra newlines - daemon" "            " 4
at_xfail=no
(
  $as_echo "193. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init



   ovn_nbctl_test_start  daemon
    ovn_nbctl_extra_newlines
    ovn_nbctl_test_stop
    ovs_cleanup
$as_echo "$at_setup_line" >"$at_check_line_file"
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_193
#AT_START_194
at_fn_group_banner 194 'ovn-nbctl.at:1765' \
  "ovn-nbctl - table formatting - direct" "          " 4
at_xfail=no
(
  $as_echo "194. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init



   ovn_nbctl_test_start  direct
    ovn_nbctl_table_formatting
    ovn_nbctl_test_stop
    ovs_cleanup
$as_echo "$at_setup_line" >"$at_check_line_file"
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_194
#AT_START_195
at_fn_group_banner 195 'ovn-nbctl.at:1765' \
  "ovn-nbctl - table formatting - daemon" "          " 4
at_xfail=no
(
  $as_echo "195. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init



   ovn_nbctl_test_start  daemon
    ovn_nbctl_table_formatting
    ovn_nbctl_test_stop
    ovs_cleanup
$as_echo "$at_setup_line" >"$at_check_line_file"
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_195
#AT_START_196
at_fn_group_banner 196 'ovn-nbctl.at:1775' \
  "ovn-nbctl - port group commands - direct" "       " 4
at_xfail=no
(
  $as_echo "196. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init



   ovn_nbctl_test_start  direct
    ovn_nbctl_port_group_commands
    ovn_nbctl_test_stop
    ovs_cleanup
$as_echo "$at_setup_line" >"$at_check_line_file"
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_196
#AT_START_197
at_fn_group_banner 197 'ovn-nbctl.at:1775' \
  "ovn-nbctl - port group commands - daemon" "       " 4
at_xfail=no
(
  $as_echo "197. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init



   ovn_nbctl_test_start  daemon
    ovn_nbctl_port_group_commands
    ovn_nbctl_test_stop
    ovs_cleanup
$as_echo "$at_setup_line" >"$at_check_line_file"
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_197
#AT_START_198
at_fn_group_banner 198 'ovn-nbctl.at:1808' \
  "ovn-nbctl - fwd groups - direct" "                " 4
at_xfail=no
(
  $as_echo "198. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init



   ovn_nbctl_test_start  direct
    ovn_nbctl_fwd_groups
    ovn_nbctl_test_stop
    ovs_cleanup
$as_echo "$at_setup_line" >"$at_check_line_file"
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_198
#AT_START_199
at_fn_group_banner 199 'ovn-nbctl.at:1808' \
  "ovn-nbctl - fwd groups - daemon" "                " 4
at_xfail=no
(
  $as_echo "199. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init



   ovn_nbctl_test_start  daemon
    ovn_nbctl_fwd_groups
    ovn_nbctl_test_stop
    ovs_cleanup
$as_echo "$at_setup_line" >"$at_check_line_file"
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_199
#AT_START_200
at_fn_group_banner 200 'ovn-nbctl.at:1844' \
  "ovn-nbctl - daemon retry connection" "            " 4
at_xfail=no
(
  $as_echo "200. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init



   ovn_nbctl_test_start  daemon
{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1846: kill \`cat ovsdb-server.pid\`"
at_fn_check_prepare_notrace 'a `...` command substitution' "ovn-nbctl.at:1846"
( $at_check_trace; kill `cat ovsdb-server.pid`
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1846"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1847: ovsdb-server --detach --no-chdir --pidfile --log-file --remote=punix:\$OVS_RUNDIR/ovnnb_db.sock ovn-nb.db"
at_fn_check_prepare_dynamic "ovsdb-server --detach --no-chdir --pidfile --log-file --remote=punix:$OVS_RUNDIR/ovnnb_db.sock ovn-nb.db" "ovn-nbctl.at:1847"
( $at_check_trace; ovsdb-server --detach --no-chdir --pidfile --log-file --remote=punix:$OVS_RUNDIR/ovnnb_db.sock ovn-nb.db
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1847"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-nbctl.at:1848: ovn-nbctl show"
at_fn_check_prepare_trace "ovn-nbctl.at:1848"
( $at_check_trace; ovn-nbctl show
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn-nbctl.at:1848"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

ovn_nbctl_test_stop /Terminated/d
ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_200
#AT_START_201
at_fn_group_banner 201 'ovn-sbctl.at:37' \
  "ovn-sbctl - chassis commands" "                   " 5
at_xfail=no
(
  $as_echo "201. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init


   for daemon in ovn-nb ovn-sb; do
      { set +x
$as_echo "$at_srcdir/ovn-sbctl.at:38: ovsdb-tool create \$daemon.db \$abs_top_srcdir/\${daemon}.ovsschema"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "ovn-sbctl.at:38"
( $at_check_trace; ovsdb-tool create $daemon.db $abs_top_srcdir/${daemon}.ovsschema
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:38"
$at_failed && at_fn_log_failure
$at_traceon; }

   done

      { set +x
$as_echo "$at_srcdir/ovn-sbctl.at:38: ovsdb-server --detach --no-chdir --pidfile=ovnnb_db.pid --unixctl=\$OVS_RUNDIR/ovnnb_db.ctl --log-file=ovsdb_nb.log --remote=punix:\$OVS_RUNDIR/ovnnb_db.sock ovn-nb.db "
at_fn_check_prepare_dynamic "ovsdb-server --detach --no-chdir --pidfile=ovnnb_db.pid --unixctl=$OVS_RUNDIR/ovnnb_db.ctl --log-file=ovsdb_nb.log --remote=punix:$OVS_RUNDIR/ovnnb_db.sock ovn-nb.db " "ovn-sbctl.at:38"
( $at_check_trace; ovsdb-server --detach --no-chdir --pidfile=ovnnb_db.pid --unixctl=$OVS_RUNDIR/ovnnb_db.ctl --log-file=ovsdb_nb.log --remote=punix:$OVS_RUNDIR/ovnnb_db.sock ovn-nb.db
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:38"
$at_failed && at_fn_log_failure
$at_traceon; }

   { set +x
$as_echo "$at_srcdir/ovn-sbctl.at:38: ovsdb-server --detach --no-chdir --pidfile=ovnsb_db.pid --unixctl=\$OVS_RUNDIR/ovnsb_db.ctl --log-file=ovsdb_sb.log --remote=punix:\$OVS_RUNDIR/ovnsb_db.sock ovn-sb.db"
at_fn_check_prepare_dynamic "ovsdb-server --detach --no-chdir --pidfile=ovnsb_db.pid --unixctl=$OVS_RUNDIR/ovnsb_db.ctl --log-file=ovsdb_sb.log --remote=punix:$OVS_RUNDIR/ovnsb_db.sock ovn-sb.db" "ovn-sbctl.at:38"
( $at_check_trace; ovsdb-server --detach --no-chdir --pidfile=ovnsb_db.pid --unixctl=$OVS_RUNDIR/ovnsb_db.ctl --log-file=ovsdb_sb.log --remote=punix:$OVS_RUNDIR/ovnsb_db.sock ovn-sb.db
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:38"
$at_failed && at_fn_log_failure
$at_traceon; }

   on_exit "kill `cat ovnnb_db.pid` `cat ovnsb_db.pid`"
   { set +x
$as_echo "$at_srcdir/ovn-sbctl.at:38: sed < stderr '
/vlog|INFO|opened log file/d
/ovsdb_server|INFO|ovsdb-server (Open vSwitch)/d'"
at_fn_check_prepare_notrace 'an embedded newline' "ovn-sbctl.at:38"
( $at_check_trace; sed < stderr '
/vlog|INFO|opened log file/d
/ovsdb_server|INFO|ovsdb-server (Open vSwitch)/d'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:38"
$at_failed && at_fn_log_failure
$at_traceon; }



      { set +x
$as_echo "$at_srcdir/ovn-sbctl.at:38: ovn-northd --detach --no-chdir --pidfile --log-file --ovnnb-db=unix:\$OVS_RUNDIR/ovnnb_db.sock --ovnsb-db=unix:\$OVS_RUNDIR/ovnsb_db.sock"
at_fn_check_prepare_dynamic "ovn-northd --detach --no-chdir --pidfile --log-file --ovnnb-db=unix:$OVS_RUNDIR/ovnnb_db.sock --ovnsb-db=unix:$OVS_RUNDIR/ovnsb_db.sock" "ovn-sbctl.at:38"
( $at_check_trace; ovn-northd --detach --no-chdir --pidfile --log-file --ovnnb-db=unix:$OVS_RUNDIR/ovnnb_db.sock --ovnsb-db=unix:$OVS_RUNDIR/ovnsb_db.sock
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:38"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

   on_exit "kill `cat ovn-northd.pid`"
   { set +x
$as_echo "$at_srcdir/ovn-sbctl.at:38: sed < stderr '
/vlog|INFO|opened log file/d'"
at_fn_check_prepare_notrace 'an embedded newline' "ovn-sbctl.at:38"
( $at_check_trace; sed < stderr '
/vlog|INFO|opened log file/d'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:38"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }



ovn_init_db ovn-sb

{ set +x
$as_echo "$at_srcdir/ovn-sbctl.at:41: ovn-sbctl chassis-add ch0 geneve 1.2.3.4"
at_fn_check_prepare_trace "ovn-sbctl.at:41"
( $at_check_trace; ovn-sbctl chassis-add ch0 geneve 1.2.3.4
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:41"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovn-northd.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-sbctl.at:42: ovn-sbctl -f csv -d bare --no-headings --columns ip,type list encap | sort"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-sbctl.at:42"
( $at_check_trace; ovn-sbctl -f csv -d bare --no-headings --columns ip,type list encap | sort
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "1.2.3.4,geneve
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:42"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovn-northd.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-sbctl.at:47: ovn-sbctl chassis-add ch1 stt,geneve,vxlan 1.2.3.5"
at_fn_check_prepare_trace "ovn-sbctl.at:47"
( $at_check_trace; ovn-sbctl chassis-add ch1 stt,geneve,vxlan 1.2.3.5
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:47"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovn-northd.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-sbctl.at:48: ovn-sbctl -f csv -d bare --no-headings --columns ip,type list encap | sort"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-sbctl.at:48"
( $at_check_trace; ovn-sbctl -f csv -d bare --no-headings --columns ip,type list encap | sort
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "1.2.3.4,geneve
1.2.3.5,geneve
1.2.3.5,stt
1.2.3.5,vxlan
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:48"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovn-northd.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-sbctl.at:56: ovn-sbctl chassis-del ch0"
at_fn_check_prepare_trace "ovn-sbctl.at:56"
( $at_check_trace; ovn-sbctl chassis-del ch0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:56"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovn-northd.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-sbctl.at:57: ovn-sbctl -f csv -d bare --no-headings --columns ip,type list encap | sort"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-sbctl.at:57"
( $at_check_trace; ovn-sbctl -f csv -d bare --no-headings --columns ip,type list encap | sort
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "1.2.3.5,geneve
1.2.3.5,stt
1.2.3.5,vxlan
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:57"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovn-northd.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-sbctl.at:64: check_logs \"\""
at_fn_check_prepare_trace "ovn-sbctl.at:64"
( $at_check_trace; check_logs ""
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:64"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovn-northd.log"
$at_traceon; }

   { set +x
$as_echo "$at_srcdir/ovn-sbctl.at:64: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn-sbctl.at:64"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:64"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovn-northd.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn-sbctl.at:64: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn-sbctl.at:64"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:64"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovn-northd.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-sbctl.at:64" "while kill -0 \$TMPPID 2>/dev/null"

   { set +x
$as_echo "$at_srcdir/ovn-sbctl.at:64: test -e \$OVS_RUNDIR/ovnnb_db.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovnnb_db.pid" "ovn-sbctl.at:64"
( $at_check_trace; test -e $OVS_RUNDIR/ovnnb_db.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:64"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovn-northd.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovnnb_db.pid)
   { set +x
$as_echo "$at_srcdir/ovn-sbctl.at:64: ovs-appctl --timeout=10 --target=\$OVS_RUNDIR/ovnnb_db.ctl exit"
at_fn_check_prepare_dynamic "ovs-appctl --timeout=10 --target=$OVS_RUNDIR/ovnnb_db.ctl exit" "ovn-sbctl.at:64"
( $at_check_trace; ovs-appctl --timeout=10 --target=$OVS_RUNDIR/ovnnb_db.ctl exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:64"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovn-northd.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-sbctl.at:64" "while kill -0 \$TMPPID 2>/dev/null"

   { set +x
$as_echo "$at_srcdir/ovn-sbctl.at:64: test -e \$OVS_RUNDIR/ovnsb_db.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovnsb_db.pid" "ovn-sbctl.at:64"
( $at_check_trace; test -e $OVS_RUNDIR/ovnsb_db.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:64"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovn-northd.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovnsb_db.pid)
   { set +x
$as_echo "$at_srcdir/ovn-sbctl.at:64: ovs-appctl --timeout=10 --target=\$OVS_RUNDIR/ovnsb_db.ctl exit"
at_fn_check_prepare_dynamic "ovs-appctl --timeout=10 --target=$OVS_RUNDIR/ovnsb_db.ctl exit" "ovn-sbctl.at:64"
( $at_check_trace; ovs-appctl --timeout=10 --target=$OVS_RUNDIR/ovnsb_db.ctl exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:64"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovn-northd.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-sbctl.at:64" "while kill -0 \$TMPPID 2>/dev/null"

as ovn-sb
{ set +x
$as_echo "$at_srcdir/ovn-sbctl.at:66: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-sbctl.at:66"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:66"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovn-northd.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-sbctl.at:66: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-sbctl.at:66"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:66"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovn-northd.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-sbctl.at:66" "while kill -0 \$TMPPID 2>/dev/null"

ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_201
#AT_START_202
at_fn_group_banner 202 'ovn-sbctl.at:71' \
  "ovn-sbctl" "                                      " 5
at_xfail=no
(
  $as_echo "202. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init


   for daemon in ovn-nb ovn-sb; do
      { set +x
$as_echo "$at_srcdir/ovn-sbctl.at:72: ovsdb-tool create \$daemon.db \$abs_top_srcdir/\${daemon}.ovsschema"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "ovn-sbctl.at:72"
( $at_check_trace; ovsdb-tool create $daemon.db $abs_top_srcdir/${daemon}.ovsschema
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:72"
$at_failed && at_fn_log_failure
$at_traceon; }

   done

      { set +x
$as_echo "$at_srcdir/ovn-sbctl.at:72: ovsdb-server --detach --no-chdir --pidfile=ovnnb_db.pid --unixctl=\$OVS_RUNDIR/ovnnb_db.ctl --log-file=ovsdb_nb.log --remote=punix:\$OVS_RUNDIR/ovnnb_db.sock ovn-nb.db "
at_fn_check_prepare_dynamic "ovsdb-server --detach --no-chdir --pidfile=ovnnb_db.pid --unixctl=$OVS_RUNDIR/ovnnb_db.ctl --log-file=ovsdb_nb.log --remote=punix:$OVS_RUNDIR/ovnnb_db.sock ovn-nb.db " "ovn-sbctl.at:72"
( $at_check_trace; ovsdb-server --detach --no-chdir --pidfile=ovnnb_db.pid --unixctl=$OVS_RUNDIR/ovnnb_db.ctl --log-file=ovsdb_nb.log --remote=punix:$OVS_RUNDIR/ovnnb_db.sock ovn-nb.db
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:72"
$at_failed && at_fn_log_failure
$at_traceon; }

   { set +x
$as_echo "$at_srcdir/ovn-sbctl.at:72: ovsdb-server --detach --no-chdir --pidfile=ovnsb_db.pid --unixctl=\$OVS_RUNDIR/ovnsb_db.ctl --log-file=ovsdb_sb.log --remote=punix:\$OVS_RUNDIR/ovnsb_db.sock ovn-sb.db"
at_fn_check_prepare_dynamic "ovsdb-server --detach --no-chdir --pidfile=ovnsb_db.pid --unixctl=$OVS_RUNDIR/ovnsb_db.ctl --log-file=ovsdb_sb.log --remote=punix:$OVS_RUNDIR/ovnsb_db.sock ovn-sb.db" "ovn-sbctl.at:72"
( $at_check_trace; ovsdb-server --detach --no-chdir --pidfile=ovnsb_db.pid --unixctl=$OVS_RUNDIR/ovnsb_db.ctl --log-file=ovsdb_sb.log --remote=punix:$OVS_RUNDIR/ovnsb_db.sock ovn-sb.db
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:72"
$at_failed && at_fn_log_failure
$at_traceon; }

   on_exit "kill `cat ovnnb_db.pid` `cat ovnsb_db.pid`"
   { set +x
$as_echo "$at_srcdir/ovn-sbctl.at:72: sed < stderr '
/vlog|INFO|opened log file/d
/ovsdb_server|INFO|ovsdb-server (Open vSwitch)/d'"
at_fn_check_prepare_notrace 'an embedded newline' "ovn-sbctl.at:72"
( $at_check_trace; sed < stderr '
/vlog|INFO|opened log file/d
/ovsdb_server|INFO|ovsdb-server (Open vSwitch)/d'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:72"
$at_failed && at_fn_log_failure
$at_traceon; }



      { set +x
$as_echo "$at_srcdir/ovn-sbctl.at:72: ovn-northd --detach --no-chdir --pidfile --log-file --ovnnb-db=unix:\$OVS_RUNDIR/ovnnb_db.sock --ovnsb-db=unix:\$OVS_RUNDIR/ovnsb_db.sock"
at_fn_check_prepare_dynamic "ovn-northd --detach --no-chdir --pidfile --log-file --ovnnb-db=unix:$OVS_RUNDIR/ovnnb_db.sock --ovnsb-db=unix:$OVS_RUNDIR/ovnsb_db.sock" "ovn-sbctl.at:72"
( $at_check_trace; ovn-northd --detach --no-chdir --pidfile --log-file --ovnnb-db=unix:$OVS_RUNDIR/ovnnb_db.sock --ovnsb-db=unix:$OVS_RUNDIR/ovnsb_db.sock
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:72"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

   on_exit "kill `cat ovn-northd.pid`"
   { set +x
$as_echo "$at_srcdir/ovn-sbctl.at:72: sed < stderr '
/vlog|INFO|opened log file/d'"
at_fn_check_prepare_notrace 'an embedded newline' "ovn-sbctl.at:72"
( $at_check_trace; sed < stderr '
/vlog|INFO|opened log file/d'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:72"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/ovn-sbctl.at:74: ovn-nbctl ls-add br-test"
at_fn_check_prepare_trace "ovn-sbctl.at:74"
( $at_check_trace; ovn-nbctl ls-add br-test
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:74"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovn-northd.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-sbctl.at:75: ovn-nbctl lsp-add br-test vif0"
at_fn_check_prepare_trace "ovn-sbctl.at:75"
( $at_check_trace; ovn-nbctl lsp-add br-test vif0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:75"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovn-northd.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-sbctl.at:76: ovn-nbctl lsp-set-addresses vif0 f0:ab:cd:ef:01:02"
at_fn_check_prepare_trace "ovn-sbctl.at:76"
( $at_check_trace; ovn-nbctl lsp-set-addresses vif0 f0:ab:cd:ef:01:02
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:76"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovn-northd.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-sbctl.at:77: ovn-sbctl chassis-add ch0 stt 1.2.3.5"
at_fn_check_prepare_trace "ovn-sbctl.at:77"
( $at_check_trace; ovn-sbctl chassis-add ch0 stt 1.2.3.5
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:77"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovn-northd.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-sbctl.at:78: ovn-nbctl --wait=sb sync"
at_fn_check_prepare_trace "ovn-sbctl.at:78"
( $at_check_trace; ovn-nbctl --wait=sb sync
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:78"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovn-northd.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-sbctl.at:79: ovn-sbctl lsp-bind vif0 ch0"
at_fn_check_prepare_trace "ovn-sbctl.at:79"
( $at_check_trace; ovn-sbctl lsp-bind vif0 ch0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:79"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovn-northd.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-sbctl.at:81: ovn-sbctl show"
at_fn_check_prepare_trace "ovn-sbctl.at:81"
( $at_check_trace; ovn-sbctl show
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "Chassis ch0
    Encap stt
        ip: \"1.2.3.5\"
        options: {csum=\"true\"}
    Port_Binding vif0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:81"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovn-northd.log"
$at_traceon; }


# adds another 'vif1'
{ set +x
$as_echo "$at_srcdir/ovn-sbctl.at:90: ovn-nbctl --wait=sb lsp-add br-test vif1"
at_fn_check_prepare_trace "ovn-sbctl.at:90"
( $at_check_trace; ovn-nbctl --wait=sb lsp-add br-test vif1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:90"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovn-northd.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-sbctl.at:91: ovn-nbctl lsp-set-addresses vif1 f0:ab:cd:ef:01:03"
at_fn_check_prepare_trace "ovn-sbctl.at:91"
( $at_check_trace; ovn-nbctl lsp-set-addresses vif1 f0:ab:cd:ef:01:03
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:91"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovn-northd.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-sbctl.at:92: ovn-sbctl lsp-bind vif1 ch0"
at_fn_check_prepare_trace "ovn-sbctl.at:92"
( $at_check_trace; ovn-sbctl lsp-bind vif1 ch0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:92"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovn-northd.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-sbctl.at:94: ovn-sbctl show | sed 's/vif[0-9]/vif/'"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-sbctl.at:94"
( $at_check_trace; ovn-sbctl show | sed 's/vif[0-9]/vif/'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "Chassis ch0
    Encap stt
        ip: \"1.2.3.5\"
        options: {csum=\"true\"}
    Port_Binding vif
    Port_Binding vif
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:94"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovn-northd.log"
$at_traceon; }


# deletes 'vif1'
{ set +x
$as_echo "$at_srcdir/ovn-sbctl.at:104: ovn-nbctl lsp-del vif1"
at_fn_check_prepare_trace "ovn-sbctl.at:104"
( $at_check_trace; ovn-nbctl lsp-del vif1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:104"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovn-northd.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-sbctl.at:105: ovn-nbctl --wait=sb sync"
at_fn_check_prepare_trace "ovn-sbctl.at:105"
( $at_check_trace; ovn-nbctl --wait=sb sync
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:105"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovn-northd.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-sbctl.at:107: ovn-sbctl show"
at_fn_check_prepare_trace "ovn-sbctl.at:107"
( $at_check_trace; ovn-sbctl show
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "Chassis ch0
    Encap stt
        ip: \"1.2.3.5\"
        options: {csum=\"true\"}
    Port_Binding vif0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:107"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovn-northd.log"
$at_traceon; }


uuid=$(ovn-sbctl --columns=_uuid list Chassis ch0 | cut -d ':' -f2 | tr -d ' ')
{ set +x
$as_echo "$at_srcdir/ovn-sbctl.at:116: ovn-sbctl --columns=logical_port,mac,chassis list Port_Binding"
at_fn_check_prepare_trace "ovn-sbctl.at:116"
( $at_check_trace; ovn-sbctl --columns=logical_port,mac,chassis list Port_Binding
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "logical_port        : vif0
mac                 : [\"f0:ab:cd:ef:01:02\"]
chassis             : ${uuid}
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:116"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovn-northd.log"
$at_traceon; }


# test the passing down of logical port type and options.
{ set +x
$as_echo "$at_srcdir/ovn-sbctl.at:123: ovn-nbctl --wait=sb lsp-add br-test vtep0"
at_fn_check_prepare_trace "ovn-sbctl.at:123"
( $at_check_trace; ovn-nbctl --wait=sb lsp-add br-test vtep0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:123"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovn-northd.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-sbctl.at:124: ovn-nbctl lsp-set-type vtep0 vtep"
at_fn_check_prepare_trace "ovn-sbctl.at:124"
( $at_check_trace; ovn-nbctl lsp-set-type vtep0 vtep
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:124"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovn-northd.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-sbctl.at:125: ovn-nbctl lsp-set-options vtep0 vtep_physical_switch=p0 vtep_logical_switch=l0"
at_fn_check_prepare_trace "ovn-sbctl.at:125"
( $at_check_trace; ovn-nbctl lsp-set-options vtep0 vtep_physical_switch=p0 vtep_logical_switch=l0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:125"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovn-northd.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-sbctl.at:127: ovn-sbctl --timeout=10 wait-until Port_Binding vtep0 options!={}"
at_fn_check_prepare_trace "ovn-sbctl.at:127"
( $at_check_trace; ovn-sbctl --timeout=10 wait-until Port_Binding vtep0 options!={}
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:127"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovn-northd.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-sbctl.at:128: ovn-sbctl --columns=logical_port,mac,type,options list Port_Binding vtep0"
at_fn_check_prepare_trace "ovn-sbctl.at:128"
( $at_check_trace; ovn-sbctl --columns=logical_port,mac,type,options list Port_Binding vtep0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "logical_port        : vtep0
mac                 : []
type                : vtep
options             : {vtep_logical_switch=l0, vtep_physical_switch=p0}
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:128"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovn-northd.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-sbctl.at:135: check_logs \"\""
at_fn_check_prepare_trace "ovn-sbctl.at:135"
( $at_check_trace; check_logs ""
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:135"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovn-northd.log"
$at_traceon; }

   { set +x
$as_echo "$at_srcdir/ovn-sbctl.at:135: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn-sbctl.at:135"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:135"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovn-northd.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn-sbctl.at:135: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn-sbctl.at:135"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:135"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovn-northd.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-sbctl.at:135" "while kill -0 \$TMPPID 2>/dev/null"

   { set +x
$as_echo "$at_srcdir/ovn-sbctl.at:135: test -e \$OVS_RUNDIR/ovnnb_db.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovnnb_db.pid" "ovn-sbctl.at:135"
( $at_check_trace; test -e $OVS_RUNDIR/ovnnb_db.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:135"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovn-northd.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovnnb_db.pid)
   { set +x
$as_echo "$at_srcdir/ovn-sbctl.at:135: ovs-appctl --timeout=10 --target=\$OVS_RUNDIR/ovnnb_db.ctl exit"
at_fn_check_prepare_dynamic "ovs-appctl --timeout=10 --target=$OVS_RUNDIR/ovnnb_db.ctl exit" "ovn-sbctl.at:135"
( $at_check_trace; ovs-appctl --timeout=10 --target=$OVS_RUNDIR/ovnnb_db.ctl exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:135"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovn-northd.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-sbctl.at:135" "while kill -0 \$TMPPID 2>/dev/null"

   { set +x
$as_echo "$at_srcdir/ovn-sbctl.at:135: test -e \$OVS_RUNDIR/ovnsb_db.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovnsb_db.pid" "ovn-sbctl.at:135"
( $at_check_trace; test -e $OVS_RUNDIR/ovnsb_db.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:135"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovn-northd.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovnsb_db.pid)
   { set +x
$as_echo "$at_srcdir/ovn-sbctl.at:135: ovs-appctl --timeout=10 --target=\$OVS_RUNDIR/ovnsb_db.ctl exit"
at_fn_check_prepare_dynamic "ovs-appctl --timeout=10 --target=$OVS_RUNDIR/ovnsb_db.ctl exit" "ovn-sbctl.at:135"
( $at_check_trace; ovs-appctl --timeout=10 --target=$OVS_RUNDIR/ovnsb_db.ctl exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:135"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovn-northd.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-sbctl.at:135" "while kill -0 \$TMPPID 2>/dev/null"

ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_202
#AT_START_203
at_fn_group_banner 203 'ovn-sbctl.at:140' \
  "ovn-sbctl - connection" "                         " 5
at_xfail=no
(
  $as_echo "203. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init


   for daemon in ovn-nb ovn-sb; do
      { set +x
$as_echo "$at_srcdir/ovn-sbctl.at:141: ovsdb-tool create \$daemon.db \$abs_top_srcdir/\${daemon}.ovsschema"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "ovn-sbctl.at:141"
( $at_check_trace; ovsdb-tool create $daemon.db $abs_top_srcdir/${daemon}.ovsschema
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:141"
$at_failed && at_fn_log_failure
$at_traceon; }

   done

      { set +x
$as_echo "$at_srcdir/ovn-sbctl.at:141: ovsdb-server --detach --no-chdir --pidfile=ovnnb_db.pid --unixctl=\$OVS_RUNDIR/ovnnb_db.ctl --log-file=ovsdb_nb.log --remote=punix:\$OVS_RUNDIR/ovnnb_db.sock ovn-nb.db "
at_fn_check_prepare_dynamic "ovsdb-server --detach --no-chdir --pidfile=ovnnb_db.pid --unixctl=$OVS_RUNDIR/ovnnb_db.ctl --log-file=ovsdb_nb.log --remote=punix:$OVS_RUNDIR/ovnnb_db.sock ovn-nb.db " "ovn-sbctl.at:141"
( $at_check_trace; ovsdb-server --detach --no-chdir --pidfile=ovnnb_db.pid --unixctl=$OVS_RUNDIR/ovnnb_db.ctl --log-file=ovsdb_nb.log --remote=punix:$OVS_RUNDIR/ovnnb_db.sock ovn-nb.db
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:141"
$at_failed && at_fn_log_failure
$at_traceon; }

   { set +x
$as_echo "$at_srcdir/ovn-sbctl.at:141: ovsdb-server --detach --no-chdir --pidfile=ovnsb_db.pid --unixctl=\$OVS_RUNDIR/ovnsb_db.ctl --log-file=ovsdb_sb.log --remote=punix:\$OVS_RUNDIR/ovnsb_db.sock ovn-sb.db"
at_fn_check_prepare_dynamic "ovsdb-server --detach --no-chdir --pidfile=ovnsb_db.pid --unixctl=$OVS_RUNDIR/ovnsb_db.ctl --log-file=ovsdb_sb.log --remote=punix:$OVS_RUNDIR/ovnsb_db.sock ovn-sb.db" "ovn-sbctl.at:141"
( $at_check_trace; ovsdb-server --detach --no-chdir --pidfile=ovnsb_db.pid --unixctl=$OVS_RUNDIR/ovnsb_db.ctl --log-file=ovsdb_sb.log --remote=punix:$OVS_RUNDIR/ovnsb_db.sock ovn-sb.db
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:141"
$at_failed && at_fn_log_failure
$at_traceon; }

   on_exit "kill `cat ovnnb_db.pid` `cat ovnsb_db.pid`"
   { set +x
$as_echo "$at_srcdir/ovn-sbctl.at:141: sed < stderr '
/vlog|INFO|opened log file/d
/ovsdb_server|INFO|ovsdb-server (Open vSwitch)/d'"
at_fn_check_prepare_notrace 'an embedded newline' "ovn-sbctl.at:141"
( $at_check_trace; sed < stderr '
/vlog|INFO|opened log file/d
/ovsdb_server|INFO|ovsdb-server (Open vSwitch)/d'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:141"
$at_failed && at_fn_log_failure
$at_traceon; }



      { set +x
$as_echo "$at_srcdir/ovn-sbctl.at:141: ovn-northd --detach --no-chdir --pidfile --log-file --ovnnb-db=unix:\$OVS_RUNDIR/ovnnb_db.sock --ovnsb-db=unix:\$OVS_RUNDIR/ovnsb_db.sock"
at_fn_check_prepare_dynamic "ovn-northd --detach --no-chdir --pidfile --log-file --ovnnb-db=unix:$OVS_RUNDIR/ovnnb_db.sock --ovnsb-db=unix:$OVS_RUNDIR/ovnsb_db.sock" "ovn-sbctl.at:141"
( $at_check_trace; ovn-northd --detach --no-chdir --pidfile --log-file --ovnnb-db=unix:$OVS_RUNDIR/ovnnb_db.sock --ovnsb-db=unix:$OVS_RUNDIR/ovnsb_db.sock
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:141"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

   on_exit "kill `cat ovn-northd.pid`"
   { set +x
$as_echo "$at_srcdir/ovn-sbctl.at:141: sed < stderr '
/vlog|INFO|opened log file/d'"
at_fn_check_prepare_notrace 'an embedded newline' "ovn-sbctl.at:141"
( $at_check_trace; sed < stderr '
/vlog|INFO|opened log file/d'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:141"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/ovn-sbctl.at:143: ovn-sbctl --inactivity-probe=30000 set-connection ptcp:6641:127.0.0.1 punix:\$OVS_RUNDIR/ovnsb_db.sock"
at_fn_check_prepare_dynamic "ovn-sbctl --inactivity-probe=30000 set-connection ptcp:6641:127.0.0.1 punix:$OVS_RUNDIR/ovnsb_db.sock" "ovn-sbctl.at:143"
( $at_check_trace; ovn-sbctl --inactivity-probe=30000 set-connection ptcp:6641:127.0.0.1 punix:$OVS_RUNDIR/ovnsb_db.sock
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:143"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovn-northd.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-sbctl.at:144: ovn-sbctl list connection | grep inactivity_probe"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-sbctl.at:144"
( $at_check_trace; ovn-sbctl list connection | grep inactivity_probe
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "inactivity_probe    : 30000
inactivity_probe    : 30000
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:144"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovn-northd.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-sbctl.at:149: check_logs \"\""
at_fn_check_prepare_trace "ovn-sbctl.at:149"
( $at_check_trace; check_logs ""
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:149"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovn-northd.log"
$at_traceon; }

   { set +x
$as_echo "$at_srcdir/ovn-sbctl.at:149: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn-sbctl.at:149"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:149"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovn-northd.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn-sbctl.at:149: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn-sbctl.at:149"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:149"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovn-northd.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-sbctl.at:149" "while kill -0 \$TMPPID 2>/dev/null"

   { set +x
$as_echo "$at_srcdir/ovn-sbctl.at:149: test -e \$OVS_RUNDIR/ovnnb_db.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovnnb_db.pid" "ovn-sbctl.at:149"
( $at_check_trace; test -e $OVS_RUNDIR/ovnnb_db.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:149"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovn-northd.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovnnb_db.pid)
   { set +x
$as_echo "$at_srcdir/ovn-sbctl.at:149: ovs-appctl --timeout=10 --target=\$OVS_RUNDIR/ovnnb_db.ctl exit"
at_fn_check_prepare_dynamic "ovs-appctl --timeout=10 --target=$OVS_RUNDIR/ovnnb_db.ctl exit" "ovn-sbctl.at:149"
( $at_check_trace; ovs-appctl --timeout=10 --target=$OVS_RUNDIR/ovnnb_db.ctl exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:149"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovn-northd.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-sbctl.at:149" "while kill -0 \$TMPPID 2>/dev/null"

   { set +x
$as_echo "$at_srcdir/ovn-sbctl.at:149: test -e \$OVS_RUNDIR/ovnsb_db.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovnsb_db.pid" "ovn-sbctl.at:149"
( $at_check_trace; test -e $OVS_RUNDIR/ovnsb_db.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:149"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovn-northd.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovnsb_db.pid)
   { set +x
$as_echo "$at_srcdir/ovn-sbctl.at:149: ovs-appctl --timeout=10 --target=\$OVS_RUNDIR/ovnsb_db.ctl exit"
at_fn_check_prepare_dynamic "ovs-appctl --timeout=10 --target=$OVS_RUNDIR/ovnsb_db.ctl exit" "ovn-sbctl.at:149"
( $at_check_trace; ovs-appctl --timeout=10 --target=$OVS_RUNDIR/ovnsb_db.ctl exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-sbctl.at:149"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovn-northd.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-sbctl.at:149" "while kill -0 \$TMPPID 2>/dev/null"

ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_203
#AT_START_204
at_fn_group_banner 204 'ovn-ic-nbctl.at:25' \
  "ovn-ic-nbctl" "                                   " 6
at_xfail=no
(
  $as_echo "204. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init


   { set +x
$as_echo "$at_srcdir/ovn-ic-nbctl.at:26: ovsdb-tool create ovn-ic-nb.db \$abs_top_srcdir/ovn-ic-nb.ovsschema"
at_fn_check_prepare_dynamic "ovsdb-tool create ovn-ic-nb.db $abs_top_srcdir/ovn-ic-nb.ovsschema" "ovn-ic-nbctl.at:26"
( $at_check_trace; ovsdb-tool create ovn-ic-nb.db $abs_top_srcdir/ovn-ic-nb.ovsschema
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic-nbctl.at:26"
$at_failed && at_fn_log_failure
$at_traceon; }


      { set +x
$as_echo "$at_srcdir/ovn-ic-nbctl.at:26: ovsdb-server --detach --no-chdir --pidfile=ovn_ic_nb_db.pid --unixctl=\$OVS_RUNDIR/ovn_ic_nb_db.ctl --log-file=ovsdb_ic_nb.log --remote=punix:\$OVS_RUNDIR/ovn_ic_nb_db.sock ovn-ic-nb.db "
at_fn_check_prepare_dynamic "ovsdb-server --detach --no-chdir --pidfile=ovn_ic_nb_db.pid --unixctl=$OVS_RUNDIR/ovn_ic_nb_db.ctl --log-file=ovsdb_ic_nb.log --remote=punix:$OVS_RUNDIR/ovn_ic_nb_db.sock ovn-ic-nb.db " "ovn-ic-nbctl.at:26"
( $at_check_trace; ovsdb-server --detach --no-chdir --pidfile=ovn_ic_nb_db.pid --unixctl=$OVS_RUNDIR/ovn_ic_nb_db.ctl --log-file=ovsdb_ic_nb.log --remote=punix:$OVS_RUNDIR/ovn_ic_nb_db.sock ovn-ic-nb.db
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic-nbctl.at:26"
$at_failed && at_fn_log_failure
$at_traceon; }

   on_exit "kill `cat ovn_ic_nb_db.pid`"
   { set +x
$as_echo "$at_srcdir/ovn-ic-nbctl.at:26: sed < stderr '
/vlog|INFO|opened log file/d
/ovsdb_server|INFO|ovsdb-server (Open vSwitch)/d'"
at_fn_check_prepare_notrace 'an embedded newline' "ovn-ic-nbctl.at:26"
( $at_check_trace; sed < stderr '
/vlog|INFO|opened log file/d
/ovsdb_server|INFO|ovsdb-server (Open vSwitch)/d'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic-nbctl.at:26"
$at_failed && at_fn_log_failure
$at_traceon; }




{ set +x
$as_echo "$at_srcdir/ovn-ic-nbctl.at:28: ovn-ic-nbctl ts-add ts0"
at_fn_check_prepare_trace "ovn-ic-nbctl.at:28"
( $at_check_trace; ovn-ic-nbctl ts-add ts0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic-nbctl.at:28"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-ic-nbctl.at:29: ovn-ic-nbctl ts-list | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-ic-nbctl.at:29"
( $at_check_trace; ovn-ic-nbctl ts-list | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "<0> (ts0)
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic-nbctl.at:29"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-ic-nbctl.at:33: ovn-ic-nbctl ts-add ts1"
at_fn_check_prepare_trace "ovn-ic-nbctl.at:33"
( $at_check_trace; ovn-ic-nbctl ts-add ts1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic-nbctl.at:33"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-ic-nbctl.at:34: ovn-ic-nbctl ts-list | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-ic-nbctl.at:34"
( $at_check_trace; ovn-ic-nbctl ts-list | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "<0> (ts0)
<1> (ts1)
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic-nbctl.at:34"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-ic-nbctl.at:39: ovn-ic-nbctl show | sort"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-ic-nbctl.at:39"
( $at_check_trace; ovn-ic-nbctl show | sort
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "Transit_Switch ts0
Transit_Switch ts1
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic-nbctl.at:39"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-ic-nbctl.at:44: ovn-ic-nbctl ts-del ts1"
at_fn_check_prepare_trace "ovn-ic-nbctl.at:44"
( $at_check_trace; ovn-ic-nbctl ts-del ts1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic-nbctl.at:44"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-ic-nbctl.at:45: ovn-ic-nbctl ts-list | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-ic-nbctl.at:45"
( $at_check_trace; ovn-ic-nbctl ts-list | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "<0> (ts0)
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic-nbctl.at:45"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-ic-nbctl.at:49: ovn-ic-nbctl ts-add ts0"
at_fn_check_prepare_trace "ovn-ic-nbctl.at:49"
( $at_check_trace; ovn-ic-nbctl ts-add ts0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-ic-nbctl: ts0: a transit switch with this name already exists
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-ic-nbctl.at:49"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-ic-nbctl.at:53: ovn-ic-nbctl --may-exist ts-add ts0"
at_fn_check_prepare_trace "ovn-ic-nbctl.at:53"
( $at_check_trace; ovn-ic-nbctl --may-exist ts-add ts0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic-nbctl.at:53"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-ic-nbctl.at:54: ovn-ic-nbctl ts-list | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-ic-nbctl.at:54"
( $at_check_trace; ovn-ic-nbctl ts-list | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "<0> (ts0)
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic-nbctl.at:54"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-ic-nbctl.at:58: ovn-ic-nbctl ts-del ts2"
at_fn_check_prepare_trace "ovn-ic-nbctl.at:58"
( $at_check_trace; ovn-ic-nbctl ts-del ts2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo >>"$at_stderr"; $as_echo "ovn-ic-nbctl: ts2: switch name not found
" | \
  $at_diff - "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 1 $at_status "$at_srcdir/ovn-ic-nbctl.at:58"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-ic-nbctl.at:62: ovn-ic-nbctl --if-exists ts-del ts2"
at_fn_check_prepare_trace "ovn-ic-nbctl.at:62"
( $at_check_trace; ovn-ic-nbctl --if-exists ts-del ts2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic-nbctl.at:62"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-ic-nbctl.at:64: check_logs \"\""
at_fn_check_prepare_trace "ovn-ic-nbctl.at:64"
( $at_check_trace; check_logs ""
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic-nbctl.at:64"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

   { set +x
$as_echo "$at_srcdir/ovn-ic-nbctl.at:64: test -e \$OVS_RUNDIR/ovn_ic_nb_db.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn_ic_nb_db.pid" "ovn-ic-nbctl.at:64"
( $at_check_trace; test -e $OVS_RUNDIR/ovn_ic_nb_db.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic-nbctl.at:64"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn_ic_nb_db.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic-nbctl.at:64: ovs-appctl --timeout=10 --target=\$OVS_RUNDIR/ovn_ic_nb_db.ctl exit"
at_fn_check_prepare_dynamic "ovs-appctl --timeout=10 --target=$OVS_RUNDIR/ovn_ic_nb_db.ctl exit" "ovn-ic-nbctl.at:64"
( $at_check_trace; ovs-appctl --timeout=10 --target=$OVS_RUNDIR/ovn_ic_nb_db.ctl exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic-nbctl.at:64"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic-nbctl.at:64" "while kill -0 \$TMPPID 2>/dev/null"

ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_204
#AT_START_205
at_fn_group_banner 205 'ovn-ic-sbctl.at:25' \
  "ovn-ic-sbctl" "                                   " 7
at_xfail=no
(
  $as_echo "205. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init


   { set +x
$as_echo "$at_srcdir/ovn-ic-sbctl.at:26: ovsdb-tool create ovn-ic-sb.db \$abs_top_srcdir/ovn-ic-sb.ovsschema"
at_fn_check_prepare_dynamic "ovsdb-tool create ovn-ic-sb.db $abs_top_srcdir/ovn-ic-sb.ovsschema" "ovn-ic-sbctl.at:26"
( $at_check_trace; ovsdb-tool create ovn-ic-sb.db $abs_top_srcdir/ovn-ic-sb.ovsschema
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic-sbctl.at:26"
$at_failed && at_fn_log_failure
$at_traceon; }


      { set +x
$as_echo "$at_srcdir/ovn-ic-sbctl.at:26: ovsdb-server --detach --no-chdir --pidfile=ovn_ic_sb_db.pid --unixctl=\$OVS_RUNDIR/ovn_ic_sb_db.ctl --log-file=ovsdb_ic_nb.log --remote=punix:\$OVS_RUNDIR/ovn_ic_sb_db.sock ovn-ic-sb.db "
at_fn_check_prepare_dynamic "ovsdb-server --detach --no-chdir --pidfile=ovn_ic_sb_db.pid --unixctl=$OVS_RUNDIR/ovn_ic_sb_db.ctl --log-file=ovsdb_ic_nb.log --remote=punix:$OVS_RUNDIR/ovn_ic_sb_db.sock ovn-ic-sb.db " "ovn-ic-sbctl.at:26"
( $at_check_trace; ovsdb-server --detach --no-chdir --pidfile=ovn_ic_sb_db.pid --unixctl=$OVS_RUNDIR/ovn_ic_sb_db.ctl --log-file=ovsdb_ic_nb.log --remote=punix:$OVS_RUNDIR/ovn_ic_sb_db.sock ovn-ic-sb.db
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic-sbctl.at:26"
$at_failed && at_fn_log_failure
$at_traceon; }

   on_exit "kill `cat ovn_ic_sb_db.pid`"
   { set +x
$as_echo "$at_srcdir/ovn-ic-sbctl.at:26: sed < stderr '
/vlog|INFO|opened log file/d
/ovsdb_server|INFO|ovsdb-server (Open vSwitch)/d'"
at_fn_check_prepare_notrace 'an embedded newline' "ovn-ic-sbctl.at:26"
( $at_check_trace; sed < stderr '
/vlog|INFO|opened log file/d
/ovsdb_server|INFO|ovsdb-server (Open vSwitch)/d'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic-sbctl.at:26"
$at_failed && at_fn_log_failure
$at_traceon; }




for az in 1 2; do
  az_uuid=$(ovn-ic-sbctl create availability_zone name=az$az)
  for gw in 1 2; do
    ovn-ic-sbctl --id=@encap create encap type=geneve ip=192.168.0.$az$gw options="csum=true" \
      -- create gateway availability_zone=$az_uuid name=gw$az$gw encap=@encap hostname=host.gw$az$gw
    for pb in 1 2; do
      ovn-ic-sbctl create port_binding logical_port=lp$az$gw$pb transit_switch="ts$pb" \
        address="\"aa:aa:aa:aa:0$az:$gw$pb 169.254.$pb.$az$gw/24\"" tunnel_key=$az$gw \
        availability_zone=$az_uuid gateway=gw$az$gw
    done
  done
done

{ set +x
$as_echo "$at_srcdir/ovn-ic-sbctl.at:41: ovn-ic-sbctl show"
at_fn_check_prepare_trace "ovn-ic-sbctl.at:41"
( $at_check_trace; ovn-ic-sbctl show
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "availability-zone az1
    gateway gw11
        hostname: host.gw11
        type: geneve
            ip: 192.168.0.11
        port lp111
            transit switch: ts1
            address: [\"aa:aa:aa:aa:01:11 169.254.1.11/24\"]
        port lp112
            transit switch: ts2
            address: [\"aa:aa:aa:aa:01:12 169.254.2.11/24\"]
    gateway gw12
        hostname: host.gw12
        type: geneve
            ip: 192.168.0.12
        port lp121
            transit switch: ts1
            address: [\"aa:aa:aa:aa:01:21 169.254.1.12/24\"]
        port lp122
            transit switch: ts2
            address: [\"aa:aa:aa:aa:01:22 169.254.2.12/24\"]
availability-zone az2
    gateway gw21
        hostname: host.gw21
        type: geneve
            ip: 192.168.0.21
        port lp211
            transit switch: ts1
            address: [\"aa:aa:aa:aa:02:11 169.254.1.21/24\"]
        port lp212
            transit switch: ts2
            address: [\"aa:aa:aa:aa:02:12 169.254.2.21/24\"]
    gateway gw22
        hostname: host.gw22
        type: geneve
            ip: 192.168.0.22
        port lp221
            transit switch: ts1
            address: [\"aa:aa:aa:aa:02:21 169.254.1.22/24\"]
        port lp222
            transit switch: ts2
            address: [\"aa:aa:aa:aa:02:22 169.254.2.22/24\"]
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic-sbctl.at:41"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-ic-sbctl.at:86: ovn-ic-sbctl show az2"
at_fn_check_prepare_trace "ovn-ic-sbctl.at:86"
( $at_check_trace; ovn-ic-sbctl show az2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "availability-zone az2
    gateway gw21
        hostname: host.gw21
        type: geneve
            ip: 192.168.0.21
        port lp211
            transit switch: ts1
            address: [\"aa:aa:aa:aa:02:11 169.254.1.21/24\"]
        port lp212
            transit switch: ts2
            address: [\"aa:aa:aa:aa:02:12 169.254.2.21/24\"]
    gateway gw22
        hostname: host.gw22
        type: geneve
            ip: 192.168.0.22
        port lp221
            transit switch: ts1
            address: [\"aa:aa:aa:aa:02:21 169.254.1.22/24\"]
        port lp222
            transit switch: ts2
            address: [\"aa:aa:aa:aa:02:22 169.254.2.22/24\"]
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic-sbctl.at:86"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }



{ set +x
$as_echo "$at_srcdir/ovn-ic-sbctl.at:111: check_logs \"\""
at_fn_check_prepare_trace "ovn-ic-sbctl.at:111"
( $at_check_trace; check_logs ""
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic-sbctl.at:111"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

   { set +x
$as_echo "$at_srcdir/ovn-ic-sbctl.at:111: test -e \$OVS_RUNDIR/ovn_ic_sb_db.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn_ic_sb_db.pid" "ovn-ic-sbctl.at:111"
( $at_check_trace; test -e $OVS_RUNDIR/ovn_ic_sb_db.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic-sbctl.at:111"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn_ic_sb_db.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic-sbctl.at:111: ovs-appctl --timeout=10 --target=\$OVS_RUNDIR/ovn_ic_sb_db.ctl exit"
at_fn_check_prepare_dynamic "ovs-appctl --timeout=10 --target=$OVS_RUNDIR/ovn_ic_sb_db.ctl exit" "ovn-ic-sbctl.at:111"
( $at_check_trace; ovs-appctl --timeout=10 --target=$OVS_RUNDIR/ovn_ic_sb_db.ctl exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic-sbctl.at:111"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic-sbctl.at:111" "while kill -0 \$TMPPID 2>/dev/null"

ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_205
#AT_START_206
at_fn_group_banner 206 'ovn-controller.at:3' \
  "ovn-controller - ovn-bridge-mappings" "           " 8
at_xfail=no
(
  $as_echo "206. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init


ovn_init_db ovn-sb
net_add n1
sim_add hv
as hv
ovs-vsctl \
    -- add-br br-phys \
    -- add-br br-eth0 \
    -- add-br br-eth1 \
    -- add-br br-eth2
ovn_attach n1 br-phys 192.168.0.1

# Waits until the OVS database contains exactly the specified patch ports.
# Each argument should be of the form BRIDGE PORT PEER.
check_patches () {
    # Generate code to check that the set of patch ports is exactly as
    # specified.
    echo 'ovs-vsctl -f csv -d bare --no-headings --columns=name find Interface type=patch | sort' > query
    for patch
    do
        echo $patch
    done | cut -d' ' -f 2 | sort > expout

    # Generate code to verify that the configuration of each patch
    # port is correct.
    for patch
    do
        set $patch; bridge=$1 port=$2 peer=$3
        echo >>query "ovs-vsctl iface-to-br $port -- get Interface $port type options"
        echo >>expout "$bridge
patch
{peer=$peer}"
    done

    # Run the query until we get the expected result (or until a timeout).
    #
    # (We use sed to drop all "s from output because ovs-vsctl quotes some
    # of the port names but not others.)



    ovs_wait_cond () {
    . ./query | sed 's/"//g' > stdout #"
                    diff -u stdout expout >/dev/null
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller.at:45" "until . ./query | sed 's/\"//g' > stdout #\"
                    diff -u stdout expout >/dev/null"

}

# Make sure that the configured bridge mappings in the Open_vSwitch db
# is mirrored into the Chassis record in the OVN_Southbound db.
check_bridge_mappings () {
    local_mappings=$1
    sysid=$(ovs-vsctl get Open_vSwitch . external_ids:system-id)
    ovs_wait_cond () {
    test x"${local_mappings}" = x$(ovn-sbctl get Chassis ${sysid} external_ids:ovn-bridge-mappings | sed -e 's/\"//g')
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller.at:54" "until test x\"\${local_mappings}\" = x\$(ovn-sbctl get Chassis \${sysid} external_ids:ovn-bridge-mappings | sed -e 's/\\\"//g')"

}

# Initially there should be no patch ports.
check_patches

# Configure two ovn-bridge mappings, but no patch ports should be created yet
{ set +x
$as_echo "$at_srcdir/ovn-controller.at:61: ovs-vsctl set Open_vSwitch . external-ids:ovn-bridge-mappings=physnet1:br-eth0,physnet2:br-eth1"
at_fn_check_prepare_trace "ovn-controller.at:61"
( $at_check_trace; ovs-vsctl set Open_vSwitch . external-ids:ovn-bridge-mappings=physnet1:br-eth0,physnet2:br-eth1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:61"
$at_failed && at_fn_log_failure  \
"query" \
"expout" \
"stdout"
$at_traceon; }

check_bridge_mappings "physnet1:br-eth0,physnet2:br-eth1"
check_patches

# Create a localnet port, but we should still have no patch ports, as they
# won't be created until there's a localnet port on a logical switch with
# another logical port bound to this chassis.
ovn-sbctl \
    -- --id=@dp101 create Datapath_Binding tunnel_key=101 \
    -- create Port_Binding datapath=@dp101 logical_port=localnet1 tunnel_key=1 \
        type=localnet options:network_name=physnet1
check_patches

# Create a localnet port on a logical switch with a port bound to this chassis.
# Now we should get some patch ports created.
ovn-sbctl \
    -- --id=@dp102 create Datapath_Binding tunnel_key=102 \
    -- create Port_Binding datapath=@dp102 logical_port=localnet2 tunnel_key=1 \
        type=localnet options:network_name=physnet1 \
    -- create Port_Binding datapath=@dp102 logical_port=localvif2 tunnel_key=2
ovs-vsctl add-port br-int localvif2 -- set Interface localvif2 external_ids:iface-id=localvif2
check_patches \
    'br-int  patch-br-int-to-localnet2 patch-localnet2-to-br-int' \
    'br-eth0 patch-localnet2-to-br-int patch-br-int-to-localnet2'

# Add logical patch ports to connect new logical datapath.
#
# OVN no longer uses OVS patch ports to implement logical patch ports, so
# the set of OVS patch ports doesn't change.
{ set +x
$as_echo "$at_srcdir/ovn-controller.at:90: ovn-sbctl \\
    -- --id=@dp1 create Datapath_Binding tunnel_key=1 \\
    -- --id=@dp2 create Datapath_Binding tunnel_key=2 \\
    -- create Port_Binding datapath=@dp1 logical_port=foo tunnel_key=1 type=patch options:peer=bar \\
    -- create Port_Binding datapath=@dp2 logical_port=bar tunnel_key=2 type=patch options:peer=foo \\
    -- create Port_Binding datapath=@dp1 logical_port=dp1vif tunnel_key=3 \\
| uuidfilt"
at_fn_check_prepare_notrace 'an embedded newline' "ovn-controller.at:90"
( $at_check_trace; ovn-sbctl \
    -- --id=@dp1 create Datapath_Binding tunnel_key=1 \
    -- --id=@dp2 create Datapath_Binding tunnel_key=2 \
    -- create Port_Binding datapath=@dp1 logical_port=foo tunnel_key=1 type=patch options:peer=bar \
    -- create Port_Binding datapath=@dp2 logical_port=bar tunnel_key=2 type=patch options:peer=foo \
    -- create Port_Binding datapath=@dp1 logical_port=dp1vif tunnel_key=3 \
| uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "<0>
<1>
<2>
<3>
<4>
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:90"
$at_failed && at_fn_log_failure  \
"query" \
"expout" \
"stdout"
$at_traceon; }

ovs-vsctl add-port br-int dp1vif -- set Interface dp1vif external_ids:iface-id=dp1vif
check_patches \
    'br-int  patch-br-int-to-localnet2 patch-localnet2-to-br-int' \
    'br-eth0 patch-localnet2-to-br-int patch-br-int-to-localnet2'

# Delete the mapping and the ovn-bridge-mapping patch ports should go away.
{ set +x
$as_echo "$at_srcdir/ovn-controller.at:108: ovs-vsctl remove Open_vSwitch . external-ids ovn-bridge-mappings"
at_fn_check_prepare_trace "ovn-controller.at:108"
( $at_check_trace; ovs-vsctl remove Open_vSwitch . external-ids ovn-bridge-mappings
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:108"
$at_failed && at_fn_log_failure  \
"query" \
"expout" \
"stdout"
$at_traceon; }

check_bridge_mappings
check_patches

# Gracefully terminate daemons

    as hv
    if test "hv" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn-controller.at:113: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn-controller.at:113"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:113"
$at_failed && at_fn_log_failure  \
"query" \
"expout" \
"stdout"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller.at:113: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn-controller.at:113"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:113"
$at_failed && at_fn_log_failure  \
"query" \
"expout" \
"stdout"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller.at:113" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn-controller.at:113: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn-controller.at:113"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:113"
$at_failed && at_fn_log_failure  \
"query" \
"expout" \
"stdout"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller.at:113: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn-controller.at:113"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:113"
$at_failed && at_fn_log_failure  \
"query" \
"expout" \
"stdout"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller.at:113" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn-controller.at:113: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn-controller.at:113"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:113"
$at_failed && at_fn_log_failure  \
"query" \
"expout" \
"stdout"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller.at:113: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn-controller.at:113"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:113"
$at_failed && at_fn_log_failure  \
"query" \
"expout" \
"stdout"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller.at:113" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv
    { set +x
$as_echo "$at_srcdir/ovn-controller.at:113: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn-controller.at:113"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:113"
$at_failed && at_fn_log_failure  \
"query" \
"expout" \
"stdout"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller.at:113: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn-controller.at:113"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:113"
$at_failed && at_fn_log_failure  \
"query" \
"expout" \
"stdout"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller.at:113" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn-controller.at:113: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-controller.at:113"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:113"
$at_failed && at_fn_log_failure  \
"query" \
"expout" \
"stdout"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller.at:113: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-controller.at:113"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:113"
$at_failed && at_fn_log_failure  \
"query" \
"expout" \
"stdout"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller.at:113" "while kill -0 \$TMPPID 2>/dev/null"




    as main
    { set +x
$as_echo "$at_srcdir/ovn-controller.at:114: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn-controller.at:114"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:114"
$at_failed && at_fn_log_failure  \
"query" \
"expout" \
"stdout"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller.at:114: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn-controller.at:114"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:114"
$at_failed && at_fn_log_failure  \
"query" \
"expout" \
"stdout"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller.at:114" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn-controller.at:114: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-controller.at:114"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:114"
$at_failed && at_fn_log_failure  \
"query" \
"expout" \
"stdout"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller.at:114: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-controller.at:114"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:114"
$at_failed && at_fn_log_failure  \
"query" \
"expout" \
"stdout"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller.at:114" "while kill -0 \$TMPPID 2>/dev/null"


as ovn-sb
{ set +x
$as_echo "$at_srcdir/ovn-controller.at:116: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-controller.at:116"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:116"
$at_failed && at_fn_log_failure  \
"query" \
"expout" \
"stdout"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller.at:116: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-controller.at:116"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:116"
$at_failed && at_fn_log_failure  \
"query" \
"expout" \
"stdout"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller.at:116" "while kill -0 \$TMPPID 2>/dev/null"


ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_206
#AT_START_207
at_fn_group_banner 207 'ovn-controller.at:122' \
  "ovn-controller - Chassis external_ids" "          " 8
at_xfail=no
(
  $as_echo "207. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init


ovn_init_db ovn-sb

net_add n1
sim_add hv
as hv
ovs-vsctl \
    -- add-br br-phys \
    -- add-br br-eth0 \
    -- add-br br-eth1 \
    -- add-br br-eth2
ovn_attach n1 br-phys 192.168.0.1

sysid=$(ovs-vsctl get Open_vSwitch . external_ids:system-id)

# Make sure that the datapath_type set in the Bridge table
# is mirrored into the Chassis record in the OVN_Southbound db.
check_datapath_type () {
    datapath_type=$1
    chassis_datapath_type=$(ovn-sbctl get Chassis ${sysid} external_ids:datapath-type | sed -e 's/"//g') #"
    test "${datapath_type}" = "${chassis_datapath_type}"
}

ovs_wait_cond () {
    check_datapath_type ""
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller.at:146" "until check_datapath_type \"\""


ovs-vsctl set Bridge br-int datapath-type=foo
ovs_wait_cond () {
    check_datapath_type foo
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller.at:149" "until check_datapath_type foo"


# Change "ovn-bridge-mappings" value. It should not change the "datapath-type".
ovs-vsctl set Open_vSwitch . external_ids:ovn-bridge-mappings=foo-mapping
check_datapath_type foo

ovs-vsctl set Bridge br-int datapath-type=bar
ovs_wait_cond () {
    check_datapath_type bar
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller.at:156" "until check_datapath_type bar"


ovs-vsctl set Bridge br-int datapath-type=\"\"
ovs_wait_cond () {
    check_datapath_type ""
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller.at:159" "until check_datapath_type \"\""


# Set the datapath_type in external_ids:ovn-bridge-datapath-type.
ovs-vsctl set Open_vSwitch . external_ids:ovn-bridge-datapath-type=foo
ovs_wait_cond () {
    check_datapath_type foo
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller.at:163" "until check_datapath_type foo"


# Change the br-int's datapath type to bar.
# It should be reset to foo since ovn-bridge-datapath-type is configured.
ovs-vsctl set Bridge br-int datapath-type=bar
ovs_wait_cond () {
    test foo=`ovs-vsctl get Bridge br-int datapath-type`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller.at:168" "until test foo=\`ovs-vsctl get Bridge br-int datapath-type\`"

ovs_wait_cond () {
    check_datapath_type foo
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller.at:169" "until check_datapath_type foo"


ovs-vsctl set Open_vSwitch . external_ids:ovn-bridge-datapath-type=foobar
ovs_wait_cond () {
    test foobar=`ovs-vsctl get Bridge br-int datapath-type`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller.at:172" "until test foobar=\`ovs-vsctl get Bridge br-int datapath-type\`"

ovs_wait_cond () {
    check_datapath_type foobar
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller.at:173" "until check_datapath_type foobar"


expected_iface_types=$(ovs-vsctl get Open_vSwitch . iface_types | tr -d '[] ""')
echo "expected_iface_types = ${expected_iface_types}"
chassis_iface_types=$(ovn-sbctl get Chassis ${sysid} external_ids:iface-types | sed -e 's/\"//g')
echo "chassis_iface_types = ${chassis_iface_types}"
{ set +x
$as_echo "$at_srcdir/ovn-controller.at:179: test \"\${expected_iface_types}\" = \"\${chassis_iface_types}\""
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "ovn-controller.at:179"
( $at_check_trace; test "${expected_iface_types}" = "${chassis_iface_types}"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:179"
$at_failed && at_fn_log_failure
$at_traceon; }


# Change the value of external_ids:iface-types using ovn-sbctl.
# ovn-controller should again set it back to proper one.
ovn-sbctl set Chassis ${sysid} external_ids:iface-types="foo"
ovs_wait_cond () {

    chassis_iface_types=$(ovn-sbctl get Chassis ${sysid} external_ids:iface-types | sed -e 's/\"//g')
    echo "chassis_iface_types = ${chassis_iface_types}"
    test "${expected_iface_types}" = "${chassis_iface_types}"

}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller.at:184" "until
    chassis_iface_types=\$(ovn-sbctl get Chassis \${sysid} external_ids:iface-types | sed -e 's/\\\"//g')
    echo \"chassis_iface_types = \${chassis_iface_types}\"
    test \"\${expected_iface_types}\" = \"\${chassis_iface_types}\"
"


# Change the value of external_ids:system-id and make sure it's mirrored
# in the Chassis record in the OVN_Southbound database.
sysid=${sysid}-foo
ovs-vsctl set Open_vSwitch . external-ids:system-id="${sysid}"
ovs_wait_cond () {

    chassis_id=$(ovn-sbctl get Chassis "${sysid}" name)
    test "${sysid}" = "${chassis_id}"

}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller.at:194" "until
    chassis_id=\$(ovn-sbctl get Chassis \"\${sysid}\" name)
    test \"\${sysid}\" = \"\${chassis_id}\"
"


# Gracefully terminate daemons

    as hv
    if test "hv" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn-controller.at:200: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn-controller.at:200"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:200"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller.at:200: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn-controller.at:200"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:200"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller.at:200" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn-controller.at:200: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn-controller.at:200"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:200"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller.at:200: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn-controller.at:200"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:200"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller.at:200" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn-controller.at:200: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn-controller.at:200"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:200"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller.at:200: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn-controller.at:200"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:200"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller.at:200" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv
    { set +x
$as_echo "$at_srcdir/ovn-controller.at:200: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn-controller.at:200"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:200"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller.at:200: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn-controller.at:200"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:200"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller.at:200" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn-controller.at:200: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-controller.at:200"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:200"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller.at:200: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-controller.at:200"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:200"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller.at:200" "while kill -0 \$TMPPID 2>/dev/null"




    as main
    { set +x
$as_echo "$at_srcdir/ovn-controller.at:201: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn-controller.at:201"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:201"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller.at:201: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn-controller.at:201"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:201"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller.at:201" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn-controller.at:201: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-controller.at:201"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:201"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller.at:201: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-controller.at:201"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:201"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller.at:201" "while kill -0 \$TMPPID 2>/dev/null"


as ovn-sb
{ set +x
$as_echo "$at_srcdir/ovn-controller.at:203: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-controller.at:203"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:203"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller.at:203: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-controller.at:203"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:203"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller.at:203" "while kill -0 \$TMPPID 2>/dev/null"


ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_207
#AT_START_208
at_fn_group_banner 208 'ovn-controller.at:209' \
  "ovn-controller - change Encap properties" "       " 8
at_xfail=no
(
  $as_echo "208. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init


ovn_init_db ovn-sb

net_add n1
sim_add hv
as hv
ovs-vsctl \
    -- add-br br-phys \
    -- add-br br-eth0 \
    -- add-br br-eth1 \
    -- add-br br-eth2
ovn_attach n1 br-phys 192.168.0.1

check_tunnel_property () {
    test "`ovs-vsctl get interface ovn-fakech-0 $1`" = "$2"
}

# Start off with a remote chassis supporting STT
ovn-sbctl chassis-add fakechassis stt 192.168.0.2
ovs_wait_cond () {
    check_tunnel_property type stt
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller.at:229" "until check_tunnel_property type stt"


# See if we switch to Geneve as the first choice when it is available
# With multi-VTEP support we support tunnels with different IPs to the
# same chassis, and hence use the IP to annotate the tunnel (along with
# the chassis-id in ovn-chassis-id); if we supply a different IP here
# we won't be able to co-relate this to the tunnel port that was created
# in the previous step and, as a result, will end up creating another tunnel,
# ie. we can't just lookup using "ovn-fakech-0". So, need to use the same IP
# as above, i.e 192.168.0.2, here.
encap_uuid=$(ovn-sbctl add chassis fakechassis encaps @encap -- --id=@encap create encap type=geneve ip="192.168.0.2")
ovs_wait_cond () {
    check_tunnel_property type geneve
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller.at:240" "until check_tunnel_property type geneve"


# Check that changes within an encap row are propagated
ovn-sbctl set encap ${encap_uuid} ip=192.168.0.2
ovs_wait_cond () {
    check_tunnel_property options:remote_ip "\"192.168.0.2\""
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller.at:244" "until check_tunnel_property options:remote_ip \"\\\"192.168.0.2\\\"\""


# Change the type on the OVS side and check than OVN fixes it
ovs-vsctl set interface ovn-fakech-0 type=vxlan
ovs_wait_cond () {
    check_tunnel_property type geneve
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller.at:248" "until check_tunnel_property type geneve"


# Delete the port entirely and it should be resurrected
ovs-vsctl del-port ovn-fakech-0
ovs_wait_cond () {
    check_tunnel_property type geneve
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller.at:252" "until check_tunnel_property type geneve"


# Gracefully terminate daemons

    as hv
    if test "hv" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn-controller.at:255: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn-controller.at:255"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:255"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller.at:255: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn-controller.at:255"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:255"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller.at:255" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn-controller.at:255: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn-controller.at:255"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:255"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller.at:255: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn-controller.at:255"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:255"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller.at:255" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn-controller.at:255: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn-controller.at:255"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:255"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller.at:255: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn-controller.at:255"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:255"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller.at:255" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv
    { set +x
$as_echo "$at_srcdir/ovn-controller.at:255: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn-controller.at:255"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:255"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller.at:255: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn-controller.at:255"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:255"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller.at:255" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn-controller.at:255: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-controller.at:255"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:255"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller.at:255: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-controller.at:255"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:255"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller.at:255" "while kill -0 \$TMPPID 2>/dev/null"




    as main
    { set +x
$as_echo "$at_srcdir/ovn-controller.at:256: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn-controller.at:256"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:256"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller.at:256: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn-controller.at:256"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:256"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller.at:256" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn-controller.at:256: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-controller.at:256"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:256"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller.at:256: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-controller.at:256"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:256"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller.at:256" "while kill -0 \$TMPPID 2>/dev/null"


as ovn-sb
{ set +x
$as_echo "$at_srcdir/ovn-controller.at:258: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-controller.at:258"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:258"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller.at:258: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-controller.at:258"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:258"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller.at:258" "while kill -0 \$TMPPID 2>/dev/null"


ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_208
#AT_START_209
at_fn_group_banner 209 'ovn-controller.at:263' \
  "ovn-controller - check sbdb connection" "         " 8
at_xfail=no
(
  $as_echo "209. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init


ovn_init_db ovn-sb

net_add n1
sim_add hv
as hv
ovs-vsctl \
    -- add-br br-phys \
    -- add-br br-eth0 \
    -- add-br br-eth1 \
    -- add-br br-eth2
ovn_attach n1 br-phys 192.168.0.1

check_sbdb_connection () {
    test "$(ovs-appctl -t ovn-controller connection-status)" = "$1"
}

ovs_wait_cond () {
    check_sbdb_connection connected
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller.at:281" "until check_sbdb_connection connected"


ovs-vsctl set open . external_ids:ovn-remote=tcp:192.168.0.10:6642
ovs_wait_cond () {
    check_sbdb_connection 'not connected'
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller.at:284" "until check_sbdb_connection 'not connected'"


# reset the remote for clean-up
ovs-vsctl set open . external_ids:ovn-remote=unix:$ovs_base/ovn-sb/ovn-sb.sock
# Gracefully terminate daemons

    as hv
    if test "hv" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn-controller.at:289: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn-controller.at:289"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:289"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller.at:289: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn-controller.at:289"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:289"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller.at:289" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn-controller.at:289: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn-controller.at:289"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:289"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller.at:289: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn-controller.at:289"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:289"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller.at:289" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn-controller.at:289: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn-controller.at:289"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:289"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller.at:289: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn-controller.at:289"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:289"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller.at:289" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv
    { set +x
$as_echo "$at_srcdir/ovn-controller.at:289: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn-controller.at:289"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:289"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller.at:289: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn-controller.at:289"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:289"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller.at:289" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn-controller.at:289: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-controller.at:289"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:289"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller.at:289: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-controller.at:289"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:289"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller.at:289" "while kill -0 \$TMPPID 2>/dev/null"




    as main
    { set +x
$as_echo "$at_srcdir/ovn-controller.at:290: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn-controller.at:290"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:290"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller.at:290: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn-controller.at:290"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:290"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller.at:290" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn-controller.at:290: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-controller.at:290"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:290"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller.at:290: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-controller.at:290"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:290"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller.at:290" "while kill -0 \$TMPPID 2>/dev/null"


as ovn-sb
{ set +x
$as_echo "$at_srcdir/ovn-controller.at:292: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-controller.at:292"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:292"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller.at:292: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-controller.at:292"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:292"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller.at:292" "while kill -0 \$TMPPID 2>/dev/null"


ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_209
#AT_START_210
at_fn_group_banner 210 'ovn-controller.at:297' \
  "ovn-controller - Chassis self record" "           " 8
at_xfail=no
(
  $as_echo "210. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init


ovn_init_db ovn-sb

net_add n1
sim_add hv
as hv
ovs-vsctl \
    -- add-br br-phys \
    -- add-br br-eth0 \
    -- add-br br-eth1 \
    -- add-br br-eth2
ovn_attach n1 br-phys 192.168.0.1

ovs_wait_cond () {
    test xhv = x`ovn-sbctl --columns name --bare find chassis`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller.at:311" "until test xhv = x\`ovn-sbctl --columns name --bare find chassis\`"

# Delete the chassis "hv"
ovn-sbctl chassis-del hv
# ovn-controller should recreate its chassis row.
ovs_wait_cond () {
    test xhv = x`ovn-sbctl --columns name --bare find chassis`
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller.at:315" "until test xhv = x\`ovn-sbctl --columns name --bare find chassis\`"


# Gracefully terminate daemons

    as hv
    if test "hv" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn-controller.at:318: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn-controller.at:318"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:318"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller.at:318: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn-controller.at:318"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:318"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller.at:318" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn-controller.at:318: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn-controller.at:318"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:318"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller.at:318: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn-controller.at:318"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:318"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller.at:318" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn-controller.at:318: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn-controller.at:318"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:318"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller.at:318: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn-controller.at:318"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:318"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller.at:318" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as hv
    { set +x
$as_echo "$at_srcdir/ovn-controller.at:318: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn-controller.at:318"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:318"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller.at:318: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn-controller.at:318"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:318"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller.at:318" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn-controller.at:318: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-controller.at:318"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:318"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller.at:318: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-controller.at:318"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:318"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller.at:318" "while kill -0 \$TMPPID 2>/dev/null"




    as main
    { set +x
$as_echo "$at_srcdir/ovn-controller.at:319: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn-controller.at:319"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:319"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller.at:319: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn-controller.at:319"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:319"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller.at:319" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn-controller.at:319: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-controller.at:319"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:319"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller.at:319: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-controller.at:319"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:319"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller.at:319" "while kill -0 \$TMPPID 2>/dev/null"


as ovn-sb
{ set +x
$as_echo "$at_srcdir/ovn-controller.at:321: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-controller.at:321"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:321"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller.at:321: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-controller.at:321"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller.at:321"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller.at:321" "while kill -0 \$TMPPID 2>/dev/null"


ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_210
#AT_START_211
at_fn_group_banner 211 'ovn-controller-vtep.at:109' \
  "ovn-controller-vtep - chassis" "                  " 9
at_xfail=no
(
  $as_echo "211. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init



   # this will cause skip when 'make check' using Windows setup.

      { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:110: ovsdb-tool create vswitchd.db \$ovs_srcdir/vswitchd/vswitch.ovsschema"
at_fn_check_prepare_dynamic "ovsdb-tool create vswitchd.db $ovs_srcdir/vswitchd/vswitch.ovsschema" "ovn-controller-vtep.at:110"
( $at_check_trace; ovsdb-tool create vswitchd.db $ovs_srcdir/vswitchd/vswitch.ovsschema
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:110"
$at_failed && at_fn_log_failure
$at_traceon; }

   for daemon in ovn-nb ovn-sb; do
      { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:110: ovsdb-tool create \$daemon.db \$abs_top_srcdir/\${daemon}.ovsschema"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "ovn-controller-vtep.at:110"
( $at_check_trace; ovsdb-tool create $daemon.db $abs_top_srcdir/${daemon}.ovsschema
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:110"
$at_failed && at_fn_log_failure
$at_traceon; }

   done
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:110: ovsdb-tool create vtep.db \$ovs_srcdir/vtep/vtep.ovsschema"
at_fn_check_prepare_dynamic "ovsdb-tool create vtep.db $ovs_srcdir/vtep/vtep.ovsschema" "ovn-controller-vtep.at:110"
( $at_check_trace; ovsdb-tool create vtep.db $ovs_srcdir/vtep/vtep.ovsschema
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:110"
$at_failed && at_fn_log_failure
$at_traceon; }


      { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:110: ovsdb-server --detach --no-chdir --pidfile --log-file --remote=punix:\$OVS_RUNDIR/db.sock vswitchd.db vtep.db"
at_fn_check_prepare_dynamic "ovsdb-server --detach --no-chdir --pidfile --log-file --remote=punix:$OVS_RUNDIR/db.sock vswitchd.db vtep.db" "ovn-controller-vtep.at:110"
( $at_check_trace; ovsdb-server --detach --no-chdir --pidfile --log-file --remote=punix:$OVS_RUNDIR/db.sock vswitchd.db vtep.db
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:110"
$at_failed && at_fn_log_failure
$at_traceon; }

   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:110: ovsdb-server --detach --no-chdir --pidfile=ovsdb-nb-server.pid --log-file=ovsdb-nb-server.log --remote=punix:\$OVS_RUNDIR/ovnnb_db.sock ovn-nb.db"
at_fn_check_prepare_dynamic "ovsdb-server --detach --no-chdir --pidfile=ovsdb-nb-server.pid --log-file=ovsdb-nb-server.log --remote=punix:$OVS_RUNDIR/ovnnb_db.sock ovn-nb.db" "ovn-controller-vtep.at:110"
( $at_check_trace; ovsdb-server --detach --no-chdir --pidfile=ovsdb-nb-server.pid --log-file=ovsdb-nb-server.log --remote=punix:$OVS_RUNDIR/ovnnb_db.sock ovn-nb.db
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:110"
$at_failed && at_fn_log_failure
$at_traceon; }

   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:110: ovsdb-server --detach --no-chdir --pidfile=ovsdb-sb-server.pid --log-file=ovsdb-sb-server.log --remote=punix:\$OVS_RUNDIR/ovnsb_db.sock ovn-sb.db ovn-sb.db"
at_fn_check_prepare_dynamic "ovsdb-server --detach --no-chdir --pidfile=ovsdb-sb-server.pid --log-file=ovsdb-sb-server.log --remote=punix:$OVS_RUNDIR/ovnsb_db.sock ovn-sb.db ovn-sb.db" "ovn-controller-vtep.at:110"
( $at_check_trace; ovsdb-server --detach --no-chdir --pidfile=ovsdb-sb-server.pid --log-file=ovsdb-sb-server.log --remote=punix:$OVS_RUNDIR/ovnsb_db.sock ovn-sb.db ovn-sb.db
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:110"
$at_failed && at_fn_log_failure
$at_traceon; }

   on_exit "kill `cat ovsdb-server.pid` `cat ovsdb-nb-server.pid` `cat ovsdb-sb-server.pid`"
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:110: sed < stderr '
/vlog|INFO|opened log file/d
/ovsdb_server|INFO|ovsdb-server (Open vSwitch)/d'"
at_fn_check_prepare_notrace 'an embedded newline' "ovn-controller-vtep.at:110"
( $at_check_trace; sed < stderr '
/vlog|INFO|opened log file/d
/ovsdb_server|INFO|ovsdb-server (Open vSwitch)/d'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:110"
$at_failed && at_fn_log_failure
$at_traceon; }



      { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:110: ovs-vswitchd --enable-dummy=system --disable-system --detach --no-chdir --pidfile --log-file -vvconn -vofproto_dpif"
at_fn_check_prepare_trace "ovn-controller-vtep.at:110"
( $at_check_trace; ovs-vswitchd --enable-dummy=system --disable-system --detach --no-chdir --pidfile --log-file -vvconn -vofproto_dpif
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:110"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


   on_exit "kill `cat ovs-vswitchd.pid`"
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:110: sed < stderr '
/ovs_numa|INFO|Discovered /d
/vlog|INFO|opened log file/d
/vswitchd|INFO|ovs-vswitchd (Open vSwitch)/d
/reconnect|INFO|/d
/ofproto|INFO|using datapath ID/d
/netlink_socket|INFO|netlink: could not enable listening to all nsid/d
/ofproto|INFO|datapath ID changed to fedcba9876543210/d'"
at_fn_check_prepare_notrace 'an embedded newline' "ovn-controller-vtep.at:110"
( $at_check_trace; sed < stderr '
/ovs_numa|INFO|Discovered /d
/vlog|INFO|opened log file/d
/vswitchd|INFO|ovs-vswitchd (Open vSwitch)/d
/reconnect|INFO|/d
/ofproto|INFO|using datapath ID/d
/netlink_socket|INFO|netlink: could not enable listening to all nsid/d
/ofproto|INFO|datapath ID changed to fedcba9876543210/d'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:110"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log"
$at_traceon; }

   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:110: ovs-vsctl -- add-br br-vtep \\
              -- set bridge br-vtep datapath-type=dummy other-config:datapath-id=fedcba9876543210 other-config:hwaddr=aa:55:aa:55:00:00 protocols=[OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13,OpenFlow14,OpenFlow15] fail-mode=secure \\
              -- add-port br-vtep p0 -- set Interface p0 type=dummy ofport_request=1 \\
              -- add-port br-vtep p1 -- set Interface p1 type=dummy ofport_request=2"
at_fn_check_prepare_notrace 'an embedded newline' "ovn-controller-vtep.at:110"
( $at_check_trace; ovs-vsctl -- add-br br-vtep \
              -- set bridge br-vtep datapath-type=dummy other-config:datapath-id=fedcba9876543210 other-config:hwaddr=aa:55:aa:55:00:00 protocols=[OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13,OpenFlow14,OpenFlow15] fail-mode=secure \
              -- add-port br-vtep p0 -- set Interface p0 type=dummy ofport_request=1 \
              -- add-port br-vtep p1 -- set Interface p1 type=dummy ofport_request=2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:110"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log"
$at_traceon; }


      { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:110: vtep-ctl add-ps br-vtep -- set Physical_Switch br-vtep tunnel_ips=1.2.3.4"
at_fn_check_prepare_trace "ovn-controller-vtep.at:110"
( $at_check_trace; vtep-ctl add-ps br-vtep -- set Physical_Switch br-vtep tunnel_ips=1.2.3.4
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:110"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log"
$at_traceon; }

   PYTHONPATH=$PYTHONPATH:$ovs_srcdir/python
   export $PYTHONPATH
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:110: ovs-vtep --log-file=ovs-vtep.log --pidfile=ovs-vtep.pid --detach --no-chdir br-vtep \\"
at_fn_check_prepare_trace "ovn-controller-vtep.at:110"
( $at_check_trace; ovs-vtep --log-file=ovs-vtep.log --pidfile=ovs-vtep.pid --detach --no-chdir br-vtep \
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:110"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log"
$at_traceon; }

   on_exit "kill `cat ovs-vtep.pid`"
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:110: sed < stderr '
/vlog|INFO|opened log file/d'"
at_fn_check_prepare_notrace 'an embedded newline' "ovn-controller-vtep.at:110"
( $at_check_trace; sed < stderr '
/vlog|INFO|opened log file/d'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:110"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log"
$at_traceon; }

   # waits until ovs-vtep starts up.
   ovs_wait_cond () {
    test -n "`vtep-ctl show | grep Physical_Port`"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:110" "until test -n \"\`vtep-ctl show | grep Physical_Port\`\""


      { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:110: ovn-nbctl ls-add br-test"
at_fn_check_prepare_trace "ovn-controller-vtep.at:110"
( $at_check_trace; ovn-nbctl ls-add br-test
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:110"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log"
$at_traceon; }

   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:110: ovn-northd --detach --no-chdir --pidfile --log-file"
at_fn_check_prepare_trace "ovn-controller-vtep.at:110"
( $at_check_trace; ovn-northd --detach --no-chdir --pidfile --log-file
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:110"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log"
$at_traceon; }

   on_exit "kill `cat ovn-northd.pid`"
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:110: sed < stderr '
/vlog|INFO|opened log file/d'"
at_fn_check_prepare_notrace 'an embedded newline' "ovn-controller-vtep.at:110"
( $at_check_trace; sed < stderr '
/vlog|INFO|opened log file/d'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:110"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log"
$at_traceon; }



      { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:110: ovn-controller-vtep --detach --no-chdir --pidfile --log-file --vtep-db=unix:\$OVS_RUNDIR/db.sock --ovnsb-db=unix:\$OVS_RUNDIR/ovnsb_db.sock"
at_fn_check_prepare_dynamic "ovn-controller-vtep --detach --no-chdir --pidfile --log-file --vtep-db=unix:$OVS_RUNDIR/db.sock --ovnsb-db=unix:$OVS_RUNDIR/ovnsb_db.sock" "ovn-controller-vtep.at:110"
( $at_check_trace; ovn-controller-vtep --detach --no-chdir --pidfile --log-file --vtep-db=unix:$OVS_RUNDIR/db.sock --ovnsb-db=unix:$OVS_RUNDIR/ovnsb_db.sock
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:110"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log"
$at_traceon; }


   on_exit "kill `cat ovn-controller-vtep.pid`"
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:110: sed < stderr '
/vlog|INFO|opened log file/d
/reconnect|INFO|/d'"
at_fn_check_prepare_notrace 'an embedded newline' "ovn-controller-vtep.at:110"
( $at_check_trace; sed < stderr '
/vlog|INFO|opened log file/d
/reconnect|INFO|/d'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:110"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }



# verifies the initial ovn-sb db configuration.
ovs_wait_cond () {
    test -n "`ovn-sbctl show | grep Chassis`"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:113" "until test -n \"\`ovn-sbctl show | grep Chassis\`\""

{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:114: ovn-sbctl show"
at_fn_check_prepare_trace "ovn-controller-vtep.at:114"
( $at_check_trace; ovn-sbctl show
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "Chassis br-vtep
    Encap vxlan
        ip: \"1.2.3.4\"
        options: {csum=\"false\"}
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:114"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }


# deletes the chassis via ovn-sbctl and check that it is readded back
# with the log.
{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:123: ovn-sbctl chassis-del br-vtep"
at_fn_check_prepare_trace "ovn-controller-vtep.at:123"
( $at_check_trace; ovn-sbctl chassis-del br-vtep
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:123"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

ovs_wait_cond () {
    test -n "`grep WARN ovn-controller-vtep.log`"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:124" "until test -n \"\`grep WARN ovn-controller-vtep.log\`\""

{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:125: sed -n 's/^.*\\(|WARN|.*\\)\$/\\1/p' ovn-controller-vtep.log"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-controller-vtep.at:125"
( $at_check_trace; sed -n 's/^.*\(|WARN|.*\)$/\1/p' ovn-controller-vtep.log
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "|WARN|Chassis for VTEP physical switch (br-vtep) disappears, maybe deleted by ovn-sbctl, adding it back
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:125"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }


# changes the tunnel_ip on physical switch, watches the update of chassis's
# encap.
{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:131: vtep-ctl set Physical_Switch br-vtep tunnel_ips=1.2.3.5"
at_fn_check_prepare_trace "ovn-controller-vtep.at:131"
( $at_check_trace; vtep-ctl set Physical_Switch br-vtep tunnel_ips=1.2.3.5
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:131"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

ovs_wait_cond () {
    test -n "`ovn-sbctl show | grep 1\.2\.3\.5`"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:132" "until test -n \"\`ovn-sbctl show | grep 1\\.2\\.3\\.5\`\""

{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:133: ovn-sbctl --columns=ip list Encap | cut -d ':' -f2 | tr -d ' '"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-controller-vtep.at:133"
( $at_check_trace; ovn-sbctl --columns=ip list Encap | cut -d ':' -f2 | tr -d ' '
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"1.2.3.5\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:133"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }


# adds vlan_bindings to physical ports.
{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:138: vtep-ctl add-ls lswitch0 -- bind-ls br-vtep p0 100 lswitch0 -- bind-ls br-vtep p0 200 lswitch0 -- bind-ls br-vtep p1 300 lswitch0"
at_fn_check_prepare_trace "ovn-controller-vtep.at:138"
( $at_check_trace; vtep-ctl add-ls lswitch0 -- bind-ls br-vtep p0 100 lswitch0 -- bind-ls br-vtep p0 200 lswitch0 -- bind-ls br-vtep p1 300 lswitch0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:138"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

ovs_wait_cond () {
    test -n "`ovn-sbctl list Chassis | grep -- lswitch0`"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:139" "until test -n \"\`ovn-sbctl list Chassis | grep -- lswitch0\`\""

{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:140: ovn-sbctl --columns=vtep_logical_switches list Chassis | cut -d ':' -f2 | tr -d ' ' "
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-controller-vtep.at:140"
( $at_check_trace; ovn-sbctl --columns=vtep_logical_switches list Chassis | cut -d ':' -f2 | tr -d ' '
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "[lswitch0]
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:140"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }


# adds another logical switch and new vlan_bindings.
{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:145: vtep-ctl add-ls lswitch1 -- bind-ls br-vtep p0 300 lswitch1"
at_fn_check_prepare_trace "ovn-controller-vtep.at:145"
( $at_check_trace; vtep-ctl add-ls lswitch1 -- bind-ls br-vtep p0 300 lswitch1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:145"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

ovs_wait_cond () {
    test -n "`ovn-sbctl list Chassis | grep -- lswitch1`"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:146" "until test -n \"\`ovn-sbctl list Chassis | grep -- lswitch1\`\""

{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:147: ovn-sbctl --columns=vtep_logical_switches list Chassis | cut -d ':' -f2 | tr -d ' '"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-controller-vtep.at:147"
( $at_check_trace; ovn-sbctl --columns=vtep_logical_switches list Chassis | cut -d ':' -f2 | tr -d ' '
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "[lswitch0,lswitch1]
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:147"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }


# unbinds one port from lswitch0, nothing should change.
{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:152: vtep-ctl unbind-ls br-vtep p0 200"
at_fn_check_prepare_trace "ovn-controller-vtep.at:152"
( $at_check_trace; vtep-ctl unbind-ls br-vtep p0 200
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:152"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

ovs_wait_cond () {
    test -z "`vtep-ctl --columns=vlan_bindings list physical_port p0 | grep -- '200='`"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:153" "until test -z \"\`vtep-ctl --columns=vlan_bindings list physical_port p0 | grep -- '200='\`\""

{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:154: ovn-sbctl --columns=vtep_logical_switches list Chassis | cut -d ':' -f2 | tr -d ' ' "
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-controller-vtep.at:154"
( $at_check_trace; ovn-sbctl --columns=vtep_logical_switches list Chassis | cut -d ':' -f2 | tr -d ' '
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "[lswitch0,lswitch1]
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:154"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }


# unbinds all ports from lswitch0.
{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:159: vtep-ctl unbind-ls br-vtep p0 100 -- unbind-ls br-vtep p1 300"
at_fn_check_prepare_trace "ovn-controller-vtep.at:159"
( $at_check_trace; vtep-ctl unbind-ls br-vtep p0 100 -- unbind-ls br-vtep p1 300
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:159"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

ovs_wait_cond () {
    test -z "`ovn-sbctl list Chassis | grep -- br-vtep_lswitch0`"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:160" "until test -z \"\`ovn-sbctl list Chassis | grep -- br-vtep_lswitch0\`\""

{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:161: ovn-sbctl --columns=vtep_logical_switches list Chassis | cut -d ':' -f2 | tr -d ' ' "
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-controller-vtep.at:161"
( $at_check_trace; ovn-sbctl --columns=vtep_logical_switches list Chassis | cut -d ':' -f2 | tr -d ' '
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "[lswitch1]
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:161"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }


# unbinds all ports from lswitch1.
{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:166: vtep-ctl unbind-ls br-vtep p0 300"
at_fn_check_prepare_trace "ovn-controller-vtep.at:166"
( $at_check_trace; vtep-ctl unbind-ls br-vtep p0 300
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:166"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

ovs_wait_cond () {
    test -z "`ovn-sbctl list Chassis | grep -- br-vtep_lswitch1`"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:167" "until test -z \"\`ovn-sbctl list Chassis | grep -- br-vtep_lswitch1\`\""

{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:168: ovn-sbctl --columns=vtep_logical_switches list Chassis | cut -d ':' -f2 | tr -d ' '"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-controller-vtep.at:168"
( $at_check_trace; ovn-sbctl --columns=vtep_logical_switches list Chassis | cut -d ':' -f2 | tr -d ' '
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "[]
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:168"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:172: check_logs \"/Chassis for VTEP physical switch (br-vtep) disappears/d\""
at_fn_check_prepare_trace "ovn-controller-vtep.at:172"
( $at_check_trace; check_logs "/Chassis for VTEP physical switch (br-vtep) disappears/d"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:172"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:172: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn-controller-vtep.at:172"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:172"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:172: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn-controller-vtep.at:172"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:172"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:172" "while kill -0 \$TMPPID 2>/dev/null"

   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:172: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn-controller-vtep.at:172"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:172"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:172: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn-controller-vtep.at:172"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:172"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:172" "while kill -0 \$TMPPID 2>/dev/null"

   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:172: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn-controller-vtep.at:172"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:172"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:172: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn-controller-vtep.at:172"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:172"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:172" "while kill -0 \$TMPPID 2>/dev/null"

   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:172: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-controller-vtep.at:172"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:172"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:172: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-controller-vtep.at:172"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:172"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:172" "while kill -0 \$TMPPID 2>/dev/null"

   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:172: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn-controller-vtep.at:172"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:172"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:172: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn-controller-vtep.at:172"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:172"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:172" "while kill -0 \$TMPPID 2>/dev/null"

ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_211
#AT_START_212
at_fn_group_banner 212 'ovn-controller-vtep.at:177' \
  "ovn-controller-vtep - binding 1" "                " 9
at_xfail=no
(
  $as_echo "212. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init



   # this will cause skip when 'make check' using Windows setup.

      { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:178: ovsdb-tool create vswitchd.db \$ovs_srcdir/vswitchd/vswitch.ovsschema"
at_fn_check_prepare_dynamic "ovsdb-tool create vswitchd.db $ovs_srcdir/vswitchd/vswitch.ovsschema" "ovn-controller-vtep.at:178"
( $at_check_trace; ovsdb-tool create vswitchd.db $ovs_srcdir/vswitchd/vswitch.ovsschema
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:178"
$at_failed && at_fn_log_failure
$at_traceon; }

   for daemon in ovn-nb ovn-sb; do
      { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:178: ovsdb-tool create \$daemon.db \$abs_top_srcdir/\${daemon}.ovsschema"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "ovn-controller-vtep.at:178"
( $at_check_trace; ovsdb-tool create $daemon.db $abs_top_srcdir/${daemon}.ovsschema
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:178"
$at_failed && at_fn_log_failure
$at_traceon; }

   done
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:178: ovsdb-tool create vtep.db \$ovs_srcdir/vtep/vtep.ovsschema"
at_fn_check_prepare_dynamic "ovsdb-tool create vtep.db $ovs_srcdir/vtep/vtep.ovsschema" "ovn-controller-vtep.at:178"
( $at_check_trace; ovsdb-tool create vtep.db $ovs_srcdir/vtep/vtep.ovsschema
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:178"
$at_failed && at_fn_log_failure
$at_traceon; }


      { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:178: ovsdb-server --detach --no-chdir --pidfile --log-file --remote=punix:\$OVS_RUNDIR/db.sock vswitchd.db vtep.db"
at_fn_check_prepare_dynamic "ovsdb-server --detach --no-chdir --pidfile --log-file --remote=punix:$OVS_RUNDIR/db.sock vswitchd.db vtep.db" "ovn-controller-vtep.at:178"
( $at_check_trace; ovsdb-server --detach --no-chdir --pidfile --log-file --remote=punix:$OVS_RUNDIR/db.sock vswitchd.db vtep.db
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:178"
$at_failed && at_fn_log_failure
$at_traceon; }

   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:178: ovsdb-server --detach --no-chdir --pidfile=ovsdb-nb-server.pid --log-file=ovsdb-nb-server.log --remote=punix:\$OVS_RUNDIR/ovnnb_db.sock ovn-nb.db"
at_fn_check_prepare_dynamic "ovsdb-server --detach --no-chdir --pidfile=ovsdb-nb-server.pid --log-file=ovsdb-nb-server.log --remote=punix:$OVS_RUNDIR/ovnnb_db.sock ovn-nb.db" "ovn-controller-vtep.at:178"
( $at_check_trace; ovsdb-server --detach --no-chdir --pidfile=ovsdb-nb-server.pid --log-file=ovsdb-nb-server.log --remote=punix:$OVS_RUNDIR/ovnnb_db.sock ovn-nb.db
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:178"
$at_failed && at_fn_log_failure
$at_traceon; }

   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:178: ovsdb-server --detach --no-chdir --pidfile=ovsdb-sb-server.pid --log-file=ovsdb-sb-server.log --remote=punix:\$OVS_RUNDIR/ovnsb_db.sock ovn-sb.db ovn-sb.db"
at_fn_check_prepare_dynamic "ovsdb-server --detach --no-chdir --pidfile=ovsdb-sb-server.pid --log-file=ovsdb-sb-server.log --remote=punix:$OVS_RUNDIR/ovnsb_db.sock ovn-sb.db ovn-sb.db" "ovn-controller-vtep.at:178"
( $at_check_trace; ovsdb-server --detach --no-chdir --pidfile=ovsdb-sb-server.pid --log-file=ovsdb-sb-server.log --remote=punix:$OVS_RUNDIR/ovnsb_db.sock ovn-sb.db ovn-sb.db
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:178"
$at_failed && at_fn_log_failure
$at_traceon; }

   on_exit "kill `cat ovsdb-server.pid` `cat ovsdb-nb-server.pid` `cat ovsdb-sb-server.pid`"
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:178: sed < stderr '
/vlog|INFO|opened log file/d
/ovsdb_server|INFO|ovsdb-server (Open vSwitch)/d'"
at_fn_check_prepare_notrace 'an embedded newline' "ovn-controller-vtep.at:178"
( $at_check_trace; sed < stderr '
/vlog|INFO|opened log file/d
/ovsdb_server|INFO|ovsdb-server (Open vSwitch)/d'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:178"
$at_failed && at_fn_log_failure
$at_traceon; }



      { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:178: ovs-vswitchd --enable-dummy=system --disable-system --detach --no-chdir --pidfile --log-file -vvconn -vofproto_dpif"
at_fn_check_prepare_trace "ovn-controller-vtep.at:178"
( $at_check_trace; ovs-vswitchd --enable-dummy=system --disable-system --detach --no-chdir --pidfile --log-file -vvconn -vofproto_dpif
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:178"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


   on_exit "kill `cat ovs-vswitchd.pid`"
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:178: sed < stderr '
/ovs_numa|INFO|Discovered /d
/vlog|INFO|opened log file/d
/vswitchd|INFO|ovs-vswitchd (Open vSwitch)/d
/reconnect|INFO|/d
/ofproto|INFO|using datapath ID/d
/netlink_socket|INFO|netlink: could not enable listening to all nsid/d
/ofproto|INFO|datapath ID changed to fedcba9876543210/d'"
at_fn_check_prepare_notrace 'an embedded newline' "ovn-controller-vtep.at:178"
( $at_check_trace; sed < stderr '
/ovs_numa|INFO|Discovered /d
/vlog|INFO|opened log file/d
/vswitchd|INFO|ovs-vswitchd (Open vSwitch)/d
/reconnect|INFO|/d
/ofproto|INFO|using datapath ID/d
/netlink_socket|INFO|netlink: could not enable listening to all nsid/d
/ofproto|INFO|datapath ID changed to fedcba9876543210/d'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:178"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log"
$at_traceon; }

   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:178: ovs-vsctl -- add-br br-vtep \\
              -- set bridge br-vtep datapath-type=dummy other-config:datapath-id=fedcba9876543210 other-config:hwaddr=aa:55:aa:55:00:00 protocols=[OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13,OpenFlow14,OpenFlow15] fail-mode=secure \\
              -- add-port br-vtep p0 -- set Interface p0 type=dummy ofport_request=1 \\
              -- add-port br-vtep p1 -- set Interface p1 type=dummy ofport_request=2"
at_fn_check_prepare_notrace 'an embedded newline' "ovn-controller-vtep.at:178"
( $at_check_trace; ovs-vsctl -- add-br br-vtep \
              -- set bridge br-vtep datapath-type=dummy other-config:datapath-id=fedcba9876543210 other-config:hwaddr=aa:55:aa:55:00:00 protocols=[OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13,OpenFlow14,OpenFlow15] fail-mode=secure \
              -- add-port br-vtep p0 -- set Interface p0 type=dummy ofport_request=1 \
              -- add-port br-vtep p1 -- set Interface p1 type=dummy ofport_request=2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:178"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log"
$at_traceon; }


      { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:178: vtep-ctl add-ps br-vtep -- set Physical_Switch br-vtep tunnel_ips=1.2.3.4"
at_fn_check_prepare_trace "ovn-controller-vtep.at:178"
( $at_check_trace; vtep-ctl add-ps br-vtep -- set Physical_Switch br-vtep tunnel_ips=1.2.3.4
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:178"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log"
$at_traceon; }

   PYTHONPATH=$PYTHONPATH:$ovs_srcdir/python
   export $PYTHONPATH
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:178: ovs-vtep --log-file=ovs-vtep.log --pidfile=ovs-vtep.pid --detach --no-chdir br-vtep \\"
at_fn_check_prepare_trace "ovn-controller-vtep.at:178"
( $at_check_trace; ovs-vtep --log-file=ovs-vtep.log --pidfile=ovs-vtep.pid --detach --no-chdir br-vtep \
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:178"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log"
$at_traceon; }

   on_exit "kill `cat ovs-vtep.pid`"
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:178: sed < stderr '
/vlog|INFO|opened log file/d'"
at_fn_check_prepare_notrace 'an embedded newline' "ovn-controller-vtep.at:178"
( $at_check_trace; sed < stderr '
/vlog|INFO|opened log file/d'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:178"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log"
$at_traceon; }

   # waits until ovs-vtep starts up.
   ovs_wait_cond () {
    test -n "`vtep-ctl show | grep Physical_Port`"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:178" "until test -n \"\`vtep-ctl show | grep Physical_Port\`\""


      { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:178: ovn-nbctl ls-add br-test"
at_fn_check_prepare_trace "ovn-controller-vtep.at:178"
( $at_check_trace; ovn-nbctl ls-add br-test
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:178"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log"
$at_traceon; }

   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:178: ovn-northd --detach --no-chdir --pidfile --log-file"
at_fn_check_prepare_trace "ovn-controller-vtep.at:178"
( $at_check_trace; ovn-northd --detach --no-chdir --pidfile --log-file
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:178"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log"
$at_traceon; }

   on_exit "kill `cat ovn-northd.pid`"
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:178: sed < stderr '
/vlog|INFO|opened log file/d'"
at_fn_check_prepare_notrace 'an embedded newline' "ovn-controller-vtep.at:178"
( $at_check_trace; sed < stderr '
/vlog|INFO|opened log file/d'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:178"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log"
$at_traceon; }



      { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:178: ovn-controller-vtep --detach --no-chdir --pidfile --log-file --vtep-db=unix:\$OVS_RUNDIR/db.sock --ovnsb-db=unix:\$OVS_RUNDIR/ovnsb_db.sock"
at_fn_check_prepare_dynamic "ovn-controller-vtep --detach --no-chdir --pidfile --log-file --vtep-db=unix:$OVS_RUNDIR/db.sock --ovnsb-db=unix:$OVS_RUNDIR/ovnsb_db.sock" "ovn-controller-vtep.at:178"
( $at_check_trace; ovn-controller-vtep --detach --no-chdir --pidfile --log-file --vtep-db=unix:$OVS_RUNDIR/db.sock --ovnsb-db=unix:$OVS_RUNDIR/ovnsb_db.sock
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:178"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log"
$at_traceon; }


   on_exit "kill `cat ovn-controller-vtep.pid`"
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:178: sed < stderr '
/vlog|INFO|opened log file/d
/reconnect|INFO|/d'"
at_fn_check_prepare_notrace 'an embedded newline' "ovn-controller-vtep.at:178"
( $at_check_trace; sed < stderr '
/vlog|INFO|opened log file/d
/reconnect|INFO|/d'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:178"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }



# adds logical switch 'lswitch0' and vlan_bindings.
{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:181: vtep-ctl add-ls lswitch0 -- bind-ls br-vtep p0 100 lswitch0 -- bind-ls br-vtep p1 300 lswitch0"
at_fn_check_prepare_trace "ovn-controller-vtep.at:181"
( $at_check_trace; vtep-ctl add-ls lswitch0 -- bind-ls br-vtep p0 100 lswitch0 -- bind-ls br-vtep p1 300 lswitch0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:181"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

# adds logical switch port in ovn-nb database, and sets the type and options.

{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:183: ovn-nbctl lsp-add br-test br-vtep_lswitch0"
at_fn_check_prepare_trace "ovn-controller-vtep.at:183"
( $at_check_trace; ovn-nbctl lsp-add br-test br-vtep_lswitch0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:183"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:183: ovn-nbctl lsp-set-type br-vtep_lswitch0 vtep"
at_fn_check_prepare_trace "ovn-controller-vtep.at:183"
( $at_check_trace; ovn-nbctl lsp-set-type br-vtep_lswitch0 vtep
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:183"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:183: ovn-nbctl lsp-set-options br-vtep_lswitch0 vtep-physical-switch=br-vtep vtep-logical-switch=lswitch0"
at_fn_check_prepare_trace "ovn-controller-vtep.at:183"
( $at_check_trace; ovn-nbctl lsp-set-options br-vtep_lswitch0 vtep-physical-switch=br-vtep vtep-logical-switch=lswitch0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:183"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }


ovn-sbctl --timeout=10 wait-until Port_Binding br-vtep_lswitch0 chassis!='[]'
# should see one binding, associated to chassis of 'br-vtep'.
chassis_uuid=$(ovn-sbctl --columns=_uuid list Chassis br-vtep | cut -d ':' -f2 | tr -d ' ')
{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:187: ovn-sbctl --columns=chassis list Port_Binding br-vtep_lswitch0 | cut -d ':' -f2 | tr -d ' '"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-controller-vtep.at:187"
( $at_check_trace; ovn-sbctl --columns=chassis list Port_Binding br-vtep_lswitch0 | cut -d ':' -f2 | tr -d ' '
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "${chassis_uuid}
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:187"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }


# adds another logical switch 'lswitch1' and vlan_bindings.
{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:192: vtep-ctl add-ls lswitch1 -- bind-ls br-vtep p0 200 lswitch1"
at_fn_check_prepare_trace "ovn-controller-vtep.at:192"
( $at_check_trace; vtep-ctl add-ls lswitch1 -- bind-ls br-vtep p0 200 lswitch1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:192"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

# adds logical switch port in ovn-nb database for lswitch1.

{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:194: ovn-nbctl lsp-add br-test br-vtep_lswitch1"
at_fn_check_prepare_trace "ovn-controller-vtep.at:194"
( $at_check_trace; ovn-nbctl lsp-add br-test br-vtep_lswitch1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:194"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:194: ovn-nbctl lsp-set-type br-vtep_lswitch1 vtep"
at_fn_check_prepare_trace "ovn-controller-vtep.at:194"
( $at_check_trace; ovn-nbctl lsp-set-type br-vtep_lswitch1 vtep
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:194"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:194: ovn-nbctl lsp-set-options br-vtep_lswitch1 vtep-physical-switch=br-vtep vtep-logical-switch=lswitch1"
at_fn_check_prepare_trace "ovn-controller-vtep.at:194"
( $at_check_trace; ovn-nbctl lsp-set-options br-vtep_lswitch1 vtep-physical-switch=br-vtep vtep-logical-switch=lswitch1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:194"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }


ovn-sbctl --timeout=10 wait-until Port_Binding br-vtep_lswitch1 chassis!='[]'
# This is allowed, but not recommended, to have two vlan_bindings (to different vtep logical switches)
# from one vtep gateway physical port in one ovn-nb logical swithch.
{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:198: ovn-sbctl --columns=chassis list Port_Binding | cut -d ':' -f2 | tr -d ' ' | sort"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-controller-vtep.at:198"
( $at_check_trace; ovn-sbctl --columns=chassis list Port_Binding | cut -d ':' -f2 | tr -d ' ' | sort
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "
${chassis_uuid}
${chassis_uuid}
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:198"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }


# adds another logical switch port in ovn-nb database for lswitch0.

{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:205: ovn-nbctl lsp-add br-test br-vtep_lswitch0_dup"
at_fn_check_prepare_trace "ovn-controller-vtep.at:205"
( $at_check_trace; ovn-nbctl lsp-add br-test br-vtep_lswitch0_dup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:205"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:205: ovn-nbctl lsp-set-type br-vtep_lswitch0_dup vtep"
at_fn_check_prepare_trace "ovn-controller-vtep.at:205"
( $at_check_trace; ovn-nbctl lsp-set-type br-vtep_lswitch0_dup vtep
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:205"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:205: ovn-nbctl lsp-set-options br-vtep_lswitch0_dup vtep-physical-switch=br-vtep vtep-logical-switch=lswitch0"
at_fn_check_prepare_trace "ovn-controller-vtep.at:205"
( $at_check_trace; ovn-nbctl lsp-set-options br-vtep_lswitch0_dup vtep-physical-switch=br-vtep vtep-logical-switch=lswitch0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:205"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }


ovn-sbctl --timeout=10 wait-until Port_Binding br-vtep_lswitch0_dup chassis!='[]'
# it is not allowed to have more than one ovn-nb logical port for the same
# vtep logical switch on a vtep gateway chassis, so should still see only
# two port_binding entries bound.
{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:210: ovn-sbctl --columns=chassis list Port_Binding | cut -d ':' -f2 | tr -d ' ' | sort | sort -d"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-controller-vtep.at:210"
( $at_check_trace; ovn-sbctl --columns=chassis list Port_Binding | cut -d ':' -f2 | tr -d ' ' | sort | sort -d
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "

[]
${chassis_uuid}
${chassis_uuid}
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:210"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

# confirms the warning log.
{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:218: sed -n 's/^.*\\(|WARN|.*\\)\$/\\1/p' ovn-controller-vtep.log | sed 's/([-_0-9a-z][-_0-9a-z]*)/()/g' | uniq"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-controller-vtep.at:218"
( $at_check_trace; sed -n 's/^.*\(|WARN|.*\)$/\1/p' ovn-controller-vtep.log | sed 's/([-_0-9a-z][-_0-9a-z]*)/()/g' | uniq
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "|WARN|logical switch (), on vtep gateway chassis () has already been associated with logical port (), ignore logical port ()
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:218"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }


# deletes physical ports from vtep.
{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:223: ovs-vsctl del-port p0 -- del-port p1"
at_fn_check_prepare_trace "ovn-controller-vtep.at:223"
( $at_check_trace; ovs-vsctl del-port p0 -- del-port p1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:223"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

ovs_wait_cond () {
    test -z "`ovn-sbctl list Chassis | grep -- br-vtep_lswitch`"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:224" "until test -z \"\`ovn-sbctl list Chassis | grep -- br-vtep_lswitch\`\""

ovs_wait_cond () {
    test -z "`vtep-ctl list physical_port p0`"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:225" "until test -z \"\`vtep-ctl list physical_port p0\`\""

ovs_wait_cond () {
    test -z "`vtep-ctl list physical_port p1`"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:226" "until test -z \"\`vtep-ctl list physical_port p1\`\""

# should see empty chassis column in both binding entries.
{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:228: ovn-sbctl --columns=chassis list Port_Binding | cut -d ':' -f2 | tr -d ' ' | sort"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-controller-vtep.at:228"
( $at_check_trace; ovn-sbctl --columns=chassis list Port_Binding | cut -d ':' -f2 | tr -d ' ' | sort
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "

[]
[]
[]
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:228"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:236: check_logs \"/has already been associated with logical port/d\""
at_fn_check_prepare_trace "ovn-controller-vtep.at:236"
( $at_check_trace; check_logs "/has already been associated with logical port/d"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:236"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:236: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn-controller-vtep.at:236"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:236"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:236: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn-controller-vtep.at:236"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:236"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:236" "while kill -0 \$TMPPID 2>/dev/null"

   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:236: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn-controller-vtep.at:236"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:236"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:236: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn-controller-vtep.at:236"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:236"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:236" "while kill -0 \$TMPPID 2>/dev/null"

   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:236: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn-controller-vtep.at:236"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:236"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:236: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn-controller-vtep.at:236"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:236"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:236" "while kill -0 \$TMPPID 2>/dev/null"

   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:236: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-controller-vtep.at:236"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:236"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:236: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-controller-vtep.at:236"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:236"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:236" "while kill -0 \$TMPPID 2>/dev/null"

   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:236: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn-controller-vtep.at:236"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:236"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:236: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn-controller-vtep.at:236"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:236"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:236" "while kill -0 \$TMPPID 2>/dev/null"

ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_212
#AT_START_213
at_fn_group_banner 213 'ovn-controller-vtep.at:242' \
  "ovn-controller-vtep - binding 2" "                " 9
at_xfail=no
(
  $as_echo "213. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init



   # this will cause skip when 'make check' using Windows setup.

      { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:243: ovsdb-tool create vswitchd.db \$ovs_srcdir/vswitchd/vswitch.ovsschema"
at_fn_check_prepare_dynamic "ovsdb-tool create vswitchd.db $ovs_srcdir/vswitchd/vswitch.ovsschema" "ovn-controller-vtep.at:243"
( $at_check_trace; ovsdb-tool create vswitchd.db $ovs_srcdir/vswitchd/vswitch.ovsschema
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:243"
$at_failed && at_fn_log_failure
$at_traceon; }

   for daemon in ovn-nb ovn-sb; do
      { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:243: ovsdb-tool create \$daemon.db \$abs_top_srcdir/\${daemon}.ovsschema"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "ovn-controller-vtep.at:243"
( $at_check_trace; ovsdb-tool create $daemon.db $abs_top_srcdir/${daemon}.ovsschema
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:243"
$at_failed && at_fn_log_failure
$at_traceon; }

   done
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:243: ovsdb-tool create vtep.db \$ovs_srcdir/vtep/vtep.ovsschema"
at_fn_check_prepare_dynamic "ovsdb-tool create vtep.db $ovs_srcdir/vtep/vtep.ovsschema" "ovn-controller-vtep.at:243"
( $at_check_trace; ovsdb-tool create vtep.db $ovs_srcdir/vtep/vtep.ovsschema
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:243"
$at_failed && at_fn_log_failure
$at_traceon; }


      { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:243: ovsdb-server --detach --no-chdir --pidfile --log-file --remote=punix:\$OVS_RUNDIR/db.sock vswitchd.db vtep.db"
at_fn_check_prepare_dynamic "ovsdb-server --detach --no-chdir --pidfile --log-file --remote=punix:$OVS_RUNDIR/db.sock vswitchd.db vtep.db" "ovn-controller-vtep.at:243"
( $at_check_trace; ovsdb-server --detach --no-chdir --pidfile --log-file --remote=punix:$OVS_RUNDIR/db.sock vswitchd.db vtep.db
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:243"
$at_failed && at_fn_log_failure
$at_traceon; }

   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:243: ovsdb-server --detach --no-chdir --pidfile=ovsdb-nb-server.pid --log-file=ovsdb-nb-server.log --remote=punix:\$OVS_RUNDIR/ovnnb_db.sock ovn-nb.db"
at_fn_check_prepare_dynamic "ovsdb-server --detach --no-chdir --pidfile=ovsdb-nb-server.pid --log-file=ovsdb-nb-server.log --remote=punix:$OVS_RUNDIR/ovnnb_db.sock ovn-nb.db" "ovn-controller-vtep.at:243"
( $at_check_trace; ovsdb-server --detach --no-chdir --pidfile=ovsdb-nb-server.pid --log-file=ovsdb-nb-server.log --remote=punix:$OVS_RUNDIR/ovnnb_db.sock ovn-nb.db
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:243"
$at_failed && at_fn_log_failure
$at_traceon; }

   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:243: ovsdb-server --detach --no-chdir --pidfile=ovsdb-sb-server.pid --log-file=ovsdb-sb-server.log --remote=punix:\$OVS_RUNDIR/ovnsb_db.sock ovn-sb.db ovn-sb.db"
at_fn_check_prepare_dynamic "ovsdb-server --detach --no-chdir --pidfile=ovsdb-sb-server.pid --log-file=ovsdb-sb-server.log --remote=punix:$OVS_RUNDIR/ovnsb_db.sock ovn-sb.db ovn-sb.db" "ovn-controller-vtep.at:243"
( $at_check_trace; ovsdb-server --detach --no-chdir --pidfile=ovsdb-sb-server.pid --log-file=ovsdb-sb-server.log --remote=punix:$OVS_RUNDIR/ovnsb_db.sock ovn-sb.db ovn-sb.db
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:243"
$at_failed && at_fn_log_failure
$at_traceon; }

   on_exit "kill `cat ovsdb-server.pid` `cat ovsdb-nb-server.pid` `cat ovsdb-sb-server.pid`"
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:243: sed < stderr '
/vlog|INFO|opened log file/d
/ovsdb_server|INFO|ovsdb-server (Open vSwitch)/d'"
at_fn_check_prepare_notrace 'an embedded newline' "ovn-controller-vtep.at:243"
( $at_check_trace; sed < stderr '
/vlog|INFO|opened log file/d
/ovsdb_server|INFO|ovsdb-server (Open vSwitch)/d'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:243"
$at_failed && at_fn_log_failure
$at_traceon; }



      { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:243: ovs-vswitchd --enable-dummy=system --disable-system --detach --no-chdir --pidfile --log-file -vvconn -vofproto_dpif"
at_fn_check_prepare_trace "ovn-controller-vtep.at:243"
( $at_check_trace; ovs-vswitchd --enable-dummy=system --disable-system --detach --no-chdir --pidfile --log-file -vvconn -vofproto_dpif
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:243"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


   on_exit "kill `cat ovs-vswitchd.pid`"
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:243: sed < stderr '
/ovs_numa|INFO|Discovered /d
/vlog|INFO|opened log file/d
/vswitchd|INFO|ovs-vswitchd (Open vSwitch)/d
/reconnect|INFO|/d
/ofproto|INFO|using datapath ID/d
/netlink_socket|INFO|netlink: could not enable listening to all nsid/d
/ofproto|INFO|datapath ID changed to fedcba9876543210/d'"
at_fn_check_prepare_notrace 'an embedded newline' "ovn-controller-vtep.at:243"
( $at_check_trace; sed < stderr '
/ovs_numa|INFO|Discovered /d
/vlog|INFO|opened log file/d
/vswitchd|INFO|ovs-vswitchd (Open vSwitch)/d
/reconnect|INFO|/d
/ofproto|INFO|using datapath ID/d
/netlink_socket|INFO|netlink: could not enable listening to all nsid/d
/ofproto|INFO|datapath ID changed to fedcba9876543210/d'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:243"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log"
$at_traceon; }

   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:243: ovs-vsctl -- add-br br-vtep \\
              -- set bridge br-vtep datapath-type=dummy other-config:datapath-id=fedcba9876543210 other-config:hwaddr=aa:55:aa:55:00:00 protocols=[OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13,OpenFlow14,OpenFlow15] fail-mode=secure \\
              -- add-port br-vtep p0 -- set Interface p0 type=dummy ofport_request=1 \\
              -- add-port br-vtep p1 -- set Interface p1 type=dummy ofport_request=2"
at_fn_check_prepare_notrace 'an embedded newline' "ovn-controller-vtep.at:243"
( $at_check_trace; ovs-vsctl -- add-br br-vtep \
              -- set bridge br-vtep datapath-type=dummy other-config:datapath-id=fedcba9876543210 other-config:hwaddr=aa:55:aa:55:00:00 protocols=[OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13,OpenFlow14,OpenFlow15] fail-mode=secure \
              -- add-port br-vtep p0 -- set Interface p0 type=dummy ofport_request=1 \
              -- add-port br-vtep p1 -- set Interface p1 type=dummy ofport_request=2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:243"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log"
$at_traceon; }


      { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:243: vtep-ctl add-ps br-vtep -- set Physical_Switch br-vtep tunnel_ips=1.2.3.4"
at_fn_check_prepare_trace "ovn-controller-vtep.at:243"
( $at_check_trace; vtep-ctl add-ps br-vtep -- set Physical_Switch br-vtep tunnel_ips=1.2.3.4
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:243"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log"
$at_traceon; }

   PYTHONPATH=$PYTHONPATH:$ovs_srcdir/python
   export $PYTHONPATH
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:243: ovs-vtep --log-file=ovs-vtep.log --pidfile=ovs-vtep.pid --detach --no-chdir br-vtep \\"
at_fn_check_prepare_trace "ovn-controller-vtep.at:243"
( $at_check_trace; ovs-vtep --log-file=ovs-vtep.log --pidfile=ovs-vtep.pid --detach --no-chdir br-vtep \
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:243"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log"
$at_traceon; }

   on_exit "kill `cat ovs-vtep.pid`"
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:243: sed < stderr '
/vlog|INFO|opened log file/d'"
at_fn_check_prepare_notrace 'an embedded newline' "ovn-controller-vtep.at:243"
( $at_check_trace; sed < stderr '
/vlog|INFO|opened log file/d'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:243"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log"
$at_traceon; }

   # waits until ovs-vtep starts up.
   ovs_wait_cond () {
    test -n "`vtep-ctl show | grep Physical_Port`"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:243" "until test -n \"\`vtep-ctl show | grep Physical_Port\`\""


      { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:243: ovn-nbctl ls-add br-test"
at_fn_check_prepare_trace "ovn-controller-vtep.at:243"
( $at_check_trace; ovn-nbctl ls-add br-test
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:243"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log"
$at_traceon; }

   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:243: ovn-northd --detach --no-chdir --pidfile --log-file"
at_fn_check_prepare_trace "ovn-controller-vtep.at:243"
( $at_check_trace; ovn-northd --detach --no-chdir --pidfile --log-file
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:243"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log"
$at_traceon; }

   on_exit "kill `cat ovn-northd.pid`"
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:243: sed < stderr '
/vlog|INFO|opened log file/d'"
at_fn_check_prepare_notrace 'an embedded newline' "ovn-controller-vtep.at:243"
( $at_check_trace; sed < stderr '
/vlog|INFO|opened log file/d'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:243"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log"
$at_traceon; }



      { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:243: ovn-controller-vtep --detach --no-chdir --pidfile --log-file --vtep-db=unix:\$OVS_RUNDIR/db.sock --ovnsb-db=unix:\$OVS_RUNDIR/ovnsb_db.sock"
at_fn_check_prepare_dynamic "ovn-controller-vtep --detach --no-chdir --pidfile --log-file --vtep-db=unix:$OVS_RUNDIR/db.sock --ovnsb-db=unix:$OVS_RUNDIR/ovnsb_db.sock" "ovn-controller-vtep.at:243"
( $at_check_trace; ovn-controller-vtep --detach --no-chdir --pidfile --log-file --vtep-db=unix:$OVS_RUNDIR/db.sock --ovnsb-db=unix:$OVS_RUNDIR/ovnsb_db.sock
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:243"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log"
$at_traceon; }


   on_exit "kill `cat ovn-controller-vtep.pid`"
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:243: sed < stderr '
/vlog|INFO|opened log file/d
/reconnect|INFO|/d'"
at_fn_check_prepare_notrace 'an embedded newline' "ovn-controller-vtep.at:243"
( $at_check_trace; sed < stderr '
/vlog|INFO|opened log file/d
/reconnect|INFO|/d'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:243"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }



# adds logical switch 'lswitch0' and vlan_bindings.
{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:246: vtep-ctl add-ls lswitch0 -- bind-ls br-vtep p0 100 lswitch0"
at_fn_check_prepare_trace "ovn-controller-vtep.at:246"
( $at_check_trace; vtep-ctl add-ls lswitch0 -- bind-ls br-vtep p0 100 lswitch0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:246"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

# adds logical switch port in ovn-nb database, and sets the type and options.

{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:248: ovn-nbctl lsp-add br-test br-vtep_lswitch0"
at_fn_check_prepare_trace "ovn-controller-vtep.at:248"
( $at_check_trace; ovn-nbctl lsp-add br-test br-vtep_lswitch0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:248"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:248: ovn-nbctl lsp-set-type br-vtep_lswitch0 vtep"
at_fn_check_prepare_trace "ovn-controller-vtep.at:248"
( $at_check_trace; ovn-nbctl lsp-set-type br-vtep_lswitch0 vtep
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:248"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:248: ovn-nbctl lsp-set-options br-vtep_lswitch0 vtep-physical-switch=br-vtep vtep-logical-switch=lswitch0"
at_fn_check_prepare_trace "ovn-controller-vtep.at:248"
( $at_check_trace; ovn-nbctl lsp-set-options br-vtep_lswitch0 vtep-physical-switch=br-vtep vtep-logical-switch=lswitch0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:248"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }


ovn-sbctl --timeout=10 wait-until Port_Binding br-vtep_lswitch0 chassis!='[]'

# adds another lswitch 'br-void' in ovn-nb database.
{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:252: ovn-nbctl ls-add br-void"
at_fn_check_prepare_trace "ovn-controller-vtep.at:252"
( $at_check_trace; ovn-nbctl ls-add br-void
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:252"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

# adds another vtep pswitch 'br-vtep-void' in vtep database.
{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:254: vtep-ctl add-ps br-vtep-void -- add-port br-vtep-void p0-void -- bind-ls br-vtep-void p0-void 100 lswitch0"
at_fn_check_prepare_trace "ovn-controller-vtep.at:254"
( $at_check_trace; vtep-ctl add-ps br-vtep-void -- add-port br-vtep-void p0-void -- bind-ls br-vtep-void p0-void 100 lswitch0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:254"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

# adds a conflicting logical port (both br-vtep_lswitch0 and br-vtep-void_lswitch0
# are bound to the same logical switch, but they are on different datapath).

{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:257: ovn-nbctl lsp-add br-void br-vtep-void_lswitch0"
at_fn_check_prepare_trace "ovn-controller-vtep.at:257"
( $at_check_trace; ovn-nbctl lsp-add br-void br-vtep-void_lswitch0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:257"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:257: ovn-nbctl lsp-set-type br-vtep-void_lswitch0 vtep"
at_fn_check_prepare_trace "ovn-controller-vtep.at:257"
( $at_check_trace; ovn-nbctl lsp-set-type br-vtep-void_lswitch0 vtep
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:257"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:257: ovn-nbctl lsp-set-options br-vtep-void_lswitch0 vtep-physical-switch=br-vtep-void vtep-logical-switch=lswitch0"
at_fn_check_prepare_trace "ovn-controller-vtep.at:257"
( $at_check_trace; ovn-nbctl lsp-set-options br-vtep-void_lswitch0 vtep-physical-switch=br-vtep-void vtep-logical-switch=lswitch0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:257"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }


ovn-sbctl --timeout=10 wait-until Port_Binding br-vtep_lswitch0
ovs_wait_cond () {
    test -n "`grep WARN ovn-controller-vtep.log`"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:259" "until test -n \"\`grep WARN ovn-controller-vtep.log\`\""

# confirms the warning log.
{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:261: sed -n 's/^.*\\(|WARN|.*\\)\$/\\1/p' ovn-controller-vtep.log | sed 's/([-_0-9a-z][-_0-9a-z]*)/()/g;s/(with tunnel key [0-9][0-9]*)/()/g' | uniq"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-controller-vtep.at:261"
( $at_check_trace; sed -n 's/^.*\(|WARN|.*\)$/\1/p' ovn-controller-vtep.log | sed 's/([-_0-9a-z][-_0-9a-z]*)/()/g;s/(with tunnel key [0-9][0-9]*)/()/g' | uniq
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "|WARN|logical switch (), on vtep gateway chassis () has already been associated with logical datapath (), ignore logical port () which belongs to logical datapath ()
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:261"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }


# then deletes 'br-void' and 'br-vtep-void', should see 'br-vtep_lswitch0'
# bound correctly.
{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:267: ovn-nbctl ls-del br-void"
at_fn_check_prepare_trace "ovn-controller-vtep.at:267"
( $at_check_trace; ovn-nbctl ls-del br-void
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:267"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

# adds another vtep pswitch 'br-vtep-void' in vtep database.
{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:269: vtep-ctl del-ps br-vtep-void"
at_fn_check_prepare_trace "ovn-controller-vtep.at:269"
( $at_check_trace; vtep-ctl del-ps br-vtep-void
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:269"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

ovs_wait_cond () {
    test -z "`ovn-sbctl list Port_Binding | grep br-vtep-void_lswitch0`"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:270" "until test -z \"\`ovn-sbctl list Port_Binding | grep br-vtep-void_lswitch0\`\""

chassis_uuid=$(ovn-sbctl --columns=_uuid list Chassis br-vtep | cut -d ':' -f2 | tr -d ' ')
{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:272: ovn-sbctl --columns=chassis list Port_Binding br-vtep_lswitch0 | cut -d ':' -f2 | tr -d ' '"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-controller-vtep.at:272"
( $at_check_trace; ovn-sbctl --columns=chassis list Port_Binding br-vtep_lswitch0 | cut -d ':' -f2 | tr -d ' '
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "${chassis_uuid}
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:272"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:276: check_logs \"/has already been associated with logical datapath/d\""
at_fn_check_prepare_trace "ovn-controller-vtep.at:276"
( $at_check_trace; check_logs "/has already been associated with logical datapath/d"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:276"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:276: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn-controller-vtep.at:276"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:276"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:276: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn-controller-vtep.at:276"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:276"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:276" "while kill -0 \$TMPPID 2>/dev/null"

   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:276: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn-controller-vtep.at:276"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:276"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:276: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn-controller-vtep.at:276"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:276"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:276" "while kill -0 \$TMPPID 2>/dev/null"

   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:276: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn-controller-vtep.at:276"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:276"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:276: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn-controller-vtep.at:276"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:276"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:276" "while kill -0 \$TMPPID 2>/dev/null"

   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:276: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-controller-vtep.at:276"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:276"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:276: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-controller-vtep.at:276"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:276"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:276" "while kill -0 \$TMPPID 2>/dev/null"

   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:276: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn-controller-vtep.at:276"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:276"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:276: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn-controller-vtep.at:276"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:276"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:276" "while kill -0 \$TMPPID 2>/dev/null"

ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_213
#AT_START_214
at_fn_group_banner 214 'ovn-controller-vtep.at:281' \
  "ovn-controller-vtep - vtep-lswitch" "             " 9
at_xfail=no
(
  $as_echo "214. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init



   # this will cause skip when 'make check' using Windows setup.

      { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:282: ovsdb-tool create vswitchd.db \$ovs_srcdir/vswitchd/vswitch.ovsschema"
at_fn_check_prepare_dynamic "ovsdb-tool create vswitchd.db $ovs_srcdir/vswitchd/vswitch.ovsschema" "ovn-controller-vtep.at:282"
( $at_check_trace; ovsdb-tool create vswitchd.db $ovs_srcdir/vswitchd/vswitch.ovsschema
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:282"
$at_failed && at_fn_log_failure
$at_traceon; }

   for daemon in ovn-nb ovn-sb; do
      { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:282: ovsdb-tool create \$daemon.db \$abs_top_srcdir/\${daemon}.ovsschema"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "ovn-controller-vtep.at:282"
( $at_check_trace; ovsdb-tool create $daemon.db $abs_top_srcdir/${daemon}.ovsschema
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:282"
$at_failed && at_fn_log_failure
$at_traceon; }

   done
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:282: ovsdb-tool create vtep.db \$ovs_srcdir/vtep/vtep.ovsschema"
at_fn_check_prepare_dynamic "ovsdb-tool create vtep.db $ovs_srcdir/vtep/vtep.ovsschema" "ovn-controller-vtep.at:282"
( $at_check_trace; ovsdb-tool create vtep.db $ovs_srcdir/vtep/vtep.ovsschema
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:282"
$at_failed && at_fn_log_failure
$at_traceon; }


      { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:282: ovsdb-server --detach --no-chdir --pidfile --log-file --remote=punix:\$OVS_RUNDIR/db.sock vswitchd.db vtep.db"
at_fn_check_prepare_dynamic "ovsdb-server --detach --no-chdir --pidfile --log-file --remote=punix:$OVS_RUNDIR/db.sock vswitchd.db vtep.db" "ovn-controller-vtep.at:282"
( $at_check_trace; ovsdb-server --detach --no-chdir --pidfile --log-file --remote=punix:$OVS_RUNDIR/db.sock vswitchd.db vtep.db
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:282"
$at_failed && at_fn_log_failure
$at_traceon; }

   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:282: ovsdb-server --detach --no-chdir --pidfile=ovsdb-nb-server.pid --log-file=ovsdb-nb-server.log --remote=punix:\$OVS_RUNDIR/ovnnb_db.sock ovn-nb.db"
at_fn_check_prepare_dynamic "ovsdb-server --detach --no-chdir --pidfile=ovsdb-nb-server.pid --log-file=ovsdb-nb-server.log --remote=punix:$OVS_RUNDIR/ovnnb_db.sock ovn-nb.db" "ovn-controller-vtep.at:282"
( $at_check_trace; ovsdb-server --detach --no-chdir --pidfile=ovsdb-nb-server.pid --log-file=ovsdb-nb-server.log --remote=punix:$OVS_RUNDIR/ovnnb_db.sock ovn-nb.db
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:282"
$at_failed && at_fn_log_failure
$at_traceon; }

   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:282: ovsdb-server --detach --no-chdir --pidfile=ovsdb-sb-server.pid --log-file=ovsdb-sb-server.log --remote=punix:\$OVS_RUNDIR/ovnsb_db.sock ovn-sb.db ovn-sb.db"
at_fn_check_prepare_dynamic "ovsdb-server --detach --no-chdir --pidfile=ovsdb-sb-server.pid --log-file=ovsdb-sb-server.log --remote=punix:$OVS_RUNDIR/ovnsb_db.sock ovn-sb.db ovn-sb.db" "ovn-controller-vtep.at:282"
( $at_check_trace; ovsdb-server --detach --no-chdir --pidfile=ovsdb-sb-server.pid --log-file=ovsdb-sb-server.log --remote=punix:$OVS_RUNDIR/ovnsb_db.sock ovn-sb.db ovn-sb.db
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:282"
$at_failed && at_fn_log_failure
$at_traceon; }

   on_exit "kill `cat ovsdb-server.pid` `cat ovsdb-nb-server.pid` `cat ovsdb-sb-server.pid`"
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:282: sed < stderr '
/vlog|INFO|opened log file/d
/ovsdb_server|INFO|ovsdb-server (Open vSwitch)/d'"
at_fn_check_prepare_notrace 'an embedded newline' "ovn-controller-vtep.at:282"
( $at_check_trace; sed < stderr '
/vlog|INFO|opened log file/d
/ovsdb_server|INFO|ovsdb-server (Open vSwitch)/d'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:282"
$at_failed && at_fn_log_failure
$at_traceon; }



      { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:282: ovs-vswitchd --enable-dummy=system --disable-system --detach --no-chdir --pidfile --log-file -vvconn -vofproto_dpif"
at_fn_check_prepare_trace "ovn-controller-vtep.at:282"
( $at_check_trace; ovs-vswitchd --enable-dummy=system --disable-system --detach --no-chdir --pidfile --log-file -vvconn -vofproto_dpif
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:282"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


   on_exit "kill `cat ovs-vswitchd.pid`"
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:282: sed < stderr '
/ovs_numa|INFO|Discovered /d
/vlog|INFO|opened log file/d
/vswitchd|INFO|ovs-vswitchd (Open vSwitch)/d
/reconnect|INFO|/d
/ofproto|INFO|using datapath ID/d
/netlink_socket|INFO|netlink: could not enable listening to all nsid/d
/ofproto|INFO|datapath ID changed to fedcba9876543210/d'"
at_fn_check_prepare_notrace 'an embedded newline' "ovn-controller-vtep.at:282"
( $at_check_trace; sed < stderr '
/ovs_numa|INFO|Discovered /d
/vlog|INFO|opened log file/d
/vswitchd|INFO|ovs-vswitchd (Open vSwitch)/d
/reconnect|INFO|/d
/ofproto|INFO|using datapath ID/d
/netlink_socket|INFO|netlink: could not enable listening to all nsid/d
/ofproto|INFO|datapath ID changed to fedcba9876543210/d'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:282"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log"
$at_traceon; }

   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:282: ovs-vsctl -- add-br br-vtep \\
              -- set bridge br-vtep datapath-type=dummy other-config:datapath-id=fedcba9876543210 other-config:hwaddr=aa:55:aa:55:00:00 protocols=[OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13,OpenFlow14,OpenFlow15] fail-mode=secure \\
              -- add-port br-vtep p0 -- set Interface p0 type=dummy ofport_request=1 \\
              -- add-port br-vtep p1 -- set Interface p1 type=dummy ofport_request=2"
at_fn_check_prepare_notrace 'an embedded newline' "ovn-controller-vtep.at:282"
( $at_check_trace; ovs-vsctl -- add-br br-vtep \
              -- set bridge br-vtep datapath-type=dummy other-config:datapath-id=fedcba9876543210 other-config:hwaddr=aa:55:aa:55:00:00 protocols=[OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13,OpenFlow14,OpenFlow15] fail-mode=secure \
              -- add-port br-vtep p0 -- set Interface p0 type=dummy ofport_request=1 \
              -- add-port br-vtep p1 -- set Interface p1 type=dummy ofport_request=2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:282"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log"
$at_traceon; }


      { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:282: vtep-ctl add-ps br-vtep -- set Physical_Switch br-vtep tunnel_ips=1.2.3.4"
at_fn_check_prepare_trace "ovn-controller-vtep.at:282"
( $at_check_trace; vtep-ctl add-ps br-vtep -- set Physical_Switch br-vtep tunnel_ips=1.2.3.4
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:282"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log"
$at_traceon; }

   PYTHONPATH=$PYTHONPATH:$ovs_srcdir/python
   export $PYTHONPATH
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:282: ovs-vtep --log-file=ovs-vtep.log --pidfile=ovs-vtep.pid --detach --no-chdir br-vtep \\"
at_fn_check_prepare_trace "ovn-controller-vtep.at:282"
( $at_check_trace; ovs-vtep --log-file=ovs-vtep.log --pidfile=ovs-vtep.pid --detach --no-chdir br-vtep \
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:282"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log"
$at_traceon; }

   on_exit "kill `cat ovs-vtep.pid`"
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:282: sed < stderr '
/vlog|INFO|opened log file/d'"
at_fn_check_prepare_notrace 'an embedded newline' "ovn-controller-vtep.at:282"
( $at_check_trace; sed < stderr '
/vlog|INFO|opened log file/d'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:282"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log"
$at_traceon; }

   # waits until ovs-vtep starts up.
   ovs_wait_cond () {
    test -n "`vtep-ctl show | grep Physical_Port`"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:282" "until test -n \"\`vtep-ctl show | grep Physical_Port\`\""


      { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:282: ovn-nbctl ls-add br-test"
at_fn_check_prepare_trace "ovn-controller-vtep.at:282"
( $at_check_trace; ovn-nbctl ls-add br-test
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:282"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log"
$at_traceon; }

   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:282: ovn-northd --detach --no-chdir --pidfile --log-file"
at_fn_check_prepare_trace "ovn-controller-vtep.at:282"
( $at_check_trace; ovn-northd --detach --no-chdir --pidfile --log-file
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:282"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log"
$at_traceon; }

   on_exit "kill `cat ovn-northd.pid`"
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:282: sed < stderr '
/vlog|INFO|opened log file/d'"
at_fn_check_prepare_notrace 'an embedded newline' "ovn-controller-vtep.at:282"
( $at_check_trace; sed < stderr '
/vlog|INFO|opened log file/d'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:282"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log"
$at_traceon; }



      { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:282: ovn-controller-vtep --detach --no-chdir --pidfile --log-file --vtep-db=unix:\$OVS_RUNDIR/db.sock --ovnsb-db=unix:\$OVS_RUNDIR/ovnsb_db.sock"
at_fn_check_prepare_dynamic "ovn-controller-vtep --detach --no-chdir --pidfile --log-file --vtep-db=unix:$OVS_RUNDIR/db.sock --ovnsb-db=unix:$OVS_RUNDIR/ovnsb_db.sock" "ovn-controller-vtep.at:282"
( $at_check_trace; ovn-controller-vtep --detach --no-chdir --pidfile --log-file --vtep-db=unix:$OVS_RUNDIR/db.sock --ovnsb-db=unix:$OVS_RUNDIR/ovnsb_db.sock
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:282"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log"
$at_traceon; }


   on_exit "kill `cat ovn-controller-vtep.pid`"
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:282: sed < stderr '
/vlog|INFO|opened log file/d
/reconnect|INFO|/d'"
at_fn_check_prepare_notrace 'an embedded newline' "ovn-controller-vtep.at:282"
( $at_check_trace; sed < stderr '
/vlog|INFO|opened log file/d
/reconnect|INFO|/d'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:282"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }



# creates the logical switch in vtep and adds the corresponding logical
# port to 'br-test'.
{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:286: vtep-ctl add-ls lswitch0 -- bind-ls br-vtep p0 100 lswitch0"
at_fn_check_prepare_trace "ovn-controller-vtep.at:286"
( $at_check_trace; vtep-ctl add-ls lswitch0 -- bind-ls br-vtep p0 100 lswitch0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:286"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:287: ovn-nbctl lsp-add br-test br-vtep_lswitch0"
at_fn_check_prepare_trace "ovn-controller-vtep.at:287"
( $at_check_trace; ovn-nbctl lsp-add br-test br-vtep_lswitch0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:287"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:287: ovn-nbctl lsp-set-type br-vtep_lswitch0 vtep"
at_fn_check_prepare_trace "ovn-controller-vtep.at:287"
( $at_check_trace; ovn-nbctl lsp-set-type br-vtep_lswitch0 vtep
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:287"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:287: ovn-nbctl lsp-set-options br-vtep_lswitch0 vtep-physical-switch=br-vtep vtep-logical-switch=lswitch0"
at_fn_check_prepare_trace "ovn-controller-vtep.at:287"
( $at_check_trace; ovn-nbctl lsp-set-options br-vtep_lswitch0 vtep-physical-switch=br-vtep vtep-logical-switch=lswitch0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:287"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }


ovs_wait_cond () {
    test -n "`ovn-sbctl list Port_Binding  | grep -- br-vtep_lswitch0`"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:288" "until test -n \"\`ovn-sbctl list Port_Binding  | grep -- br-vtep_lswitch0\`\""


# retrieves the expected tunnel key.
datapath_uuid=$(ovn-sbctl --columns=datapath list Port_Binding br-vtep_lswitch0 | cut -d ':' -f2 | tr -d ' ')
tunnel_key=$(ovn-sbctl --columns=tunnel_key list Datapath_Binding ${datapath_uuid} | cut -d ':' -f2 | tr -d ' ')
ovs_wait_cond () {
    test -z "`vtep-ctl --columns=tunnel_key list Logical_Switch | grep 0`"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:293" "until test -z \"\`vtep-ctl --columns=tunnel_key list Logical_Switch | grep 0\`\""

# checks the vtep logical switch tunnel key configuration.
{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:295: vtep-ctl --columns=tunnel_key list Logical_Switch | cut -d ':' -f2 | tr -d ' '"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-controller-vtep.at:295"
( $at_check_trace; vtep-ctl --columns=tunnel_key list Logical_Switch | cut -d ':' -f2 | tr -d ' '
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "${tunnel_key}
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:295"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }


# creates a second physical switch in vtep database, and binds its p0 vlan-100
# to the same logical switch 'lswitch0'.
{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:301: vtep-ctl add-ps br-vtep-void -- add-port br-vtep-void p0 -- bind-ls br-vtep-void p0 100 lswitch0"
at_fn_check_prepare_trace "ovn-controller-vtep.at:301"
( $at_check_trace; vtep-ctl add-ps br-vtep-void -- add-port br-vtep-void p0 -- bind-ls br-vtep-void p0 100 lswitch0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:301"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

ovs_wait_cond () {
    test -n "`ovn-sbctl --columns=name list Chassis  | grep -- br-vtep-void`"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:302" "until test -n \"\`ovn-sbctl --columns=name list Chassis  | grep -- br-vtep-void\`\""


{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:303: ovn-nbctl lsp-add br-test br-vtep-void_lswitch0"
at_fn_check_prepare_trace "ovn-controller-vtep.at:303"
( $at_check_trace; ovn-nbctl lsp-add br-test br-vtep-void_lswitch0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:303"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:303: ovn-nbctl lsp-set-type br-vtep-void_lswitch0 vtep"
at_fn_check_prepare_trace "ovn-controller-vtep.at:303"
( $at_check_trace; ovn-nbctl lsp-set-type br-vtep-void_lswitch0 vtep
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:303"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:303: ovn-nbctl lsp-set-options br-vtep-void_lswitch0 vtep-physical-switch=br-vtep-void vtep-logical-switch=lswitch0"
at_fn_check_prepare_trace "ovn-controller-vtep.at:303"
( $at_check_trace; ovn-nbctl lsp-set-options br-vtep-void_lswitch0 vtep-physical-switch=br-vtep-void vtep-logical-switch=lswitch0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:303"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }


ovs_wait_cond () {
    test -n "`ovn-sbctl list Port_Binding  | grep -- br-vtep-void_lswitch0`"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:304" "until test -n \"\`ovn-sbctl list Port_Binding  | grep -- br-vtep-void_lswitch0\`\""


# checks the vtep logical switch tunnel key configuration.
{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:307: vtep-ctl --columns=tunnel_key list Logical_Switch | cut -d ':' -f2 | tr -d ' '"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-controller-vtep.at:307"
( $at_check_trace; vtep-ctl --columns=tunnel_key list Logical_Switch | cut -d ':' -f2 | tr -d ' '
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "${tunnel_key}
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:307"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }


# now, deletes br-vtep-void.
{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:312: vtep-ctl del-ps br-vtep-void"
at_fn_check_prepare_trace "ovn-controller-vtep.at:312"
( $at_check_trace; vtep-ctl del-ps br-vtep-void
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:312"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

ovs_wait_cond () {
    test -z "`ovn-sbctl --columns=name list Chassis  | grep -- br-vtep-void`"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:313" "until test -z \"\`ovn-sbctl --columns=name list Chassis  | grep -- br-vtep-void\`\""

# checks the vtep logical switch tunnel key configuration.
{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:315: vtep-ctl --columns=tunnel_key list Logical_Switch | cut -d ':' -f2 | tr -d ' '"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-controller-vtep.at:315"
( $at_check_trace; vtep-ctl --columns=tunnel_key list Logical_Switch | cut -d ':' -f2 | tr -d ' '
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "${tunnel_key}
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:315"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }


# changes the ovn-nb logical port type so that it is no longer
# vtep port.
{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:321: ovn-nbctl lsp-set-type br-vtep_lswitch0 \"\""
at_fn_check_prepare_trace "ovn-controller-vtep.at:321"
( $at_check_trace; ovn-nbctl lsp-set-type br-vtep_lswitch0 ""
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:321"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

ovs_wait_cond () {
    test -z "`vtep-ctl --columns=tunnel_key list Logical_Switch | grep 1`"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:322" "until test -z \"\`vtep-ctl --columns=tunnel_key list Logical_Switch | grep 1\`\""

# now should see the tunnel key reset.
{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:324: vtep-ctl --columns=tunnel_key list Logical_Switch | cut -d ':' -f2 | tr -d ' '"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-controller-vtep.at:324"
( $at_check_trace; vtep-ctl --columns=tunnel_key list Logical_Switch | cut -d ':' -f2 | tr -d ' '
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "0
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:324"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:328: check_logs \"\""
at_fn_check_prepare_trace "ovn-controller-vtep.at:328"
( $at_check_trace; check_logs ""
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:328: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn-controller-vtep.at:328"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:328: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn-controller-vtep.at:328"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:328" "while kill -0 \$TMPPID 2>/dev/null"

   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:328: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn-controller-vtep.at:328"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:328: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn-controller-vtep.at:328"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:328" "while kill -0 \$TMPPID 2>/dev/null"

   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:328: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn-controller-vtep.at:328"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:328: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn-controller-vtep.at:328"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:328" "while kill -0 \$TMPPID 2>/dev/null"

   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:328: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-controller-vtep.at:328"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:328: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-controller-vtep.at:328"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:328" "while kill -0 \$TMPPID 2>/dev/null"

   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:328: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn-controller-vtep.at:328"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:328: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn-controller-vtep.at:328"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:328"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:328" "while kill -0 \$TMPPID 2>/dev/null"

ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_214
#AT_START_215
at_fn_group_banner 215 'ovn-controller-vtep.at:333' \
  "ovn-controller-vtep - vtep-macs 1" "              " 9
at_xfail=no
(
  $as_echo "215. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init



   # this will cause skip when 'make check' using Windows setup.

      { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:334: ovsdb-tool create vswitchd.db \$ovs_srcdir/vswitchd/vswitch.ovsschema"
at_fn_check_prepare_dynamic "ovsdb-tool create vswitchd.db $ovs_srcdir/vswitchd/vswitch.ovsschema" "ovn-controller-vtep.at:334"
( $at_check_trace; ovsdb-tool create vswitchd.db $ovs_srcdir/vswitchd/vswitch.ovsschema
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:334"
$at_failed && at_fn_log_failure
$at_traceon; }

   for daemon in ovn-nb ovn-sb; do
      { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:334: ovsdb-tool create \$daemon.db \$abs_top_srcdir/\${daemon}.ovsschema"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "ovn-controller-vtep.at:334"
( $at_check_trace; ovsdb-tool create $daemon.db $abs_top_srcdir/${daemon}.ovsschema
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:334"
$at_failed && at_fn_log_failure
$at_traceon; }

   done
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:334: ovsdb-tool create vtep.db \$ovs_srcdir/vtep/vtep.ovsschema"
at_fn_check_prepare_dynamic "ovsdb-tool create vtep.db $ovs_srcdir/vtep/vtep.ovsschema" "ovn-controller-vtep.at:334"
( $at_check_trace; ovsdb-tool create vtep.db $ovs_srcdir/vtep/vtep.ovsschema
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:334"
$at_failed && at_fn_log_failure
$at_traceon; }


      { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:334: ovsdb-server --detach --no-chdir --pidfile --log-file --remote=punix:\$OVS_RUNDIR/db.sock vswitchd.db vtep.db"
at_fn_check_prepare_dynamic "ovsdb-server --detach --no-chdir --pidfile --log-file --remote=punix:$OVS_RUNDIR/db.sock vswitchd.db vtep.db" "ovn-controller-vtep.at:334"
( $at_check_trace; ovsdb-server --detach --no-chdir --pidfile --log-file --remote=punix:$OVS_RUNDIR/db.sock vswitchd.db vtep.db
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:334"
$at_failed && at_fn_log_failure
$at_traceon; }

   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:334: ovsdb-server --detach --no-chdir --pidfile=ovsdb-nb-server.pid --log-file=ovsdb-nb-server.log --remote=punix:\$OVS_RUNDIR/ovnnb_db.sock ovn-nb.db"
at_fn_check_prepare_dynamic "ovsdb-server --detach --no-chdir --pidfile=ovsdb-nb-server.pid --log-file=ovsdb-nb-server.log --remote=punix:$OVS_RUNDIR/ovnnb_db.sock ovn-nb.db" "ovn-controller-vtep.at:334"
( $at_check_trace; ovsdb-server --detach --no-chdir --pidfile=ovsdb-nb-server.pid --log-file=ovsdb-nb-server.log --remote=punix:$OVS_RUNDIR/ovnnb_db.sock ovn-nb.db
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:334"
$at_failed && at_fn_log_failure
$at_traceon; }

   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:334: ovsdb-server --detach --no-chdir --pidfile=ovsdb-sb-server.pid --log-file=ovsdb-sb-server.log --remote=punix:\$OVS_RUNDIR/ovnsb_db.sock ovn-sb.db ovn-sb.db"
at_fn_check_prepare_dynamic "ovsdb-server --detach --no-chdir --pidfile=ovsdb-sb-server.pid --log-file=ovsdb-sb-server.log --remote=punix:$OVS_RUNDIR/ovnsb_db.sock ovn-sb.db ovn-sb.db" "ovn-controller-vtep.at:334"
( $at_check_trace; ovsdb-server --detach --no-chdir --pidfile=ovsdb-sb-server.pid --log-file=ovsdb-sb-server.log --remote=punix:$OVS_RUNDIR/ovnsb_db.sock ovn-sb.db ovn-sb.db
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:334"
$at_failed && at_fn_log_failure
$at_traceon; }

   on_exit "kill `cat ovsdb-server.pid` `cat ovsdb-nb-server.pid` `cat ovsdb-sb-server.pid`"
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:334: sed < stderr '
/vlog|INFO|opened log file/d
/ovsdb_server|INFO|ovsdb-server (Open vSwitch)/d'"
at_fn_check_prepare_notrace 'an embedded newline' "ovn-controller-vtep.at:334"
( $at_check_trace; sed < stderr '
/vlog|INFO|opened log file/d
/ovsdb_server|INFO|ovsdb-server (Open vSwitch)/d'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:334"
$at_failed && at_fn_log_failure
$at_traceon; }



      { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:334: ovs-vswitchd --enable-dummy=system --disable-system --detach --no-chdir --pidfile --log-file -vvconn -vofproto_dpif"
at_fn_check_prepare_trace "ovn-controller-vtep.at:334"
( $at_check_trace; ovs-vswitchd --enable-dummy=system --disable-system --detach --no-chdir --pidfile --log-file -vvconn -vofproto_dpif
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:334"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


   on_exit "kill `cat ovs-vswitchd.pid`"
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:334: sed < stderr '
/ovs_numa|INFO|Discovered /d
/vlog|INFO|opened log file/d
/vswitchd|INFO|ovs-vswitchd (Open vSwitch)/d
/reconnect|INFO|/d
/ofproto|INFO|using datapath ID/d
/netlink_socket|INFO|netlink: could not enable listening to all nsid/d
/ofproto|INFO|datapath ID changed to fedcba9876543210/d'"
at_fn_check_prepare_notrace 'an embedded newline' "ovn-controller-vtep.at:334"
( $at_check_trace; sed < stderr '
/ovs_numa|INFO|Discovered /d
/vlog|INFO|opened log file/d
/vswitchd|INFO|ovs-vswitchd (Open vSwitch)/d
/reconnect|INFO|/d
/ofproto|INFO|using datapath ID/d
/netlink_socket|INFO|netlink: could not enable listening to all nsid/d
/ofproto|INFO|datapath ID changed to fedcba9876543210/d'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:334"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log"
$at_traceon; }

   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:334: ovs-vsctl -- add-br br-vtep \\
              -- set bridge br-vtep datapath-type=dummy other-config:datapath-id=fedcba9876543210 other-config:hwaddr=aa:55:aa:55:00:00 protocols=[OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13,OpenFlow14,OpenFlow15] fail-mode=secure \\
              -- add-port br-vtep p0 -- set Interface p0 type=dummy ofport_request=1 \\
              -- add-port br-vtep p1 -- set Interface p1 type=dummy ofport_request=2"
at_fn_check_prepare_notrace 'an embedded newline' "ovn-controller-vtep.at:334"
( $at_check_trace; ovs-vsctl -- add-br br-vtep \
              -- set bridge br-vtep datapath-type=dummy other-config:datapath-id=fedcba9876543210 other-config:hwaddr=aa:55:aa:55:00:00 protocols=[OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13,OpenFlow14,OpenFlow15] fail-mode=secure \
              -- add-port br-vtep p0 -- set Interface p0 type=dummy ofport_request=1 \
              -- add-port br-vtep p1 -- set Interface p1 type=dummy ofport_request=2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:334"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log"
$at_traceon; }


      { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:334: vtep-ctl add-ps br-vtep -- set Physical_Switch br-vtep tunnel_ips=1.2.3.4"
at_fn_check_prepare_trace "ovn-controller-vtep.at:334"
( $at_check_trace; vtep-ctl add-ps br-vtep -- set Physical_Switch br-vtep tunnel_ips=1.2.3.4
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:334"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log"
$at_traceon; }

   PYTHONPATH=$PYTHONPATH:$ovs_srcdir/python
   export $PYTHONPATH
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:334: ovs-vtep --log-file=ovs-vtep.log --pidfile=ovs-vtep.pid --detach --no-chdir br-vtep \\"
at_fn_check_prepare_trace "ovn-controller-vtep.at:334"
( $at_check_trace; ovs-vtep --log-file=ovs-vtep.log --pidfile=ovs-vtep.pid --detach --no-chdir br-vtep \
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:334"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log"
$at_traceon; }

   on_exit "kill `cat ovs-vtep.pid`"
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:334: sed < stderr '
/vlog|INFO|opened log file/d'"
at_fn_check_prepare_notrace 'an embedded newline' "ovn-controller-vtep.at:334"
( $at_check_trace; sed < stderr '
/vlog|INFO|opened log file/d'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:334"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log"
$at_traceon; }

   # waits until ovs-vtep starts up.
   ovs_wait_cond () {
    test -n "`vtep-ctl show | grep Physical_Port`"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:334" "until test -n \"\`vtep-ctl show | grep Physical_Port\`\""


      { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:334: ovn-nbctl ls-add br-test"
at_fn_check_prepare_trace "ovn-controller-vtep.at:334"
( $at_check_trace; ovn-nbctl ls-add br-test
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:334"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log"
$at_traceon; }

   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:334: ovn-northd --detach --no-chdir --pidfile --log-file"
at_fn_check_prepare_trace "ovn-controller-vtep.at:334"
( $at_check_trace; ovn-northd --detach --no-chdir --pidfile --log-file
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:334"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log"
$at_traceon; }

   on_exit "kill `cat ovn-northd.pid`"
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:334: sed < stderr '
/vlog|INFO|opened log file/d'"
at_fn_check_prepare_notrace 'an embedded newline' "ovn-controller-vtep.at:334"
( $at_check_trace; sed < stderr '
/vlog|INFO|opened log file/d'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:334"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log"
$at_traceon; }



      { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:334: ovn-controller-vtep --detach --no-chdir --pidfile --log-file --vtep-db=unix:\$OVS_RUNDIR/db.sock --ovnsb-db=unix:\$OVS_RUNDIR/ovnsb_db.sock"
at_fn_check_prepare_dynamic "ovn-controller-vtep --detach --no-chdir --pidfile --log-file --vtep-db=unix:$OVS_RUNDIR/db.sock --ovnsb-db=unix:$OVS_RUNDIR/ovnsb_db.sock" "ovn-controller-vtep.at:334"
( $at_check_trace; ovn-controller-vtep --detach --no-chdir --pidfile --log-file --vtep-db=unix:$OVS_RUNDIR/db.sock --ovnsb-db=unix:$OVS_RUNDIR/ovnsb_db.sock
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:334"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log"
$at_traceon; }


   on_exit "kill `cat ovn-controller-vtep.pid`"
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:334: sed < stderr '
/vlog|INFO|opened log file/d
/reconnect|INFO|/d'"
at_fn_check_prepare_notrace 'an embedded newline' "ovn-controller-vtep.at:334"
( $at_check_trace; sed < stderr '
/vlog|INFO|opened log file/d
/reconnect|INFO|/d'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:334"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }



# creates a simple logical network with the vtep device and a fake hv chassis
# 'ch0'.
{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:338: ovn-nbctl lsp-add br-test vif0"
at_fn_check_prepare_trace "ovn-controller-vtep.at:338"
( $at_check_trace; ovn-nbctl lsp-add br-test vif0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:338"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:339: ovn-nbctl lsp-set-addresses vif0 f0:ab:cd:ef:01:02"
at_fn_check_prepare_trace "ovn-controller-vtep.at:339"
( $at_check_trace; ovn-nbctl lsp-set-addresses vif0 f0:ab:cd:ef:01:02
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:339"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:340: ovn-nbctl --timeout=10 --wait=sb sync"
at_fn_check_prepare_trace "ovn-controller-vtep.at:340"
( $at_check_trace; ovn-nbctl --timeout=10 --wait=sb sync
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:340"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:341: ovn-sbctl chassis-add ch0 vxlan 1.2.3.5"
at_fn_check_prepare_trace "ovn-controller-vtep.at:341"
( $at_check_trace; ovn-sbctl chassis-add ch0 vxlan 1.2.3.5
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:341"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:342: ovn-sbctl lsp-bind vif0 ch0"
at_fn_check_prepare_trace "ovn-controller-vtep.at:342"
( $at_check_trace; ovn-sbctl lsp-bind vif0 ch0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:342"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }


# creates the logical switch in vtep and adds the corresponding logical
# port to 'br-test'.
{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:346: vtep-ctl add-ls lswitch0 -- bind-ls br-vtep p0 100 lswitch0"
at_fn_check_prepare_trace "ovn-controller-vtep.at:346"
( $at_check_trace; vtep-ctl add-ls lswitch0 -- bind-ls br-vtep p0 100 lswitch0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:346"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:347: ovn-nbctl lsp-add br-test br-vtep_lswitch0"
at_fn_check_prepare_trace "ovn-controller-vtep.at:347"
( $at_check_trace; ovn-nbctl lsp-add br-test br-vtep_lswitch0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:347"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:347: ovn-nbctl lsp-set-type br-vtep_lswitch0 vtep"
at_fn_check_prepare_trace "ovn-controller-vtep.at:347"
( $at_check_trace; ovn-nbctl lsp-set-type br-vtep_lswitch0 vtep
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:347"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:347: ovn-nbctl lsp-set-options br-vtep_lswitch0 vtep-physical-switch=br-vtep vtep-logical-switch=lswitch0"
at_fn_check_prepare_trace "ovn-controller-vtep.at:347"
( $at_check_trace; ovn-nbctl lsp-set-options br-vtep_lswitch0 vtep-physical-switch=br-vtep vtep-logical-switch=lswitch0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:347"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }


ovs_wait_cond () {
    test -n "`ovn-sbctl list Port_Binding  | grep br-vtep_lswitch0`"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:348" "until test -n \"\`ovn-sbctl list Port_Binding  | grep br-vtep_lswitch0\`\""


# adds another lswitch 'br-void' in ovn-nb database.
{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:351: ovn-nbctl ls-add br-void"
at_fn_check_prepare_trace "ovn-controller-vtep.at:351"
( $at_check_trace; ovn-nbctl ls-add br-void
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:351"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

# adds fake hv chassis 'ch1'.
{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:353: ovn-nbctl lsp-add br-void vif1"
at_fn_check_prepare_trace "ovn-controller-vtep.at:353"
( $at_check_trace; ovn-nbctl lsp-add br-void vif1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:353"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:354: ovn-nbctl lsp-set-addresses vif1 f0:ab:cd:ef:01:02"
at_fn_check_prepare_trace "ovn-controller-vtep.at:354"
( $at_check_trace; ovn-nbctl lsp-set-addresses vif1 f0:ab:cd:ef:01:02
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:354"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:355: ovn-nbctl --timeout=10 --wait=sb sync"
at_fn_check_prepare_trace "ovn-controller-vtep.at:355"
( $at_check_trace; ovn-nbctl --timeout=10 --wait=sb sync
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:355"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:356: ovn-sbctl chassis-add ch1 vxlan 1.2.3.6"
at_fn_check_prepare_trace "ovn-controller-vtep.at:356"
( $at_check_trace; ovn-sbctl chassis-add ch1 vxlan 1.2.3.6
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:356"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:357: ovn-sbctl lsp-bind vif1 ch1"
at_fn_check_prepare_trace "ovn-controller-vtep.at:357"
( $at_check_trace; ovn-sbctl lsp-bind vif1 ch1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:357"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }


# checks Ucast_Macs_Remote creation.
ovs_wait_cond () {
    test -n "`vtep-ctl list Ucast_Macs_Remote | grep _uuid`"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:360" "until test -n \"\`vtep-ctl list Ucast_Macs_Remote | grep _uuid\`\""

{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:361: vtep-ctl --columns=MAC list Ucast_Macs_Remote | cut -d ':' -f2- | tr -d ' '"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-controller-vtep.at:361"
( $at_check_trace; vtep-ctl --columns=MAC list Ucast_Macs_Remote | cut -d ':' -f2- | tr -d ' '
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"f0:ab:cd:ef:01:02\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:361"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }


# checks physical locator creation.
ovs_wait_cond () {
    test -n "`vtep-ctl list Physical_Locator | grep _uuid`"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:366" "until test -n \"\`vtep-ctl list Physical_Locator | grep _uuid\`\""

{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:367: vtep-ctl --columns=dst_ip list Physical_Locator | cut -d ':' -f2 | tr -d ' ' | grep -v 1.2.3.4 | sed '/^\$/d'"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-controller-vtep.at:367"
( $at_check_trace; vtep-ctl --columns=dst_ip list Physical_Locator | cut -d ':' -f2 | tr -d ' ' | grep -v 1.2.3.4 | sed '/^$/d'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"1.2.3.5\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:367"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }


# checks tunnel creation by ovs-vtep.
ovs_wait_cond () {
    test -n "`ovs-vsctl list Interface bfd1.2.3.5`"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:372" "until test -n \"\`ovs-vsctl list Interface bfd1.2.3.5\`\""

{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:373: ovs-vsctl --columns=options list Interface bfd1.2.3.5 | cut -d ':' -f2 | tr -d ' '"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-controller-vtep.at:373"
( $at_check_trace; ovs-vsctl --columns=options list Interface bfd1.2.3.5 | cut -d ':' -f2 | tr -d ' '
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "{remote_ip=\"1.2.3.5\"}
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:373"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }


# adds another mac to logical switch port.
{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:378: ovn-nbctl lsp-set-addresses vif0 f0:ab:cd:ef:01:02 f0:ab:cd:ef:01:03"
at_fn_check_prepare_trace "ovn-controller-vtep.at:378"
( $at_check_trace; ovn-nbctl lsp-set-addresses vif0 f0:ab:cd:ef:01:02 f0:ab:cd:ef:01:03
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:378"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

ovs_wait_cond () {
    test -n "`vtep-ctl list Ucast_Macs_Remote | grep 03`"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:379" "until test -n \"\`vtep-ctl list Ucast_Macs_Remote | grep 03\`\""

{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:380: vtep-ctl --columns=MAC list Ucast_Macs_Remote | cut -d ':' -f2- | tr -d ' ' | sort"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-controller-vtep.at:380"
( $at_check_trace; vtep-ctl --columns=MAC list Ucast_Macs_Remote | cut -d ':' -f2- | tr -d ' ' | sort
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "
\"f0:ab:cd:ef:01:02\"
\"f0:ab:cd:ef:01:03\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:380"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }


# removes one mac to logical switch port.
{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:387: ovn-nbctl lsp-set-addresses vif0 f0:ab:cd:ef:01:03"
at_fn_check_prepare_trace "ovn-controller-vtep.at:387"
( $at_check_trace; ovn-nbctl lsp-set-addresses vif0 f0:ab:cd:ef:01:03
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:387"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

ovs_wait_cond () {
    test -z "`vtep-ctl --columns=MAC list Ucast_Macs_Remote | grep 02`"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:388" "until test -z \"\`vtep-ctl --columns=MAC list Ucast_Macs_Remote | grep 02\`\""

{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:389: vtep-ctl --columns=MAC list Ucast_Macs_Remote | cut -d ':' -f2- | tr -d ' ' | sort"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-controller-vtep.at:389"
( $at_check_trace; vtep-ctl --columns=MAC list Ucast_Macs_Remote | cut -d ':' -f2- | tr -d ' ' | sort
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"f0:ab:cd:ef:01:03\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:389"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }


# migrates mac to logical switch port vif1 on 'br-void'.
{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:394: ovn-nbctl lsp-set-addresses vif0"
at_fn_check_prepare_trace "ovn-controller-vtep.at:394"
( $at_check_trace; ovn-nbctl lsp-set-addresses vif0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:394"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:395: ovn-nbctl lsp-set-addresses vif1 f0:ab:cd:ef:01:03"
at_fn_check_prepare_trace "ovn-controller-vtep.at:395"
( $at_check_trace; ovn-nbctl lsp-set-addresses vif1 f0:ab:cd:ef:01:03
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:395"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

ovs_wait_cond () {
    test -z "`vtep-ctl --columns=MAC list Ucast_Macs_Remote | grep 03`"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:396" "until test -z \"\`vtep-ctl --columns=MAC list Ucast_Macs_Remote | grep 03\`\""

{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:397: vtep-ctl --columns=MAC list Ucast_Macs_Remote | cut -d ':' -f2- | tr -d ' ' | sort"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-controller-vtep.at:397"
( $at_check_trace; vtep-ctl --columns=MAC list Ucast_Macs_Remote | cut -d ':' -f2- | tr -d ' ' | sort
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:397"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:400: check_logs \"\""
at_fn_check_prepare_trace "ovn-controller-vtep.at:400"
( $at_check_trace; check_logs ""
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:400"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:400: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn-controller-vtep.at:400"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:400"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:400: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn-controller-vtep.at:400"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:400"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:400" "while kill -0 \$TMPPID 2>/dev/null"

   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:400: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn-controller-vtep.at:400"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:400"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:400: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn-controller-vtep.at:400"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:400"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:400" "while kill -0 \$TMPPID 2>/dev/null"

   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:400: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn-controller-vtep.at:400"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:400"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:400: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn-controller-vtep.at:400"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:400"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:400" "while kill -0 \$TMPPID 2>/dev/null"

   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:400: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-controller-vtep.at:400"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:400"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:400: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-controller-vtep.at:400"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:400"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:400" "while kill -0 \$TMPPID 2>/dev/null"

   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:400: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn-controller-vtep.at:400"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:400"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:400: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn-controller-vtep.at:400"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:400"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:400" "while kill -0 \$TMPPID 2>/dev/null"

ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_215
#AT_START_216
at_fn_group_banner 216 'ovn-controller-vtep.at:405' \
  "ovn-controller-vtep - vtep-macs 2" "              " 9
at_xfail=no
(
  $as_echo "216. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init



   # this will cause skip when 'make check' using Windows setup.

      { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:406: ovsdb-tool create vswitchd.db \$ovs_srcdir/vswitchd/vswitch.ovsschema"
at_fn_check_prepare_dynamic "ovsdb-tool create vswitchd.db $ovs_srcdir/vswitchd/vswitch.ovsschema" "ovn-controller-vtep.at:406"
( $at_check_trace; ovsdb-tool create vswitchd.db $ovs_srcdir/vswitchd/vswitch.ovsschema
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:406"
$at_failed && at_fn_log_failure
$at_traceon; }

   for daemon in ovn-nb ovn-sb; do
      { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:406: ovsdb-tool create \$daemon.db \$abs_top_srcdir/\${daemon}.ovsschema"
at_fn_check_prepare_notrace 'a ${...} parameter expansion' "ovn-controller-vtep.at:406"
( $at_check_trace; ovsdb-tool create $daemon.db $abs_top_srcdir/${daemon}.ovsschema
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:406"
$at_failed && at_fn_log_failure
$at_traceon; }

   done
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:406: ovsdb-tool create vtep.db \$ovs_srcdir/vtep/vtep.ovsschema"
at_fn_check_prepare_dynamic "ovsdb-tool create vtep.db $ovs_srcdir/vtep/vtep.ovsschema" "ovn-controller-vtep.at:406"
( $at_check_trace; ovsdb-tool create vtep.db $ovs_srcdir/vtep/vtep.ovsschema
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:406"
$at_failed && at_fn_log_failure
$at_traceon; }


      { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:406: ovsdb-server --detach --no-chdir --pidfile --log-file --remote=punix:\$OVS_RUNDIR/db.sock vswitchd.db vtep.db"
at_fn_check_prepare_dynamic "ovsdb-server --detach --no-chdir --pidfile --log-file --remote=punix:$OVS_RUNDIR/db.sock vswitchd.db vtep.db" "ovn-controller-vtep.at:406"
( $at_check_trace; ovsdb-server --detach --no-chdir --pidfile --log-file --remote=punix:$OVS_RUNDIR/db.sock vswitchd.db vtep.db
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:406"
$at_failed && at_fn_log_failure
$at_traceon; }

   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:406: ovsdb-server --detach --no-chdir --pidfile=ovsdb-nb-server.pid --log-file=ovsdb-nb-server.log --remote=punix:\$OVS_RUNDIR/ovnnb_db.sock ovn-nb.db"
at_fn_check_prepare_dynamic "ovsdb-server --detach --no-chdir --pidfile=ovsdb-nb-server.pid --log-file=ovsdb-nb-server.log --remote=punix:$OVS_RUNDIR/ovnnb_db.sock ovn-nb.db" "ovn-controller-vtep.at:406"
( $at_check_trace; ovsdb-server --detach --no-chdir --pidfile=ovsdb-nb-server.pid --log-file=ovsdb-nb-server.log --remote=punix:$OVS_RUNDIR/ovnnb_db.sock ovn-nb.db
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:406"
$at_failed && at_fn_log_failure
$at_traceon; }

   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:406: ovsdb-server --detach --no-chdir --pidfile=ovsdb-sb-server.pid --log-file=ovsdb-sb-server.log --remote=punix:\$OVS_RUNDIR/ovnsb_db.sock ovn-sb.db ovn-sb.db"
at_fn_check_prepare_dynamic "ovsdb-server --detach --no-chdir --pidfile=ovsdb-sb-server.pid --log-file=ovsdb-sb-server.log --remote=punix:$OVS_RUNDIR/ovnsb_db.sock ovn-sb.db ovn-sb.db" "ovn-controller-vtep.at:406"
( $at_check_trace; ovsdb-server --detach --no-chdir --pidfile=ovsdb-sb-server.pid --log-file=ovsdb-sb-server.log --remote=punix:$OVS_RUNDIR/ovnsb_db.sock ovn-sb.db ovn-sb.db
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:406"
$at_failed && at_fn_log_failure
$at_traceon; }

   on_exit "kill `cat ovsdb-server.pid` `cat ovsdb-nb-server.pid` `cat ovsdb-sb-server.pid`"
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:406: sed < stderr '
/vlog|INFO|opened log file/d
/ovsdb_server|INFO|ovsdb-server (Open vSwitch)/d'"
at_fn_check_prepare_notrace 'an embedded newline' "ovn-controller-vtep.at:406"
( $at_check_trace; sed < stderr '
/vlog|INFO|opened log file/d
/ovsdb_server|INFO|ovsdb-server (Open vSwitch)/d'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:406"
$at_failed && at_fn_log_failure
$at_traceon; }



      { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:406: ovs-vswitchd --enable-dummy=system --disable-system --detach --no-chdir --pidfile --log-file -vvconn -vofproto_dpif"
at_fn_check_prepare_trace "ovn-controller-vtep.at:406"
( $at_check_trace; ovs-vswitchd --enable-dummy=system --disable-system --detach --no-chdir --pidfile --log-file -vvconn -vofproto_dpif
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:406"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log"
$at_traceon; }


   on_exit "kill `cat ovs-vswitchd.pid`"
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:406: sed < stderr '
/ovs_numa|INFO|Discovered /d
/vlog|INFO|opened log file/d
/vswitchd|INFO|ovs-vswitchd (Open vSwitch)/d
/reconnect|INFO|/d
/ofproto|INFO|using datapath ID/d
/netlink_socket|INFO|netlink: could not enable listening to all nsid/d
/ofproto|INFO|datapath ID changed to fedcba9876543210/d'"
at_fn_check_prepare_notrace 'an embedded newline' "ovn-controller-vtep.at:406"
( $at_check_trace; sed < stderr '
/ovs_numa|INFO|Discovered /d
/vlog|INFO|opened log file/d
/vswitchd|INFO|ovs-vswitchd (Open vSwitch)/d
/reconnect|INFO|/d
/ofproto|INFO|using datapath ID/d
/netlink_socket|INFO|netlink: could not enable listening to all nsid/d
/ofproto|INFO|datapath ID changed to fedcba9876543210/d'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:406"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log"
$at_traceon; }

   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:406: ovs-vsctl -- add-br br-vtep \\
              -- set bridge br-vtep datapath-type=dummy other-config:datapath-id=fedcba9876543210 other-config:hwaddr=aa:55:aa:55:00:00 protocols=[OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13,OpenFlow14,OpenFlow15] fail-mode=secure \\
              -- add-port br-vtep p0 -- set Interface p0 type=dummy ofport_request=1 \\
              -- add-port br-vtep p1 -- set Interface p1 type=dummy ofport_request=2"
at_fn_check_prepare_notrace 'an embedded newline' "ovn-controller-vtep.at:406"
( $at_check_trace; ovs-vsctl -- add-br br-vtep \
              -- set bridge br-vtep datapath-type=dummy other-config:datapath-id=fedcba9876543210 other-config:hwaddr=aa:55:aa:55:00:00 protocols=[OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13,OpenFlow14,OpenFlow15] fail-mode=secure \
              -- add-port br-vtep p0 -- set Interface p0 type=dummy ofport_request=1 \
              -- add-port br-vtep p1 -- set Interface p1 type=dummy ofport_request=2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:406"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log"
$at_traceon; }


      { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:406: vtep-ctl add-ps br-vtep -- set Physical_Switch br-vtep tunnel_ips=1.2.3.4"
at_fn_check_prepare_trace "ovn-controller-vtep.at:406"
( $at_check_trace; vtep-ctl add-ps br-vtep -- set Physical_Switch br-vtep tunnel_ips=1.2.3.4
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:406"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log"
$at_traceon; }

   PYTHONPATH=$PYTHONPATH:$ovs_srcdir/python
   export $PYTHONPATH
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:406: ovs-vtep --log-file=ovs-vtep.log --pidfile=ovs-vtep.pid --detach --no-chdir br-vtep \\"
at_fn_check_prepare_trace "ovn-controller-vtep.at:406"
( $at_check_trace; ovs-vtep --log-file=ovs-vtep.log --pidfile=ovs-vtep.pid --detach --no-chdir br-vtep \
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:406"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log"
$at_traceon; }

   on_exit "kill `cat ovs-vtep.pid`"
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:406: sed < stderr '
/vlog|INFO|opened log file/d'"
at_fn_check_prepare_notrace 'an embedded newline' "ovn-controller-vtep.at:406"
( $at_check_trace; sed < stderr '
/vlog|INFO|opened log file/d'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:406"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log"
$at_traceon; }

   # waits until ovs-vtep starts up.
   ovs_wait_cond () {
    test -n "`vtep-ctl show | grep Physical_Port`"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:406" "until test -n \"\`vtep-ctl show | grep Physical_Port\`\""


      { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:406: ovn-nbctl ls-add br-test"
at_fn_check_prepare_trace "ovn-controller-vtep.at:406"
( $at_check_trace; ovn-nbctl ls-add br-test
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:406"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log"
$at_traceon; }

   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:406: ovn-northd --detach --no-chdir --pidfile --log-file"
at_fn_check_prepare_trace "ovn-controller-vtep.at:406"
( $at_check_trace; ovn-northd --detach --no-chdir --pidfile --log-file
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:406"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log"
$at_traceon; }

   on_exit "kill `cat ovn-northd.pid`"
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:406: sed < stderr '
/vlog|INFO|opened log file/d'"
at_fn_check_prepare_notrace 'an embedded newline' "ovn-controller-vtep.at:406"
( $at_check_trace; sed < stderr '
/vlog|INFO|opened log file/d'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:406"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log"
$at_traceon; }



      { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:406: ovn-controller-vtep --detach --no-chdir --pidfile --log-file --vtep-db=unix:\$OVS_RUNDIR/db.sock --ovnsb-db=unix:\$OVS_RUNDIR/ovnsb_db.sock"
at_fn_check_prepare_dynamic "ovn-controller-vtep --detach --no-chdir --pidfile --log-file --vtep-db=unix:$OVS_RUNDIR/db.sock --ovnsb-db=unix:$OVS_RUNDIR/ovnsb_db.sock" "ovn-controller-vtep.at:406"
( $at_check_trace; ovn-controller-vtep --detach --no-chdir --pidfile --log-file --vtep-db=unix:$OVS_RUNDIR/db.sock --ovnsb-db=unix:$OVS_RUNDIR/ovnsb_db.sock
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
echo stderr:; tee stderr <"$at_stderr"
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:406"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log"
$at_traceon; }


   on_exit "kill `cat ovn-controller-vtep.pid`"
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:406: sed < stderr '
/vlog|INFO|opened log file/d
/reconnect|INFO|/d'"
at_fn_check_prepare_notrace 'an embedded newline' "ovn-controller-vtep.at:406"
( $at_check_trace; sed < stderr '
/vlog|INFO|opened log file/d
/reconnect|INFO|/d'
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:406"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }



# creates a simple logical network with the vtep device and a fake hv chassis
# 'ch0'.
{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:410: ovn-nbctl lsp-add br-test vif0"
at_fn_check_prepare_trace "ovn-controller-vtep.at:410"
( $at_check_trace; ovn-nbctl lsp-add br-test vif0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:410"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:411: ovn-nbctl lsp-set-addresses vif0 f0:ab:cd:ef:01:02"
at_fn_check_prepare_trace "ovn-controller-vtep.at:411"
( $at_check_trace; ovn-nbctl lsp-set-addresses vif0 f0:ab:cd:ef:01:02
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:411"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:412: ovn-nbctl --timeout=10 --wait=sb sync"
at_fn_check_prepare_trace "ovn-controller-vtep.at:412"
( $at_check_trace; ovn-nbctl --timeout=10 --wait=sb sync
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:412"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:413: ovn-sbctl chassis-add ch0 vxlan 1.2.3.5"
at_fn_check_prepare_trace "ovn-controller-vtep.at:413"
( $at_check_trace; ovn-sbctl chassis-add ch0 vxlan 1.2.3.5
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:413"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:414: ovn-sbctl lsp-bind vif0 ch0"
at_fn_check_prepare_trace "ovn-controller-vtep.at:414"
( $at_check_trace; ovn-sbctl lsp-bind vif0 ch0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:414"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }


# creates another vif in the same logical switch with duplicate mac.
{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:417: ovn-nbctl lsp-add br-test vif1"
at_fn_check_prepare_trace "ovn-controller-vtep.at:417"
( $at_check_trace; ovn-nbctl lsp-add br-test vif1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:417"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:418: ovn-nbctl lsp-set-addresses vif1 f0:ab:cd:ef:01:02"
at_fn_check_prepare_trace "ovn-controller-vtep.at:418"
( $at_check_trace; ovn-nbctl lsp-set-addresses vif1 f0:ab:cd:ef:01:02
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:418"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:419: ovn-nbctl --timeout=10 --wait=sb sync"
at_fn_check_prepare_trace "ovn-controller-vtep.at:419"
( $at_check_trace; ovn-nbctl --timeout=10 --wait=sb sync
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:419"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:420: ovn-sbctl lsp-bind vif1 ch0"
at_fn_check_prepare_trace "ovn-controller-vtep.at:420"
( $at_check_trace; ovn-sbctl lsp-bind vif1 ch0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:420"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }


# creates the logical switch in vtep and adds the corresponding logical
# port to 'br-test'.
{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:424: vtep-ctl add-ls lswitch0 -- bind-ls br-vtep p0 100 lswitch0"
at_fn_check_prepare_trace "ovn-controller-vtep.at:424"
( $at_check_trace; vtep-ctl add-ls lswitch0 -- bind-ls br-vtep p0 100 lswitch0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:424"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:425: ovn-nbctl lsp-add br-test br-vtep_lswitch0"
at_fn_check_prepare_trace "ovn-controller-vtep.at:425"
( $at_check_trace; ovn-nbctl lsp-add br-test br-vtep_lswitch0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:425"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:425: ovn-nbctl lsp-set-type br-vtep_lswitch0 vtep"
at_fn_check_prepare_trace "ovn-controller-vtep.at:425"
( $at_check_trace; ovn-nbctl lsp-set-type br-vtep_lswitch0 vtep
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:425"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:425: ovn-nbctl lsp-set-options br-vtep_lswitch0 vtep-physical-switch=br-vtep vtep-logical-switch=lswitch0"
at_fn_check_prepare_trace "ovn-controller-vtep.at:425"
( $at_check_trace; ovn-nbctl lsp-set-options br-vtep_lswitch0 vtep-physical-switch=br-vtep vtep-logical-switch=lswitch0
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:425"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }


ovs_wait_cond () {
    test -n "`ovn-sbctl list Port_Binding  | grep br-vtep_lswitch0`"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:426" "until test -n \"\`ovn-sbctl list Port_Binding  | grep br-vtep_lswitch0\`\""


# checks Ucast_Macs_Remote creation.  Should still only be one entry, since duplicate
# mac in the same logical switch is not allowed.
ovs_wait_cond () {
    test -n "`vtep-ctl list Ucast_Macs_Remote | grep _uuid`"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:430" "until test -n \"\`vtep-ctl list Ucast_Macs_Remote | grep _uuid\`\""

{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:431: vtep-ctl --columns=MAC list Ucast_Macs_Remote | cut -d ':' -f2- | tr -d ' '"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-controller-vtep.at:431"
( $at_check_trace; vtep-ctl --columns=MAC list Ucast_Macs_Remote | cut -d ':' -f2- | tr -d ' '
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "\"f0:ab:cd:ef:01:02\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:431"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

# confirms the warning log.
ovs_wait_cond () {
    test -n "`grep WARN ovn-controller-vtep.log`"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:435" "until test -n \"\`grep WARN ovn-controller-vtep.log\`\""

{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:436: sed -n 's/^.*\\(|WARN|.*\\)\$/\\1/p' ovn-controller-vtep.log | sed 's/([-_:0-9a-z][-_:0-9a-z]*)/()/g' | uniq"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-controller-vtep.at:436"
( $at_check_trace; sed -n 's/^.*\(|WARN|.*\)$/\1/p' ovn-controller-vtep.log | sed 's/([-_:0-9a-z][-_:0-9a-z]*)/()/g' | uniq
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "|WARN|MAC address () has already been known to be on logical port () in the same logical datapath, so just ignore this logical port ()
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:436"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }


# deletes vif1.
{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:441: ovn-nbctl lsp-del vif1"
at_fn_check_prepare_trace "ovn-controller-vtep.at:441"
( $at_check_trace; ovn-nbctl lsp-del vif1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:441"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }


# adds another lswitch 'br-void' in ovn-nb database.
{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:444: ovn-nbctl ls-add br-void"
at_fn_check_prepare_trace "ovn-controller-vtep.at:444"
( $at_check_trace; ovn-nbctl ls-add br-void
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:444"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

# adds fake hv chassis 'ch1' and vif1 with same mac address as vif0.
{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:446: ovn-nbctl lsp-add br-void vif1"
at_fn_check_prepare_trace "ovn-controller-vtep.at:446"
( $at_check_trace; ovn-nbctl lsp-add br-void vif1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:446"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:447: ovn-nbctl lsp-set-addresses vif1 f0:ab:cd:ef:01:02"
at_fn_check_prepare_trace "ovn-controller-vtep.at:447"
( $at_check_trace; ovn-nbctl lsp-set-addresses vif1 f0:ab:cd:ef:01:02
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:447"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:448: ovn-nbctl --timeout=10 --wait=sb sync"
at_fn_check_prepare_trace "ovn-controller-vtep.at:448"
( $at_check_trace; ovn-nbctl --timeout=10 --wait=sb sync
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:448"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:449: ovn-sbctl chassis-add ch1 vxlan 1.2.3.6"
at_fn_check_prepare_trace "ovn-controller-vtep.at:449"
( $at_check_trace; ovn-sbctl chassis-add ch1 vxlan 1.2.3.6
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:449"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:450: ovn-sbctl lsp-bind vif1 ch1"
at_fn_check_prepare_trace "ovn-controller-vtep.at:450"
( $at_check_trace; ovn-sbctl lsp-bind vif1 ch1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:450"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

ovs_wait_cond () {
    test -n "`ovn-sbctl list Port_Binding | grep vif1`"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:451" "until test -n \"\`ovn-sbctl list Port_Binding | grep vif1\`\""


# creates another logical switch in vtep and adds the corresponding logical
# port to 'br-void'.
{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:455: vtep-ctl add-ls lswitch1 -- bind-ls br-vtep p0 200 lswitch1"
at_fn_check_prepare_trace "ovn-controller-vtep.at:455"
( $at_check_trace; vtep-ctl add-ls lswitch1 -- bind-ls br-vtep p0 200 lswitch1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:455"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:456: ovn-nbctl lsp-add br-void br-void_lswitch1"
at_fn_check_prepare_trace "ovn-controller-vtep.at:456"
( $at_check_trace; ovn-nbctl lsp-add br-void br-void_lswitch1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:456"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:456: ovn-nbctl lsp-set-type br-void_lswitch1 vtep"
at_fn_check_prepare_trace "ovn-controller-vtep.at:456"
( $at_check_trace; ovn-nbctl lsp-set-type br-void_lswitch1 vtep
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:456"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:456: ovn-nbctl lsp-set-options br-void_lswitch1 vtep-physical-switch=br-vtep vtep-logical-switch=lswitch1"
at_fn_check_prepare_trace "ovn-controller-vtep.at:456"
( $at_check_trace; ovn-nbctl lsp-set-options br-void_lswitch1 vtep-physical-switch=br-vtep vtep-logical-switch=lswitch1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:456"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }


ovs_wait_cond () {
    test -n "`ovn-sbctl list Port_Binding  | grep br-void_lswitch1`"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:457" "until test -n \"\`ovn-sbctl list Port_Binding  | grep br-void_lswitch1\`\""


# checks Ucast_Macs_Remote creation.  Should see two entries since it is allowed
# to have duplicate macs in different logical switches.
ovs_wait_cond () {
    test `vtep-ctl --columns=MAC list Ucast_Macs_Remote | grep 02 | wc -l` -gt 1
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:461" "until test \`vtep-ctl --columns=MAC list Ucast_Macs_Remote | grep 02 | wc -l\` -gt 1"

{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:462: vtep-ctl --columns=MAC list Ucast_Macs_Remote | cut -d ':' -f2- | tr -d ' ' | sort"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-controller-vtep.at:462"
( $at_check_trace; vtep-ctl --columns=MAC list Ucast_Macs_Remote | cut -d ':' -f2- | tr -d ' ' | sort
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "
\"f0:ab:cd:ef:01:02\"
\"f0:ab:cd:ef:01:02\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:462"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:468: check_logs \"/has already been known to be on logical port/d\""
at_fn_check_prepare_trace "ovn-controller-vtep.at:468"
( $at_check_trace; check_logs "/has already been known to be on logical port/d"
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:468"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:468: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn-controller-vtep.at:468"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:468"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:468: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn-controller-vtep.at:468"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:468"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:468" "while kill -0 \$TMPPID 2>/dev/null"

   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:468: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn-controller-vtep.at:468"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:468"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:468: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn-controller-vtep.at:468"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:468"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:468" "while kill -0 \$TMPPID 2>/dev/null"

   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:468: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn-controller-vtep.at:468"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:468"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:468: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn-controller-vtep.at:468"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:468"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:468" "while kill -0 \$TMPPID 2>/dev/null"

   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:468: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-controller-vtep.at:468"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:468"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:468: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-controller-vtep.at:468"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:468"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:468" "while kill -0 \$TMPPID 2>/dev/null"

   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:468: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn-controller-vtep.at:468"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:468"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn-controller-vtep.at:468: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn-controller-vtep.at:468"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-controller-vtep.at:468"
$at_failed && at_fn_log_failure  \
"ovsdb-server.log" \
"ovs-vswitchd.log" \
"ovn-northd.log" \
"ovn-controller-vtep.log"
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-controller-vtep.at:468" "while kill -0 \$TMPPID 2>/dev/null"

ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_216
#AT_START_217
at_fn_group_banner 217 'ovn-ic.at:2' \
  "ovn-ic -- AZ register" "                          " 10
at_xfail=no
(
  $as_echo "217. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init


ovn_init_ic_db
ovn_start az1
ovn_start az2

{ set +x
$as_echo "$at_srcdir/ovn-ic.at:8: ovn-ic-sbctl show"
at_fn_check_prepare_trace "ovn-ic.at:8"
( $at_check_trace; ovn-ic-sbctl show
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "availability-zone az1
availability-zone az2
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:8"
$at_failed && at_fn_log_failure
$at_traceon; }


ovn_as az1
ovn-nbctl set NB_Global . name=az3
{ set +x
$as_echo "$at_srcdir/ovn-ic.at:15: ovn-ic-sbctl show"
at_fn_check_prepare_trace "ovn-ic.at:15"
( $at_check_trace; ovn-ic-sbctl show
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "availability-zone az2
availability-zone az3
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:15"
$at_failed && at_fn_log_failure
$at_traceon; }


ovn_as az2
ovn-nbctl set NB_Global . name=\"\"
{ set +x
$as_echo "$at_srcdir/ovn-ic.at:22: ovn-ic-sbctl show"
at_fn_check_prepare_trace "ovn-ic.at:22"
( $at_check_trace; ovn-ic-sbctl show
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "availability-zone az3
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:22"
$at_failed && at_fn_log_failure
$at_traceon; }





    as az1/ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn-ic.at:26: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-ic.at:26"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:26"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:26: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-ic.at:26"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:26"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:26" "while kill -0 \$TMPPID 2>/dev/null"


    as az1/ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn-ic.at:26: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-ic.at:26"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:26"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:26: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-ic.at:26"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:26"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:26" "while kill -0 \$TMPPID 2>/dev/null"


    as az1/northd
    { set +x
$as_echo "$at_srcdir/ovn-ic.at:26: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn-ic.at:26"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:26"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:26: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn-ic.at:26"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:26"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:26" "while kill -0 \$TMPPID 2>/dev/null"


    as az1/northd-backup
    { set +x
$as_echo "$at_srcdir/ovn-ic.at:26: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn-ic.at:26"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:26"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:26: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn-ic.at:26"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:26"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:26" "while kill -0 \$TMPPID 2>/dev/null"


    as az1/ic
    { set +x
$as_echo "$at_srcdir/ovn-ic.at:26: test -e \$OVS_RUNDIR/ovn-ic.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-ic.pid" "ovn-ic.at:26"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-ic.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:26"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-ic.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:26: ovs-appctl --timeout=10 -t ovn-ic exit"
at_fn_check_prepare_trace "ovn-ic.at:26"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-ic exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:26"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:26" "while kill -0 \$TMPPID 2>/dev/null"




    as az2/ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn-ic.at:26: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-ic.at:26"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:26"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:26: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-ic.at:26"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:26"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:26" "while kill -0 \$TMPPID 2>/dev/null"


    as az2/ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn-ic.at:26: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-ic.at:26"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:26"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:26: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-ic.at:26"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:26"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:26" "while kill -0 \$TMPPID 2>/dev/null"


    as az2/northd
    { set +x
$as_echo "$at_srcdir/ovn-ic.at:26: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn-ic.at:26"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:26"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:26: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn-ic.at:26"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:26"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:26" "while kill -0 \$TMPPID 2>/dev/null"


    as az2/northd-backup
    { set +x
$as_echo "$at_srcdir/ovn-ic.at:26: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn-ic.at:26"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:26"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:26: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn-ic.at:26"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:26"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:26" "while kill -0 \$TMPPID 2>/dev/null"


    as az2/ic
    { set +x
$as_echo "$at_srcdir/ovn-ic.at:26: test -e \$OVS_RUNDIR/ovn-ic.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-ic.pid" "ovn-ic.at:26"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-ic.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:26"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-ic.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:26: ovs-appctl --timeout=10 -t ovn-ic exit"
at_fn_check_prepare_trace "ovn-ic.at:26"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-ic exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:26"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:26" "while kill -0 \$TMPPID 2>/dev/null"



    as ovn-ic-sb
    { set +x
$as_echo "$at_srcdir/ovn-ic.at:26: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-ic.at:26"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:26"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:26: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-ic.at:26"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:26"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:26" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-ic-nb
    { set +x
$as_echo "$at_srcdir/ovn-ic.at:26: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-ic.at:26"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:26"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:26: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-ic.at:26"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:26"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:26" "while kill -0 \$TMPPID 2>/dev/null"


    if test -d "$ovs_base"/main; then

    as main
    { set +x
$as_echo "$at_srcdir/ovn-ic.at:26: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn-ic.at:26"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:26"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:26: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn-ic.at:26"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:26"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:26" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn-ic.at:26: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-ic.at:26"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:26"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:26: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-ic.at:26"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:26"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:26" "while kill -0 \$TMPPID 2>/dev/null"


    fi


ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_217
#AT_START_218
at_fn_group_banner 218 'ovn-ic.at:30' \
  "ovn-ic -- transit switch handling" "              " 10
at_xfail=no
(
  $as_echo "218. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init


ovn_init_ic_db
ovn_start az1

{ set +x
$as_echo "$at_srcdir/ovn-ic.at:35: ovn-ic-nbctl ts-add ts1"
at_fn_check_prepare_trace "ovn-ic.at:35"
( $at_check_trace; ovn-ic-nbctl ts-add ts1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:35"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-ic.at:36: ovn-ic-nbctl ts-add ts2"
at_fn_check_prepare_trace "ovn-ic.at:36"
( $at_check_trace; ovn-ic-nbctl ts-add ts2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:36"
$at_failed && at_fn_log_failure
$at_traceon; }


# Check ISB
ovs_wait_cond () {
    ovn-ic-sbctl list datapath | grep ts2
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:39" "until ovn-ic-sbctl list datapath | grep ts2"

{ set +x
$as_echo "$at_srcdir/ovn-ic.at:40: ovn-ic-sbctl -f csv -d bare --no-headings --columns transit_switch list datapath | sort"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-ic.at:40"
( $at_check_trace; ovn-ic-sbctl -f csv -d bare --no-headings --columns transit_switch list datapath | sort
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "ts1
ts2
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:40"
$at_failed && at_fn_log_failure
$at_traceon; }


# Check NB
{ set +x
$as_echo "$at_srcdir/ovn-ic.at:46: ovn-nbctl -f csv -d bare --no-headings --columns name list logical_switch | sort"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-ic.at:46"
( $at_check_trace; ovn-nbctl -f csv -d bare --no-headings --columns name list logical_switch | sort
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "ts1
ts2
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:46"
$at_failed && at_fn_log_failure
$at_traceon; }


# Check SB DP key
ts1_key=$(ovn-ic-sbctl -f csv -d bare --no-headings --columns tunnel_key find datapath transit_switch=ts1)
sb_ts1_key=$(ovn-sbctl -f csv -d bare --no-headings --columns tunnel_key find datapath_binding external_ids:interconn-ts=ts1)
{ set +x
$as_echo "$at_srcdir/ovn-ic.at:54: test \$ts1_key = \$sb_ts1_key"
at_fn_check_prepare_dynamic "test $ts1_key = $sb_ts1_key" "ovn-ic.at:54"
( $at_check_trace; test $ts1_key = $sb_ts1_key
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:54"
$at_failed && at_fn_log_failure
$at_traceon; }


# Test delete
{ set +x
$as_echo "$at_srcdir/ovn-ic.at:57: ovn-ic-nbctl ts-del ts1"
at_fn_check_prepare_trace "ovn-ic.at:57"
( $at_check_trace; ovn-ic-nbctl ts-del ts1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:57"
$at_failed && at_fn_log_failure
$at_traceon; }

ovs_wait_cond () {
    if ovn-ic-sbctl list datapath | grep ts1; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:58" "while ovn-ic-sbctl list datapath | grep ts1"

{ set +x
$as_echo "$at_srcdir/ovn-ic.at:59: ovn-ic-sbctl -f csv -d bare --no-headings --columns transit_switch list datapath"
at_fn_check_prepare_trace "ovn-ic.at:59"
( $at_check_trace; ovn-ic-sbctl -f csv -d bare --no-headings --columns transit_switch list datapath
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "ts2
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:59"
$at_failed && at_fn_log_failure
$at_traceon; }

{ set +x
$as_echo "$at_srcdir/ovn-ic.at:62: ovn-nbctl -f csv -d bare --no-headings --columns name list logical_switch | sort"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-ic.at:62"
( $at_check_trace; ovn-nbctl -f csv -d bare --no-headings --columns name list logical_switch | sort
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "ts2
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:62"
$at_failed && at_fn_log_failure
$at_traceon; }





    as az1/ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn-ic.at:66: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-ic.at:66"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:66"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:66: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-ic.at:66"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:66"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:66" "while kill -0 \$TMPPID 2>/dev/null"


    as az1/ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn-ic.at:66: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-ic.at:66"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:66"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:66: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-ic.at:66"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:66"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:66" "while kill -0 \$TMPPID 2>/dev/null"


    as az1/northd
    { set +x
$as_echo "$at_srcdir/ovn-ic.at:66: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn-ic.at:66"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:66"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:66: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn-ic.at:66"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:66"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:66" "while kill -0 \$TMPPID 2>/dev/null"


    as az1/northd-backup
    { set +x
$as_echo "$at_srcdir/ovn-ic.at:66: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn-ic.at:66"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:66"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:66: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn-ic.at:66"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:66"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:66" "while kill -0 \$TMPPID 2>/dev/null"


    as az1/ic
    { set +x
$as_echo "$at_srcdir/ovn-ic.at:66: test -e \$OVS_RUNDIR/ovn-ic.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-ic.pid" "ovn-ic.at:66"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-ic.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:66"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-ic.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:66: ovs-appctl --timeout=10 -t ovn-ic exit"
at_fn_check_prepare_trace "ovn-ic.at:66"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-ic exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:66"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:66" "while kill -0 \$TMPPID 2>/dev/null"



    as ovn-ic-sb
    { set +x
$as_echo "$at_srcdir/ovn-ic.at:66: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-ic.at:66"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:66"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:66: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-ic.at:66"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:66"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:66" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-ic-nb
    { set +x
$as_echo "$at_srcdir/ovn-ic.at:66: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-ic.at:66"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:66"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:66: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-ic.at:66"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:66"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:66" "while kill -0 \$TMPPID 2>/dev/null"


    if test -d "$ovs_base"/main; then

    as main
    { set +x
$as_echo "$at_srcdir/ovn-ic.at:66: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn-ic.at:66"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:66"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:66: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn-ic.at:66"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:66"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:66" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn-ic.at:66: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-ic.at:66"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:66"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:66: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-ic.at:66"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:66"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:66" "while kill -0 \$TMPPID 2>/dev/null"


    fi


ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_218
#AT_START_219
at_fn_group_banner 219 'ovn-ic.at:70' \
  "ovn-ic -- gateway sync" "                         " 10
at_xfail=no
(
  $as_echo "219. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init


ovn_init_ic_db
net_add n1
ovn_start az1
ovn_start az2
sim_add gw1
as gw1
ovs-vsctl add-br br-phys
ovn_az_attach az1 n1 br-phys 192.168.0.1
ovs-vsctl set open . external-ids:ovn-is-interconn=true external-ids:hostname=gw1

{ set +x
$as_echo "$at_srcdir/ovn-ic.at:82: ovn_as az2 ovn-sbctl show | sort -r"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-ic.at:82"
( $at_check_trace; ovn_as az2 ovn-sbctl show | sort -r
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "Chassis gw1
    hostname: gw1
    Encap vxlan
    Encap geneve
        options: {csum=\"true\"}
        options: {csum=\"true\"}
        ip: \"192.168.0.1\"
        ip: \"192.168.0.1\"
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:82"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-ic.at:93: ovn_as az2 ovn-sbctl -f csv -d bare --no-headings --columns external_ids list chassis"
at_fn_check_prepare_trace "ovn-ic.at:93"
( $at_check_trace; ovn_as az2 ovn-sbctl -f csv -d bare --no-headings --columns external_ids list chassis
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "is-remote=true
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:93"
$at_failed && at_fn_log_failure
$at_traceon; }


ovs-vsctl set open . external-ids:ovn-is-interconn=false
{ set +x
$as_echo "$at_srcdir/ovn-ic.at:98: ovn_as az2 ovn-sbctl show"
at_fn_check_prepare_trace "ovn-ic.at:98"
( $at_check_trace; ovn_as az2 ovn-sbctl show
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:98"
$at_failed && at_fn_log_failure
$at_traceon; }


ovs-vsctl set open . external-ids:ovn-is-interconn=true
{ set +x
$as_echo "$at_srcdir/ovn-ic.at:102: ovn_as az2 ovn-sbctl show | grep gw1"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-ic.at:102"
( $at_check_trace; ovn_as az2 ovn-sbctl show | grep gw1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:102"
$at_failed && at_fn_log_failure
$at_traceon; }



    as gw1
    if test "gw1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn-ic.at:104: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn-ic.at:104"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:104"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:104: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn-ic.at:104"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:104"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:104" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn-ic.at:104: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn-ic.at:104"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:104"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:104: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn-ic.at:104"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:104"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:104" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn-ic.at:104: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn-ic.at:104"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:104"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:104: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn-ic.at:104"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:104"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:104" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as gw1
    { set +x
$as_echo "$at_srcdir/ovn-ic.at:104: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn-ic.at:104"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:104"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:104: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn-ic.at:104"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:104"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:104" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn-ic.at:104: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-ic.at:104"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:104"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:104: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-ic.at:104"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:104"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:104" "while kill -0 \$TMPPID 2>/dev/null"



{ set +x
$as_echo "$at_srcdir/ovn-ic.at:105: ovn_as az2 ovn-sbctl show"
at_fn_check_prepare_trace "ovn-ic.at:105"
( $at_check_trace; ovn_as az2 ovn-sbctl show
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:105"
$at_failed && at_fn_log_failure
$at_traceon; }


# Test encap change
sim_add gw2
as gw2
ovs-vsctl add-br br-phys
ovn_az_attach az1 n1 br-phys 192.168.0.1
ovs-vsctl set open . external-ids:ovn-is-interconn=true
ovs_wait_cond () {
    ovn_as az2 ovn-sbctl show | grep "192.168.0.1"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:114" "until ovn_as az2 ovn-sbctl show | grep \"192.168.0.1\""

ovs-vsctl set open . external_ids:ovn-encap-ip=192.168.0.2
ovs_wait_cond () {
    ovn_as az2 ovn-sbctl show | grep "192.168.0.2"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:116" "until ovn_as az2 ovn-sbctl show | grep \"192.168.0.2\""

ovs-vsctl set open . external_ids:ovn-encap-type="geneve,stt"
ovs_wait_cond () {
    ovn_as az2 ovn-sbctl show | grep stt
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:118" "until ovn_as az2 ovn-sbctl show | grep stt"



    as gw2
    if test "gw2" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn-ic.at:120: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn-ic.at:120"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:120"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:120: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn-ic.at:120"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:120"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:120" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn-ic.at:120: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn-ic.at:120"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:120"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:120: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn-ic.at:120"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:120"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:120" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn-ic.at:120: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn-ic.at:120"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:120"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:120: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn-ic.at:120"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:120"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:120" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as gw2
    { set +x
$as_echo "$at_srcdir/ovn-ic.at:120: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn-ic.at:120"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:120"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:120: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn-ic.at:120"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:120"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:120" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn-ic.at:120: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-ic.at:120"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:120"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:120: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-ic.at:120"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:120"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:120" "while kill -0 \$TMPPID 2>/dev/null"






    as az1/ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn-ic.at:121: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-ic.at:121"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:121"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:121: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-ic.at:121"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:121"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:121" "while kill -0 \$TMPPID 2>/dev/null"


    as az1/ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn-ic.at:121: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-ic.at:121"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:121"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:121: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-ic.at:121"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:121"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:121" "while kill -0 \$TMPPID 2>/dev/null"


    as az1/northd
    { set +x
$as_echo "$at_srcdir/ovn-ic.at:121: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn-ic.at:121"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:121"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:121: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn-ic.at:121"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:121"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:121" "while kill -0 \$TMPPID 2>/dev/null"


    as az1/northd-backup
    { set +x
$as_echo "$at_srcdir/ovn-ic.at:121: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn-ic.at:121"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:121"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:121: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn-ic.at:121"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:121"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:121" "while kill -0 \$TMPPID 2>/dev/null"


    as az1/ic
    { set +x
$as_echo "$at_srcdir/ovn-ic.at:121: test -e \$OVS_RUNDIR/ovn-ic.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-ic.pid" "ovn-ic.at:121"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-ic.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:121"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-ic.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:121: ovs-appctl --timeout=10 -t ovn-ic exit"
at_fn_check_prepare_trace "ovn-ic.at:121"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-ic exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:121"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:121" "while kill -0 \$TMPPID 2>/dev/null"




    as az2/ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn-ic.at:121: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-ic.at:121"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:121"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:121: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-ic.at:121"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:121"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:121" "while kill -0 \$TMPPID 2>/dev/null"


    as az2/ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn-ic.at:121: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-ic.at:121"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:121"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:121: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-ic.at:121"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:121"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:121" "while kill -0 \$TMPPID 2>/dev/null"


    as az2/northd
    { set +x
$as_echo "$at_srcdir/ovn-ic.at:121: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn-ic.at:121"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:121"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:121: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn-ic.at:121"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:121"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:121" "while kill -0 \$TMPPID 2>/dev/null"


    as az2/northd-backup
    { set +x
$as_echo "$at_srcdir/ovn-ic.at:121: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn-ic.at:121"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:121"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:121: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn-ic.at:121"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:121"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:121" "while kill -0 \$TMPPID 2>/dev/null"


    as az2/ic
    { set +x
$as_echo "$at_srcdir/ovn-ic.at:121: test -e \$OVS_RUNDIR/ovn-ic.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-ic.pid" "ovn-ic.at:121"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-ic.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:121"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-ic.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:121: ovs-appctl --timeout=10 -t ovn-ic exit"
at_fn_check_prepare_trace "ovn-ic.at:121"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-ic exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:121"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:121" "while kill -0 \$TMPPID 2>/dev/null"



    as ovn-ic-sb
    { set +x
$as_echo "$at_srcdir/ovn-ic.at:121: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-ic.at:121"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:121"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:121: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-ic.at:121"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:121"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:121" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-ic-nb
    { set +x
$as_echo "$at_srcdir/ovn-ic.at:121: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-ic.at:121"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:121"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:121: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-ic.at:121"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:121"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:121" "while kill -0 \$TMPPID 2>/dev/null"


    if test -d "$ovs_base"/main; then

    as main
    { set +x
$as_echo "$at_srcdir/ovn-ic.at:121: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn-ic.at:121"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:121"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:121: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn-ic.at:121"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:121"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:121" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn-ic.at:121: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-ic.at:121"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:121"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:121: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-ic.at:121"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:121"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:121" "while kill -0 \$TMPPID 2>/dev/null"


    fi


ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_219
#AT_START_220
at_fn_group_banner 220 'ovn-ic.at:126' \
  "ovn-ic -- port sync" "                            " 10
at_xfail=no
(
  $as_echo "220. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init


ovn_init_ic_db
ovn-ic-nbctl ts-add ts1
net_add n1
ovn_start az1
ovn_start az2
sim_add gw1
as gw1
ovs-vsctl add-br br-phys
ovn_az_attach az1 n1 br-phys 192.168.0.1
ovs-vsctl set open . external-ids:ovn-is-interconn=true

ovn_as az1
ovs_wait_cond () {
    ovn-sbctl list datapath_binding | grep interconn-ts | grep ts1
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:140" "until ovn-sbctl list datapath_binding | grep interconn-ts | grep ts1"


# Create LRP and connect to TS
ovn-nbctl lr-add lr1
ovn-nbctl lrp-add lr1 lrp-lr1-ts1 aa:aa:aa:aa:aa:01 169.254.100.1/24
ovn-nbctl lsp-add ts1 lsp-ts1-lr1
ovn-nbctl lsp-set-addresses lsp-ts1-lr1 router
ovn-nbctl lsp-set-type lsp-ts1-lr1 router
ovn-nbctl lsp-set-options lsp-ts1-lr1 router-port=lrp-lr1-ts1

{ set +x
$as_echo "$at_srcdir/ovn-ic.at:150: ovn_as az2 ovn-nbctl show | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-ic.at:150"
( $at_check_trace; ovn_as az2 ovn-nbctl show | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "switch <0> (ts1)
    port lsp-ts1-lr1
        type: remote
        addresses: [\"aa:aa:aa:aa:aa:01 169.254.100.1/24\"]
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:150"
$at_failed && at_fn_log_failure
$at_traceon; }


{ set +x
$as_echo "$at_srcdir/ovn-ic.at:157: ovn_as az2 ovn-sbctl -f csv -d bare --no-headings --columns logical_port,type list port_binding"
at_fn_check_prepare_trace "ovn-ic.at:157"
( $at_check_trace; ovn_as az2 ovn-sbctl -f csv -d bare --no-headings --columns logical_port,type list port_binding
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "lsp-ts1-lr1,remote
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:157"
$at_failed && at_fn_log_failure
$at_traceon; }


ovn-nbctl lrp-set-gateway-chassis lrp-lr1-ts1 gw1
ovs_wait_cond () {
    ovn_as az2 ovn-sbctl show | grep lsp-ts1-lr1
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:162" "until ovn_as az2 ovn-sbctl show | grep lsp-ts1-lr1"


ovn-nbctl lrp-del-gateway-chassis lrp-lr1-ts1 gw1
ovs_wait_cond () {
    if ovn_as az2 ovn-sbctl show | grep lsp-ts1-lr1; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:165" "while ovn_as az2 ovn-sbctl show | grep lsp-ts1-lr1"


ovn-nbctl set logical_router_port lrp-lr1-ts1 mac="\"aa:aa:aa:aa:aa:02\"" \
              networks="169.254.100.2/24 169.254.200.3/24"
ovs_wait_cond () {
    ovn_as az2 ovn-nbctl show | grep "aa:aa:aa:aa:aa:02 169.254.100.2/24 169.254.200.3/24"
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:169" "until ovn_as az2 ovn-nbctl show | grep \"aa:aa:aa:aa:aa:02 169.254.100.2/24 169.254.200.3/24\""


# Delete the router port from az1, the remote port in az2 should still remain
# but just lost address.
ovn-nbctl lrp-del lrp-lr1-ts1
ovs_wait_cond () {
    if ovn_as az2 ovn-nbctl show | grep "aa:aa:aa:aa:aa:02 169.254.100.2/24 169.254.200.3/24"; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:174" "while ovn_as az2 ovn-nbctl show | grep \"aa:aa:aa:aa:aa:02 169.254.100.2/24 169.254.200.3/24\""

{ set +x
$as_echo "$at_srcdir/ovn-ic.at:175: ovn_as az2 ovn-nbctl show | uuidfilt"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-ic.at:175"
( $at_check_trace; ovn_as az2 ovn-nbctl show | uuidfilt
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "switch <0> (ts1)
    port lsp-ts1-lr1
        type: remote
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:175"
$at_failed && at_fn_log_failure
$at_traceon; }


# Delete the lsp from az1, the remote port in az2 should be gone
ovn-nbctl lsp-del lsp-ts1-lr1
ovs_wait_cond () {
    if ovn_as az2 ovn-nbctl show | grep lsp-ts1-lr1; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:183" "while ovn_as az2 ovn-nbctl show | grep lsp-ts1-lr1"



    as gw1
    if test "gw1" = "vtep"; then
        { set +x
$as_echo "$at_srcdir/ovn-ic.at:185: test -e \$OVS_RUNDIR/ovn-controller-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller-vtep.pid" "ovn-ic.at:185"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:185"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:185: ovs-appctl --timeout=10 -t ovn-controller-vtep exit"
at_fn_check_prepare_trace "ovn-ic.at:185"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:185"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:185" "while kill -0 \$TMPPID 2>/dev/null"

        { set +x
$as_echo "$at_srcdir/ovn-ic.at:185: test -e \$OVS_RUNDIR/ovs-vtep.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vtep.pid" "ovn-ic.at:185"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vtep.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:185"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vtep.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:185: ovs-appctl --timeout=10 -t ovs-vtep exit"
at_fn_check_prepare_trace "ovn-ic.at:185"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vtep exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:185"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:185" "while kill -0 \$TMPPID 2>/dev/null"

    else
        { set +x
$as_echo "$at_srcdir/ovn-ic.at:185: test -e \$OVS_RUNDIR/ovn-controller.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-controller.pid" "ovn-ic.at:185"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-controller.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:185"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-controller.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:185: ovs-appctl --timeout=10 -t ovn-controller exit"
at_fn_check_prepare_trace "ovn-ic.at:185"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-controller exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:185"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:185" "while kill -0 \$TMPPID 2>/dev/null"

    fi

    as gw1
    { set +x
$as_echo "$at_srcdir/ovn-ic.at:185: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn-ic.at:185"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:185"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:185: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn-ic.at:185"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:185"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:185" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn-ic.at:185: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-ic.at:185"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:185"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:185: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-ic.at:185"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:185"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:185" "while kill -0 \$TMPPID 2>/dev/null"






    as az1/ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn-ic.at:186: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-ic.at:186"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:186"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:186: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-ic.at:186"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:186"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:186" "while kill -0 \$TMPPID 2>/dev/null"


    as az1/ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn-ic.at:186: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-ic.at:186"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:186"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:186: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-ic.at:186"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:186"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:186" "while kill -0 \$TMPPID 2>/dev/null"


    as az1/northd
    { set +x
$as_echo "$at_srcdir/ovn-ic.at:186: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn-ic.at:186"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:186"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:186: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn-ic.at:186"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:186"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:186" "while kill -0 \$TMPPID 2>/dev/null"


    as az1/northd-backup
    { set +x
$as_echo "$at_srcdir/ovn-ic.at:186: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn-ic.at:186"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:186"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:186: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn-ic.at:186"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:186"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:186" "while kill -0 \$TMPPID 2>/dev/null"


    as az1/ic
    { set +x
$as_echo "$at_srcdir/ovn-ic.at:186: test -e \$OVS_RUNDIR/ovn-ic.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-ic.pid" "ovn-ic.at:186"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-ic.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:186"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-ic.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:186: ovs-appctl --timeout=10 -t ovn-ic exit"
at_fn_check_prepare_trace "ovn-ic.at:186"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-ic exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:186"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:186" "while kill -0 \$TMPPID 2>/dev/null"




    as az2/ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn-ic.at:186: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-ic.at:186"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:186"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:186: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-ic.at:186"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:186"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:186" "while kill -0 \$TMPPID 2>/dev/null"


    as az2/ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn-ic.at:186: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-ic.at:186"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:186"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:186: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-ic.at:186"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:186"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:186" "while kill -0 \$TMPPID 2>/dev/null"


    as az2/northd
    { set +x
$as_echo "$at_srcdir/ovn-ic.at:186: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn-ic.at:186"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:186"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:186: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn-ic.at:186"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:186"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:186" "while kill -0 \$TMPPID 2>/dev/null"


    as az2/northd-backup
    { set +x
$as_echo "$at_srcdir/ovn-ic.at:186: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn-ic.at:186"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:186"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:186: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn-ic.at:186"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:186"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:186" "while kill -0 \$TMPPID 2>/dev/null"


    as az2/ic
    { set +x
$as_echo "$at_srcdir/ovn-ic.at:186: test -e \$OVS_RUNDIR/ovn-ic.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-ic.pid" "ovn-ic.at:186"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-ic.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:186"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-ic.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:186: ovs-appctl --timeout=10 -t ovn-ic exit"
at_fn_check_prepare_trace "ovn-ic.at:186"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-ic exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:186"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:186" "while kill -0 \$TMPPID 2>/dev/null"



    as ovn-ic-sb
    { set +x
$as_echo "$at_srcdir/ovn-ic.at:186: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-ic.at:186"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:186"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:186: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-ic.at:186"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:186"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:186" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-ic-nb
    { set +x
$as_echo "$at_srcdir/ovn-ic.at:186: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-ic.at:186"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:186"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:186: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-ic.at:186"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:186"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:186" "while kill -0 \$TMPPID 2>/dev/null"


    if test -d "$ovs_base"/main; then

    as main
    { set +x
$as_echo "$at_srcdir/ovn-ic.at:186: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn-ic.at:186"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:186"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:186: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn-ic.at:186"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:186"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:186" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn-ic.at:186: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-ic.at:186"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:186"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:186: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-ic.at:186"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:186"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:186" "while kill -0 \$TMPPID 2>/dev/null"


    fi


ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_220
#AT_START_221
at_fn_group_banner 221 'ovn-ic.at:190' \
  "ovn-ic -- route sync" "                           " 10
at_xfail=no
(
  $as_echo "221. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init


ovn_init_ic_db
ovn-ic-nbctl ts-add ts1

for i in 1 2; do
    ovn_start az$i
    ovn_as az$i

    # Enable route learning at AZ level
    ovn-nbctl set nb_global . options:ic-route-learn=true
    # Enable route advertising at AZ level
    ovn-nbctl set nb_global . options:ic-route-adv=true

    # Create LRP and connect to TS
    ovn-nbctl lr-add lr$i
    ovn-nbctl lrp-add lr$i lrp-lr$i-ts1 aa:aa:aa:aa:aa:0$i 169.254.100.$i/24
    ovn-nbctl lsp-add ts1 lsp-ts1-lr$i \
            -- lsp-set-addresses lsp-ts1-lr$i router \
            -- lsp-set-type lsp-ts1-lr$i router \
            -- lsp-set-options lsp-ts1-lr$i router-port=lrp-lr$i-ts1

    # Create static routes
    ovn-nbctl lr-route-add lr$i 10.11.$i.0/24 169.254.0.1

    # Create a src-ip route, which shouldn't be synced
    ovn-nbctl --policy=src-ip lr-route-add lr$i 10.22.$i.0/24 169.254.0.2
done

for i in 1 2; do
    ovs_wait_cond () {
    ovn_as az$i ovn-nbctl lr-route-list lr$i | grep learned
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:220" "until ovn_as az\$i ovn-nbctl lr-route-list lr\$i | grep learned"

done

{ set +x
$as_echo "$at_srcdir/ovn-ic.at:223: ovn_as az1 ovn-nbctl lr-route-list lr1"
at_fn_check_prepare_trace "ovn-ic.at:223"
( $at_check_trace; ovn_as az1 ovn-nbctl lr-route-list lr1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "IPv4 Routes
             10.11.1.0/24               169.254.0.1 dst-ip
             10.11.2.0/24             169.254.100.2 dst-ip (learned)
             10.22.1.0/24               169.254.0.2 src-ip
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:223"
$at_failed && at_fn_log_failure
$at_traceon; }


# Delete route in AZ1, AZ2's learned route should be deleted.
ovn_as az1 ovn-nbctl lr-route-del lr1 10.11.1.0/24
ovs_wait_cond () {
    if ovn_as az2 ovn-nbctl lr-route-list lr2 | grep learned; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:232" "while ovn_as az2 ovn-nbctl lr-route-list lr2 | grep learned"


# Add the route back
ovn_as az1 ovn-nbctl lr-route-add lr1 10.11.1.0/24 169.254.0.1
ovs_wait_cond () {
    ovn_as az2 ovn-nbctl lr-route-list lr2 | grep learned
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:236" "until ovn_as az2 ovn-nbctl lr-route-list lr2 | grep learned"


# Disable route-learning for AZ1
ovn_as az1 ovn-nbctl set nb_global . options:ic-route-learn=false
ovs_wait_cond () {
    if ovn_as az1 ovn-nbctl lr-route-list lr1 | grep learned; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:240" "while ovn_as az1 ovn-nbctl lr-route-list lr1 | grep learned"

{ set +x
$as_echo "$at_srcdir/ovn-ic.at:241: ovn_as az1 ovn-nbctl lr-route-list lr1"
at_fn_check_prepare_trace "ovn-ic.at:241"
( $at_check_trace; ovn_as az1 ovn-nbctl lr-route-list lr1
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "IPv4 Routes
             10.11.1.0/24               169.254.0.1 dst-ip
             10.22.1.0/24               169.254.0.2 src-ip
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:241"
$at_failed && at_fn_log_failure
$at_traceon; }


# AZ1 should still advertise and AZ2 should still learn the route
{ set +x
$as_echo "$at_srcdir/ovn-ic.at:248: ovn_as az2 ovn-nbctl lr-route-list lr2 | grep learned"
at_fn_check_prepare_notrace 'a shell pipeline' "ovn-ic.at:248"
( $at_check_trace; ovn_as az2 ovn-nbctl lr-route-list lr2 | grep learned
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo stdout:; cat "$at_stdout"
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:248"
$at_failed && at_fn_log_failure
$at_traceon; }


# Disable route-advertising for AZ1
ovn_as az1 ovn-nbctl set nb_global . options:ic-route-adv=false

# AZ2 shouldn't have the route learned, because AZ1 should have stopped
# advertising.
ovs_wait_cond () {
    if ovn_as az2 ovn-nbctl lr-route-list lr2 | grep learned; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:255" "while ovn_as az2 ovn-nbctl lr-route-list lr2 | grep learned"

{ set +x
$as_echo "$at_srcdir/ovn-ic.at:256: ovn_as az2 ovn-nbctl lr-route-list lr2"
at_fn_check_prepare_trace "ovn-ic.at:256"
( $at_check_trace; ovn_as az2 ovn-nbctl lr-route-list lr2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "IPv4 Routes
             10.11.2.0/24               169.254.0.1 dst-ip
             10.22.2.0/24               169.254.0.2 src-ip
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:256"
$at_failed && at_fn_log_failure
$at_traceon; }


# Add default route in AZ1
ovn_as az1 ovn-nbctl lr-route-add lr1 0.0.0.0/0 169.254.0.3

# Re-enable router-advertising & learn for AZ1
ovn_as az1 ovn-nbctl set nb_global . options:ic-route-adv=true
ovn_as az1 ovn-nbctl set nb_global . options:ic-route-learn=true

for i in 1 2; do
    ovs_wait_cond () {
    ovn_as az$i ovn-nbctl lr-route-list lr$i | grep learned
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:270" "until ovn_as az\$i ovn-nbctl lr-route-list lr\$i | grep learned"

done

# Default route should NOT get advertised or learned, by default.
{ set +x
$as_echo "$at_srcdir/ovn-ic.at:274: ovn_as az2 ovn-nbctl lr-route-list lr2"
at_fn_check_prepare_trace "ovn-ic.at:274"
( $at_check_trace; ovn_as az2 ovn-nbctl lr-route-list lr2
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
echo >>"$at_stdout"; $as_echo "IPv4 Routes
             10.11.1.0/24             169.254.100.1 dst-ip (learned)
             10.11.2.0/24               169.254.0.1 dst-ip
             10.22.2.0/24               169.254.0.2 src-ip
" | \
  $at_diff - "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:274"
$at_failed && at_fn_log_failure
$at_traceon; }


# Enable default route advertising in AZ1
ovn_as az1 ovn-nbctl set nb_global . options:ic-route-adv-default=true
ovs_wait_cond () {
    ovn-ic-sbctl list route | grep 0.0.0.0
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:283" "until ovn-ic-sbctl list route | grep 0.0.0.0"


# Enable default route learning in AZ2
ovn_as az2 ovn-nbctl set nb_global . options:ic-route-learn-default=true
ovs_wait_cond () {
    ovn_as az2 ovn-nbctl lr-route-list lr2 | grep learned | grep 0.0.0.0
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:287" "until ovn_as az2 ovn-nbctl lr-route-list lr2 | grep learned | grep 0.0.0.0"


# Test directly connected subnet route advertising.
ovn_as az1 ovn-nbctl lrp-add lr1 lrp-lr1-ls1 aa:aa:aa:aa:bb:01 "192.168.0.1/24"
ovs_wait_cond () {
    ovn_as az2 ovn-nbctl lr-route-list lr2 | grep learned | grep 192.168
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:291" "until ovn_as az2 ovn-nbctl lr-route-list lr2 | grep learned | grep 192.168"


# Delete the directly connected subnet from AZ1, learned route should be
# removed from AZ2.
ovn_as az1 ovn-nbctl lrp-del lrp-lr1-ls1
ovs_wait_cond () {
    if ovn_as az2 ovn-nbctl lr-route-list lr2 | grep learned | grep 192.168; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:296" "while ovn_as az2 ovn-nbctl lr-route-list lr2 | grep learned | grep 192.168"


# Test blacklist routes
# Add back the directly connected 192.168 route.
ovn_as az1 ovn-nbctl lrp-add lr1 lrp-lr1-ls1 aa:aa:aa:aa:bb:01 "192.168.0.1/24"
ovs_wait_cond () {
    ovn_as az2 ovn-nbctl lr-route-list lr2 | grep learned | grep 192.168
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:301" "until ovn_as az2 ovn-nbctl lr-route-list lr2 | grep learned | grep 192.168"

# Ensure AZ1 learned AZ2's 10.11.2.0 route as well.
ovs_wait_cond () {
    ovn_as az1 ovn-nbctl lr-route-list lr1 | grep learned | grep 10.11
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:303" "until ovn_as az1 ovn-nbctl lr-route-list lr1 | grep learned | grep 10.11"

# Now black list 10.11.0.0/16 and 192.168.0.0/16 in AZ2.
ovn_as az2 ovn-nbctl set nb_global . options:ic-route-blacklist="10.11.0.0/16,192.168.0.0/16"
# AZ2 shouldn't learn 192.168 route any more.
ovs_wait_cond () {
    if ovn_as az2 ovn-nbctl lr-route-list lr2 | grep learned | grep 192.168; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:307" "while ovn_as az2 ovn-nbctl lr-route-list lr2 | grep learned | grep 192.168"

# AZ1 shouldn't learn 10.11 any more.
ovs_wait_cond () {
    if ovn_as az1 ovn-nbctl lr-route-list lr1 | grep learned | grep 10.11; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:309" "while ovn_as az1 ovn-nbctl lr-route-list lr1 | grep learned | grep 10.11"





    as az1/ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn-ic.at:311: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-ic.at:311"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:311"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:311: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-ic.at:311"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:311"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:311" "while kill -0 \$TMPPID 2>/dev/null"


    as az1/ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn-ic.at:311: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-ic.at:311"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:311"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:311: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-ic.at:311"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:311"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:311" "while kill -0 \$TMPPID 2>/dev/null"


    as az1/northd
    { set +x
$as_echo "$at_srcdir/ovn-ic.at:311: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn-ic.at:311"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:311"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:311: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn-ic.at:311"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:311"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:311" "while kill -0 \$TMPPID 2>/dev/null"


    as az1/northd-backup
    { set +x
$as_echo "$at_srcdir/ovn-ic.at:311: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn-ic.at:311"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:311"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:311: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn-ic.at:311"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:311"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:311" "while kill -0 \$TMPPID 2>/dev/null"


    as az1/ic
    { set +x
$as_echo "$at_srcdir/ovn-ic.at:311: test -e \$OVS_RUNDIR/ovn-ic.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-ic.pid" "ovn-ic.at:311"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-ic.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:311"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-ic.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:311: ovs-appctl --timeout=10 -t ovn-ic exit"
at_fn_check_prepare_trace "ovn-ic.at:311"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-ic exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:311"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:311" "while kill -0 \$TMPPID 2>/dev/null"




    as az2/ovn-sb
    { set +x
$as_echo "$at_srcdir/ovn-ic.at:311: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-ic.at:311"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:311"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:311: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-ic.at:311"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:311"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:311" "while kill -0 \$TMPPID 2>/dev/null"


    as az2/ovn-nb
    { set +x
$as_echo "$at_srcdir/ovn-ic.at:311: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-ic.at:311"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:311"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:311: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-ic.at:311"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:311"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:311" "while kill -0 \$TMPPID 2>/dev/null"


    as az2/northd
    { set +x
$as_echo "$at_srcdir/ovn-ic.at:311: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn-ic.at:311"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:311"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:311: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn-ic.at:311"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:311"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:311" "while kill -0 \$TMPPID 2>/dev/null"


    as az2/northd-backup
    { set +x
$as_echo "$at_srcdir/ovn-ic.at:311: test -e \$OVS_RUNDIR/ovn-northd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-northd.pid" "ovn-ic.at:311"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-northd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:311"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-northd.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:311: ovs-appctl --timeout=10 -t ovn-northd exit"
at_fn_check_prepare_trace "ovn-ic.at:311"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-northd exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:311"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:311" "while kill -0 \$TMPPID 2>/dev/null"


    as az2/ic
    { set +x
$as_echo "$at_srcdir/ovn-ic.at:311: test -e \$OVS_RUNDIR/ovn-ic.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovn-ic.pid" "ovn-ic.at:311"
( $at_check_trace; test -e $OVS_RUNDIR/ovn-ic.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:311"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovn-ic.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:311: ovs-appctl --timeout=10 -t ovn-ic exit"
at_fn_check_prepare_trace "ovn-ic.at:311"
( $at_check_trace; ovs-appctl --timeout=10 -t ovn-ic exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:311"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:311" "while kill -0 \$TMPPID 2>/dev/null"



    as ovn-ic-sb
    { set +x
$as_echo "$at_srcdir/ovn-ic.at:311: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-ic.at:311"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:311"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:311: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-ic.at:311"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:311"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:311" "while kill -0 \$TMPPID 2>/dev/null"


    as ovn-ic-nb
    { set +x
$as_echo "$at_srcdir/ovn-ic.at:311: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-ic.at:311"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:311"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:311: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-ic.at:311"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:311"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:311" "while kill -0 \$TMPPID 2>/dev/null"


    if test -d "$ovs_base"/main; then

    as main
    { set +x
$as_echo "$at_srcdir/ovn-ic.at:311: test -e \$OVS_RUNDIR/ovs-vswitchd.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovs-vswitchd.pid" "ovn-ic.at:311"
( $at_check_trace; test -e $OVS_RUNDIR/ovs-vswitchd.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:311"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovs-vswitchd.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:311: ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup"
at_fn_check_prepare_trace "ovn-ic.at:311"
( $at_check_trace; ovs-appctl --timeout=10 -t ovs-vswitchd exit --cleanup
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:311"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:311" "while kill -0 \$TMPPID 2>/dev/null"

    { set +x
$as_echo "$at_srcdir/ovn-ic.at:311: test -e \$OVS_RUNDIR/ovsdb-server.pid"
at_fn_check_prepare_dynamic "test -e $OVS_RUNDIR/ovsdb-server.pid" "ovn-ic.at:311"
( $at_check_trace; test -e $OVS_RUNDIR/ovsdb-server.pid
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:311"
$at_failed && at_fn_log_failure
$at_traceon; }

   TMPPID=$(cat $OVS_RUNDIR/ovsdb-server.pid)
   { set +x
$as_echo "$at_srcdir/ovn-ic.at:311: ovs-appctl --timeout=10 -t ovsdb-server exit"
at_fn_check_prepare_trace "ovn-ic.at:311"
( $at_check_trace; ovs-appctl --timeout=10 -t ovsdb-server exit
) >>"$at_stdout" 2>>"$at_stderr" 5>&-
at_status=$? at_failed=false
$at_check_filter
at_fn_diff_devnull "$at_stderr" || at_failed=:
at_fn_diff_devnull "$at_stdout" || at_failed=:
at_fn_check_status 0 $at_status "$at_srcdir/ovn-ic.at:311"
$at_failed && at_fn_log_failure
$at_traceon; }

   ovs_wait_cond () {
    if kill -0 $TMPPID 2>/dev/null; then return 1; else return 0; fi
}
ovs_wait_failed () {
    :

}
ovs_wait "ovn-ic.at:311" "while kill -0 \$TMPPID 2>/dev/null"


    fi


ovs_cleanup
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_221
#AT_START_222
at_fn_group_banner 222 'checkpatch.at:37' \
  "checkpatch - sign-offs" "                         " 11
at_xfail=no
(
  $as_echo "222. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init


# Sign-off for single author who is also the committer.
try_checkpatch \
   "Author: A
    Commit: A

    Signed-off-by: A"
try_checkpatch \
   "Author: A
    Commit: A" \
   "ERROR: Author A needs to sign off."

# Single author but somehow the mailing list is the author.
try_checkpatch \
   "Author: Foo Bar via dev <ovs-dev@openvswitch.org>
    Commit: A

    Signed-off-by: A" \
   "ERROR: Author should not be mailing list."

# Sign-off for single author and different committer.
try_checkpatch \
   "Author: A
    Commit: B

    Signed-off-by: A
    Signed-off-by: B"
try_checkpatch \
   "Author: A
    Commit: B" \
   "ERROR: Author A needs to sign off.
    ERROR: Committer B needs to sign off."

# Sign-off for multiple authors with one author also the committer.
try_checkpatch \
   "Author: A
    Commit: A

    Signed-off-by: A
    Co-authored-by: B
    Signed-off-by: B"
try_checkpatch \
   "Author: A
    Commit: A

    Co-authored-by: B
    Signed-off-by: B" \
   "ERROR: Author A needs to sign off."
try_checkpatch \
   "Author: A
    Commit: A

    Signed-off-by: A
    Co-authored-by: B" \
   "ERROR: Co-author B needs to sign off."
try_checkpatch \
   "Author: A
    Commit: A

    Co-authored-by: B" \
   "ERROR: Author A needs to sign off.
    ERROR: Co-author B needs to sign off."

# Sign-off for multiple authors and separate committer.
try_checkpatch \
   "Author: A
    Commit: C

    Signed-off-by: A
    Co-authored-by: B
    Signed-off-by: B
    Signed-off-by: C"
try_checkpatch \
   "Author: A
    Commit: C

    Signed-off-by: A
    Co-authored-by: B
    Signed-off-by: B" \
   "ERROR: Committer C needs to sign off."

# Extra sign-offs:
#
#    - If we know the committer, one extra sign-off raises a warning.
#
#    - If we do not know the committer, two extra sign-offs raise a warning.
try_checkpatch \
   "Author: A
    Commit: C

    Signed-off-by: A
    Co-authored-by: B
    Signed-off-by: B
    Signed-off-by: C
    Signed-off-by: D" \
   "WARNING: Unexpected sign-offs from developers who are not authors or co-authors or committers: D"
try_checkpatch \
   "Author: A

    Signed-off-by: A
    Co-authored-by: B
    Signed-off-by: B
    Signed-off-by: C"
try_checkpatch \
   "Author: A

    Signed-off-by: A
    Co-authored-by: B
    Signed-off-by: B
    Signed-off-by: C
    Signed-off-by: D" \
   "WARNING: Unexpected sign-offs from developers who are not authors or co-authors or committers: C, D"

# Missing committer is OK, missing author is an error.
try_checkpatch \
   "Author: A

    Signed-off-by: A"
try_checkpatch \
   "Commit: A

    Signed-off-by: A" \
   "ERROR: Patch lacks author."

ovs_cleanup
$as_echo "$at_setup_line" >"$at_check_line_file"
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_222
#AT_START_223
at_fn_group_banner 223 'checkpatch.at:177' \
  "checkpatch - parenthesized constructs" "          " 11
at_xfail=no
(
  $as_echo "223. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

for ctr in 'if' 'while' 'switch' 'HMAP_FOR_EACH' 'BITMAP_FOR_EACH_1'; do
try_checkpatch \
   "    Author: A

    Signed-off-by: A
    ---
    diff --git a/A.c b/A.c
    index 0000000..1111111 100644
    --- a/A.c
    +++ b/A.c
    @@ -1,1 +1,1 @@
    +     $ctr (first_run) {
    "

try_checkpatch \
   "    Author: A

    Signed-off-by: A
    ---
    diff --git a/A.c b/A.c
    index 0000000..1111111 100644
    --- a/A.c
    +++ b/A.c
    @@ -1,1 +1,1 @@
    +     $ctr ( first_run) {
    " \
    "ERROR: Improper whitespace around control block
    #8 FILE: A.c:1:
         $ctr ( first_run) {
"

try_checkpatch \
   "    Author: A

    Signed-off-by: A
    ---
    diff --git a/A.c b/A.c
    index 0000000..1111111 100644
    --- a/A.c
    +++ b/A.c
    @@ -1,1 +1,1 @@
    +     $ctr (first_run ) {
    " \
    "ERROR: Inappropriate bracing around statement
    #8 FILE: A.c:1:
         $ctr (first_run ) {
"

try_checkpatch \
   "    Author: A

    Signed-off-by: A
    ---
    diff --git a/A.c b/A.c
    index 0000000..1111111 100644
    --- a/A.c
    +++ b/A.c
    @@ -1,1 +1,1 @@
    +     $ctr (first_run)
    " \
    "ERROR: Inappropriate bracing around statement
    #8 FILE: A.c:1:
         $ctr (first_run)
"

try_checkpatch \
   "    Author: A

    Signed-off-by: A
    ---
    diff --git a/A.c b/A.c
    index 0000000..1111111 100644
    --- a/A.c
    +++ b/A.c
    @@ -1,1 +1,1 @@
    +     $ctr(first_run)
    " \
    "ERROR: Improper whitespace around control block
    #8 FILE: A.c:1:
         $ctr(first_run)
"

try_checkpatch \
   "    Author: A

    Signed-off-by: A
    ---
    diff --git a/A.c b/A.c
    index 0000000..1111111 100644
    --- a/A.c
    +++ b/A.c
    @@ -1,1 +1,1 @@
    +     $ctr (first_run) { /* foo */
    "

try_checkpatch \
   "    Author: A

    Signed-off-by: A
    ---
    diff --git a/A.c b/A.c
    index 0000000..1111111 100644
    --- a/A.c
    +++ b/A.c
    @@ -1,1 +1,1 @@
    +     $ctr (first_run) { \\
    "

try_checkpatch \
   "    Author: A

    Signed-off-by: A
    ---
    diff --git a/A.c b/A.c
    index 0000000..1111111 100644
    --- a/A.c
    +++ b/A.c
    @@ -1,1 +1,1 @@
    +     $ctr (a) {    \\
    "
done
ovs_cleanup
$as_echo "$at_setup_line" >"$at_check_line_file"
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_223
#AT_START_224
at_fn_group_banner 224 'checkpatch.at:238' \
  "checkpatch - parenthesized constructs - for" "    " 11
at_xfail=no
(
  $as_echo "224. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

try_checkpatch \
   "    Author: A

    Signed-off-by: A
    ---
    diff --git a/A.c b/A.c
    index 0000000..1111111 100644
    --- a/A.c
    +++ b/A.c
    @@ -1,1 +1,1 @@
    +     for (init; condition; increment) {
    "

try_checkpatch \
   "    Author: A

    Signed-off-by: A
    ---
    diff --git a/A.c b/A.c
    index 0000000..1111111 100644
    --- a/A.c
    +++ b/A.c
    @@ -1,1 +1,1 @@
    +     for ( init; condition; increment) {
    " \
    "ERROR: Improper whitespace around control block
    #8 FILE: A.c:1:
         for ( init; condition; increment) {
"

try_checkpatch \
   "    Author: A

    Signed-off-by: A
    ---
    diff --git a/A.c b/A.c
    index 0000000..1111111 100644
    --- a/A.c
    +++ b/A.c
    @@ -1,1 +1,1 @@
    +     for (init; condition; increment ) {
    " \
    "ERROR: Inappropriate bracing around statement
    #8 FILE: A.c:1:
         for (init; condition; increment ) {
"

try_checkpatch \
   "    Author: A

    Signed-off-by: A
    ---
    diff --git a/A.c b/A.c
    index 0000000..1111111 100644
    --- a/A.c
    +++ b/A.c
    @@ -1,1 +1,1 @@
    +     for (init; condition; increment)
    " \
    "ERROR: Inappropriate bracing around statement
    #8 FILE: A.c:1:
         for (init; condition; increment)
"

try_checkpatch \
   "    Author: A

    Signed-off-by: A
    ---
    diff --git a/A.c b/A.c
    index 0000000..1111111 100644
    --- a/A.c
    +++ b/A.c
    @@ -1,1 +1,1 @@
    +     for(init; condition; increment)
    " \
    "ERROR: Improper whitespace around control block
    #8 FILE: A.c:1:
         for(init; condition; increment)
"

try_checkpatch \
   "    Author: A

    Signed-off-by: A
    ---
    diff --git a/A.c b/A.c
    index 0000000..1111111 100644
    --- a/A.c
    +++ b/A.c
    @@ -1,1 +1,1 @@
    +     for (init; condition; increment) { /* foo */
    "

try_checkpatch \
   "    Author: A

    Signed-off-by: A
    ---
    diff --git a/A.c b/A.c
    index 0000000..1111111 100644
    --- a/A.c
    +++ b/A.c
    @@ -1,1 +1,1 @@
    +     for (init; condition; increment) { \\
    "

ovs_cleanup
$as_echo "$at_setup_line" >"$at_check_line_file"
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_224
#AT_START_225
at_fn_group_banner 225 'checkpatch.at:293' \
  "checkpatch - comments" "                          " 11
at_xfail=no
(
  $as_echo "225. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

try_checkpatch \
   "    Author: A

    Signed-off-by: A
    ---
    diff --git a/A.c b/A.c
    index 0000000..1111111 100644
    --- a/A.c
    +++ b/A.c
    @@ -1,1 +1,1 @@
    +     a = 1; /* C style comment. */
    "

try_checkpatch \
   "    Author: A

    Signed-off-by: A
    ---
    diff --git a/A.c b/A.c
    index 0000000..1111111 100644
    --- a/A.c
    +++ b/A.c
    @@ -1,1 +1,1 @@
    +     /* http://URL/inside/the/comment.html */
    "

try_checkpatch \
   "    Author: A

    Signed-off-by: A
    ---
    diff --git a/A.c b/A.c
    index 0000000..1111111 100644
    --- a/A.c
    +++ b/A.c
    @@ -1,1 +1,1 @@
    +     a = 1; // C99 style comment.
    " \
    "ERROR: C99 style comment
    #8 FILE: A.c:1:
         a = 1; // C99 style comment.
"

ovs_cleanup
$as_echo "$at_setup_line" >"$at_check_line_file"
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_225
#AT_START_226
at_fn_group_banner 226 'checkpatch.at:315' \
  "checkpatch - whitespace around operator" "        " 11
at_xfail=no
(
  $as_echo "226. $at_setup_line: testing $at_desc ..."
  $at_traceon

ovs_init

try_checkpatch \
   "    Author: A

    Signed-off-by: A
    ---
    diff --git a/A.c b/A.c
    index 0000000..1111111 100644
    --- a/A.c
    +++ b/A.c
    @@ -1,1 +1,1 @@
    +     if (--mcs->n_refs == 0) {
    "

try_checkpatch \
   "    Author: A

    Signed-off-by: A
    ---
    diff --git a/A.c b/A.c
    index 0000000..1111111 100644
    --- a/A.c
    +++ b/A.c
    @@ -1,1 +1,1 @@
    +     if (--mcs->n_refs==0) {
    " \
    "WARNING: Line lacks whitespace around operator
    WARNING: Line lacks whitespace around operator
    #8 FILE: A.c:1:
         if (--mcs->n_refs==0) {
"

ovs_cleanup
$as_echo "$at_setup_line" >"$at_check_line_file"
  set +x
  $at_times_p && times >"$at_times_file"
) 5>&1 2>&1 7>&- | eval $at_tee_pipe
read at_status <"$at_status_file"
#AT_STOP_226
