Skip to content

Commit

Permalink
Add virtual switch mlnx/brcm SAI tests (sonic-net#200)
Browse files Browse the repository at this point in the history
  • Loading branch information
kcudnik authored Jul 27, 2017
1 parent 2d632b6 commit bfdd383
Show file tree
Hide file tree
Showing 28 changed files with 258,119 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
@@ -1 +1 @@
SUBDIRS = meta lib vslib syncd saiplayer saidump
SUBDIRS = meta lib vslib syncd saiplayer saidump saidiscovery tests
3 changes: 2 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,5 @@ AC_OUTPUT(Makefile
syncd/Makefile
saiplayer/Makefile
saidump/Makefile
saidiscovery/Makefile)
saidiscovery/Makefile
tests/Makefile)
24 changes: 24 additions & 0 deletions tests/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
AM_CPPFLAGS = -I$(top_srcdir)/vslib/inc -I$(top_srcdir)/lib/inc -I$(top_srcdir)/SAI/inc -I$(top_srcdir)/SAI/meta

bin_PROGRAMS = vssyncd

if DEBUG
DBGFLAGS = -ggdb -DDEBUG
else
DBGFLAGS = -g
endif

SAILIB=-L$(top_srcdir)/vslib/src/.libs -lsaivs

vssyncd_SOURCES = \
../syncd/syncd.cpp \
../syncd/syncd_saiswitch.cpp \
../syncd/syncd_hard_reinit.cpp \
../syncd/syncd_notifications.cpp \
../syncd/syncd_counters.cpp \
../syncd/syncd_applyview.cpp

vssyncd_CPPFLAGS = $(DBGFLAGS) $(AM_CPPFLAGS) $(CFLAGS_COMMON) $(SAIFLAGS)
vssyncd_LDADD = -lhiredis -lswsscommon $(SAILIB) -lpthread -L$(top_srcdir)/meta/.libs -lsaimetadata -lsaimeta -ldl

TESTS = mlnx.pl brcm.pl
193 changes: 193 additions & 0 deletions tests/brcm.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
#!/usr/bin/perl

use strict;
use warnings;
use diagnostics;

use utils;

sub test_brcm_start_empty
{
fresh_start;

play "empty_sw.rec";
}

sub test_brcm_start_empty_to_empty
{
fresh_start;

play "empty_sw.rec";
play "empty_sw.rec";
}

sub test_brcm_full
{
fresh_start;

play "full.rec";
}

sub test_brcm_full_to_empty
{
fresh_start;

play "full.rec";
play "empty_sw.rec";
}

sub test_brcm_empty_to_full
{
fresh_start;

play "empty_sw.rec";
play "full.rec";
}

sub test_brcm_empty_restart_to_full
{
fresh_start;

play "empty_sw.rec";

kill_syncd;
start_syncd;

play "full.rec";
}

sub test_brcm_empty_to_full_to_empty_to_full_to_full
{
fresh_start;

play "empty_sw.rec";
play "full.rec";
play "empty_sw.rec";
play "full_second.rec";
play "full_second.rec";
}

sub test_brcm_full_to_full
{
fresh_start;

play "full.rec";
play "full_second.rec";
}

sub test_brcm_full_to_full_no_bridge
{
fresh_start;

play "full.rec";
play "full_second_no_bridge.rec";
}

sub test_brcm_full_to_full_no_bridge_restart
{
fresh_start;

play "full.rec";
play "full_second_no_bridge.rec";

kill_syncd;
start_syncd;

play "full_second_no_bridge.rec";
}

sub test_brcm_empty_to_full_to_empty
{
fresh_start;

play "empty_sw.rec";
play "full.rec";
play "empty_sw.rec";
}

sub test_brcm_empty_to_full_nhg_bug
{
fresh_start;

play "empty_sw.rec";
play "full_nhg_bug.rec";
}

sub test_brcm_empty_to_full_prio_flow_bug
{
fresh_start;

play "empty_sw.rec";
play "full_nhg_bug_prio_flow_bug.rec";
}

sub test_brcm_empty_to_full_trap_group_bug
{
fresh_start;

play "empty_sw.rec";
play "full_nhg_bug_trap_group_create_fail.rec";
}

sub test_brcm_queue_bug_null_buffer_profile
{
fresh_start;

play "full_queue_bug_null_buffer_profile.rec";
play "empty_sw.rec";
}

sub test_brcm_full_to_empty_no_queue
{
fresh_start;

play "full_no_queue.rec";
play "empty_sw.rec";
}

sub test_brcm_full_to_empty_no_queue_no_ipg
{
fresh_start;

play "full_no_queue_no_ipg.rec";
play "empty_sw.rec";
}

sub test_brcm_full_to_empty_hostif_remove_segfault
{
fresh_start;

play "full_hostif_remove_segfault.rec";
play "empty_sw.rec";
}

sub test_brcm_full_to_empty_no_queue_no_ipg_no_buffer_profile
{
fresh_start;

play "full_no_queue_no_ipg_no_buffer_pfofile.rec";
play "empty_sw.rec";
}


# RUN TESTS

test_brcm_start_empty;
test_brcm_start_empty_to_empty;
test_brcm_full;
test_brcm_full_to_empty;
test_brcm_empty_to_full;
test_brcm_empty_restart_to_full;
test_brcm_empty_to_full_to_empty_to_full_to_full;
test_brcm_full_to_full;
test_brcm_full_to_full_no_bridge;
test_brcm_full_to_full_no_bridge_restart;
test_brcm_empty_to_full_to_empty;
test_brcm_empty_to_full_nhg_bug;
test_brcm_empty_to_full_prio_flow_bug;
test_brcm_empty_to_full_trap_group_bug;
test_brcm_queue_bug_null_buffer_profile;
test_brcm_full_to_empty_no_queue;
test_brcm_full_to_empty_no_queue_no_ipg;
test_brcm_full_to_empty_hostif_remove_segfault;
test_brcm_full_to_empty_no_queue_no_ipg_no_buffer_profile;
7 changes: 7 additions & 0 deletions tests/brcm/empty_sw.rec
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
2017-05-13.20:47:13.432144|#|recording to: sairedis.2017-05-13.20:47:13.431964.rec
2017-05-13.20:47:13.435733|a|INIT_VIEW
2017-05-13.20:47:13.439887|A|SAI_STATUS_SUCCESS
2017-05-13.20:47:13.443079|c|SAI_OBJECT_TYPE_SWITCH:oid:0x21000000000000|SAI_SWITCH_ATTR_INIT_SWITCH=true
2017-06-14.01:55:46.558259|s|SAI_OBJECT_TYPE_SWITCH:oid:0x21000000000000|SAI_SWITCH_ATTR_SRC_MAC_ADDRESS=00:11:11:11:11:11
2017-05-13.20:47:24.881973|a|APPLY_VIEW
2017-05-13.20:47:24.883499|A|SAI_STATUS_SUCCESS
Loading

0 comments on commit bfdd383

Please sign in to comment.