summaryrefslogtreecommitdiff
path: root/cesar
diff options
context:
space:
mode:
Diffstat (limited to 'cesar')
-rw-r--r--cesar/cl/cl.h6
-rw-r--r--cesar/cl/src/cl.c84
-rw-r--r--cesar/cl/test/utest/Config1
-rw-r--r--cesar/cl/test/utest/Makefile1
-rw-r--r--cesar/cl/test/utest/src/misc.c47
-rw-r--r--cesar/common/tests/Makefile31
-rwxr-xr-xcesar/common/tests/get-cov.pl50
-rwxr-xr-xcesar/common/tests/run-test.pl235
-rw-r--r--cesar/common/tests/tests567
-rwxr-xr-xcesar/common/tools/build-info3
-rw-r--r--cesar/common/tools/traceviewer/annotate/cpu.py20
-rw-r--r--cesar/common/tools/traceviewer/gui.py35
-rw-r--r--cesar/common/tools/traceviewer/trace_view.py61
-rw-r--r--cesar/cp/sta/action/Config1
-rw-r--r--cesar/cp/sta/action/src/misc.c3
-rw-r--r--cesar/hal/phy/inc/phy_params.txt4
-rw-r--r--cesar/mac/common/mfs.h2
-rw-r--r--cesar/mac/common/src/mfs.c1
-rw-r--r--cesar/mac/pbproc/src/prep_mpdu.c22
-rw-r--r--cesar/mac/pbproc/test/pbproc/src/prep_mpdu.c83
-rw-r--r--cesar/maximus/coreengine/src/Maximus.cpp1
-rw-r--r--cesar/maximus/python/lib/cesar/defineparser.py38
-rw-r--r--cesar/maximus/python/lib/cesar/own_data.py5
-rw-r--r--cesar/maximus/python/lib/cesar/sniffer.py135
-rw-r--r--cesar/maximus/python/tools/csi/csiavln.py48
-rw-r--r--cesar/maximus/python/tools/csi/csicore.py116
-rw-r--r--cesar/maximus/python/tools/csi/csistation.py9
-rw-r--r--cesar/test_general/station/cco0/s1/Config2
-rw-r--r--cesar/test_general/station/cco0/s1/Makefile14
-rw-r--r--cesar/test_general/station/cco0/s1/doc/Makefile29
-rw-r--r--cesar/test_general/station/cco0/s1/doc/scenario_1.msc11
-rw-r--r--cesar/test_general/station/cco0/s1/doc/scenario_2.msc17
-rw-r--r--cesar/test_general/station/cco0/s1/doc/scenario_3.msc22
-rw-r--r--cesar/test_general/station/cco0/s1/doc/scenario_4.msc19
-rw-r--r--cesar/test_general/station/cco0/s1/doc/scenario_5.msc20
-rw-r--r--cesar/test_general/station/cco0/s1/doc/scenario_6.msc24
-rw-r--r--cesar/test_general/station/cco0/s1/doc/scenario_7.msc33
-rw-r--r--cesar/test_general/station/cco0/s1/doc/scenario_8.msc37
-rw-r--r--cesar/test_general/station/cco0/s1/doc/test-plan.txt106
-rw-r--r--cesar/test_general/station/cco0/s1/py/cm_unassociated_sta.py160
-rw-r--r--cesar/test_general/station/cco0/s1/py/init.py90
-rw-r--r--cesar/test_general/station/cco0/s1/py/sc10_two_sta_with_snr.py187
-rw-r--r--cesar/test_general/station/cco0/s1/py/sc11_three_sta_one_deactivate.py275
-rw-r--r--cesar/test_general/station/cco0/s1/py/sc12_five_stations.py58
-rw-r--r--cesar/test_general/station/cco0/s1/py/sc13_10stations.py73
-rw-r--r--cesar/test_general/station/cco0/s1/py/sc14_discover_beacon.py86
-rw-r--r--cesar/test_general/station/cco0/s1/py/sc15_full_traffic_two_sta.py61
-rw-r--r--cesar/test_general/station/cco0/s1/py/sc1_one_sta_mac_start.py111
-rw-r--r--cesar/test_general/station/cco0/s1/py/sc1_one_sta_mac_start_cco_pref.py110
-rw-r--r--cesar/test_general/station/cco0/s1/py/sc2_two_sta_assoc.py90
-rw-r--r--cesar/test_general/station/cco0/s1/py/sc2_two_sta_assoc_one_cco_pref.py94
-rw-r--r--cesar/test_general/station/cco0/s1/py/sc3_two_sta_communication.py53
-rw-r--r--cesar/test_general/station/cco0/s1/py/sc4_cc_who_ru.py76
-rw-r--r--cesar/test_general/station/cco0/s1/py/sc5_cc_leave.py76
-rw-r--r--cesar/test_general/station/cco0/s1/py/sc6_three_sta_assoc.py175
-rw-r--r--cesar/test_general/station/cco0/s1/py/sc7_three_sta_communication.py369
-rw-r--r--cesar/test_general/station/cco0/s1/py/sc8_three_sta_one_leaving.py76
-rw-r--r--cesar/test_general/station/cco0/s1/py/sc9_cco_leaving.py90
-rw-r--r--cesar/test_general/station/cco0/s2/Config3
-rw-r--r--cesar/test_general/station/cco0/s2/Makefile14
-rw-r--r--cesar/test_general/station/cco0/s2/doc/Makefile13
-rw-r--r--cesar/test_general/station/cco0/s2/doc/sc02_five_station.diabin2568 -> 0 bytes
-rw-r--r--cesar/test_general/station/cco0/s2/ecos.ecc.sh5
-rw-r--r--cesar/test_general/station/cco0/s2/py/sc01_bridge.py231
-rw-r--r--cesar/test_general/station/cco0/s2/py/sc02_five_stations.py82
-rw-r--r--cesar/test_general/station/cco0/s2/py/sc03_ten_stations.py88
-rw-r--r--cesar/test_general/station/cco0/s2/py/sc04_change_snid.py87
-rw-r--r--cesar/test_general/station/cco0/s2/py/sc05_change_hm.py91
-rw-r--r--cesar/test_general/station/cco0/s2/py/sc06_snid_conflict.py110
-rw-r--r--cesar/test_general/station/cco0/s2/py/sc07_handover.py86
-rw-r--r--cesar/test_general/station/cco0/s2/py/sc08_sc_avln_already_exist_one_sc_join.py122
-rw-r--r--cesar/test_general/station/cco0/s2/py/sc08_sc_one_sc_join_one_sc_add.py91
-rw-r--r--cesar/test_general/station/cco0/s2/py/sc08_sc_two_sc_join.py75
-rw-r--r--cesar/test_general/station/cco0/s2/py/sc09_Vendor_Specific_mme.py423
-rw-r--r--cesar/test_general/station/cco0/s2/py/sc10_short_messages.py47
-rw-r--r--cesar/test_general/station/cco0/s2/py/sc11_one_sta_stats.py147
-rw-r--r--cesar/test_general/station/cco0/s2/py/sc12_cm_nw_info.py167
-rw-r--r--cesar/test_general/station/cco0/s2/py/sc13_cm_nw_stats.py173
-rw-r--r--cesar/test_general/station/cco0/s2/py/sc14_change_nek.py156
-rw-r--r--cesar/test_general/station/cco0/s2/py/sc15_two_avlns.py89
-rw-r--r--cesar/test_general/station/cco0/s2/py/sc16_igmp.py210
-rw-r--r--cesar/test_general/station/cco0/s2/py/sc17_change_nmk.py160
-rw-r--r--cesar/test_general/station/cco0/s2/py/sc18_change_nmk_cco_first_and_after_sta.py104
-rw-r--r--cesar/test_general/station/fcall/src/beacon.c20
-rw-r--r--cesar/test_general/station/scenario/Makefile25
-rw-r--r--cesar/test_general/station/scenario/ecos.ecc.sh (renamed from cesar/test_general/station/cco0/s1/ecos.ecc.sh)0
-rw-r--r--cesar/test_general/station/scenario/lib/association_protocol.py38
-rw-r--r--cesar/test_general/station/scenario/lib/handover_protocol.py26
-rw-r--r--cesar/test_general/station/scenario/py/sc01_assoc_auth.py92
-rw-r--r--cesar/test_general/station/scenario/py/sc02_stas_communication.py52
-rw-r--r--cesar/test_general/station/scenario/py/sc03_two_avln_coexisting.py128
-rw-r--r--cesar/test_general/station/scenario/py/sc04_cc_whoru.py83
-rw-r--r--cesar/test_general/station/scenario/py/sc05_cc_leave.py133
-rw-r--r--cesar/test_general/station/scenario/py/sc06_discover_procedure.py61
-rw-r--r--cesar/test_general/station/scenario/py/sc07_bridge.py109
-rw-r--r--cesar/test_general/station/scenario/py/sc08_bentry_change.py291
-rw-r--r--cesar/test_general/station/scenario/py/sc09_simple_connect.py232
-rw-r--r--cesar/test_general/station/scenario/py/sc10_short_messages.py40
-rw-r--r--cesar/test_general/station/scenario/py/sc11_cm_nw_info.py92
-rw-r--r--cesar/test_general/station/scenario/py/sc12_change_nmk.py331
-rw-r--r--cesar/test_general/station/scenario/py/sc14_igmp.py95
-rw-r--r--cesar/test_general/station/scenario/py/scenario_init.py287
-rw-r--r--cesar/test_general/station/scenario/py/testtemplate.py42
-rw-r--r--cesar/test_general/station/scenario/testbook.py78
104 files changed, 2662 insertions, 6620 deletions
diff --git a/cesar/cl/cl.h b/cesar/cl/cl.h
index ce7831b78f..931092cb2f 100644
--- a/cesar/cl/cl.h
+++ b/cesar/cl/cl.h
@@ -21,6 +21,12 @@
#include "mac/sar/sar.h"
#include "common/defs/igmp.h"
+#if MODULE_INCLUDED (cl)
+# include "config/cl.h"
+#else
+# define CONFIG_CL_DATARATE 0
+#endif
+
/** forward declaration. */
typedef struct cl_t cl_t;
typedef struct cl_send_t cl_send_t;
diff --git a/cesar/cl/src/cl.c b/cesar/cl/src/cl.c
index 11d721149f..39d4c1d12c 100644
--- a/cesar/cl/src/cl.c
+++ b/cesar/cl/src/cl.c
@@ -17,7 +17,6 @@
#include "lib/bitstream.h"
#include "lib/seq_check.h"
-#include "config/cl.h"
#include "cl/cl.h"
#include "cl/data_rate.h"
#include "mac/sar/sar.h"
@@ -80,6 +79,10 @@ cl_classifer_get_lid_ (cl_t *ctx, uint tei, uint tag,
static uint lid_table[] = { 1, 0, 0, 1, 2, 2, 3, 3 };
uint lid;
+ dbg_assert (ctx);
+ dbg_assert (bcast);
+ dbg_assert (acs);
+ dbg_assert (drop);
dbg_assert (tag < COUNT (lid_table));
if (tei == MAC_TEI_BCAST)
@@ -115,6 +118,31 @@ cl_classifer_get_lid (cl_t *ctx, uint tei, uint tag,
dbg_assert (drop);
return cl_classifer_get_lid_ (ctx, tei, tag,bcast, acs, drop);
}
+
+/**
+ * Compute the data rate for a station based on the TEI.
+ * \param ctx CL context.
+ * \param mfs the MFS used for the transmission or reception.
+ * \param length the data length.
+ */
+PRIVATE void
+cl_compute_datarate_on_sta (cl_t *ctx, mfs_t *mfs, uint length)
+{
+#if CONFIG_CL_DATA_RATE
+ if (MAC_TEI_IS_STA (mfs->common.tei))
+ {
+ sta_t *sta = mac_store_sta_get (ctx->mac_store, mfs->common.tei);
+ if (sta)
+ {
+ data_rate_update_info (
+ mfs->common.tx ? &sta->tx_data_rate : &sta->rx_data_rate,
+ length);
+ blk_release (sta);
+ }
+ }
+#endif
+}
+
/**
* Send a data once the TEI has been find.
*
@@ -190,19 +218,7 @@ cl_data_send_with_tei (cl_t *ctx, u8 *buffer, uint length, uint tei,
ctx->data_send_link.tag = tag;
sar_msdu_add (ctx->sar, buffer, length, mfs, cl_data,
arrival_time_ntb);
-
- /* update data rate informations associated to the TX
- * from the local sta to the associated sta */
-
- if (MAC_TEI_IS_STA (tei) && CONFIG_CL_DATA_RATE)
- {
- sta_t * sta = mac_store_sta_get (ctx->mac_store, tei);
- if (sta)
- {
- data_rate_update_info (&(sta->tx_data_rate), length);
- blk_release (sta);
- }
- }
+ cl_compute_datarate_on_sta (ctx, PARENT_OF (mfs_t, tx, mfs), length);
}
else
{
@@ -610,18 +626,8 @@ cl_send_multiunicast (cl_t *ctx, u8 *buffer, uint length, bool mme, uint tag,
slab_addref (cl_data);
sar_msdu_add (ctx->sar, buffer, length, mfs, cl_data,
arrival_time_ntb);
-
- /* update data rate informations associated to the TX
- * from the local sta to the associated sta */
- if (CONFIG_CL_DATA_RATE)
- {
- sta = mac_store_sta_get (ctx->mac_store, tei);
- if (sta)
- {
- data_rate_update_info (&(sta->tx_data_rate), length);
- blk_release (sta);
- }
- }
+ cl_compute_datarate_on_sta (
+ ctx, PARENT_OF (mfs_t, tx, mfs), length);
}
else
{
@@ -750,9 +756,13 @@ cl_data_send (cl_t *ctx, u8 *buffer, uint length, uint tag,
(*ctx->data_tx.cb) (ctx->data_tx.user, buffer);
else
#endif
+ {
sar_msdu_add (ctx->sar, buffer, length,
ctx->data_send_link.mfs, NULL,
arrival_time_ntb);
+ cl_compute_datarate_on_sta (
+ ctx, PARENT_OF (mfs_t, tx, ctx->data_send_link.mfs), length);
+ }
}
else
{
@@ -1001,8 +1011,6 @@ void cl_data_recv_init (cl_t *cl, cl_data_recv_cb_t cb, void *user)
*/
void cl_data_recv (cl_t *ctx, u8 *buffer, uint length, mfs_rx_t *mfs)
{
- uint tei;
-
dbg_assert (ctx);
dbg_assert (buffer);
dbg_assert ((length >= ETH_PACKET_MIN_SIZE_ALLOWED)
@@ -1021,26 +1029,16 @@ void cl_data_recv (cl_t *ctx, u8 *buffer, uint length, mfs_rx_t *mfs)
#if !CONFIG_CL_EOC_ROUTE
cl_brg_rx_add (ctx, smac, mfs->common.tei);
-#endif
- /* update data rate informations associated to the RX
- * from the associated sta to the local sta */
- tei = mfs->common.tei;
-#if CONFIG_CL_EOC_ROUTE
+#else
bool ok = true;
if (MAC_TEI_IS_EOC_CCO(ctx->mac_config->tei))
- ok = cl_eoc_mactotei_entry_insert (ctx, smac, tei);
+ ok = cl_eoc_mactotei_entry_insert (ctx, smac, mfs->common.tei);
dbg_assert (ok);
#endif
- if (MAC_TEI_IS_STA (tei) && CONFIG_CL_DATA_RATE)
- {
- sta_t * sta = mac_store_sta_get (ctx->mac_store, tei);
- if (sta)
- {
- data_rate_update_info(&(sta->rx_data_rate), length);
- blk_release (sta);
- }
- }
+ /* update data rate informations associated to the RX
+ * from the associated sta to the local sta */
+ cl_compute_datarate_on_sta (ctx, PARENT_OF (mfs_t, rx, mfs), length);
/* Debug info. */
GPIO_TOGGLE (LED_CL_RX);
}
diff --git a/cesar/cl/test/utest/Config b/cesar/cl/test/utest/Config
index 2c7c85cbed..7f25c115f1 100644
--- a/cesar/cl/test/utest/Config
+++ b/cesar/cl/test/utest/Config
@@ -1,2 +1,3 @@
CONFIG_DEBUG_FATAL_CATCH = y
CONFIG_TRACE = y
+CONFIG_CL_DATA_RATE = y
diff --git a/cesar/cl/test/utest/Makefile b/cesar/cl/test/utest/Makefile
index 959c0fd9fc..c68a702408 100644
--- a/cesar/cl/test/utest/Makefile
+++ b/cesar/cl/test/utest/Makefile
@@ -1,5 +1,6 @@
BASE = ../../..
+DEFS = -DNO_PRIVATE
HOST_PROGRAMS = cl
cl_SOURCES = cl.c test.c send.c receive.c misc.c brg_rx.c
diff --git a/cesar/cl/test/utest/src/misc.c b/cesar/cl/test/utest/src/misc.c
index 401d834445..dda06ac235 100644
--- a/cesar/cl/test/utest/src/misc.c
+++ b/cesar/cl/test/utest/src/misc.c
@@ -23,6 +23,9 @@ cl_classifer_get_lid (cl_t *ctx, uint tei, uint tag,
bool *drop);
void
+cl_compute_datarate_on_sta (cl_t *ctx, mfs_t *mfs, uint length);
+
+void
cl_test_case__classifier (test_t test)
{
test_case_begin (test, "Testing the Classifier");
@@ -296,10 +299,54 @@ cl_test_case__cl_update_igmp_groups (test_t test)
}
void
+cl_test_case__cl_compute_datarate_on_sta_mfs (test_t test, cl_test_t *ctx,
+ mfs_t *mfs)
+{
+ uint i;
+ test_within (test);
+ for (i = 0; i < 100; i++)
+ {
+ cl_compute_datarate_on_sta (ctx->cl, mfs, 1500);
+ }
+ sta_t *sta = mac_store_sta_get (ctx->mac_store, mfs->common.tei);
+ test_fail_unless (sta);
+ test_fail_unless (mfs->common.tx ? sta->tx_data_rate.data_rate :
+ sta->rx_data_rate.data_rate == i*1500);
+ blk_release (sta);
+}
+
+void
+cl_test_case__cl_compute_datarate_on_sta (test_t test)
+{
+ test_case_begin (test, "Data rate");
+ cl_test_t ctx;
+ cl_test_init (&ctx, 0x4354);
+ test_begin (test, "TX/RX")
+ {
+ uint i;
+ bool iter[] = {false, true};
+ for (i = 0; i < COUNT (iter); i++)
+ {
+ bool added;
+ mfs_t *mfs = mac_store_mfs_add (
+ ctx.mac_store, iter[i], false, false, 1, 1, &added);
+ test_fail_unless (added);
+ cl_test_case__cl_compute_datarate_on_sta_mfs (test, &ctx, mfs);
+ mac_store_mfs_remove (ctx.mac_store, mfs);
+ dbg_check (mac_store_sta_remove (ctx.mac_store, 1));
+ blk_release (mfs);
+ }
+ }
+ test_end;
+ cl_test_uninit (&ctx);
+}
+
+void
cl_test_suite_misc (test_t test)
{
test_suite_begin (test, "CL miscellaneous");
cl_test_case__classifier (test);
cl_test_case__mactotei_test_api_copy_tag_and_tei (test);
cl_test_case__cl_update_igmp_groups (test);
+ cl_test_case__cl_compute_datarate_on_sta (test);
}
diff --git a/cesar/common/tests/Makefile b/cesar/common/tests/Makefile
deleted file mode 100644
index 2295421607..0000000000
--- a/cesar/common/tests/Makefile
+++ /dev/null
@@ -1,31 +0,0 @@
-BASE = ../..
-RUN_TEST = run-test.pl
-GET_COV = get-cov.pl
-COVERAGE_OUTPUT = coverage
-COVERAGE_TITLE = Cesar
-
-all: tests.all.brief tests.all.result
-
-.PHONY: tests.all
-
-tests.all: tests $(RUN_TEST)
- -perl $(RUN_TEST) $(BASE) < $< > $@ 2>&1
-
-clean: tests.clean
- rm -f tests.all.brief tests.all tests.clean
-
-.PHONY: tests.clean
-
-tests.clean: tests $(RUN_TEST)
- perl $(RUN_TEST) -I clean $(BASE) < $< > $@ 2>&1
-
-%.brief: %
- grep '^==' < $< > $@
-
-%.result: %.brief
- grep '^===' < $<
-
-.PHONY: cov
-
-cov: tests $(GET_COV)
- genhtml -q -t $(COVERAGE_TITLE) -o $(COVERAGE_OUTPUT) -s $$(perl $(GET_COV) $(BASE) < $<)
diff --git a/cesar/common/tests/get-cov.pl b/cesar/common/tests/get-cov.pl
deleted file mode 100755
index 273db8509c..0000000000
--- a/cesar/common/tests/get-cov.pl
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/usr/bin/perl
-#
-# Get the list of coverage trace files.
-#
-use strict;
-use warnings;
-
-my $base = shift @ARGV;
-my $dir;
-my $fail = 0;
-
-# Return truth if the given info file contains at least one trace
-# information.
-sub not_empty
-{
- my $f = shift;
- open FILE, "<$f" or die;
- while (<FILE>)
- {
- if (/^SF:/)
- {
- close FILE;
- return 1;
- }
- }
- close FILE;
- return 0;
-}
-
-# Read tests file.
-while (<STDIN>)
-{
- chomp;
- # Drop comments.
- next if /^\s*(?:#.*)?$/;
- if (/^(.*):(:)?$/)
- {
- # Directory line.
- $dir = $1;
- -d "$base/$dir"
- or die "cannot change directory";
- }
- elsif (/^cov.*? (.*?): .*$/)
- {
- # Coverage test line.
- my $f = "$base/$dir/obj/$1.info";
- -f $f && not_empty ($f)
- and print "$f\n";
- }
-}
diff --git a/cesar/common/tests/run-test.pl b/cesar/common/tests/run-test.pl
deleted file mode 100755
index 04c1bfed62..0000000000
--- a/cesar/common/tests/run-test.pl
+++ /dev/null
@@ -1,235 +0,0 @@
-#!/usr/bin/perl
-#
-# Run all defined tests.
-#
-use strict;
-use warnings;
-use Cwd;
-use Getopt::Long qw(:config no_ignore_case bundling);
-use Pod::Usage;
-
-# Option parsing.
-my $help;
-my $timeout = 5 * 60;
-my @include;
-my @exclude;
-my @include_dir;
-GetOptions (
- 'help|h' => \$help,
- 'timeout|t=i' => \$timeout,
- 'include|I=s' => \@include,
- 'exclude|X=s' => \@exclude,
- 'directory|d=s' => \@include_dir,
-) or pod2usage (2);
-pod2usage (1) if $help;
-
-@ARGV == 1 or pod2usage (2);
-
-my $base = getcwd . '/' . shift @ARGV;
-
-my %include;
-@include{@include} = ();
-my %exclude;
-@exclude{@exclude} = ();
-
-# Initialise signal number to name table.
-use Config;
-my @signame;
-my %signum;;
-my $i = 0;
-defined $Config{sig_name} || die "No sigs?";
-foreach (split (' ', $Config{sig_name}))
-{
- $signame[$i] = $_;
- $signum{$_} = $i;
- $i++;
-}
-
-# Test macros.
-my %macros = (
- 'cov' => \&cov_macro,
- 'cov-target' => \&cov_target_macro,
-);
-my $lcov;
-
-# Read tests file.
-my $dir;
-my $fail = 0;
-while (<STDIN>)
-{
- chomp;
- # Drop comments.
- next if /^\s*(?:#.*)?$/;
- # This table will enable an unget system to fake input lines.
- my @ungeted;
- push @ungeted, $_;
- while (@ungeted)
- {
- $_ = shift @ungeted;
- if (/^(.*):(:)?$/)
- {
- # Directory line.
- $dir = $1;
- chdir "$base/$dir"
- or die "cannot change directory";
- # Push automatic clean test.
- push @ungeted, '-clean: make -s clean' unless $2;
- }
- else
- {
- # Test line.
- defined $dir
- or die "bad format";
- # Read '-' and '!' flags.
- my ($dontcare, $expected) = (0, '');
- $dontcare = 1 if s/^-//;
- $expected = ' (expected)' if s/^!//;
- # Decode name and command.
- my ($name, $cmd);
- /^(.*?): (.*)$/
- and ($name, $cmd) = ($1, $2)
- or ($name, $cmd) = ($_, $_);
- # Decode macros.
- $name =~ /^(.*?) (.*)$/ && exists $macros{$1}
- and ($name, $cmd) = $macros{$1} ($1, $2, $cmd);
- # Skip test?
- next if @include_dir && !grep { $dir =~ /^$_/ } @include_dir;
- next if %include && !exists $include{$name};
- next if exists $exclude{$name};
- # Start test.
- my $t = "=> $dir - $name";
- print "\n$t\n";
- my $status = timed_system ($cmd);
- # Check result.
- if ($dontcare)
- {
- print "=$t: DONE\n";
- }
- else
- {
- if ($status != 0)
- {
- $fail++ unless $expected;
- if ($status == -1 || $status == 128 << 8) {
- print "=$t: FAIL$expected command not found\n";
- } elsif ($status & 127) {
- printf "=$t: FAIL$expected killed with signal %s\n",
- $signame[$status & 127];
- die "interrupted" if ($signame[$status & 127] eq 'INT');
- } else {
- printf "=$t: FAIL$expected exited with value %d\n",
- ($status >> 8);
- }
- }
- else
- {
- print "=$t: PASS\n";
- }
- }
- }
- }
-}
-# Print summary.
-if ($fail)
-{
- print "\n===> FAIL $fail unexpected tests\n";
- exit 1;
-}
-else
-{
- print "\n===> PASS all tests\n";
- exit 0;
-}
-
-sub cov_macro
-{
- my ($name, $arg, $cmd, $objdir, $gcov) = @_;
- if (not defined $lcov)
- {
- system ('lcov --version > /dev/null');
- $lcov = $? == 0 ? 1 : 0;
- }
- if ($lcov)
- {
- $objdir = 'obj' unless defined $objdir;
- $gcov = '' unless defined $gcov;
- return ($name,
- "rm -f obj/$arg.info && "
- . "lcov -q -d $objdir -b . -z $gcov && "
- . "$cmd && "
- . "lcov -q -d $objdir -b . -c -t $arg -o obj/$arg.info $gcov");
- }
- else
- {
- return ('run', $cmd);
- }
-}
-
-sub cov_target_macro
-{
- my ($name, $arg, $cmd) = @_;
- if (exists $ENV{CROSS_COMPILE_})
- {
- return cov_macro ($name, $arg, $cmd, '.', " -g $ENV{CROSS_COMPILE_}gcov");
- }
- else
- {
- return ('run', $cmd);
- }
-}
-
-sub timed_system
-{
- my $cmd = shift;
- my $pid = fork;
- defined $pid or die "fork: $!,";
- if ($pid == 0)
- {
- # Son.
- exec $cmd;
- exit 128;
- }
- else
- {
- # Father.
- eval {
- local $SIG{ALRM} = sub { die "alarm\n" };
- alarm $timeout;
- do { $_ = wait } until $_ == $pid;
- alarm 0;
- };
- if ($@)
- {
- die unless $@ eq "alarm\n";
- kill INT => $pid;
- sleep 3;
- kill KILL => $pid;
- print "Timed out!\n";
- return $signum{ALRM};
- }
- else
- {
- return $?;
- }
- }
-}
-
-__END__
-
-=head1 NAME
-
-run-test.pl - Read a tests file and run all configured tests
-
-=head1 SYNOPSIS
-
-run-test.pl [options] base
-
- Options:
- -h, --help brief help message
- -I, --include=NAME only include named tests, can be issued multiple times
- -X, --exclude=NAME do not include named tests
- -d, --directory=DIR only include tests below given directories
- -t, --timeout=SEC timeout for each test (seconds)
-
-=cut
-
diff --git a/cesar/common/tests/tests b/cesar/common/tests/tests
deleted file mode 100644
index d556cf7488..0000000000
--- a/cesar/common/tests/tests
+++ /dev/null
@@ -1,567 +0,0 @@
-# tests file.
-#
-# Define tests using the following format:
-#
-# path/to/test/directory:[:]
-# [!|-][test name: ]command
-# [!|-][test name: ]command...
-#
-# The commands are run in the given directory. If the second colon is not
-# present, first command is 'make -s clean'. Commands starting with a bang
-# (!) are expected to fail. Result of commands starting with a dash (-) are
-# ignored.
-#
-# If test name is 'cov <test_name>', lcov is run on this test if found,
-# producing a file obj/<test_name>.info.
-
-#common/make/test::
-#run: ./test_make.sh
-
-hal/arch/test/atomic:
-make: make COV=y
-cov test_atomic: ./obj/test_atomic
-
-hal/boot_params/test/test_boot_params:
-make
-test_boot_params: ./obj/test_boot_params
-
-hal/boot_params/test/test_bin_eof:
-make
-test_bin_eof: python ./test_bin_eof.py
-
-hal/mem/test:
-make
-test_mem: ./obj/test_mem
-
-hal/phy/maximus/test:
-make: make COV=y
-cov test_phy_maximus: ./obj/test_phy_maximus
-
-hal/phy/maximus/dur/test:
-make: make COV=y
-cov test_dur: ./obj/test_dur
-
-hal/hle/maximus/test:
-make: make COV=y
-cov test_maximus_hle: ./obj/test_maximus_hle
-
-hal/hle/test:
-make: make COV=y
-cov hal_hle_hal_ipmbox: ./obj/hal_hle_hal_ipmbox
-cov hal_hle_ipmbox: ./obj/hal_hle_ipmbox
-
-hal/leon/maximus/test:
-make: make COV=y
-cov test_maximus_timer: ./obj/test_maximus_timer
-
-lib/test/bitstream:
-make: make HOST_COV=y
-cov test_bitstream: ./obj/test_bitstream
-
-lib/test/blk:
-make: make COV=y
-cov test_blk: ./obj/test_blk
-
-lib/test/circular_buffer:
-make: make COV=y
-cov test_circular_buffer: ./obj/test_circular_list
-
-lib/test/crc:
-make: make COV=y
-cov test_crc: ./obj/test_crc
-
-lib/test/fixed:
-make: make COV=y
-cov test_fixed: ./obj/test_fixed
-
-lib/test/heap:
-make: make COV=y
-cov test_heap: ./obj/test_heap
-
-lib/test/init:
-make: make COV=y
-cov test_init: ./obj/test_init
-
-lib/test/list:
-make: make COV=y
-cov test_list: ./obj/test_list
-
-lib/test/mac_lookup_table:
-make: make COV=y
-cov test_mac_lookup_table: ./obj/test_mac_lookup_table
-
-lib/test/mbox:
-make: make COV=y
-cov test_mbox_host: ./obj/mbox_host
-cov-target test_mbox_ecos: ./obj/mbox.elf
-
-lib/test/perf:
-make: make
-
-lib/test/read_word:
-make: make COV=y
-cov test_read_word: ./obj/test_read_word
-
-lib/test/restrack:
-make: make COV=y
-cov test_restrack: ./obj/test_restrack
-
-lib/test/rnd:
-make: make COV=y
-cov test_rnd: ./obj/test_rnd
-
-lib/test/set:
-make: make COV=y
-cov test_set: ./obj/test_set
-
-lib/test/slab:
-make: make COV=y
-cov test_slab: ./obj/test_slab
-
-lib/test/slist:
-make
-run: ./obj/test_slist
-
-lib/test/stats:
-make: make COV=y
-cov test_stats: ./obj/test_stats
-
-lib/test/test:
-make
-!run: ./obj/test_test
-
-lib/test/trace:
-make: make HOST_COV=y
-cov test_trace: ./obj/test_trace
-
-lib/test/try:
-make: make COV=y
-cov test_try: ./obj/test_try
-
-lib/test/utils:
-make: make COV=y
-cov test_utils: ./obj/test_utils
-
-lib/scenario/test:
-make: make COV=y
-cov test_scenario: ./obj/test_scenario
-
-lib/test/seq_check:
-make: make COV=y
-cov test_seq_check: ./obj/test_seq_check
-
-maximus/stationtest:
-make
-
-maximus/prototest/fcall:
-make
-
-maximus/python:
-make: make COV=y
-python test/test_channel.py -e ../stationtest/obj/test_station.elf -d false -t 2500000000
-python test/test_cli.py
-python test/test_ethernet.py -e ../stationtest/obj/test_ether.elf -d false -t 2500000000
-python test/test_fsm.py
-python test/test_interface.py -e ../stationtest/obj/stationtest.elf -d false -t 2500000000
-python test/test_lib_cesar.py -e ../stationtest/obj/test_lib_cesar.elf -d false -t 2500000000
-python test/test_lib_proto.py -u -e ../prototest/fcall/obj/test_fcall.elf -t 2500000000
-python test/test_macframe.py -e ../stationtest/obj/test_send.elf -d false -t 2500000000
-python test/test_mme.py -e ../stationtest/obj/stationtest.elf -d false -t 2500000000
-python test/test_result.py
-python test/test_simu.py -e ../stationtest/obj/stationtest.elf -d false -t 2500000000
-python test/test_station.py -e ../stationtest/obj/test_station.elf -d false -t 2500000000
-python test/test_utils.py
-python py/script_example.py -e ../stationtest/obj/stationtest.elf -d false -t 2500000000
-python py/test_cb.py -e ../stationtest/obj/test_cb.elf -d false -t 2500000000
-python py/test_send_mpdu.py -e ../stationtest/obj/test_send.elf -d false -t 2500000000
-python py/test_send_noise.py -e ../stationtest/obj/test_send.elf -d false -t 2500000000
-python py/test_tx_rx.py -e ../stationtest/obj/test_tx_rx.elf -d false -t 2500000000
-python py/test_ether.py -e ../stationtest/obj/test_ether.elf -d false -t 2500000000
-python py/test_false_alarm.py -e ../stationtest/obj/test_false_alarm.elf -d false -t 2500000000
-
-maximus/python/tools/csi/test:
-python avln.py
-python core.py
-python station.py
-
-hal/phy/test/phy:
-make
-cd py/test_phy && perl regs2py.pl ../../../../inc
-run: python py/all.py -d false -t 2500000000
-
-hal/phy/test/bridgedma:
-make
-run: ./obj/host/bridgedma.elf
-
-mac/ca/test/ca:
-make: make COV=y
-cov test_ca: ./obj/test_ca
-
-mac/ca/test/ca_eoc:
-make: make COV=y
-cov test_ca_eoc: ./obj/test_ca
-
-mac/common/test/mfs:
-make
-run: ./obj/test_mfs
-
-mac/common/test/pb:
-make
-run: ./obj/test_pb
-
-mac/common/test/store:
-make: make COV=y
-cov test_store: ./obj/test_store
-
-mac/common/test/tonemap:
-make: make COV=y
-cov test_tonemap: ./obj/test_tonemap
-
-mac/common/test/interval:
-make: make COV=y
-cov test_interval: ./obj/test_interval
-
-mac/design/test/mfs_tx:
-make
-
-mac/design/test/mfs_tx2:
-make
-
-mac/design/test/sacki:
-make
-run: ./obj/test_sacki
-
-mac/pbproc/test/fc:
-make: make COV=y
-cov test_fc: ./obj/test_fc
-
-mac/pbproc/test/fsm:
-make: make COV=y
-cov test_fsm: ./obj/test_fsm
-
-mac/pbproc/test/mfs:
-make: make COV=y
-cov test_mfs: ./obj/test_mfs
-
-mac/pbproc/test/pbproc:
-make: make COV=y
-cov test_pbproc: ./obj/test_pbproc
-
-mac/pbproc/test/pbproc_eoc:
-make: make COV=y
-cov test_pbproc_eoc: ./obj/test_pbproc
-
-mac/pbproc/test/int:
-make
-run: python py/host_test_pbproc.py --maximus
-run: python py/test_coll.py --maximus
-
-mac/pbproc/test/sacki:
-make: make COV=y
-cov test_sacki: ./obj/test_sacki
-
-mac/sar/test/unit_test/ecos:
-make: make
-sar: ./obj/sar.elf
-sar_pbproc_mfs_orverride: ./obj/sar_pbproc_override.elf
-
-mac/sar/test/unit_test/host:
-make: make COV=y
-cov lib_sar_mf: ./obj/lib_sar_mf
-
-mac/sar/test/functional:
-make host
-sar_rx_perf: obj/host/sar_rx_perf.elf
-sar_rx_perf_huge_mpdu: obj/host/sar_rx_perf_huge_mpdu.elf
-sar_tx_perf: obj/host/sar_tx_perf.elf
-sar_rx_perf_huge_mpdu_1518: obj/host/sar_rx_perf_huge_mpdu_1518.elf
-sar_rx_tx: obj/host/sar_rx_tx.elf
-sar_tx_rx: obj/host/sar_tx_rx.elf
-
-cl/test/utest:
-make: make COV=y
-cov cl: ./obj/cl
-
-cl/test/functional:
-make host
-cl: ./obj/host/cl.elf
-
-cl/test/bridge_table:
-make: make COV=y
-cov test_bridge_table: ./obj/test_bridge_table
-
-cl/test/data_rate:
-make: make COV=y
-cov data_rate: ./obj/data_rate
-
-ce/tx/test:
-make: make COV=y
-cov ce_tx_test_mme: ./obj/test_mme
-cov ce_tx_test_expiration: ./obj/test_expiration
-cov ce_tx_test_tm: ./obj/test_tm
-
-ce/rx/test:
-make: make COV=y
-cov-target ce_rx_test_rx: ./obj/test_rx.elf
-
-ce/rx/bitloading/test:
-make: make COV=y host fsm
-cov ce_rx_bl_host: ./obj/host/test_ce_host
-cov ce_rx_bl_fsm_host: ./obj/host/test_ce_fsm
-cov ce_rx_bl_intervals_host: ./obj/host/test_ce_intervals
-
-ce/rx/cp/test:
-make: make
-ce_rx_cp_test_me: ./obj/test_mme.elf
-ce_rx_cp_test_mbox: ./obj/test_mbox
-
-maximus/unittest:
-make: make COV=y
-obj/unittest -e ../stationtest/obj/stationtest.elf
-
-maximus/usertest:
-make: make COV=y
-obj/usertest -e ../stationtest/obj/stationtest.elf -d false -t 2500000000
-
-test_general/maximus/integration/cl-sar-pbproc:
-make
-python test1.py -d false -t 2500000000
-
-test_general/maximus/integration/sar-pbproc:
-make
-python test1.py -d false -t 2500000000
-python test2.py -d false -t 2500000000
-
-test_general/maximus/integration/sar-pbproc-eoc:
-make
-python test1.py -d false -t 2500000000
-python test2.py -d false -t 2500000000
-python test_eoc_2sta.py -d false -t 2500000000
-python test_eoc_2sta_csmaonly.py -d false -t 2500000000
-python test_eoc_2stasound.py -d false -t 2500000000
-python test_eoc_3sta.py -d false -t 2500000000
-python test_eoc_3sta1bad.py -d false -t 2500000000
-python test_eoc_multista.py -d false -t 2500000000
-
-test_general/maximus/integration/hle-cl-sar-pbproc:
-make
-python test1.py -d false -t 2500000000
-
-test_general/maximus/integration/ipmbox-hle-cl-sar-pbproc:
-make
-python test1.py -d false -t 2500000000
-python test2.py -d false -t 2500000000
-
-test_general/maximus/integration/interface-dp:
-make
-python test01.py -d false -t 2500000000
-
-interface/sniffer/test:
-make
-sniffer: ./obj/test-sniffer
-
-interface/test:
-make: make synth
-interface: ./obj/synth/test-interface.elf
-
-hle/test/:
-make: make COV=y
-hle_recv_from_arm: ./obj/host/hle_recv_from_arm
-hle_send_to_arm: ./obj/host/hle_send_to_arm
-interface_send: ./obj/host/interface_send
-
-host/test:
-make: make COV=y
-./obj/test_host
-
-host/sci/cesar/test:
-make: make COV=y
-./obj/test_sci_cesar
-
-interface/fcall/test:
-make: make COV=y
-./obj/test_interface_fcall
-
-cp/test/mme:
-make: make COV=y host.all
-cov test_mme: ./obj/test_mme
-
-cp/fsm/test/utest:
-make: make COV=y
-cov test_fsm: ./obj/test_fsm
-
-cp/sta/action/test/utest:
-make: make COV=y
-cov test_sta_action: ./obj/test_sta_action
-
-cp/sta/mgr/test:
-make
-test_sta_mgr: obj/test_sta_mgr
-
-cp/cco/action/test:
-make
-action: ./obj/action.elf
-garbage: ./obj/garbage.elf
-status: ./obj/status.elf
-keys: ./obj/keys.elf
-
-cp/cco/action/test/utest:
-make
-action: ./obj/test_cco_action
-
-cp/beacon/test:
-make
-beacon: ./obj/beacon.elf
-discover: ./obj/discover_process.elf
-
-cp/msg/test:
-make: make COV=y
-read-header: ./obj/test-msg-read-header
-cc-msg: ./obj/test-msg-cc
-cm-msg: ./obj/test-msg-cm
-frag_mme: ./obj/test_frag_mme
-cm-drv: ./obj/test_drv_msg
-discover_list: ./obj/test_cc_discover_list
-relay: ./obj/relay
-vs-msg: ./obj/test_vs_msg
-vs-msg: ./obj/test_vs_msg
-test_allowed_mme: ./obj/test_allowed_mme
-
-cp/secu/test:
-make: make -f host-Makefile COV=y
-sha256: ./obj/host/test_sha2
-aes128: ./obj/host/test_aes
-prun: ./obj/host/test_prun
-nmk: ./obj/host/test_nmk
-hash: ./obj/host/test_hash
-
-cp/cl_interf/test:
-make
-cl_interf: ./obj/test-cl-interf
-
-cp/sta/core/test:
-make simu
-core: ./obj/simu/core.elf
-core_event: ./obj/simu/core_events.elf
-core_thread: ./obj/simu/core_thread.elf
-core_timer: ./obj/simu/core_timer.elf
-
-test_general/station/cco0/s1:
-make
-init: python py/init.py -d false -t 2500000000
-cm_unassociated_sta: python py/cm_unassociated_sta.py -d false -t 2500000000
-sc1_one_sta_mac_start_cco_pref: python py/sc1_one_sta_mac_start_cco_pref.py -d false -t 2500000000
-sc1_one_sta_mac_start: python py/sc1_one_sta_mac_start.py -d false -t 2500000000
-sc2_two_sta_assoc_one_cco_pref: python py/sc2_two_sta_assoc_one_cco_pref.py -d false -t 2500000000
-sc2_two_sta_assoc: python py/sc2_two_sta_assoc.py -d false -t 2500000000
-sc3_two_sta_communication: python py/sc3_two_sta_communication.py -d false -t 2500000000
-sc4_cc_who_ru: python py/sc4_cc_who_ru.py -d false -t 2500000000
-sc5_cc_leave: python py/sc5_cc_leave.py -d false -t 2500000000
-sc6_three_sta_assoc: python py/sc6_three_sta_assoc.py -d false -t 2500000000
-sc7_three_sta_communication: python py/sc7_three_sta_communication.py -d false -t 2500000000
-sc8_three_sta_one_leaving: python py/sc8_three_sta_one_leaving.py -d false -t 2500000000
-sc9_cco_leaving: python py/sc9_cco_leaving.py -d false -t 2500000000
-sc10_two_sta_with_snr: python py/sc10_two_sta_with_snr.py -d false -t 2500000000
-sc11_three_sta_one_deactivate: python py/sc11_three_sta_one_deactivate.py -d false -t 2500000000
-sc12_five_stations: python py/sc12_five_stations.py -d false -t 2500000000
-sc13_10stations: python py/sc13_10stations.py -d false -t 2500000000
-sc14_discover_beacon: python py/sc14_discover_beacon.py -d false -t 2500000000
-
-test_general/station/cco0/s2:
-make
-sc01_bridge: python py/sc01_bridge.py -d false -t 25000000000
-sc02_five_stations: python py/sc02_five_stations.py -d false -t 25000000000
-sc03_ten_stations: python py/sc03_ten_stations.py -d false -t 25000000000
-sc04_change_snid: python py/sc04_change_snid.py -d false -t 25000000000
-sc05_change_hm: python py/sc05_change_hm.py -d false -t 25000000000
-sc06_snid_conflict: python py/sc06_snid_conflict.py -d false -t 25000000000
-sc07_handover: python py/sc07_handover.py -d false -t 25000000000
-sc08_sc_two_sc_join: python py/sc08_sc_two_sc_join.py --maximus
-sc08_sc_one_sc_join_one_sc_add: python py/sc08_sc_one_sc_join_one_sc_add.py --maximus
-sc08_sc_one_sc_join_one_sc_add_revert: python py/sc08_sc_one_sc_join_one_sc_add.py --maximus --revert
-sc08_sc_cco_sc_add_sc_join: python py/sc08_sc_avln_already_exist_one_sc_join.py --maximus --cco
-sc08_sc_sta_sc_add_sc_join: python py/sc08_sc_avln_already_exist_one_sc_join.py --maximus --sta
-sc09_Vendor_Specific_mme: python py/sc09_Vendor_Specific_mme.py -d false -t 25000000000
-sc10_short_messages: python py/sc10_short_messages.py -d false -t 25000000000
-sc11_one_sta_stats: python py/sc11_one_sta_stats.py -d false -t 25000000000
-sc12_cm_nw_info: python py/sc12_cm_nw_info.py -d false -t 25000000000
-sc13_cm_nw_stats: python py/sc13_cm_nw_stats.py -d false -t 25000000000
-sc14_change_nek: python py/sc14_change_nek.py -d false -t 25000000000
-sc15_two_avlns: python py/sc15_two_avlns.py -d false -t 25000000000
-sc16_igmp: python py/sc16_igmp.py -d false -t 25000000000
-sc17_nmk_change: python py/sc17_change_nmk.py -d false -t 25000000000
-sc18_change_nmk_cco_first_and_after_sta.py: python py/sc18_change_nmk_cco_first_and_after_sta.py -d false -t 25000000000
-
-test_general/station/maximus:
-make
-sc01_long_simu: python py/sc01_long_simu.py -d false -t 25000000000
-sc02_long_simu_data: python py/sc02_long_simu_data.py -d false -t 25000000000
-
-test_general/station/tonemap:
-make -f host-Makefile
-sc01_bl_initial: python py/sc01_bl_initial.py --maximus
-sc02_vs_get_tonemap: python py/sc02_vs_get_tonemap.py --maximus
-
-cp/cco/bw/test:
-make
-bw: ./obj/bw
-
-cp/cco/region/test:
-make
-region: ./obj/region
-
-hal/phy/spoc/test:
-make host.all
-spoc: ./obj/spoc_host_check_coeff
-
-cp/beacon/test/utest_eoc:
-make
-beaconeoc: ./obj/beacon.elf
-
-test_general/station/compliance-eoc:
-make
-test02_eoc_beacon: python py/test02_eoc_beacon.py --maximus
-
-cp/eoc/cco/action/test/utest:
-make: make COV=y
-cov test_fsm: ./obj/fsm/test_fsm
-cov test_actions: ./obj/actions/test_actions
-
-
-cp/eoc/sta/action/test/utest:
-make: make COV=y
-cov test_fsm: ./obj/fsm/test_fsm
-cov test_actions: ./obj/actions/test_actions
-
-cp/eoc/multi_sta_fsm/test/utest:
-make: make COV=y
-cov test_fsm: ./obj/test_fsm
-
-cp/eoc/multi_sta/action/test/utest:
-make: make COV=y
-cov test_fsm: ./obj/fsm/test_fsm
-cov test_actions: ./obj/actions/test_actions
-
-test_general/station/compliance:
-make
-6.2.1-dut_as_a_cco: python py/sc01_dut_as_a_cco.py --maximus
-
-bsu/beacon/test/utest:
-make
-beacon: ./obj/beacon
-
-bsu/test/utest:
-make
-test_bsu: ./obj/test_bsu
-
-bsu/ntb/test/utest:
-make
-bsu/ntb: ./obj/ntb
-
-bsu/aclf/test/utest:
-make
-bsu/aclf: ./obj/aclf
-
-projects/plc:
-make
-make traces: make PROJECT_CONFIG=Config.traces
diff --git a/cesar/common/tools/build-info b/cesar/common/tools/build-info
index df1e6b100b..50e528f4cb 100755
--- a/cesar/common/tools/build-info
+++ b/cesar/common/tools/build-info
@@ -33,11 +33,12 @@ sub info_project
{
use Cwd;
my @dir = split '/', getcwd ();
+ my $short = $dir[-1];
my @project;
# Iteratively remove a directory part to find root.
do
{
- @dir or die "cannot find the base directory.\n";
+ @dir or return $short;
unshift @project, pop @dir;
} while (!-r join ('/', @dir) . '/common/make/top.mk');
return join ('/', @project);
diff --git a/cesar/common/tools/traceviewer/annotate/cpu.py b/cesar/common/tools/traceviewer/annotate/cpu.py
index 3e64981fd3..b7013c35eb 100644
--- a/cesar/common/tools/traceviewer/annotate/cpu.py
+++ b/cesar/common/tools/traceviewer/annotate/cpu.py
@@ -1,25 +1,32 @@
"""Annotate CPU usage trace."""
import re
+attrs = {
+ 'thread': 'green',
+ 'isr': 'blue',
+ 'dsr': 'cyan',
+ 'phy': 'red',
+ }
+
def annotate (trace):
re_switch = re.compile (r'^switch .*to sp=(.*)')
- re_enter = re.compile (r'^(isr|dsr|phy)')
+ re_enter = re.compile (r'^(isr|dsr|phy) [^ ]*[0-9]')
re_exit = re.compile (r'^(?:isr|dsr|phy) exit')
stack = [ ]
for t in trace.trace:
# Colorize.
if t.text.startswith ('switch'):
- t.view_attr = 'green'
+ t.view_attr = attrs['thread']
elif t.text.startswith ('isr sp='):
- t.view_attr = 'blue'
+ t.view_attr = attrs['isr']
elif t.text.startswith ('dsr sp='):
- t.view_attr = 'cyan'
+ t.view_attr = attrs['dsr']
elif t.text.startswith ('phy 0'):
- t.view_attr = 'red'
+ t.view_attr = attrs['phy']
# Handle stack.
m_switch = re_switch.search (t.text)
if m_switch:
- stack = [ m_switch.group (1) ]
+ stack = [ 'thread' ]
elif re_exit.search (t.text):
if stack:
stack.pop ()
@@ -29,4 +36,5 @@ def annotate (trace):
stack.append (m_enter.group (1))
if stack:
t.view_text = stack[-1]
+ t.view_line_attr = attrs[stack[-1]]
diff --git a/cesar/common/tools/traceviewer/gui.py b/cesar/common/tools/traceviewer/gui.py
index 658c2ab0d4..e782de376c 100644
--- a/cesar/common/tools/traceviewer/gui.py
+++ b/cesar/common/tools/traceviewer/gui.py
@@ -126,7 +126,7 @@ class TracesListView (gtk.TreeView):
class Gui:
- def __init__ (self, zoom = 1):
+ def __init__ (self, zoom = 1.0):
traceviewerdir = os.path.dirname (__file__)
xml = gtk.glade.XML (os.path.join (traceviewerdir,
'traceviewer.glade'))
@@ -138,6 +138,7 @@ class Gui:
self.trace_sw = xml.get_widget ('trace_sw')
self.trace_sw.add_with_viewport (self.trace_view)
self.trace_view.connect ('cursor-tck', self.on_cursor_tck)
+ self.trace_sw.connect ('scroll-event', self.on_zoom_scroll_event)
self.trace_tree_box = xml.get_widget ('trace_tree_box')
self.traces_list_view = TracesListView (self.on_trace_visible_toggle)
control_box = xml.get_widget ('control_box')
@@ -193,24 +194,44 @@ class Gui:
def show_all (self):
self.window.show_all ()
+ def zoom (self, zoom, x = None):
+ zoom_change = zoom / self.trace_view.zoom
+ adj = self.trace_sw.get_hadjustment ()
+ if x is None:
+ offset = adj.page_size * 0.5
+ else:
+ offset = x - adj.value
+ old_pos = adj.value + offset
+ self.trace_view.zoom_set (zoom)
+ self.update_zoom ()
+ new_value = zoom_change * old_pos - offset
+ new_value = min (new_value, self.trace_view.get_size_request ()[0]
+ - adj.page_size)
+ new_value = max (0, new_value)
+ adj.value = new_value
+
+ def on_zoom_scroll_event (self, button, event):
+ if event.direction == gtk.gdk.SCROLL_UP:
+ self.zoom (self.trace_view.zoom * 2, event.x)
+ else:
+ self.zoom (self.trace_view.zoom * 0.5, event.x)
+ return True
+
def on_zoom_fit_clicked (self, button):
self.trace_view.zoom_fit (self.trace_sw.get_allocation ().width - 40)
self.update_zoom ()
def on_zoom_in_clicked (self, button):
- self.trace_view.zoom_set (self.trace_view.zoom * 2)
- self.update_zoom ()
+ self.zoom (self.trace_view.zoom * 2)
def on_zoom_out_clicked (self, button):
- self.trace_view.zoom_set (self.trace_view.zoom / 2.0)
- self.update_zoom ()
+ self.zoom (self.trace_view.zoom * 0.5)
def on_center_clicked (self, button):
self.center ()
def on_zoom_entry_activate (self, entry):
- self.trace_view.zoom_set (float (self.zoom_entry.get_text ()))
- self.update_zoom ()
+ self.zoom (float (self.zoom_entry.get_text ()))
def on_user_cursor_entry_change (self, entry):
try:
diff --git a/cesar/common/tools/traceviewer/trace_view.py b/cesar/common/tools/traceviewer/trace_view.py
index ffe530271e..ad922aae02 100644
--- a/cesar/common/tools/traceviewer/trace_view.py
+++ b/cesar/common/tools/traceviewer/trace_view.py
@@ -170,42 +170,59 @@ class TraceView (gtk.DrawingArea):
line += 1
def draw_trace (self, trace, x, w, lyb, lyt):
- xend = min (long ((self.end - self.base) * self.zoom), x + w) - 1
+ xgend = long ((self.end - self.base) * self.zoom)
+ xend = min (xgend, x + w) - 1
if trace is self.highlighted:
self.window.draw_rectangle (self.highlight_gc, True, x, lyt,
xend - x, lyb - lyt)
self.window.draw_line (self.trace_gc, x, lyb, xend, lyb)
+ # Annotation function, executed late.
+ def draw_annotation (entry, d, dend):
+ if hasattr (entry, 'view_attr'):
+ gc = self.attr (entry.view_attr)
+ else:
+ gc = self.trace_gc
+ if hasattr (entry, 'view_line_attr'):
+ gc = self.attr (entry.view_line_attr)
+ if dend - d - 1 > 0:
+ self.window.draw_rectangle (gc, True, d + 1, lyb - 2,
+ dend - d - 1, 3)
+ if hasattr (entry, 'view_text'):
+ text = self.create_pango_layout (entry.view_text)
+ size = text.get_pixel_size ()
+ if d + size[0] < dend:
+ self.window.draw_layout (gc, d + 1, lyb - size[1] + 4,
+ text)
# Draw a tick for each date corresponding to a trace event (avoid
# duplicate drawing).
- miin = long (x // self.zoom) + self.base
- max = long (((x + w) + self.zoom) // self.zoom) + self.base
- last = None
- for i in xrange (*trace.range (miin, max)):
+ date_min = long (x // self.zoom) + self.base
+ date_max = long (((x + w) + self.zoom) // self.zoom) + self.base
+ imin, imax = trace.range (date_min, date_max)
+ dlast = None
+ for i in xrange (max (0, imin - 1), imax):
d = long ((trace.trace[i].date - self.base) * self.zoom)
# Draw if not drawn yet.
- if d != last:
- # Get optional view attribute and text.
+ if d != dlast:
+ # Get optional view attribute.
if hasattr (trace.trace[i], 'view_attr'):
gc = self.attr (trace.trace[i].view_attr)
else:
gc = self.trace_gc
- if hasattr (trace.trace[i], 'view_text'):
- text = trace.trace[i].view_text
- text = self.create_pango_layout (text)
- else:
- text = None
# Draw tick.
self.window.draw_line (gc, d, lyt, d, lyb)
- # Draw text if there is room.
- if text is not None:
- if len (trace.trace) > i + 1:
- dnext = long ((trace.trace[i + 1].date - self.base)
- * self.zoom)
- else:
- dnext = None
- if dnext is None or d + text.get_pixel_size ()[0] < dnext:
- self.window.draw_layout (gc, d + 1, lyt - 1, text)
- last = d
+ # Draw previous text if there is room.
+ if dlast is not None:
+ draw_annotation (trace.trace[i - 1], dlast, d)
+ # Remember for next iteration.
+ dlast = d
+ # Draw last annotation.
+ if dlast is not None:
+ try:
+ next_entry = trace.trace[i + 1]
+ dend = long ((next_entry.date - self.base) * self.zoom)
+ except IndexError:
+ dend = xgend
+ draw_annotation (trace.trace[i], dlast, dend)
def zoom_fit (self, px):
self.zoom = float (px) / (self.end - self.base)
diff --git a/cesar/cp/sta/action/Config b/cesar/cp/sta/action/Config
index ec2625bda7..c8185f667b 100644
--- a/cesar/cp/sta/action/Config
+++ b/cesar/cp/sta/action/Config
@@ -1,2 +1 @@
CONFIG_CP_STA_ACTION_MISC_EOC = n
-CONFIG_DATA_RATE=n
diff --git a/cesar/cp/sta/action/src/misc.c b/cesar/cp/sta/action/src/misc.c
index 1ea0d5aec5..7ecc613c63 100644
--- a/cesar/cp/sta/action/src/misc.c
+++ b/cesar/cp/sta/action/src/misc.c
@@ -13,7 +13,6 @@
#include "common/std.h"
#include "cl/data_rate.h"
#include "mac/common/store.h"
-#include "config/data/rate.h"
#include "action.h"
@@ -482,7 +481,7 @@ cp_sta_action_process_cm_nw_stats_req (cp_t *ctx, cp_mme_rx_t *rx_mme)
mac = cp_sta_get_mac_address(sta_list);
- if (CONFIG_DATA_RATE)
+ if (CONFIG_CL_DATA_RATE)
{
sta_t* sta;
diff --git a/cesar/hal/phy/inc/phy_params.txt b/cesar/hal/phy/inc/phy_params.txt
index 821355100d..db3aa3c76f 100644
--- a/cesar/hal/phy/inc/phy_params.txt
+++ b/cesar/hal/phy/inc/phy_params.txt
@@ -14,7 +14,7 @@ channel_estim_coef__coef_res_delta_internal = 32
channel_estim_coef__coef_res_delta_external = 26
resys_threshold__nb_syncp_1 = 1995
resys_threshold__nb_syncp_2 = 2379
-detect_param_1__lambda = 49152
+detect_param_1__lambda = 32807
detect_param_1__gamma = 49152
detect_param_2__dmin = 1536
detect_param_2__dmax = 3264
@@ -25,7 +25,7 @@ detect_param_3__msb_filter_0_choice = 20
detect_param_3__msb_filter_1_choice = 20
detect_param_4__delay_before_detect = 188
detect_param_4__delay_freeze = 20
-detect_param_4__activation_init_reference = 0
+detect_param_4__activation_init_reference = 1
magic_param_1__target_nrj = 35
magic_param_1__convergence_tolerance = 3
magic_param_2__divergence_tolerance = 5
diff --git a/cesar/mac/common/mfs.h b/cesar/mac/common/mfs.h
index 7d731c83a5..632cdebe56 100644
--- a/cesar/mac/common/mfs.h
+++ b/cesar/mac/common/mfs.h
@@ -175,6 +175,8 @@ struct mfs_tx_t
/** Number of holes in the MFS, i.e. number of acknowledged or canceled
* segment in the MFS. */
u16 holes_seg_nb;
+ /** Difference between the Tx ssn_min and the Rx ssn_min. */
+ u16 delta_between_ssn_min;
/** Channel Access Priority. */
uint cap;
diff --git a/cesar/mac/common/src/mfs.c b/cesar/mac/common/src/mfs.c
index a16a10994c..9cb8202965 100644
--- a/cesar/mac/common/src/mfs.c
+++ b/cesar/mac/common/src/mfs.c
@@ -108,6 +108,7 @@ mfs_tx_init (mfs_tx_t *mfs, bool bcast, bool mme, uint lid, uint tei)
mfs->window_size = mme ? mfs_window_size[MFS_WINDOW_SIZE_MME]
: mfs_window_size[MFS_DEFAULT_WINDOW_SIZE_DATA_TX];
mfs->holes_seg_nb = 0;
+ mfs->delta_between_ssn_min = 0;
if (mme)
mfs->cap = 2;
else
diff --git a/cesar/mac/pbproc/src/prep_mpdu.c b/cesar/mac/pbproc/src/prep_mpdu.c
index 87f4839a71..15b21d5fbd 100644
--- a/cesar/mac/pbproc/src/prep_mpdu.c
+++ b/cesar/mac/pbproc/src/prep_mpdu.c
@@ -137,14 +137,14 @@ pbproc_prep_beacon (pbproc_t *ctx, mfs_tx_t *mfs)
prep->wack = false;
prep->unassociated = false;
prep->rts_cts = false;
+ prep->burst_mpdu_nb = 1;
+ prep->mpdu_count = 0;
+ prep->current = &prep->mpdu[0];
#if CONFIG_MAC_PBPROC_EOC_FC
prep->fc_mode = PHY_FC_MODE (false, ctx->config->fc_symbols_nb);
#else
prep->fc_mode = PHY_FC_MODE (true, ctx->config->fc_symbols_nb);
#endif
- prep->burst_mpdu_nb = 1;
- prep->mpdu_count = 0;
- prep->current = &prep->mpdu[0];
prep->sound_reason_code = TONEMAP_SRC_NULL;
prep->bypass_aes = true;
/* Modulation. */
@@ -463,11 +463,13 @@ pbproc_prep_mpdu (pbproc_t *ctx, mfs_tx_t *mfs)
if (mfs->ca_state == CA_MFS_STATE_REMOVED)
max_seg_nb = 0;
else if (mfs->fsm_state == MFS_FSM_CMD_RE_SYNC
- || mfs->window_size <= mfs->holes_seg_nb)
+ || mfs->window_size <= (mfs->holes_seg_nb
+ + mfs->delta_between_ssn_min))
max_seg_nb = MIN (mfs->seg_nb, 1);
else
max_seg_nb = MIN (mfs->seg_nb, (int) (mfs->window_size
- - mfs->holes_seg_nb - prep->burst_seg_nb));
+ - mfs->holes_seg_nb - prep->burst_seg_nb
+ - mfs->delta_between_ssn_min));
#endif
}
@@ -1631,6 +1633,8 @@ pbproc_prep_mpdu_commit_burst (pbproc_t *ctx)
if (prep->main_commit_return_head)
{
prep->min_rx_ssn = prep->main_commit_return_head->header.ssn;
+ if (!prep->main_commit_return_head->header.opsf)
+ mfs->delta_between_ssn_min = 0;
/* If the MFS has been removed or if the last sent PB has expired,
* do not give PB back. Do not put more than one PB in a beacon MFS. */
bool expire_return =
@@ -1663,6 +1667,8 @@ pbproc_prep_mpdu_commit_burst (pbproc_t *ctx)
mfs->seg_nb += prep->main_commit_return_seg_nb_reserved;
prep->main_commit_return_seg_nb_reserved = 0;
}
+ else
+ mfs->delta_between_ssn_min = 0;
/* Update number of holes in the MFS. */
if (prep->main_commit_return_seg_nb)
{
@@ -1695,6 +1701,12 @@ pbproc_prep_mpdu_commit_burst (pbproc_t *ctx)
else
mfs->holes_seg_nb = 0;
}
+ /* Update synchronization between tx and rx ssn_min. */
+ if (mfs->ca_state != CA_MFS_STATE_REMOVED)
+ {
+ u16 min_tx_ssn = mfs->head ? mfs->head->header.ssn : mfs->next_ssn;
+ mfs->delta_between_ssn_min += min_tx_ssn - prep->min_rx_ssn;
+ }
#if !CONFIG_MAC_PBPROC_EOC_FC
/* Commit FSM change. */
pbproc_prep_mpdu_commit_fsm (ctx);
diff --git a/cesar/mac/pbproc/test/pbproc/src/prep_mpdu.c b/cesar/mac/pbproc/test/pbproc/src/prep_mpdu.c
index 95ac99efc2..72083ed432 100644
--- a/cesar/mac/pbproc/test/pbproc/src/prep_mpdu.c
+++ b/cesar/mac/pbproc/test/pbproc/src/prep_mpdu.c
@@ -106,6 +106,10 @@ struct prep_mpdu_test_t
bool mfs_fsm_state_test;
/* Expected MFS FSM state after SACK reception. */
mfs_fsm_cmd_t expected_mfs_fsm_state;
+ /* Initial delta between RX and TX ssn min. */
+ u16 min_ssn_delta;
+ /* Expected delta between RX and TX ssn min. */
+ u16 expected_delta;
};
#define prep_mpdu_test(t, tp, date, params...) \
@@ -191,6 +195,7 @@ prep_mpdu_test_f (test_t t, test_pbproc_t *tp, u32 date,
/* Setup receiver window size */
if (params->window_size)
mfs->window_size = mfs_window_size[params->window_size];
+ mfs->delta_between_ssn_min = params->min_ssn_delta;
/* Encrypted? */
utils_prepare_encryption (tp, params->encrypted, !params->bcast, dtei, 0);
/* Setup an access. */
@@ -531,6 +536,8 @@ prep_mpdu_test_f (test_t t, test_pbproc_t *tp, u32 date,
}
/* Test update of number of holes in the MFS. */
test_fail_unless (mfs->holes_seg_nb == expected_holes_nb);
+ /* Test update of delta between RX and TX min ssn. */
+ test_fail_unless (mfs->delta_between_ssn_min == params->expected_delta);
/* Test update of MFS FSM state in case of expiration. */
if (params->mfs_fsm_state_test)
test_fail_unless (mfs->fsm_state == params->expected_mfs_fsm_state);
@@ -1106,51 +1113,54 @@ prep_mpdu_expiration_test_case (test_t t)
prep_mpdu_test (t, &tp, 0, .mfs_seg_nb = 40, .duration_symb_nb = 50,
.symb_nb = 25, .main_seg_nb_total = 40, .seg_nb_pending = 1,
.expiration_date = 20 * UTILS_MFS_EXPIRATION_NTB_STEP,
- .tmi = 5, .tm_mod = 10);
+ .expected_delta = 0, .tmi = 5, .tm_mod = 10);
prep_mpdu_test (t, &tp, 0, .mfs_seg_nb = 40, .duration_symb_nb = 50,
.symb_nb = 25, .main_seg_nb_total = 40, .seg_nb_pending = 1,
.expiration_date = 50 * UTILS_MFS_EXPIRATION_NTB_STEP,
- .tmi = 5, .tm_mod = 10);
+ .expected_delta = 40, .tmi = 5, .tm_mod = 10);
prep_mpdu_test (t, &tp, 0, .mfs_seg_nb = 40, .duration_symb_nb = 50,
.symb_nb = 25, .main_seg_nb_total = 40, .seg_nb_pending = 1,
.crc = true, .crc_error = { 0x0fa5c03a, 0x15 },
.expiration_date = 50 * UTILS_MFS_EXPIRATION_NTB_STEP,
- .tmi = 5, .tm_mod = 10);
+ .expected_delta = 39, .tmi = 5, .tm_mod = 10);
} test_end;
test_begin (t, "expiration on chaining")
{
prep_mpdu_test (t, &tp, 0, .mfs_seg_nb = 200, .duration_symb_nb = 50,
.symb_nb = 50, .main_seg_nb_total = 83, .seg_nb_pending = 0,
.expiration_date = 80 * UTILS_MFS_EXPIRATION_NTB_STEP,
- .tmi = 5, .tm_mod = 10);
+ .expected_delta = 0, .tmi = 5, .tm_mod = 10);
prep_mpdu_test (t, &tp, 0, .mfs_seg_nb = 200, .duration_symb_nb = 50,
.symb_nb = 50, .main_seg_nb_total = 83, .seg_nb_pending = 0,
.expiration_date = 150 * UTILS_MFS_EXPIRATION_NTB_STEP,
- .tmi = 5, .tm_mod = 10);
+ .expected_delta = 147, .tmi = 5, .tm_mod = 10);
prep_mpdu_test (t, &tp, 0, .mfs_seg_nb = 200, .duration_symb_nb = 50,
.symb_nb = 50, .main_seg_nb_total = 83, .seg_nb_pending = 0,
.expiration_date = 250 * UTILS_MFS_EXPIRATION_NTB_STEP,
- .tmi = 5, .tm_mod = 10);
+ .expected_delta = 147, .tmi = 5, .tm_mod = 10);
prep_mpdu_test (t, &tp, 0, .mfs_seg_nb = 200, .duration_symb_nb = 50,
.symb_nb = 50, .main_seg_nb_total = 83, .seg_nb_pending = 0,
.crc = true, .crc_error = { 0x0fa5c03a, 0x15, 0x7ff00 },
.expiration_date = 150 * UTILS_MFS_EXPIRATION_NTB_STEP,
- .tmi = 5, .tm_mod = 10);
+ .expected_delta = 146, .tmi = 5, .tm_mod = 10);
} test_end;
test_begin (t, "expiration with cancel")
{
prep_mpdu_test (t, &tp, 0, .mfs_seg_nb = 40, .duration_symb_nb = 50,
.symb_nb = 25, .main_seg_nb_total = 40, .seg_nb_pending = 1,
.expiration_date = 3 * UTILS_MFS_EXPIRATION_NTB_STEP,
- .no_access_conf = true, .tmi = 5, .tm_mod = 10);
+ .no_access_conf = true, .expected_delta = 0,
+ .tmi = 5, .tm_mod = 10);
prep_mpdu_test (t, &tp, 0, .mfs_seg_nb = 40, .duration_symb_nb = 50,
.symb_nb = 25, .main_seg_nb_total = 40, .seg_nb_pending = 1,
.expiration_date = 50 * UTILS_MFS_EXPIRATION_NTB_STEP,
- .no_access_conf = true, .tmi = 5, .tm_mod = 10);
+ .no_access_conf = true, .expected_delta = 4,
+ .tmi = 5, .tm_mod = 10);
prep_mpdu_test (t, &tp, 0, .mfs_seg_nb = 40, .duration_symb_nb = 50,
.symb_nb = 25, .main_seg_nb_total = 40, .seg_nb_pending = 1,
.expiration_date = 200 * UTILS_MFS_EXPIRATION_NTB_STEP,
- .no_access_conf = true, .tmi = 5, .tm_mod = 10);
+ .no_access_conf = true, .expected_delta = 4,
+ .tmi = 5, .tm_mod = 10);
} test_end;
test_pbproc_uninit (&tp);
}
@@ -1239,35 +1249,37 @@ prep_mpdu_window_size_test_case (test_t t)
.symb_nb = 12, .main_seg_nb_total = 19, .seg_nb_pending = 0,
.expiration_date = 22 * UTILS_MFS_EXPIRATION_NTB_STEP,
.expected_mfs_fsm_state = MFS_FSM_CMD_IN_SYNC,
- .all_ok = true, .tmi = 5, .tm_mod = 10);
+ .expected_delta = 3, .all_ok = true, .tmi = 5, .tm_mod = 10);
prep_mpdu_test (t, &tp, 0, .mfs_seg_nb = 30, .mfs_holes_bitmap = 0xAA,
.window_size = MFS_WINDOW_SIZE_24, .duration_symb_nb = 50,
.symb_nb = 13, .main_seg_nb_total = 20, .seg_nb_pending = 1,
.crc = true, .crc_error = { 0x00021084 },
.expiration_date = 15 * UTILS_MFS_EXPIRATION_NTB_STEP,
.expected_mfs_fsm_state = MFS_FSM_CMD_IN_SYNC,
- .tmi = 5, .tm_mod = 10);
+ .expected_delta = 0, .tmi = 5, .tm_mod = 10);
prep_mpdu_test (t, &tp, 0, .mfs_seg_nb = 30, .mfs_holes_bitmap = 0xAA,
.window_size = MFS_WINDOW_SIZE_24, .duration_symb_nb = 50,
.symb_nb = 13, .main_seg_nb_total = 20, .seg_nb_pending = 1,
.crc = true, .crc_error = { 0x00021084 },
.expiration_date = 22 * UTILS_MFS_EXPIRATION_NTB_STEP,
.expected_mfs_fsm_state = MFS_FSM_CMD_IN_SYNC,
- .tmi = 5, .tm_mod = 10);
+ .expected_delta = 22, .tmi = 5, .tm_mod = 10);
prep_mpdu_test (t, &tp, 0, .mfs_seg_nb = 30, .mfs_holes_bitmap = 0xAA,
.window_size = MFS_WINDOW_SIZE_24, .duration_symb_nb = 50,
.symb_nb = 13, .main_seg_nb_total = 20, .seg_nb_pending = 1,
.crc = true, .crc_error = { 0x00021084 },
.expiration_date = 50 * UTILS_MFS_EXPIRATION_NTB_STEP,
.expected_mfs_fsm_state = MFS_FSM_CMD_RE_SYNC,
- .mfs_fsm_state_test = true, .tmi = 5, .tm_mod = 10);
+ .mfs_fsm_state_test = true, .expected_delta = 30,
+ .tmi = 5, .tm_mod = 10);
prep_mpdu_test (t, &tp, 0, .mfs_seg_nb = 200, .mfs_holes_bitmap = 0xAA,
.window_size = MFS_WINDOW_SIZE_24, .duration_symb_nb = 50,
.symb_nb = 13, .main_seg_nb_total = 20, .seg_nb_pending = 1,
.crc = true, .crc_error = { 0x00021084 },
.expiration_date = 100 * UTILS_MFS_EXPIRATION_NTB_STEP,
.expected_mfs_fsm_state = MFS_FSM_CMD_RE_SYNC,
- .mfs_fsm_state_test = true, .tmi = 5, .tm_mod = 10);
+ .mfs_fsm_state_test = true, .expected_delta = 84,
+ .tmi = 5, .tm_mod = 10);
} test_end;
test_begin (t, "no access conf")
{
@@ -1280,6 +1292,47 @@ prep_mpdu_window_size_test_case (test_t t)
.symb_nb = 13, .main_seg_nb_total = 20, .seg_nb_pending = 1,
.no_access_conf = true, .tmi = 5, .tm_mod = 10);
} test_end;
+ test_begin (t, "RX/TX ssn min delta")
+ {
+ prep_mpdu_test (t, &tp, 0, .mfs_seg_nb = 25, .mfs_holes_bitmap = 0,
+ .window_size = MFS_WINDOW_SIZE_32, .duration_symb_nb = 50,
+ .symb_nb = 16, .main_seg_nb_total = 25, .seg_nb_pending = 1,
+ .min_ssn_delta = 4, .expected_delta = 0,
+ .all_ok = true, .tmi = 5, .tm_mod = 10);
+ prep_mpdu_test (t, &tp, 0, .mfs_seg_nb = 40, .mfs_holes_bitmap = 0,
+ .window_size = MFS_WINDOW_SIZE_32, .duration_symb_nb = 50,
+ .symb_nb = 18, .main_seg_nb_total = 28, .seg_nb_pending = 1,
+ .min_ssn_delta = 4, .expected_delta = 0,
+ .all_ok = true, .tmi = 5, .tm_mod = 10);
+ prep_mpdu_test (t, &tp, 0, .mfs_seg_nb = 40, .mfs_holes_bitmap = 0,
+ .window_size = MFS_WINDOW_SIZE_32, .duration_symb_nb = 50,
+ .symb_nb = 18, .main_seg_nb_total = 28, .seg_nb_pending = 1,
+ .min_ssn_delta = 4, .expected_delta = 0,
+ .crc = true, .crc_error = { 0x00021084 },
+ .tmi = 5, .tm_mod = 10);
+ prep_mpdu_test (t, &tp, 0, .mfs_seg_nb = 40, .mfs_holes_bitmap = 0,
+ .window_size = MFS_WINDOW_SIZE_32, .duration_symb_nb = 50,
+ .symb_nb = 18, .main_seg_nb_total = 28, .seg_nb_pending = 1,
+ .expiration_date = 33 * UTILS_MFS_EXPIRATION_NTB_STEP,
+ .min_ssn_delta = 4, .expected_delta = 5,
+ .all_ok = true, .tmi = 5, .tm_mod = 10);
+ prep_mpdu_test (t, &tp, 0, .mfs_seg_nb = 40, .mfs_holes_bitmap = 0,
+ .window_size = MFS_WINDOW_SIZE_32, .duration_symb_nb = 50,
+ .symb_nb = 18, .main_seg_nb_total = 28, .seg_nb_pending = 1,
+ .min_ssn_delta = 4, .expected_delta = 4, .tmi = 5, .tm_mod = 10);
+ prep_mpdu_test (t, &tp, 0, .mfs_seg_nb = 40, .mfs_holes_bitmap = 0,
+ .window_size = MFS_WINDOW_SIZE_32, .duration_symb_nb = 50,
+ .symb_nb = 18, .main_seg_nb_total = 28, .seg_nb_pending = 1,
+ .min_ssn_delta = 4, .expected_delta = 4,
+ .crc = true, .crc_error = { 0x00000001 },
+ .tmi = 5, .tm_mod = 10);
+ prep_mpdu_test (t, &tp, 0, .mfs_seg_nb = 40, .mfs_holes_bitmap = 0,
+ .window_size = MFS_WINDOW_SIZE_32, .duration_symb_nb = 50,
+ .symb_nb = 18, .main_seg_nb_total = 28, .seg_nb_pending = 1,
+ .expiration_date = 33 * UTILS_MFS_EXPIRATION_NTB_STEP,
+ .min_ssn_delta = 4, .expected_delta = 37,
+ .tmi = 5, .tm_mod = 10);
+ } test_end;
test_pbproc_uninit (&tp);
}
diff --git a/cesar/maximus/coreengine/src/Maximus.cpp b/cesar/maximus/coreengine/src/Maximus.cpp
index 8a885d6c69..b174b374b9 100644
--- a/cesar/maximus/coreengine/src/Maximus.cpp
+++ b/cesar/maximus/coreengine/src/Maximus.cpp
@@ -283,6 +283,7 @@ void Maximus::init ( int argc, char * argv[] )
break;
}
}
+ optind = 1;
if (!isStationExecutableSet)
{
diff --git a/cesar/maximus/python/lib/cesar/defineparser.py b/cesar/maximus/python/lib/cesar/defineparser.py
new file mode 100644
index 0000000000..e5f7c4518c
--- /dev/null
+++ b/cesar/maximus/python/lib/cesar/defineparser.py
@@ -0,0 +1,38 @@
+#!/usr/bin/python
+
+#############################################################################
+# Copyright (C) 2011 Spidcom
+#############################################################################
+
+def define_parser (filename):
+ """
+ Get constant defines into a python dict.
+ param filename : the string to parse the file.
+ return a dict containing the defines.
+
+ Supported defines:
+ #define FOO 2
+ #define BAR FOO
+
+ Not supported defines: All Macros set to check values, computes values,
+ etc...
+ """
+ import os
+ import re
+ # Read the file.
+ fd = open (filename, 'r')
+ f = fd.read ()
+ fd.close ()
+ defines = \
+ re.findall (r'(?m)^#define\s+([A-Z_0-9]+)\s+((?:0x)?[0-9A-Z_]+)\s*$',
+ f)
+ defs = {}
+ defines_dict = dict (defines)
+ for i in defines:
+ a = i[0]
+ if re.match (r'^[A-Z][A-Z_0-9]*$', i[1]):
+ b = defines_dict[i[1]]
+ else:
+ b = i[1]
+ defs[a] = int (b, 0)
+ return defs
diff --git a/cesar/maximus/python/lib/cesar/own_data.py b/cesar/maximus/python/lib/cesar/own_data.py
index e7155b5281..59a4a70c25 100644
--- a/cesar/maximus/python/lib/cesar/own_data.py
+++ b/cesar/maximus/python/lib/cesar/own_data.py
@@ -79,8 +79,9 @@ class Station_own_data:
nid = fcall.bind_param_string ("nid")
if nid:
- nid += '0'
- self.nid = hex(unpack ('Q', nid)[0])
+ nid += '\0'
+ self.nid = unpack ('Q', nid)[0]
+
return self
diff --git a/cesar/maximus/python/lib/cesar/sniffer.py b/cesar/maximus/python/lib/cesar/sniffer.py
deleted file mode 100644
index c5092822df..0000000000
--- a/cesar/maximus/python/lib/cesar/sniffer.py
+++ /dev/null
@@ -1,135 +0,0 @@
-#!/usr/bin/env python
-
-from struct import *
-from maximus.mme.mme import MME
-from maximus.mme.mmentry import MMEntry
-from maximus.mme.mmheader import MMHeader
-
-
-class sniffer:
- def __init__(self):
- self.mask = 0
-
- def set_mask (self, mme_tx, mme_rx, beacon_tx, beacon_rx):
- self.mask = mme_tx | (mme_rx << 1) | (beacon_tx << 2) | (beacon_rx << 3)
-
- def apply (self, maximus, sta, sta_mac_addr, mme_entry):
- mme_entry = pack (3*'B', 0x00, 0x13, 0xd7) + mme_entry
- mme = MME(MMHeader=MMHeader(ODA=sta_mac_addr, OSA=sta_mac_addr,
- MTYPE=0x88E1, MMV=1, MMTYPE=0xA02C, FMI=0),MMEntry=MMEntry(mme_entry))
- mme.send(maximus, sta)
-
- def activate_full(self, maximus, sta, sta_mac_addr):
- mme_entry = pack ('B', 0xF)
- self.mask = 0xF
-
- self.apply (maximus, sta, sta_mac_addr, mme_entry)
-
- def deactivate_full(self, maximus, sta, sta_mac_addr):
- mme_entry = pack ('B', 0x0)
- self.mask = 0
-
- self.apply (maximus, sta, sta_mac_addr, mme_entry)
-
- def activate_tx (self, maximus, sta, sta_mac_addr):
- self.mask |= 0x5
- mme_entry = pack ('B', self.mask)
-
- self.apply (maximus, sta, sta_mac_addr, mme_entry)
-
- def deactivate_tx (self, maximus, sta, sta_mac_addr):
- self.mask |= ~0x5
- mme_entry = pack ('B', self.mask)
-
- self.apply (maximus, sta, sta_mac_addr, mme_entry)
-
- def activate_rx (self, maximus, sta, sta_mac_addr):
- self.mask |= 0xA
- mme_entry = pack ('B', self.mask)
-
- self.apply (maximus, sta, sta_mac_addr, mme_entry)
-
- def deactivate_rx (self, maximus, sta, sta_mac_addr):
- self.mask |= ~0xA
- mme_entry = pack ('B', self.mask)
-
- self.apply (maximus, sta, sta_mac_addr, mme_entry)
-
- def activate_beacon_tx (self, maximus, sta, sta_mac_addr):
- self.mask |= 0x4
- mme_entry = pack ('B', self.mask)
-
- self.apply (maximus, sta, sta_mac_addr, mme_entry)
-
- def deactivate_beacon_tx (self, maximus, sta, sta_mac_addr):
- self.mask |= ~0x4
- mme_entry = pack ('B', self.mask)
-
- self.apply (maximus, sta, sta_mac_addr, mme_entry)
-
- def activate_beacon_rx (self, maximus, sta, sta_mac_addr):
- self.mask |= 0x8
- mme_entry = pack ('B', self.mask)
-
- self.apply (maximus, sta, sta_mac_addr, mme_entry)
-
- def deactivate_beacon_rx (self, maximus, sta, sta_mac_addr):
- self.mask |= ~0x8
- mme_entry = pack ('B', self.mask)
-
- self.apply (maximus, sta, sta_mac_addr, mme_entry)
-
- def activate_mme_tx (self, maximus, sta, sta_mac_addr):
- self.mask |= 0x1
- mme_entry = pack ('B', self.mask)
-
- self.apply (maximus, sta, sta_mac_addr, mme_entry)
-
- def deactivate_mme_tx (self, maximus, sta, sta_mac_addr):
- self.mask |= ~0x1
- mme_entry = pack ('B', self.mask)
-
- self.apply (maximus, sta, sta_mac_addr, mme_entry)
-
- def activate_mme_rx (self, maximus, sta, sta_mac_addr):
- self.mask |= 0x2
- mme_entry = pack ('B', self.mask)
-
- self.apply (maximus, sta, sta_mac_addr, mme_entry)
-
- def deactivate_mme_rx (self, maximus, sta, sta_mac_addr):
- self.mask |= ~0x2
- mme_entry = pack ('B', self.mask)
-
- self.apply (maximus, sta, sta_mac_addr, mme_entry)
-
- def activate_mme (self, maximus, sta, sta_mac_addr):
- self.mask |= 0x3
- mme_entry = pack ('B', self.mask)
-
- self.apply (maximus, sta, sta_mac_addr, mme_entry)
-
- def deactivate_mme (self, maximus, sta, sta_mac_addr):
- self.mask |= ~0x3
- mme_entry = pack ('B', self.mask)
-
- self.apply (maximus, sta, sta_mac_addr, mme_entry)
-
- def activate_beacon (self, maximus, sta, sta_mac_addr):
- self.mask |= 0xC
- mme_entry = pack ('B', self.mask)
-
- self.apply (maximus, sta, sta_mac_addr, mme_entry)
-
- def deactivate_beacon (self, maximus, sta, sta_mac_addr):
- self.mask |= ~0xC
- mme_entry = pack ('B', self.mask)
-
- self.apply (maximus, sta, sta_mac_addr, mme_entry)
-
- def apply_conf (self, maximus, sta, sta_mac_addr):
- mme_entry = pack ('B', self.mask)
- for i in range (41 - len(mme_entry)):
- mme_entry += '\0'
-
- self.apply (maximus, sta, sta_mac_addr, mme_entry)
diff --git a/cesar/maximus/python/tools/csi/csiavln.py b/cesar/maximus/python/tools/csi/csiavln.py
index b020758684..069c9f1b7a 100644
--- a/cesar/maximus/python/tools/csi/csiavln.py
+++ b/cesar/maximus/python/tools/csi/csiavln.py
@@ -1,12 +1,14 @@
from csistation import csiSta
+from own_data import Station_own_data
class csiAvln:
- def __init__ (self, npw, ahfid):
+ def __init__ (self, npw, ahfid, id_num = 0):
self.__npw = npw
self.__ahfid = ahfid
self.__hp_sta_max = 254
self.__sta_list = list()
+ self.__id_num = id_num
def get_ahfid (self):
return self.__ahfid
@@ -57,3 +59,47 @@ class csiAvln:
if sta.get_mac_addr () == mac_addr:
self.__sta_list.remove (sta)
break
+
+ def add_snr (self, maximus, snr):
+ """Add a noise on the avln medium for all stations of the AVLN.
+ snr: the snr value.
+ """
+ maximus.disturb_channel (True)
+ for sta_src in self.__sta_list:
+ for sta_dst in self.__sta_list:
+ if sta_src != sta_dst:
+ maximus.set_snr_from_src_to_dst (snr,
+ sta_src.get_sta_cesar ().get (),
+ sta_dst.get_sta_cesar ().get (),
+ True)
+
+ def add_stas (self, nb_stas, internal_conf = None):
+ """Create nb_stats into the AVLN."""
+ for i in range (nb_stas):
+ nb = i + 1
+ sta_mac = "00:13:d7:00:%02x:%02x" % (self.__id_num, nb)
+ dpw = "HomePlugAV_AVLN%d_station%d" % (self.__id_num, nb)
+ mhfid = "HomePlugAV_AVLN%d_station%d" % (self.__id_num, nb)
+ uhfid = "HomePlugAV_AVLN%d_station%d" % (self.__id_num, nb)
+ self.sta_add (sta_mac, False, False, dpw, mhfid, uhfid, 0,
+ internal_conf = internal_conf)
+
+ def get_cco (self, maximus):
+ """Get the CCo of the AVLN."""
+ for i in self.__sta_list:
+ sta_data = Station_own_data ()
+ data = sta_data.get_data (maximus, i.get_sta_cesar ())
+ if data.is_cco:
+ return i
+ return None
+
+ def get_stas (self, maximus):
+ """Get all STA of the AVLN."""
+ stas = list ()
+ for i in self.__sta_list:
+ sta_data = Station_own_data ()
+ data = sta_data.get_data (maximus, i.get_sta_cesar ())
+ if not data.is_cco:
+ stas.append (i)
+ return stas
+
diff --git a/cesar/maximus/python/tools/csi/csicore.py b/cesar/maximus/python/tools/csi/csicore.py
index 6522d45146..f3665011b2 100644
--- a/cesar/maximus/python/tools/csi/csicore.py
+++ b/cesar/maximus/python/tools/csi/csicore.py
@@ -28,6 +28,7 @@ class csiCore:
self.__recv_obj = None
self.__frames_recv = list ()
self.__frames_sent = list ()
+ self.sniffed_packets = list ()
self.__proto = False
@@ -35,10 +36,12 @@ class csiCore:
random.seed (seed);
def __receive_all_frames (self, frame):
- if frame.get_type() == 'ETHERNET_TYPE_DATA':
+ if frame.get_type() is 'ETHERNET_TYPE_DATA':
frame.src = NULL_MAC_ADDRESS[0:17 - len(frame.src)] + frame.src
frame.dst = NULL_MAC_ADDRESS[0:17 - len(frame.dst)] + frame.dst
self.__frames_recv.append (frame)
+ elif frame.get_type() is 'ETHERNET_TYPE_SNIFFER':
+ self.sniffed_packets.append (frame)
return True
def __frame_data_send (self, packet, payload):
@@ -114,43 +117,29 @@ class csiCore:
if ahfid == self.avln_get (i).get_ahfid():
return None
- avln = csiAvln (npw, ahfid)
-
# Adding the AVLN to the list.
if self.__avln_list == None:
self.__avln_list = list()
+ avln = csiAvln (npw, ahfid, len (self.__avln_list))
self.__avln_list.append(avln)
return avln
def avln_remove (self, avln):
self.__avln_list.remove (avln)
- def avln_create_traffic (self, avln, number_packets):
+ def avln_create_traffic (self, avln):
"""Create a random Ethernet data traffic based on the station random in the AVLN."""
packet_list = list()
- nb = 0
- while nb < number_packets:
- stop = False
-
- # Get sta source
- index = random.randint(0, avln.get_nb_sta() - 1)
- sta_src = avln.get_sta (index)
-
- # Get sta dest
- index = random.randint(0, avln.get_nb_sta())
- if index == avln.get_nb_sta ():
- sta_dest = None
- elif avln.get_sta (index) != sta_src:
- sta_dest = avln.get_sta (index)
- else:
- stop = True
-
- if stop != True:
+ for i in range (avln.get_nb_sta()):
+ sta_src = avln.get_sta (i)
+ for j in range (avln.get_nb_sta()):
+ if i == j:
+ sta_dest = None
+ else:
+ sta_dest = avln.get_sta (j)
packet = csiPacket(random.randint(14, 1500), avln, sta_src, None, sta_dest)
packet_list.append (packet)
- nb = nb + 1
-
return packet_list
def avln_create_bridge_traffic (self, avln, number_packets):
@@ -224,7 +213,8 @@ class csiCore:
def process_uninit (self):
"""Unitialise Maximus, stop it, free resources."""
- self.__maximus.uninit ()
+ self.__maximus.uninit()
+ del (self.__maximus)
def process_sta_start (self, station = None):
"""Start a station which was not launched yet."""
@@ -337,6 +327,7 @@ class csiCore:
def process_data_send_traffic (self, packet_list):
+ self.transmission_result_reset ()
for i in range (0, len (packet_list)):
packet = packet_list[i]
payload = ""
@@ -384,6 +375,15 @@ class csiCore:
log.close()
+ def process_wait_transmission (self, timeout_sec = 10):
+ """Wait for transmission complete until timeout is not exceeded."""
+ maximus_current_date = self.__maximus.get_date ()
+ timeout_date = sec_to_tck (timeout_sec) + maximus_current_date
+ print "Waiting transmission ends, please wait"
+ while (self.__maximus.get_date () < timeout_date \
+ and len (self.__frames_sent) > len (self.__frames_recv)):
+ self.process_wait_sec (0.1)
+
def process_end_get_result (self):
"""Get the result of the test."""
self.__test.result_print ()
@@ -392,13 +392,16 @@ class csiCore:
def transmission_result_reset (self):
"""Reset the counter of received or sent packets for the test."""
# Reset the transmission list.
+ for i in self.__frames_recv:
+ del i
+ for i in self.__frames_sent:
+ del i
self.__frames_recv = list ()
self.__frames_sent = list ()
self.__test.reset ()
def process_wait_sec (self, sec = 5):
"""Request the test to wait X seconds."""
- print "\nWaiting ", sec, " seconds in Maximus time"
self.__maximus.wait (sec_to_tck (sec))
def process_verify_assoc_on_avln (self, avln):
@@ -413,14 +416,13 @@ class csiCore:
break
return assoc
- def process_wait_association (self, timeout = 15):
+ def process_wait_association (self, timeout = 5):
"""Wait until all the station of all AVLN are associated."""
time = 0;
-
assoc = False
+ print "Waiting for association"
while (time < timeout and assoc == False):
time = time + 1;
- print "Waiting 1 sec for association"
self.__maximus.wait (sec_to_tck (1))
for i in range (0, self.avln_nb()):
@@ -448,14 +450,13 @@ class csiCore:
return auth
- def process_wait_authentication(self, timeout = 15):
+ def process_wait_authentication(self, timeout = 5):
"""Wait until all the station of all AVLN are authenticated."""
time = 0;
-
auth = False
+ print "Waiting for authentication"
while (time < timeout and auth == False):
time = time + 1;
- print "Waiting 1 sec for authentication"
self.process_avlns_send_broadcast_delayed (0.5)
for i in range (0, self.avln_nb()):
@@ -472,31 +473,6 @@ class csiCore:
self.__maximus.wait (sec_to_tck (1))
return auth
-
- def sniffer_activate (self, sta, mme_tx=True, mme_rx=True, beacon_tx=True, beacon_rx=True):
- """Activate the sniffer for a particular station."""
- from maximus.simu.rx import recv
- sniffer = sta.get_sniffer()
- sniffer.set_mask (mme_tx, mme_rx, beacon_tx, beacon_rx)
- sniffer.apply_conf (self.__maximus, sta.get_sta_cesar(), sta.get_mac_addr())
-
- if self.__proto == False:
- rsp = recv(self.__maximus, count=1, filter=frame_filter_sniffer,
- timeout = ms_to_tck(100))
- else:
- rsp = True
-
- if rsp == None:
- return False
- else:
- return True
-
- def sniffer_deactivate (self, sta):
- """Activate the sniffer for a particular station."""
- from maximus.simu.rx import recv
- sniffer = sta.get_sniffer()
- sniffer.deactivate_full (self.__maximus, sta.get_sta_cesar(), sta.get_mac_addr())
-
def sniff_packets (self, count = 1, timeout_sec = 10):
from maximus.simu.rx import recv
print "Waiting ", timeout_sec, "sec in Maximus ticks maximum timeout"
@@ -561,3 +537,29 @@ class csiCore:
line += t[j] + " | "
print line
+ def reset_sniffed_packets (self):
+ """Reset sniffed packets."""
+ while (len (self.sniffed_packets)):
+ p = self.sniffed_packets.pop ()
+ del p
+
+ def init_test_bed (self, array_nb_stas, internal_conf = None):
+ """Initialise a test bed with an array of nb_stas.
+ array_nb_stas: An array of nb_stats to create len(array) AVLNs with
+ nb_stas on each.
+ Example array_nb_stas[2, 4] will create two AVLN, the first wit two
+ stations, the second one with four stations.
+ """
+ for i in array_nb_stas:
+ # Generate a NPW.
+ npw = str (random.getrandbits(64))
+ ahfid = str (random.getrandbits(32))
+ avln = self.avln_add (npw, ahfid)
+ avln.add_stas (i, internal_conf)
+ self.process_avlns_launch ()
+ self.process_wait_association ()
+ self.process_wait_authentication ()
+
+ def uninit_test_bed (self):
+ """Initialise the test bed."""
+ self.process_avlns_remove ()
diff --git a/cesar/maximus/python/tools/csi/csistation.py b/cesar/maximus/python/tools/csi/csistation.py
index e082054638..338eddfd76 100644
--- a/cesar/maximus/python/tools/csi/csistation.py
+++ b/cesar/maximus/python/tools/csi/csistation.py
@@ -1,5 +1,4 @@
from maximus.station.config import Config
-from sniffer import sniffer
class csiSta:
@@ -23,7 +22,6 @@ class csiSta:
self.__config.internal_conf = internal_conf
self.__config.default_config = True if not internal_conf else False
- self.__sniffer = None
self.__delay_ms = delay_ms
self.__bridge_addr = None
self.__tei = None
@@ -71,13 +69,6 @@ class csiSta:
def get_config (self):
return self.__config
- def get_sniffer (self):
- if self.__sniffer == None:
- self.__sniffer = sniffer()
- return self.__sniffer
- else:
- return self.__sniffer
-
def get_delay_ms (self):
return self.__delay_ms
diff --git a/cesar/test_general/station/cco0/s1/Config b/cesar/test_general/station/cco0/s1/Config
deleted file mode 100644
index ff5bdc3671..0000000000
--- a/cesar/test_general/station/cco0/s1/Config
+++ /dev/null
@@ -1,2 +0,0 @@
-CONFIG_TRACE = y
-CONFIG_TRACE_ON_FATAL = y
diff --git a/cesar/test_general/station/cco0/s1/Makefile b/cesar/test_general/station/cco0/s1/Makefile
deleted file mode 100644
index 5f9309c249..0000000000
--- a/cesar/test_general/station/cco0/s1/Makefile
+++ /dev/null
@@ -1,14 +0,0 @@
-BASE = ../../../..
-ECOS = y
-
-TARGET_PROGRAMS= cco0s1
-
-cco0s1_SOURCES =
-cco0s1_MODULES = lib mac/common mac cl hle interface cp hal station \
- host cp/av bsu \
- test_general/station/fcall \
- test_general/station/common ce/stub
-
-include $(BASE)/common/make/top.mk
-
-$(call src2obj,src/region_stub.c,target): $(BASE)/cp/fsm/fsm.h
diff --git a/cesar/test_general/station/cco0/s1/doc/Makefile b/cesar/test_general/station/cco0/s1/doc/Makefile
deleted file mode 100644
index 4e22f6c448..0000000000
--- a/cesar/test_general/station/cco0/s1/doc/Makefile
+++ /dev/null
@@ -1,29 +0,0 @@
-PAGES= test-plan.txt
-MSC = scenario_1.msc scenario_2.msc scenario_3.msc scenario_4.msc \
- scenario_5.msc scenario_6.msc scenario_7.msc scenario_8.msc
-
-ODT=$(PAGES:%.txt=%.odt)
-HTML=$(PAGES:%.txt=%.html)
-PNG=$(MSC:%.msc=%.png)
-
-all: $(ODT) $(HTML) $(PNG)
-
-odt: $(ODT)
-
-html: $(HTML)
-
-png: $(PNG)
-
-%.odt: %.txt
- rst2odt.py $< $@
-
-%.html: %.txt
- rst2html $< $@
-
-%.png: %.msc
- mscgen -T png -i $< -o $@
-
-clean:
- rm -f $(ODT)
- rm -f $(HTML)
- rm -f $(PNG)
diff --git a/cesar/test_general/station/cco0/s1/doc/scenario_1.msc b/cesar/test_general/station/cco0/s1/doc/scenario_1.msc
deleted file mode 100644
index 3cb4b54bed..0000000000
--- a/cesar/test_general/station/cco0/s1/doc/scenario_1.msc
+++ /dev/null
@@ -1,11 +0,0 @@
-# One station alone in the AVLN. It shall become UCCo and send a discover
-# beacon.
-
-msc
-{
-STA, AVLN;
-
-STA -> STA [label = "Power On Detect"];
---- [label = "Power on passed, nothing heard on the medium"];
-STA -> AVLN [label = "Send discover beacon"];
-}
diff --git a/cesar/test_general/station/cco0/s1/doc/scenario_2.msc b/cesar/test_general/station/cco0/s1/doc/scenario_2.msc
deleted file mode 100644
index 184c564069..0000000000
--- a/cesar/test_general/station/cco0/s1/doc/scenario_2.msc
+++ /dev/null
@@ -1,17 +0,0 @@
-# Two station tries an association.
-
-msc
-{
-STA1, STA2;
-
-STA1 -> STA1 [label = "Power on detect"];
-STA2 -> STA2 [label = "Power on detect"];
---- [label = "Station 1 beacomes UCCo cause of the Seed"];
-STA1 -> STA2 [label = "Discover beacon"];
-STA2 -> STA1 [label = "CC_ASSOC.REQ (join = NEW)"];
-STA1 -> STA1 [label = "Become CCo, Get TEI = 1"];
-STA1 -> STA2 [label = "CC_ASSOC.CNF (Granted, TEI = 2)"];
-STA2 -> STA1 [label = "CM_GET_KEY.REQ (PID = 0)"];
-STA1 -> STA2 [label = "CM_GET_KEY.CNF"];
---- [label = "Test ended"];
-}
diff --git a/cesar/test_general/station/cco0/s1/doc/scenario_3.msc b/cesar/test_general/station/cco0/s1/doc/scenario_3.msc
deleted file mode 100644
index d6e1afe940..0000000000
--- a/cesar/test_general/station/cco0/s1/doc/scenario_3.msc
+++ /dev/null
@@ -1,22 +0,0 @@
-# Two station sending data.
-
-msc
-{
-STA1, STA2;
-
-STA1 -> STA1 [label = "Power on detect"];
-STA2 -> STA2 [label = "Power on detect"];
---- [label = "Station 1 beacomes UCCo cause of the Seed"];
-STA1 -> STA2 [label = "Discover beacon"];
-STA2 -> STA1 [label = "CC_ASSOC.REQ (join = NEW)"];
-STA1 -> STA1 [label = "Become CCo, Get TEI = 1"];
-STA1 -> STA2 [label = "CC_ASSOC.CNF (Granted, TEI = 2)"];
-STA2 -> STA1 [label = "CM_GET_KEY.REQ (PID = 0)"];
-STA1 -> STA2 [label = "CM_GET_KEY.CNF"];
---- [label = "Communication part"];
-STA2 -> STA1 [label = "Send a Ethernet packet"];
-STA1 -> STA2 [label = "Send a Ethernet packet"];
---- [label = "In the next script"];
-STA1 -> STA2 [label = "Send a Ethernet packet"];
-STA1 -> STA2 [label = "Send a Ethernet packet"];
-}
diff --git a/cesar/test_general/station/cco0/s1/doc/scenario_4.msc b/cesar/test_general/station/cco0/s1/doc/scenario_4.msc
deleted file mode 100644
index d9e57b05df..0000000000
--- a/cesar/test_general/station/cco0/s1/doc/scenario_4.msc
+++ /dev/null
@@ -1,19 +0,0 @@
-# Two station sending data.
-
-msc
-{
-STA1, STA2;
-
-STA1 -> STA1 [label = "Power on detect"];
-STA2 -> STA2 [label = "Power on detect"];
---- [label = "Station 2 beacomes UCCo cause of the Seed"];
-STA2 -> STA1 [label = "Discover beacon"];
-STA1 -> STA2 [label = "CC_ASSOC.REQ (join = NEW)"];
-STA2 -> STA2 [label = "Become CCo, Get TEI = 1"];
-STA2 -> STA1 [label = "CC_ASSOC.CNF (Granted, TEI = 2)"];
-STA1 -> STA2 [label = "CM_GET_KEY.REQ (PID = 0)"];
-STA2 -> STA1 [label = "CM_GET_KEY.CNF"];
---- [label = "Communication part"];
-STA1 -> STA2 [label = "Send CC_WHO_RU.REQ"];
-STA2 -> STA1 [label = "CC_WHO_RU.CNF (AVLN1)"];
-}
diff --git a/cesar/test_general/station/cco0/s1/doc/scenario_5.msc b/cesar/test_general/station/cco0/s1/doc/scenario_5.msc
deleted file mode 100644
index 2bcdffb7f4..0000000000
--- a/cesar/test_general/station/cco0/s1/doc/scenario_5.msc
+++ /dev/null
@@ -1,20 +0,0 @@
-# Two station sending data.
-
-msc
-{
-STA1, STA2;
-
-STA1 -> STA1 [label = "Power on detect"];
-STA2 -> STA2 [label = "Power on detect"];
---- [label = "Station 2 beacomes UCCo cause of the Seed"];
-STA1 -> STA2 [label = "Discover beacon"];
-STA2 -> STA1 [label = "CC_ASSOC.REQ (join = NEW)"];
-STA1 -> STA1 [label = "Become CCo, Get TEI = 1"];
-STA1 -> STA2 [label = "CC_ASSOC.CNF (Granted, TEI = 2)"];
-STA2 -> STA1 [label = "CM_GET_KEY.REQ (PID = 0)"];
-STA1 -> STA2 [label = "CM_GET_KEY.CNF"];
---- [label = "Communication part"];
-STA2 -> STA1 [label = "Send CC_LEAVE.REQ"];
-STA1 -> STA2 [label = "CC_LEAVE.CNF)"];
---- [label = "The station 1 keeps the CCo status for 1 second"];
-}
diff --git a/cesar/test_general/station/cco0/s1/doc/scenario_6.msc b/cesar/test_general/station/cco0/s1/doc/scenario_6.msc
deleted file mode 100644
index 8597fd2d70..0000000000
--- a/cesar/test_general/station/cco0/s1/doc/scenario_6.msc
+++ /dev/null
@@ -1,24 +0,0 @@
-# Three station sending data.
-
-msc
-{
-STA1, STA2, STA3, bcast;
-
-STA1 -> STA1 [label = "Power on detect"];
-STA2 -> STA2 [label = "Power on detect"];
-STA3 -> STA3 [label = "Power on detect"];
---- [label = "Station 2 beacomes UCCo cause of the Seed"];
-STA2 -> STA1 [label = "Discover beacon"];
-STA1 -> STA2 [label = "CC_ASSOC.REQ (join = NEW)"];
-STA2 -> STA2 [label = "Become CCo, Get TEI = 1"];
-STA2 -> STA1 [label = "CC_ASSOC.CNF (Granted, TEI = 2)"];
-STA3 -> STA2 [label = "CC_ASSOC.REQ (join = NEW)"];
-STA2 -> STA3 [label = "CC_ASSOC.CNF (Granted, TEI = 3)"];
-STA2 -> STA3 [label = "CC_SET_TEI_MAP.IND (UPDATE)"];
-STA2 -> bcast [label = "CC_SET_TEI_MAP.IND (ADD)"];
-STA3 -> STA2 [label = "CM_ENC_PAYLOAD.IND (CM_GET_KEY.REQ (PID = 0))"];
-STA2 -> STA3 [label = "CM_ENC_PAYLOAD.IND (CM_GET_KEY.CNF)"];
-STA1 -> STA2 [label = "CM_ENC_PAYLOAD.IND (CM_GET_KEY.REQ (PID = 0))"];
-STA2 -> STA1 [label = "CM_ENC_PAYLOAD.IND (CM_GET_KEY.CNF)"];
---- [label = "Test end, verify the station state"];
-}
diff --git a/cesar/test_general/station/cco0/s1/doc/scenario_7.msc b/cesar/test_general/station/cco0/s1/doc/scenario_7.msc
deleted file mode 100644
index af718d2abe..0000000000
--- a/cesar/test_general/station/cco0/s1/doc/scenario_7.msc
+++ /dev/null
@@ -1,33 +0,0 @@
-# Three station sending data.
-
-msc
-{
-STA1, STA2, STA3, bcast;
-
-STA1 -> STA1 [label = "Power on detect"];
-STA2 -> STA2 [label = "Power on detect"];
-STA3 -> STA3 [label = "Power on detect"];
---- [label = "Station 2 beacomes UCCo cause of the Seed"];
-STA2 -> STA1 [label = "Discover beacon"];
-STA1 -> STA2 [label = "CC_ASSOC.REQ (join = NEW)"];
-STA2 -> STA2 [label = "Become CCo, Get TEI = 1"];
-STA2 -> STA1 [label = "CC_ASSOC.CNF (Granted, TEI = 2)"];
-STA3 -> STA2 [label = "CC_ASSOC.REQ (join = NEW)"];
-STA2 -> STA3 [label = "CC_ASSOC.CNF (Granted, TEI = 3)"];
-STA2 -> STA3 [label = "CC_SET_TEI_MAP.IND (UPDATE)"];
-STA2 -> bcast [label = "CC_SET_TEI_MAP.IND (ADD)"];
-STA3 -> STA2 [label = "CM_ENC_PAYLOAD.IND (CM_GET_KEY.REQ (PID = 0))"];
-STA2 -> STA3 [label = "CM_ENC_PAYLOAD.IND (CM_GET_KEY.CNF)"];
-STA1 -> STA2 [label = "CM_ENC_PAYLOAD.IND (CM_GET_KEY.REQ (PID = 0))"];
-STA2 -> STA1 [label = "CM_ENC_PAYLOAD.IND (CM_GET_KEY.CNF)"];
---- [label = "Starting transmitting data"];
-STA3 -> bcast [label = "Send Data packet, EKS = 0"];
-STA1 -> bcast [label = "Send Data packet, EKS = 0"];
---- [label = "Bcast packet done to indicate that the station are authenticate"];
-STA3 -> STA2 [label = "Send Data packet, EKS = 0"];
-STA3 -> STA1 [label = "Send Data packet, EKS = 0"];
-STA1 -> STA2 [label = "Send Data packet, EKS = 0"];
-STA1 -> STA3 [label = "Send Data packet, EKS = 0"];
-STA2 -> STA1 [label = "Send Data packet, EKS = 0"];
-STA2 -> STA3 [label = "Send Data packet, EKS = 0"];
-}
diff --git a/cesar/test_general/station/cco0/s1/doc/scenario_8.msc b/cesar/test_general/station/cco0/s1/doc/scenario_8.msc
deleted file mode 100644
index a4e22d36a3..0000000000
--- a/cesar/test_general/station/cco0/s1/doc/scenario_8.msc
+++ /dev/null
@@ -1,37 +0,0 @@
-# Three station sending data.
-
-msc
-{
-STA1, STA2, STA3, bcast;
-
-STA1 -> STA1 [label = "Power on detect"];
-STA2 -> STA2 [label = "Power on detect"];
-STA3 -> STA3 [label = "Power on detect"];
---- [label = "Station 2 beacomes UCCo cause of the Seed"];
-STA2 -> STA1 [label = "Discover beacon"];
-STA1 -> STA2 [label = "CC_ASSOC.REQ (join = NEW)"];
-STA2 -> STA2 [label = "Become CCo, Get TEI = 1"];
-STA2 -> STA1 [label = "CC_ASSOC.CNF (Granted, TEI = 2)"];
-STA3 -> STA2 [label = "CC_ASSOC.REQ (join = NEW)"];
-STA2 -> STA3 [label = "CC_ASSOC.CNF (Granted, TEI = 3)"];
-STA2 -> STA3 [label = "CC_SET_TEI_MAP.IND (UPDATE)"];
-STA2 -> bcast [label = "CC_SET_TEI_MAP.IND (ADD)"];
-STA3 -> STA2 [label = "CM_ENC_PAYLOAD.IND (CM_GET_KEY.REQ (PID = 0))"];
-STA2 -> STA3 [label = "CM_ENC_PAYLOAD.IND (CM_GET_KEY.CNF)"];
-STA1 -> STA2 [label = "CM_ENC_PAYLOAD.IND (CM_GET_KEY.REQ (PID = 0))"];
-STA2 -> STA1 [label = "CM_ENC_PAYLOAD.IND (CM_GET_KEY.CNF)"];
---- [label = "Starting transmitting data"];
-STA3 -> bcast [label = "Send Data packet, EKS = 0"];
-STA1 -> bcast [label = "Send Data packet, EKS = 0"];
---- [label = "Bcast packet done to indicate that the station are authenticate"];
-STA3 -> STA2 [label = "Send Data packet, EKS = 0"];
-STA3 -> STA1 [label = "Send Data packet, EKS = 0"];
-STA1 -> STA2 [label = "Send Data packet, EKS = 0"];
-STA1 -> STA3 [label = "Send Data packet, EKS = 0"];
-STA2 -> STA1 [label = "Send Data packet, EKS = 0"];
-STA2 -> STA3 [label = "Send Data packet, EKS = 0"];
---- [label = "Few time later"];
-STA3 -> STA2 [label = "CC_LEAVE.REQ"];
-STA2 -> STA3 [label = "CC_LEAVE.CNF"];
-STA2 -> bcast [label = "CC_SET_TEI_MAP.IND"];
-}
diff --git a/cesar/test_general/station/cco0/s1/doc/test-plan.txt b/cesar/test_general/station/cco0/s1/doc/test-plan.txt
deleted file mode 100644
index 5284282562..0000000000
--- a/cesar/test_general/station/cco0/s1/doc/test-plan.txt
+++ /dev/null
@@ -1,106 +0,0 @@
-.. contents:: Table of Contents
-
-The test shall be realised with the station present in the directory
-test_general/station/cco0/s1.
-
-.. Hint:: For more details, compile the Makefile in /trunk/cesar/test_general/station/cco0/s1/doc.
-
- The scenario of the tests are described in the msc files which produce png picture once interpreted with mscgen.
-
- Or using wireshark, and displaying the flow with the analysis tool.
-
-Initialisation
-==============
-
-The objective is to verify the initialisation of a full station.
-The station will receive the following MME Driver to be configured.
-
- * DRV_STA_SET_MAC_ADDR_REQ
- * DRV_STA_SET_CCO_PREF_REQ
- * DRV_STA_SET_WAS_CCO_REQ
- * DRV_STA_SET_SL_REQ
- * DRV_STA_SET_M_STA_HFID_REQ
- * DRV_STA_SET_AVLN_HFID_REQ
- * DRV_STA_SET_U_STA_HFID_REQ
- * DRV_STA_SET_TONEMASK_REQ
- * DRV_STA_START_REQ
- * DRV_STA_STOP_REQ
-
-The station shall answer to each one in order to receive the next one.
-The python test 'init.py' verifies at the end that the data provided by the
-DRV MME have been kept and stored by the station.
-
-Mac Start
-=========
-
-Description
------------
-
-The mac start MME driver has for job to request the station to start listening
-the medium by entering in the Power On detect procedure.
-
-For that the station shall:
-
- * Create default schedules.
- * Activate the Mac layer.
-
-Create default schedules:
-
- The defaults schedules are provided to the Channel Access, this will allow
- the CA to listen the medium. The beacon module has this charge, it also
- program a timer (Leon timer) to be awaken before the defaults schedules ends
- (3 * 4095 ATU), this will post an event in the FSM which will normally
- request the beacon module to create defaults schedules again.
-
-Activate the Mac layer:
-
- The activation of the Mac layer will allow the station to listen in a first
- time what is being transmitted on the medium. During the Power On detect
- procedure it will listen the medium (2 seconds if the station was CCo at the
- last boot or 4 seconds if it was a simple station) searching for a central
- beacon of the same NID.
-
-Result
-------
-
-The result of this test shall ends with the station passing to the UCCo state
-and emitting a discover beacon over the medium. The UCCo state is only valid
-if there are no others AVLN on the medium (which is the case of this test). If
-another AVLN is present the station shall become a USTA.
-
-Two Station
-===========
-
-Description
------------
-
-.. HINT::
- The two station have the same NID.
-
-First step:
- This test shall use two stations, one of those shall become UCCo and the other
- one shall become USTA.
-
-Second step:
- The USTA shall try to associate with the UCCo, as it have the same NID the
- UCCo will associate the station and provide a TEI to it.
-
-Result
-------
-
-1. The UCCo becomes CCo.
-
-2. The USTA becomes a STA.
-
-3. The Station shall send a CC_ASSOC.REQ to the CCo.
-
-4. The CCO shall provide a TEI to the station and answer with a CC_ASSOC.CNF
- and send the CC_SET_TEI_MAP.IND to the station.
-
-5. The station shall send a CC_ENCRYPTED_PAYLOAD.IND encapsulating a
- CM_GET_KEY.REQ to the CCo.
-
-6. The CCo shall answer with a CC_ENCRYPTED_PAYLOAD.IND encapsulating a
- CM_GET_KEY.CNF to the station with the neks.
-
-The station is now able to send data to the CCo on the medium.
diff --git a/cesar/test_general/station/cco0/s1/py/cm_unassociated_sta.py b/cesar/test_general/station/cco0/s1/py/cm_unassociated_sta.py
deleted file mode 100644
index 8db6f6abc0..0000000000
--- a/cesar/test_general/station/cco0/s1/py/cm_unassociated_sta.py
+++ /dev/null
@@ -1,160 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-# Two station with the Mac start order #
-# ---------------------------------------------------------------------- #
-# #
-# Objective: Two station which starts at the same time, One will become #
-# the CCo the other one shall become an unassociated station. #
-# At this point the station shall try an association with the #
-# CCo. #
-# Hint: The two station does not have the same NID. #
-##############################################################################
-
-import sys
-sys.path.append('../../../../maximus/python/obj');
-sys.path.append('../../../../maximus/python');
-sys.path.append('../../../../maximus/python/lib/cesar');
-
-from interface import *
-from string import *
-from struct import *
-from maximus import *
-from sta_cesar import STACesar
-from own_data import Station_own_data
-from sniffer import *
-from sta_mgr import *
-
-import unittest
-
-def ms_to_tck (ms):
- return (ms * 25000)
-
-def my_mpdu_filter(mpdu):
- if mpdu.get_type() is 'PHY_TYPE_MPDU_PAYLOAD':
- # The received object is an MPDU
- return True
- else:
- return False
-
-
-# Initialise Maximus with the station.
-maximus = Maximus()
-maximus.init (sys.argv + ['-e', './obj/cco0s1.elf'])
-
-# Configure the first station.
-sta1_conf = Config ()
-sta1_conf.mac_address = (0x10, 0x11, 0x12, 0x13, 0x14, 0x15)
-sta1_conf.cco_preference = False
-sta1_conf.was_cco = False
-sta1_conf.npw = "HomePlugAV0123"
-sta1_conf.dpw = "STATION_DEVICE_PASSWORD"
-sta1_conf.m_sta_hfid = "HPAV_STATION"
-sta1_conf.u_sta_hfid = "STA1"
-sta1_conf.avln_hfid = "AVLN1"
-sta1_conf.tonemask = (85,139,167,214,225,282,302,409,419,569,591,736,748,856,882,1015,1027,1143,1535)
-sta1_conf.sl = 1
-sta1_conf.snid = None
-
-# Configure the second station.
-sta2_conf = Config ()
-sta2_conf.mac_address = (0x20, 0x21, 0x22, 0x23, 0x24, 0x25)
-sta2_conf.cco_preference = False
-sta2_conf.was_cco = False
-sta2_conf.npw = "Spidcom-SPC300"
-sta2_conf.dpw = "STATION_DEVICE_PASSWORD"
-sta2_conf.m_sta_hfid = "HPAV_STATION"
-sta2_conf.u_sta_hfid = "STA2"
-sta2_conf.avln_hfid = "AVLN1"
-sta2_conf.tonemask = (85,139,167,214,225,282,302,409,419,569,591,736,748,856,882,1015,1027,1143,1535)
-sta2_conf.sl = 1
-sta2_conf.snid = None
-
-# Create the station
-print ""
-print "Starting the test ..."
-sta1 = STACesar (maximus, config=sta1_conf, mme_buffer_nb=1, debug=False, config_mode="MME", seed=1224)
-sta2 = STACesar (maximus, config=sta2_conf, mme_buffer_nb=1, debug=False, config_mode="MME", seed=2345)
-
-# Activate the Sniffer module only for the MMEs.
-sta1_sniffer = sniffer ()
-sta1_sniffer.activate_mme (maximus, sta1, sta1_conf.mac_address)
-
-
-while (maximus.get_date () < 240000000):
- wait = ms_to_tck (1000)
- maximus.wait (wait)
-
-class TestInitFunctions(unittest.TestCase):
-
- def setUp(self):
- pass
-
- def tearDown(self):
- pass
-
- def testAuthenticateSta1(self):
- sta_data = Station_own_data ()
- data = sta_data.get_data (maximus, sta1)
-
- self.failUnless (data.mac_address == sta1_conf.mac_address)
- self.failUnless (data.cco_prefered == sta1_conf.cco_preference)
- # The station become CCo so the was_cco status have evolved.
- self.failUnless (data.was_cco == sta1_conf.was_cco)
- self.failUnless (data.npw == sta1_conf.npw)
- self.failUnless (data.dpw == sta1_conf.dpw)
- self.failUnless (data.hfid_manufacturer == sta1_conf.m_sta_hfid)
- self.failUnless (data.hfid_user == sta1_conf.u_sta_hfid)
- self.failUnless (data.security_level == sta1_conf.sl)
- self.failUnless (data.tei == 0)
- self.failUnless (data.authenticated == 0)
- self.failUnless (data.is_cco == 0)
- nid = data.nid;
- snid = data.snid;
-
- def testAuthenticateSta2(self):
- sta_data = Station_own_data ()
- data = sta_data.get_data (maximus, sta2)
-
- self.failUnless (data.mac_address == sta2_conf.mac_address)
- self.failUnless (data.cco_prefered == sta2_conf.cco_preference)
- # The station become CCo so the was_cco status have evolved.
- self.failUnless (data.was_cco == sta2_conf.was_cco)
- self.failUnless (data.npw == sta2_conf.npw)
- self.failUnless (data.dpw == sta2_conf.dpw)
- self.failUnless (data.hfid_manufacturer == sta2_conf.m_sta_hfid)
- self.failUnless (data.hfid_user == sta2_conf.u_sta_hfid)
- self.failUnless (data.security_level == sta2_conf.sl)
- self.failUnless (data.tei == 0)
- self.failUnless (data.authenticated == 0)
- self.failUnless (data.is_cco == 0)
-
- def teststa1instamgrsta2(self):
- # verify if the station 2 is present in the station manager of the
- # station 1.
- my_sta_mgr = Sta_mgr ()
- my_sta_mgr.get_unassoc_sta (maximus, sta2, 0, 0x184e35a5cb6b02, 0x151413121110)
-
- self.failUnless (my_sta_mgr.tei == 0)
-
- def teststa2instamgrsta1(self):
- # verify if the station 2 is present in the station manager of the
- # station 1.
- my_sta_mgr = Sta_mgr ()
- my_sta_mgr.get_unassoc_sta (maximus, sta1, 0, 0x15c4110f87b14f, 0x252423222120)
-
- self.failUnless (my_sta_mgr.tei == 0)
-
-suite = unittest.TestLoader().loadTestsFromTestCase(TestInitFunctions)
-
-testResult = unittest.TextTestRunner(verbosity=2).run(suite)
-
-# Delete the station.
-print "Removing STA 1 ..."
-sta1.remove()
-print "Removing STA 2 ..."
-sta2.remove()
-
-
-# For nightly build errors
-sys.exit ((1, 0)[testResult.wasSuccessful ()])
diff --git a/cesar/test_general/station/cco0/s1/py/init.py b/cesar/test_general/station/cco0/s1/py/init.py
deleted file mode 100644
index d10c0d5246..0000000000
--- a/cesar/test_general/station/cco0/s1/py/init.py
+++ /dev/null
@@ -1,90 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-# Initialisation test of the station #
-# ----------------------------------------------------------------------- #
-# #
-# Objective of this test is to provide a script which verifies that the #
-# station is correctly initialised to communicate between all the layers. #
-##############################################################################
-
-import sys
-sys.path.append('../../../../maximus/python/obj');
-sys.path.append('../../../../maximus/python');
-sys.path.append('../../../../maximus/python/lib/cesar');
-
-from interface import *
-from string import *
-from struct import *
-from maximus import *
-from sta_cesar import STACesar
-from own_data import Station_own_data
-
-import unittest
-
-# Initialise Maximus with the station.
-maximus = Maximus()
-maximus.init (sys.argv + ['-e', './obj/cco0s1.elf'])
-
-class TestInitFunctions(unittest.TestCase):
-
- def setUp(self):
- pass
-
- def tearDown(self):
- pass
-
- def testconfig (self):
- # Configure the first station.
- conf_sta = Config ()
- conf_sta.mac_address = (0x11, 0x21, 0x31, 0x41, 0x51, 0x61)
- conf_sta.cco_preference = True
- conf_sta.was_cco = True
- conf_sta.npw = "HomePlugAV0123"
- conf_sta.dpw = "STATION_DEVICE_PASSWORD"
- conf_sta.m_sta_hfid = "HPAV_STATION"
- conf_sta.u_sta_hfid = "STA1_CCO"
- conf_sta.avln_hfid = "AVLN1"
- conf_sta.tonemask = (85,139,167,214,225,282,302,409,419,569,591,736,748,856,882,1015,1027,1143,1535)
- conf_sta.sl = 1
- conf_sta.snid = None
-
- # Create the station
- sta = STACesar (maximus, config=conf_sta, mme_buffer_nb=1, debug=False, config_mode="MME", seed = 0x1234)
-
- # Wait for 1 000 000.
- maximus.wait (10000)
-
- sta_data = Station_own_data ()
- data = sta_data.get_data (maximus, sta)
-
- self.failUnless (data.mac_address == conf_sta.mac_address)
- self.failUnless (data.cco_prefered == conf_sta.cco_preference)
- self.failUnless (data.was_cco == conf_sta.was_cco)
- self.failUnless (data.npw == conf_sta.npw)
- self.failUnless (data.dpw == conf_sta.dpw)
- self.failUnless (data.hfid_manufacturer == conf_sta.m_sta_hfid)
- self.failUnless (data.hfid_user == conf_sta.u_sta_hfid)
- self.failUnless (data.security_level == conf_sta.sl)
-
- sta.stop()
- # Sends a fcall to uninit the station.
- fcall = maximus.create_fcall ("fc_cesar_uninit")
- fcall.set_sta (sta.get())
- fcall.send()
-
- # Check the memory state.
- fcall = maximus.create_fcall ("fc_memory_state")
- fcall.set_sta (sta.get())
- fcall.send()
- result = fcall.bind_param_ushort ("result")
- self.failUnless (result == True);
-
- # Delete the station.
- sta.remove()
-
-suite = unittest.TestLoader().loadTestsFromTestCase(TestInitFunctions)
-testResult = unittest.TextTestRunner(verbosity=2).run(suite)
-
-# For nightly build errors
-sys.exit ((1, 0)[testResult.wasSuccessful ()])
diff --git a/cesar/test_general/station/cco0/s1/py/sc10_two_sta_with_snr.py b/cesar/test_general/station/cco0/s1/py/sc10_two_sta_with_snr.py
deleted file mode 100644
index 4f6666c74a..0000000000
--- a/cesar/test_general/station/cco0/s1/py/sc10_two_sta_with_snr.py
+++ /dev/null
@@ -1,187 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-# Two station with the Mac start order #
-# ---------------------------------------------------------------------- #
-# #
-# Objective: Two station which starts at the same time, one will become #
-# the CCo the other one shall become an unassociated station. #
-# At this point the station shall try an association with the #
-# CCo. #
-# Hint: The two station have the same NID. #
-##############################################################################
-
-import sys
-sys.path.append('../../../../maximus/python/obj');
-sys.path.append('../../../../maximus/python');
-sys.path.append('../../../../maximus/python/lib/cesar');
-
-from interface import *
-from string import *
-from struct import *
-from maximus import *
-from sta_cesar import STACesar
-from own_data import Station_own_data
-from sniffer import *
-
-import unittest
-
-def ms_to_tck (ms):
- return (ms * 25000)
-
-
-def my_mpdu_filter(mpdu):
- if mpdu.get_type() is 'PHY_TYPE_MPDU_PAYLOAD':
- # The received object is an MPDU
- return True
- else:
- return False
-
-def data_msdu_filter (msdu):
- if msdu.get_type () is 'ETHERNET_TYPE_DATA':
- # The received object is an MSDU
- return True
- else:
- return False
-
-# Initialise Maximus with the station.
-maximus = Maximus()
-maximus.init (sys.argv + ['-e', './obj/cco0s1.elf'])
-
-#Add noise on the medium.
-maximus.disturb_channel (True)
-set_snr (maximus, value = 1)
-
-realloc_buffer ( True )
-
-# Configure the first station.
-sta1_conf = Config ()
-sta1_conf.mac_address = (0x10, 0x11, 0x12, 0x13, 0x14, 0x15)
-sta1_conf.cco_preference = True
-sta1_conf.was_cco = True
-sta1_conf.npw = "HomePlugAV0123"
-sta1_conf.dpw = "STATION_DEVICE_PASSWORD"
-sta1_conf.m_sta_hfid = "HPAV_STATION"
-sta1_conf.u_sta_hfid = "STA1"
-sta1_conf.avln_hfid = "AVLN1"
-sta1_conf.tonemask = (85,139,167,214,225,282,302,409,419,569,591,736,748,856,882,1015,1027,1143,1535)
-sta1_conf.sl = 1
-sta1_conf.snid = None
-
-# Configure the second station.
-sta2_conf = Config ()
-sta2_conf.mac_address = (0x20, 0x21, 0x22, 0x23, 0x24, 0x25)
-sta2_conf.cco_preference = False
-sta2_conf.was_cco = False
-sta2_conf.npw = "HomePlugAV0123"
-sta2_conf.dpw = "STATION_DEVICE_PASSWORD"
-sta2_conf.m_sta_hfid = "HPAV_STATION"
-sta2_conf.u_sta_hfid = "STA2"
-sta2_conf.avln_hfid = "AVLN1"
-sta2_conf.tonemask = (85,139,167,214,225,282,302,409,419,569,591,736,748,856,882,1015,1027,1143,1535)
-sta2_conf.sl = 1
-sta2_conf.snid = None
-
-sta1_mac_addr = '10:11:12:13:14:15'
-sta2_mac_addr = '20:21:22:23:24:25'
-
-# Create the station
-print ""
-print "Starting the test ..."
-sta1 = STACesar (maximus, config=sta1_conf, mme_buffer_nb=1, debug=False, config_mode="MME", seed = 0x2345)
-sta2 = STACesar (maximus, config=sta2_conf, mme_buffer_nb=1, debug=False, config_mode="MME", seed = 0x1234)
-
-maximus.wait (50000000)
-
-class TestInitFunctions(unittest.TestCase):
-
- def setUp(self):
- pass
-
- def tearDown(self):
- pass
-
- def testAuthenticateSta1(self):
- sta_data = Station_own_data ()
- data = sta_data.get_data (maximus, sta1)
-
- self.failUnless (data.mac_address == sta1_conf.mac_address)
- self.failUnless (data.cco_prefered == sta1_conf.cco_preference)
- # The station become CCo so the was_cco status have evolved.
- self.failUnless (data.was_cco == True)
- self.failUnless (data.npw == sta1_conf.npw)
- self.failUnless (data.dpw == sta1_conf.dpw)
- self.failUnless (data.hfid_manufacturer == sta1_conf.m_sta_hfid)
- self.failUnless (data.hfid_user == sta1_conf.u_sta_hfid)
- self.failUnless (data.security_level == sta1_conf.sl)
- # The station is CCo and automatically authenticated.
- self.failUnless (data.tei != 0)
- self.failUnless (data.authenticated != 0)
- self.failUnless (data.is_cco != 0)
-
- def testAuthenticateSta2(self):
- sta_data = Station_own_data ()
- data = sta_data.get_data (maximus, sta2)
-
- self.failUnless (data.mac_address == sta2_conf.mac_address)
- self.failUnless (data.cco_prefered == sta2_conf.cco_preference)
- # The station become CCo so the was_cco status have evolved.
- self.failUnless (data.was_cco == sta2_conf.was_cco)
- self.failUnless (data.npw == sta2_conf.npw)
- self.failUnless (data.dpw == sta2_conf.dpw)
- self.failUnless (data.hfid_manufacturer == sta2_conf.m_sta_hfid)
- self.failUnless (data.hfid_user == sta2_conf.u_sta_hfid)
- self.failUnless (data.security_level == sta2_conf.sl)
- self.failUnless (data.tei != 0)
- self.failUnless (data.authenticated != 0)
- self.failUnless (data.is_cco == 0)
-
- def testDataTransmission1 (self):
- alloc_data_buffer (maximus, sta1)
- frame = Eth()
- frame.dst = sta1_mac_addr
- frame.src = sta2_mac_addr
- frame.type = 0x4F50
- frame.payload = "Hello world, this is only a test to send data over the PWL with two stations."
- frame.send (maximus, sta2)
-
- rsp = recv(maximus, count=1, filter=data_msdu_filter, timeout = 1000000000)
- self.failUnless (rsp != None)
- if rsp != None:
- rsp = rsp[0]
- self.failUnless (rsp.dst == frame.dst)
- self.failUnless (rsp.src == frame.src)
- self.failUnless (rsp.type == frame.type)
- self.failUnless (rsp.payload == frame.payload)
-
- def testDataTransmission2 (self):
- alloc_data_buffer (maximus, sta2)
- frame = Eth()
- frame.dst = sta2_mac_addr
- frame.src = sta1_mac_addr
- frame.type = 0x4F50
- frame.payload = "Hello I'm the station 1, this is only a test to send data over the PWL with two stations."
- frame.send (maximus, sta1)
-
- rsp = recv(maximus, count=1, filter=data_msdu_filter, timeout = 50000)
- self.failUnless (rsp != None)
- if rsp != None:
- rsp = rsp[0]
- self.failUnless (rsp.dst == frame.dst)
- self.failUnless (rsp.src == frame.src)
- self.failUnless (rsp.type == frame.type)
- self.failUnless (rsp.payload == frame.payload)
-
-suite = unittest.TestLoader().loadTestsFromTestCase(TestInitFunctions)
-
-testResult = unittest.TextTestRunner(verbosity=2).run(suite)
-
-# Delete the station.
-print "Removing STA 1 ..."
-sta1.remove()
-print "Removing STA 2 ..."
-sta2.remove()
-
-
-# For nightly build errors
-sys.exit ((1, 0)[testResult.wasSuccessful ()])
diff --git a/cesar/test_general/station/cco0/s1/py/sc11_three_sta_one_deactivate.py b/cesar/test_general/station/cco0/s1/py/sc11_three_sta_one_deactivate.py
deleted file mode 100644
index c34d3c5aaa..0000000000
--- a/cesar/test_general/station/cco0/s1/py/sc11_three_sta_one_deactivate.py
+++ /dev/null
@@ -1,275 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-# Three station with the Mac start order #
-# ---------------------------------------------------------------------- #
-# #
-# Objective: Three station which starts at the same time, one will become #
-# the CCo the other one shall become an unassociated station. #
-# At this point the station shall try an association with the #
-# CCo. #
-# Hint: The two station have the same NID. #
-##############################################################################
-
-import sys
-sys.path.append('../../../../maximus/python/obj');
-sys.path.append('../../../../maximus/python');
-sys.path.append('../../../../maximus/python/lib/cesar');
-
-from interface import *
-from string import *
-from struct import *
-from maximus import *
-from sta_cesar import STACesar
-from own_data import Station_own_data
-from sniffer import *
-
-import unittest
-
-def ms_to_tck (ms):
- return int(ms * 25000)
-
-def data_msdu_filter (msdu):
- if msdu.get_type () is 'ETHERNET_TYPE_DATA':
- # The received object is an MSDU
- return True
- else:
- return False
-
-s1_deb = False
-s2_deb = False
-s3_deb = False
-
-sta1_mac_addr = '10:11:12:13:14:15'
-sta2_mac_addr = '20:21:22:23:24:25'
-sta3_mac_addr = '30:31:32:33:34:35'
-
-# Initialise Maximus with the station.
-maximus = Maximus()
-maximus.init (sys.argv + ['-e', './obj/cco0s1.elf'])
-
-# Configure the first station.
-sta1_conf = Config ()
-sta1_conf.mac_address = (0x10, 0x11, 0x12, 0x13, 0x14, 0x15)
-sta1_conf.cco_preference = False
-sta1_conf.was_cco = False
-sta1_conf.npw = "HomePlugAV0123"
-sta1_conf.dpw = "STATION_DEVICE_PASSWORD"
-sta1_conf.m_sta_hfid = "HPAV_STATION"
-sta1_conf.u_sta_hfid = "STA1"
-sta1_conf.avln_hfid = "AVLN1"
-sta1_conf.tonemask = (85,139,167,214,225,282,302,409,419,569,591,736,748,856,882,1015,1027,1143,1535)
-sta1_conf.sl = 1
-sta1_conf.snid = None
-
-# Configure the second station.
-sta2_conf = Config ()
-sta2_conf.mac_address = (0x20, 0x21, 0x22, 0x23, 0x24, 0x25)
-sta2_conf.cco_preference = False
-sta2_conf.was_cco = False
-sta2_conf.npw = "HomePlugAV0123"
-sta2_conf.dpw = "STATION_DEVICE_PASSWORD"
-sta2_conf.m_sta_hfid = "HPAV_STATION"
-sta2_conf.u_sta_hfid = "STA2"
-sta2_conf.avln_hfid = "AVLN1"
-sta2_conf.tonemask = (85,139,167,214,225,282,302,409,419,569,591,736,748,856,882,1015,1027,1143,1535)
-sta2_conf.sl = 1
-sta2_conf.snid = None
-
-# Configure the third station.
-sta3_conf = Config ()
-sta3_conf.mac_address = (0x30, 0x31, 0x32, 0x33, 0x34, 0x35)
-sta3_conf.cco_preference = False
-sta3_conf.was_cco = False
-sta3_conf.npw = "HomePlugAV0123"
-sta3_conf.dpw = "STATION_DEVICE_PASSWORD"
-sta3_conf.m_sta_hfid = "HPAV_STATION"
-sta3_conf.u_sta_hfid = "STA3"
-sta3_conf.avln_hfid = "AVLN1"
-sta3_conf.tonemask = (85,139,167,214,225,282,302,409,419,569,591,736,748,856,882,1015,1027,1143,1535)
-sta3_conf.sl = 1
-sta3_conf.snid = None
-
-# Create the station
-print ""
-print "Starting the test ..."
-sta1 = STACesar (maximus, config=sta1_conf, mme_buffer_nb=1, debug=s1_deb, config_mode="MME", seed=1224)
-sta2 = STACesar (maximus, config=sta2_conf, mme_buffer_nb=1, debug=s2_deb, config_mode="MME", seed=2345)
-sta3 = STACesar (maximus, config=sta3_conf, mme_buffer_nb=1, debug=s3_deb, config_mode="MME", seed=3456)
-
-
-#Activate Sniffer on the CCo alias sta2.
-sta2_sniffer = sniffer ()
-sta2_sniffer.activate_mme (maximus, sta2, sta2_conf.mac_address)
-
-
-wait = ms_to_tck (10000)
-print "\n Waitting ", wait, " Tcks ..."
-maximus.wait (wait)
-
-class MyTest(unittest.TestCase):
-
- def setUp(self):
- pass
-
- def tearDown(self):
- pass
-
- def AuthenticateSta1(self):
- sta_data = Station_own_data ()
- data = sta_data.get_data (maximus, sta1)
-
- self.failUnless (data.mac_address == sta1_conf.mac_address)
- self.failUnless (data.cco_prefered == sta1_conf.cco_preference)
- # The station become CCo so the was_cco status have evolved.
- self.failUnless (data.was_cco == sta1_conf.was_cco)
- self.failUnless (data.npw == sta1_conf.npw)
- self.failUnless (data.dpw == sta1_conf.dpw)
- self.failUnless (data.hfid_manufacturer == sta1_conf.m_sta_hfid)
- self.failUnless (data.hfid_user == sta1_conf.u_sta_hfid)
- self.failUnless (data.security_level == sta1_conf.sl)
- # The station is CCo and automatically authenticated.
- self.failUnless (data.tei == 2)
- self.failUnless (data.authenticated != 0)
- self.failUnless (data.is_cco == 0)
-
- def AuthenticateSta2(self):
- sta_data = Station_own_data ()
- data = sta_data.get_data (maximus, sta2)
-
- self.failUnless (data.mac_address == sta2_conf.mac_address)
- self.failUnless (data.cco_prefered == sta2_conf.cco_preference)
- # The station become CCo so the was_cco status have evolved.
- self.failUnless (data.was_cco == sta2_conf.was_cco)
- self.failUnless (data.npw == sta2_conf.npw)
- self.failUnless (data.dpw == sta2_conf.dpw)
- self.failUnless (data.hfid_manufacturer == sta2_conf.m_sta_hfid)
- self.failUnless (data.hfid_user == sta2_conf.u_sta_hfid)
- self.failUnless (data.security_level == sta2_conf.sl)
- self.failUnless (data.tei == 1)
- self.failUnless (data.authenticated != 0)
- self.failUnless (data.is_cco != 0)
-
- def AuthenticateSta3(self):
- sta_data = Station_own_data ()
- data = sta_data.get_data (maximus, sta3)
-
- self.failUnless (data.mac_address == sta3_conf.mac_address)
- self.failUnless (data.cco_prefered == sta3_conf.cco_preference)
- # The station become CCo so the was_cco status have evolved.
- self.failUnless (data.was_cco == sta3_conf.was_cco)
- self.failUnless (data.npw == sta3_conf.npw)
- self.failUnless (data.dpw == sta3_conf.dpw)
- self.failUnless (data.hfid_manufacturer == sta3_conf.m_sta_hfid)
- self.failUnless (data.hfid_user == sta3_conf.u_sta_hfid)
- self.failUnless (data.security_level == sta3_conf.sl)
- self.failUnless (data.tei == 3)
- self.failUnless (data.authenticated != 0)
- self.failUnless (data.is_cco == 0)
-
- def Send_Packet_from_sta3_broadcast(self):
- alloc_data_buffer (maximus, sta1)
- alloc_data_buffer (maximus, sta2)
-
- msg = "broadcast"
- frame = Eth ()
- frame.dst = 'ff:ff:ff:ff:ff:ff'
- frame.src = sta3_mac_addr
- frame.type = 0x4f50
- frame.payload = msg
- frame.send (maximus, sta3)
-
- rsp = recv(maximus, count=2, filter=data_msdu_filter, timeout = 200000)
- self.failUnless (rsp != None)
- if rsp != None:
- my_frame = frame.get()
- my_frame_rsp = rsp[0].get() [0: len(my_frame)]
-
- self.failUnless (my_frame == my_frame_rsp)
-
- my_frame_rsp = rsp[1].get() [0: len(my_frame)]
- self.failUnless (my_frame == my_frame_rsp)
-
- def Send_Packet_from_sta1_broadcast(self):
- alloc_data_buffer (maximus, sta3)
- alloc_data_buffer (maximus, sta2)
-
- msg = "broadcast"
- frame = Eth ()
- frame.dst = 'ff:ff:ff:ff:ff:ff'
- frame.src = sta1_mac_addr
- frame.type = 0x4f50
- frame.payload = msg
- frame.send (maximus, sta1)
-
- rsp = recv(maximus, count=2, filter=data_msdu_filter, timeout = 200000)
- self.failUnless (rsp != None)
- if rsp != None:
- my_frame = frame.get()
- my_frame_rsp = rsp[0].get() [0: len(my_frame)]
-
- self.failUnless (my_frame == my_frame_rsp)
-
- my_frame_rsp = rsp[1].get() [0: len(my_frame)]
- self.failUnless (my_frame == my_frame_rsp)
-
- def sta3_deactivate (self):
- sta3.deactivate ()
-
- # Station 1 Sends a packet to sta 3.
- msg = "broadcast"
- frame = Eth ()
- frame.dst = sta3_mac_addr
- frame.src = sta1_mac_addr
- frame.type = 0x4f50
- frame.payload = msg
- frame.send (maximus, sta1)
-
- rsp = recv(maximus, count=1, filter=data_msdu_filter, timeout = 200000)
- self.failUnless (rsp == None)
-
- # Station 1 Sends a packet to sta 2.
- msg = "broadcast"
- frame = Eth ()
- frame.dst = sta2_mac_addr
- frame.src = sta1_mac_addr
- frame.type = 0x4f50
- frame.payload = msg
- frame.send (maximus, sta1)
-
- rsp = recv(maximus, count=1, filter=data_msdu_filter, timeout = 200000)
- self.failUnless (rsp != None)
-
- # Station 2 Sends a packet to sta 1.
- msg = "broadcast"
- frame = Eth ()
- frame.dst = sta1_mac_addr
- frame.src = sta2_mac_addr
- frame.type = 0x4f50
- frame.payload = msg
- frame.send (maximus, sta2)
-
- rsp = recv(maximus, count=1, filter=data_msdu_filter, timeout = 200000)
- self.failUnless (rsp != None)
-
- def testRun(self):
- self.AuthenticateSta1()
- self.AuthenticateSta2()
- self.AuthenticateSta3()
- self.Send_Packet_from_sta3_broadcast()
- self.Send_Packet_from_sta1_broadcast()
-
-suite = unittest.TestLoader().loadTestsFromTestCase(MyTest)
-
-testResult = unittest.TextTestRunner(verbosity=2).run(suite)
-
-# Delete the station.
-print "Removing STA 1 ..."
-sta1.remove()
-print "Removing STA 2 ..."
-sta2.remove()
-print "Removing STA 3 ..."
-sta3.remove()
-
-# For nightly build errors
-sys.exit ((1, 0)[testResult.wasSuccessful ()])
diff --git a/cesar/test_general/station/cco0/s1/py/sc12_five_stations.py b/cesar/test_general/station/cco0/s1/py/sc12_five_stations.py
deleted file mode 100644
index 3fe8b6a166..0000000000
--- a/cesar/test_general/station/cco0/s1/py/sc12_five_stations.py
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/usr/bin/python
-# Script interpreted by the CSI Cesar Script Interpreter
-
-import os
-import sys
-sys.path.append ('../../../../maximus/python/tools/csi/')
-sys.path.append ('../../../../maximus/python/obj/')
-sys.path.append ('../../../../maximus/python/')
-sys.path.append ('../../../../maximus/python/lib/cesar')
-
-from csicore import *
-
-csi = csiCore (1234)
-
-# Creating an AVLN.
-avln1 = csi.avln_add ("Homeplug_AVLN1", "AVLN1")
-
-sta1_debug = False
-sta2_debug = False
-sta3_debug = False
-sta4_debug = False
-sta5_debug = False
-
-# Adding some station to the AVLN.
-stas = list ()
-stas.append(avln1.sta_add ("10:11:12:13:14:15", False, False,
- "Homeplug_Station1", "spidcom_spc300_sta1", "station1", 1, sta1_debug))
-stas.append(avln1.sta_add ("20:22:22:23:24:25", False, False,
- "Homeplug_Station2", "spidcom_spc300_sta2", "station2", 1, sta2_debug))
-stas.append(avln1.sta_add ("30:33:32:33:34:35", False, False,
- "Homeplug_Station3", "spidcom_spc300_sta3", "station3", 1, sta3_debug))
-stas.append(avln1.sta_add ("40:44:42:43:44:45", False, False,
- "Homeplug_Station4", "spidcom_spc300_sta4", "station4", 1, sta4_debug))
-stas.append(avln1.sta_add ("50:55:52:53:54:55", False, False,
- "Homeplug_Station5", "spidcom_spc300_sta5", "station5", 1, sta5_debug))
-
-packet_list = csi.avln_create_traffic (avln1, 10)
-
-csi.process_init (sys.argv + ['-e', 'obj/cco0s1.elf'])
-csi.process_avlns_launch ()
-csi.process_wait_association (15)
-csi.process_wait_authentication (15)
-csi.process_avlns_send_broadcast_delayed (0.05)
-
-csi.authentication_status (avln1)
-csi.process_data_send_traffic (packet_list)
-
-csi.process_wait_sec (5)
-csi.process_verify_transmission ()
-
-csi.process_wait_sec (1)
-#csi.process_avlns_stop ()
-
-result = csi.process_end_get_result ()
-csi.process_uninit ()
-
-# For nightly build errors
-sys.exit ((1, 0)[result])
diff --git a/cesar/test_general/station/cco0/s1/py/sc13_10stations.py b/cesar/test_general/station/cco0/s1/py/sc13_10stations.py
deleted file mode 100644
index 76ef84c079..0000000000
--- a/cesar/test_general/station/cco0/s1/py/sc13_10stations.py
+++ /dev/null
@@ -1,73 +0,0 @@
-#!/usr/bin/env python
-# Script interpreted by the CSI Cesar Script Interpreter
-
-import os
-import sys
-sys.path.append ('../../../../maximus/python/tools/csi/')
-sys.path.append ('../../../../maximus/python/obj/')
-sys.path.append ('../../../../maximus/python/')
-sys.path.append ('../../../../maximus/python/lib/cesar')
-
-from csicore import *
-
-csi = csiCore (1234)
-
-# Creating an AVLN.
-avln1 = csi.avln_add ("Homeplug_AVLN1", "AVLN1")
-
-sta1_debug = False
-sta2_debug = False
-sta3_debug = False
-sta4_debug = False
-sta5_debug = False
-sta6_debug = False
-sta7_debug = False
-sta8_debug = False
-sta9_debug = False
-sta10_debug = False
-
-# Adding some station to the AVLN.
-stas = list ()
-stas.append(avln1.sta_add ("10:11:12:13:14:15", False, False, "Homeplug_Station1", "spidcom_spc300_sta1", "station1", 1, sta1_debug, 0))
-stas.append(avln1.sta_add ("20:22:22:23:24:25", False, False, "Homeplug_Station2", "spidcom_spc300_sta2", "station2", 1, sta2_debug, 0))
-stas.append(avln1.sta_add ("30:33:32:33:34:35", False, False, "Homeplug_Station3", "spidcom_spc300_sta3", "station3", 1, sta3_debug, 0))
-stas.append(avln1.sta_add ("40:44:42:43:44:45", False, False, "Homeplug_Station4", "spidcom_spc300_sta4", "station4", 1, sta4_debug, 0))
-stas.append(avln1.sta_add ("50:55:52:53:54:55", False, False, "Homeplug_Station5", "spidcom_spc300_sta5", "station5", 1, sta5_debug, 0))
-stas.append(avln1.sta_add ("60:66:62:63:64:65", False, False, "Homeplug_Station6", "spidcom_spc300_sta6", "station6", 1, sta6_debug, 0))
-stas.append(avln1.sta_add ("70:77:77:73:74:75", False, False, "Homeplug_Station7", "spidcom_spc300_sta7", "station7", 1, sta7_debug, 0))
-stas.append(avln1.sta_add ("80:88:82:88:84:85", False, False, "Homeplug_Station8", "spidcom_spc800_sta8", "station8", 1, sta8_debug, 0))
-stas.append(avln1.sta_add ("90:99:92:93:99:95", False, False, "Homeplug_Station9", "spidcom_spc300_sta9", "station9", 1, sta9_debug, 0))
-stas.append(avln1.sta_add ("A0:12:13:14:15:16", False, False, "Homeplug_Station10", "spidcom_spc300_sta10", "station10", 1, sta10_debug, 0))
-
-sys.stderr.write("Creating the traffic\n")
-list = csi.avln_create_traffic (avln1, 100)
-
-sys.stderr.write("Launching the test\n")
-csi.process_init (sys.argv + ['-e', 'obj/cco0s1.elf'])
-csi.process_avlns_launch ()
-
-sys.stderr.write("Wait association\n")
-csi.process_wait_association ()
-sys.stderr.write("Wait authentication\n")
-csi.process_wait_authentication ()
-csi.process_avlns_send_broadcast_delayed (0.001)
-csi.authentication_status (avln1)
-sys.stderr.write("Send traffic\n")
-csi.process_data_send_traffic (list)
-
-sys.stderr.write("Wait 6 seconds in maximus time\n")
-csi.process_wait_sec (6)
-
-print "Verifying the transmission"
-sys.stderr.write("Verifying the transmission\n")
-csi.process_verify_transmission ()
-
-csi.process_wait_sec (1)
-csi.process_avlns_remove()
-
-sys.stderr.write("Ending\n")
-result = csi.process_end_get_result ()
-csi.process_uninit ()
-
-# For nightly build errors
-sys.exit ((1, 0)[result])
diff --git a/cesar/test_general/station/cco0/s1/py/sc14_discover_beacon.py b/cesar/test_general/station/cco0/s1/py/sc14_discover_beacon.py
deleted file mode 100644
index 17b3b87436..0000000000
--- a/cesar/test_general/station/cco0/s1/py/sc14_discover_beacon.py
+++ /dev/null
@@ -1,86 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-# Three stations on the AVLN #
-# ---------------------------------------------------------------------- #
-# #
-# Objective: Verify the discover process done by the CCo. #
-# Once the CCo is choose in the AVLN, the discover process shall start #
-# 83 beacon periods after (at 50Hz). The real objective is to get 3 #
-# discover beacons since the apparition of the CCo. #
-# The discovers beacon shall have a Source TEI different from 0. #
-##############################################################################
-
-import unittest
-import sys
-
-sys.path.append ('../../../../maximus/python/tools/csi/')
-sys.path.append ('../../../../maximus/python/obj/')
-sys.path.append ('../../../../maximus/python/')
-sys.path.append ('../../../../maximus/python/lib/cesar')
-
-from struct import unpack
-
-from csicore import *
-
-csi = csiCore (1234)
-
-# Creating an AVLN.
-avln = csi.avln_add ("Homeplug_AVLN1", "AVLN1")
-
-macs = ["00:13:d7:00:00:01", "00:13:d7:00:00:02", "00:13:d7:00:00:03"]
-debugs = [False, False, False]
-
-for i in range (0, len (macs)):
- avln.sta_add (macs[i], False, False, "Homeplug_Station" + str (i),
- "spidcom_spc300_sta" + str (i), "station" + str (i), 1,
- debugs[i])
-
-csi.process_init (sys.argv + ['-e', 'obj/cco0s1.elf'])
-csi.process_avlns_launch ()
-csi.process_wait_association ()
-# Skip the first round of discovery procedure.
-csi.process_wait_sec (10)
-
-# Activate the sniffer for the beacon RX on the CCo. Normally the CCo shall
-# only receive discover beacons not central beacon in this test because there
-# is only one AVLN.
-cco = avln.get_sta (len (macs) - 1)
-state = csi.sniffer_activate (cco , False, False, False, True)
-if state == False:
- print "Sniffer not activated for CCo"
-
-# Wait 3 discover beacons from each station for 12 seconds.
-db = csi.sniff_packets (2, 12);
-
-#print "Removing the AVLNS"
-#csi.process_test_stop_avlns ()
-csi.process_avlns_remove ()
-
-result = csi.process_end_get_result ()
-
-class TestDiscoverBeacon(unittest.TestCase):
-
- def setUp(self):
- pass
-
- def tearDown(self):
- pass
-
- def test (self):
- stei_list = list()
- self.failUnless (db != None)
- self.failUnless (len (db) == 2)
- for i in range (0, len(db)):
- data = db[i].get()
- data = unpack (len(data) * 'B', data)
- stei_list.append (hex(data[31]))
- type = (data[32] & 0x3)
- self.failUnless (type == 1)
- self.failUnless (stei_list[0] != stei_list[1])
-
-suite = unittest.TestLoader().loadTestsFromTestCase(TestDiscoverBeacon)
-testResult = unittest.TextTestRunner(verbosity=2).run(suite)
-
-# For nightly build errors
-sys.exit ((1, 0)[result and testResult.wasSuccessful ()])
diff --git a/cesar/test_general/station/cco0/s1/py/sc15_full_traffic_two_sta.py b/cesar/test_general/station/cco0/s1/py/sc15_full_traffic_two_sta.py
deleted file mode 100644
index a3157fcbb4..0000000000
--- a/cesar/test_general/station/cco0/s1/py/sc15_full_traffic_two_sta.py
+++ /dev/null
@@ -1,61 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-# Two stations on the AVLN #
-# ---------------------------------------------------------------------- #
-# #
-# Objective: Verify the charge of communication between two stations. #
-##############################################################################
-
-import unittest
-import sys
-
-sys.path.append ('../../../../maximus/python/tools/csi/')
-sys.path.append ('../../../../maximus/python/obj/')
-sys.path.append ('../../../../maximus/python/')
-sys.path.append ('../../../../maximus/python/lib/cesar')
-
-from csicore import *
-
-csi = csiCore (1234)
-
-# Creating an AVLN.
-avln = csi.avln_add ("Homeplug_AVLN1", "AVLN1")
-
-sta1_debug = True
-sta2_debug = True
-
-sta1 = avln.sta_add ("10:11:12:13:14:15", False, False, "Homeplug_Station1",
- "spidcom_spc300_sta1", "station1", 1, sta1_debug)
-sta2 = avln.sta_add ("20:22:22:23:24:25", False, False, "Homeplug_Station2",
- "spidcom_spc300_sta2", "station2", 1, sta2_debug)
-
-csi.process_init (sys.argv + ['-e', 'obj/cco0s1.elf'])
-csi.process_avlns_launch ()
-csi.process_wait_association ()
-csi.process_wait_authentication ()
-
-packet = [csiPacket (1450, avln, sta1, None, sta2)]
-
-for i in range (0, 1000000):
- print "Packet ", i
- csi.process_data_send_traffic (packet)
- csi.process_wait_sec (0.005)
-
-csi.process_wait_sec (5)
-
-sta1.stop()
-# Sends a fcall to uninit the station.
-fcall = maximus.create_fcall ("fc_cesar_uninit")
-fcall.set_sta (sta.get())
-fcall.send()
-
-sta2.stop()
-# Sends a fcall to uninit the station.
-fcall = maximus.create_fcall ("fc_cesar_uninit")
-fcall.set_sta (sta.get())
-fcall.send()
-
-result = csi.process_end_get_result ()
-# For nightly build errors
-sys.exit ((1, 0)[result])
diff --git a/cesar/test_general/station/cco0/s1/py/sc1_one_sta_mac_start.py b/cesar/test_general/station/cco0/s1/py/sc1_one_sta_mac_start.py
deleted file mode 100644
index d353b6c7a3..0000000000
--- a/cesar/test_general/station/cco0/s1/py/sc1_one_sta_mac_start.py
+++ /dev/null
@@ -1,111 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-# One station alone with the Mac start order #
-# ---------------------------------------------------------------------- #
-# #
-# Objective of this test is to provide a script which verifies that the #
-# station is correctly initialised to communicate between all the layers. #
-# The PbProc will be activate on the Mac Start MME driver and enters in #
-# the Power one discover procedure. #
-##############################################################################
-
-import sys
-sys.path.append('../../../../maximus/python/obj');
-sys.path.append('../../../../maximus/python');
-sys.path.append('../../../../maximus/python/lib/cesar');
-
-from interface import *
-from string import *
-from struct import *
-from maximus import *
-from sta_cesar import STACesar
-from own_data import Station_own_data
-
-import unittest
-
-def my_mpdu_filter(mpdu):
- if mpdu.get_type() is 'PHY_TYPE_MPDU_PAYLOAD':
- # The received object is an MPDU
- return True
- else:
- return False
-
-
-# Initialise Maximus with the station.
-maximus = Maximus()
-maximus.init (sys.argv + ['-e', './obj/cco0s1.elf'])
-
-# Configure the first station.
-conf_sta = Config ()
-conf_sta.mac_address = (0x11, 0x21, 0x31, 0x41, 0x51, 0x61)
-conf_sta.cco_preference = False
-conf_sta.was_cco = False
-conf_sta.npw = "HomePlugAV0123"
-conf_sta.dpw = "STATION_DEVICE_PASSWORD"
-conf_sta.m_sta_hfid = "HPAV_STATION"
-conf_sta.u_sta_hfid = "STA1_CCO"
-conf_sta.avln_hfid = "AVLN1"
-conf_sta.tonemask = (85,139,167,214,225,282,302,409,419,569,591,736,748,856,882,1015,1027,1143,1535)
-conf_sta.sl = 1
-conf_sta.snid = None
-
-# Create the station
-sta = STACesar (maximus, config=conf_sta, mme_buffer_nb=1, debug=False, config_mode="MME", seed = 0x1234)
-
-class TestInitFunctions(unittest.TestCase):
-
- def setUp(self):
- pass
-
- def tearDown(self):
- pass
-
- def testReceveBeacon(self):
- beacon_count = 28
- mpdu = recv (maximus, count = beacon_count, filter=my_mpdu_filter)
- self.failUnless (mpdu != None)
-
- print ""
- for i in range (0, beacon_count):
- res = (mpdu[i].fc_av[0]) & 0x3
- self.failUnless (res == 0x0 or res == 0x1)
- print "Beacon received correct ", i
-
- def testStationState (self):
- sta_data = Station_own_data ()
- data = sta_data.get_data (maximus, sta)
-
- self.failUnless (data.mac_address == conf_sta.mac_address)
- self.failUnless (data.is_cco == False)
- self.failUnless (data.cco_prefered == conf_sta.cco_preference)
- self.failUnless (data.was_cco == conf_sta.was_cco)
- self.failUnless (data.npw == conf_sta.npw)
- self.failUnless (data.dpw == conf_sta.dpw)
- self.failUnless (data.hfid_manufacturer == conf_sta.m_sta_hfid)
- self.failUnless (data.hfid_user == conf_sta.u_sta_hfid)
- self.failUnless (data.security_level == conf_sta.sl)
-
- # Delete the station.
- sta.stop()
-
- # Sends a fcall to uninit the station.
- fcall = maximus.create_fcall ("fc_cesar_uninit")
- fcall.set_sta (sta.get())
- fcall.send()
-
- # Check the memory state.
- fcall = maximus.create_fcall ("fc_memory_state")
- fcall.set_sta (sta.get())
- fcall.send()
- result = fcall.bind_param_ushort ("result")
- self.failUnless (result == True);
-
- sta.remove()
-
-suite = unittest.TestLoader().loadTestsFromTestCase(TestInitFunctions)
-testResult = unittest.TextTestRunner(verbosity=2).run(suite)
-
-
-# For nightly build errors
-sys.exit ((1, 0)[testResult.wasSuccessful ()])
diff --git a/cesar/test_general/station/cco0/s1/py/sc1_one_sta_mac_start_cco_pref.py b/cesar/test_general/station/cco0/s1/py/sc1_one_sta_mac_start_cco_pref.py
deleted file mode 100644
index e91e155b3a..0000000000
--- a/cesar/test_general/station/cco0/s1/py/sc1_one_sta_mac_start_cco_pref.py
+++ /dev/null
@@ -1,110 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-# One station alone with the Mac start order #
-# ---------------------------------------------------------------------- #
-# #
-# Objective of this test is to provide a script which verifies that the #
-# station is correctly initialised to communicate between all the layers. #
-# The PbProc will be activate on the Mac Start MME driver and enters in #
-# the Power one discover procedure. #
-##############################################################################
-
-import sys
-sys.path.append('../../../../maximus/python/obj');
-sys.path.append('../../../../maximus/python');
-sys.path.append('../../../../maximus/python/lib/cesar');
-
-from interface import *
-from string import *
-from struct import *
-from maximus import *
-from sta_cesar import STACesar
-from own_data import Station_own_data
-
-import unittest
-
-def my_mpdu_filter(mpdu):
- if mpdu.get_type() is 'PHY_TYPE_MPDU_PAYLOAD':
- # The received object is an MPDU
- return True
- else:
- return False
-
-
-# Initialise Maximus with the station.
-maximus = Maximus()
-maximus.init (sys.argv + ['-e', './obj/cco0s1.elf'])
-
-# Configure the first station.
-conf_sta = Config ()
-conf_sta.mac_address = (0x11, 0x21, 0x31, 0x41, 0x51, 0x61)
-conf_sta.cco_preference = True
-conf_sta.was_cco = True
-conf_sta.npw = "HomePlugAV0123"
-conf_sta.dpw = "STATION_DEVICE_PASSWORD"
-conf_sta.m_sta_hfid = "HPAV_STATION"
-conf_sta.u_sta_hfid = "STA1_CCO"
-conf_sta.avln_hfid = "AVLN1"
-conf_sta.tonemask = (85,139,167,214,225,282,302,409,419,569,591,736,748,856,882,1015,1027,1143,1535)
-conf_sta.sl = 1
-conf_sta.snid = None
-
-# Create the station
-sta = STACesar (maximus, config=conf_sta, mme_buffer_nb=1, debug=False, config_mode="MME", seed = 0x1234)
-
-class TestInitFunctions(unittest.TestCase):
-
- def setUp(self):
- pass
-
- def tearDown(self):
- pass
-
- def testReceveBeacon(self):
- beacon_count = 28
- mpdu = recv (maximus, count = beacon_count, filter=my_mpdu_filter)
- self.failUnless (mpdu != None)
-
- print ""
- for i in range (0, beacon_count):
- res = (mpdu[i].fc_av[0]) & 0x3
- self.failUnless (res == 0x0 or res == 0x1)
- print "Beacon received correct ", i
-
- def testStationState (self):
- sta_data = Station_own_data ()
- data = sta_data.get_data (maximus, sta)
-
- self.failUnless (data.mac_address == conf_sta.mac_address)
- self.failUnless (data.is_cco == False)
- self.failUnless (data.cco_prefered == conf_sta.cco_preference)
- self.failUnless (data.was_cco == conf_sta.was_cco)
- self.failUnless (data.npw == conf_sta.npw)
- self.failUnless (data.dpw == conf_sta.dpw)
- self.failUnless (data.hfid_manufacturer == conf_sta.m_sta_hfid)
- self.failUnless (data.hfid_user == conf_sta.u_sta_hfid)
- self.failUnless (data.security_level == conf_sta.sl)
-
- # Delete the station.
- sta.stop()
-
- # Sends a fcall to uninit the station.
- fcall = maximus.create_fcall ("fc_cesar_uninit")
- fcall.set_sta (sta.get())
- fcall.send()
-
- # Check the memory state.
- fcall = maximus.create_fcall ("fc_memory_state")
- fcall.set_sta (sta.get())
- fcall.send()
- result = fcall.bind_param_ushort ("result")
- self.failUnless (result == True);
-
- sta.remove()
-
-suite = unittest.TestLoader().loadTestsFromTestCase(TestInitFunctions)
-testResult = unittest.TextTestRunner(verbosity=2).run(suite)
-
-# For nightly build errors
-sys.exit ((1, 0)[testResult.wasSuccessful ()])
diff --git a/cesar/test_general/station/cco0/s1/py/sc2_two_sta_assoc.py b/cesar/test_general/station/cco0/s1/py/sc2_two_sta_assoc.py
deleted file mode 100644
index fc24e81510..0000000000
--- a/cesar/test_general/station/cco0/s1/py/sc2_two_sta_assoc.py
+++ /dev/null
@@ -1,90 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-# Two station with the Mac start order #
-# ---------------------------------------------------------------------- #
-# #
-# Objective: Two station which starts at the same time, one will become #
-# the CCo the other one shall become an unassociated station. #
-# At this point the station shall try an association with the #
-# CCo. #
-# Hint: The two station have the same NID. #
-##############################################################################
-
-import unittest
-import sys
-
-sys.path.append ('../../../../maximus/python/tools/csi/')
-sys.path.append ('../../../../maximus/python/obj/')
-sys.path.append ('../../../../maximus/python/')
-sys.path.append ('../../../../maximus/python/lib/cesar')
-
-from csicore import *
-MACSDEFAULT = "00:13:d7:00:0%x:%02x"
-csi = csiCore (1234)
-
-# Creating an AVLN.
-avln1 = csi.avln_add ("Homeplug_AVLN1", "AVLN1")
-avln1_sta_nb = 2
-# Adding the stations.
-avln1_stas = list ()
-for i in range (0, avln1_sta_nb):
- avln1_stas.append (avln1.sta_add (MACSDEFAULT % (1, i+1), False, False,
- "HomePlug_AVLN1_Station%d" % (i+1),
- "av1_spc300_sta%d" % (i+1),
- "avln1_station%d" % (i+1), 1, False))
-csi.process_init (sys.argv + ['-e', 'obj/cco0s1.elf'])
-csi.process_avlns_launch ()
-csi.process_wait_association ()
-csi.process_wait_authentication ()
-
-class TestInitFunctions(unittest.TestCase):
-
- def setUp(self):
- self.sta = avln1_stas[0]
- self.cco = avln1_stas[avln1_sta_nb - 1]
-
- def tearDown(self):
- pass
-
- def testAuthenticateSta1(self):
- sta_data = Station_own_data ()
- data = sta_data.get_data (csi.get_maximus(), self.sta.get_sta_cesar())
- sta_conf = self.sta.get_config ()
-
- self.failUnless (data.cco_prefered == sta_conf.cco_preference)
- # The station become CCo so the was_cco status have evolved.
- self.failUnless (data.was_cco == sta_conf.was_cco)
- self.failUnless (data.npw == sta_conf.npw)
- self.failUnless (data.dpw == sta_conf.dpw)
- self.failUnless (data.hfid_manufacturer == sta_conf.m_sta_hfid)
- self.failUnless (data.hfid_user == sta_conf.u_sta_hfid)
- self.failUnless (data.security_level == sta_conf.sl)
- # The station is CCo and automatically authenticated.
- self.failUnless (data.tei != 0)
- self.failUnless (data.authenticated == True)
- self.failUnless (data.is_cco == False)
-
- def testAuthenticateSta2(self):
- sta_data = Station_own_data ()
- data = sta_data.get_data (csi.get_maximus(), self.cco.get_sta_cesar())
- cco_conf = self.cco.get_config ()
-
- self.failUnless (data.cco_prefered == cco_conf.cco_preference)
- # The station become CCo so the was_cco status have evolved.
- self.failUnless (data.was_cco == cco_conf.was_cco)
- self.failUnless (data.npw == cco_conf.npw)
- self.failUnless (data.dpw == cco_conf.dpw)
- self.failUnless (data.hfid_manufacturer == cco_conf.m_sta_hfid)
- self.failUnless (data.hfid_user == cco_conf.u_sta_hfid)
- self.failUnless (data.security_level == cco_conf.sl)
- self.failUnless (data.tei != 0)
- self.failUnless (data.authenticated == True)
- self.failUnless (data.is_cco == True)
-
-suite = unittest.TestLoader().loadTestsFromTestCase(TestInitFunctions)
-testResult = unittest.TextTestRunner(verbosity=2).run(suite)
-
-csi.process_avlns_remove ()
-# For nightly build errors
-sys.exit ((1, 0)[testResult.wasSuccessful ()])
diff --git a/cesar/test_general/station/cco0/s1/py/sc2_two_sta_assoc_one_cco_pref.py b/cesar/test_general/station/cco0/s1/py/sc2_two_sta_assoc_one_cco_pref.py
deleted file mode 100644
index b762742a01..0000000000
--- a/cesar/test_general/station/cco0/s1/py/sc2_two_sta_assoc_one_cco_pref.py
+++ /dev/null
@@ -1,94 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-# Two station with the Mac start order #
-# ---------------------------------------------------------------------- #
-# #
-# Objective: Two station which starts at the same time, one will become #
-# the CCo the other one shall become an unassociated station. #
-# At this point the station shall try an association with the #
-# CCo. #
-# Hint: The two station have the same NID. #
-##############################################################################
-
-import unittest
-import sys
-
-sys.path.append ('../../../../maximus/python/tools/csi/')
-sys.path.append ('../../../../maximus/python/obj/')
-sys.path.append ('../../../../maximus/python/')
-sys.path.append ('../../../../maximus/python/lib/cesar')
-
-from csicore import *
-MACSDEFAULT = "00:13:d7:00:0%x:%02x"
-csi = csiCore (1234)
-
-# Creating an AVLN.
-avln1 = csi.avln_add ("Homeplug_AVLN1", "AVLN1")
-avln1_sta_nb = 2
-# Adding the stations.
-avln1_stas = list ()
-for i in range (0, avln1_sta_nb):
- avln1_stas.append (avln1.sta_add (MACSDEFAULT % (1, i+1),
- i == 0, False,
- "HomePlug_AVLN1_Station%d" % (i+1),
- "av1_spc300_sta%d" % (i+1),
- "avln1_station%d" % (i+1), 1, False))
-csi.process_init (sys.argv + ['-e', 'obj/cco0s1.elf'])
-csi.process_avlns_launch ()
-csi.process_wait_association ()
-csi.process_wait_authentication ()
-
-class TestInitFunctions(unittest.TestCase):
-
- def setUp(self):
- """ Set UP. """
- # CCo user appoint criteria is not used in network discover procedure.
- # So the station with the biggest Mac Address will become the CCo.
- self.sta = avln1_stas[0]
- self.cco = avln1_stas[avln1_sta_nb - 1]
-
- def tearDown(self):
- pass
-
- def testAuthenticateSta1(self):
- sta_data = Station_own_data ()
- data = sta_data.get_data (csi.get_maximus(), self.sta.get_sta_cesar())
- sta_conf = self.sta.get_config ()
-
- self.failUnless (data.cco_prefered == sta_conf.cco_preference)
- # The station become CCo so the was_cco status have evolved.
- self.failUnless (data.was_cco == sta_conf.was_cco)
- self.failUnless (data.npw == sta_conf.npw)
- self.failUnless (data.dpw == sta_conf.dpw)
- self.failUnless (data.hfid_manufacturer == sta_conf.m_sta_hfid)
- self.failUnless (data.hfid_user == sta_conf.u_sta_hfid)
- self.failUnless (data.security_level == sta_conf.sl)
- # The station is CCo and automatically authenticated.
- self.failUnless (data.tei != 0)
- self.failUnless (data.authenticated == True)
- self.failUnless (data.is_cco == False)
-
- def testAuthenticateSta2(self):
- sta_data = Station_own_data ()
- data = sta_data.get_data (csi.get_maximus(), self.cco.get_sta_cesar())
- cco_conf = self.cco.get_config ()
-
- self.failUnless (data.cco_prefered == cco_conf.cco_preference)
- # The station become CCo so the was_cco status have evolved.
- self.failUnless (data.was_cco == cco_conf.was_cco)
- self.failUnless (data.npw == cco_conf.npw)
- self.failUnless (data.dpw == cco_conf.dpw)
- self.failUnless (data.hfid_manufacturer == cco_conf.m_sta_hfid)
- self.failUnless (data.hfid_user == cco_conf.u_sta_hfid)
- self.failUnless (data.security_level == cco_conf.sl)
- self.failUnless (data.tei != 0)
- self.failUnless (data.authenticated == True)
- self.failUnless (data.is_cco == True)
-
-suite = unittest.TestLoader().loadTestsFromTestCase(TestInitFunctions)
-testResult = unittest.TextTestRunner(verbosity=2).run(suite)
-
-csi.process_avlns_remove ()
-# For nightly build errors
-sys.exit ((1, 0)[testResult.wasSuccessful ()])
diff --git a/cesar/test_general/station/cco0/s1/py/sc3_two_sta_communication.py b/cesar/test_general/station/cco0/s1/py/sc3_two_sta_communication.py
deleted file mode 100644
index 211233a57b..0000000000
--- a/cesar/test_general/station/cco0/s1/py/sc3_two_sta_communication.py
+++ /dev/null
@@ -1,53 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-# Two station with the Mac start order #
-# ---------------------------------------------------------------------- #
-# #
-# Objective: Two station which starts at the same time, one will become #
-# the CCo the other one shall become an unassociated station. #
-# At this point the station shall try an association with the #
-# CCo. #
-# Hint: The two station have the same NID. #
-##############################################################################
-
-import unittest
-import sys
-
-sys.path.append ('../../../../maximus/python/tools/csi/')
-sys.path.append ('../../../../maximus/python/obj/')
-sys.path.append ('../../../../maximus/python/')
-sys.path.append ('../../../../maximus/python/lib/cesar')
-
-from csicore import *
-
-csi = csiCore (1234)
-
-# Creating an AVLN.
-avln = csi.avln_add ("Homeplug_AVLN1", "AVLN1")
-
-sta1_debug = False
-sta2_debug = False
-
-sta1 = avln.sta_add ("10:11:12:13:14:15", False, False, "Homeplug_Station1",
- "spidcom_spc300_sta1", "station1", 1, sta1_debug)
-sta2 = avln.sta_add ("20:22:22:23:24:25", False, False, "Homeplug_Station2",
- "spidcom_spc300_sta2", "station2", 1, sta2_debug)
-
-csi.process_init (sys.argv + ['-e', 'obj/cco0s1.elf'])
-csi.process_avlns_launch ()
-csi.process_wait_association ()
-csi.process_wait_authentication ()
-csi.authentication_status (avln)
-
-packets = csi.avln_create_traffic (avln, 10)
-
-csi.process_data_send_traffic (packets)
-csi.process_wait_sec (3)
-csi.process_verify_transmission ()
-
-csi.process_avlns_remove()
-result = csi.process_end_get_result ()
-
-# For nightly build errors
-sys.exit ((1, 0)[result])
diff --git a/cesar/test_general/station/cco0/s1/py/sc4_cc_who_ru.py b/cesar/test_general/station/cco0/s1/py/sc4_cc_who_ru.py
deleted file mode 100644
index 566cad778c..0000000000
--- a/cesar/test_general/station/cco0/s1/py/sc4_cc_who_ru.py
+++ /dev/null
@@ -1,76 +0,0 @@
-#!/usr/bin/python
-
-##############################################################################
-# CC_WHO_ARE_YOU #
-# ----------------------------------------------------------------------- #
-# #
-# Objective: One station which receives the request from the linux and #
-# answers it. #
-##############################################################################
-
-import unittest
-import sys
-
-sys.path.append ('../../../../maximus/python/tools/csi/')
-sys.path.append ('../../../../maximus/python/obj/')
-sys.path.append ('../../../../maximus/python/')
-sys.path.append ('../../../../maximus/python/lib/cesar')
-
-from csicore import *
-MACSDEFAULT = "00:13:d7:00:0%x:%02x"
-csi = csiCore (1234)
-# Creating an AVLN.
-avln1 = csi.avln_add ("Homeplug_AVLN1", "AVLN1")
-avln1_sta_nb = 2
-# Adding the stations.
-avln1_stas = list ()
-for i in range (0, avln1_sta_nb):
- avln1_stas.append (avln1.sta_add (MACSDEFAULT % (1, i+1), False, False,
- "HomePlug_AVLN1_Station%d" % (i+1),
- "av1_spc300_sta%d" % (i+1),
- "avln1_station%d" % (i+1), 1, False))
-csi.process_init (sys.argv + ['-e', 'obj/cco0s1.elf'])
-csi.process_avlns_launch ()
-csi.process_wait_association ()
-
-class TestInitFunctions(unittest.TestCase):
- def setUp(self):
- self.sta = avln1_stas[0]
- self.cco = avln1_stas[avln1_sta_nb - 1]
-
- def tearDown(self):
- pass
-
- def testWhoAreYou(self):
- from maximus.mme.mme import MME
- from maximus.mme.mmheader import MMHeader
- from maximus.mme.mmentry import MMEntry
- from maximus.simu.rx import recv
- from struct import pack, unpack
- from csifilter import frame_filter_msdu_mme
- from csitime import sec_to_tck
- mme = MME(MMHeader=MMHeader(ODA=self.cco.get_mac_addr(),
- OSA=self.cco.get_mac_addr(),
- MTYPE=0x88E1, MMV=1, MMTYPE=0x002C, FMI=0),
- MMEntry=MMEntry(pack ('Q',8910861401412611)))
- mme.send(csi.get_maximus(), self.cco.get_sta_cesar().get())
- rsp = recv(csi.get_maximus(), count=1, filter=frame_filter_msdu_mme,
- timeout = sec_to_tck (2))
- self.failUnless (rsp != None)
- if rsp != None:
- rsp = rsp[0]
- entry = rsp.get_mmentry()
- nid = hex(unpack ('Q', entry[0:7] + '\0')[0])
- cco_mac = hex(unpack ('Q', entry[7:13] + "\0\0")[0])
- hfid = entry[13:13 + len(avln1.get_ahfid())]
- self.failUnless (nid.lower() == '0x1FA86198795403L'.lower())
- self.failUnless (hfid == avln1.get_ahfid())
-
-suite = unittest.TestLoader().loadTestsFromTestCase(TestInitFunctions)
-testResult = unittest.TextTestRunner(verbosity=2).run(suite)
-
-# Delete the station.
-csi.process_avlns_remove ()
-
-# For nightly build errors
-sys.exit ((1, 0)[testResult.wasSuccessful ()])
diff --git a/cesar/test_general/station/cco0/s1/py/sc5_cc_leave.py b/cesar/test_general/station/cco0/s1/py/sc5_cc_leave.py
deleted file mode 100644
index 98cf120c39..0000000000
--- a/cesar/test_general/station/cco0/s1/py/sc5_cc_leave.py
+++ /dev/null
@@ -1,76 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-# CC_LEAVE #
-# ---------------------------------------------------------------------- #
-# #
-# Objective: Two station which starts at the same time, one will become #
-# the CCo the other one shall become an unassociated station. #
-# At this point the station shall try an association with the #
-# CCo. #
-# Once it done, maximus will send fcall to request a station #
-# to leave the AVLN. #
-# Hint: The two station have the same NID. #
-##############################################################################
-
-import os
-import unittest
-import sys
-sys.path.append ('../../../../maximus/python/tools/csi/')
-sys.path.append ('../../../../maximus/python/obj/')
-sys.path.append ('../../../../maximus/python/')
-sys.path.append ('../../../../maximus/python/lib/cesar')
-from csicore import *
-csi = csiCore (1234)
-MACSDEFAULT = "00:13:d7:00:0%x:%02x"
-# Creating an AVLN.
-avln1 = csi.avln_add ("Homeplug_AVLN1", "AVLN1")
-avln1_sta_nb = 2
-# Adding the stations.
-avln1_stas = list ()
-for i in range (0, avln1_sta_nb):
- avln1_stas.append (avln1.sta_add (MACSDEFAULT % (1, i+1), False, False,
- "HomePlug_AVLN1_Station%d" % (i+1),
- "av1_spc300_sta%d" % (i+1),
- "avln1_station%d" % (i+1), 1, False))
-csi.process_init (sys.argv + ['-e' , 'obj/cco0s1.elf'])
-csi.process_avlns_launch ()
-csi.process_wait_association (15)
-csi.process_wait_authentication (15)
-print "Association status on AVLN1"
-csi.authentication_status (avln1)
-class TestCCLEAVE(unittest.TestCase):
-
- def setUp(self):
- pass
-
- def tearDown(self):
- pass
-
- def test01(self):
- """Request the first station to leave the network."""
- from struct import unpack
- from maximus.simu.rx import recv
- from csifilter import frame_filter_sniffer
- from csitime import sec_to_tck
- sta = avln1_stas[0]
- cco = avln1_stas[avln1_sta_nb-1]
- csi.sniffer_activate (sta, False, True, False, False)
- fcall = csi.get_maximus().create_fcall ("fc_cc_leave_req")
- fcall.set_sta (sta.get_sta_cesar().get())
- fcall.send()
- rsp = recv (csi.get_maximus(), filter = frame_filter_sniffer,
- timeout = sec_to_tck(1), count = 1)
- self.failUnless (rsp)
- for i in rsp:
- u = unpack (len (i.get ()) * 'B', i.get ())[39:]
- mmtype = (u[1] << 8) | u[0]
- self.failUnless (mmtype == 0x0035)
-
-suite = unittest.TestLoader().loadTestsFromTestCase(TestCCLEAVE)
-testResult = unittest.TextTestRunner(verbosity=2).run(suite)
-csi.process_avlns_stop ()
-csi.process_avlns_remove ()
-# For nightly build errors
-sys.exit ((1, 0)[testResult.wasSuccessful ()])
-os.system ("killall cco0s1.elf")
diff --git a/cesar/test_general/station/cco0/s1/py/sc6_three_sta_assoc.py b/cesar/test_general/station/cco0/s1/py/sc6_three_sta_assoc.py
deleted file mode 100644
index 166aac20e2..0000000000
--- a/cesar/test_general/station/cco0/s1/py/sc6_three_sta_assoc.py
+++ /dev/null
@@ -1,175 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-# Three station with the Mac start order #
-# ---------------------------------------------------------------------- #
-# #
-# Objective: Three station which starts at the same time, one will become #
-# the CCo the other one shall become an unassociated station. #
-# At this point the station shall try an association with the #
-# CCo. #
-# Hint: The two station have the same NID. #
-##############################################################################
-
-import sys
-sys.path.append('../../../../maximus/python/obj');
-sys.path.append('../../../../maximus/python');
-sys.path.append('../../../../maximus/python/lib/cesar');
-
-from interface import *
-from string import *
-from struct import *
-from maximus import *
-from sta_cesar import STACesar
-from own_data import Station_own_data
-from sniffer import *
-
-import unittest
-
-def ms_to_tck (ms):
- return int(ms * 25000)
-
-
-def my_mpdu_filter(mpdu):
- if mpdu.get_type() is 'PHY_TYPE_MPDU_PAYLOAD':
- # The received object is an MPDU
- return True
- else:
- return False
-
-
-# Initialise Maximus with the station.
-maximus = Maximus()
-maximus.init (sys.argv + ['-e', './obj/cco0s1.elf'])
-
-# Configure the first station.
-sta1_conf = Config ()
-sta1_conf.mac_address = (0x10, 0x11, 0x12, 0x13, 0x14, 0x15)
-sta1_conf.cco_preference = False
-sta1_conf.was_cco = False
-sta1_conf.npw = "HomePlugAV0123"
-sta1_conf.dpw = "STATION_DEVICE_PASSWORD"
-sta1_conf.m_sta_hfid = "HPAV_STATION"
-sta1_conf.u_sta_hfid = "STA1"
-sta1_conf.avln_hfid = "AVLN1"
-sta1_conf.tonemask = (85,139,167,214,225,282,302,409,419,569,591,736,748,856,882,1015,1027,1143,1535)
-sta1_conf.sl = 1
-sta1_conf.snid = None
-
-# Configure the second station.
-sta2_conf = Config ()
-sta2_conf.mac_address = (0x20, 0x21, 0x22, 0x23, 0x24, 0x25)
-sta2_conf.cco_preference = False
-sta2_conf.was_cco = False
-sta2_conf.npw = "HomePlugAV0123"
-sta2_conf.dpw = "STATION_DEVICE_PASSWORD"
-sta2_conf.m_sta_hfid = "HPAV_STATION"
-sta2_conf.u_sta_hfid = "STA2"
-sta2_conf.avln_hfid = "AVLN1"
-sta2_conf.tonemask = (85,139,167,214,225,282,302,409,419,569,591,736,748,856,882,1015,1027,1143,1535)
-sta2_conf.sl = 1
-sta2_conf.snid = None
-
-# Configure the third station.
-sta3_conf = Config ()
-sta3_conf.mac_address = (0x30, 0x31, 0x33, 0x34, 0x35, 0x36)
-sta3_conf.cco_preference = False
-sta3_conf.was_cco = False
-sta3_conf.npw = "HomePlugAV0123"
-sta3_conf.dpw = "STATION_DEVICE_PASSWORD"
-sta3_conf.m_sta_hfid = "HPAV_STATION"
-sta3_conf.u_sta_hfid = "STA3"
-sta3_conf.avln_hfid = "AVLN1"
-sta3_conf.tonemask = (85,139,167,214,225,282,302,409,419,569,591,736,748,856,882,1015,1027,1143,1535)
-sta3_conf.sl = 1
-sta3_conf.snid = None
-
-# Create the station
-print ""
-print "Starting the test ..."
-sta1 = STACesar (maximus, config=sta1_conf, mme_buffer_nb=1, debug=False, config_mode="MME", seed=1224)
-sta2 = STACesar (maximus, config=sta2_conf, mme_buffer_nb=1, debug=False, config_mode="MME", seed=2345)
-sta3 = STACesar (maximus, config=sta3_conf, mme_buffer_nb=1, debug=False, config_mode="MME", seed=3456)
-
-# Activate the Sniffer module only for the MMEs.
-sta2_sniffer = sniffer ()
-sta2_sniffer.activate_mme (maximus, sta2, sta2_conf.mac_address)
-
-wait = ms_to_tck (10000)
-print "\n Waitting ", wait, " Tcks ..."
-maximus.wait (wait)
-
-class TestInitFunctions(unittest.TestCase):
-
- def setUp(self):
- pass
-
- def tearDown(self):
- pass
-
- def testAuthenticateSta1(self):
- sta_data = Station_own_data ()
- data = sta_data.get_data (maximus, sta1)
-
- self.failUnless (data.mac_address == sta1_conf.mac_address)
- self.failUnless (data.cco_prefered == sta1_conf.cco_preference)
- # The station become CCo so the was_cco status have evolved.
- self.failUnless (data.was_cco == sta1_conf.was_cco)
- self.failUnless (data.npw == sta1_conf.npw)
- self.failUnless (data.dpw == sta1_conf.dpw)
- self.failUnless (data.hfid_manufacturer == sta1_conf.m_sta_hfid)
- self.failUnless (data.hfid_user == sta1_conf.u_sta_hfid)
- self.failUnless (data.security_level == sta1_conf.sl)
- # The station is CCo and automatically authenticated.
- self.failUnless (data.tei == 2)
- self.failUnless (data.authenticated != 0)
- self.failUnless (data.is_cco == 0)
-
- def testAuthenticateSta2(self):
- sta_data = Station_own_data ()
- data = sta_data.get_data (maximus, sta2)
-
- self.failUnless (data.mac_address == sta2_conf.mac_address)
- self.failUnless (data.cco_prefered == sta2_conf.cco_preference)
- # The station become CCo so the was_cco status have evolved.
- self.failUnless (data.was_cco == sta2_conf.was_cco)
- self.failUnless (data.npw == sta2_conf.npw)
- self.failUnless (data.dpw == sta2_conf.dpw)
- self.failUnless (data.hfid_manufacturer == sta2_conf.m_sta_hfid)
- self.failUnless (data.hfid_user == sta2_conf.u_sta_hfid)
- self.failUnless (data.security_level == sta2_conf.sl)
- self.failUnless (data.tei == 1)
- self.failUnless (data.authenticated != 0)
- self.failUnless (data.is_cco != 0)
-
- def testAuthenticateSta3(self):
- sta_data = Station_own_data ()
- data = sta_data.get_data (maximus, sta3)
-
- self.failUnless (data.mac_address == sta3_conf.mac_address)
- self.failUnless (data.cco_prefered == sta3_conf.cco_preference)
- # The station become CCo so the was_cco status have evolved.
- self.failUnless (data.was_cco == sta3_conf.was_cco)
- self.failUnless (data.npw == sta3_conf.npw)
- self.failUnless (data.dpw == sta3_conf.dpw)
- self.failUnless (data.hfid_manufacturer == sta3_conf.m_sta_hfid)
- self.failUnless (data.hfid_user == sta3_conf.u_sta_hfid)
- self.failUnless (data.security_level == sta3_conf.sl)
- self.failUnless (data.tei == 3)
- self.failUnless (data.authenticated != 0)
- self.failUnless (data.is_cco == 0)
-
-suite = unittest.TestLoader().loadTestsFromTestCase(TestInitFunctions)
-
-testResult = unittest.TextTestRunner(verbosity=2).run(suite)
-
-# Delete the station.
-print "Removing STA 1 ..."
-sta1.remove()
-print "Removing STA 2 ..."
-sta2.remove()
-print "Removing STA 3 ..."
-sta3.remove()
-
-# For nightly build errors
-sys.exit ((1, 0)[testResult.wasSuccessful ()])
diff --git a/cesar/test_general/station/cco0/s1/py/sc7_three_sta_communication.py b/cesar/test_general/station/cco0/s1/py/sc7_three_sta_communication.py
deleted file mode 100644
index b96728af49..0000000000
--- a/cesar/test_general/station/cco0/s1/py/sc7_three_sta_communication.py
+++ /dev/null
@@ -1,369 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-# Three station with the Mac start order #
-# ---------------------------------------------------------------------- #
-# #
-# Objective: Three station which starts at the same time, one will become #
-# the CCo the other one shall become an unassociated station. #
-# At this point the station shall try an association with the #
-# CCo. #
-# Hint: The two station have the same NID. #
-##############################################################################
-
-import sys
-sys.path.append('../../../../maximus/python/obj');
-sys.path.append('../../../../maximus/python');
-sys.path.append('../../../../maximus/python/lib/cesar');
-
-from interface import *
-from string import *
-from struct import *
-from maximus import *
-from sta_cesar import STACesar
-from own_data import Station_own_data
-from sniffer import *
-
-import unittest
-
-def ms_to_tck (ms):
- return int(ms * 25000)
-
-def data_msdu_filter (msdu):
- if msdu.get_type () is 'ETHERNET_TYPE_DATA':
- # The received object is an MSDU
- return True
- else:
- return False
-
-s1_deb = False
-s2_deb = False
-s3_deb = False
-
-sta1_mac_addr = '10:11:12:13:14:15'
-sta2_mac_addr = '20:21:22:23:24:25'
-sta3_mac_addr = '30:31:32:33:34:35'
-
-# Initialise Maximus with the station.
-maximus = Maximus()
-maximus.init (sys.argv + ['-e', './obj/cco0s1.elf'])
-
-# Configure the first station.
-sta1_conf = Config ()
-sta1_conf.mac_address = (0x10, 0x11, 0x12, 0x13, 0x14, 0x15)
-sta1_conf.cco_preference = False
-sta1_conf.was_cco = False
-sta1_conf.npw = "HomePlugAV0123"
-sta1_conf.dpw = "STATION_DEVICE_PASSWORD"
-sta1_conf.m_sta_hfid = "HPAV_STATION"
-sta1_conf.u_sta_hfid = "STA1"
-sta1_conf.avln_hfid = "AVLN1"
-sta1_conf.tonemask = (85,139,167,214,225,282,302,409,419,569,591,736,748,856,882,1015,1027,1143,1535)
-sta1_conf.sl = 1
-sta1_conf.snid = None
-
-# Configure the second station.
-sta2_conf = Config ()
-sta2_conf.mac_address = (0x20, 0x21, 0x22, 0x23, 0x24, 0x25)
-sta2_conf.cco_preference = False
-sta2_conf.was_cco = False
-sta2_conf.npw = "HomePlugAV0123"
-sta2_conf.dpw = "STATION_DEVICE_PASSWORD"
-sta2_conf.m_sta_hfid = "HPAV_STATION"
-sta2_conf.u_sta_hfid = "STA2"
-sta2_conf.avln_hfid = "AVLN1"
-sta2_conf.tonemask = (85,139,167,214,225,282,302,409,419,569,591,736,748,856,882,1015,1027,1143,1535)
-sta2_conf.sl = 1
-sta2_conf.snid = None
-
-# Configure the third station.
-sta3_conf = Config ()
-sta3_conf.mac_address = (0x30, 0x31, 0x32, 0x33, 0x34, 0x35)
-sta3_conf.cco_preference = False
-sta3_conf.was_cco = False
-sta3_conf.npw = "HomePlugAV0123"
-sta3_conf.dpw = "STATION_DEVICE_PASSWORD"
-sta3_conf.m_sta_hfid = "HPAV_STATION"
-sta3_conf.u_sta_hfid = "STA3"
-sta3_conf.avln_hfid = "AVLN1"
-sta3_conf.tonemask = (85,139,167,214,225,282,302,409,419,569,591,736,748,856,882,1015,1027,1143,1535)
-sta3_conf.sl = 1
-sta3_conf.snid = None
-
-# Create the station
-print ""
-print "Starting the test ..."
-sta1 = STACesar (maximus, config=sta1_conf, mme_buffer_nb=1, debug=s1_deb, config_mode="MME", seed=1224)
-sta2 = STACesar (maximus, config=sta2_conf, mme_buffer_nb=1, debug=s2_deb, config_mode="MME", seed=2345)
-sta3 = STACesar (maximus, config=sta3_conf, mme_buffer_nb=1, debug=s3_deb, config_mode="MME", seed=3456)
-
-
-#Activate Sniffer on the CCo alias sta2.
-sta2_sniffer = sniffer ()
-sta2_sniffer.activate_mme (maximus, sta2, sta2_conf.mac_address)
-
-
-wait = ms_to_tck (10000)
-print "\n Waitting ", wait, " Tcks ..."
-maximus.wait (wait)
-
-class MyTest(unittest.TestCase):
-
- def setUp(self):
- pass
-
- def tearDown(self):
- pass
-
- def AuthenticateSta1(self):
- sta_data = Station_own_data ()
- data = sta_data.get_data (maximus, sta1)
-
- self.failUnless (data.mac_address == sta1_conf.mac_address)
- self.failUnless (data.cco_prefered == sta1_conf.cco_preference)
- # The station become CCo so the was_cco status have evolved.
- self.failUnless (data.was_cco == sta1_conf.was_cco)
- self.failUnless (data.npw == sta1_conf.npw)
- self.failUnless (data.dpw == sta1_conf.dpw)
- self.failUnless (data.hfid_manufacturer == sta1_conf.m_sta_hfid)
- self.failUnless (data.hfid_user == sta1_conf.u_sta_hfid)
- self.failUnless (data.security_level == sta1_conf.sl)
- # The station is CCo and automatically authenticated.
- self.failUnless (data.tei == 2)
- self.failUnless (data.authenticated != 0)
- self.failUnless (data.is_cco == 0)
-
- def AuthenticateSta2(self):
- sta_data = Station_own_data ()
- data = sta_data.get_data (maximus, sta2)
-
- self.failUnless (data.mac_address == sta2_conf.mac_address)
- self.failUnless (data.cco_prefered == sta2_conf.cco_preference)
- # The station become CCo so the was_cco status have evolved.
- self.failUnless (data.was_cco == sta2_conf.was_cco)
- self.failUnless (data.npw == sta2_conf.npw)
- self.failUnless (data.dpw == sta2_conf.dpw)
- self.failUnless (data.hfid_manufacturer == sta2_conf.m_sta_hfid)
- self.failUnless (data.hfid_user == sta2_conf.u_sta_hfid)
- self.failUnless (data.security_level == sta2_conf.sl)
- self.failUnless (data.tei == 1)
- self.failUnless (data.authenticated != 0)
- self.failUnless (data.is_cco != 0)
-
- def AuthenticateSta3(self):
- sta_data = Station_own_data ()
- data = sta_data.get_data (maximus, sta3)
-
- self.failUnless (data.mac_address == sta3_conf.mac_address)
- self.failUnless (data.cco_prefered == sta3_conf.cco_preference)
- # The station become CCo so the was_cco status have evolved.
- self.failUnless (data.was_cco == sta3_conf.was_cco)
- self.failUnless (data.npw == sta3_conf.npw)
- self.failUnless (data.dpw == sta3_conf.dpw)
- self.failUnless (data.hfid_manufacturer == sta3_conf.m_sta_hfid)
- self.failUnless (data.hfid_user == sta3_conf.u_sta_hfid)
- self.failUnless (data.security_level == sta3_conf.sl)
- self.failUnless (data.tei == 3)
- self.failUnless (data.authenticated != 0)
- self.failUnless (data.is_cco == 0)
-
- def Send_Packet_from_sta3_broadcast(self):
- alloc_data_buffer (maximus, sta1)
- alloc_data_buffer (maximus, sta2)
-
- msg = "broadcast"
- frame = Eth ()
- frame.dst = 'ff:ff:ff:ff:ff:ff'
- frame.src = sta3_mac_addr
- frame.type = 0x4f50
- frame.payload = msg
- frame.send (maximus, sta3)
-
- rsp = recv(maximus, count=2, filter=data_msdu_filter, timeout = 200000)
- self.failUnless (rsp != None)
- if rsp != None:
- my_frame = frame.get()
- my_frame_rsp = rsp[0].get() [0: len(my_frame)]
-
- self.failUnless (my_frame == my_frame_rsp)
-
- my_frame_rsp = rsp[1].get() [0: len(my_frame)]
- self.failUnless (my_frame == my_frame_rsp)
-
- def Send_Packet_from_sta3_to_sta2(self):
- payload = ''
- for i in range (0, 1500):
- payload += str (i)[0]
-
- alloc_data_buffer (maximus, sta2)
- frame = Eth ()
- frame.dst = sta2_mac_addr
- frame.src = sta3_mac_addr
- frame.type = 0x4f50
- frame.payload = payload
- frame.send (maximus, sta3)
-
- rsp = recv(maximus, count=1, filter=data_msdu_filter, timeout = 200000)
- self.failUnless (rsp != None)
- if rsp != None:
- my_frame = frame.get()
- my_frame_rsp = rsp[0].get() [0: len(my_frame)]
-
- self.failUnless (my_frame == my_frame_rsp)
-
- def Send_Packet_from_sta3_to_sta1(self):
- payload = ''
- for i in range (0, 1500):
- payload += str (i)[0]
-
- alloc_data_buffer (maximus, sta1)
- frame = Eth ()
- frame.dst = sta1_mac_addr
- frame.src = sta3_mac_addr
- frame.type = 0x4f50
- frame.payload = payload
- frame.send (maximus, sta3)
-
- rsp = recv(maximus, count=1, filter=data_msdu_filter, timeout = 200000)
- self.failUnless (rsp != None)
- if rsp != None:
- my_frame = frame.get()
- my_frame_rsp = rsp[0].get() [0: len(my_frame)]
-
- self.failUnless (my_frame == my_frame_rsp)
-
- def Send_Packet_from_sta1_broadcast(self):
- alloc_data_buffer (maximus, sta3)
- alloc_data_buffer (maximus, sta2)
-
- msg = "broadcast"
- frame = Eth ()
- frame.dst = 'ff:ff:ff:ff:ff:ff'
- frame.src = sta1_mac_addr
- frame.type = 0x4f50
- frame.payload = msg
- frame.send (maximus, sta1)
-
- rsp = recv(maximus, count=2, filter=data_msdu_filter, timeout = 200000)
- self.failUnless (rsp != None)
- if rsp != None:
- my_frame = frame.get()
- my_frame_rsp = rsp[0].get() [0: len(my_frame)]
-
- self.failUnless (my_frame == my_frame_rsp)
-
- my_frame_rsp = rsp[1].get() [0: len(my_frame)]
- self.failUnless (my_frame == my_frame_rsp)
-
- def Send_Packet_from_sta1_to_sta2(self):
- payload = ''
- for i in range (0, 1500):
- payload += str (i)[0]
-
- alloc_data_buffer (maximus, sta2)
- frame = Eth ()
- frame.dst = sta2_mac_addr
- frame.src = sta1_mac_addr
- frame.type = 0x4f50
- frame.payload = payload
- frame.send (maximus, sta1)
-
- rsp = recv(maximus, count=1, filter=data_msdu_filter, timeout = 200000)
- self.failUnless (rsp != None)
- if rsp != None:
- my_frame = frame.get()
- my_frame_rsp = rsp[0].get() [0: len(my_frame)]
-
- self.failUnless (my_frame == my_frame_rsp)
-
- def Send_Packet_from_sta1_to_sta3(self):
- payload = ''
- for i in range (0, 1500):
- payload += str (i)[0]
-
- alloc_data_buffer (maximus, sta3)
- frame = Eth ()
- frame.dst = sta3_mac_addr
- frame.src = sta1_mac_addr
- frame.type = 0x4f50
- frame.payload = payload
- frame.send (maximus, sta1)
-
- rsp = recv(maximus, count=1, filter=data_msdu_filter, timeout = 200000)
- self.failUnless (rsp != None)
- if rsp != None:
- my_frame = frame.get()
- my_frame_rsp = rsp[0].get() [0: len(my_frame)]
-
- self.failUnless (my_frame == my_frame_rsp)
-
- def Send_Packet_from_sta2_to_sta1(self):
- payload = ''
- for i in range (0, 1500):
- payload += str (i)[0]
-
- alloc_data_buffer (maximus, sta1)
- frame = Eth ()
- frame.dst = sta1_mac_addr
- frame.src = sta2_mac_addr
- frame.type = 0x4f50
- frame.payload = payload
- frame.send (maximus, sta2)
-
- rsp = recv(maximus, count=1, filter=data_msdu_filter, timeout = 200000)
- self.failUnless (rsp != None)
- if rsp != None:
- my_frame = frame.get()
- my_frame_rsp = rsp[0].get() [0: len(my_frame)]
-
- self.failUnless (my_frame == my_frame_rsp)
-
- def Send_Packet_from_sta2_to_sta3(self):
- payload = ''
- for i in range (0, 1500):
- payload += str (i)[0]
-
- alloc_data_buffer (maximus, sta3)
- frame = Eth ()
- frame.dst = sta3_mac_addr
- frame.src = sta2_mac_addr
- frame.type = 0x4f50
- frame.payload = payload
- frame.send (maximus, sta2)
-
- rsp = recv(maximus, count=1, filter=data_msdu_filter, timeout = 200000)
- self.failUnless (rsp != None)
- if rsp != None:
-
- my_frame = frame.get()
- my_frame_rsp = rsp[0].get() [0: len(my_frame)]
-
- self.failUnless (my_frame == my_frame_rsp)
-
- def testRun(self):
- self.AuthenticateSta1()
- self.AuthenticateSta2()
- self.AuthenticateSta3()
- self.Send_Packet_from_sta3_broadcast()
- self.Send_Packet_from_sta1_broadcast()
- self.Send_Packet_from_sta3_to_sta2()
- self.Send_Packet_from_sta3_to_sta1()
- self.Send_Packet_from_sta1_to_sta2()
- self.Send_Packet_from_sta1_to_sta3()
- self.Send_Packet_from_sta2_to_sta1()
- self.Send_Packet_from_sta2_to_sta3()
-
-suite = unittest.TestLoader().loadTestsFromTestCase(MyTest)
-
-testResult = unittest.TextTestRunner(verbosity=2).run(suite)
-
-# Delete the station.
-print "Removing STA 1 ..."
-sta1.remove()
-print "Removing STA 2 ..."
-sta2.remove()
-print "Removing STA 3 ..."
-sta3.remove()
-
-# For nightly build errors
-sys.exit ((1, 0)[testResult.wasSuccessful ()])
diff --git a/cesar/test_general/station/cco0/s1/py/sc8_three_sta_one_leaving.py b/cesar/test_general/station/cco0/s1/py/sc8_three_sta_one_leaving.py
deleted file mode 100644
index ac0f52c93a..0000000000
--- a/cesar/test_general/station/cco0/s1/py/sc8_three_sta_one_leaving.py
+++ /dev/null
@@ -1,76 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-# Three station with the Mac start order #
-# ---------------------------------------------------------------------- #
-# #
-# Objective: Three station which starts at the same time, one will become #
-# the CCo the other one shall become an unassociated station. #
-# At this point the station shall try an association with the #
-# CCo. #
-# Once it done, maximus will send fcall to request a station #
-# to leave the AVLN. #
-# Hint: The two station have the same NID. #
-##############################################################################
-
-import os
-import unittest
-import sys
-sys.path.append ('../../../../maximus/python/tools/csi/')
-sys.path.append ('../../../../maximus/python/obj/')
-sys.path.append ('../../../../maximus/python/')
-sys.path.append ('../../../../maximus/python/lib/cesar')
-from csicore import *
-csi = csiCore (1234)
-MACSDEFAULT = "00:13:d7:00:0%x:%02x"
-# Creating an AVLN.
-avln1 = csi.avln_add ("Homeplug_AVLN1", "AVLN1")
-avln1_sta_nb = 3
-# Adding the stations.
-avln1_stas = list ()
-for i in range (0, avln1_sta_nb):
- avln1_stas.append (avln1.sta_add (MACSDEFAULT % (1, i+1), False, False,
- "HomePlug_AVLN1_Station%d" % (i+1),
- "av1_spc300_sta%d" % (i+1),
- "avln1_station%d" % (i+1), 1, False))
-csi.process_init (sys.argv + ['-e' , 'obj/cco0s1.elf'])
-csi.process_avlns_launch ()
-csi.process_wait_association (15)
-csi.process_wait_authentication (15)
-print "Association status on AVLN1"
-csi.authentication_status (avln1)
-class TestCCLEAVE(unittest.TestCase):
-
- def setUp(self):
- pass
-
- def tearDown(self):
- pass
-
- def test01(self):
- """Request the first station to leave the network."""
- from struct import unpack
- from maximus.simu.rx import recv
- from csifilter import frame_filter_sniffer
- from csitime import sec_to_tck
- sta = avln1_stas[0]
- cco = avln1_stas[avln1_sta_nb-1]
- csi.sniffer_activate (sta, False, True, False, False)
- fcall = csi.get_maximus().create_fcall ("fc_cc_leave_req")
- fcall.set_sta (sta.get_sta_cesar().get())
- fcall.send()
- rsp = recv (csi.get_maximus(), filter = frame_filter_sniffer,
- timeout = sec_to_tck(1), count = 1)
- self.failUnless (rsp)
- for i in rsp:
- u = unpack (len (i.get ()) * 'B', i.get ())[39:]
- mmtype = (u[1] << 8) | u[0]
- self.failUnless (mmtype == 0x0035)
-
-suite = unittest.TestLoader().loadTestsFromTestCase(TestCCLEAVE)
-testResult = unittest.TextTestRunner(verbosity=2).run(suite)
-csi.process_avlns_stop ()
-csi.process_avlns_remove ()
-# For nightly build errors
-sys.exit ((1, 0)[testResult.wasSuccessful ()])
-os.system ("killall cco0s1.elf")
diff --git a/cesar/test_general/station/cco0/s1/py/sc9_cco_leaving.py b/cesar/test_general/station/cco0/s1/py/sc9_cco_leaving.py
deleted file mode 100644
index 48ab2443a4..0000000000
--- a/cesar/test_general/station/cco0/s1/py/sc9_cco_leaving.py
+++ /dev/null
@@ -1,90 +0,0 @@
-#!/usr/bin/python
-
-#############################################################################
-# CC_LEAVE #
-# ---------------------------------------------------------------------- #
-# #
-# Objective: Two station authenticated on the AVLN. #
-# The CCo leaves the AVLN #
-# The other station shall become the CCo. #
-#############################################################################
-
-import sys
-sys.path.append ('../../../../maximus/python/tools/csi/')
-sys.path.append('../../../../maximus/python/obj');
-sys.path.append('../../../../maximus/python');
-sys.path.append('../../../../maximus/python/lib/cesar');
-
-from csicore import *
-import unittest
-from struct import unpack
-
-csi = csiCore (1234)
-
-# Creating an AVLN.
-avln1 = csi.avln_add ("Homeplug_AVLN1", "AVLN1")
-
-sta1_debug = False
-sta2_debug = False
-
-# Adding some station to the AVLN.
-stas = list ()
-stas.append(avln1.sta_add ("00:00:00:00:00:01", False, False,
- "Homeplug_Station1", "spidcom_spc300_sta1", "station1", 1, sta1_debug))
-stas.append(avln1.sta_add ("00:00:00:00:00:02", False, False,
- "Homeplug_Station2", "spidcom_spc300_sta2", "station2", 1, sta2_debug))
-
-csi.process_init (sys.argv + ['-e', 'obj/cco0s1.elf'])
-csi.process_avlns_launch ()
-csi.process_wait_association (15)
-csi.process_wait_authentication (15)
-csi.authentication_status (avln1)
-
-# Remove the CCo.
-stas[0].get_sta_cesar().stop()
-csi.process_wait_sec (1)
-csi.process_sta_remove (avln1, stas[0])
-csi.process_wait_sec (1)
-
-# Activate the sniffer on the second station.
-db = None
-state = csi.sniffer_activate (stas[1], False, False, True, False)
-if state != None:
- db = csi.sniff_packets (10)
-
-class TestDiscoverBeacon(unittest.TestCase):
-
- def setUp(self):
- pass
-
- def tearDown(self):
- pass
-
- def test (self):
- stei_list = list()
- if db == None:
- print "No discover beacons received."
- else:
- print "Number of discovered beacons received ", len(db)
- for i in range (0, len(db)):
- from struct import unpack
- data = db[i].get()
-
- # Convert it from string to integer array.
- data = unpack (len(data) * 'B', data)[19:]
-
- if data[0] == 1:
- # Fail if the beacon type is not a discover beacon.
- self.failUnless (data[0] == 1)
- self.failUnless (data[1] == 0)
- self.failUnless (data[10] & 3 == 1)
-
-suite = unittest.TestLoader().loadTestsFromTestCase(TestDiscoverBeacon)
-testResult = unittest.TextTestRunner(verbosity=2).run(suite)
-
-print "Removing the AVLNS"
-csi.process_avlns_remove()
-result = csi.process_end_get_result ()
-
-# For nightly build errors
-sys.exit ((1, 0)[result and testResult.wasSuccessful ()])
diff --git a/cesar/test_general/station/cco0/s2/Config b/cesar/test_general/station/cco0/s2/Config
deleted file mode 100644
index 54cdd69001..0000000000
--- a/cesar/test_general/station/cco0/s2/Config
+++ /dev/null
@@ -1,3 +0,0 @@
-CONFIG_BLK_NB = 2048
-CONFIG_STATS=y
-CONFIG_MAC_PBPROC_EOC_FC = y
diff --git a/cesar/test_general/station/cco0/s2/Makefile b/cesar/test_general/station/cco0/s2/Makefile
deleted file mode 100644
index 33e924cf2d..0000000000
--- a/cesar/test_general/station/cco0/s2/Makefile
+++ /dev/null
@@ -1,14 +0,0 @@
-BASE = ../../../..
-ECOS = y
-
-TARGET_PROGRAMS= cco0s2
-
-cco0s2_SOURCES =
-cco0s2_MODULES = lib mac/common mac cl hle interface cp hal station host \
- cp/av bsu \
- test_general/station/fcall \
- test_general/station/common ce/stub
-
-include $(BASE)/common/make/top.mk
-
-$(call src2obj,src/region_stub.c,target): $(BASE)/cp/fsm/fsm.h
diff --git a/cesar/test_general/station/cco0/s2/doc/Makefile b/cesar/test_general/station/cco0/s2/doc/Makefile
deleted file mode 100644
index 70191a5009..0000000000
--- a/cesar/test_general/station/cco0/s2/doc/Makefile
+++ /dev/null
@@ -1,13 +0,0 @@
-DIA = sc02_five_station.dia
-
-PNG=$(DIA:%.dia=%.png)
-
-all: $(PNG)
-
-png: $(PNG)
-
-%.png: %.dia
- dia -t png $<
-
-clean:
- rm -f $(PNG)
diff --git a/cesar/test_general/station/cco0/s2/doc/sc02_five_station.dia b/cesar/test_general/station/cco0/s2/doc/sc02_five_station.dia
deleted file mode 100644
index 56e0ddbedc..0000000000
--- a/cesar/test_general/station/cco0/s2/doc/sc02_five_station.dia
+++ /dev/null
Binary files differ
diff --git a/cesar/test_general/station/cco0/s2/ecos.ecc.sh b/cesar/test_general/station/cco0/s2/ecos.ecc.sh
deleted file mode 100644
index e0278271fe..0000000000
--- a/cesar/test_general/station/cco0/s2/ecos.ecc.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-config=${1:-ecos-gen.ecc}
-ecosconfig --config=$config new maximus default
-cat >> $config <<'EOF'
-EOF
-ecosconfig --config=$config check
diff --git a/cesar/test_general/station/cco0/s2/py/sc01_bridge.py b/cesar/test_general/station/cco0/s2/py/sc01_bridge.py
deleted file mode 100644
index 0eb9165a83..0000000000
--- a/cesar/test_general/station/cco0/s2/py/sc01_bridge.py
+++ /dev/null
@@ -1,231 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-# Bridge MMEs #
-# ---------------------------------------------------------------------- #
-# Objective: Two or more stations authenticated on the same #
-# AVLN are exchanging data with bridged entities MMEs. #
-##############################################################################
-
-# Add Maximus and CSI to PATH module lookup.
-import sys
-sys.path.append(sys.path[0] + '/../../../../../maximus/python/tools/csi/')
-sys.path.append(sys.path[0] + '/../../../../../maximus/python/obj/')
-sys.path.append(sys.path[0] + '/../../../../../maximus/python/')
-sys.path.append(sys.path[0] + '/../../../../../maximus/python/lib/cesar')
-# Import some classes from the CSI module.
-from csicore import csiCore, csiPacket, csiSta, csiPacket
-from sta_mgr import Sta_mgr
-# Random.
-import random
-
-### Handy functions.
-def send_bridged_packet(sta_src, sta_dst, bridged_mac_src):
- """
- Send a packet coming from a STA out of the AVLN with bridged_mac_src
- through sta_src to sta_dst.
- """
- # Add MAC address to the internal bridged list of CSI module.
- sta_src.bridge_mac_addr_add(bridged_mac_src)
- # Create a list of one packet to send.
- bridged_packet = list()
- bridged_packet.append(csiPacket(150, avln, sta_src, bridged_mac_src,
- sta_dst))
- # Send bridged packet.
- csi.process_data_send_traffic(bridged_packet)
-
-def is_mac_into_bridge_table(range, mac, has = True):
- """
- Check a range of STAs of the AVLN has or has not the MAC entry presents
- into its bridge table.
- """
- # Create a sta manager.
- sta_data = Sta_mgr()
- # Get maximus.
- maximus = csi.get_maximus()
- # For each STA of the AVLN in range.
- if has:
- for i in range:
- if not sta_data.is_bridged_mac(maximus,
- avln.get_sta(i).get_sta_cesar(), mac):
- # Error!
- return False
- else:
- for i in range:
- if sta_data.is_bridged_mac(maximus,
- avln.get_sta(i).get_sta_cesar(), mac):
- # Error!
- return False
- # No error.
- return True
-
-def is_mac_into_mactotei_table(range, mac, has = True):
- """
- Check a range of STAs of the AVLN has or has not the MAC entry presents
- into the MAC to TEI table.
- """
- # Create a sta manager.
- sta_data = Sta_mgr()
- # Get maximus.
- maximus = csi.get_maximus()
- # For each STA of the AVLN in range.
- if has:
- for i in range:
- if sta_data.get_tei_from_mac(maximus,
- avln.get_sta(i).get_sta_cesar(), mac) == 0:
- # Error!
- return False
- else:
- for i in range:
- if sta_data.get_tei_from_mac(maximus,
- avln.get_sta(i).get_sta_cesar(), mac) != 0:
- # Error!
- return False
- # No error.
- return True
-
-### Some "defines".
-# Count of STA in the AVLN (need to be between 2 and 10).
-avln_sta_count = 2
-# List of bridged addresses.
-bridged_address = list()
-bridged_address.append (("42:42:42:42:42:42", (66, 66, 66, 66, 66, 66)))
-bridged_address.append (("24:24:24:24:24:24", (36, 36, 36, 36, 36, 36)))
-bridged_address.append (("66:66:66:66:66:66", (102, 102, 102, 102, 102, 102)))
-
-# Initialize CSI.
-csi = csiCore(4242);
-
-# Create an AVLN.
-avln = csi.avln_add("HomePlug_AVLN", "AVLN")
-
-# Add some STA to the AVLN.
-for i in range(avln_sta_count):
- # Generate MAC address
- mac = ''
- for j in range(6):
- mac += str(i)
- mac += str(j)
- if j != 5:
- mac += ':'
- # Add STA to the AVLN.
- avln.sta_add(mac, False, False, 'Homeplug_Station' + str(i),
- 'spidcom_spc300_sta' + str(i), 'station' + str(i),
- 1, False, 0)
-
-# Start the simulation.
-csi.process_init(sys.argv + ['-e', sys.path[0] + '/../obj/cco0s2.elf'])
-# Start the AVLN and STA.
-csi.process_avlns_launch()
-# Wait for association and authentication.
-csi.process_wait_association()
-csi.process_wait_authentication()
-
-# Send a bridged packet from the first STA to another one.
-send_bridged_packet(avln.get_sta(0), avln.get_sta(1), bridged_address[0][0])
-
-# Let's wait a little bit for the update of the bridge table to be triggered
-# by the garbage CP function.
-csi.process_wait_sec(1)
-
-# Check first STA bridges the MAC address (i.e., have the MAC address in the
-# bridge table).
-if not (is_mac_into_bridge_table((0,), bridged_address[0][1]), True):
- raise Exception("STA 0 should contain one bridged entry")
-# Check first STA has not the bridge MAC address into its MAC to TEI table.
-if not (is_mac_into_mactotei_table((0,), bridged_address[0][1]), False):
- raise Exception("STA 0 should not contain the MAC address into the "
- "MAC to TEI table")
-# Check other STA has not the MAC address in the bridge table.
-if not (is_mac_into_bridge_table(range(1, avln_sta_count),
- bridged_address[0][1]), False):
- raise Exception("STA should not contain bridged entry")
-# Check other STAs have the MAC address into the MAC to TEI.
-if not (is_mac_into_mactotei_table(range(1, avln_sta_count),
- bridged_address[0][1]), True):
- raise Exception("STA should have an entry for the "
- "bridged MAC address into the MAC to TEI table.")
-
-
-# We now send a second bridge packet with a MAC address different. The STA
-# should add it to its bridge table but not "publish" it to other STA.
-send_bridged_packet(avln.get_sta(0), avln.get_sta(1), bridged_address[1][0])
-# Wait a little.
-csi.process_wait_sec(1)
-# Check first STA bridges the MAC address.
-if not (is_mac_into_bridge_table((0,), bridged_address[1][1]), True):
- raise Exception("STA 0 should have bridged the MAC address.")
-# Check first STA has not the bridge MAC address into its MAC to TEI table.
-if not (is_mac_into_mactotei_table((0,), bridged_address[1][1]), False):
- raise Exception("STA 0 should not contain the MAC address into the "
- "MAC to TEI table")
-# Check other STA has not the MAC address in the bridge table.
-if not (is_mac_into_bridge_table(range(1, avln_sta_count),
- bridged_address[1][1]), False):
- raise Exception("STA should not contain bridged entry")
-# Check other STAs have not yet the MAC address into the MAC to TEI.
-if not (is_mac_into_mactotei_table(range(1, avln_sta_count),
- bridged_address[1][1]), False):
- raise Exception("STA should not have an entry for the "
- "bridged MAC address into the MAC to TEI table.")
-
-# Let's now wait some time for the bridge MAC address to be published.
-csi.process_wait_sec(4)
-# The MAC address should still not be present in the bridge table of other
-# STA.
-if not (is_mac_into_bridge_table(range(1, avln_sta_count),
- bridged_address[1][1]), False):
- raise Exception("STA should not contain bridged entry")
-# Check other STAs have now the MAC address into the MAC to TEI.
-if not (is_mac_into_mactotei_table(range(1, avln_sta_count),
- bridged_address[1][1]), True):
- raise Exception("STA should have an entry for the "
- "bridged MAC address into the MAC to TEI table.")
-
-# We now send a third bridge packet with a MAC address different.
-send_bridged_packet(avln.get_sta(0), avln.get_sta(1), bridged_address[2][0])
-# The MAC address will be published in 5 seconds, and them the bridge table
-# will be published again in 90 seconds. But the first bridged MAC address
-# should have expire in the bridge table and should not published again.
-csi.process_wait_sec(95)
-# Check first STA does not bridge the MAC address anymore.
-if not (is_mac_into_bridge_table((0,), bridged_address[0][1]), False):
- raise Exception("STA 0 should not bridge the MAC address anymore.")
-# Other STA should have remove the entry from their MAC to TEI table.
-if not (is_mac_into_mactotei_table(range(1, avln_sta_count),
- bridged_address[0][1]), False):
- raise Exception("STA should not have an entry for the "
- "bridged MAC address into the MAC to TEI table.")
-
-# We now send again a packet with the third bridge MAC address and wait until
-# it the next publication of the bridge table (in 90 seconds). It should be
-# the only remaining entry.
-send_bridged_packet(avln.get_sta(0), avln.get_sta(1), bridged_address[2][0])
-csi.process_wait_sec(91)
-# Check first STA only contains the third MAC address into the bridge table.
-if not (is_mac_into_bridge_table((0,), bridged_address[0][1]), False):
- raise Exception("STA 0 should not bridge the MAC address anymore.")
-if not (is_mac_into_bridge_table((0,), bridged_address[1][1]), False):
- raise Exception("STA 0 should not bridge the MAC address anymore.")
-if not (is_mac_into_bridge_table((0,), bridged_address[2][1]), True):
- raise Exception("STA 0 should bridge the MAC address anymore.")
-# Other STA should have remove the entries from their MAC to TEI table and
-# only keep one.
-if not (is_mac_into_mactotei_table(range(1, avln_sta_count),
- bridged_address[0][1]), False):
- raise Exception("STA should not have an entry for the "
- "bridged MAC address into the MAC to TEI table.")
-if not (is_mac_into_mactotei_table(range(1, avln_sta_count),
- bridged_address[1][1]), False):
- raise Exception("STA should not have an entry for the "
- "bridged MAC address into the MAC to TEI table.")
-if not (is_mac_into_mactotei_table(range(1, avln_sta_count),
- bridged_address[2][1]), True):
- raise Exception("STA should have an entry for the "
- "bridged MAC address into the MAC to TEI table.")
-
-# Check every packets sent have been received.
-csi.process_verify_transmission()
-# Report errors for nightly build.
-result = csi.process_end_get_result()
-sys.exit((1, 0)[result])
diff --git a/cesar/test_general/station/cco0/s2/py/sc02_five_stations.py b/cesar/test_general/station/cco0/s2/py/sc02_five_stations.py
deleted file mode 100644
index 5f5ff39f8e..0000000000
--- a/cesar/test_general/station/cco0/s2/py/sc02_five_stations.py
+++ /dev/null
@@ -1,82 +0,0 @@
-#!/usr/bin/env python
-# Script interpreted by the CSI Cesar Script Interpreter
-
-# Create 5 station within an AVLN i.e. AVLN1.
-# Wait authentication of each station.
-# Create traffic bridged and to send over the stations.
-# See the doc sc02_five_station.dia or execute the makefile in it to obtain
-# the png file.
-
-import os
-import sys
-sys.path.append ('../../../../maximus/python/tools/csi/')
-sys.path.append ('../../../../maximus/python/obj/')
-sys.path.append ('../../../../maximus/python/')
-sys.path.append ('../../../../maximus/python/lib/cesar')
-
-from csicore import *
-
-csi = csiCore (1234)
-
-# Creating an AVLN.
-avln1 = csi.avln_add ("Homeplug_AVLN1", "AVLN1")
-
-sta1_debug = False
-sta2_debug = False
-sta3_debug = False
-sta4_debug = False
-sta5_debug = False
-
-# Adding some station to the AVLN.
-stas = list ()
-stas.append(avln1.sta_add ("10:11:12:13:14:15", False, False,
- "Homeplug_Station1", "spidcom_spc300_sta1", "station1", 1, sta1_debug))
-stas.append(avln1.sta_add ("20:22:22:23:24:25", False, False,
- "Homeplug_Station2", "spidcom_spc300_sta2", "station2", 1, sta2_debug))
-stas.append(avln1.sta_add ("30:33:32:33:34:35", False, False,
- "Homeplug_Station3", "spidcom_spc300_sta3", "station3", 1, sta3_debug))
-stas.append(avln1.sta_add ("40:44:42:43:44:45", False, False,
- "Homeplug_Station4", "spidcom_spc300_sta4", "station4", 1, sta4_debug))
-stas.append(avln1.sta_add ("50:55:52:53:54:55", False, False,
- "Homeplug_Station5", "spidcom_spc300_sta5", "station5", 1, sta5_debug))
-
-# Add some bridged stations.
-stas[0].bridge_mac_addr_add ("10:10:10:10:10:01")
-stas[0].bridge_mac_addr_add ("10:10:10:10:10:02")
-
-stas[2].bridge_mac_addr_add("30:30:30:30:30:01")
-stas[2].bridge_mac_addr_add("30:30:30:30:30:02")
-stas[2].bridge_mac_addr_add("30:30:30:30:30:03")
-
-stas[3].bridge_mac_addr_add("40:40:40:40:40:01")
-stas[3].bridge_mac_addr_add("40:40:40:40:40:02")
-stas[3].bridge_mac_addr_add("40:40:40:40:40:03")
-
-packet_list = csi.avln_create_bridge_traffic (avln1, 100)
-
-csi.process_init (sys.argv + ['-e', 'obj/cco0s2.elf'])
-csi.process_avlns_launch ()
-csi.process_wait_association (15)
-csi.process_wait_authentication (15)
-csi.authentication_status (avln1)
-
-# Create broadcast frames for the bridged stations.
-for i in range (len (stas)):
- sta = stas[i]
- for j in range (sta.bridge_mac_addr_nb ()):
- packet = csiPacket (0, avln1, sta, sta.bridge_mac_addr_get (j))
- csi.process_data_send (packet)
- csi.process_wait_sec (0.1)
-
-csi.process_wait_sec (100)
-csi.process_data_send_traffic (packet_list)
-
-csi.process_wait_sec (5)
-csi.process_verify_transmission ()
-
-csi.process_wait_sec (1)
-#csi.process_avlns_stop ()
-
-result = csi.process_end_get_result ()
-# For nightly build errors
-sys.exit ((1, 0)[result])
diff --git a/cesar/test_general/station/cco0/s2/py/sc03_ten_stations.py b/cesar/test_general/station/cco0/s2/py/sc03_ten_stations.py
deleted file mode 100644
index ed2fcaffa3..0000000000
--- a/cesar/test_general/station/cco0/s2/py/sc03_ten_stations.py
+++ /dev/null
@@ -1,88 +0,0 @@
-#!/usr/bin/python
-# Script interpreted by the CSI Cesar Script Interpreter
-
-# Create 10 stations within an AVLN i.e. AVLN1.
-# Wait authentication of each station.
-# Create traffic bridged and to send over the stations.
-# See the doc sc03_ten_station.dia or execute the makefile in it to obtain
-# the png file.
-
-import os
-import sys
-sys.path.append ('../../../../maximus/python/tools/csi/')
-sys.path.append ('../../../../maximus/python/obj/')
-sys.path.append ('../../../../maximus/python/')
-sys.path.append ('../../../../maximus/python/lib/cesar')
-
-from csicore import *
-
-csi = csiCore (1234)
-
-# Creating an AVLN.
-avln1 = csi.avln_add ("Homeplug_AVLN1", "AVLN1")
-
-sta1_debug = False
-sta2_debug = False
-sta3_debug = False
-sta4_debug = False
-sta5_debug = False
-sta6_debug = False
-sta7_debug = False
-sta8_debug = False
-sta9_debug = False
-sta10_debug = False
-
-# Adding some station to the AVLN.
-stas = list ()
-stas.append(avln1.sta_add ("00:00:00:00:00:01", False, False, "Homeplug_Station1", "spidcom_spc300_sta1", "station1", 1, sta1_debug))
-stas.append(avln1.sta_add ("00:00:00:00:00:02", False, False, "Homeplug_Station2", "spidcom_spc300_sta2", "station2", 1, sta2_debug))
-stas.append(avln1.sta_add ("00:00:00:00:00:03", False, False, "Homeplug_Station3", "spidcom_spc300_sta3", "station3", 1, sta3_debug))
-stas.append(avln1.sta_add ("00:00:00:00:00:04", False, False, "Homeplug_Station4", "spidcom_spc300_sta4", "station4", 1, sta4_debug))
-stas.append(avln1.sta_add ("00:00:00:00:00:05", False, False, "Homeplug_Station5", "spidcom_spc300_sta5", "station5", 1, sta5_debug))
-stas.append(avln1.sta_add ("00:00:00:00:00:06", False, False, "Homeplug_Station6", "spidcom_spc300_sta6", "station6", 1, sta6_debug))
-stas.append(avln1.sta_add ("00:00:00:00:00:07", False, False, "Homeplug_Station7", "spidcom_spc300_sta7", "station7", 1, sta7_debug))
-stas.append(avln1.sta_add ("00:00:00:00:00:08", False, False, "Homeplug_Station8", "spidcom_spc300_sta8", "station8", 1, sta8_debug))
-stas.append(avln1.sta_add ("00:00:00:00:00:09", False, False, "Homeplug_Station9", "spidcom_spc300_sta9", "station9", 1, sta9_debug))
-stas.append(avln1.sta_add ("00:00:00:00:00:0a", False, False, "Homeplug_Station10", "spidcom_spc300_sta10", "station10", 1, sta10_debug))
-
-
-# Add some bridged stations.
-stas[0].bridge_mac_addr_add ("00:00:00:00:01:01")
-stas[0].bridge_mac_addr_add ("00:00:00:00:01:02")
-
-stas[2].bridge_mac_addr_add("00:00:00:00:03:01")
-stas[2].bridge_mac_addr_add("00:00:00:00:03:02")
-stas[2].bridge_mac_addr_add("00:00:00:00:03:03")
-
-stas[3].bridge_mac_addr_add("00:00:00:00:04:01")
-stas[3].bridge_mac_addr_add("00:00:00:00:04:02")
-stas[3].bridge_mac_addr_add("00:00:00:00:04:03")
-
-packet_list = csi.avln_create_bridge_traffic (avln1, 100)
-
-csi.process_init (sys.argv + ['-e', 'obj/cco0s2.elf'])
-csi.process_avlns_launch ()
-csi.process_wait_association (15)
-csi.process_wait_authentication (15) # Broadcast from one station to the others
-csi.authentication_status (avln1) # Build table
-
-# Create broadcast frames for the bridged stations.
-for i in range (len (stas)):
- sta = stas[i]
- for j in range (sta.bridge_mac_addr_nb ()):
- packet = csiPacket (0, avln1, sta, sta.bridge_mac_addr_get (j))
- csi.process_data_send (packet)
- csi.process_wait_sec (0.1)
-
-csi.process_wait_sec (100)
-csi.process_data_send_traffic (packet_list) # Send Ethernet packets
-
-csi.process_wait_sec (5)
-csi.process_verify_transmission () # Check reception list
-
-csi.process_wait_sec (1)
-csi.process_avlns_remove()
-
-result = csi.process_end_get_result () # Display result
-# For nightly build errors
-sys.exit ((1, 0)[result])
diff --git a/cesar/test_general/station/cco0/s2/py/sc04_change_snid.py b/cesar/test_general/station/cco0/s2/py/sc04_change_snid.py
deleted file mode 100644
index 3b1b4f654d..0000000000
--- a/cesar/test_general/station/cco0/s2/py/sc04_change_snid.py
+++ /dev/null
@@ -1,87 +0,0 @@
-#!/usr/bin/python
-
-# Create two AVLN and cause a SNID conflict.
-
-import os
-import unittest
-import sys
-sys.path.append ('../../../../maximus/python/tools/csi/')
-sys.path.append ('../../../../maximus/python/obj/')
-sys.path.append ('../../../../maximus/python/')
-sys.path.append ('../../../../maximus/python/lib/cesar')
-
-from csicore import *
-from beacon import *
-
-csi = csiCore (1234)
-MACSDEFAULT = "00:13:d7:00:0%x:%02x"
-# Creating an AVLN.
-avln1 = csi.avln_add ("Homeplug_AVLN1", "AVLN1")
-avln1_sta_nb = 2
-# Adding the stations.
-avln1_stas = list ()
-for i in range (0, avln1_sta_nb):
- avln1_stas.append (avln1.sta_add (MACSDEFAULT % (1, i+1), False, False,
- "HomePlug_AVLN1_Station%d" % (i+1),
- "av1_spc300_sta%d" % (i+1),
- "avln1_station%d" % (i+1), 1, False))
-csi.process_init (sys.argv + ['-e', 'obj/cco0s2.elf'])
-csi.process_avlns_launch ()
-csi.process_wait_association (15)
-csi.process_wait_authentication (15)
-csi.authentication_status (avln1)
-# Get the CCo.
-cco = avln1_stas[avln1_sta_nb - 1]
-own = Station_own_data ()
-own.get_data (csi.get_maximus (), cco.get_sta_cesar())
-snid = own.snid
-own = None
-
-# Activate the sniffer for the beacon TX on the CCo.
-state = csi.sniffer_activate (cco, False, False, True, False)
-if state == False:
- print "Sniffer not activated for Sta 1"
-
-fcall = csi.get_maximus().create_fcall ("fc_cco_change_snid")
-fcall.set_sta (cco.get_sta_cesar().get())
-fcall.add_param_ushort ('snid', snid + 1)
-fcall.send()
-
-beacon = csi.sniff_packets (1)
-
-# Wait 1 seconds.
-csi.process_wait_sec (1)
-beacon2 = csi.sniff_packets (1)
-
-csi.process_avlns_remove ()
-
-class TestSnidChange(unittest.TestCase):
-
- def setUp(self):
- pass
-
- def tearDown(self):
- pass
-
- def test (self):
-
-
- self.failUnless (beacon)
- unpack = Beacon ()
- unpack.unpack (beacon[0].get())
- self.failUnless (unpack.change_snid_snid == snid + 1)
- unpack = None
- self.failUnless (beacon2 != None)
- unpack = Beacon()
- unpack.unpack (beacon2[0].get())
- self.failUnless (unpack.change_snid_snid == 0)
- for i in avln1_stas:
- own = Station_own_data ()
- own.get_data (csi.get_maximus (), i.get_sta_cesar())
- self.failUnless (own.snid == snid + 1)
-
-suite = unittest.TestLoader().loadTestsFromTestCase(TestSnidChange)
-testResult = unittest.TextTestRunner(verbosity=2).run(suite)
-
-# For nightly build errors
-sys.exit ((1, 0)[testResult.wasSuccessful ()])
diff --git a/cesar/test_general/station/cco0/s2/py/sc05_change_hm.py b/cesar/test_general/station/cco0/s2/py/sc05_change_hm.py
deleted file mode 100644
index 469272c009..0000000000
--- a/cesar/test_general/station/cco0/s2/py/sc05_change_hm.py
+++ /dev/null
@@ -1,91 +0,0 @@
-#!/usr/bin/python
-
-# Create an AVLN and cause a hybrid mode change.
-
-import os
-import unittest
-import sys
-sys.path.append ('../../../../maximus/python/tools/csi/')
-sys.path.append ('../../../../maximus/python/obj/')
-sys.path.append ('../../../../maximus/python/')
-sys.path.append ('../../../../maximus/python/lib/cesar')
-
-from csicore import *
-from beacon import *
-
-csi = csiCore (1234)
-MACSDEFAULT = "00:13:d7:00:0%x:%02x"
-# Creating an AVLN.
-avln1 = csi.avln_add ("Homeplug_AVLN1", "AVLN1")
-avln1_sta_nb = 2
-# Adding the stations.
-avln1_stas = list ()
-for i in range (0, avln1_sta_nb):
- avln1_stas.append (avln1.sta_add (MACSDEFAULT % (1, i+1), False, False,
- "HomePlug_AVLN1_Station%d" % (i+1),
- "av1_spc300_sta%d" % (i+1),
- "avln1_station%d" % (i+1), 1, False))
-csi.process_init (sys.argv + ['-e', 'obj/cco0s2.elf'])
-csi.process_avlns_launch ()
-csi.process_wait_association (15)
-csi.process_wait_authentication (15)
-csi.authentication_status (avln1)
-# Get the CCo.
-cco = avln1_stas[avln1_sta_nb - 1]
-own = Station_own_data ()
-own.get_data (csi.get_maximus (), cco.get_sta_cesar())
-hm = own.hybrid_mode
-own = None
-hm_req = 0
-
-# Activate the sniffer for the beacon TX on the CCo.
-state = csi.sniffer_activate (cco, False, False, True, False)
-if state == False:
- print "Sniffer not activated for Sta 1"
-
-fcall = csi.get_maximus().create_fcall ("fc_cco_change_hm")
-fcall.set_sta (cco.get_sta_cesar().get())
-fcall.add_param_ushort ('hm', hm_req)
-fcall.send()
-
-beacon = csi.sniff_packets (1)
-
-# Wait 1 seconds.
-csi.process_wait_sec (1)
-beacon2 = csi.sniff_packets (1)
-
-csi.process_avlns_remove ()
-
-class TestHmChange(unittest.TestCase):
-
- def setUp(self):
- pass
-
- def tearDown(self):
- pass
-
- def test (self):
-
-
- self.failUnless (beacon)
- unpack = Beacon ()
- unpack.unpack (beacon[0].get())
- self.failUnless (unpack.change_hm_newhm == hm_req)
- unpack = None
-
- self.failUnless (beacon2 != None)
- unpack = Beacon()
- unpack.unpack (beacon2[0].get())
- self.failUnless (unpack.change_hm_newhm == 0)
- self.failUnless (unpack.hm == hm_req)
-
- for i in avln1_stas:
- own = Station_own_data ()
- own.get_data (csi.get_maximus (), i.get_sta_cesar())
- self.failUnless (own.hybrid_mode == hm_req)
-
-suite = unittest.TestLoader().loadTestsFromTestCase(TestHmChange)
-testResult = unittest.TextTestRunner(verbosity=2).run(suite)
-
-# For nightly build errors
-sys.exit ((1, 0)[testResult.wasSuccessful ()])
diff --git a/cesar/test_general/station/cco0/s2/py/sc06_snid_conflict.py b/cesar/test_general/station/cco0/s2/py/sc06_snid_conflict.py
deleted file mode 100644
index 13b7698c8a..0000000000
--- a/cesar/test_general/station/cco0/s2/py/sc06_snid_conflict.py
+++ /dev/null
@@ -1,110 +0,0 @@
-#!/usr/bin/python
-
-# Create two AVLN and cause a SNID conflict.
-
-import os
-import unittest
-import sys
-sys.path.append ('../../../../maximus/python/tools/csi/')
-sys.path.append ('../../../../maximus/python/obj/')
-sys.path.append ('../../../../maximus/python/')
-sys.path.append ('../../../../maximus/python/lib/cesar')
-
-from csicore import *
-from beacon import *
-
-csi = csiCore (1234)
-
-MACSDEFAULT = "00:13:d7:00:0%x:%02x"
-
-# Creating an AVLN.
-avln1 = csi.avln_add ("Homeplug_AVLN1", "AVLN1")
-avln1_sta_nb = 2
-
-avln2 = csi.avln_add ("Homeplug_AVLN2", "AVLN2")
-avln2_sta_nb = 2
-
-# Adding the stations.
-avln1_stas = list ()
-for i in range (0, avln1_sta_nb):
- avln1_stas.append (avln1.sta_add (MACSDEFAULT % (1, i+1), False, False,
- "HomePlug_AVLN1_Station%d" % (i+1),
- "av1_spc300_sta%d" % (i+1),
- "avln1_station%d" % (i+1), 1, False))
-
-avln2_stas = list ()
-for i in range (0, avln2_sta_nb):
- avln2_stas.append (avln2.sta_add (MACSDEFAULT % (2, i+1), False, False,
- "HomePlug_AVLN2_Station%d" % (i+1),
- "av2_spc300_sta%d" % (i+1),
- "avln2_station%d" % (i+1), 1, False))
-
-csi.process_init (sys.argv + ['-e' , 'obj/cco0s2.elf'])
-csi.process_avlns_launch ()
-csi.process_wait_association (15)
-csi.process_wait_authentication (15)
-
-print "Association status on AVLN1"
-csi.authentication_status (avln1)
-
-print "Association status on AVLN2"
-csi.authentication_status (avln2)
-
-class TestSnidChange(unittest.TestCase):
-
- def setUp(self):
- pass
-
- def tearDown(self):
- pass
-
- def testSnidDiff (self):
- """Set the same SNID in the AVLN using Fcalls, CCo should change the
- SNID."""
- # Get the snid of the first AVLN.
- own = Station_own_data ()
- own.get_data (csi.get_maximus (), avln1_stas[1].get_sta_cesar())
- avln1_snid = own.snid
- own = None
- print ""
- print "AVLN 1 SNID : ", avln1_snid
- # Get the snid of the second AVLN.
- own = Station_own_data ()
- own.get_data (csi.get_maximus (), avln2_stas[1].get_sta_cesar())
- avln2_snid = own.snid
- own = None
- print "AVLN 2 SNID : ", avln2_snid
- fcall = csi.get_maximus().create_fcall ("fc_cco_change_snid")
- fcall.set_sta (avln1_stas[1].get_sta_cesar().get())
- fcall.add_param_ushort ('snid', avln1_snid + 1)
- fcall.send()
- csi.process_wait_sec (2)
- own = Station_own_data ()
- own.get_data (csi.get_maximus (), avln1_stas[1].get_sta_cesar())
- avln1_snid = own.snid
- print "AVLN 1 SNID : ", avln1_snid
- own = Station_own_data ()
- own.get_data (csi.get_maximus (), avln2_stas[0].get_sta_cesar())
- avln2_snid = own.snid
- print "AVLN 2 SNID : ", avln2_snid
- self.failUnless (avln1_snid != avln2_snid)
- # Send data over the two AVLN 1.
- from csipacket import csiPacket
- for i in [avln1, avln2]:
- stationsrc = i.get_sta (0)
- stationdst = i.get_sta (1)
- p = csiPacket (1024, i, stationsrc, stationsrc.get_mac_addr (),
- stationdst)
- csi.process_data_send (p)
- csi.process_wait_sec (1)
- csi.process_verify_transmission ()
-
-suite = unittest.TestLoader().loadTestsFromTestCase(TestSnidChange)
-testResult = unittest.TextTestRunner(verbosity=2).run(suite)
-
-csi.process_avlns_stop ()
-csi.process_avlns_remove ()
-
-# For nightly build errors
-sys.exit ((1, 0)[testResult.wasSuccessful ()])
-os.system ("killall cco0s2.elf")
diff --git a/cesar/test_general/station/cco0/s2/py/sc07_handover.py b/cesar/test_general/station/cco0/s2/py/sc07_handover.py
deleted file mode 100644
index d5e39c2dd5..0000000000
--- a/cesar/test_general/station/cco0/s2/py/sc07_handover.py
+++ /dev/null
@@ -1,86 +0,0 @@
-#!/usr/bin/python
-
-#############################################################################
-# #
-# The handover shall only occur when no other countdown is active. #
-# This test verifies it by activating a SNID collision on the AVLNS at #
-# the same time as the CCo should handover. #
-# #
-# One AVLNs, 3 stations. #
-# AVLN 1 contains three stations. #
-# #
-# Result expected: The handover should only occur after the SNID changed. #
-# #
-# Some others test will be done for the hybrid mode. #
-#############################################################################
-
-import unittest, sys, os
-sys.path.append ('../../../../maximus/python/tools/csi/')
-sys.path.append ('../../../../maximus/python/obj/')
-sys.path.append ('../../../../maximus/python/')
-sys.path.append ('../../../../maximus/python/lib/cesar')
-
-from csicore import csiCore
-from csistation import csiSta
-
-DEFAULT_MAC = '00:13:d7:00:00:%02x'
-NB_STA = 2
-DEBUG = False
-EXECUTABLE = 'obj/cco0s2.elf'
-
-csi = csiCore (1234)
-csi.process_init (sys.argv + ['-e', EXECUTABLE])
-# Creating an AVLN.
-avln = csi.avln_add ("Homeplug_AVLN1", "AVLN1")
-
-for i in range (0, NB_STA):
- if i != NB_STA - 1:
- avln.sta_add (DEFAULT_MAC % (i + 1), False, False,
- "SPIDCOM_CCO_LEVEL0_STEP2_" + str (i+1),
- "SPIDCOM_SPC_300_" + str (i+1), "SPIDCOM_SPC_300_" + str (i+1),
- 1, DEBUG)
- else:
- avln.sta_add (DEFAULT_MAC % (i + 1), True, False,
- "SPIDCOM_CCO_LEVEL0_STEP2_" + str (i+1),
- "SPIDCOM_SPC_300_" + str (i+1), "SPIDCOM_SPC_300_" + str (i+1),
- 1, DEBUG)
-
-class TestHandover (unittest.TestCase):
-
- def setUp (self):
- pass
-
- def tearDown (self):
- pass
-
- def testHandover (self):
- """Test the handover from station 1 to station NB_STA - 1.
- Last station of the AVLN is CCO user appointed.
- HPAV require on a handover on the CCo CAP of a station, user appointed
- is optional.
- """
- from own_data import Station_own_data
- csi.process_sta_start (avln.get_sta (0))
- csi.process_wait_sec (4)
- for i in range (1, NB_STA):
- csi.process_sta_start (avln.get_sta(i))
- csi.process_wait_association ()
- csi.process_wait_authentication ()
- csi.process_wait_sec (20)
- data = Station_own_data ()
- data.get_data (csi.get_maximus (),
- avln.get_sta (0).get_sta_cesar ())
- self.failUnless (data.cco_prefered == False)
- self.failUnless (data.is_cco == True)
- data.get_data (csi.get_maximus (),
- avln.get_sta (NB_STA - 1).get_sta_cesar ())
- self.failUnless (data.cco_prefered == True)
- self.failUnless (data.is_cco == False)
-
-suite = unittest.TestLoader().loadTestsFromTestCase(TestHandover)
-testResult = unittest.TextTestRunner(verbosity=2).run(suite)
-
-csi.process_avlns_remove ()
-# For nightly build errors
-sys.exit ((1, 0)[testResult.wasSuccessful ()])
-os.system ('killall cco0s2.elf')
diff --git a/cesar/test_general/station/cco0/s2/py/sc08_sc_avln_already_exist_one_sc_join.py b/cesar/test_general/station/cco0/s2/py/sc08_sc_avln_already_exist_one_sc_join.py
deleted file mode 100644
index b22f4a2a38..0000000000
--- a/cesar/test_general/station/cco0/s2/py/sc08_sc_avln_already_exist_one_sc_join.py
+++ /dev/null
@@ -1,122 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-# SC procedure : two STA : one in SC JOIN, one in SC ADD & AVLN. #
-# ---------------------------------------------------------------------- #
-# Objective: Two STA not connected to any AVLN will try to form an AVLN by #
-# using the SC procedure. This is quite the same as two STA in #
-# SC JOIN because the one doing the SC_ADD is the one with the #
-# bigger MAC address. #
-##############################################################################
-
-# Add Maximus and CSI to PATH module lookup.
-import sys
-base_path = sys.path[0] + '/../../../../../'
-sys.path.append (base_path + '/test_general/station/common/py')
-from startup import Startup
-from define import *
-startup = Startup (base_path = base_path,
- executable = sys.path[0] + '/../obj/cco0s2.elf')
-startup.add_option ('-g', '--gdb', action = 'store_true',
- default = False, help = 'launch the test in debug mode')
-startup.add_option ('-c', '--cco', action = 'store_true',
- default = False, dest = 'sc_add_cco', help = 'CCO in SC_ADD')
-startup.add_option ('-s', '--sta', action = 'store_false',
- dest = 'sc_add_cco', help = 'STA in SC_ADD')
-argv, proto, options = startup.parse ()
-from csicore import csiCore, csiSta, csiPacket
-from sta_mgr import Sta_mgr
-from drv import *
-from own_data import Station_own_data
-import unittest
-
-# To check STA are really associated and authenticated.
-class TestAuthentication(unittest.TestCase):
- def setUp(self):
- pass
- def tearDown(self):
- pass
- def testAuthentication(self):
- """Check SC stations are authenticated"""
- own = Station_own_data ()
- own.get_data (csi.get_maximus (), csista1.get_sta_cesar())
- self.failUnless(own.authenticated == True)
- own.get_data (csi.get_maximus (), csista2.get_sta_cesar())
- self.failUnless(own.authenticated == True)
- own.get_data (csi.get_maximus (), csista3.get_sta_cesar())
- self.failUnless(own.authenticated == True)
-
-# Initialize CSI.
-csi = csiCore(4242);
-
-# Create two AVLN.
-avln1 = csi.avln_add("HomePlug_AVLN1", "AVLN1")
-avln2 = csi.avln_add("HomePlug_AVLN2", "AVLN2")
-
-mac1 = '00:1e:4f:ed:fb:01'
-mac2 = '00:1e:4f:ed:fb:02'
-mac3 = '00:1e:4f:ed:fb:03'
-
-# Add STA1 and STA2 to the first AVLN.
-csista1 = avln1.sta_add(mac1, False, False, 'Homeplug_Station1', 'spidcom_spc300_sta1',
- 'station1', 1, options.gdb, 0)
-csista2 = avln1.sta_add(mac2, False, False, 'Homeplug_Station2', 'spidcom_spc300_sta2',
- 'station2', 1, options.gdb, 0)
-# Add STA3 to the second AVLN.
-csista3 = avln2.sta_add(mac3, False, False, 'Homeplug_Station3', 'spidcom_spc300_sta3',
- 'station3', 1, options.gdb, 0)
-
-# Start the simulation.
-csi.process_init (argv, proto)
-# Start the AVLN and STA.
-csi.process_avlns_launch()
-
-driverMME = DriverMME(maximus=csi.get_maximus(), autoload=True)
-own = Station_own_data ()
-
-# Wait until STA1 and STA2 are associated and authenticated.
-not_associated = True
-while not_associated:
- own.get_data (csi.get_maximus (), csista1.get_sta_cesar())
- auth1 = own.authenticated
- own.get_data (csi.get_maximus (), csista2.get_sta_cesar())
- auth2 = own.authenticated
- if auth1 == True and auth2 == True:
- not_associated = False
- else:
- csi.process_wait_sec(1)
-
-print "Ok STA1 and STA2 are associated & authenticated."
-
-# SC JOIN on third STA.
-driverMME.send(csista3.get_sta_cesar(), 'DRV_STA_SC', '\x01')
-
-# Get CCO status of STA1.
-own.get_data (csi.get_maximus (), csista1.get_sta_cesar())
-# STA1 is CCO.
-if own.is_cco:
- if options.sc_add_cco:
- print "CCo doing SC_ADD."
- driverMME.send(csista1.get_sta_cesar(), 'DRV_STA_SC', '\x00')
- else:
- print "STA doing SC_ADD."
- driverMME.send(csista2.get_sta_cesar(), 'DRV_STA_SC', '\x00')
-# STA2 is CCO
-else:
- if options.sc_add_cco:
- print "CCo doing SC_ADD."
- driverMME.send(csista2.get_sta_cesar(), 'DRV_STA_SC', '\x00')
- else:
- print "STA doing SC_ADD."
- driverMME.send(csista1.get_sta_cesar(), 'DRV_STA_SC', '\x00')
-
-# Wait for association.
-csi.process_wait_association()
-# Wait for authentication.
-csi.process_wait_authentication()
-
-# Do some checks.
-suite = unittest.TestLoader().loadTestsFromTestCase(TestAuthentication)
-testResult = unittest.TextTestRunner(verbosity=2).run(suite)
-# For nightly build errors
-sys.exit ((1, 0)[testResult.wasSuccessful()])
diff --git a/cesar/test_general/station/cco0/s2/py/sc08_sc_one_sc_join_one_sc_add.py b/cesar/test_general/station/cco0/s2/py/sc08_sc_one_sc_join_one_sc_add.py
deleted file mode 100644
index cd0f9ad29b..0000000000
--- a/cesar/test_general/station/cco0/s2/py/sc08_sc_one_sc_join_one_sc_add.py
+++ /dev/null
@@ -1,91 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-# SC procedure : two STA : one in SC ADD, one in SC JOIN #
-# ---------------------------------------------------------------------- #
-# Objective: Two STA not connected to any AVLN will try to form an AVLN by #
-# using the SC procedure. This is quite the same as two STA in #
-# SC JOIN because the one doing the SC_ADD is the one with the #
-# bigger MAC address. #
-##############################################################################
-
-# Add Maximus and CSI to PATH module lookup.
-import sys
-base_path = sys.path[0] + '/../../../../../'
-sys.path.append (base_path + '/test_general/station/common/py')
-from startup import Startup
-from define import *
-startup = Startup (base_path = base_path,
- executable = sys.path[0] + '/../obj/cco0s2.elf')
-startup.add_option ('-g', '--gdb', action = 'store_true',
- default = False, help = 'launch the test in debug mode')
-startup.add_option ('-r', '--revert', action = 'store_false',
- default = True, help = 'revert which STA will do the SC_ADD')
-argv, proto, options = startup.parse ()
-
-from csicore import csiCore, csiSta, csiPacket
-from sta_mgr import Sta_mgr
-from drv import *
-from own_data import Station_own_data
-import unittest
-
-# Set which STA is doing the SC_ADD.
-sc_join_sta1 = options.revert
-
-class TestAuthentication(unittest.TestCase):
- def setUp(self):
- pass
- def tearDown(self):
- pass
- def testAuthentication(self):
- """Check SC stations are authenticated"""
- own = Station_own_data ()
- own.get_data (csi.get_maximus (), csista1.get_sta_cesar())
- self.failUnless(own.authenticated == True)
- own.get_data (csi.get_maximus (), csista2.get_sta_cesar())
- self.failUnless(own.authenticated == True)
-
-# Initialize CSI.
-csi = csiCore(4242);
-
-# Create two AVLN.
-avln1 = csi.avln_add("HomePlug_AVLN1", "AVLN1")
-avln2 = csi.avln_add("HomePlug_AVLN2", "AVLN2")
-
-mac1 = '00:1e:4f:ed:fb:01'
-mac2 = '00:1e:4f:ed:fb:02'
-
-csista1 = avln1.sta_add(mac1, False, False, 'Homeplug_Station1', 'spidcom_spc300_sta1',
- 'station1', 1, options.gdb, 0)
-csista2 = avln2.sta_add(mac2, False, False, 'Homeplug_Station2', 'spidcom_spc300_sta2',
- 'station2', 1, options.gdb, 0)
-
-# Start the simulation.
-csi.process_init (argv, proto)
-# Start the AVLN and STA.
-csi.process_avlns_launch()
-
-driverMME = DriverMME(maximus=csi.get_maximus(), autoload=True)
-
-csi.process_wait_sec(5)
-
-if sc_join_sta1:
- print "STA1: SC_JOIN, STA2: SC_ADD"
- # SC JOIN.
- driverMME.send(csista1.get_sta_cesar(), 'DRV_STA_SC', '\x01')
- # SC ADD.
- driverMME.send(csista2.get_sta_cesar(), 'DRV_STA_SC', '\x00')
-else:
- print "STA1: SC_ADD, STA2: SC_JOIN"
- # SC JOIN.
- driverMME.send(csista2.get_sta_cesar(), 'DRV_STA_SC', '\x01')
- # SC ADD.
- driverMME.send(csista1.get_sta_cesar(), 'DRV_STA_SC', '\x00')
-
-csi.process_wait_association()
-csi.process_wait_authentication()
-
-suite = unittest.TestLoader().loadTestsFromTestCase(TestAuthentication)
-testResult = unittest.TextTestRunner(verbosity=2).run(suite)
-# For nightly build errors
-sys.exit ((1, 0)[testResult.wasSuccessful ()])
diff --git a/cesar/test_general/station/cco0/s2/py/sc08_sc_two_sc_join.py b/cesar/test_general/station/cco0/s2/py/sc08_sc_two_sc_join.py
deleted file mode 100644
index ae5ade496e..0000000000
--- a/cesar/test_general/station/cco0/s2/py/sc08_sc_two_sc_join.py
+++ /dev/null
@@ -1,75 +0,0 @@
-#!/usr/bin/env python
-
-##############################################################################
-# SC procedure : two STA in SC JOIN #
-# ---------------------------------------------------------------------- #
-# Objective: Two STA not connected to any AVLN will try to form an AVLN by #
-# using the SC JOIN procedure. This case will be more likely to #
-# be the one to occur in every day usage. #
-##############################################################################
-
-# Add Maximus and CSI to PATH module lookup.
-import sys
-base_path = sys.path[0] + '/../../../../../'
-sys.path.append (base_path + '/test_general/station/common/py')
-from startup import Startup
-from define import *
-startup = Startup (base_path = base_path,
- executable = sys.path[0] + '/../obj/cco0s2.elf')
-startup.add_option ('-g', '--gdb', action = 'store_true',
- default = False, help = 'launch the test in debug mode')
-argv, proto, options = startup.parse ()
-
-from csicore import csiCore, csiSta, csiPacket
-from sta_mgr import Sta_mgr
-from drv import *
-from own_data import Station_own_data
-import unittest
-
-class TestAuthentication(unittest.TestCase):
- def setUp(self):
- pass
- def tearDown(self):
- pass
- def testAuthentication(self):
- """Check SC stations are authenticated"""
- own = Station_own_data ()
- own.get_data (csi.get_maximus (), csista1.get_sta_cesar())
- self.failUnless(own.authenticated == True)
- own.get_data (csi.get_maximus (), csista2.get_sta_cesar())
- self.failUnless(own.authenticated == True)
-
-# Initialize CSI.
-csi = csiCore(4242);
-
-# Create two AVLN.
-avln1 = csi.avln_add("HomePlug_AVLN1", "AVLN1")
-avln2 = csi.avln_add("HomePlug_AVLN2", "AVLN2")
-
-mac1 = '00:1e:4f:ed:fb:01'
-mac2 = '00:1e:4f:ed:fb:02'
-
-csista1 = avln1.sta_add(mac1, False, False, 'Homeplug_Station1', 'spidcom_spc300_sta1',
- 'station1', 1, options.gdb, 0)
-csista2 = avln2.sta_add(mac2, False, False, 'Homeplug_Station2', 'spidcom_spc300_sta2',
- 'station2', 1, options.gdb, 0)
-
-# Start the simulation.
-csi.process_init (argv, proto)
-# Start the AVLN and STA.
-csi.process_avlns_launch()
-
-driverMME = DriverMME(maximus=csi.get_maximus(), autoload=True)
-
-csi.process_wait_sec(5)
-
-driverMME.send(csista1.get_sta_cesar(), 'DRV_STA_SC', '\x01')
-driverMME.send(csista2.get_sta_cesar(), 'DRV_STA_SC', '\x01')
-
-csi.process_wait_association()
-csi.process_wait_authentication()
-
-suite = unittest.TestLoader().loadTestsFromTestCase(TestAuthentication)
-testResult = unittest.TextTestRunner(verbosity=2).run(suite)
-# For nightly build errors
-sys.exit ((1, 0)[testResult.wasSuccessful ()])
diff --git a/cesar/test_general/station/cco0/s2/py/sc09_Vendor_Specific_mme.py b/cesar/test_general/station/cco0/s2/py/sc09_Vendor_Specific_mme.py
deleted file mode 100644
index 300c43541a..0000000000
--- a/cesar/test_general/station/cco0/s2/py/sc09_Vendor_Specific_mme.py
+++ /dev/null
@@ -1,423 +0,0 @@
-#!/usr/bin/python
-
-##############################################################################
-# VENDOR SPECIFIC MME #
-# ----------------------------------------------------------------------- #
-# #
-# Objective: For each VS mmtype, one station which receives the request #
-# from the linux and answers it. #
-##############################################################################
-
-import unittest
-import sys
-sys.path.append ('../../../../maximus/python/tools/csi/')
-sys.path.append ('../../../../maximus/python/obj/')
-sys.path.append ('../../../../maximus/python/')
-sys.path.append ('../../../../maximus/python/lib/cesar')
-
-from csicore import *
-from csifilter import *
-from maximus.mme import *
-from maximus.mme.mmheader import *
-from maximus.mme.mmentry import *
-from maximus.simu.rx import recv
-from struct import *
-
-csi = csiCore (1234)
-
-# Creating an AVLN.
-avln1 = csi.avln_add ("Homeplug_AVLN1", "AVLN1")
-
-sta1_debug = False
-sta_mac_addr = "10:11:12:13:14:15"
-
-# Adding some station to the AVLN.
-sta=avln1.sta_add (sta_mac_addr, False, False,
- "Homeplug_Station1", "spidcom_spc300_sta1", "station1", 1, sta1_debug)
-
-csi.process_init (sys.argv + ['-e', 'obj/cco0s2.elf'])
-csi.process_avlns_launch ()
-
-#Convert two 8 bits into a single 16 bits int
-def make16from8 (MSB,LSB):
- value = ((MSB << 8) | LSB)
- return value
-
-#Exctract bits from a value with an offset starting at lsb and a mask
-def GetBitsInValue (value,offset,mask):
- nibble = (value >> offset) & mask
- return nibble
-
-class TestVendorSpecificMME(unittest.TestCase):
-
- #Function executed before each test
- def setUp(self):
- pass
- #Function executed after each test
- def tearDown(self):
- pass
-
- def testVSGetTonemap(self):
- #Fill entry field
- mme_entry = [0x00,0x13,0xd7] #SPiDCOM OUI
- mme_entry.extend([0x66,0x55,0x44,0x33,0x22,0x11]) #Station address
- mme_entry.append(0x10) #TMI
- mme_entry.append(0x32) #INT id
- mme_entry.append(0x01) #Direction Rx
-
- #Convert entry data into a single string
- data = ""
- for i in mme_entry:
- data += pack('B', i)
-
- #Build MME frame
- mme = MME(MMHeader=MMHeader(ODA=sta_mac_addr, OSA=sta_mac_addr,
- MTYPE=0x88E1, MMV=1, MMTYPE=0xA034, FMI=0),MMEntry=MMEntry(data))
- #Send MME request to Cesar
- mme.send(csi.get_maximus(), sta.get_sta_cesar())
-
- #Receive CNF in response from Cesar
- rsp = recv(csi.get_maximus(), count=1, filter=frame_filter_msdu_mme,
- timeout = ms_to_tck(100))
-
- self.failUnless (rsp != None)
-
- #Extract string that contain response data
- rsp = rsp[0]
- #Extract entry field from received frame
- entry = rsp.get_mmentry()
-
- #Extract data from entry field
- oui = []
- for i in range(3):
- oui.append(hex(unpack('B',entry[i])[0]))
-
- result = hex(unpack ('B', entry[3])[0])
- Beacon_delta = unpack ('I', entry[4:8])[0]
- int_id = hex(unpack ('B', entry[8])[0])
- tmi_default = hex(unpack ('B', entry[9])[0])
- tmi_length = hex(unpack ('B', entry[10])[0])
-
- idx = 11 #Data index
-
- tmi_li = []
- for i in range(int(tmi_length,16)):
- tmi_li.append(hex(unpack('B',entry[idx])[0]))
- idx+= 1
-
- int_length = hex(unpack('B',entry[idx])[0])
- idx+= 1
-
- current_et = [] #handle the current int_et MSB and LSB
- int_et = []
- int_tmi = []
- for i in range(int(int_length,16)):
- current_et.insert(0,(unpack('B',entry[idx])[0]))
- idx+= 1
- current_et.insert(1,(unpack('B',entry[idx])[0]))
- int_et.append(hex(make16from8(current_et[1],current_et[0])))
- idx+= 1
- int_tmi.append(hex(unpack('B',entry[idx])[0]))
- idx+= 1
-
- tmi = hex(unpack('B',entry[idx])[0])
- idx+= 1
- tm_fec = hex(unpack('B',entry[idx])[0])
- idx+= 1
- tm_gi = hex(unpack('B',entry[idx])[0])
- idx+= 1
-
- #Compare received value to expected value
- self.failUnless (oui[0] == '0x0')
- self.failUnless (oui[1] == '0x13')
- self.failUnless (oui[2] == '0xd7')
-
- self.failUnless (result == '0x0')
- self.failUnless (Beacon_delta == 0x2710)
- self.failUnless (int_id == '0x32')
- self.failUnless (tmi_default == '0x4')
- self.failUnless (tmi_length == '0x4')
-
- self.failUnless (tmi_li[0] == '0x4')
- self.failUnless (tmi_li[1] == '0x5')
- self.failUnless (tmi_li[2] == '0x6')
- self.failUnless (tmi_li[3] == '0x10')
-
- self.failUnless (int_length == '0x2')
-
- for i in range(int(int_length,16)):
- self.failUnless (int_et[i] == hex(i))
- self.failUnless (int_tmi[i] == hex(i))
-
- self.failUnless (tmi == '0x10')
- self.failUnless (tm_fec == '0x1')
- self.failUnless (tm_gi == '0x2')
-
- bitoffs = 0
- for i in range(192):
- for j in range(8):
- mod = GetBitsInValue(unpack('B',entry[idx])[0],bitoffs,0x0F)
- self.failUnless (mod == j)
- bitoffs+= 4
- if bitoffs == 8:
- bitoffs = 0
- idx+= 1
-
- def testVSGetSnr(self):
- #Fill entry field
- mme_entry = [0x00,0x13,0xd7] #SPiDCOM OUI
- mme_entry.extend([0x66,0x55,0x44,0x33,0x22,0x11]) #Station address
- mme_entry.append(0x10) #INT
- mme_entry.append(0x32) #INT id
- mme_entry.append(0x03) #Carrier group
-
- #Convert entry data into a single string
- data = ""
- for i in mme_entry:
- data += pack('B', i)
-
- #Build MME frame
- mme = MME(MMHeader=MMHeader(ODA=sta_mac_addr, OSA=sta_mac_addr,
- MTYPE=0x88E1, MMV=1, MMTYPE=0xA038, FMI=0),MMEntry=MMEntry(data))
- #Send MME request to Cesar
- mme.send(csi.get_maximus(), sta.get_sta_cesar())
-
- #Receive CNF in response from Cesar
- rsp = recv(csi.get_maximus(), count=1, filter=frame_filter_msdu_mme,
- timeout = ms_to_tck(100))
-
- self.failUnless (rsp != None)
-
- #Extract string that contain response data
- rsp = rsp[0]
- #Extract entry field from received frame
- entry = rsp.get_mmentry()
-
- #Extract data from entry field
- oui = []
- for i in range(3):
- oui.append(hex(unpack('B',entry[i])[0]))
-
- result = hex(unpack ('B', entry[3])[0])
- int_id = hex(unpack('B',entry[4])[0])
- int_length = hex(unpack('B',entry[5])[0])
- idx = 6 #Data index
-
- current_intet = []
- int_et = []
- for i in range(int(int_length,16)):
- current_intet.insert(0,(unpack('B',entry[idx])[0]))
- idx+= 1
- current_intet.insert(1,(unpack('B',entry[idx])[0]))
- int_et.append(hex(make16from8(current_intet[1],current_intet[0])))
- idx+= 1
-
- tm_ber_get = []
- tm_ber_get.insert(0,(unpack('B',entry[idx])[0]))
- idx+= 1
- tm_ber_get.insert(1,(unpack('B',entry[idx])[0]))
- tm_ber = hex(make16from8(tm_ber_get[1],tm_ber_get[0]))
- idx+= 1
-
- #Compare received value to expected value
- self.failUnless (oui[0] == '0x0')
- self.failUnless (oui[1] == '0x13')
- self.failUnless (oui[2] == '0xd7')
-
- self.failUnless (result == '0x0')
- self.failUnless (int_id == '0x32')
- self.failUnless (int_length == '0x2')
-
- for i in range(int(int_length,16)):
- self.failUnless(int_et[i] == hex(i))
-
- self.failUnless(tm_ber == '0x4567')
-
- current_snr = []
- for i in range(384):
- current_snr.insert(0,(unpack('B',entry[idx])[0]))
- idx+= 1
- current_snr.insert(1,(unpack('B',entry[idx])[0]))
- idx+= 1
- snr = (make16from8(current_snr[1],current_snr[0]))
- self.failUnless(snr == i)
-
- def testVSGetSpectrum(self):
- #Fill entry field
- mme_entry = [0x00,0x13,0xd7] #SPiDCOM OUI
- mme_entry.extend([0x66,0x55,0x44,0x33,0x22,0x11]) #Station address
- mme_entry.append(0x07) #Carrier group
-
- #Convert entry data into a single string
- data = ""
- for i in mme_entry:
- data += pack('B', i)
-
- #Build MME frame
- mme = MME(MMHeader=MMHeader(ODA=sta_mac_addr, OSA=sta_mac_addr,
- MTYPE=0x88E1, MMV=1, MMTYPE=0xA03C, FMI=0),MMEntry=MMEntry(data))
- #Send MME request to Cesar
- mme.send(csi.get_maximus(), sta.get_sta_cesar())
-
- #Receive CNF in response from Cesar
- rsp = recv(csi.get_maximus(), count=1, filter=frame_filter_msdu_mme,
- timeout = ms_to_tck(100))
-
- self.failUnless (rsp != None)
-
- #Extract string that contain response data
- rsp = rsp[0]
- #Extract entry field from received frame
- entry = rsp.get_mmentry()
-
- #Extract data from entry field
- oui = []
- for i in range(3):
- oui.append(hex(unpack('B',entry[i])[0]))
-
- result = hex(unpack ('B', entry[3])[0])
- avg_agc = hex(unpack('B',entry[4])[0])
-
- idx = 5 #Data index
-
- #Compare received value to expected value
- self.failUnless (oui[0] == '0x0')
- self.failUnless (oui[1] == '0x13')
- self.failUnless (oui[2] == '0xd7')
-
- self.failUnless(result == '0x0')
- self.failUnless(avg_agc == '0x64')
-
- j = 0
- current_im = []
- current_re = []
- for i in range(192):
- j = i + 1
- current_im.insert(0,(unpack('B',entry[idx])[0]))
- idx+= 1
- current_im.insert(1,(unpack('B',entry[idx])[0]))
- idx+= 1
- imaginary = (make16from8(current_im[1],current_im[0]))
- self.failUnless(imaginary == i)
- current_re.insert(0,(unpack('B',entry[idx])[0]))
- idx+= 1
- current_re.insert(1,(unpack('B',entry[idx])[0]))
- idx+= 1
- real = (make16from8(current_re[1],current_re[0]))
- self.failUnless(real == j)
-
- def testVSGetLinkStats(self):
- #Fill entry field
- mme_entry = [0x00,0x13,0xd7] #SPiDCOM OUI
- mme_entry.append(0x02) #ReqType
- mme_entry.append(0x45) #ReqID
- mme_entry.extend([0x99,0x88,0x77,0x66,0x55,0x44,0x00]) #NID
- mme_entry.append(0x64) #LID
- mme_entry.append(0x01) #TLFlag
- mme_entry.append(0x01) #Mgmt_Flag
- mme_entry.extend([0x66,0x55,0x44,0x33,0x22,0x11]) #DA/SA
-
- #Convert entry data into a single string
- data = ""
- for i in mme_entry:
- data += pack('B', i)
-
- #Build MME frame
- mme = MME(MMHeader=MMHeader(ODA=sta_mac_addr, OSA=sta_mac_addr,
- MTYPE=0x88E1, MMV=1, MMTYPE=0xA040, FMI=0),MMEntry=MMEntry(data))
- #Send MME request to Cesar
- mme.send(csi.get_maximus(), sta.get_sta_cesar())
-
- #Receive CNF in response from Cesar
- rsp = recv(csi.get_maximus(), count=1, filter=frame_filter_msdu_mme,
- timeout = ms_to_tck(100))
-
- self.failUnless (rsp != None)
-
- #Extract string that contain response data
- rsp = rsp[0]
- #Extract entry field from received frame
- entry = rsp.get_mmentry()
-
- #Extract data from entry field
- oui = []
- for i in range(3):
- oui.append(hex(unpack('B',entry[i])[0]))
-
- reqid = hex(unpack ('B', entry[3])[0])
- result = hex(unpack ('B', entry[4])[0])
- bad_crc = unpack('I',entry[5:9])[0]
-
- #Compare received value to expected value
- self.failUnless (oui[0] == '0x0')
- self.failUnless (oui[1] == '0x13')
- self.failUnless (oui[2] == '0xd7')
-
- self.failUnless(reqid == '0x45')
- self.failUnless(result == '0x0')
- self.failUnless(bad_crc == 0x34667988)
-
- def testVSGetAmpMap(self):
- #Fill entry field
- mme_entry = [0x00,0x13,0xd7] #SPiDCOM OUI
-
- #Convert entry data into a single string
- data = ""
- for i in mme_entry:
- data += pack('B', i)
-
- #Build MME frame
- mme = MME(MMHeader=MMHeader(ODA=sta_mac_addr, OSA=sta_mac_addr,
- MTYPE=0x88E1, MMV=1, MMTYPE=0xA044, FMI=0),MMEntry=MMEntry(data))
- #Send MME request to Cesar
- mme.send(csi.get_maximus(), sta.get_sta_cesar())
-
- #Receive CNF in response from Cesar
- rsp = recv(csi.get_maximus(), count=1, filter=frame_filter_msdu_mme,
- timeout = ms_to_tck(100))
-
- self.failUnless (rsp != None)
-
- #Extract string that contain response data
- rsp = rsp[0]
- #Extract entry field from received frame
- entry = rsp.get_mmentry()
-
- #Extract data from entry field
- oui = []
- for i in range(3):
- oui.append(hex(unpack('B',entry[i])[0]))
-
- result = hex(unpack ('B', entry[3])[0])
- amlen = hex(unpack('H',entry[4:6])[0])
-
- idx = 6 #Data index
-
- #Compare received value to expected value
- self.failUnless (oui[0] == '0x0')
- self.failUnless (oui[1] == '0x13')
- self.failUnless (oui[2] == '0xd7')
-
- self.failUnless(result == '0x0')
- self.failUnless(amlen == '0x1234')
-
- bitoffs = 0
- for i in range(128):
- for j in range(12):
- am = GetBitsInValue(unpack('B',entry[idx])[0],bitoffs,0x0F)
- self.failUnless (am == j)
- bitoffs+= 4
- if bitoffs == 8:
- bitoffs = 0
- idx+= 1
-
-
-suite = unittest.TestLoader().loadTestsFromTestCase(TestVendorSpecificMME)
-testResult = unittest.TextTestRunner(verbosity=2).run(suite)
-
-csi.process_wait_sec (1)
-csi.process_avlns_stop ()
-csi.process_avlns_remove ()
-
-# For nightly build errors
-sys.exit ((1, 0)[testResult.wasSuccessful ()])
diff --git a/cesar/test_general/station/cco0/s2/py/sc10_short_messages.py b/cesar/test_general/station/cco0/s2/py/sc10_short_messages.py
deleted file mode 100644
index 9a07e8cd97..0000000000
--- a/cesar/test_general/station/cco0/s2/py/sc10_short_messages.py
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/usr/bin/env python
-
-# Create 2 stations and request to send data of 14 bytes.
-import os
-import sys
-sys.path.append ('../../../../maximus/python/tools/csi/')
-sys.path.append ('../../../../maximus/python/obj/')
-sys.path.append ('../../../../maximus/python/')
-sys.path.append ('../../../../maximus/python/lib/cesar')
-
-from csicore import *
-
-csi = csiCore (1234)
-
-# Creating an AVLN.
-avln1 = csi.avln_add ("Homeplug_AVLN1", "AVLN1")
-
-sta1_debug = False
-sta2_debug = False
-
-# Adding some station to the AVLN.
-stas = list ()
-stas.append(avln1.sta_add ("10:11:12:13:14:15", False, False,
- "Homeplug_Station1", "spidcom_spc300_sta1", "station1", 1, sta1_debug))
-stas.append(avln1.sta_add ("20:22:22:23:24:25", False, False,
- "Homeplug_Station2", "spidcom_spc300_sta2", "station2", 1, sta2_debug))
-
-csi.process_init (sys.argv + ['-e', 'obj/cco0s2.elf'])
-csi.process_avlns_launch ()
-csi.process_wait_association (15)
-csi.process_wait_authentication (15)
-csi.authentication_status (avln1)
-
-packet = csiPacket (payload_size = 12,
- avln = avln1,
- sta_src = stas[0],
- sta_dest = stas[1])
-
-csi.process_data_send (packet)
-csi.process_wait_sec (1)
-csi.process_avln_stop (avln1)
-csi.process_avln_remove (avln1)
-
-csi.process_verify_transmission ()
-# For nightly build errors
-result = csi.process_end_get_result ()
-sys.exit ((1, 0)[result])
diff --git a/cesar/test_general/station/cco0/s2/py/sc11_one_sta_stats.py b/cesar/test_general/station/cco0/s2/py/sc11_one_sta_stats.py
deleted file mode 100644
index 9c25a3048b..0000000000
--- a/cesar/test_general/station/cco0/s2/py/sc11_one_sta_stats.py
+++ /dev/null
@@ -1,147 +0,0 @@
-#!/usr/bin/python
-
-##############################################################################
-# VS_GET_STATS #
-# ----------------------------------------------------------------------- #
-# build /home/mercadie/sources/work/cesar/maximus/python/Makefile before #
-# executing this. #
-# Objective: One station which receives stat requests from the linux and #
-# answers it. #
-##############################################################################
-
-import unittest
-import sys
-import re
-import struct
-
-
-sys.path.append ('../../../../maximus/python/tools/csi/')
-sys.path.append ('../../../../maximus/python/obj/')
-sys.path.append ('../../../../maximus/python/')
-sys.path.append ('../../../../maximus/python/lib/cesar')
-
-from maximus.mme.mme import MME
-from maximus.mme.mmheader import MMHeader
-from maximus.mme.mmentry import MMEntry
-from maximus.simu.rx import recv
-from struct import pack, unpack
-from csicore import *
-
-# Csi call
-csi = csiCore (1234)
-
-# Creating an AVLN.
-avln = csi.avln_add ("Homeplug_AVLN", "AVLN")
-
-#Creating a station
-sta_debug = False
-sta = avln.sta_add ("10:11:12:13:14:15", False, False, "Homeplug_Station",
- "spidcom_spc300_sta", "station", 1, sta_debug)
-
-csi.process_init (sys.argv + ['-e', 'obj/cco0s2.elf'])
-csi.process_avlns_launch ()
-
-def data_msdu_filter (msdu):
- if msdu.get_type () is 'ETHERNET_TYPE_MME':
- # The received object is an MSDU
- return True
- else:
- return False
-
-def send_mme_stats_get (self, mac, page_requested):
-
- global nb_stats_in_page
- global page_1_available
-
- #Convert entry data into a single string
- data = ""
- data += pack('B', 0x00)
- data += pack('B', 0x13)
- data += pack('B', 0xD7)
- data += pack('B', page_requested)
- data += pack('B', 0x00)
-
- # Create and send mme message VS_GET_STATS
- mme = MME (MMHeader=MMHeader (mac, "20:21:22:23:24:25", MTYPE = 0x88E1, MMV = 1, MMTYPE = 0xA048, FMI = 0),
- MMEntry=MMEntry (data))
- mme.send (csi.get_maximus(), sta.get_sta_cesar ().get ())
-
- # Wait for response
- rsp = recv (csi.get_maximus (), count = 1, filter = data_msdu_filter, timeout = 5000)
-
- # Fail in case of no response
- self.failUnless (rsp != None)
-
- rsp = rsp[0] # take the first response of the list?
- entry = rsp.get_mmentry()
- head = rsp.get_mmheader()
-
- oda = ':'.join ("%02x" % i for i in unpack ("6B", head[0:6]))
- osa = ':'.join ("%02x" % i for i in unpack ("6B", head[6:12]))
- mtype = unpack ("H", head[12:14])[0] # no VLAN Tag
- mmv = unpack ("B", head[14:15])[0]
- mmtype = unpack ("H", head[15:17])[0]
- fmi = unpack ("H", head[17:19])[0]
-
- # Check that mmtype is correct (expected 0xA049)
- self.failUnless (mmtype == 0xA049)
-
- print "\nmme header(hex): |%s|%s|%04x|%02x|%04x|%04x|" % (oda, osa, mtype, mmv, mmtype, fmi)
-
- oui = unpack ("3B", entry[0:3])[0]
- self.failUnless (oui != 0xd71300)
- result = unpack ('1B', entry[3:4])[0]
- nb_pages_available = unpack ('1B', entry[4:5])[0]
- print "page %d (total %d):%s|" % (page_requested, nb_pages_available, entry[5:])
-
- # There should be always at least one page available
- self.failUnless (nb_pages_available != 0)
-
- # Check that the stat 'nb_stats_pages(u8)' gives the same value than the first octet
- get_stats = re.compile(r":\w*\b")
- all_stats = get_stats.findall(entry)
- nb_stats_in_page = len (all_stats)
-# if page_requested == 0:
-# nb_pages_sent_hex = "0x"+all_stats[0][1:]
-# nb_pages_hex = "0x%02x" % (nb_pages_available)
-# self.failUnless (nb_pages_hex == nb_pages_sent_hex)
-
- # Check that when page 1 is available it's not empty
- if (nb_pages_available == 2) and (page_requested == 1):
- page_1_available = True
- self.failUnless (nb_stats_in_page != 0)
-
-class TestInitFunctions (unittest.TestCase):
- def setUp (self):
- pass
-
- def tearDown (self):
- pass
-
- def testGetStats (self):
-
- global page_1_available
-
- page_1_available = False
-
- sta_mac_addr = "10:11:12:13:14:15"
- nb_page_req = 5
- mac=sta.get_mac_addr()
-
- while nb_page_req:
- send_mme_stats_get (self, mac, 0)
- send_mme_stats_get (self, mac, 1)
- nb_page_req -= 1
-
- # Check that stats filled page 0 and reached page 1
- self.failUnless (page_1_available == True)
-
-suite = unittest.TestLoader ().loadTestsFromTestCase (TestInitFunctions)
-
-testResult = unittest.TextTestRunner (verbosity=7).run (suite)
-
-# Delete the station.
-csi.process_avlns_remove ()
-
-# For nightly build errors
-sys.exit ((1, 0)[testResult.wasSuccessful ()])
diff --git a/cesar/test_general/station/cco0/s2/py/sc12_cm_nw_info.py b/cesar/test_general/station/cco0/s2/py/sc12_cm_nw_info.py
deleted file mode 100644
index 0d8a6a1ad7..0000000000
--- a/cesar/test_general/station/cco0/s2/py/sc12_cm_nw_info.py
+++ /dev/null
@@ -1,167 +0,0 @@
-#!/usr/bin/python
-
-##############################################################################
-# CM_NW_INFO #
-# ----------------------------------------------------------------------- #
-# build /home/mercadie/sources/work/cesar/maximus/python/Makefile before #
-# executing this. #
-# Objective: #
-##############################################################################
-
-import unittest
-import sys
-import re
-import struct
-
-sys.path.append ('../../../../maximus/python/tools/csi/')
-sys.path.append ('../../../../maximus/python/obj/')
-sys.path.append ('../../../../maximus/python/')
-sys.path.append ('../../../../maximus/python/lib/cesar')
-
-from maximus.mme.mme import MME
-from maximus.mme.mmheader import MMHeader
-from maximus.simu.rx import recv
-from struct import pack, unpack
-from csicore import *
-
-# Csi call
-csi = csiCore (1234)
-csi.process_init (sys.argv + ['-e', 'obj/cco0s2.elf'])
-
-# Common def
-def data_msdu_filter (msdu):
- if msdu.get_type () is 'ETHERNET_TYPE_MME':
- # The received object is an MSDU
- return True
- else:
- return False
-
-def send_mme_CM_NW_INFO (self, sta):
- global csi
-
- # Create and send mme message
-
- dst_mac = sta.get_mac_addr()
- src_mac = "10:12:13:14:15:16"
- MMTYPE_CM_NW_INFO = 0x6038
- staRole = [ "STA" , "PCO" , "CCO" ]
-
- mme = MME (MMHeader=MMHeader (dst_mac, src_mac,
- MTYPE = 0x88E1,
- MMV = 1,
- MMTYPE = MMTYPE_CM_NW_INFO,
- FMI = 0),
- MMEntry="")
- mme.send (csi.get_maximus(), sta.get_sta_cesar ().get ())
-
- # Wait for response
- rsp = recv (csi.get_maximus (), count = 1, filter = data_msdu_filter, timeout = 50000000)
-
- # Fail in case of no response
- self.failUnless (rsp != None)
-
- rsp = rsp[0]
- entry = rsp.get_mmentry()
- head = rsp.get_mmheader()
-
- # display header
- oda = ':'.join ("%02x" % i for i in unpack ("6B", head[0:6]))
- osa = ':'.join ("%02x" % i for i in unpack ("6B", head[6:12]))
- mtype = unpack ("H", head[12:14])[0] # no VLAN Tag
- mmv = unpack ("B", head[14:15])[0]
- mmtype = unpack ("H", head[15:17])[0]
- fmi = unpack ("H", head[17:19])[0]
-
- # Check that mmtype is correct (expected 0x6039)
- self.failUnless (mmtype == MMTYPE_CM_NW_INFO + 1)
-
- CCo_MACAddr = ':'.join ("%02x" % i for i in unpack ("6B", entry[11:17]))
- StationRole = staRole[unpack ("B", entry[10:11])[0]]
- NumNws = unpack ("B", entry[0:1])[0]
-
- print "\nmme header(hex): |%s|%s|%04x|%02x|%04x|%04x|" % (oda, osa, mtype, mmv, mmtype, fmi)
- print "\n| NumNws:0x%02x |" % (NumNws),
- if NumNws:
- print "NID:%s |" % (hex(unpack ('Q', entry[1:8] + '\0')[0])),
- print "SNID:0x%02x |" % (unpack ("B", entry[8:9])[0]),
- print "TEI:0x%02x |" % (unpack ("B", entry[9:10])[0]),
- print "StationRole:%s |" % (StationRole),
- print "CCo_MACAddr:%s |" % (CCo_MACAddr),
- print "Access:0x%02x |" % (unpack ("B", entry[17:18])[0])
- else:
- print "\n"
-
- return (CCo_MACAddr, StationRole, NumNws)
-
-
-class TestInitFunctions (unittest.TestCase):
- def setUp (self):
- pass
-
- def tearDown (self):
- pass
-
- def test_CM_CW_INFO (self):
- global csi
-
- cco_mac = "20:22:23:24:25:26"
- sta_mac = "30:32:33:34:35:36"
-
- # Creating an AVLN.
- avln = csi.avln_add ("Homeplug_AVLN", "AVLN")
-
- # adding a station
- target_sta = avln.sta_add (sta_mac, False, False, "authenticated_avln",
- "spidcom_spc300_sta2", "station2", 1, False)
- cco_sta = avln.sta_add (cco_mac, True, True, "authenticated_avln",
- "spidcom_spc300_sta3", "station3", 1, False)
-
- csi.process_avln_launch (avln)
-
- ##############################################################################
- # Test 1 #
- # ----------------------------------------------------------------------- #
- # * Two station recorded but not yet authenticated #
- # Check that there is no network associated yet #
- ##############################################################################
- (mac, role, numNw) = send_mme_CM_NW_INFO (self, target_sta)
-
- # Check that there is no network
- self.failUnless (numNw == 0)
-
- csi.process_wait_association ()
- csi.process_wait_authentication ()
-
- ##############################################################################
- # Test 2 #
- # ----------------------------------------------------------------------- #
- # * Two station recorded #
- # The target station is not the CCo #
- # We check that we receive a correct answer (especially the CCo mac) #
- ##############################################################################
- (mac, role, numNw) = send_mme_CM_NW_INFO (self, target_sta)
- self.failUnless (role == "STA")
- self.failUnless (numNw == 1)
- self.failUnless (mac == cco_mac)
-
- ##############################################################################
- # Test 3 #
- # ----------------------------------------------------------------------- #
- # * Two station recorded #
- # The target station is the CCo #
- # We check that we receive a correct answer (especially the CCo mac) #
- ##############################################################################
- (mac, role, numNw) = send_mme_CM_NW_INFO (self, cco_sta)
- self.failUnless (mac == cco_mac)
- self.failUnless (role == "CCO")
- self.failUnless (numNw == 1)
-
- csi.process_avln_remove (avln)
-
-
-suite = unittest.TestLoader ().loadTestsFromTestCase (TestInitFunctions)
-
-testResult = unittest.TextTestRunner (verbosity=2).run (suite)
-
-# For nightly build errors
-sys.exit ((1, 0)[testResult.wasSuccessful ()])
diff --git a/cesar/test_general/station/cco0/s2/py/sc13_cm_nw_stats.py b/cesar/test_general/station/cco0/s2/py/sc13_cm_nw_stats.py
deleted file mode 100644
index 668d978b7f..0000000000
--- a/cesar/test_general/station/cco0/s2/py/sc13_cm_nw_stats.py
+++ /dev/null
@@ -1,173 +0,0 @@
-#!/usr/bin/python
-
-##############################################################################
-# CM_NW_STATS #
-# ----------------------------------------------------------------------- #
-# re-build /cesar/maximus/python/Makefile before executing this. #
-# Objective: create an avln and check data_rate evolution with cm_nw_stats #
-##############################################################################
-
-import unittest
-import sys
-import re
-import struct
-
-
-sys.path.append ('../../../../maximus/python/tools/csi/')
-sys.path.append ('../../../../maximus/python/obj/')
-sys.path.append ('../../../../maximus/python/')
-sys.path.append ('../../../../maximus/python/lib/cesar')
-
-from maximus.mme.mme import MME
-from maximus.mme.mmheader import MMHeader
-from maximus.mme.mmentry import MMEntry
-from maximus.simu.rx import recv
-from struct import pack, unpack
-from csicore import *
-
-def data_msdu_filter (msdu):
- if msdu.get_type () is 'ETHERNET_TYPE_MME':
- # The received object is an MSDU
- return True
- else:
- return False
-
-def send_mme_cm_nw_stats (self, sta):
-
- dst_mac = sta.get_mac_addr()
-
- # Create and send mme message CM_NW_STATS
- mme = MME (MMHeader=MMHeader (dst_mac, "20:21:22:23:24:25", MTYPE = 0x88E1,
- MMV = 1, MMTYPE = 0x6048, FMI = 0),
- MMEntry="")
- mme.send (csi.get_maximus(), sta.get_sta_cesar ().get ())
-
- # Wait for response
- rsp = recv (csi.get_maximus (), count = 1, filter = data_msdu_filter,
- timeout = 5000)
-
- # Fail in case of no response
- self.failUnless (rsp != None)
-
- rsp = rsp[0] # take the first response of the list
- entry = rsp.get_mmentry()
- head = rsp.get_mmheader()
-
- oda = ':'.join ("%02x" % i for i in unpack ("6B", head[0:6]))
- osa = ':'.join ("%02x" % i for i in unpack ("6B", head[6:12]))
- mtype = unpack ("H", head[12:14])[0] # no VLAN Tag
- mmv = unpack ("B", head[14:15])[0]
- mmtype = unpack ("H", head[15:17])[0]
- fmi = unpack ("H", head[17:19])[0]
-
- # Check that mmtype is correct (expected 0xA049)
- self.failUnless (mmtype == 0x6049)
-
- num_stas = unpack ('1B', entry[0:1])[0]
- print "numStas %d |" % (num_stas),
- if (num_stas):
- mac = ':'.join ("%02x" % i for i in unpack ("6B", entry[1:7]))
- tx = unpack ('1B', entry[7:8])[0]
- rx = unpack ('1B', entry[8:9])[0]
- print "mac %s|tx %d|rx %d|" % (mac, tx, rx)
- else:
- tx = 0
- rx = 0
- tuple = (num_stas, tx, rx)
- return tuple
-
-
-# Csi call
-csi = csiCore (1234)
-
-# Creating an AVLN.
-avln = csi.avln_add ("Homeplug_AVLN", "AVLN")
-
-#Creating 2 stations
-sta_debug = False
-mac_1 = "10:11:11:11:11:11"
-mac_2 = "22:22:22:22:22:22"
-sta_1 = avln.sta_add (mac_1, True, True, "authenticated_avln",
- "spidcom_spc300_sta1", "station1", 1, False)
-sta_2 = avln.sta_add (mac_2, False, False, "authenticated_avln",
- "spidcom_spc300_sta2", "station2", 1, False)
-
-csi.process_init (sys.argv + ['-e', 'obj/cco0s2.elf'])
-csi.process_avlns_launch ()
-csi.process_wait_association ()
-csi.process_wait_authentication ()
-packet_1 = csiPacket (200, avln, sta_1, mac_1, sta_2, mac_2)
-packet_2 = csiPacket (200, avln, sta_2, mac_2, sta_1, mac_1)
-
-class TestInitFunctions (unittest.TestCase):
- def setUp (self):
- pass
-
- def tearDown (self):
- pass
-
- def test_cm_nw_stats (self):
- # Wait for all stas of the net to know other sta is authenticated
- csi.process_data_send(packet_1)
- csi.process_data_send(packet_2)
- num_stas = 0
- while num_stas == 0:
- csi.process_wait_sec(0.002)
- (num_stas, dr_tx1, dr_rx1) = send_mme_cm_nw_stats (self, sta_1)
- while num_stas == 0:
- csi.process_wait_sec(0.002)
- (num_stas, dr_tx2, dr_rx2) = send_mme_cm_nw_stats (self, sta_2)
- csi.authentication_status (avln)
-
- for i in range(1, 1000):
- csi.process_data_send(packet_1)
- csi.process_wait_sec(0.002)
-
- # Check that sta1 is sending and sta2 receiving
- (num_stas, dr_tx1, dr_rx1) = send_mme_cm_nw_stats (self, sta_1)
- (num_stas, dr_tx2, dr_rx2) = send_mme_cm_nw_stats (self, sta_2)
- self.failUnless (dr_tx1 == dr_rx2)
- self.failUnless (dr_tx2 == dr_rx1)
- self.failUnless (dr_tx1 == 1)
- self.failUnless (dr_tx2 == 0)
-
- # Check data rates are null after 1 sec
- csi.process_wait_sec(1)
- (num_stas, dr_tx1, dr_rx1) = send_mme_cm_nw_stats (self, sta_1)
- (num_stas, dr_tx2, dr_rx2) = send_mme_cm_nw_stats (self, sta_2)
- self.failUnless (dr_tx1 == dr_rx2)
- self.failUnless (dr_tx2 == dr_rx1)
- self.failUnless (dr_tx1 == 0)
- self.failUnless (dr_tx2 == 0)
-
- for i in range(1, 1000):
- csi.process_data_send(packet_2)
- csi.process_wait_sec(0.002)
-
- (num_stas, dr_tx1, dr_rx1) = send_mme_cm_nw_stats (self, sta_1)
- (num_stas, dr_tx2, dr_rx2) = send_mme_cm_nw_stats (self, sta_2)
-
- # Check that sta2 is sending and sta1 receiving
- self.failUnless (dr_tx1 == dr_rx2)
- self.failUnless (dr_tx2 == dr_rx1)
- self.failUnless (dr_tx1 == 0)
- self.failUnless (dr_tx2 == 1)
-
- # Check data rates are null after 1 sec
- csi.process_wait_sec(1)
- (num_stas, dr_tx1, dr_rx1) = send_mme_cm_nw_stats (self, sta_1)
- (num_stas, dr_tx2, dr_rx2) = send_mme_cm_nw_stats (self, sta_2)
- self.failUnless (dr_tx1 == dr_rx2)
- self.failUnless (dr_tx2 == dr_rx1)
- self.failUnless (dr_tx1 == 0)
- self.failUnless (dr_tx2 == 0)
-
-suite = unittest.TestLoader ().loadTestsFromTestCase (TestInitFunctions)
-
-testResult = unittest.TextTestRunner (verbosity=7).run (suite)
-
-# Delete the station.
-csi.process_avlns_remove ()
-
-# For nightly build errors
-sys.exit ((1, 0)[testResult.wasSuccessful ()])
diff --git a/cesar/test_general/station/cco0/s2/py/sc14_change_nek.py b/cesar/test_general/station/cco0/s2/py/sc14_change_nek.py
deleted file mode 100644
index 9df5d51540..0000000000
--- a/cesar/test_general/station/cco0/s2/py/sc14_change_nek.py
+++ /dev/null
@@ -1,156 +0,0 @@
-#!/usr/bin/python
-
-# Create an AVLN and cause a hybrid mode change.
-
-import os
-import unittest
-import sys
-sys.path.append ('../../../../maximus/python/tools/csi/')
-sys.path.append ('../../../../maximus/python/obj/')
-sys.path.append ('../../../../maximus/python/')
-sys.path.append ('../../../../maximus/python/lib/cesar')
-
-from csicore import *
-from own_data import Schedules
-
-csi = csiCore (1234)
-
-# Creating an AVLN.
-avln1 = csi.avln_add ("HomePlugAV0123", "AVLN1")
-
-sta1_debug = False
-sta2_debug = False
-
-# Adding the stations.
-stas = list ()
-stas.append (avln1.sta_add ("00:00:00:00:01:01", False, False,
- "HomePlug_AVLN1_Station1", "spc300_sta1", "station1", 1, sta1_debug))
-stas.append (avln1.sta_add ("00:00:00:00:01:02", False, False,
- "HomePlug_AVLN1_Station2", "spc300_sta2", "station2", 1, sta2_debug))
-csi.process_init (sys.argv + ['-e', 'obj/cco0s2.elf'])
-csi.process_avlns_launch ()
-csi.process_wait_association (15)
-csi.process_wait_authentication (15)
-csi.authentication_status (avln1)
-
-class EKS:
- """Define an EKS class."""
- def __init__ (self, eks, nek):
- """Initialise the class with the EKS and the NEK.
- - eks: encryption key select
- - nek: network encryption key.
- """
- self.eks = eks
- self.nek = nek
-
- def is_valid (self):
- """Verify the EKS is valid.
- In AV specification, an EKS valid is a value between 0 and 7
- included. 15 Is the clear value.
- Return true if the NEK is valid.
- """
- return (self.eks >= 0 and self.eks <= 7)
-
-def get_nek (csi, sta):
- """Require the NEK from a station."""
- fcall = csi.get_maximus().create_fcall ("fc_nek_get")
- fcall.set_sta (sta.get_sta_cesar().get())
- fcall.send ()
- # Get the neks.
- e = []
- for i in range (2):
- eks = 0
- nek = ""
- eks = fcall.bind_param_n_u32 ("eks" + str(i))[0]
- for j in range (4):
- nek += "%08x" \
- % (fcall.bind_param_n_u32 ("nek" + str(i) + str (j))[0])
- e.append (EKS (eks, nek))
- return e
-
-def compare_keys (key1, key2):
- """Compare two keys.
- - key1: encryption key select class.
- - key2: encryption key select class.
- return true is equals.
- """
- return key1.eks == key2.eks and key1.nek == key2.nek
-
-class TestNEKChange(unittest.TestCase):
-
- def setUp(self):
- pass
-
- def tearDown(self):
- pass
-
- def testNekChange (self):
- own = Station_own_data ()
- own.get_data (csi.get_maximus (), stas[0].get_sta_cesar())
- if own.is_cco:
- cco = stas[0]
- sta = stas[1]
- else:
- sta = stas[0]
- cco = stas[1]
-
- print "CCo is ", cco.get_mac_addr()
- state = csi.sniffer_activate (cco, False, False, True, False)
- assert state
-
- # Send a FCALL to initiate the NEK change.
- fcall = csi.get_maximus().create_fcall ("fc_cco_change_nek")
- fcall.set_sta (cco.get_sta_cesar().get())
- fcall.send()
- # let time for MME to be exchange.
- csi.process_wait_sec (0.010)
- for i in range (0, 15):
- print "Verify NEK on both CCo and STA"
- cco_keys = get_nek (csi, cco)
- sta_keys = get_nek (csi, sta)
- if not (compare_keys (cco_keys[0], cco_keys[1]) \
- or compare_keys (sta_keys[0], sta_keys[1])) \
- and compare_keys (cco_keys[0], sta_keys[0]) \
- and compare_keys (cco_keys[1], sta_keys[1]):
- break
- # The EKS must be valid.
- print "CCo keys"
- for i in cco_keys:
- self.failUnless (i.is_valid ())
- print "EKS %d NEK %s" % (i.eks, i.nek)
- print "STA keys"
- for i in sta_keys:
- self.failUnless (i.is_valid ())
- print "EKS %d NEK %s" % (i.eks, i.nek)
- # Verify NEK switch.
- while True:
- print "Verifying NEK switch in both CCo and STA"
- cco_schedule = Schedules ()
- cco_schedule.get_schedules (csi.get_maximus (),
- cco.get_sta_cesar ())
- sta_schedule = Schedules ()
- sta_schedule.get_schedules (csi.get_maximus (),
- sta.get_sta_cesar ())
- # It must check that at the same beacon period the values are
- # equals between the CCo and the STA.
- for i in range (len (cco_schedule.bpsd)):
- if cco_schedule.bpsd[i] == sta_schedule.bpsd[i]:
- print "CCo nek index %d STA nek index %d" \
- % (cco_schedule.nek_index[i],
- sta_schedule.nek_index[i])
- self.failUnless (cco_schedule.coexistence_mode[i] ==
- sta_schedule.coexistence_mode[i])
- self.failUnless (cco_schedule.snid[i] ==
- sta_schedule.snid[i])
- self.failUnless (cco_schedule.nek_index[i] ==
- sta_schedule.nek_index[i])
- if cco_keys[1].eks == cco_schedule.nek_index[0]:
- break
- csi.process_wait_sec (0.040)
- csi.process_avlns_remove ()
-
-suite = unittest.TestLoader().loadTestsFromTestCase(TestNEKChange)
-testResult = unittest.TextTestRunner(verbosity=2).run(suite)
-
-# For nightly build errors
-sys.exit ((1, 0)[testResult.wasSuccessful ()])
diff --git a/cesar/test_general/station/cco0/s2/py/sc15_two_avlns.py b/cesar/test_general/station/cco0/s2/py/sc15_two_avlns.py
deleted file mode 100644
index 3de9113639..0000000000
--- a/cesar/test_general/station/cco0/s2/py/sc15_two_avlns.py
+++ /dev/null
@@ -1,89 +0,0 @@
-#!/usr/bin/python
-
-#############################################################################
-# Copyright (C) 2010 Spidcom
-#
-# UCCo behavior. A first station will start alone, and then two stations on
-# another AVLN will start.
-#
-# UCCo of the first AVLN should go to the unassociated STA and should send
-# CM_UNASSOCIATED_STA.IND over the PWL.
-#############################################################################
-
-import os
-import unittest
-import sys
-sys.path.append ('../../../../maximus/python/tools/csi/')
-sys.path.append ('../../../../maximus/python/obj/')
-sys.path.append ('../../../../maximus/python/')
-sys.path.append ('../../../../maximus/python/lib/cesar')
-
-from csicore import *
-
-csi = csiCore (1234)
-MACSDEFAULT = "00:13:d7:00:0%x:%02x"
-# Creating an AVLN.
-avln1 = csi.avln_add ("Homeplug_AVLN1", "AVLN1")
-avln1_sta_nb = 1
-# Adding the stations.
-avln1_stas = list ()
-for i in range (0, avln1_sta_nb):
- avln1_stas.append (avln1.sta_add (MACSDEFAULT % (1, i+1), False, False,
- "HomePlug_AVLN1_Station%d" % (i+1),
- "av1_spc300_sta%d" % (i+1),
- "avln1_station%d" % (i+1), 1, False))
-avln2 = csi.avln_add ("Homeplug_AVLN2", "AVLN2")
-avln2_sta_nb = 2
-# Adding the stations.
-avln2_stas = list ()
-for i in range (0, avln2_sta_nb):
- avln2_stas.append (avln2.sta_add (MACSDEFAULT % (2, i+1), False, False,
- "HomePlug_AVLN2_Station%d" % (i+1),
- "av2_spc300_sta%d" % (i+1),
- "avln2_station%d" % (i+1), 1, False))
-
-class TestTwoAVLNS(unittest.TestCase):
-
- def setUp(self):
- pass
-
- def tearDown(self):
- pass
-
- def testIT (self):
- """Launch the first AVLN and check the lonely STA is CCo.
- The second AVLN starts, the lonely CCo of the test should be present
- in the second AVLN, the lonely station in AVLN1 should be in the
- Unassociated STA status."""
- csi.process_init (sys.argv + ['-e', 'obj/cco0s2.elf'])
- csi.process_avln_launch (avln1)
- csi.sniffer_activate (avln1_stas[0])
- csi.process_wait_sec (5)
- own = Station_own_data ()
- own.get_data (csi.get_maximus (), avln1.get_sta(0).get_sta_cesar())
- # Test the CCo status of this station.
- self.failUnless (own.tei == 1)
- self.failUnless (own.is_cco == True)
- # Launch the second AVLN.
- csi.authentication_status (avln1)
- csi.process_avln_launch (avln2)
- csi.process_wait_sec (10)
- # Test station of the first AVLN to be unassociated.
- own = Station_own_data ()
- own.get_data (csi.get_maximus (), avln1.get_sta(0).get_sta_cesar())
- self.failUnless (own.tei == 0)
- self.failUnless (own.is_cco == False)
- # The second AVLN must have a CCo.
- cco = avln2.get_sta (avln2_sta_nb - 1)
- own = Station_own_data ()
- own.get_data (csi.get_maximus (), cco.get_sta_cesar())
- self.failUnless (own.tei == 1)
- self.failUnless (own.is_cco == True)
-
-suite = unittest.TestLoader().loadTestsFromTestCase(TestTwoAVLNS)
-testResult = unittest.TextTestRunner(verbosity=2).run(suite)
-csi.process_avlns_stop ()
-# For nightly build errors
-sys.exit ((1, 0)[testResult.wasSuccessful ()])
-# Killall stations.
-os.system ('killall cco0s2.elf')
diff --git a/cesar/test_general/station/cco0/s2/py/sc16_igmp.py b/cesar/test_general/station/cco0/s2/py/sc16_igmp.py
deleted file mode 100644
index 6f030535c9..0000000000
--- a/cesar/test_general/station/cco0/s2/py/sc16_igmp.py
+++ /dev/null
@@ -1,210 +0,0 @@
-#!/usr/bin/python
-
-#############################################################################
-# Copyright (C) 2011 Spidcom
-#
-# Test of the multicast behavior
-#############################################################################
-
-import os
-import unittest
-import sys
-
-# Add Maximus and CSI to PATH module lookup.
-sys.path.append ('../../../../maximus/python/tools/csi/')
-sys.path.append ('../../../../maximus/python/obj/')
-sys.path.append ('../../../../maximus/python/')
-sys.path.append ('../../../../maximus/python/lib/cesar')
-
-from csicore import *
-from sta_mgr import Sta_mgr
-from maximus import *
-
-csi = csiCore (1234)
-MAC_TEI_BCAST = 0xff
-
-# Create the AVLN.
-avln_sta_nb = 5
-avln = csi.avln_add ("Homeplug_AVLN", "AVLN")
-avln_stas = list ()
-for i in range (0, avln_sta_nb):
- mac = "00:13:d7:00:01:%02x" % (i)
- avln_stas.append (avln.sta_add (mac, False, False,
- "HomePlug_AVLN_Station%d" % (i), "av_spc300_sta%d" % (i),
- "avln_station%d" % (i), 1, False))
-
-# Launch the AVLN
-csi.process_init (sys.argv + ['-e', 'obj/cco0s2.elf'])
-csi.process_avln_launch (avln)
-csi.process_wait_association (15)
-csi.process_wait_authentication (15)
-
-# Create a sta manager.
-sta_data = Sta_mgr()
-# Get maximus.
-maximus = csi.get_maximus()
-
-# our reference stations will be 00:13:d7:00:01:00 -> ref_sta_cesar
-for i in range (0, avln_sta_nb):
- mac_ref = "00:13:d7:00:01:%02x" % (0)
- if avln.get_sta(i).get_mac_addr() == mac_ref:
- ref_sta_cesar = avln.get_sta(i).get_sta_cesar()
- break
-
-# wait for the mactotei table to be completed
-mac2tei = {}
-print ""
-for i in range (1, avln_sta_nb):
- mac = (0x00, 0x13, 0xd7, 00, 1, i)
- tei = sta_data.get_tei_from_mac(maximus, ref_sta_cesar, mac)
- # check the mactotei is completed before copying it
- while (tei == 0):
- csi.process_wait_sec (1)
- tei = sta_data.get_tei_from_mac(maximus, ref_sta_cesar, mac)
- mac2tei[mac] = tei
-
-def test_mactotei_is_valid(self):
- """ check the mactotei contains the mac and tei of the neighbors"""
- for i in range (1, avln_sta_nb):
- mac = (0x00, 0x13, 0xd7, 00, 1, i)
- tei = sta_data.get_tei_from_mac(maximus, ref_sta_cesar, mac)
- self.failUnless (tei == mac2tei[mac])
-
-def test_mactotei_no_group(self):
- """ check there is no group in the mactotei table """
- for i in range (1, avln_sta_nb):
- mac_group = (0x01, 0x00, 0x5E, i, i, i)
- tei = sta_data.get_tei_from_mac(maximus, ref_sta_cesar, mac_group)
- self.failUnless (tei == 0)
-
-def mme_msdu_filter (msdu):
- if msdu.get_type () is 'ETHERNET_TYPE_MME':
- # The received object is an MSDU
- return True
- else:
- return False
-
-def data_msdu_filter (msdu):
- if msdu.get_type () is 'ETHERNET_TYPE_DATA':
- # The received object is an MSDU
- return True
- else:
- return False
-
-def send_mme_DRV_MCAST_SET_LIST (self, payload):
- """ send DRV_MCAST_SET_REQ to ref_sta_cesar """
- # Create and send mme message
- dst_mac = "00:13:d7:00:01:00"
- src_mac = "10:12:13:14:15:16"
- MMTYPE_DRV_MCAST_SET_LIST = 0xB054
-
- mme = MME (MMHeader=MMHeader (dst_mac, src_mac,
- MTYPE=0x88E1,
- MMV=1,
- MMTYPE=MMTYPE_DRV_MCAST_SET_LIST,
- FMI=0),
- MMEntry=MMEntry(payload))
- mme.send (maximus, ref_sta_cesar)
-
- # Wait for response
- rsp = recv (maximus, count=1, filter=mme_msdu_filter,
- timeout=50000000)
- # Fail in case of no response
- self.failUnless (rsp != None)
- rsp = rsp[0]
- entry = rsp.get_mmentry()
- head = rsp.get_mmheader()
- mmtype = unpack ("H", head[15:17])[0]
-
- # Check that mmtype is correct
- self.failUnless (mmtype == MMTYPE_DRV_MCAST_SET_LIST + 1)
- result = unpack ("B", entry[0:1])[0]
- return (result)
-
-class TestIGMP(unittest.TestCase):
-
- def setUp(self):
- pass
-
- def tearDown(self):
- pass
-
- def testIT (self):
- # test mactotei contains the neighbors
- test_mactotei_is_valid(self)
- # check the mactotei table doesn't contain any group yet
- test_mactotei_no_group(self)
-
- # Send an empty list to the station
- payload = pack ('B', 0)
- (result) = send_mme_DRV_MCAST_SET_LIST (self, payload)
- self.failUnless (result == 0)
-
- # test mactotei contains the neighbors
- test_mactotei_is_valid(self)
- # check the mactotei table doesn't contain any group yet
- test_mactotei_no_group(self)
-
- # send an invalid list to the reference station
- data = [avln_sta_nb - 1]
- for i in range (1, avln_sta_nb):
- mac_group = (0x01, 0x01, 0x5E, i, i, i)
- mac_member = (0x00, 0x13, 0xD7, 0, 1, i)
- data.extend (mac_group)
- data.append (0x01)
- data.extend (mac_member)
- #Convert entry data into a single string
- payload = ""
- for i in data:
- payload += pack('B', i)
-
- (result) = send_mme_DRV_MCAST_SET_LIST (self, payload)
- self.failUnless (result == 1)
-
- # test mactotei contains the neighbors
- test_mactotei_is_valid(self)
- # check the mactotei table doesn't contain any group yet
- test_mactotei_no_group(self)
-
- # send a valid list to the reference station
- data = [avln_sta_nb - 1]
- for i in range (1, avln_sta_nb):
- mac_group = (0x01, 0x00, 0x5E, i, i, i)
- mac_member = (0x00, 0x13, 0xD7, 0x00, 0x01, i)
- data.extend (mac_group)
- data.append (0x01)
- data.extend (mac_member)
- #Convert entry data into a single string
- payload = ""
- for i in data:
- payload += pack('B', i)
-
- (result) = send_mme_DRV_MCAST_SET_LIST (self, payload)
- self.failUnless (result == 0)
-
- # test mactotei contains the neighbors
- test_mactotei_is_valid(self)
- # Check the groups have been added to the mactotei
- for i in range (1, avln_sta_nb):
- mac_group = (0x01, 0x00, 0x5E, i, i , i)
- mac_member = (0x00, 0x13, 0xd7, 0x00, 0x01, i)
- tei = sta_data.get_tei_from_mac(maximus, ref_sta_cesar, mac_group)
- self.failUnless (tei == MAC_TEI_BCAST)
-
- # Send an empty list to remove the multicast entries
- data = pack ('B', 0)
- (result) = send_mme_DRV_MCAST_SET_LIST (self, data)
- self.failUnless (result == 0)
-
- # test mactotei contains the neighbors
- test_mactotei_is_valid(self)
- # check the mactotei table doesn't contain any group again
- test_mactotei_no_group(self)
-
-suite = unittest.TestLoader().loadTestsFromTestCase(TestIGMP)
-testResult = unittest.TextTestRunner(verbosity=2).run(suite)
-csi.process_avlns_stop ()
-# For nightly build errors
-sys.exit ((1, 0)[testResult.wasSuccessful ()])
-# Killall stations.
-os.system ('killall cco0s2.elf')
diff --git a/cesar/test_general/station/cco0/s2/py/sc17_change_nmk.py b/cesar/test_general/station/cco0/s2/py/sc17_change_nmk.py
deleted file mode 100644
index b9550c2571..0000000000
--- a/cesar/test_general/station/cco0/s2/py/sc17_change_nmk.py
+++ /dev/null
@@ -1,160 +0,0 @@
-#!/usr/bin/python
-
-#############################################################################
-# Copyright (C) 2011 Spidcom
-#
-# Change the Network password from the CCo.
-#
-# All the AVLN change the network password and the traffic works.
-#############################################################################
-
-import os
-import unittest
-import sys
-sys.path.append ('../../../../maximus/python/tools/csi/')
-sys.path.append ('../../../../maximus/python/obj/')
-sys.path.append ('../../../../maximus/python/')
-sys.path.append ('../../../../maximus/python/lib/cesar')
-
-from csicore import *
-from own_data import Schedules
-from maximus.mme import *
-from struct import pack, unpack
-from csipacket import csiPacket
-from csifilter import frame_filter_msdu_mme
-
-csi = csiCore (1234)
-
-NPWs = ["HomePlugAV0123", "SPIDCOMTEST012"]
-nb_stas = 3
-
-# Creating an AVLN.
-avln = csi.avln_add (NPWs[0], "AVLN")
-
-# Create the stations.
-stas = []
-for i in range (1, nb_stas + 1):
- stas.append (avln.sta_add ("00:13:d7:00:00:%02x" % i, False, False,
- "HomePlug_AVLN1_Station%d" % i, "spc300_sta%d" % i, "station%d" % i,
- 1, False))
-
-csi.process_init (sys.argv + ['-e', 'obj/cco0s2.elf'])
-csi.process_avlns_launch ()
-csi.process_wait_association (15)
-csi.process_wait_authentication (15)
-csi.authentication_status (avln)
-
-def drv_sta_set_key (sta):
- """Send and receive a DRV_STA_SET_KEY.REQ and analyse the confirmation
- from the station."""
- print "Sending the MME to station with mac address ", sta.get_mac_addr()
- # Prepare the MME to change the key.
- entry = "0000000011111111"
- for i in range (44):
- entry += pack ('<B', 0)
- mmheader = MMHeader(ODA=sta.get_mac_addr (),
- OSA="00:00:00:00:00:00", MMV=0x01,
- MMTYPE = 0xb040)
- mme = MME(MMHeader=mmheader, MMEntry=entry)
- rsp = mme.sendnrecv(maximus=csi.get_maximus(),
- station=sta.get_sta_cesar(), filter=frame_filter_msdu_mme)
- if len (rsp) == 1:
- result = unpack ('B', rsp.pop().get_mmentry()[0])[0]
- return result == 0
- return False
-
-def get_cco (stalist):
- """Get the CCo in the station list."""
- own = Station_own_data ()
- for i in stalist:
- own = Station_own_data ()
- own.get_data (csi.get_maximus (), i.get_sta_cesar())
- if own.is_cco:
- cco = i
- break
- return cco
-
-class TestNPWChange(unittest.TestCase):
-
- def setUp(self):
- pass
-
- def tearDown(self):
- pass
-
- def change_nmk (self, sta):
- """Change the NMK on the CCo."""
- self.failUnless (drv_sta_set_key (sta))
- csi.process_wait_sec (5)
-
- def testCCoChangeNPW (self):
- """Change the network password of the AVLN by the CCo"""
- self.new_avln = list()
- cco = get_cco (stas)
- self.change_nmk (cco)
- # At this moment the CCo is no more a CCo, it is a USTA. The new CCo
- # has taken the CCo role and maintain the AVLN alive.
- packets = []
- for i in stas:
- if i != cco:
- packets.append (csiPacket (1000, avln, cco, sta_dest = i))
- csi.process_data_send_traffic (packets)
- csi.process_wait_sec (1)
- csi.process_verify_transmission ()
- self.failUnless (csi.process_end_get_result () == False)
- # The other two stations should be able to communicate.
- csi.transmission_result_reset ()
- packets = []
- packets.append (csiPacket (1000, avln, stas[0], sta_dest = stas[1]))
- packets.append (csiPacket (1000, avln, stas[1], sta_dest = stas[0]))
- csi.process_data_send_traffic (packets)
- csi.process_wait_sec (1)
- csi.process_verify_transmission ()
- self.failUnless (csi.process_end_get_result ())
- self.new_avln.append (cco)
-
- # Still not ended !!!
- cco = get_cco (stas)
- self.change_nmk (cco)
- self.new_avln.append (cco)
- # Wait 10 seconds to allow the new two stations to form the new AVLN.
- csi.process_wait_sec (10)
- csi.transmission_result_reset ()
- packet = csiPacket (1000, avln, self.new_avln[1],
- sta_dest = self.new_avln[0])
- csi.process_data_send (packet)
- csi.process_wait_sec (1)
- packet = csiPacket (1000, avln, self.new_avln[0],
- sta_dest = self.new_avln[1])
- csi.process_data_send (packet)
- csi.process_wait_sec (1)
- csi.process_verify_transmission ()
- self.failUnless (csi.process_end_get_result ())
-
- # Last step, change the NMK on the last station.
- sta = None
- for i in stas:
- if not self.new_avln.count (i):
- sta = i
- break
- self.change_nmk (sta)
- # Wait 10 seconds to allow the new two stations to form the new AVLN.
- csi.process_wait_association ()
- csi.process_wait_authentication ()
- csi.authentication_status (avln)
- packets = list()
- for i in stas:
- for j in stas:
- if i != j:
- packets.append (csiPacket (1000, avln, i, sta_dest = j))
- csi.process_data_send_traffic (packets)
- csi.process_wait_sec (1)
- csi.process_verify_transmission ()
- self.failUnless (csi.process_end_get_result () == True)
-
-suite = unittest.TestLoader().loadTestsFromTestCase(TestNPWChange)
-testResult = unittest.TextTestRunner(verbosity=2).run(suite)
-# For nightly build errors
-csi.process_avlns_remove ()
-csi.process_uninit ()
-sys.exit ((1, 0)[testResult.wasSuccessful ()])
diff --git a/cesar/test_general/station/cco0/s2/py/sc18_change_nmk_cco_first_and_after_sta.py b/cesar/test_general/station/cco0/s2/py/sc18_change_nmk_cco_first_and_after_sta.py
deleted file mode 100644
index c80485c7bf..0000000000
--- a/cesar/test_general/station/cco0/s2/py/sc18_change_nmk_cco_first_and_after_sta.py
+++ /dev/null
@@ -1,104 +0,0 @@
-#!/usr/bin/python
-
-#############################################################################
-# Copyright (C) 2011 Spidcom
-#
-# Change the Network password from the CCo.
-#############################################################################
-
-import os
-import unittest
-import sys
-sys.path.append ('../../../../maximus/python/tools/csi/')
-sys.path.append ('../../../../maximus/python/obj/')
-sys.path.append ('../../../../maximus/python/')
-sys.path.append ('../../../../maximus/python/lib/cesar')
-
-from csicore import *
-from own_data import Schedules
-from maximus.mme import *
-from struct import pack, unpack
-from csipacket import csiPacket
-from csifilter import frame_filter_msdu_mme
-
-csi = csiCore (1234)
-
-NPWs = ["HomePlugAV0123", "SPIDCOMTEST012"]
-nb_stas = 2
-
-# Creating an AVLN.
-avln = csi.avln_add (NPWs[0], "AVLN")
-
-# Create the stations.
-stas = []
-for i in range (1, nb_stas + 1):
- stas.append (avln.sta_add ("00:13:d7:00:00:%02x" % i, False, False,
- "HomePlug_AVLN1_Station%d" % i, "spc300_sta%d" % i, "station%d" % i,
- 1, False))
-
-csi.process_init (sys.argv + ['-e', 'obj/cco0s2.elf'])
-csi.process_avlns_launch ()
-csi.process_wait_association (15)
-csi.process_wait_authentication (15)
-csi.authentication_status (avln)
-
-def drv_sta_set_key (sta):
- """Send and receive a DRV_STA_SET_KEY.REQ and analyse the confirmation
- from the station."""
- print "Sending the MME to station with mac address ", sta.get_mac_addr()
- # Prepare the MME to change the key.
- entry = "0000000011111111"
- for i in range (44):
- entry += pack ('<B', 0)
- mmheader = MMHeader(ODA=sta.get_mac_addr (),
- OSA="00:00:00:00:00:00", MMV=0x01,
- MMTYPE = 0xb040)
- mme = MME(MMHeader=mmheader, MMEntry=entry)
- rsp = mme.sendnrecv(maximus=csi.get_maximus(),
- station=sta.get_sta_cesar(), filter=frame_filter_msdu_mme)
- if len (rsp) == 1:
- result = unpack ('B', rsp.pop().get_mmentry()[0])[0]
- return result == 0
- return False
-
-def get_cco (stalist):
- """Get the CCo in the station list."""
- own = Station_own_data ()
- for i in stalist:
- own = Station_own_data ()
- own.get_data (csi.get_maximus (), i.get_sta_cesar())
- if own.is_cco:
- cco = i
- break
- return cco
-
-class TestNPWChange(unittest.TestCase):
- """Change the network password on the CCo and after on the STA, the AVLN
- should be reformed."""
-
- def setUp(self):
- pass
-
- def tearDown(self):
- pass
-
- def change_nmk (self, sta):
- """Change the NMK on the CCo."""
- self.failUnless (drv_sta_set_key (sta))
- csi.process_wait_sec (2)
-
- def testCCoChangeNPW (self):
- """Change the network password of the AVLN by the CCo"""
- self.change_nmk (stas[1])
- self.change_nmk (stas[0])
- # Wait 10 seconds to allow the new two stations to form the new AVLN.
- csi.process_wait_association ()
- csi.process_wait_authentication ()
- csi.authentication_status (avln)
-
-suite = unittest.TestLoader().loadTestsFromTestCase(TestNPWChange)
-testResult = unittest.TextTestRunner(verbosity=2).run(suite)
-# For nightly build errors
-csi.process_avlns_remove ()
-csi.process_uninit ()
-sys.exit ((1, 0)[testResult.wasSuccessful ()])
diff --git a/cesar/test_general/station/fcall/src/beacon.c b/cesar/test_general/station/fcall/src/beacon.c
index 71091de3d9..22343c1a72 100644
--- a/cesar/test_general/station/fcall/src/beacon.c
+++ b/cesar/test_general/station/fcall/src/beacon.c
@@ -78,21 +78,19 @@ int
fc_nek_get (fcall_ctx_t *fcall, fcall_param_t **param,
sci_msg_t **msg, void *data)
{
- uint i,j;
- char id[20];
+ mac_nek_t *nek;
cesar_t *cesar = data;
dbg_assert (data);
fcall_param_reset (*param);
- for (i = 0; i < 2; i++)
+ uint nek_index = bsu_nek_index_current (cesar->bsu);
+ nek = &cesar->mac_config.nek[nek_index];
+ fcall_param_add_long (*param, *msg, "eks", &nek->eks);
+ uint i;
+ char id[20];
+ for (i = 0; i < 4; i++)
{
- sprintf (id, "eks%d", i);
- fcall_param_add_long (*param, *msg, id, &cesar->mac_config.nek[i].eks);
- for (j = 0; j < 4; j++)
- {
- sprintf (id, "nek%d%d", i, j);
- fcall_param_add_long (*param, *msg, id,
- &cesar->mac_config.nek[i].nek_enc[j]);
- }
+ sprintf (id, "nek%d", i);
+ fcall_param_add_long (*param, *msg, id, &nek->nek_enc[i]);
}
return true;
}
diff --git a/cesar/test_general/station/scenario/Makefile b/cesar/test_general/station/scenario/Makefile
new file mode 100644
index 0000000000..952e5a3d3e
--- /dev/null
+++ b/cesar/test_general/station/scenario/Makefile
@@ -0,0 +1,25 @@
+BASE = ../../..
+ECOS = y
+
+TARGET_PROGRAMS= test_scenario
+
+test_scenario_SOURCES =
+test_scenario_MODULES = lib mac/common mac cl hle interface cp hal station \
+ host cp/av bsu \
+ test_general/station/fcall \
+ test_general/station/common ce/stub
+
+include $(BASE)/common/make/top.mk
+
+testbook: py/sc01_assoc_auth.py py/sc02_stas_communication.py \
+ py/sc03_two_avln_coexisting.py py/sc04_cc_whoru.py \
+ py/sc05_cc_leave.py py/sc06_discover_procedure.py \
+ py/sc07_bridge.py py/sc08_bentry_change.py \
+ py/sc09_simple_connect.py py/sc10_short_messages.py \
+ py/sc11_cm_nw_info.py py/sc12_change_nmk.py \
+ py/sc13_data_rate.py py/sc14_igmp.py
+ python testbook.py $^ > $@.rst
+
+CLEAN_FILES += testbook.rst
+
+$(call src2obj,src/region_stub.c,target): $(BASE)/cp/fsm/fsm.h
diff --git a/cesar/test_general/station/cco0/s1/ecos.ecc.sh b/cesar/test_general/station/scenario/ecos.ecc.sh
index e0278271fe..e0278271fe 100644
--- a/cesar/test_general/station/cco0/s1/ecos.ecc.sh
+++ b/cesar/test_general/station/scenario/ecos.ecc.sh
diff --git a/cesar/test_general/station/scenario/lib/association_protocol.py b/cesar/test_general/station/scenario/lib/association_protocol.py
new file mode 100644
index 0000000000..fe36635c03
--- /dev/null
+++ b/cesar/test_general/station/scenario/lib/association_protocol.py
@@ -0,0 +1,38 @@
+#!/usr/bin/python
+
+#############################################################################
+# Copyright (C) 2011 Spidcom
+#############################################################################
+
+import scammer
+
+def HPAVAssocAuthProtocol (hpavProtocol, cco_mac, sta_mac, nid, snid,
+ teimapindstation, teimapmode):
+ """Add the MME definitions for a full assoc auth.
+ hpavProtocol: The HPAVProtocol object to fill.
+ cco_mac: The CCo Mac address.
+ sta_mac: The STA Mac address.
+ nid: The NID of the AVLN to be formed.
+ snid: The SNID of the AVLN to be formed.
+ teimapindstation: Array of scammer.CC_SET_TEI_MAP_IND_station filled with
+ the expected values.
+ """
+ station_tei = 0
+ for i in teimapindstation:
+ if i.mac == sta_mac:
+ station_tei = i.tei
+ hpavProtocol.add_mme_tx (cco_mac, sta_mac,
+ scammer.CC_ASSOC_REQ (nid = nid, cco_cap = 0))
+ hpavProtocol.add_mme_rx (sta_mac, cco_mac,
+ scammer.CC_ASSOC_CNF (
+ result = scammer.HPAV_RESULT['success'],
+ nid = nid, snid = snid, stei = station_tei, tei_lease = 15))
+ hpavProtocol.add_mme_tx (cco_mac, sta_mac,
+ scammer.CM_ENCRYPTED_PAYLOAD_IND (
+ peks = 1, pid = 0, pmn = 1))
+ hpavProtocol.add_mme_rx (sta_mac, cco_mac,
+ scammer.CC_SET_TEI_MAP_IND (mode = teimapmode,
+ stations = teimapindstation))
+ hpavProtocol.add_mme_rx (sta_mac, cco_mac,
+ scammer.CM_ENCRYPTED_PAYLOAD_IND (
+ peks = 1, pid = 0, pmn = 0xff))
diff --git a/cesar/test_general/station/scenario/lib/handover_protocol.py b/cesar/test_general/station/scenario/lib/handover_protocol.py
new file mode 100644
index 0000000000..df4795000a
--- /dev/null
+++ b/cesar/test_general/station/scenario/lib/handover_protocol.py
@@ -0,0 +1,26 @@
+#!/usr/bin/python
+
+#############################################################################
+# Copyright (C) 2011 Spidcom
+#############################################################################
+
+import scammer
+
+def HPAVHandoverProtocol (hpavProtocol, new_cco_mac, cco_mac, handover_list,
+ station_list):
+ """Add the MME definitions for a full handover."""
+ hpavProtocol.add_mme_tx (new_cco_mac, cco_mac,
+ scammer.CC_HANDOVER_REQ (soft_hard = 1, reason = 2))
+ hpavProtocol.add_mme_rx ( cco_mac, new_cco_mac,
+ scammer.CC_HANDOVER_CNF (result = 0))
+ # TODO: In the central beacon the CCo must set the HOIP flag.
+ hpavProtocol.add_mme_tx (new_cco_mac, cco_mac,
+ scammer.CC_HANDOVER_INFO_IND (rsc = 0, backupcco = 0,
+ num = len (handover_list), stas = handover_list))
+ hpavProtocol.add_mme_rx (cco_mac, new_cco_mac,
+ scammer.CC_HANDOVER_INFO_RSP ())
+ hpavProtocol.add_mme_tx (new_cco_mac, cco_mac, scammer.CC_LEAVE_REQ (), 2)
+ hpavProtocol.add_mme_rx ("ff:ff:ff:ff:ff:ff", new_cco_mac,
+ scammer.CC_SET_TEI_MAP_IND (mode = 2, num = len (station_list),
+ stations = station_list))
+ hpavProtocol.add_mme_rx (cco_mac, new_cco_mac, scammer.CC_LEAVE_CNF ())
diff --git a/cesar/test_general/station/scenario/py/sc01_assoc_auth.py b/cesar/test_general/station/scenario/py/sc01_assoc_auth.py
new file mode 100644
index 0000000000..ba32efd9a9
--- /dev/null
+++ b/cesar/test_general/station/scenario/py/sc01_assoc_auth.py
@@ -0,0 +1,92 @@
+#!/usr/bin/python
+
+#############################################################################
+# Copyright (C) 2011 Spidcom
+#############################################################################
+
+import sys
+sys.path.append ('py')
+from scenario_init import *
+from association_protocol import HPAVAssocAuthProtocol
+
+class TestAssociationAuthentication (unittest.TestCase):
+ """Test the association and authentication between two stations on the
+ same AVLN.
+ """
+
+ def setUp (self):
+ self.csi = csiCore (1234)
+ self.csi.process_init (args)
+
+ def tearDown (self):
+ self.csi.process_uninit ()
+ del self.csi
+
+ def testAssocAuth (self):
+ """Start two station, activate Cesar sniffer on one of them and check
+ the protocol is correct.
+
+ Message exchange:
+
+ - CM_UNASSOCIATED.IND from STA
+ - CM_UNASSOCIATED.IND from future CCo
+
+ 1. CC_ASSOC.REQ from STA to CCO
+ 2. CC_ASSOC.CNF from CCO to STA
+ 3. CM_ENCRYPTED_PAYLOAD.IND from STA to CCo.
+ 4. CC_SET_TEI_MAP.IND from CCo to STA
+ 5. CM_ENCRYPTED_PAYLOAD.IND from CCo to STA.
+
+ Expected result: At the end of the test, stations are able to exchange
+ DATA.
+ """
+ # Create the AVLN with two stations.
+ npw = str (random.getrandbits(64))
+ ahfid = str (random.getrandbits(32))
+ avln = self.csi.avln_add (npw, ahfid)
+ avln.add_stas (2)
+ # Get a station to activate the sniffer on it.
+ sta = avln.get_sta (0)
+ # Now we can start the avln.
+ self.csi.process_avln_launch (avln)
+ # Activate the sniffer for the station.
+ maximus = self.csi.get_maximus ()
+ status = sniffer (maximus, sta, mme_tx = True, mme_rx = True)
+ self.failUnless (status)
+ rsp = self.csi.sniff_packets (10, 10)
+ status = sniffer (maximus, sta)
+ self.failUnless (status)
+ # Get the CCo.
+ cco = avln.get_cco (maximus)
+ # Normally the station with the highest Mac address is the CCo.
+ # This only occurs when the stations are started at the same time.
+ self.failUnless (sta != cco)
+ sta_mac = sta.get_mac_addr ()
+ cco_mac = cco.get_mac_addr ()
+ MAC_BCAST = "ff:ff:ff:ff:ff:ff"
+ # Get the nid.
+ sta_data = Station_own_data ()
+ data = sta_data.get_data (maximus, sta.get_sta_cesar ())
+ nid = data.nid
+ snid = data.snid
+ # Checking the protocol.
+ protocol = HPAVProtocol ()
+ protocol.add_mme_tx (MAC_BCAST, sta_mac,
+ scammer.CM_UNASSOCIATED_STA_IND (nid = nid, cco_cap = 0), 2)
+ protocol.add_mme_rx (MAC_BCAST, cco_mac,
+ scammer.CM_UNASSOCIATED_STA_IND (nid = nid, cco_cap = 0), 2)
+ HPAVAssocAuthProtocol (protocol, cco_mac, sta_mac, nid, snid,
+ [
+ scammer.CC_SET_TEI_MAP_IND_station (tei = 1, mac = cco_mac,
+ status = 1),
+ scammer.CC_SET_TEI_MAP_IND_station (tei = 2, mac = sta_mac,
+ status = 0),
+ ], 0)
+ ok = protocol.protocol_exchange_check (rsp)
+ self.failUnless (ok)
+
+if __name__ == '__main__':
+ suite = unittest.TestLoader().\
+ loadTestsFromTestCase(TestAssociationAuthentication)
+ testResult = unittest.TextTestRunner(verbosity=2).run(suite)
+ sys.exit ((1, 0)[testResult.wasSuccessful ()])
diff --git a/cesar/test_general/station/scenario/py/sc02_stas_communication.py b/cesar/test_general/station/scenario/py/sc02_stas_communication.py
new file mode 100644
index 0000000000..668b614e87
--- /dev/null
+++ b/cesar/test_general/station/scenario/py/sc02_stas_communication.py
@@ -0,0 +1,52 @@
+#!/usr/bin/python
+
+#############################################################################
+# Copyright (C) 2011 Spidcom
+#############################################################################
+
+import sys
+sys.path.append ('py')
+from scenario_init import *
+
+class TestStationsComm(unittest.TestCase):
+ """Test the communication on an AVLN with or without noise on the
+ channel."""
+
+ def setUp(self):
+ self.csi = csiCore (1234)
+ self.csi.process_init (args)
+
+ def tearDown(self):
+ self.csi.process_uninit ()
+ del self.csi
+
+ def testCommunication5Stas (self):
+ """Communication between 5 stations.
+ Send some data between the stations.
+
+ Expected result: Data should be received from each station.
+ """
+ self.csi.init_test_bed ([5])
+ self.failUnless (send_check_datas (self.csi, self.csi.avln_get (0)))
+ self.csi.uninit_test_bed ()
+
+ def testCommunication2StasWithSNR (self):
+ """Communication between 2 stations with Noise on the channel.
+
+ 1. Add noise between each station (value is set to 1.0 in maximus i.e.
+ 100%).
+
+ 2. Send some data between the stations.
+
+ Expected result: Data should be received from each station.
+ """
+ self.csi.init_test_bed ([2])
+ avln = self.csi.avln_get (self.csi.avln_nb() - 1)
+ avln.add_snr (self.csi.get_maximus (), 1.0)
+ self.failUnless (send_check_datas (self.csi, avln))
+ self.csi.uninit_test_bed ()
+
+if __name__ == '__main__':
+ suite = unittest.TestLoader().loadTestsFromTestCase(TestStationsComm)
+ testResult = unittest.TextTestRunner(verbosity=2).run(suite)
+ sys.exit ((1, 0)[testResult.wasSuccessful ()])
diff --git a/cesar/test_general/station/scenario/py/sc03_two_avln_coexisting.py b/cesar/test_general/station/scenario/py/sc03_two_avln_coexisting.py
new file mode 100644
index 0000000000..488e476760
--- /dev/null
+++ b/cesar/test_general/station/scenario/py/sc03_two_avln_coexisting.py
@@ -0,0 +1,128 @@
+#!/usr/bin/python
+
+#############################################################################
+# Copyright (C) 2011 Spidcom
+#############################################################################
+
+import sys
+sys.path.append ('py')
+from scenario_init import *
+
+class TestTwoAVLNCoexistence(unittest.TestCase):
+ """Test the coexistence of Two AVLN and prove that a station from an AVLN
+ can not communicate with the station of another AVLN."""
+
+ def setUp(self):
+ self.csi = csiCore (1234)
+ self.csi.process_init (args)
+
+ def tearDown(self):
+ self.csi.process_uninit ()
+ del (self.csi)
+
+ def testTwoAVLNsOfOneStation (self):
+ """Create two AVLN with a single station.
+ Expected results: One of the station becomes UCCo and start sending
+ Central beacons. The station on the other AVLN should stay USTA.
+ """
+ self.csi.init_test_bed ([1, 1])
+ usta = None
+ cco = None
+ for i in range (self.csi.avln_nb ()):
+ avln = self.csi.avln_get (i)
+ sta_data = Station_own_data ()
+ data = sta_data.get_data (self.csi.get_maximus (),
+ avln.get_sta (0).get_sta_cesar ())
+ # Too possibilities, the STA is CCo or USTA.
+ if data.is_cco:
+ cco = avln.get_sta (0)
+ self.failUnless (data.tei > 0 and data.tei < 255)
+ cco.tei = data.tei
+ else:
+ usta = avln.get_sta (0)
+ self.failUnless (data.tei == 0)
+ self.failUnless (cco)
+ self.failUnless (usta)
+ # We can verify the USTA sends CM_UNASSOCIATED_STA.IND MME.
+ self.failUnless (
+ sniffer (self.csi.get_maximus (), usta, mme_tx = True))
+ rsp = self.csi.sniff_packets (1, 20);
+ self.failUnless (rsp)
+ self.failUnless (len (rsp) == 1)
+ mme = Ether (rsp[0].get ())
+ mme = scammer.get_sniffed_mme (mme)
+ self.failUnless (mme)
+ self.failUnless (mme.mmtype == \
+ scammer.HPAV_MMTYPES['CM_UNASSOCIATED_STA_IND'])
+ sniffer (self.csi.get_maximus (), usta)
+ # Now we can verify that the CCo sends central beacons.
+ sniffer (self.csi.get_maximus (), cco, beacon_tx = True)
+ cbeacons = self.csi.sniff_packets (1, 12);
+ sniffer (self.csi.get_maximus (), cco)
+ self.failUnless (cbeacons)
+ self.failUnless (len (cbeacons))
+ mme = Ether (cbeacons[0].get ())
+ mme = mme.getlayer (1)
+ # check the sniffed MME contains a beacon.
+ self.failUnless (mme.sniff_type == 1)
+ beacon = mme.getlayer (1)
+ self.failUnless (beacon.stei == cco.tei)
+ # Uninitialise the test bed.
+ self.csi.uninit_test_bed ()
+
+ def testCoexistence (self):
+ """Create two AVLNs with two stations each.
+ Wait for authentication of all stations on each AVLN.
+
+ 1. Check reception of beacons from each CCo on each AVLN.
+ 2. Send DATA on each AVLN (from all the station of an AVLN to the
+ other stations of the same AVLN).
+ 3. Send DATA from each station of the first AVLN to the station of the
+ second AVLN.
+
+ Expected result:
+
+ 1. Two CCo must be present on two different AVLNs.
+ 2. All the data must be received within the AVLN.
+ 3. No DATA should be received from an AVLN to the other.
+ """
+ self.csi.init_test_bed ([2, 2])
+ sta = self.csi.avln_get (0).get_sta (0)
+ sniffer (self.csi.get_maximus (), sta, beacon_tx = True,
+ beacon_rx = True)
+ # We need 4 beacons in 1 seconds, like in a second a CCo emits 25
+ # beacons, we have all the time.
+ rsp = self.csi.sniff_packets (25, 1);
+ sniffer (self.csi.get_maximus (), sta)
+ # Parse the beacons and store the mac address of the CCo if it is not
+ # already present in the mac_addrs list and only if the beacon is a
+ # central beacon.
+ mac_addrs = []
+ for i in rsp:
+ mme = Ether (i.get ())
+ if mme.getlayer(1).sniff_type == 1:
+ beacon = mme.getlayer (2)
+ if beacon.bt == 0:
+ for i in beacon.bentry:
+ if i.header == \
+ scammer.beacon.BENTRY_HDR['MAC_ADDRESS'] \
+ and mac_addrs.count (i.mac) == 0:
+ mac_addrs.append (i.mac)
+ self.failUnless (len (mac_addrs) == 2)
+ avlns = list ()
+ for i in range (self.csi.avln_nb ()):
+ avlns.append (self.csi.avln_get (i))
+ # First step, send and check data emission and reception of DATA from
+ # the station of the of same AVLN.
+ for i in avlns:
+ self.failUnless (send_check_datas (self.csi, i))
+ # Second step, prepare packet to be emitted from the station of the
+ # first AVLN to the station of the second AVLN.
+ self.failUnless (send_data_from_stasAvln1_to_stasAVLN2 (self.csi,
+ avlns[0], avlns[1]))
+ self.csi.uninit_test_bed ()
+
+if __name__ == '__main__':
+ suite = unittest.TestLoader().loadTestsFromTestCase(TestTwoAVLNCoexistence)
+ testResult = unittest.TextTestRunner(verbosity=2).run(suite)
+ sys.exit ((1, 0)[testResult.wasSuccessful ()])
diff --git a/cesar/test_general/station/scenario/py/sc04_cc_whoru.py b/cesar/test_general/station/scenario/py/sc04_cc_whoru.py
new file mode 100644
index 0000000000..a1144944de
--- /dev/null
+++ b/cesar/test_general/station/scenario/py/sc04_cc_whoru.py
@@ -0,0 +1,83 @@
+#!/usr/bin/python
+
+#############################################################################
+# Copyright (C) 2011 Spidcom
+#############################################################################
+
+import sys
+sys.path.append ('py')
+from scenario_init import *
+
+class TestWhoAreYou (unittest.TestCase):
+ """Send a CC_WHO_RU.REQ to each station of the station."""
+
+ def setUp (self):
+ self.csi = csiCore (1234)
+ self.csi.process_init (args)
+ self.csi.init_test_bed ([2])
+ self.computer_mac = "10:10:10:10:10:10"
+ self.get_cco_and_sta ()
+
+ def tearDown (self):
+ self.csi.uninit_test_bed ()
+ self.csi.process_uninit ()
+ del (self.csi)
+
+ def get_cco_and_sta (self):
+ """Parse the AVLN and store in self, the cco and the sta reference.
+ """
+ maximus = self.csi.get_maximus ()
+ avln = self.csi.avln_get (0)
+ sta_data = Station_own_data ()
+ for i in range (avln.get_nb_sta ()):
+ station = avln.get_sta (i)
+ data = sta_data.get_data (maximus, station.get_sta_cesar ())
+ self.avln_nid = data.nid
+ # Too possibilities, the station is CCo or STA.
+ if data.is_cco:
+ cco = station
+ else:
+ sta = station
+ self.failUnless (data.tei > 0 and data.tei < 255)
+ self.failUnless (sta)
+ self.failUnless (cco)
+ self.sta = sta
+ self.cco = cco
+ # Convert the nid from string to int.
+
+ def send_cc_who_ru_req_and_read_cnf (self, sta):
+ """Send a CC_WHO_RU.REQ MME to the sta and read the confirmation."""
+ req = Ether (dst = sta.get_mac_addr (), src = self.computer_mac) \
+ / scammer.MME (mmtype = scammer.HPAV_MMTYPES ['CC_WHO_RU_REQ']) \
+ / scammer.CC_WHO_RU_REQ (nid = int (self.avln_nid))
+ send_mme (self.csi.get_maximus(), sta, req)
+ rsp = recv (self.csi.get_maximus(), timeout = 10,
+ filter = frame_filter_msdu_mme, count = 3)
+ if sta is self.cco:
+ self.failUnless (rsp)
+ cnf = Ether (rsp[0].get ())
+ self.failUnless (cnf.src == sta.get_mac_addr ())
+ self.failUnless (cnf.mac == self.cco.get_mac_addr ())
+ self.failUnless (cnf.nid == req.nid)
+ else:
+ self.failUnless (not rsp)
+
+ def testFromComputer (self):
+ """Sends a CC_WHO_RU.REQ from a computer. Wait for the answer
+ CC_WHO_RU.CNF from the station.
+
+ 1. Start an AVLN with 2 stations.
+ 2. Send a CC_WHO_RU.REQ MME to the CCo.
+ 3. Check the CCo answered to it.
+ 4. Send a CC_WHO_RU.REQ MME to the STA.
+ 5. The STA should not answer.
+
+ Excepted results: Only the CCo should answer.
+ """
+ self.send_cc_who_ru_req_and_read_cnf (self.cco)
+ self.send_cc_who_ru_req_and_read_cnf (self.sta)
+
+if __name__ == '__main__':
+ suite = unittest.TestLoader().loadTestsFromTestCase(TestWhoAreYou)
+ testResult = unittest.TextTestRunner(verbosity=2).run(suite)
+ sys.exit ((1, 0)[testResult.wasSuccessful ()])
diff --git a/cesar/test_general/station/scenario/py/sc05_cc_leave.py b/cesar/test_general/station/scenario/py/sc05_cc_leave.py
new file mode 100644
index 0000000000..f47d2bcfa3
--- /dev/null
+++ b/cesar/test_general/station/scenario/py/sc05_cc_leave.py
@@ -0,0 +1,133 @@
+#!/usr/bin/python
+
+#############################################################################
+# Copyright (C) 2011 Spidcom
+#############################################################################
+
+import sys
+sys.path.append ('py')
+from scenario_init import *
+from handover_protocol import HPAVHandoverProtocol
+
+class TestLeave (unittest.TestCase):
+ """Send a CC_LEAVE.REQ to a station."""
+
+ def setUp (self):
+ self.csi = csiCore (1234)
+ self.csi.process_init (args)
+ self.csi.init_test_bed ([2])
+ self.computer_mac = "10:10:10:10:10:10"
+
+ def tearDown (self):
+ self.csi.uninit_test_bed ()
+ self.csi.process_uninit ()
+ del (self.csi)
+
+ def testStaLeave (self):
+ """Take all the station of the AVLN and send a DRV_STA_MAC_STOP.REQ
+ MME to it.
+
+ 1. Send a DRV_STA_MAC_STOP to the station.
+ 2. The station should send a CC_LEAVE.REQ to the CCo.
+ 3. The CCo should confirm the leave req with a CC_LEAVE.CNF
+ 4. The station should send a DRV_STA_MAC_STOP.CNF to linux.
+ 5. The station should leave the AVLN.
+
+ Excepted results: The station has left the AVLN.
+ """
+ avln = self.csi.avln_get (0)
+ cco = avln.get_cco (self.csi.get_maximus ())
+ cco_mac = cco.get_mac_addr ()
+ drv_sta_mac_stop_req = Ether (src = self.computer_mac) \
+ / scammer.MME () \
+ / scammer.DRV_STA_MAC_STOP_REQ ()
+ for i in range (avln.get_nb_sta ()):
+ # Modify the destination mac address of the MME.
+ sta = avln.get_sta (i)
+ if cco is not sta:
+ sta_mac = sta.get_mac_addr ()
+ # We will need to activate the sniffer here to get the
+ # CC_LEAVE MME exchange between the CCo and the authenticated
+ # STA.
+ state = sniffer (self.csi.get_maximus (), sta, mme_tx = True,
+ mme_rx = True)
+ self.failUnless (state)
+ drv_sta_mac_stop_req.dst = sta.get_mac_addr ()
+ send_mme (self.csi.get_maximus (), sta, drv_sta_mac_stop_req)
+ rsp = self.csi.sniff_packets (10, 10);
+ sniffer (self.csi.get_maximus (), sta)
+ self.failUnless (rsp)
+ # Verify expected protocol exchanges
+ protocol = HPAVProtocol ()
+ protocol.add_mme_rx (sta_mac, self.computer_mac,
+ scammer.DRV_STA_MAC_STOP_REQ ())
+ protocol.add_mme_tx (cco_mac, sta_mac,
+ scammer.CC_LEAVE_REQ ())
+ protocol.add_mme_rx (sta_mac, cco_mac,
+ scammer.CC_LEAVE_CNF ())
+ protocol.add_mme_tx (self.computer_mac, sta_mac,
+ scammer.DRV_STA_MAC_STOP_CNF (result = 0))
+ ok = protocol.protocol_exchange_check (rsp)
+ self.failUnless (ok)
+
+ def testCCoLeave (self):
+ """Take the CCo of the AVLN and send a DRV_STA_MAC_STOP.REQ MME to it.
+
+ 1. Send a DRV_STA_MAC_STOP to the CCo.
+ 2. The CCo should send a CC_HEADOVER.REQ to the station.
+ 3. The station should confirm the request with a CC_HANDOVER.CNF
+ 4. The CCo set the HOIP flag in the central beacon.
+ 5. The CCo should send a CC_HANDOVER_INFO.IND to the station.
+ 6. The station should confirm with a CC_HANDOVER_INFO.RSP to the CCo.
+ 7. The CCo set the handover in progress bentry in the central beacon.
+ 8. At the end of the countdown the new CCo start sending central
+ beacons.
+ 9. The old CCo sends a CC_LEAVE.REQ MME to the new CCo.
+ 10. The New CCo confirms the request and send a CC_LEAVE.CNF to the
+ old CCo.
+ 11. The old CCo sends a DRV_STA_MAC_STOP.CNF to cleopatre.
+
+ Excepted results: The CCo has left the AVLN and new one has taken the
+ CCo role in the AVLN.
+ """
+ avln = self.csi.avln_get (0)
+ cco = avln.get_cco (self.csi.get_maximus ())
+ # get the station.
+ for i in range (avln.get_nb_sta()):
+ if avln.get_sta (i) != cco:
+ sta = avln.get_sta(i)
+ break
+ state = sniffer (self.csi.get_maximus (), cco, True, True, True, True)
+ self.failUnless (state)
+ drv_sta_mac_stop_req = \
+ Ether (dst = cco.get_mac_addr (), src = self.computer_mac) \
+ / scammer.MME () \
+ / scammer.DRV_STA_MAC_STOP_REQ ()
+ send_mme (self.csi.get_maximus(), cco, drv_sta_mac_stop_req)
+ self.csi.process_wait_sec (10)
+ sniffer (self.csi.get_maximus (), sta)
+ # We need to verify the exchange order.
+ sta_mac = sta.get_mac_addr ()
+ cco_mac = cco.get_mac_addr ()
+ protocol = HPAVProtocol ()
+ protocol.add_mme_rx (cco_mac, self.computer_mac,
+ scammer.DRV_STA_MAC_STOP_REQ ())
+ handover_station_list = [
+ scammer.CC_HANDOVER_INFO_IND_sta_info (tei = 1,
+ mac = cco_mac, status = 1),
+ ]
+ station_list = [
+ scammer.CC_SET_TEI_MAP_IND_station (tei = 1, mac = cco_mac,
+ status = 1)]
+ HPAVHandoverProtocol (protocol, sta_mac, cco_mac,
+ handover_station_list, station_list)
+ protocol.add_mme_tx (self.computer_mac, cco_mac,
+ scammer.DRV_STA_MAC_STOP_CNF (result = 0))
+ ok = protocol.protocol_exchange_check (self.csi.sniffed_packets)
+ self.failUnless (ok)
+ del self.csi.sniffed_packets
+
+if __name__ == '__main__':
+ suite = unittest.TestLoader().loadTestsFromTestCase(TestLeave)
+ testResult = unittest.TextTestRunner(verbosity=2).run(suite)
+ sys.exit ((1, 0)[testResult.wasSuccessful ()])
diff --git a/cesar/test_general/station/scenario/py/sc06_discover_procedure.py b/cesar/test_general/station/scenario/py/sc06_discover_procedure.py
new file mode 100644
index 0000000000..c294599039
--- /dev/null
+++ b/cesar/test_general/station/scenario/py/sc06_discover_procedure.py
@@ -0,0 +1,61 @@
+#!/usr/bin/python
+
+#############################################################################
+# Copyright (C) 2011 Spidcom
+#############################################################################
+
+import sys
+sys.path.append ('py')
+from scenario_init import *
+
+class TestDiscoverProcedure (unittest.TestCase):
+ """In HomePlug AV the CCo must require a discover beacon from each station
+ in a cycle of 10 seconds.
+ """
+
+ def setUp (self):
+ self.csi = csiCore (1234)
+ self.csi.process_init (args)
+ self.csi.init_test_bed ([2])
+ self.computer_mac = "10:10:10:10:10:10"
+
+ def tearDown (self):
+ self.csi.uninit_test_bed ()
+ self.csi.process_uninit ()
+ del self.csi
+
+ def testDiscoverProcedure (self):
+ """Create an AVLN of 2 stations. Wait for authentication and then
+ activate the sniffer on one of the stations.
+ Sniff only beacons TX/RX.
+
+ Excepted results: After a central beacon with a discover beacon entry,
+ a discover beacon from the requested station must be present.
+ """
+ avln = self.csi.avln_get (0)
+ cco = avln.get_cco (self.csi.get_maximus ())
+ sniff_state = sniffer (self.csi.get_maximus (), cco,
+ beacon_tx = True, beacon_rx = True)
+ self.failUnless (sniff_state)
+ timeout = 12
+ # On AV for a powerline in 50Hz we have 25 beacon / second.
+ rsp = self.csi.sniff_packets (25 * timeout, timeout);
+ # Now for each beacon with a discover beacon entry must be followed
+ # by a discover beacon of the station requested.
+ stei = None
+ for i in rsp:
+ m = Ether (i.get ())
+ # Central beacon.
+ if m.bt == 0:
+ for i in m.bentry:
+ if i.header == scammer.BENTRY_HDR['DISCOVER']:
+ stei = i.tei
+ elif m.bt == 1:
+ self.failUnless (m.stei == stei)
+ sniff_state = sniffer (self.csi.get_maximus (), cco)
+ self.failUnless (sniff_state)
+
+if __name__ == '__main__':
+ suite = unittest.TestLoader().loadTestsFromTestCase(TestDiscoverProcedure)
+ testResult = unittest.TextTestRunner(verbosity=2).run(suite)
+ sys.exit ((1, 0)[testResult.wasSuccessful ()])
diff --git a/cesar/test_general/station/scenario/py/sc07_bridge.py b/cesar/test_general/station/scenario/py/sc07_bridge.py
new file mode 100644
index 0000000000..95ae3c6085
--- /dev/null
+++ b/cesar/test_general/station/scenario/py/sc07_bridge.py
@@ -0,0 +1,109 @@
+#!/usr/bin/env python
+
+##############################################################################
+# Copyright (C) 2011 Spidcom
+##############################################################################
+
+import sys
+sys.path.append ('py')
+from scenario_init import *
+
+class TestBridge (unittest.TestCase):
+ """Two or more stations authenticated on the same AVLN are exchanging data
+ with bridged entities MMEs.
+ """
+
+ def setUp (self):
+ self.csi = csiCore (1234)
+ self.csi.process_init (args)
+ self.csi.init_test_bed ([2])
+ self.computer_mac = "10:10:10:10:10:10"
+
+ def tearDown (self):
+ self.csi.uninit_test_bed ()
+ self.csi.process_uninit ()
+ del self.csi
+
+
+ def mac2tei_verification (self, avln, sta, sta_remote):
+ """Verify that the sta_remote station is present in the mac2tei table
+ of sta."""
+ mac2tei = Ether (dst = sta_remote.get_mac_addr (), src = MAC_DEFAULT)\
+ / scammer.MME () / scammer.VS_GET_MACTOTEI_REQ ()
+ rsp = sendnrecv_mme (self.csi.get_maximus (), sta, mac2tei)
+ self.failUnless (rsp)
+ # Dissect the confirmation.
+ mac2teicnf = Ether (rsp[0].get ())
+ # Mac a simple table of all mac address present in the sta remote.
+ sta_remote_macs = []
+ for i in range (sta_remote.bridge_mac_addr_nb ()):
+ sta_remote_macs.append (sta_remote.bridge_mac_addr_get (i))
+ sta_remote_macs.append (sta_remote.get_mac_addr ())
+ # Check it.
+ for i in mac2teicnf.entries:
+ self.failUnless (i.mac in sta_remote_macs)
+
+ def testBridge (self):
+ """Create an AVLN with two stations. Exchange Bridge ethernet packets
+ from one station to another one.
+
+ Excepted result: The CM_BRIDGE_INFO.IND is sent and the bridged MAC
+ addresses are present in the mac2tei table.
+ """
+ # Get the AVLN.
+ avln = self.csi.avln_get (0)
+ sta1 = avln.get_sta (0)
+ sta2 = avln.get_sta (1)
+ # List of bridged addresses.
+ sta1_macs = [sta1.get_mac_addr ()]
+ sta2_macs = [sta2.get_mac_addr ()]
+ packets = []
+ for i in range (2):
+ sta1b = '00:10:00:00:00:%02x' % (i + 1)
+ sta2b = '00:20:00:00:00:%02x' % (i + 1)
+ sta1_macs.append (sta1b)
+ sta2_macs.append (sta2b)
+ sta1.bridge_mac_addr_add (sta1b)
+ sta2.bridge_mac_addr_add (sta2b)
+ packets.append (csiPacket (payload_size = 1400, avln = avln,
+ sta_src = sta1, mac_addr_src = sta1b, sta_dest = sta2))
+ packets.append (csiPacket (payload_size = 1400, avln = avln,
+ sta_src = sta2, mac_addr_src = sta2b, sta_dest = sta1))
+ while (len (packets)):
+ # Activate the sniffer on one station to catch the MME exchange.
+ ss = sniffer (self.csi.get_maximus (), sta1, mme_tx = True,
+ mme_rx = True)
+ self.failUnless (ss)
+ # Prepare packets to be sent by each station in the AVLN using the
+ # first MAC address bridge of each one.
+ p = packets[:2]
+ packets = packets[2:]
+ self.csi.process_data_send_traffic (p)
+ # Sniff the MME exchanges
+ rsp = self.csi.sniff_packets (2, 10);
+ for i in rsp:
+ m = scammer.get_sniffed_mme (Ether (i.get ()))
+ self.failUnless (m.mmtype == \
+ scammer.HPAV_MMTYPES['CM_BRG_INFO_CNF'])
+ # MME should only have a bridged Mac address to provide.
+ self.failUnless (m.nbda)
+ # Verify it is the right mac address provided.
+ for j in m.bdas:
+ if m.src == sta1.get_mac_addr ():
+ self.failUnless (j.mac in sta1_macs)
+ elif m.src == sta2.get_mac_addr ():
+ self.failUnless (j.mac in sta2_macs)
+ # Check the traffic.
+ sniffer (self.csi.get_maximus (), sta1)
+ self.csi.process_verify_transmission ()
+ result = self.csi.process_end_get_result ()
+ self.csi.transmission_result_reset ()
+ self.failUnless (result)
+ # Now we can verify the mac2tei table of each station.
+ self.mac2tei_verification (avln, sta1, sta2)
+ self.mac2tei_verification (avln, sta2, sta1)
+
+if __name__ == '__main__':
+ suite = unittest.TestLoader().loadTestsFromTestCase(TestBridge)
+ testResult = unittest.TextTestRunner(verbosity=2).run(suite)
+ sys.exit ((1, 0)[testResult.wasSuccessful ()])
diff --git a/cesar/test_general/station/scenario/py/sc08_bentry_change.py b/cesar/test_general/station/scenario/py/sc08_bentry_change.py
new file mode 100644
index 0000000000..c32acc3d78
--- /dev/null
+++ b/cesar/test_general/station/scenario/py/sc08_bentry_change.py
@@ -0,0 +1,291 @@
+#!/usr/bin/python
+
+#############################################################################
+# Copyright (C) 2011 Spidcom
+#############################################################################
+
+import sys
+sys.path.append ('py')
+from scenario_init import *
+from scammer.beacon import BEntryChangeHm, BEntryChangeSnid
+from scammer.beacon import BEntryEncryptionKeyChange
+
+class EKS:
+ """Define an EKS class."""
+ def __init__ (self, eks, nek):
+ """Initialise the class with the EKS and the NEK.
+ - eks: encryption key select
+ - nek: network encryption key.
+ """
+ self.eks = eks
+ self.nek = nek
+
+ def is_valid (self):
+ """Verify the EKS is valid.
+ In AV specification, an EKS valid is a value between 0 and 7
+ included. 15 Is the clear value.
+ Return true if the NEK is valid.
+ """
+ return (self.eks >= 0 and self.eks <= 7)
+
+def get_nek (csi, sta):
+ """Require the NEK from a station."""
+ fcall = csi.get_maximus().create_fcall ("fc_nek_get")
+ fcall.set_sta (sta.get_sta_cesar().get())
+ fcall.send ()
+ nek = ""
+ eks = fcall.bind_param_n_u32 ("eks")[0]
+ for j in range (4):
+ nek += "%08x" \
+ % (fcall.bind_param_n_u32 ("nek" + str (j))[0])
+ return EKS (eks, nek)
+
+class TestBentryChange (unittest.TestCase):
+ """Test beacon entry which have a coutdown.
+ """
+
+ def setUp (self):
+ self.computer_mac = "10:10:10:10:10:10"
+
+ def tearDown (self):
+ pass
+
+ def init (self, avln_sta_nb_array):
+ """Initialise the avlns."""
+ self.csi = csiCore (1234)
+ self.csi.process_init (args)
+ self.csi.init_test_bed (avln_sta_nb_array)
+
+ def uninit (self):
+ """Uninitialise."""
+ self.csi.uninit_test_bed ()
+ self.csi.process_uninit ()
+
+ def bentry_check (self, beacon, bentry):
+ """Test the bentry with the beacon.
+ beacon: the beacon to check inside.
+ bentry: the values expected in the beacon entry.
+ """
+ for i in beacon.bentry:
+ if i.header == bentry.header:
+ if i != bentry:
+ print "Expected"
+ bentry.show ()
+ print "Got "
+ i.show ()
+ self.failUnless (i == bentry)
+ if i.header == scammer.BENTRY_HDR['CHANGE_SNID']:
+ bentry.sccd -= 1
+ elif i.header == scammer.BENTRY_HDR['CHANGE_HM']:
+ bentry.hmccd -= 1
+ elif i.header == scammer.BENTRY_HDR['ENCRYPTION_KEY_CHANGE']:
+ bentry.kccd -= 1
+
+ def testSnid (self):
+ """Test the snid change done by the CCo on the AVLN using the beacon
+ entry for this effect.
+
+ Excepted results: The snid should be change on all stations.
+ """
+ self.init ([2])
+ maximus = self.csi.get_maximus ()
+ avln = self.csi.avln_get (0)
+ cco = avln.get_cco (maximus)
+ # Require the current snid from the CCO using a fcall to get it from
+ # cp_sta_own_data_t firmware structure.
+ own = Station_own_data ()
+ own.get_data (maximus, cco.get_sta_cesar())
+ snid = own.snid
+ del own
+ # We need to activate the sniffer for TX beacons.
+ status = sniffer (maximus, cco, beacon_tx = True)
+ self.failUnless (status)
+ # We will change the snid using a fcall message.
+ fcall = maximus.create_fcall ("fc_cco_change_snid")
+ fcall.set_sta (cco.get_sta_cesar().get())
+ new_snid = (snid + 1) % 0x10
+ fcall.add_param_ushort ('snid', new_snid)
+ fcall.send()
+ # Get all Beacon emitted by the CCo.
+ beacons = self.csi.sniff_packets (25)
+ self.failUnless (beacons)
+ # Check the presence of the beacon entry change snid.
+ bentry = BEntryChangeSnid (
+ header = scammer.BENTRY_HDR['CHANGE_SNID'],
+ length = 1, sccd = 4, newsnid = new_snid)
+ for i in beacons:
+ vs_sniffer_ind = Ether (i.get ())
+ beacon = scammer.get_sniffed_mme (vs_sniffer_ind)
+ self.bentry_check (beacon, bentry)
+ self.failUnless (bentry.sccd == 0)
+ # We can stop the sniffer now.
+ status = sniffer (maximus, cco)
+ self.failUnless (status)
+ # We need to verify the snid on all stations of the AVLN.
+ own = Station_own_data ()
+ for i in range (avln.get_nb_sta ()):
+ sta = avln.get_sta (i)
+ own.get_data (maximus, sta.get_sta_cesar())
+ self.failUnless (new_snid == own.snid)
+ # Test is ended.
+ self.uninit ()
+
+ def testSnidConflict (self):
+ """Test the snid conflict between two AVLNs.
+
+ For this we need to change the SNID on one of the AVLNs to set the
+ same as the other AVLN. This is done by a fcall.
+
+ Expected results: The two AVLN have changed their SNID.
+ """
+ self.init ([2, 2])
+ maximus = self.csi.get_maximus ()
+ avlns = [self.csi.avln_get (0), self.csi.avln_get (1)]
+ ccos = [avlns[0].get_cco (maximus), avlns[1].get_cco (maximus)]
+ # Require the current snid from the CCO using a fcall to get it from
+ # cp_sta_own_data_t firmware structure.
+ snids = []
+ own = Station_own_data ()
+ for i in ccos:
+ own.get_data (maximus, i.get_sta_cesar())
+ snids.append (own.snid)
+ del own
+ # Change the SNID on AVLN 1.
+ fcall = maximus.create_fcall ("fc_cco_change_snid")
+ fcall.set_sta (ccos[0].get_sta_cesar().get())
+ fcall.add_param_ushort ('snid', snids[1])
+ fcall.send()
+ # We need to activate the sniffer for TX/RX beacons.
+ status = sniffer (maximus, ccos[0], beacon_tx = True,
+ beacon_rx = True)
+ self.failUnless (status)
+ beacons = self.csi.sniff_packets (25)
+ self.failUnless (beacons)
+ # Stop the sniffer.
+ status = sniffer (maximus, ccos[0])
+ self.failUnless (status)
+ # Process the beacons.
+ countdown = [5, 5]
+ for i in beacons:
+ vs_sniffer_ind = Ether (i.get ())
+ beacon = scammer.get_sniffed_mme (vs_sniffer_ind)
+ # Beacons from AVLN 1 are the transmitted ones i.e. 0 in direction
+ # field. The beacons from AVLN 2 are the received ones i.e. 1 in
+ # direction.
+ # We use the direction value as index of tables in this test.
+ for j in beacon.bentry:
+ if j.header == scammer.BENTRY_HDR['CHANGE_SNID']:
+ self.failUnless (j.sccd ==
+ countdown[vs_sniffer_ind.direction])
+ self.failUnless (j.newsnid not in snids)
+ countdown[vs_sniffer_ind.direction] -= 1
+ self.failUnless (countdown == [0, 0])
+ # Now we verify the SNID is correctly set in the CCo.
+ snids_new = []
+ own = Station_own_data ()
+ for i in ccos:
+ own.get_data (maximus, i.get_sta_cesar())
+ self.failUnless (own.snid not in snids)
+ snids_new.append (own.snid)
+ # Same thing for stations.
+ for i in range (len (snids)):
+ avln = avlns[i]
+ for j in range (avln.get_nb_sta ()):
+ sta = avln.get_sta (j)
+ own.get_data (maximus, sta.get_sta_cesar())
+ self.failUnless (own.snid == snids_new[i])
+ # Test is ended.
+ self.uninit ()
+
+ def testHybridMode (self):
+ """Test the hybrid mode change on an AVLN.
+
+ For this we need to change the HM on the AVLN using an Fcall.
+
+ Excepted results: The HM have changed using the change HM beacon entry
+ """
+ self.init ([2])
+ maximus = self.csi.get_maximus ()
+ avln = self.csi.avln_get (0)
+ cco = avln.get_cco (maximus)
+ # We activate the sniffer to see the changes.
+ status = sniffer (maximus, cco, beacon_tx = True)
+ self.failUnless (status)
+ # Stations starts in HYBRID_DELIMITERS_MODE, we will change it to
+ # SHARED_CSMA_HYBRID_MODE.
+ fcall = maximus.create_fcall ("fc_cco_change_hm")
+ fcall.set_sta (cco.get_sta_cesar().get())
+ fcall.add_param_ushort ('hm', 1)
+ fcall.send()
+ # Start sniffing the beacons.
+ beacons = self.csi.sniff_packets (25)
+ self.failUnless (beacons)
+ bentry = BEntryChangeHm (
+ header = scammer.BENTRY_HDR['CHANGE_HM'],
+ length = 1, hmccd = 4, newhm = 1)
+ for i in beacons:
+ vs_sniffer_ind = Ether (i.get ())
+ beacon = scammer.get_sniffed_mme (vs_sniffer_ind)
+ self.bentry_check (beacon, bentry)
+ self.failUnless (bentry.hmccd == 0)
+ # We can deactivate the sniffer.
+ status = sniffer (maximus, cco)
+ self.failUnless (status)
+ # Now we can verify on each station what hm it is using.
+ own = Station_own_data ()
+ for i in range (avln.get_nb_sta ()):
+ sta = avln.get_sta (i)
+ own.get_data (maximus, sta.get_sta_cesar())
+ self.failUnless (own.hybrid_mode == 1)
+ # Test is ended.
+ self.uninit ()
+
+ def testChangeNek (self):
+ """Change the NEK from the CCo using a fcall on it.
+ We should see an encryption key change in the central beacon.
+ """
+ self.init ([2])
+ maximus = self.csi.get_maximus ()
+ avln = self.csi.avln_get (0)
+ cco = avln.get_cco (maximus)
+ # Get the current nek.
+ nek = get_nek (self.csi, cco)
+ # Activate the sniffer to see the nek change in the central beacon.
+ status = sniffer (maximus, cco, beacon_tx = True)
+ self.failUnless (status)
+ # Require the nek change using the fcall.
+ fcall = maximus.create_fcall ("fc_cco_change_nek")
+ fcall.set_sta (cco.get_sta_cesar().get())
+ fcall.send()
+ # Sniff the beacons to see the change.
+ beacons = self.csi.sniff_packets (25)
+ self.failUnless (beacons)
+ bentry = BEntryEncryptionKeyChange (
+ header = scammer.BENTRY_HDR['ENCRYPTION_KEY_CHANGE'],
+ length = 2, kccd = 4, kbc = 0, neweks = 1)
+ for i in beacons:
+ vs_sniffer_ind = Ether (i.get ())
+ beacon = scammer.get_sniffed_mme (vs_sniffer_ind)
+ self.bentry_check (beacon, bentry)
+ self.failUnless (bentry.kccd == 0)
+ # Deactivate the sniffer.
+ status = sniffer (maximus, cco)
+ self.failUnless (status)
+ # Get the new NEK.
+ nek_new = get_nek (self.csi, cco)
+ self.failUnless (nek != nek_new)
+ # Verify all the stations use the same NEK.
+ for i in range (avln.get_nb_sta ()):
+ sta = avln.get_sta (i)
+ nek_sta = get_nek (self.csi, sta)
+ self.failUnless (nek_sta.is_valid ())
+ self.failUnless (nek_sta.eks == nek_new.eks)
+ self.failUnless (nek_sta.nek == nek_new.nek)
+ del nek_sta
+ # Test ended.
+ self.uninit ()
+
+if __name__ == '__main__':
+ suite = unittest.TestLoader().loadTestsFromTestCase(TestBentryChange)
+ testResult = unittest.TextTestRunner(verbosity=2).run(suite)
+ sys.exit ((1, 0)[testResult.wasSuccessful ()])
diff --git a/cesar/test_general/station/scenario/py/sc09_simple_connect.py b/cesar/test_general/station/scenario/py/sc09_simple_connect.py
new file mode 100644
index 0000000000..f02e87a197
--- /dev/null
+++ b/cesar/test_general/station/scenario/py/sc09_simple_connect.py
@@ -0,0 +1,232 @@
+#!/usr/bin/python
+
+#############################################################################
+# Copyright (C) 2011 Spidcom
+#############################################################################
+
+import sys
+sys.path.append ('py')
+from scenario_init import *
+import threading
+
+class TestSimpleConnect (unittest.TestCase):
+ """Test all the simple connect scenarios.
+ """
+
+ def setUp (self):
+ pass
+
+ def tearDown (self):
+ pass
+
+ def init (self, avln_sta_nb_array):
+ """Initialise the avlns."""
+ self.csi = csiCore (1234)
+ self.csi.process_init (args)
+ self.csi.init_test_bed (avln_sta_nb_array)
+ self.computer_mac = "10:10:10:10:10:10"
+
+ def uninit (self):
+ """Uninitialise."""
+ self.csi.uninit_test_bed ()
+ self.csi.process_uninit ()
+
+ def send_drv_sta_sc_req (self, sta, sc_join):
+ """Send a DRV_STA_SC.REQ and check the response."""
+ drv_sta_sc_req = Ether (dst = sta.get_mac_addr (),
+ src = self.computer_mac) / scammer.MME () \
+ / scammer.DRV_STA_SC_REQ (sc_join = sc_join)
+ rsp = sendnrecv_mme (self.csi.get_maximus (), sta, drv_sta_sc_req)
+ self.failUnless (rsp)
+ drv_sta_sc_cnf = Ether (rsp[0].get ())
+ self.failUnless (drv_sta_sc_cnf.result == 0)
+
+ def testAvlnExistsCCoSCADD (self):
+ """An AVLN already exists, a new station with a different NMK is added
+ to the medium. We associate it with the simple connect method.
+
+ See HPAV specification section 7.3.5.3 SC-Join and SC-Add
+
+ Excepted results: The SC station is added to the network.
+ """
+ self.init ([2, 1])
+ maximus = self.csi.get_maximus ()
+ avln1 = self.csi.avln_get (0)
+ cco = avln1.get_cco (maximus)
+ sta = self.csi.avln_get (1).get_sta (0)
+ # Get the AVLN NID.
+ own = Station_own_data ()
+ own.get_data (maximus, cco.get_sta_cesar())
+ nid = own.nid
+ snid = own.snid
+ del own
+ # Activate the sniffer only for MME.
+ status = sniffer (maximus, sta, mme_tx = True, mme_rx = True)
+ self.failUnless (status)
+ # Get the station to send the DRV_STA_SC MME to start the simple
+ # connect method.
+ self.send_drv_sta_sc_req (sta, 1)
+ # Set the CCo in the SC_ADD mode.
+ self.send_drv_sta_sc_req (cco, 0)
+ # Wait some time.
+ self.csi.process_wait_sec (2)
+ # Deactivate the sniffer.
+ status = sniffer (maximus, sta)
+ self.failUnless (status)
+ # Check the MME exchanged.
+ cco_mac = cco.get_mac_addr ()
+ sta_mac = sta.get_mac_addr ()
+ protocol = HPAVProtocol ()
+ protocol.add_mme_tx (cco_mac, sta_mac,
+ scammer.CM_SC_JOIN_REQ (cco_cap = 0)),
+ protocol.add_mme_rx (sta_mac, cco_mac,
+ scammer.CM_SC_JOIN_CNF (nid = nid, avln_status = 1,
+ cco_cap = 0, proxy_cap = 0, backup_cco_cap = 0,
+ cco_status = 1, pco_status = 0, backup_cco_status = 0))
+ protocol.add_mme_tx (cco_mac, sta_mac,
+ scammer.CC_ASSOC_REQ (reqtype = 0, nid = nid, cco_cap = 0,
+ proxy_cap = 0))
+ protocol.add_mme_rx (sta_mac, cco_mac,
+ scammer.CC_ASSOC_CNF (result = 0, nid = nid, snid = snid,
+ stei = 3, tei_lease = 15))
+ # TEK exchange.
+ protocol.add_mme_rx (sta_mac, cco_mac,
+ scammer.CM_GET_KEY_REQ (req_type = 0, req_keytype = 4,
+ nid = nid, pid = 3, pmn = 1))
+ protocol.add_mme_tx (cco_mac, sta_mac,
+ scammer.CM_GET_KEY_CNF (result = 0, req_keytype = 4,
+ nid = nid, pid = 3, pmn = 2))
+ # Get NMK.
+ protocol.add_mme_rx (sta_mac, cco_mac,
+ scammer.CM_ENCRYPTED_PAYLOAD_IND (peks = 2, pid = 3, pmn = 3))
+ protocol.add_mme_tx (cco_mac, sta_mac,
+ scammer.CM_ENCRYPTED_PAYLOAD_IND (peks = 2, pid = 3,
+ pmn = 255))
+ # NEK require.
+ protocol.add_mme_tx (cco_mac, sta_mac,
+ scammer.CM_ENCRYPTED_PAYLOAD_IND (peks = 2, pid = 3, pmn = 1))
+ protocol.add_mme_rx (sta_mac, cco_mac,
+ scammer.CM_ENCRYPTED_PAYLOAD_IND (peks = 2, pid = 3, pmn = 2))
+ ok = protocol.protocol_exchange_check (self.csi.sniffed_packets)
+ self.failUnless (ok)
+ del self.csi.sniffed_packets
+
+ def assocationAuthentication (self, protocol, sta1_mac, sta2_mac, nid,
+ snid):
+ """Add the common assocation and authentication MME exchanges.
+ protocol the HPAVProtocol object
+ sta1_mac the first station's mac address.
+ sta2_mac the second station's mac address.
+ """
+ protocol.add_mme_tx (sta1_mac, sta2_mac,
+ scammer.CM_SC_JOIN_REQ (cco_cap = 0)),
+ protocol.add_mme_rx (sta2_mac, sta1_mac,
+ scammer.CM_SC_JOIN_CNF (nid = nid, avln_status = 1,
+ cco_cap = 0, proxy_cap = 0, backup_cco_cap = 0,
+ cco_status = 0, pco_status = 0, backup_cco_status = 0))
+ # Association.
+ protocol.add_mme_tx (sta2_mac, sta1_mac,
+ scammer.CC_ASSOC_REQ (reqtype = 0, nid = nid, cco_cap = 0,
+ proxy_cap = 0))
+ protocol.add_mme_rx (sta1_mac, sta2_mac,
+ scammer.CC_ASSOC_CNF (result = 0, nid = nid, snid = snid,
+ stei = 2, tei_lease = 15))
+ # Exchanging the TEK.
+ protocol.add_mme_tx (sta1_mac, sta2_mac,
+ scammer.CM_GET_KEY_REQ (req_type = 0, req_keytype = 4,
+ nid = nid, pid = 3, pmn = 1))
+ protocol.add_mme_rx (sta2_mac, sta1_mac,
+ scammer.CM_GET_KEY_CNF (result = 0, req_keytype = 4,
+ nid = nid, pid = 3, pmn = 2))
+ # Exchanging the NMK.
+ protocol.add_mme_tx (sta2_mac, sta1_mac,
+ scammer.CM_ENCRYPTED_PAYLOAD_IND (peks = 2, pid = 3, pmn = 3))
+ protocol.add_mme_rx (sta1_mac, sta2_mac,
+ scammer.CM_ENCRYPTED_PAYLOAD_IND (peks = 1, pid = 3,
+ pmn = 255))
+ # NEK require.
+ protocol.add_mme_tx (sta1_mac, sta2_mac,
+ scammer.CM_ENCRYPTED_PAYLOAD_IND (peks = 1, pid = 0, pmn = 1))
+ protocol.add_mme_rx (sta2_mac, sta1_mac,
+ scammer.CM_ENCRYPTED_PAYLOAD_IND (peks = 1, pid = 0,
+ pmn = 255))
+
+ def testOneSCJoinOneSCAdd (self):
+ """Two STA not connected to any AVLN will try to form an AVLN by
+ using the SC procedure. This is quite the same as two STA in
+ SC JOIN because the one doing the SC_ADD is the one with the
+ bigger MAC address.
+
+ See HPAV specification section 7.3.4.3 Two Unassociated STAs: One in
+ SC-Add and One in SC-Join
+
+ Excepted results: The SC station is added to the network.
+ """
+ self.init ([1, 1])
+ maximus = self.csi.get_maximus ()
+ sta1 = self.csi.avln_get (0).get_sta (0)
+ sta2 = self.csi.avln_get (1).get_sta (0)
+ status = sniffer (maximus, sta1, mme_tx = True, mme_rx = True)
+ self.failUnless (status)
+ self.send_drv_sta_sc_req (sta1, 1)
+ self.send_drv_sta_sc_req (sta2, 0)
+ sta1_mac = sta1.get_mac_addr ()
+ sta2_mac = sta2.get_mac_addr ()
+ own = Station_own_data ()
+ own.get_data (maximus, sta1.get_sta_cesar())
+ nid = own.nid
+ snid = own.snid
+ del own
+ # Wait some time.
+ self.csi.process_wait_sec (2)
+ status = sniffer (maximus, sta1)
+ self.failUnless (status)
+ # Test the protocol.
+ protocol = HPAVProtocol ()
+ self.assocationAuthentication (protocol, sta1_mac, sta2_mac, nid,
+ snid)
+ ok = protocol.protocol_exchange_check (self.csi.sniffed_packets)
+ self.failUnless (ok)
+ del self.csi.sniffed_packets
+
+ def testTwoStaInSCJOIN (self):
+ """Two STA not connected to any AVLN will try to form an AVLN by
+ using the SC JOIN procedure. This case will be more likely to
+ be the one to occur in every day usage.
+
+ See HPAV specification section 7.3.4.4 Two Unassociated STAs: Both in
+ SC-Join
+
+ Excepted results: The SC station is added to the network.
+ """
+ self.init ([1, 1])
+ maximus = self.csi.get_maximus ()
+ sta1 = self.csi.avln_get (0).get_sta (0)
+ sta2 = self.csi.avln_get (1).get_sta (0)
+ status = sniffer (maximus, sta1, mme_tx = True, mme_rx = True)
+ self.failUnless (status)
+ self.send_drv_sta_sc_req (sta1, 1)
+ self.send_drv_sta_sc_req (sta2, 0)
+ sta1_mac = sta1.get_mac_addr ()
+ sta2_mac = sta2.get_mac_addr ()
+ own = Station_own_data ()
+ own.get_data (maximus, sta1.get_sta_cesar())
+ nid = own.nid
+ snid = own.snid
+ del own
+ # Wait some time.
+ self.csi.process_wait_sec (2)
+ status = sniffer (maximus, sta1)
+ self.failUnless (status)
+ # Test the protocol.
+ protocol = HPAVProtocol ()
+ self.assocationAuthentication (protocol, sta1_mac, sta2_mac, nid,
+ snid)
+ ok = protocol.protocol_exchange_check (self.csi.sniffed_packets)
+ self.failUnless (ok)
+ del self.csi.sniffed_packets
+
+if __name__ == '__main__':
+ suite = unittest.TestLoader().loadTestsFromTestCase(TestSimpleConnect)
+ testResult = unittest.TextTestRunner(verbosity=2).run(suite)
+ sys.exit ((1, 0)[testResult.wasSuccessful ()])
diff --git a/cesar/test_general/station/scenario/py/sc10_short_messages.py b/cesar/test_general/station/scenario/py/sc10_short_messages.py
new file mode 100644
index 0000000000..b931fd0365
--- /dev/null
+++ b/cesar/test_general/station/scenario/py/sc10_short_messages.py
@@ -0,0 +1,40 @@
+#!/usr/bin/python
+
+#############################################################################
+# Copyright (C) 2011 Spidcom
+#############################################################################
+
+import sys
+sys.path.append ('py')
+from scenario_init import *
+
+class TestShortMessage (unittest.TestCase):
+ """ Test a frame with the min size, between two station in an AVLN.
+ """
+
+ def setUp (self):
+ self.csi = csiCore (1234)
+ self.csi.process_init (args)
+ self.csi.init_test_bed ([2])
+
+ def tearDown (self):
+ self.csi.uninit_test_bed ()
+ self.csi.process_uninit ()
+ del self.csi
+
+ def testFrameWithoutPayload (self):
+ """A frame of 14 bytes is sent from sta1 to sta2.
+
+ Excepted results: This frame must be received.
+ """
+ avln = self.csi.avln_get (self.csi.avln_nb() - 1)
+ packets = list ()
+ packets.append (csiPacket (0, avln,
+ avln.get_sta(0), avln.get_sta(0).get_mac_addr (),
+ avln.get_sta(1), avln.get_sta(1).get_mac_addr ()))
+ self.failUnless (send_check_datas (self.csi, avln, packets))
+
+if __name__ == '__main__':
+ suite = unittest.TestLoader().loadTestsFromTestCase(TestShortMessage)
+ testResult = unittest.TextTestRunner(verbosity=2).run(suite)
+ sys.exit ((1, 0)[testResult.wasSuccessful ()])
diff --git a/cesar/test_general/station/scenario/py/sc11_cm_nw_info.py b/cesar/test_general/station/scenario/py/sc11_cm_nw_info.py
new file mode 100644
index 0000000000..7d407d84b1
--- /dev/null
+++ b/cesar/test_general/station/scenario/py/sc11_cm_nw_info.py
@@ -0,0 +1,92 @@
+#!/usr/bin/python
+
+#############################################################################
+# Copyright (C) 2011 Spidcom
+#############################################################################
+
+import sys
+sys.path.append ('py')
+from scenario_init import *
+
+class Test_CM_NW_INFO (unittest.TestCase):
+ """test the CM_NW_INFO.CNF received for different destination (sta, cco).
+ """
+
+ def setUp (self):
+ self.csi = csiCore (1234)
+ self.csi.process_init (args)
+ self.maximus = self.csi.get_maximus ()
+
+ def tearDown (self):
+ del self.maximus
+ self.csi.process_uninit ()
+ del self.csi
+
+ def __sendnrecv_cm_nw_info (self, sta):
+ """Send a CM_NW_INFO.REQ MME to the sta and read the confirmation."""
+ self.computer_mac = "10:10:10:10:10:10"
+ req = Ether (dst = sta.get_mac_addr (), src = self.computer_mac) \
+ / scammer.MME (mmtype = scammer.HPAV_MMTYPES ['CM_NW_INFO_REQ']) \
+ / scammer.CM_NW_INFO_REQ ()
+ rsp = sendnrecv_mme (self.csi.get_maximus (), sta, req)
+ self.failUnless (rsp)
+ return Ether (rsp[0].get ())
+
+ def test_cm_nw_info_to_cco (self):
+ """Two stations authenticated, the target is the CCo.
+
+ Excepted results: We check that we receive a correct answer
+ (especially the CCo mac)
+ """
+ self.csi.init_test_bed ([2])
+ avln = self.csi.avln_get(0)
+ cco = avln.get_cco (self.maximus)
+ cnf = self.__sendnrecv_cm_nw_info (cco)
+
+ nwinfo = cnf.getlayer (3)
+ self.failUnless (cnf.numnws == 1)
+ self.failUnless (nwinfo.stationrole == 2)
+ self.failUnless (nwinfo.mac == cco.get_mac_addr())
+ self.csi.avln_remove (avln)
+ self.csi.uninit_test_bed ()
+
+ def test_cm_nw_info_to_sta (self):
+ """Two stations authenticated, the target station is not the CCo.
+
+ Excepted results: We check that we receive a correct answer
+ (especially the CCo mac)
+ """
+ self.csi.init_test_bed ([2])
+ avln = self.csi.avln_get(0)
+ sta = avln.get_stas (self.maximus)[0]
+ cco = avln.get_cco (self.maximus)
+ cnf = self.__sendnrecv_cm_nw_info (sta)
+
+ nwinfo = cnf.getlayer (3)
+ self.failUnless (cnf.numnws == 1)
+ self.failUnless (nwinfo.stationrole == 0)
+ self.failUnless (nwinfo.mac == cco.get_mac_addr())
+ self.csi.avln_remove (avln)
+ self.csi.uninit_test_bed ()
+
+ def test_cm_nw_info_empty (self):
+ """Station not authenticated or associated.
+
+ Excepted results: numnws field must indicate 0
+ """
+ npw = str (random.getrandbits(64))
+ ahfid = str (random.getrandbits(32))
+ avln = self.csi.avln_add (npw, ahfid)
+ avln.add_stas (1)
+ self.csi.process_avlns_launch ()
+ cco = avln.get_cco (self.maximus)
+ sta = avln.get_stas (self.maximus)[0]
+ cnf = self.__sendnrecv_cm_nw_info (sta)
+
+ self.failUnless (cnf.numnws == 0)
+ self.csi.avln_remove (avln)
+
+if __name__ == '__main__':
+ suite = unittest.TestLoader().loadTestsFromTestCase(Test_CM_NW_INFO)
+ testResult = unittest.TextTestRunner(verbosity=2).run(suite)
+ sys.exit ((1, 0)[testResult.wasSuccessful ()])
diff --git a/cesar/test_general/station/scenario/py/sc12_change_nmk.py b/cesar/test_general/station/scenario/py/sc12_change_nmk.py
new file mode 100644
index 0000000000..636eb73629
--- /dev/null
+++ b/cesar/test_general/station/scenario/py/sc12_change_nmk.py
@@ -0,0 +1,331 @@
+#!/usr/bin/python
+
+#############################################################################
+# Copyright (C) 2011 Spidcom
+#############################################################################
+
+import sys
+sys.path.append ('py')
+from scenario_init import *
+from handover_protocol import HPAVHandoverProtocol
+from association_protocol import HPAVAssocAuthProtocol
+
+def staGetSnidAndNid (sta, maximus):
+ """Get the NID and the SNID of a station."""
+ sta_data = Station_own_data ()
+ data = sta_data.get_data (maximus, sta.get_sta_cesar ())
+ return [data.nid, data.snid]
+
+def prepare_packets (avln, cco, stas):
+ """ """
+ packets = list ()
+ for i in stas:
+ packets.append (csiPacket (payload_size = 200, avln = avln,
+ sta_src = i, sta_dest = cco))
+ packets.append (csiPacket (payload_size = 200, avln = avln,
+ sta_src = cco, sta_dest = i))
+ for j in stas:
+ if i is not j:
+ packets.append (csiPacket (payload_size = 200, avln = avln,
+ sta_src = i, sta_dest = j))
+ return packets
+
+class testAVLN:
+ """Define the AVLN with a CCo and a list of stations."""
+
+ def __init__ (self):
+ self.cco = None
+ self.stas = None
+
+class TestNMK (unittest.TestCase):
+ """Change the Network password on station in an AVLN."""
+
+ def setUp (self):
+ pass
+
+ def tearDown (self):
+ pass
+
+ def init (self, avln_station_array):
+ self.csi = csiCore (1234)
+ self.csi.process_init (args)
+ self.csi.init_test_bed (avln_station_array)
+ self.maximus = self.csi.get_maximus ()
+ self.avlns = list ()
+ global NMK
+ NMK = random.getrandbits(64)
+
+ def uninit (self):
+ del self.maximus
+ self.csi.uninit_test_bed ()
+ self.csi.process_uninit ()
+ del self.csi
+
+ def changeNMK (self, sta, nmk):
+ """Change the NMK on the station."""
+ mme = Ether (dst = sta.get_mac_addr (), src = MAC_DEFAULT) \
+ / scammer.MME () \
+ / scammer.DRV_STA_SET_KEY_REQ (nmk = nmk, type = 1)
+ rsp = sendnrecv_mme (self.csi.get_maximus (), sta, mme)
+ self.failUnless (rsp)
+ mme_cnf = Ether (rsp[0].get ())
+ self.failUnless (mme_cnf.result == 0)
+
+ def t3StaStep1 (self):
+ """ step1: Change the NMK on the CCo of the AVLN.
+ The CCo should do a handover to one of the other stations and
+ become STA before leaving the AVLN.
+ At the end we have two AVLNS:
+
+ - one with a CCo and a STA (AVLN1).
+ - the other one with an unassociated STA (AVLN2).
+ """
+ print "First step"
+ cco = self.avlns[0].cco
+ sta = self.avlns[0].stas[1]
+ # Macs
+ cco_mac = cco.get_mac_addr ()
+ sta_mac = sta.get_mac_addr ()
+ # Get the nid.
+ nid, snid = staGetSnidAndNid (cco, self.maximus)
+ # Change the NMK on the CCo.
+ status = sniffer (self.maximus, cco, mme_tx = True, mme_rx = True)
+ self.failUnless (status)
+ self.changeNMK (cco, NMK)
+ self.csi.process_wait_sec (5)
+ status = sniffer (self.maximus, cco)
+ self.failUnless (status)
+ # We need the new NID of the CCo to check the CM_UNASSOCIATED_STA.IND.
+ nid_new, snid_new = staGetSnidAndNid (cco, self.maximus)
+ # Get the sniffed MME to process.
+ protocol = HPAVProtocol ()
+ protocol.add_mme_rx (cco_mac, MAC_DEFAULT,
+ scammer.DRV_STA_SET_KEY_REQ (nmk = NMK, type = 1))
+ protocol.add_mme_tx (MAC_DEFAULT, cco_mac,
+ scammer.DRV_STA_SET_KEY_CNF (result = 0))
+ handover_station_list = [
+ scammer.CC_HANDOVER_INFO_IND_sta_info (tei = 1,
+ mac = cco_mac, status = 1),
+ scammer.CC_HANDOVER_INFO_IND_sta_info (tei = 2,
+ mac = self.avlns[0].stas[0].get_mac_addr (),
+ status = 1)
+ ]
+ teimap_station_list = [
+ scammer.CC_SET_TEI_MAP_IND_station (tei = 1, mac = cco_mac,
+ status = 1),
+ ]
+ HPAVHandoverProtocol (protocol, sta_mac, cco_mac,
+ handover_station_list, teimap_station_list)
+ protocol.add_mme_tx (MAC_DEFAULT, cco_mac,
+ scammer.CM_UNASSOCIATED_STA_IND (nid = nid_new, cco_cap = 0))
+ ok = protocol.protocol_exchange_check (self.csi.sniffed_packets)
+ self.failUnless (ok)
+ self.csi.reset_sniffed_packets ()
+ # Keep the CCo as USTA in the class.
+ av = testAVLN ()
+ av.stas = [cco]
+ self.avlns.append (av)
+ # Update the current AVLN.
+ self.avlns[0].cco = sta
+ self.avlns[0].stas.remove (sta)
+ # We can test some communication.
+ avln = self.csi.avln_get (0)
+ packets = prepare_packets (avln, self.avlns[0].cco, self.avlns[0].stas)
+ result = send_check_datas (self.csi, avln, packets)
+ self.failUnless (result)
+
+ def t3StaStep2 (self):
+ """ step2: Change the NMK on the CCo.
+ The CCo should do a handover to one of the other stations and
+ become STA before leaving the AVLN.
+
+ At the end we have two AVLNS:
+ - AVLN1 with a CCo and a STA.
+ - AVLN2 with a USTA.
+ """
+ print "Second step"
+ cco = self.avlns[0].cco
+ sta = self.avlns[0].stas[0]
+ cco_mac = cco.get_mac_addr ()
+ sta_mac = sta.get_mac_addr ()
+ # Get the nid.
+ nid, snid = staGetSnidAndNid (cco, self.maximus)
+ # Change the NMK on the CCo.
+ status = sniffer (self.maximus, cco, mme_tx = True, mme_rx = True)
+ self.failUnless (status)
+ self.changeNMK (cco, NMK)
+ self.csi.process_wait_sec (15)
+ status = sniffer (self.maximus, cco)
+ self.failUnless (status)
+ # Get the new nid of the old CCo.
+ nid_new, snid_new = staGetSnidAndNid (cco, self.maximus)
+ # Check the protocol.
+ protocol = HPAVProtocol ()
+ protocol.add_mme_rx (cco_mac, MAC_DEFAULT,
+ scammer.DRV_STA_SET_KEY_REQ (nmk = NMK, type = 1))
+ protocol.add_mme_tx (MAC_DEFAULT, cco_mac,
+ scammer.DRV_STA_SET_KEY_CNF (result = 0))
+ handover_station_list = [
+ scammer.CC_HANDOVER_INFO_IND_sta_info (tei = 3,
+ mac = cco_mac, status = 1),
+ ]
+ teimap_station_list = [
+ scammer.CC_SET_TEI_MAP_IND_station (tei = 3,
+ mac = cco_mac, status = 1),
+ ]
+ HPAVHandoverProtocol (protocol, sta_mac, cco_mac,
+ handover_station_list, teimap_station_list)
+ protocol.add_mme_tx (MAC_DEFAULT, cco_mac,
+ scammer.CM_UNASSOCIATED_STA_IND (nid = nid_new, cco_cap = 0),
+ 2)
+ # From here, the station on the one the NMK have just been changed
+ # will try to associate with the previous CCo of step 1.
+ avln = self.avlns[1]
+ avln.cco = avln.stas.pop ()
+ avln.stas = [cco]
+ avln = self.avlns[0]
+ avln.cco = None
+ # Prepare protocol.
+ avln2cco = self.avlns[1].cco
+ avln2cco_mac = avln2cco.get_mac_addr ()
+ avln2sta = self.avlns[1].stas[0]
+ avln2sta_mac = avln2sta.get_mac_addr ()
+ HPAVAssocAuthProtocol (protocol, avln2cco_mac, avln2sta_mac, nid_new,
+ snid_new,
+ [
+ scammer.CC_SET_TEI_MAP_IND_station (tei = 1,
+ mac = avln2cco_mac, status = 1),
+ scammer.CC_SET_TEI_MAP_IND_station (tei = 2,
+ mac = avln2sta_mac, status = 0),
+ ], 0)
+ ok = protocol.protocol_exchange_check (self.csi.sniffed_packets)
+ self.failUnless (ok)
+ self.csi.reset_sniffed_packets ()
+ # If we send data from station to the CCo it must be received.
+ # Do not change the way.
+ avln = self.csi.avln_get (0)
+ packets = [
+ csiPacket (payload_size = 200, avln = avln,
+ sta_src = avln2sta, sta_dest = avln2sta),
+ csiPacket (payload_size = 200, avln = avln,
+ sta_src = avln2cco, sta_dest = avln2sta),
+ ]
+ result = send_check_datas (self.csi, avln, packets)
+ self.failUnless (result)
+
+ def t3StaStep3 (self):
+ """step3: Change the NMK on the USTA. At the end we should have a
+ single AVLN with 3 stations associated and authenticated (one of those
+ is the CCo).
+ """
+ cco = self.avlns[1].cco
+ sta = self.avlns[0].stas.pop ()
+ # Change the NMK on the CCo.
+ status = sniffer (self.maximus, sta, mme_tx = True, mme_rx = True)
+ self.failUnless (status)
+ self.changeNMK (sta, NMK)
+ self.csi.process_wait_association ()
+ self.csi.process_wait_authentication ()
+ status = sniffer (self.maximus, sta)
+ self.failUnless (status)
+ # Prepare macs.
+ nid, snid = staGetSnidAndNid (cco, self.maximus)
+ cco_mac = cco.get_mac_addr ()
+ sta_mac = sta.get_mac_addr ()
+ protocol = HPAVProtocol ()
+ HPAVAssocAuthProtocol (protocol, cco_mac, sta_mac, nid, snid,
+ [
+ scammer.CC_SET_TEI_MAP_IND_station (tei = 1,
+ mac = cco_mac, status = 1),
+ scammer.CC_SET_TEI_MAP_IND_station (tei = 2,
+ mac = sta_mac, status = 1),
+ scammer.CC_SET_TEI_MAP_IND_station (tei = 3,
+ mac = sta_mac, status = 0),
+ ], 0)
+ ok = protocol.protocol_exchange_check (self.csi.sniffed_packets)
+ self.failUnless (ok)
+ self.csi.reset_sniffed_packets ()
+ # Check transmission.
+ avln = self.csi.avln_get (0)
+ cco = avln.get_cco (self.maximus)
+ stas = avln.get_stas (self.maximus)
+ packets = prepare_packets (avln, cco, stas)
+ result = send_check_datas (self.csi, avln, packets)
+ self.failUnless (result)
+
+ def test3STA (self):
+ """
+ init: 3 stations associated authenticated on the same AVLN.
+
+ step1: Change the NMK on the CCo of the AVLN.
+ The CCo should do a handover to one of the other stations and
+ become STA before leaving the AVLN.
+ At the end we have two AVLNS:
+
+ - one with a CCo and a STA (AVLN1).
+ - the other one with an unassociated STA (AVLN2).
+
+ step2: Change the NMK on the CCo.
+ The CCo should do a handover to one of the other stations and
+ become STA before leaving the AVLN.
+
+ At the end we have two AVLNS:
+ - AVLN1 with a CCo and a STA.
+ - AVLN2 with a USTA.
+
+ step3: Change the NMK on the USTA. At the end we should have a single
+ AVLN with 3 stations associated and authenticated (one of those is the
+ CCo).
+ """
+ self.init ([3])
+ avln = testAVLN ()
+ avln.cco = self.csi.avln_get (0).get_cco (self.maximus)
+ avln.stas = self.csi.avln_get (0).get_stas (self.maximus)
+ self.avlns.append (avln)
+ self.t3StaStep1 ()
+ self.t3StaStep2 ()
+ self.t3StaStep3 ()
+ del self.avlns
+ self.uninit ()
+
+ def testChangeNMKOnCCoAndSTA (self):
+ """Change the NMK on the CCo and just after on the station.
+ """
+ self.init ([2])
+ cco = self.csi.avln_get (0).get_cco (self.maximus)
+ sta = self.csi.avln_get (0).get_stas (self.maximus)[0]
+ # Change the NMK on the CCo.
+ status = sniffer (self.maximus, cco, mme_tx = True, mme_rx = True)
+ self.failUnless (status)
+ self.changeNMK (cco, NMK)
+ self.changeNMK (sta, NMK)
+ self.csi.process_wait_association ()
+ self.csi.process_wait_authentication ()
+ status = sniffer (self.maximus, cco)
+ self.failUnless (status)
+ nid, snid = staGetSnidAndNid (cco, self.maximus)
+ cco_mac = cco.get_mac_addr ()
+ sta_mac = sta.get_mac_addr ()
+ protocol = HPAVProtocol ()
+ HPAVAssocAuthProtocol (protocol, cco_mac, sta_mac, nid, snid,
+ [
+ scammer.CC_SET_TEI_MAP_IND_station (tei = 1,
+ mac = cco_mac, status = 1),
+ scammer.CC_SET_TEI_MAP_IND_station (tei = 2,
+ mac = sta_mac, status = 0),
+ ], 0)
+ ok = protocol.protocol_exchange_check (self.csi.sniffed_packets)
+ self.failUnless (ok)
+ self.csi.reset_sniffed_packets ()
+ # Check transmission.
+ avln = self.csi.avln_get (0)
+ stas = avln.get_stas (self.maximus)
+ packets = prepare_packets (avln, cco, stas)
+ result = send_check_datas (self.csi, avln, packets)
+ self.failUnless (result)
+ self.uninit ()
+
+if __name__ == '__main__':
+ suite = unittest.TestLoader().loadTestsFromTestCase(TestNMK)
+ testResult = unittest.TextTestRunner(verbosity=2).run(suite)
+ sys.exit ((1, 0)[testResult.wasSuccessful ()])
diff --git a/cesar/test_general/station/scenario/py/sc14_igmp.py b/cesar/test_general/station/scenario/py/sc14_igmp.py
new file mode 100644
index 0000000000..cafde5a852
--- /dev/null
+++ b/cesar/test_general/station/scenario/py/sc14_igmp.py
@@ -0,0 +1,95 @@
+#!/usr/bin/python
+
+#############################################################################
+# Copyright (C) 2011 Spidcom
+#############################################################################
+
+import sys
+sys.path.append ('py')
+from scenario_init import *
+from scapy.all import hexdump
+
+class TestIGMP (unittest.TestCase):
+ """Test of the multicast behavior."""
+
+ def setUp (self):
+ self.csi = csiCore (1234)
+ self.csi.process_init (args)
+ self.csi.init_test_bed ([2])
+
+ def tearDown (self):
+ self.csi.uninit_test_bed ()
+ self.csi.process_uninit ()
+ del self.csi
+
+ def sendAndVerify (self, mme, sta, macs):
+ """
+ """
+ sta_mac = sta.get_mac_addr ()
+ #Send the MME.
+ rsp = sendnrecv_mme (self.csi.get_maximus (), sta, mme)
+ self.failUnless (rsp)
+ drv_mcast_set_list_cnf = Ether (rsp[0].get ())
+ self.failUnless (drv_mcast_set_list_cnf.result == 0)
+ # Get the Mac 2 TEI table.
+ mac2tei = Ether (dst = sta_mac, src = MAC_DEFAULT)\
+ / scammer.MME () / scammer.VS_GET_MACTOTEI_REQ ()
+ rsp = sendnrecv_mme (self.csi.get_maximus (), sta, mac2tei)
+ self.failUnless (rsp)
+ mac2teicnf = Ether (rsp[0].get ())
+ # Compare, only groups mac address are present in the mac2tei table,
+ # the members are present in another table.
+ for i in mac2teicnf.entries:
+ self.failUnless (i.mac in macs)
+
+ def testSetMcastList (self):
+ """Provide a list of IGMP groups and check its presence in the mac2tei
+ table.
+
+ Excepted results: The MCast mac addresses must be present in the
+ mac2tei group.
+ """
+ sta1 = self.csi.avln_get (0).get_sta (0)
+ sta1_mac = sta1.get_mac_addr ()
+ # Create groups
+ group = list ()
+ mac = "00:13:d7:00:%02x:%02x"
+ # For Group mac address be careful, the station use MAC_IS_GROUP macro
+ # to verify the Mac address is a group mac address one.
+ for i in range (2):
+ member = list ()
+ for j in range (4):
+ member.append (mac % (i + 1, j + 1))
+ group.append (["01:00:5e:%02x:00:00" % (i + 1), member])
+ # Create the MME.
+ mme = Ether (dst = sta1_mac, src = MAC_DEFAULT) \
+ / scammer.MME () \
+ / scammer.DRV_MCAST_SET_LIST_REQ (nbgrps = len (group))
+ mme_groups = list ()
+ for i in group:
+ grp = scammer.DRV_MCAST_SET_LIST_REQ_group (mac_group = i[0])
+ members= list ()
+ for j in i[1]:
+ members.append (
+ scammer.DRV_MCAST_SET_LIST_REQ_member (mac = j))
+ grp.members = members
+ grp.nbmembers = len (i[1])
+ mme_groups.append (grp)
+ mme.groups = mme_groups
+ # Expected mac addresses present in the mac2tei table.
+ macs = [self.csi.avln_get (0).get_sta(1).get_mac_addr ()]
+ for i in group:
+ macs.append (i[0])
+ self.sendAndVerify (mme, sta1, macs)
+ # Verify the mac2tei only contains the remote station when an empty
+ # list is sent.
+ macs = macs[0]
+ mme = Ether (dst = sta1_mac, src = MAC_DEFAULT) \
+ / scammer.MME () \
+ / scammer.DRV_MCAST_SET_LIST_REQ ()
+ self.sendAndVerify (mme, sta1, macs)
+
+if __name__ == '__main__':
+ suite = unittest.TestLoader().loadTestsFromTestCase(TestIGMP)
+ testResult = unittest.TextTestRunner(verbosity=2).run(suite)
+ sys.exit ((1, 0)[testResult.wasSuccessful ()])
diff --git a/cesar/test_general/station/scenario/py/scenario_init.py b/cesar/test_general/station/scenario/py/scenario_init.py
new file mode 100644
index 0000000000..838eb7522f
--- /dev/null
+++ b/cesar/test_general/station/scenario/py/scenario_init.py
@@ -0,0 +1,287 @@
+#!/usr/bin/python
+
+#############################################################################
+# Copyright (C) 2011 Spidcom
+#############################################################################
+
+import os
+import sys
+import unittest
+sys.path.append ('../../../maximus/python/tools/csi/')
+sys.path.append ('../../../maximus/python/')
+sys.path.append ('../../../maximus/python/obj')
+sys.path.append ('../../../maximus/python/lib/cesar')
+sys.path.append ('../../../../common/lib')
+sys.path.append ('lib')
+from csicore import *
+from maximus.mme.mme import MME
+from maximus.simu.rx import recv
+from csifilter import *
+from csitime import sec_to_tck
+import scammer
+from scapy.all import Ether, hexdump
+
+args = sys.argv + ['--station-executable', 'obj/test_scenario.elf']
+
+MAC_DEFAULT = "00:00:00:00:00:01"
+MAC_BCAST = "ff:ff:ff:ff:ff:ff"
+
+def send_check_datas (csi, avln, packet_list = None):
+ """Create some Ethernet packets to be sent."""
+ nb_stas = avln.get_nb_sta ()
+ if not packet_list:
+ packets = csi.avln_create_traffic (avln)
+ else:
+ packets = packet_list
+ csi.process_data_send_traffic (packets)
+ csi.process_wait_transmission (nb_stas * 10)
+ csi.process_verify_transmission ()
+ result = csi.process_end_get_result ()
+ csi.transmission_result_reset ()
+ return result
+
+def send_data_from_stasAvln1_to_stasAVLN2 (csi, avln1, avln2):
+ """Send data from all the station of AVLN1 to the stations of AVLN2.
+ Send data from all the station of AVLN2 to the stations of AVLN1.
+ """
+ packets = list ()
+ for i in range (avln1.get_nb_sta ()):
+ for j in range (avln2.get_nb_sta ()):
+ # Create a packet from station of the AVLN 1 to AVLN 2.
+ packets.append (csiPacket (
+ 60, avln1, avln1.get_sta (i),
+ mac_addr_dest = avln2.get_sta (j).get_mac_addr ()))
+ # Create a packet from station of the AVLN 2 to AVLN 1.
+ packets.append (csiPacket (
+ 60, avln2, avln2.get_sta (j),
+ mac_addr_dest = avln1.get_sta (i).get_mac_addr ()))
+ csi.process_data_send_traffic (packets)
+ csi.process_wait_transmission (
+ avln1.get_nb_sta () + avln2.get_nb_sta () * 10)
+ csi.process_verify_transmission ()
+ result = csi.process_end_get_result ()
+ csi.transmission_result_reset ()
+ return result
+
+def send_mme (maximus, station, scammer_mme):
+ """Send a scammer MME to maximus."""
+ mmemax = MME ()
+ mmemax.set_msdu_attr (str (scammer_mme))
+ mmemax.send (maximus, station.get_sta_cesar().get())
+
+def sendnrecv_mme (maximus, station, scammer_mme):
+ """Send a scammer MME to maximus."""
+ mmemax = MME ()
+ mmemax.set_msdu_attr (str (scammer_mme))
+ rsp = mmemax.sendnrecv (maximus, station.get_sta_cesar().get(),
+ timeout = sec_to_tck (1),
+ filter = lambda msdu: msdu.get_type () is 'ETHERNET_TYPE_MME' \
+ and Ether (msdu.get ()).mmtype == \
+ scammer_mme.mmtype + 1,
+ count = 1)
+ return rsp
+
+def sniffer (maximus, sta, mme_tx = False, mme_rx = False, beacon_tx = False,
+ beacon_rx = False):
+ """Activate/deactivate the cesar sniffer on the station."""
+ sniffer = Ether (dst = sta.get_mac_addr (), src = MAC_DEFAULT) \
+ / scammer.MME () \
+ / scammer.VS_SNIFFER_REQ (mme_tx = mme_tx, mme_rx = mme_rx,
+ beacon_tx = beacon_tx, beacon_rx = beacon_rx)
+ mmemax = MME ()
+ mmemax.set_msdu_attr (str (sniffer))
+ rsp = mmemax.sendnrecv (maximus, sta.get_sta_cesar().get(),
+ count = 1, filter = frame_filter_sniffer,
+ timeout = sec_to_tck (1))
+ m = Ether (rsp[0].get ())
+ if m.mmtype == scammer.HPAV_MMTYPES['VS_SNIFFER_CNF']:
+ return m.result == scammer.HPAV_RESULT['success']
+ return False
+
+class HPAVProtocol:
+ """Class to test a protocol exchange."""
+
+ def __init__ (self):
+ self.protocol_tx = list ()
+ self.protocol_rx = list ()
+
+ def __add_mme (self, dst, src, sublayer, repeat, tx):
+ """Add the MME to the correct list."""
+ m = Ether (dst = dst, src = src) \
+ / scammer.MME () \
+ / scammer.VS_SNIFFER_IND (sniff_type = 0, direction = 0) \
+ / Ether (dst = dst, src = src) \
+ / scammer.MME () \
+ / sublayer
+ if tx:
+ self.protocol_tx.append ([m, repeat])
+ else:
+ self.protocol_rx.append ([m, repeat])
+
+ def add_mme_tx (self, dst, src, sublayer, repeat_times = 1):
+ """Add a MME to check the protocol.
+ - dst = The destination mac address.
+ - src = The source mac address.
+ - mmtype = The MME MMtype
+ - sublayer = The sublayer MME filled.
+ This function only handles Sniffed MME from Cesar Sniffer.
+ """
+ self.__add_mme (dst, src, sublayer, repeat_times, True)
+
+ def add_mme_rx (self, dst, src, sublayer, repeat_times = 1):
+ """Add a MME to check the protocol.
+ - dst = The destination mac address.
+ - src = The source mac address.
+ - mmtype = The MME MMtype
+ - sublayer = The sublayer MME filled.
+ This function only handles Sniffed MME from Cesar Sniffer.
+ """
+ self.__add_mme (dst, src, sublayer, repeat_times, False)
+
+ def get_header (self, mme):
+ # Create an Packet with the Ethernet and HPAV header.
+ mmel0 = mme.copy ()
+ mmel1 = mmel0.getlayer (1)
+ mmel0.remove_payload ()
+ mmel1.remove_payload ()
+ h = mmel0 / mmel1
+ h.mmtype = mme.mmtype
+ return h
+
+ def error (self, m1, m2):
+ """Print an error
+ m1 expected MME
+ m2 MME got
+ """
+ print "Protocol Error."
+ print "Expected MME"
+ m1.show ()
+ print "I Got MME"
+ m2.show ()
+
+ def __check_security (self, m1, m2):
+ """Check security points."""
+ peks_ok = m1.peks == m2.peks
+ pid_ok = m1.pid == m2.pid
+ pmn_ok = m1.pmn == m2.pmn
+ if not peks_ok:
+ print "PEKS wrong, expected %d got %d" \
+ % (m1.peks, m2.peks)
+ if not pid_ok:
+ print "PID wrong, expected %d got %d" \
+ % (m1.pid, m2.pid)
+ if not pmn_ok:
+ print "PMN wrong, expected %d git %d" \
+ % (m1.pmn. m2.pmn)
+ return peks_ok and pid_ok and pmn_ok
+
+ def __protocol_exchange_check_mmes (self, m1, m2):
+ """Check the MME itself."""
+ m1h = self.get_header (m1)
+ m2h = self.get_header (m2)
+ header_ok = m1h == m2h
+ # Compare the two ones.
+ if not header_ok:
+ print "Header wrong"
+ print "Expected"
+ hexdump (m1h)
+ print "Got"
+ hexdump (m2h)
+ if m1.mmtype == scammer.HPAV_MMTYPES['CM_ENCRYPTED_PAYLOAD_IND']:
+ return self.__check_security (m1, m2)
+ elif m1.mmtype == scammer.HPAV_MMTYPES['CM_GET_KEY_REQ']:
+ security_ok = self.__check_security (m1, m2)
+ result_ok = m1.result == m2.result
+ nid_ok = m1.nid == m2.nid
+ eks_ok = m1.eks == m2.eks
+ if not result_ok:
+ print "Result is wrong."
+ if not nid_ok:
+ print "NID is wrong."
+ if not eks_ok:
+ print "EKS is wrong."
+ return security_ok and result_ok and nid_ok and eks_ok
+ elif m1.mmtype == scammer.HPAV_MMTYPES['CM_GET_KEY_CNF']:
+ security_ok = self.__check_security (m1, m2)
+ nid_ok = m1.nid == m2.nid
+ eks_ok = m1.eks == m2.eks
+ if not nid_ok:
+ print "NID is wrong."
+ if not eks_ok:
+ print "EKS is wrong."
+ return security_ok and nid_ok and eks_ok
+ else:
+ return str (m1) == str (m2)
+
+ def __protocol_exchange_check_lists (self, protocollist, mmelist):
+ """Check the MME list with the one defined."""
+ # At this point we have two list with sniffed MME Scammer types.
+ index_protocol = 0
+ index_mmelist = 0
+ repeat = 0
+ # Count the number of MMEs expected.
+ mme_nb = 0
+ for i in protocollist:
+ mme_nb += i[1]
+ i = 0
+ while index_protocol < len (protocollist) \
+ and index_mmelist < len (mmelist):
+ [mme, repeat_new] = protocollist[index_protocol]
+ if repeat == 0:
+ repeat = repeat_new
+ m1 = scammer.get_sniffed_mme (mme)
+ m2 = scammer.get_sniffed_mme (mmelist[index_mmelist])
+ if m1.mmtype == m2.mmtype:
+ if not self.__protocol_exchange_check_mmes (m1, m2):
+ self.error (m1, m2)
+ return False
+ repeat = repeat - 1
+ if repeat == 0:
+ # All repetition of the MME have been received.
+ index_protocol += 1
+ index_mmelist += 1
+ else:
+ repeat = 0
+ index_protocol += 1
+ if index_protocol == len (protocollist):
+ return True
+ else:
+ print "Expected missing MMEs"
+ while index_protocol < len (protocollist):
+ [mme, repeat_new] = protocollist[index_protocol]
+ m1 = scammer.get_sniffed_mme (mme)
+ print scammer.HPAV_MMTYPES_REVERSE[m1.mmtype]
+ index_protocol += 1
+ return False
+
+ def protocol_exchange_check (self, mme_list):
+ """Verify the protocol exchange.
+ - mme_list: The sniffer MME list from cesar sniffer.
+ return: True if the protocol is correct, false otherwise.
+ """
+ # For now only process VS_SNIFFER.INF with MME embedded.
+ mme_embed_list_tx = list ()
+ mme_embed_list_rx = list ()
+ ok_tx = False
+ ok_rx = False
+ for i in mme_list:
+ if len (i.get ()) >= 14:
+ m = Ether (i.get ())
+ if m.mmtype == scammer.HPAV_MMTYPES ['VS_SNIFFER_IND'] \
+ and m.sniff_type == 0 \
+ and scammer.get_sniffed_mme(m).mmtype \
+ != scammer.HPAV_MMTYPES ['DRV_STA_STATUS_IND']:
+ if hasattr (m, 'load'):
+ del (m.load)
+ if m.direction == 0:
+ mme_embed_list_tx.append (m)
+ else:
+ mme_embed_list_rx.append (m)
+ ok_tx = self.__protocol_exchange_check_lists (self.protocol_tx,
+ mme_embed_list_tx)
+ if ok_tx:
+ ok_rx = self.__protocol_exchange_check_lists (self.protocol_rx,
+ mme_embed_list_rx)
+ return ok_tx and ok_rx
+
+# Do not add executable code in the script.
diff --git a/cesar/test_general/station/scenario/py/testtemplate.py b/cesar/test_general/station/scenario/py/testtemplate.py
new file mode 100644
index 0000000000..664cbd4da4
--- /dev/null
+++ b/cesar/test_general/station/scenario/py/testtemplate.py
@@ -0,0 +1,42 @@
+#!/usr/bin/python
+
+#############################################################################
+# Copyright (C) 2011 Spidcom
+#############################################################################
+
+import sys
+sys.path.append ('py')
+from scenario_init import *
+
+class Test... (unittest.TestCase):
+ """Test description, the scenario tested for example ->
+ Test the communication between two station in an AVLN with noise on the
+ medium.
+ """
+
+ def setUp (self):
+ """Set up the test scenario.
+ This function is called before each test function define bellow."""
+ pass
+
+ def tearDown (self):
+ """Tear down the test scenario.
+ This function is called at the end of each test function define
+ bellow."""
+
+ def testA (self):
+ """Test description in rst format.
+
+ Excepted results: ....
+ """
+
+ def testB (self):
+ """Test description in rst format.
+
+ Excepted results: ....
+ """
+
+if __name__ == '__main__':
+ suite = unittest.TestLoader().loadTestsFromTestCase(Test...)
+ testResult = unittest.TextTestRunner(verbosity=2).run(suite)
+ sys.exit ((1, 0)[testResult.wasSuccessful ()])
diff --git a/cesar/test_general/station/scenario/testbook.py b/cesar/test_general/station/scenario/testbook.py
new file mode 100644
index 0000000000..5003948800
--- /dev/null
+++ b/cesar/test_general/station/scenario/testbook.py
@@ -0,0 +1,78 @@
+#!/usr/bin/python
+
+#############################################################################
+# Copyright (C) 2011 Spidcom
+#
+# Parse all scripts to get the test function documentation.
+#############################################################################
+
+import sys
+import inspect
+import re
+sys.path.append ('py')
+
+class TestFunctionDocumentation:
+ """Documentation of a function."""
+
+ def __init__ (self, name, doc):
+ """Initialise the function documentation object with the name of the
+ function and the documentation associated.
+ """
+ self.name = name
+ self.doc = doc
+
+class TestDocumentation:
+ """A test documentation object."""
+
+ def __init__ (self, name, doc):
+ """Initialise the test documentation object with a name."""
+ self.name = name
+ self.documentation = doc
+ self.doc = list ()
+
+ def add_doc (self, function_name, function_doc):
+ """Add a documentation of test function."""
+ d = TestFunctionDocumentation (function_name, function_doc)
+ self.doc.append (d)
+
+ def test_book_format (self):
+ """Format the object to be written in a test book in RST language."""
+ titlefmt = re.sub ('.', '-', self.name)
+ titledoc = re.sub (r'(?m)^[\t ]+', '', self.documentation)
+ string = "%s\n%s\n\n%s" % (self.name, titlefmt, titledoc)
+ # Format each function documentation.
+ for i in self.doc:
+ functitlefmt = re.sub ('.', '~', i.name)
+ functitledoc = re.sub (r'(?m)^[\t ]{8}', '', i.doc)
+ string += "\n\n%s\n%s\n\n%s" \
+ % (i.name, functitlefmt, functitledoc)
+ return string
+
+if __name__ == "__main__":
+ classtest = list ()
+ for i in sys.argv[1:]:
+ pyfile = i.replace ('.py', '')
+ pyfile = pyfile.replace ('py/', '')
+ scnum = re.search ('sc([0-9]*)_', pyfile).group (1)
+ # Import scenario script file.
+ c = __import__ (pyfile)
+ # Search in the imported module c, the members of the module starting with
+ # Test. It will only search Test classes.
+ for name, obj in inspect.getmembers (c):
+ if inspect.isclass (obj) and name.startswith ('Test'):
+ # Instantiate a testDocumentation object with the class test name
+ # and documentation.
+ d = TestDocumentation ("Scenario %s - %s" % (scnum, name),
+ obj.__doc__)
+ classtest.append (d)
+ # Find documentation in methods starting with test.
+ for fname, fobj in inspect.getmembers (obj):
+ if inspect.ismethod (fobj) \
+ and fname.startswith ('test'):
+ # Add function name and documentation method to
+ # testDocumentation object.
+ d.add_doc (fname, fobj.__doc__)
+
+ # Generate the test book in rst format.
+ for i in classtest:
+ print i.test_book_format ()