summaryrefslogtreecommitdiff
path: root/cesar/bsu/test
diff options
context:
space:
mode:
authorlaranjeiro2010-07-22 08:40:45 +0000
committerlaranjeiro2010-07-22 08:40:45 +0000
commitdf052ada107010e544918a6319db94762ea08476 (patch)
treedba5911528cce1aa7a6b1f225ac821e6d4477d92 /cesar/bsu/test
parent0665ce40cb403c93eb131e48ea4972588ed11386 (diff)
cesar/bsu: add CSMA only verification
If a central beacon is received with a schedule which is not persistent, replace it by a permanent schedule with only a CSMA SAI. git-svn-id: svn+ssh://pessac/svn/cesar/trunk@7306 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'cesar/bsu/test')
-rw-r--r--cesar/bsu/test/utest/src/schedules.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/cesar/bsu/test/utest/src/schedules.c b/cesar/bsu/test/utest/src/schedules.c
index 4ca917f3a7..a18ceb6527 100644
--- a/cesar/bsu/test/utest/src/schedules.c
+++ b/cesar/bsu/test/utest/src/schedules.c
@@ -18,6 +18,7 @@
#include "bsu/inc/bsu.h"
#include "bsu/inc/context.h"
#include "bsu/inc/interface.h"
+#include <string.h>
void
bsu_schedules_merge (bsu_t *ctx, bsu_beacon_schedules_t *avln,
@@ -223,9 +224,63 @@ test_case_bsu_schedules_countdowns (test_t t)
}
void
+test_case_ca_schedules_intellon (test_t test)
+{
+ test_case_begin (test, "Intellon central beacons");
+ test_begin (
+ test, "Persistent schedule valid for the current beacon period")
+ {
+ bsu_test_t t;
+ bsu_test_init (&t);
+ bsu_beacon_t beacon;
+ pb_beacon_t *pbbeacon;
+ bsu_test_create_beacon (&t, &beacon);
+ beacon.bmis.nps.ns = 0;
+ beacon.bmis.ps.nb = 1;
+ beacon.bmis.ps.ps[0].ns = 1;
+ beacon.bmis.ps.ps[0].pscd = 0;
+ beacon.bmis.ps.ps[0].cscd = 0;
+ beacon.bmis.ps.ps[0].sais[0].stpf = true;
+ beacon.bmis.ps.ps[0].sais[0].start_time_atu = 52;
+ beacon.bmis.ps.ps[0].sais[0].end_time_atu = 3907;
+ beacon.bmis.ps.ps[0].sais[0].glid = MAC_LID_SHARED_CSMA & 0x7f;
+ uint i;
+ for (i = 0; i < COUNT (t.bsu->aclf->bpsd); i++)
+ t.bsu->aclf->bpsd[i] = i * BSU_ACLF_BP_50HZ_TCK;
+ t.bsu->aclf->beacon_period = BSU_ACLF_BP_50HZ_TCK;
+ *((uint*) &t.bsu->aclf->bp) = BSU_ACLF_BP_50HZ_TCK;
+ pbproc_tx_beacon_params_t btx;
+ pbproc_rx_beacon_params_t brx;
+ memset (&brx, 0, sizeof (pbproc_rx_beacon_params_t));
+ pbbeacon = bsu_beacon_write (
+ &beacon, BSU_BEACON_TYPE_CENTRAL, &t.mac_config, &btx);
+ pbbeacon->phy_pb.pb_rx.pb_measurement.crc_error = false;
+ bsu_track_avln (beacon.vf.nid, brx.snid, 0, beacon.vf.nm);
+ t.bsu->is_sta = BSU_UPDATE_STA_TYPE_STA;
+ bsu_beacon_process (t.bsu, pbbeacon, &brx);
+ /* Schedules which should be present. */
+ test_fail_unless (t.bsu->sta_avln->bs.schedules.ps.nb == 1);
+ test_fail_unless (t.bsu->sta_avln->bs.schedules.ps.ps[0].pscd == 7);
+ test_fail_unless (t.bsu->sta_avln->bs.schedules.ps.ps[0].cscd == 7);
+ test_fail_unless (
+ t.bsu->sta_avln->bs.schedules.ps.ps[0].sais[0].glid ==
+ (MAC_LID_SHARED_CSMA & 0x7f));
+ test_fail_unless (
+ t.bsu->sta_avln->bs.schedules.ps.ps[0].sais[0].end_time_atu ==
+ 3907);
+ test_fail_unless (
+ t.bsu->sta_avln->bs.schedules.ps.ps[0].sais[0].stpf == false);
+ blk_release_desc ((blk_t*) pbbeacon);
+ bsu_test_uninit (&t);
+ }
+ test_end;
+}
+
+void
test_suite_bsu_schedule (test_t t)
{
test_suite_begin (t, "BSU schedules");
test_case_ca_schedules (t);
test_case_bsu_schedules_countdowns (t);
+ test_case_ca_schedules_intellon (t);
}