summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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
-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
-rw-r--r--cleopatre/Makefile5
-rwxr-xr-xcleopatre/application/fw_wd/S99fwwatchd43
-rwxr-xr-xcleopatre/application/fw_wd/S99trace64
-rwxr-xr-xcleopatre/application/fw_wd/fwwatchd81
-rw-r--r--cleopatre/application/fw_wd/fwwatchd.default (renamed from cleopatre/application/fw_wd/trace)16
-rw-r--r--cleopatre/application/libmme/Module1
-rw-r--r--cleopatre/application/libmme/src/mme.c10
-rw-r--r--cleopatre/application/libspid/Module6
-rw-r--r--cleopatre/application/libspid/src/analog_alarm_eoc.c5
-rw-r--r--cleopatre/application/libspid/src/autoconf_eoc.c6
-rw-r--r--cleopatre/application/libspid/src/config_item.c4
-rw-r--r--cleopatre/application/libspid/src/config_line.c11
-rw-r--r--cleopatre/application/libspid/src/current_alarm_eoc.c5
-rw-r--r--cleopatre/application/libspid/src/discrete_alarm_eoc.c5
-rw-r--r--cleopatre/application/libspid/src/image.c7
-rw-r--r--cleopatre/application/libspid/src/master_config_eoc.c8
-rw-r--r--cleopatre/application/libspid/src/misc.c4
-rw-r--r--cleopatre/application/libspid/src/misc_eoc.c12
-rw-r--r--cleopatre/application/libspid/src/port_eoc.c23
-rw-r--r--cleopatre/application/libspid/src/secu.c2
-rw-r--r--cleopatre/application/libspid/src/service_eoc.c32
-rw-r--r--cleopatre/application/libspid/src/system.c33
-rw-r--r--cleopatre/application/libspid/src/upgrade_eoc.c9
-rw-r--r--cleopatre/application/libspid/src/wl_eoc.c36
-rw-r--r--cleopatre/application/managerd/Module2
-rw-r--r--cleopatre/application/managerd/inc/bridge.h1
-rw-r--r--cleopatre/application/managerd/inc/managerd.h1
-rw-r--r--cleopatre/application/managerd/inc/vs_mme.h2
-rw-r--r--cleopatre/application/managerd/src/managerd.c19
-rw-r--r--cleopatre/application/managerd/src/mme_nl.c7
-rw-r--r--cleopatre/application/managerd/src/vs_mme.c10
-rw-r--r--cleopatre/application/upnpd/src/.upnpd.c.swpbin16384 -> 0 bytes
-rw-r--r--cleopatre/buildroot/package/fw_wd/fw_wd.mk18
-rwxr-xr-xcleopatre/buildroot/target/device/Spidcom/scr310/target_skeleton/etc/init.d/S30plc2
-rwxr-xr-xcleopatre/buildroot/target/device/Spidcom/spk300/target_skeleton/etc/init.d/S30plc2
-rwxr-xr-xcleopatre/buildroot/target/device/Spidcom/spk300g/target_skeleton/etc/init.d/S30plc2
-rwxr-xr-xcleopatre/buildroot/target/device/Spidcom/spk310/target_skeleton/etc/init.d/S30plc2
-rwxr-xr-xcleopatre/buildroot/target/device/Spidcom/spr300/target_skeleton/etc/init.d/S30plc2
-rwxr-xr-xcleopatre/buildroot/target/device/Spidcom/spr310/target_skeleton/etc/init.d/S30plc2
-rw-r--r--cleopatre/devkit/doc/cleopatre_mme_specs.odtbin199528 -> 199558 bytes
-rw-r--r--cleopatre/devkit/plcd/src/plcd_main.c15
-rw-r--r--cleopatre/devkit/plcdrv/arm/Module1
-rw-r--r--cleopatre/devkit/plcdrv/arm/inc/common.h4
-rw-r--r--cleopatre/devkit/plcdrv/arm/inc/hal.h6
-rw-r--r--cleopatre/devkit/plcdrv/arm/inc/linux_drv.h13
-rw-r--r--cleopatre/devkit/plcdrv/arm/inc/mailbox.h2
-rw-r--r--cleopatre/devkit/plcdrv/arm/inc/processing.h4
-rw-r--r--cleopatre/devkit/plcdrv/arm/src/boot_params.c41
-rw-r--r--cleopatre/devkit/plcdrv/arm/src/hal.c11
-rw-r--r--cleopatre/devkit/plcdrv/arm/src/linux_drv.c314
-rw-r--r--cleopatre/devkit/plcdrv/arm/src/mailbox.c17
-rw-r--r--cleopatre/devkit/plcdrv/arm/src/processing.c43
-rw-r--r--cleopatre/devkit/tests/common/Makefile46
-rw-r--r--cleopatre/devkit/tests/fw_wd/Makefile15
-rwxr-xr-xcleopatre/devkit/tests/fw_wd/run-test248
-rw-r--r--cleopatre/devkit/tests/hal/gidel/ftests/Makefile34
-rw-r--r--cleopatre/devkit/tests/hal/gidel/ftests/src/start.cpp139
-rw-r--r--cleopatre/devkit/tests/hal/gidel/ftests/src/start2.cpp117
-rw-r--r--cleopatre/devkit/tests/hal/gidel/ftests/src/start3.cpp137
-rw-r--r--cleopatre/devkit/tests/kernel/drivers/gpio/ftests/interrupt/Makefile35
-rw-r--r--cleopatre/devkit/tests/kernel/drivers/gpio/ftests/module/Kbuild4
-rw-r--r--cleopatre/devkit/tests/kernel/drivers/gpio/ftests/module/Makefile53
-rw-r--r--cleopatre/devkit/tests/kernel/drivers/gpio/ftests/user/Makefile35
-rw-r--r--cleopatre/devkit/tests/libmme/utests/Makefile22
-rw-r--r--cleopatre/devkit/tests/libmme/utests/src/mme_utests.c68
-rw-r--r--cleopatre/devkit/tests/libspid/ftests/Makefile38
-rw-r--r--cleopatre/devkit/tests/libspid/ftests/src/spidlib_ftests.c (renamed from cleopatre/devkit/tests/libspid/ftests/spidlib_ftests.c)0
-rw-r--r--cleopatre/devkit/tests/libspid/utests/Makefile46
-rw-r--r--cleopatre/devkit/tests/libspid/utests/inc/config_item_utests.h12
-rw-r--r--cleopatre/devkit/tests/libspid/utests/inc/config_line_utests.h5
-rw-r--r--cleopatre/devkit/tests/libspid/utests/inc/image_utests.h4
-rw-r--r--cleopatre/devkit/tests/libspid/utests/inc/network_utests.h6
-rw-r--r--cleopatre/devkit/tests/libspid/utests/inc/system_utests.h13
-rw-r--r--cleopatre/devkit/tests/libspid/utests/override/Module1
-rw-r--r--cleopatre/devkit/tests/libspid/utests/override/inc/eoc_utests.h (renamed from cleopatre/devkit/tests/libspid/utests/inc/eoc_utests.h)0
-rw-r--r--cleopatre/devkit/tests/libspid/utests/override/src/port_eoc_stub.c (renamed from cleopatre/devkit/tests/libspid/utests/stubs/port_eoc_stubs.c)0
-rw-r--r--cleopatre/devkit/tests/libspid/utests/override/src/service_eoc_stub.c (renamed from cleopatre/devkit/tests/libspid/utests/stubs/service_eoc_stubs.c)0
-rw-r--r--cleopatre/devkit/tests/libspid/utests/override/src/wl_eoc_stub.c (renamed from cleopatre/devkit/tests/libspid/utests/stubs/wl_eoc_stubs.c)0
-rw-r--r--cleopatre/devkit/tests/libspid/utests/src/analog_alarm_eoc_utests.c18
-rw-r--r--cleopatre/devkit/tests/libspid/utests/src/autoconf_eoc_utests.c209
-rw-r--r--cleopatre/devkit/tests/libspid/utests/src/config_item_utests.c6
-rw-r--r--cleopatre/devkit/tests/libspid/utests/src/config_line_utests.c42
-rw-r--r--cleopatre/devkit/tests/libspid/utests/src/current_alarm_eoc_utests.c14
-rw-r--r--cleopatre/devkit/tests/libspid/utests/src/discrete_alarm_eoc_utests.c20
-rw-r--r--cleopatre/devkit/tests/libspid/utests/src/hpav_info_utests.c3
-rw-r--r--cleopatre/devkit/tests/libspid/utests/src/image_utests.c9
-rw-r--r--cleopatre/devkit/tests/libspid/utests/src/master_config_eoc_utests.c16
-rw-r--r--cleopatre/devkit/tests/libspid/utests/src/misc_eoc_utests.c196
-rw-r--r--cleopatre/devkit/tests/libspid/utests/src/network_utests.c4
-rw-r--r--cleopatre/devkit/tests/libspid/utests/src/port_eoc_utests.c20
-rw-r--r--cleopatre/devkit/tests/libspid/utests/src/service_eoc_utests.c34
-rw-r--r--cleopatre/devkit/tests/libspid/utests/src/system_utests.c107
-rw-r--r--cleopatre/devkit/tests/libspid/utests/src/tonemap_snr_eoc_utests.c236
-rw-r--r--cleopatre/devkit/tests/libspid/utests/src/upgrade_eoc_utests.c258
-rw-r--r--cleopatre/devkit/tests/libspid/utests/src/wl_eoc_utests.c207
-rw-r--r--cleopatre/devkit/tests/managerd/ftests/Makefile32
-rw-r--r--cleopatre/devkit/tests/managerd/utests/Makefile102
-rw-r--r--cleopatre/devkit/tests/managerd/utests/override/Module1
-rw-r--r--cleopatre/devkit/tests/managerd/utests/override/inc/stub.h46
-rw-r--r--cleopatre/devkit/tests/managerd/utests/override/src/libmme_stub.c340
-rw-r--r--cleopatre/devkit/tests/managerd/utests/override/src/libspid_stub.c219
-rw-r--r--cleopatre/devkit/tests/managerd/utests/override/src/misc_stub.c43
-rw-r--r--cleopatre/devkit/tests/managerd/utests/src/vs_eoc_mme_utests.c42
-rw-r--r--cleopatre/devkit/tests/managerd/utests/src/vs_mme_utests.c105
-rw-r--r--cleopatre/devkit/tests/plcd/Makefile25
-rw-r--r--cleopatre/devkit/tests/plcd/inc/check_event.h24
-rwxr-xr-xcleopatre/devkit/tests/plcd/inc/eoc_utests.h32
-rw-r--r--cleopatre/devkit/tests/plcd/inc/hpav_utests.h43
-rw-r--r--cleopatre/devkit/tests/plcd/inc/plcd_utests.h43
-rw-r--r--cleopatre/devkit/tests/plcd/inc/stub.h20
-rwxr-xr-xcleopatre/devkit/tests/plcd/src/eoc_utests.c198
-rw-r--r--cleopatre/devkit/tests/plcd/src/event_utests.c777
-rw-r--r--cleopatre/devkit/tests/plcd/src/hpav_utests.c375
-rw-r--r--cleopatre/devkit/tests/plcd/src/plcd_utests.c132
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/ftests/lo_ecos/Makefile2
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/ftests/lo_ecos/src/loopback.c4
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/ftests/wd_leon/Makefile38
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/utests/Makefile26
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/utests/inc/linux_drv_utests.h176
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/utests/inc/mailbox_utests.h5
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/utests/src/hal_utests.c3
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/Module2
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/asm/arch/hardware/regbank.h13
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/asm/arch/nvram.h37
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/afe.h8
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/asm.h70
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/bitops.h6
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/capability.h14
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/cdev.h22
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/compiler.h8
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/delay.h6
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/device.h6
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/dma-mapping.h28
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/errno.h12
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/file.h6
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/fs.h125
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/gfp.h10
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/if.h8
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/if_ether.h17
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/if_vlan.h20
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/init.h11
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/interrupt.h38
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/irqreturn.h9
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/kdev_t.h11
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/kernel.h34
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/list.h71
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/module.h13
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/moduleparam.h6
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/mutex.h30
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/netdevice.h92
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/netlink.h84
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/path.h12
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/poll.h20
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/proc_fs.h29
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/rcupdate.h9
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/sched.h10
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/skbuff.h45
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/socket.h18
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/spinlock.h35
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/types.h23
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/wait.h32
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/net/net_namespace.h55
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/net/seq_check.h28
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/net/sock.h13
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/src/af_netlink.c24
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/src/afe.c6
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/src/bitops.c6
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/src/char_dev.c26
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/src/delay.c6
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/src/dma.c25
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/src/eth.c12
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/src/ioremap.c10
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/src/irq_manage.c12
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/src/mutex.c11
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/src/net_dev.c42
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/src/softirq.c15
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/src/uaccess.c32
-rw-r--r--cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/src/wait.c7
-rw-r--r--cleopatre/devkit/tests/plcdrv/gidel/ftests/.exrc74
-rw-r--r--cleopatre/devkit/tests/plcdrv/gidel/ftests/Makefile7
-rw-r--r--cleopatre/devkit/tests/plcdrv/gidel/ftests/lo_ecos/Config2
-rw-r--r--cleopatre/devkit/tests/plcdrv/gidel/ftests/lo_ecos/Makefile13
-rw-r--r--cleopatre/devkit/tests/plcdrv/gidel/ftests/lo_ecos/Makefile_debug30
-rw-r--r--cleopatre/devkit/tests/plcdrv/gidel/ftests/lo_ecos/common.h26
-rw-r--r--cleopatre/devkit/tests/plcdrv/gidel/ftests/lo_ecos/ecos.ecc.sh5
-rw-r--r--cleopatre/devkit/tests/plcdrv/gidel/ftests/lo_ecos/src/loopback.c117
-rw-r--r--cleopatre/devkit/tests/plcdrv/gidel/htests/Makefile43
-rw-r--r--cleopatre/devkit/tests/plcdrv/gidel/htests/src/hal_htests.cpp270
-rw-r--r--cleopatre/devkit/tests/plcdrv/gidel/htests/src/mbx_htests.cpp109
-rw-r--r--cleopatre/devkit/tests/plcdrv/gidel/utests/Makefile7
-rw-r--r--cleopatre/devkit/tests/plcdrv/gidel/utests/inc/hal_stub.h507
-rw-r--r--cleopatre/devkit/tests/plcdrv/gidel/utests/inc/hard_stub.h52
-rw-r--r--cleopatre/devkit/tests/plcdrv/gidel/utests/inc/mailbox_stub.h60
-rw-r--r--cleopatre/devkit/tests/plcdrv/gidel/utests/inc/plc_drv_stub.h38
-rw-r--r--cleopatre/devkit/tests/plcdrv/gidel/utests/inc/processing_stub.h102
-rw-r--r--cleopatre/devkit/tests/plcdrv/gidel/utests/src/hal_utests.cpp430
-rw-r--r--cleopatre/devkit/tests/plcdrv/gidel/utests/src/mailbox_utests.c232
-rw-r--r--cleopatre/devkit/tests/plcdrv/gidel/utests/src/plc_drv_utests.c122
-rw-r--r--cleopatre/devkit/tests/plcdrv/gidel/utests/src/processing_utests.c43
-rw-r--r--cleopatre/devkit/tests/utests_makerules70
-rw-r--r--cleopatre/linux-2.6.25.10-spc300/arch/arm/boot/Makefile2
-rw-r--r--cleopatre/linux-2.6.25.10-spc300/drivers/net/arm/synop3504.c8
-rw-r--r--cleopatre/u-boot-1.1.6/.gitignore1
-rw-r--r--common/lib/scammer/__init__.py10
-rw-r--r--common/lib/scammer/beacon.py379
-rw-r--r--common/lib/scammer/cc.py189
-rw-r--r--common/lib/scammer/cm.py187
-rw-r--r--common/lib/scammer/common.py72
-rw-r--r--common/lib/scammer/commonfields.py107
-rw-r--r--common/lib/scammer/cp.py10
-rw-r--r--common/lib/scammer/drv.py140
-rw-r--r--common/lib/scammer/nn.py9
-rw-r--r--common/lib/scammer/scammer.py53
-rw-r--r--common/lib/scammer/vs.py109
-rw-r--r--common/tests/Makefile (renamed from cesar/common/tests/Makefile)0
-rwxr-xr-xcommon/tests/get-cov.pl (renamed from cesar/common/tests/get-cov.pl)0
-rwxr-xr-xcommon/tests/run-test.pl (renamed from cesar/common/tests/run-test.pl)0
-rw-r--r--common/tests/tests (renamed from cesar/common/tests/tests)293
-rwxr-xr-xvalidation/test/test.py10
-rw-r--r--validation/test/test_bench.diabin0 -> 5787 bytes
-rw-r--r--validation/test/test_io_group.py20
-rw-r--r--validation/test/test_power_strip.py20
-rw-r--r--validation/test/test_spc300.py199
-rw-r--r--validation/validlib/__init__.py0
-rw-r--r--validation/validlib/anellib.py103
-rw-r--r--validation/validlib/attenuator.py106
-rw-r--r--validation/validlib/io_group.py43
-rw-r--r--validation/validlib/link.py36
-rw-r--r--validation/validlib/power_strip.py44
-rw-r--r--validation/validlib/spc300.py144
330 files changed, 8096 insertions, 12637 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/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 ()
diff --git a/cleopatre/Makefile b/cleopatre/Makefile
index ff8fc65cb4..9a12aaf96b 100644
--- a/cleopatre/Makefile
+++ b/cleopatre/Makefile
@@ -50,7 +50,7 @@ BUILDROOT_GIT_PATH=$(CURDIR)/buildroot
BUILDROOT_PATH=$(BUNDLE_COMPILE_PATH)/buildroot
UBOOT_NAME=u-boot.bin
UBOOT_PATH=$(BUNDLE_COMPILE_PATH)/u-boot-$(UBOOT_VERSION)
-FLASHFS_NAME=flashfs
+FLASHFS_NAME=flashfs.jffs2
FLASHFS_PATH=$(BUNDLE_COMPILE_PATH)/tools/flashfs
##################################################################
@@ -101,6 +101,7 @@ bundle-standalone:
$(Q)git checkout-index --prefix=$(BUNDLE_PATH)/ -a -q
$(Q)mv $(BUNDLE_PATH)/cleopatre $(BUNDLE_COMPILE_PATH)
$(Q)rm -rf $(BUNDLE_PATH)/.git
+ $(Q)find $(BUNDLE_COMPILE_PATH)/application/ -name Module -exec rm -f '{}' ';'
$(Q)sed -i -e 's/\(BUNDLE_VERSION_GIT *= *\)\(.*\)/\1$(BUNDLE_VERSION)/' $(BUILDROOT_PATH)/target/device/Spidcom/Makefile.in
$(Q)sed -i -e 's/\(EXTRAVERSION *= *\)\(.*\)/\1-$(BUNDLE_VERSION)/' $(BUNDLE_COMPILE_PATH)/u-boot-1.1.6/Makefile
$(Q)echo -n "$(BUNDLE_VERSION)" | sed -e 's/\(.\{16\}\).*/\1/' > $(BUILDROOT_PATH)/.version
@@ -182,5 +183,5 @@ linux:
flashfs:
$(MAKE) -C $(FLASHFS_PATH)
- cp $(FLASHFS_PATH)/$(FLASHFS_NAME).jffs2 $(BUNDLE_GENBIN_PATH)/
+ cp $(FLASHFS_PATH)/$(FLASHFS_NAME) $(BUNDLE_GENBIN_PATH)/$(FLASHFS_NAME)
diff --git a/cleopatre/application/fw_wd/S99fwwatchd b/cleopatre/application/fw_wd/S99fwwatchd
new file mode 100755
index 0000000000..cb0000edfd
--- /dev/null
+++ b/cleopatre/application/fw_wd/S99fwwatchd
@@ -0,0 +1,43 @@
+#!/bin/sh
+#
+# Start the fwwatchd daemon...
+#
+
+DAEMON=/usr/bin/fwwatchd
+PIDFILE=/var/run/fwwatchd.pid
+
+test -f $DAEMON || exit 0
+
+start() {
+ echo "Starting fwwatchd..."
+ $DAEMON &
+ echo $! > $PIDFILE
+}
+stop() {
+ echo "Stopping fwwatchd..."
+ if [ -r $PIDFILE ]
+ then
+ kill $(cat $PIDFILE)
+ fi
+}
+restart() {
+ stop
+ start
+}
+
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ restart|reload)
+ restart
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|restart}"
+ exit 1
+esac
+
+exit $?
diff --git a/cleopatre/application/fw_wd/S99trace b/cleopatre/application/fw_wd/S99trace
deleted file mode 100755
index fee0a1cf94..0000000000
--- a/cleopatre/application/fw_wd/S99trace
+++ /dev/null
@@ -1,64 +0,0 @@
-#!/bin/sh
-
-# Do not get trace from firmware and keep them compressed.
-TRACE_ENABLED=false
-# Reboot automatically after getting trace.
-TRACE_REBOOT=true
-# Trace folder.
-TRACE_FOLDER=/usr/local/trace/
-# Trace basename.
-TRACE_BASENAME=trace_
-# Header of the last trace, uncompressed.
-TRACE_HEADER_PATH=${TRACE_FOLDER}/last_head_trace.txt
-# Number of lines to store in the uncompressed trace.
-TRACE_HEADER_LINE=3
-
-# Load personnalize preferences.
-test -f /etc/default/trace && . /etc/default/trace
-
-# Do not continue if disabled.
-test $TRACE_ENABLED = true || exit 1
-
-# Ensure trace folder is created.
-mkdir -p $TRACE_FOLDER || exit 1
-
-# Get list of traces, sort them (by the last number)
-# and handle case where there are no traces.
-last_trace=$(ls -1 $TRACE_FOLDER/$TRACE_BASENAME[0-9]*.gz 2>/dev/null | sort \
--n -k 2 -t _ | tail -n 1)
-# No trace file found.
-if [[ -z $last_trace ]];
-then
- # Start at 1.
- new_trace_digit=1
-else
- # Remove prefix & suffix.
- new_trace_digit=${last_trace##$TRACE_FOLDER/$TRACE_BASENAME}
- new_trace_digit=${new_trace_digit%%.gz}
- # Get trace + 1.
- new_trace_digit=$(expr $new_trace_digit + 1)
-fi
-
-# Sleep for the watchdog, get trace (uncompressed, then compressed), get files
-# and execute commands and reboot if required.
-(fw_wd && \
- rm -f ${TRACE_HEADER_PATH} && \
- head -n ${TRACE_HEADER_LINE} /dev/trace > ${TRACE_HEADER_PATH} && \
- echo "Full trace available in ${TRACE_FOLDER}/${TRACE_BASENAME}${new_trace_digit}.gz" \
- >> ${TRACE_HEADER_PATH} && \
- (head -n ${TRACE_HEADER_LINE} ${TRACE_FOLDER}/last_head_trace.txt && \
- cat /dev/trace && \
- IFSOLD=$IFS
- IFS=":" && for i in $TRACE_FILES
- do
- IFS=$IFSOLD
- test -f "$i" && echo "==== $i ====" && cat "$i" && echo ""
- done
- IFS=":" && for i in $TRACE_CMDS
- do
- IFS=$IFSOLD
- echo "==== $i ====" && $i && echo ""
- done
- ) | gzip -c \
- > ${TRACE_FOLDER}/${TRACE_BASENAME}${new_trace_digit}.gz \
- && test $TRACE_REBOOT = true && reboot) &
diff --git a/cleopatre/application/fw_wd/fwwatchd b/cleopatre/application/fw_wd/fwwatchd
new file mode 100755
index 0000000000..1c8d743ce5
--- /dev/null
+++ b/cleopatre/application/fw_wd/fwwatchd
@@ -0,0 +1,81 @@
+#!/bin/sh
+
+# Authorize automatic system reboot on watchdog expiration.
+REBOOT=true
+# Do not get trace from firmware and keep them compressed.
+TRACE_ENABLED=false
+# Trace folder.
+TRACE_FOLDER=/usr/local/trace/
+# Trace basename.
+TRACE_BASENAME=trace_
+# Header of the last trace, uncompressed.
+TRACE_HEADER_PATH=${TRACE_FOLDER}/last_head_trace.txt
+# Trace currently dumped, will be moved once finished.
+TRACE_DUMPING_PATH=${TRACE_FOLDER}/last_trace_dumping.gz
+# Number of lines to store in the uncompressed trace.
+TRACE_HEADER_LINE=3
+
+# Load personnalize preferences.
+test -f /etc/default/fwwatchd && . /etc/default/fwwatchd
+
+# Do not continue if nothing to do.
+test $TRACE_ENABLED = true || exit 1
+
+# Dump all information to be stored in trace.
+dump_trace () {
+ tail -n +2 ${TRACE_FOLDER}/last_head_trace.txt
+ cat /dev/trace
+ IFSOLD=$IFS
+ IFS=":" && for i in $TRACE_FILES; do
+ IFS=$IFSOLD
+ test -f "$i" && echo "==== $i ====" && cat "$i" && echo ""
+ done
+ IFS=":" && for i in $TRACE_CMDS; do
+ IFS=$IFSOLD
+ echo "==== $i ====" && $i && echo ""
+ done
+ IFS=$IFSOLD
+}
+
+# Get all trace information and store it on file system.
+get_trace () {
+ test $TRACE_ENABLED = true || return 0
+
+ # Ensure trace folder is created.
+ mkdir -p $TRACE_FOLDER || return 1
+
+ # Get list of traces, sort them (by the last number)
+ # and handle case where there are no traces.
+ last_trace=$(ls -1 $TRACE_FOLDER/$TRACE_BASENAME[0-9]*.gz 2>/dev/null \
+ | sort -n -k 2 -t _ | tail -n 1)
+ # No trace file found.
+ if [[ -z $last_trace ]]; then
+ # Start at 1.
+ new_trace_digit=1
+ else
+ # Remove prefix & suffix.
+ new_trace_digit=${last_trace##$TRACE_FOLDER/$TRACE_BASENAME}
+ new_trace_digit=${new_trace_digit%%.gz}
+ # Get trace + 1.
+ new_trace_digit=$(expr $new_trace_digit + 1)
+ fi
+
+ # Get trace (uncompressed, then compressed), get files and execute
+ # commands.
+ new_trace=${TRACE_FOLDER}/${TRACE_BASENAME}${new_trace_digit}.gz
+ echo "Full trace available in $new_trace" > ${TRACE_HEADER_PATH} && \
+ head -n ${TRACE_HEADER_LINE} /dev/trace >> ${TRACE_HEADER_PATH} && \
+ dump_trace | gzip -c > $TRACE_DUMPING_PATH
+ mv $TRACE_DUMPING_PATH $new_trace
+}
+
+# Sleep until watchdog expires, get trace and reboot if requested.
+trap : TERM
+while true; do
+ fw_wd &
+ fw_wd_pid=$!
+ wait $fw_wd_pid || { kill $fw_wd_pid 2>/dev/null; exit 1; }
+ get_trace
+ { test $REBOOT = true && reboot; } || \
+ exit 1
+done
diff --git a/cleopatre/application/fw_wd/trace b/cleopatre/application/fw_wd/fwwatchd.default
index 87195e8f3d..f91e2b14c0 100644
--- a/cleopatre/application/fw_wd/trace
+++ b/cleopatre/application/fw_wd/fwwatchd.default
@@ -1,14 +1,24 @@
-# Configure trace behavior.
+# Configure fwwatchd behavior.
+
+#
+# Life saving procedures.
+#
+
+# Authorize automatic system reboot on watchdog expiration.
+REBOOT=true
+
+#
+# Traces.
+#
# Get trace from firmware and keep them compressed.
TRACE_ENABLED=true
-# Reboot automatically after getting trace.
-TRACE_REBOOT=true
# Where to store compressed traces.
TRACE_FOLDER="/usr/local/trace/"
# List of files to add to trace (separator is ':').
TRACE_FILES="/proc/net/plc/version:/etc/hpav.info:/proc/uptime"
+
# List of commands to get output with traces (separator is ':').
TRACE_CMDS=""
diff --git a/cleopatre/application/libmme/Module b/cleopatre/application/libmme/Module
new file mode 100644
index 0000000000..79021cc954
--- /dev/null
+++ b/cleopatre/application/libmme/Module
@@ -0,0 +1 @@
+SOURCES := mme.c
diff --git a/cleopatre/application/libmme/src/mme.c b/cleopatre/application/libmme/src/mme.c
index 1e66cbd963..aa5b7e9f46 100644
--- a/cleopatre/application/libmme/src/mme.c
+++ b/cleopatre/application/libmme/src/mme.c
@@ -125,7 +125,7 @@ mme_get_free_space (mme_ctx_t *ctx, unsigned int *length)
mme_error_t
mme_push (mme_ctx_t *ctx, const void *data, unsigned int length, unsigned int *result_length)
{
- int free = 0;
+ unsigned int free = 0;
int delta = 0;
/* protect from null pointers */
@@ -189,7 +189,7 @@ mme_push (mme_ctx_t *ctx, const void *data, unsigned int length, unsigned int *r
mme_error_t
mme_put (mme_ctx_t *ctx, const void *data, unsigned int length, unsigned int *result_length)
{
- int free = 0;
+ unsigned int free = 0;
int delta = 0;
/* protect from null pointers */
@@ -379,7 +379,8 @@ mme_send (mme_ctx_t *ctx, mme_send_type_t type, char *iface, unsigned char *dest
struct timeval now;
struct timeval waittime;
int res;
- unsigned int len, result_len;
+ int len;
+ unsigned int result_len;
int i;
int pkt_nfo_sz = sizeof (pkt_info);
mme_error_t ret;
@@ -675,7 +676,8 @@ mme_listen (mme_ctx_t *ctx, char *iface, unsigned char *source, mme_listen_cb_t
struct timeval now;
struct timeval waittime;
int res;
- unsigned int len, result_len;
+ int len;
+ unsigned int result_len;
int pkt_nfo_sz = sizeof (pkt_info);
mme_error_t ret;
int pkt_cnt = 0; /* to indicate if we recive packets in
diff --git a/cleopatre/application/libspid/Module b/cleopatre/application/libspid/Module
new file mode 100644
index 0000000000..01f30b10a2
--- /dev/null
+++ b/cleopatre/application/libspid/Module
@@ -0,0 +1,6 @@
+SOURCES := config_item.c config_line.c hpav_info.c image.c misc.c \
+ multicast_info.c network.c openssl_sha256.c secu.c system.c \
+ analog_alarm_eoc.c autoconf_eoc.c current_alarm_eoc.c \
+ discrete_alarm_eoc.c hardware.c master_config_eoc.c misc_eoc.c \
+ openssl_md5.c port_eoc.c service_eoc.c tonemap_snr_eoc.c upgrade_eoc.c \
+ wl_eoc.c
diff --git a/cleopatre/application/libspid/src/analog_alarm_eoc.c b/cleopatre/application/libspid/src/analog_alarm_eoc.c
index ff5f1c2555..33a0382289 100644
--- a/cleopatre/application/libspid/src/analog_alarm_eoc.c
+++ b/cleopatre/application/libspid/src/analog_alarm_eoc.c
@@ -25,11 +25,6 @@
#include "libspid.h"
-#ifdef __UTESTS__
-#include "eoc_utests.h"
-#endif /* __UTESTS__ */
-
-
/**
* Returns the analog alarm entry for given string with OID.<BR>
* \param OID alarm OID
diff --git a/cleopatre/application/libspid/src/autoconf_eoc.c b/cleopatre/application/libspid/src/autoconf_eoc.c
index 52776e530a..5d9c35cb78 100644
--- a/cleopatre/application/libspid/src/autoconf_eoc.c
+++ b/cleopatre/application/libspid/src/autoconf_eoc.c
@@ -33,10 +33,6 @@
#include "nvram.h"
#include "libmme.h"
-#ifdef __UTESTS__
- #include "eoc_utests.h"
-#endif /* __UTESTS__ */
-
static int
libspid_eoc_autoconf_start (char *mac_address, char *file)
{
@@ -155,7 +151,7 @@ libspid_eoc_autoconf_transfer (char *mac_address, char *file)
/* finish the transfer */
if (psize == 0) break;
- if (psize < LIBSPID_TRANSFER_MAX_SLICE) not_done = 0;
+ if (psize < (int) LIBSPID_TRANSFER_MAX_SLICE) not_done = 0;
/* initialize transfer MME */
ret = mme_init (&request_ctx, MME_TYPE_VS_EOC_AUTOCONF_TRANSFER | MME_TYPE_REQ, snd_buffer, ETH_DATA_LEN);
diff --git a/cleopatre/application/libspid/src/config_item.c b/cleopatre/application/libspid/src/config_item.c
index 9de2affe57..ee58ffd428 100644
--- a/cleopatre/application/libspid/src/config_item.c
+++ b/cleopatre/application/libspid/src/config_item.c
@@ -21,10 +21,6 @@
#include <unistd.h>
#include "libspid.h"
-#ifdef __UTESTS__
- #include "config_item_utests.h"
-#endif /* __UTESTS__ */
-
/**
* Return the values of items from a configuration file.
*
diff --git a/cleopatre/application/libspid/src/config_line.c b/cleopatre/application/libspid/src/config_line.c
index 42545c263a..381643921d 100644
--- a/cleopatre/application/libspid/src/config_line.c
+++ b/cleopatre/application/libspid/src/config_line.c
@@ -43,7 +43,7 @@
* \param delimiters string containing all accepted delimiters
* (usually space and tab characters)
* \param key key of the line to read; updated with the key of
- * the next line
+ * the next line; key buffer size must be LIBSPID_CONFIG_KEY_MAX_LEN
* \param elt_number maximum number of elements to read, updated
* with the real number of read elements if less is found
* \param elt array of pointers where are stored pointers to
@@ -69,7 +69,7 @@ libspid_config_read_line (const char *filename, const char* delimiters, char *ke
#ifdef USE_LOCK
struct flock lock;
#endif /* USE_LOCK */
- int max_elt_number;
+ unsigned int max_elt_number;
int is_key_found;
libspid_boolean_t key_is_mac = LIBSPID_FALSE;
@@ -218,7 +218,8 @@ libspid_config_read_line (const char *filename, const char* delimiters, char *ke
/* check if it is looked key */
if ((ptr == NULL) || (strlen (ptr) <= 0) || (*ptr == '#'))
continue;
- strcpy (key, ptr);
+ strncpy(key, ptr, (strlen(ptr) < LIBSPID_CONFIG_KEY_MAX_LEN) ?\
+ strlen(ptr) : LIBSPID_CONFIG_KEY_MAX_LEN);
/* if key is mac address change to lower case */
if (key_is_mac == LIBSPID_TRUE)
{
@@ -269,7 +270,8 @@ libspid_config_write_line (const char *filename, const char delimiter, const cha
char out_filename[64];
char *ptr, *strtok_ctx;
FILE *fp_in, *fp_out;
- int fd_in, index = 0;
+ int fd_in;
+ unsigned int index = 0;
int is_key_found = LIBSPID_FALSE;
char delimiters[8] = LIBSPID_CONFIG_DELIMITER " \t";
#ifdef USE_LOCK
@@ -351,6 +353,7 @@ libspid_config_write_line (const char *filename, const char delimiter, const cha
while (fgets (buffer, LIBSPID_CONFIG_LINE_MAX_LEN - 1, fp_in))
{
/* fill working copy for key */
+ memset(key_buffer, '\0', LIBSPID_CONFIG_KEY_MAX_LEN + 1);
strncpy (key_buffer, buffer, LIBSPID_CONFIG_KEY_MAX_LEN);
/* if key is mac address change to lower case */
if (key_is_mac == LIBSPID_TRUE)
diff --git a/cleopatre/application/libspid/src/current_alarm_eoc.c b/cleopatre/application/libspid/src/current_alarm_eoc.c
index b87e9cb0f7..49f7e34bef 100644
--- a/cleopatre/application/libspid/src/current_alarm_eoc.c
+++ b/cleopatre/application/libspid/src/current_alarm_eoc.c
@@ -25,11 +25,6 @@
#include "libspid.h"
-#ifdef __UTESTS__
-#include "eoc_utests.h"
-#endif /* __UTESTS__ */
-
-
/**
* Returns the current alarm entry for given string with OID.<BR>
* \param OID alarm OID
diff --git a/cleopatre/application/libspid/src/discrete_alarm_eoc.c b/cleopatre/application/libspid/src/discrete_alarm_eoc.c
index 258b250520..11ae87389f 100644
--- a/cleopatre/application/libspid/src/discrete_alarm_eoc.c
+++ b/cleopatre/application/libspid/src/discrete_alarm_eoc.c
@@ -25,11 +25,6 @@
#include "libspid.h"
-#ifdef __UTESTS__
-#include "eoc_utests.h"
-#endif /* __UTESTS__ */
-
-
/**
* Returns the discrete alarm entry for given string with OID.<BR>
* \param OID alarm OID
diff --git a/cleopatre/application/libspid/src/image.c b/cleopatre/application/libspid/src/image.c
index 970aeafd66..3d42d43ea2 100644
--- a/cleopatre/application/libspid/src/image.c
+++ b/cleopatre/application/libspid/src/image.c
@@ -70,7 +70,7 @@ libspid_image_get_desc (libspid_image_desc_type_t type, spidcom_image_desc_t *im
return LIBSPID_ERROR_PARAM;
}
- if ((type < 0) || (type >= LIBSPID_IMAGE_DESC_TYPE_NB))
+ if (type >= LIBSPID_IMAGE_DESC_TYPE_NB)
{
syslog (LOG_ERR, "%s: type is out-of-range", __FUNCTION__);
return LIBSPID_ERROR_PARAM;
@@ -137,7 +137,8 @@ libspid_image_get_desc (libspid_image_desc_type_t type, spidcom_image_desc_t *im
}
/* get image descriptor infos from both MTD */
- if ((read (fd0, &image_desc_temp[0], sizeof (spidcom_image_desc_t)) < sizeof (spidcom_image_desc_t)) || (nvram.nb_images > 1 && (read (fd1, &image_desc_temp[1], sizeof (spidcom_image_desc_t)) < sizeof (spidcom_image_desc_t))))
+ if ( (read(fd0, &image_desc_temp[0], sizeof(spidcom_image_desc_t)) < (int)sizeof(spidcom_image_desc_t))
+ || ( nvram.nb_images > 1 && ( read(fd1, &image_desc_temp[1], sizeof(spidcom_image_desc_t)) < (int)sizeof(spidcom_image_desc_t) ) ) )
{
close (fd0);
if (nvram.nb_images > 1)
@@ -380,7 +381,7 @@ libspid_image_select (libspid_image_select_t select)
} meminfo;
#endif /* __UTESTS__ */
- if ((select < LIBSPID_IMAGE_SELECT_0) || (select >= LIBSPID_IMAGE_SELECT_NB))
+ if (select >= LIBSPID_IMAGE_SELECT_NB)
{
syslog (LOG_ERR, "%s: argument is out-of-range", __FUNCTION__);
return LIBSPID_ERROR_PARAM;
diff --git a/cleopatre/application/libspid/src/master_config_eoc.c b/cleopatre/application/libspid/src/master_config_eoc.c
index faf411fb15..d4fc6b80a3 100644
--- a/cleopatre/application/libspid/src/master_config_eoc.c
+++ b/cleopatre/application/libspid/src/master_config_eoc.c
@@ -33,10 +33,6 @@
#include "libspid.h"
#include "nvram.h"
-#ifdef __UTESTS__
- #include "eoc_utests.h"
-#endif /* __UTESTS__ */
-
libspid_error_t
libspid_eoc_master_broadstorm_action (void)
{
@@ -51,7 +47,7 @@ libspid_eoc_master_broadstorm_action (void)
/* read broadcast fields */
if (LIBSPID_SUCCESS == libspid_config_read_item (LIBSPID_MASTER_CONF_PATH, LIBSPID_MASTER_CONF_LABEL_BCAST_LIMIT_ENABLE, buffer, LIBSPID_LINE_MAX_LEN))
{
- for (i=0; i<strlen(buffer); i++)
+ for (i = 0; i < (int) strlen (buffer); i++)
buffer[i] = tolower (buffer[i]);
if ((strcmp (buffer, "yes") == 0) || (strcmp (buffer, "y") == 0))
@@ -67,7 +63,7 @@ libspid_eoc_master_broadstorm_action (void)
/* read unkwown fields */
if (LIBSPID_SUCCESS == libspid_config_read_item (LIBSPID_MASTER_CONF_PATH, LIBSPID_MASTER_CONF_LABEL_UNKNOWN_LIMIT_ENABLE, buffer, LIBSPID_LINE_MAX_LEN))
{
- for (i=0; i<strlen(buffer); i++)
+ for (i = 0; i < (int) strlen (buffer); i++)
buffer[i] = tolower (buffer[i]);
if ((strcmp (buffer, "yes") == 0) || (strcmp (buffer, "y") == 0))
diff --git a/cleopatre/application/libspid/src/misc.c b/cleopatre/application/libspid/src/misc.c
index be803c149c..343d88356f 100644
--- a/cleopatre/application/libspid/src/misc.c
+++ b/cleopatre/application/libspid/src/misc.c
@@ -167,7 +167,7 @@ libspid_ip_bin_to_str (const unsigned char *bin, char *str)
libspid_error_t
libspid_hexstring_to_binary (const char* hex_string, unsigned char *binary, unsigned int binary_length)
{
- int i;
+ unsigned int i;
char hexa[binary_length / 2];
/* Check input parameters */
@@ -201,7 +201,7 @@ libspid_hexstring_to_binary (const char* hex_string, unsigned char *binary, unsi
libspid_error_t
libspid_binary_to_hexstring (const unsigned char *binary, unsigned int binary_length, char *hex_string)
{
- int i;
+ unsigned int i;
/* Check input parameters */
if ((NULL == binary) || (NULL == hex_string))
diff --git a/cleopatre/application/libspid/src/misc_eoc.c b/cleopatre/application/libspid/src/misc_eoc.c
index 022c908548..1982ad47d1 100644
--- a/cleopatre/application/libspid/src/misc_eoc.c
+++ b/cleopatre/application/libspid/src/misc_eoc.c
@@ -32,10 +32,6 @@
#include "nvram.h"
#include "libmme.h"
-#ifdef __UTESTS__
- #include "eoc_utests.h"
-#endif /* __UTESTS__ */
-
/**
* Reboots the slave with MAC address given as parameter.
* \param mac_address MAC address of the slave to reboot
@@ -108,7 +104,9 @@ libspid_eoc_get_topo (char *mac_address_list, int *mac_address_count)
for (*mac_address_count=0; *mac_address_count<LIBSPID_ONLINE_INFO_LINE_MAX_NB; (*mac_address_count)++)
{
/* get current line key */
- if ((error = libspid_config_read_line (LIBSPID_ONLINE_INFO_PATH, delimiters, key, &elt_number, elt, buffer, LIBSPID_CONFIG_LINE_MAX_LEN)) < 0)
+ if ((error = libspid_config_read_line (LIBSPID_ONLINE_INFO_PATH,
+ delimiters, key, &elt_number, elt, buffer,
+ LIBSPID_CONFIG_LINE_MAX_LEN)) != LIBSPID_SUCCESS)
return error;
/* check that eof is not reached */
@@ -116,7 +114,9 @@ libspid_eoc_get_topo (char *mac_address_list, int *mac_address_count)
break;
/* convert mac address from string to char array */
- if ((error = libspid_mac_str_to_bin (key, (unsigned char *)mac_address_list+LIBSPID_MAC_BIN_LEN*(*mac_address_count))) < 0 )
+ if ((error = libspid_mac_str_to_bin (key,
+ (unsigned char *) mac_address_list + LIBSPID_MAC_BIN_LEN * \
+ (*mac_address_count))) != LIBSPID_SUCCESS)
return error;
}
diff --git a/cleopatre/application/libspid/src/port_eoc.c b/cleopatre/application/libspid/src/port_eoc.c
index 686af626c2..7dabb850c1 100644
--- a/cleopatre/application/libspid/src/port_eoc.c
+++ b/cleopatre/application/libspid/src/port_eoc.c
@@ -31,8 +31,13 @@
#include "libmme.h"
#ifdef __UTESTS__
-#include "eoc_utests.h"
-#endif /* __UTESTS__ */
+libspid_error_t
+port_send_single_value (unsigned int mmtype, const void *value,
+ unsigned int length);
+libspid_error_t
+port_receive_single_value (unsigned int mmtype, const void *value,
+ unsigned int length, unsigned char *response);
+#endif
/**
* Returns the port entry for the given slave MAC address and port index.<BR>
@@ -367,9 +372,7 @@ libspid_eoc_port_retrieve (libspid_eoc_port_entry_t *entry, int *count)
unsigned char response[ETH_DATA_LEN];
unsigned char index = 0;
unsigned char i, j;
- unsigned int result;
unsigned int total_sta_entry_nb = LIBSPID_WHITE_LIST_CONF_LINE_MAX_NB;
- unsigned int first_sta_entry;
unsigned int curr_sta_entry_nb = LIBSPID_PORT_STA_MAX_CNT;
libspid_eoc_port_entry_t *curr_port_entry = entry;
@@ -385,9 +388,7 @@ libspid_eoc_port_retrieve (libspid_eoc_port_entry_t *entry, int *count)
unsigned char *rsp_ptr = response;
- result = rsp_ptr[0];
total_sta_entry_nb = rsp_ptr[1];
- first_sta_entry = rsp_ptr[2];
curr_sta_entry_nb = rsp_ptr[3];
rsp_ptr += 4;
@@ -544,11 +545,9 @@ libspid_eoc_port_sync (void)
/* pointer to list of port entries read from config file */
libspid_eoc_port_entry_t *port_config_entries;
libspid_error_t error = LIBSPID_SUCCESS;
- int i, j, k, t, idx;
+ unsigned int i, j, port_count, sta_count, curr_count, mme_num, remain;
+ int k, t, idx, temp_count;
unsigned char *mme_body;
- int temp_count;
- unsigned int port_count, sta_count, curr_count;
- unsigned int mme_num, remain;
mme_body = NULL;
port_config_entries = NULL;
@@ -638,7 +637,9 @@ libspid_eoc_port_sync (void)
t = j*LIBSPID_PORT_BYTE_PER_STA;
/* pack MAC address of current station */
- if ((error = libspid_mac_str_to_bin (port_config_entries[idx*LIBSPID_PORT_PER_SLAVE_MAX].mac_addr, mme_body+t+1)) < 0)
+ if ((error = libspid_mac_str_to_bin (port_config_entries[idx * \
+ LIBSPID_PORT_PER_SLAVE_MAX].mac_addr, mme_body + t + 1)) != \
+ LIBSPID_SUCCESS)
goto libspid_eoc_port_sync_end;
/* pack ports for current station */
diff --git a/cleopatre/application/libspid/src/secu.c b/cleopatre/application/libspid/src/secu.c
index fe88be8d44..adfde44c0b 100644
--- a/cleopatre/application/libspid/src/secu.c
+++ b/cleopatre/application/libspid/src/secu.c
@@ -103,7 +103,7 @@ libspid_secu_pbkdf1 (const unsigned char input[],
/* Check parameters. */
if((NULL == input) || (0 == input_length)
- || (salt_type < 0) || (salt_type >= LIBSPID_SECU_SALT_TYPE_NB)
+ || (salt_type >= LIBSPID_SECU_SALT_TYPE_NB)
|| (0 == it_count) || (NULL == output) || (0 == output_length))
{
return LIBSPID_ERROR_PARAM;
diff --git a/cleopatre/application/libspid/src/service_eoc.c b/cleopatre/application/libspid/src/service_eoc.c
index 4b2b1be3a7..eea694243c 100644
--- a/cleopatre/application/libspid/src/service_eoc.c
+++ b/cleopatre/application/libspid/src/service_eoc.c
@@ -31,8 +31,13 @@
#include "libmme.h"
#ifdef __UTESTS__
-#include "eoc_utests.h"
-#endif /* __UTESTS__ */
+libspid_error_t
+service_send_single_value (unsigned int mmtype, const void *value,
+ unsigned int length);
+libspid_error_t
+service_receive_single_value (unsigned int mmtype, const void *value,
+ unsigned int length, unsigned char *response);
+#endif
/**
* Returns the service entry for the given service index.<BR>
@@ -395,9 +400,7 @@ libspid_eoc_service_retrieve (libspid_eoc_service_entry_t *entry, int *count)
unsigned char response[ETH_DATA_LEN];
unsigned char index = 0;
unsigned char i, j;
- unsigned int result;
unsigned int total_service_entry_nb = LIBSPID_SERVICE_AMOUNT_LIMIT;
- unsigned int first_service_entry;
unsigned int curr_service_entry_nb = LIBSPID_SERVICE_MAX_CNT;
libspid_eoc_service_entry_t *curr_service_entry = entry;
@@ -418,9 +421,7 @@ libspid_eoc_service_retrieve (libspid_eoc_service_entry_t *entry, int *count)
unsigned char *rsp_ptr = response;
- result = rsp_ptr[0];
total_service_entry_nb = rsp_ptr[1];
- first_service_entry = rsp_ptr[2];
curr_service_entry_nb = rsp_ptr[3];
rsp_ptr += 4;
@@ -801,12 +802,9 @@ service_pack_send_set_mme (unsigned char *mme_body,
libspid_eoc_service_entry_t *service_entries,
int count, int action)
{
- unsigned int mme_num, remain;
+ unsigned int mme_num, remain, curr_count, i, j, tmp;
libspid_error_t error = LIBSPID_SUCCESS;
- unsigned int curr_count;
- int i, j, t;
- int idx;
- unsigned int tmp;
+ int t, idx;
/* allocate and initialize pointer to MME body */
if (count == 0)
@@ -929,11 +927,10 @@ libspid_eoc_service_sync (void)
/* pointer to list of service entries to be removed */
libspid_eoc_service_entry_t *service_remove_entries;
libspid_error_t error = LIBSPID_SUCCESS;
- int i, j;
+ unsigned int i, j, config_count, current_count;
static unsigned char *add_mme_body;
static unsigned char *remove_mme_body;
int temp_count;
- unsigned int config_count, current_count;
int found = 0;
int changed = 0;
int add_count = 0;
@@ -1207,7 +1204,8 @@ service_check_input_parameters (libspid_eoc_service_entry_t *service_entry,
unsigned int *max_limit)
{
int error_number = 0;
- int i = 0, tmp = 0, value = 0;
+ int tmp = 0, value = 0;
+ unsigned int i = 0;
int ret = 0;
int service_number = 0;
char buffer[LIBSPID_LINE_MAX_LEN];
@@ -1221,7 +1219,7 @@ service_check_input_parameters (libspid_eoc_service_entry_t *service_entry,
}
/** check if index is duplicated */
- for (i=0; i<wl_service_port_list.service_count_cnf; i++)
+ for (i = 0; i < (unsigned int) wl_service_port_list.service_count_cnf; i++)
{
if (strcmp (wl_service_port_list.service_entries_cnf[i].service_index, service_entry->service_index) == 0)
@@ -1281,7 +1279,7 @@ service_check_input_parameters (libspid_eoc_service_entry_t *service_entry,
}
/** check matching value **/
- for (i=0; i<wl_service_port_list.port_count_cnf; i++)
+ for (i = 0; i < (unsigned int) wl_service_port_list.port_count_cnf; i++)
{
/** check matching value if service is enabled in port.conf **/
if (strcmp (service_entry->service_index,
@@ -1314,7 +1312,7 @@ service_check_input_parameters (libspid_eoc_service_entry_t *service_entry,
if (*pnumber != '\0' || strcmp (service_entry->matching_value,"") == 0)
ret = -1;
else
- ret = (value < 0 || value > *max_limit) ? -1 : 0;
+ ret = (value < 0 || value > (int) *max_limit) ? -1 : 0;
if (ret != 0)
{
diff --git a/cleopatre/application/libspid/src/system.c b/cleopatre/application/libspid/src/system.c
index 8ea1836ba5..3ddcc04fee 100644
--- a/cleopatre/application/libspid/src/system.c
+++ b/cleopatre/application/libspid/src/system.c
@@ -173,7 +173,7 @@ libspid_system_get_kernel_version (char *buffer, int buffer_len)
/* check for buffer overload */
len = strlen (line_buffer);
total += len;
- if (total > buffer_len)
+ if (total > (unsigned int)buffer_len)
return LIBSPID_ERROR_NO_SPACE;
strcat (buffer, line_buffer);
@@ -314,7 +314,7 @@ libspid_system_get_meminfo (char *buffer, int buffer_len)
/* check for buffer overload */
len = strlen (line_buffer);
total += len;
- if (total > buffer_len)
+ if (total > (unsigned int)buffer_len)
return LIBSPID_ERROR_NO_SPACE;
strcat (buffer, line_buffer);
@@ -352,9 +352,9 @@ libspid_error_t
libspid_system_save(void)
{
FILE *fp;
- char *ptr, filename[128], *dirptr, tmpbuf[128], command_buffer[256], mkdir_buffer[256];
+ char *ptr, filename[128], *dirptr, tmpbuf[128], command_buffer[256], mkdir_buffer[256];
int rc = 0;
- char prefix[16] = {0};
+ char prefix[128] = {0};
struct stat st;
/* create save.lst file if it is not present already */
@@ -536,7 +536,7 @@ libspid_system_get_nvram (spc300_nvram_t *nvram)
return LIBSPID_ERROR_SYSTEM;
}
- if (read (fd, nvram, sizeof (spc300_nvram_t)) < sizeof (spc300_nvram_t))
+ if (read (fd, nvram, sizeof (spc300_nvram_t)) < (int) sizeof (spc300_nvram_t))
{
close (fd);
return LIBSPID_ERROR_SYSTEM;
@@ -615,7 +615,7 @@ libspid_system_set_nvram (spc300_nvram_t *nvram)
#endif
/* store new NVRAM contents */
- if (write (fd, nvram, sizeof (spc300_nvram_t)) < sizeof (spc300_nvram_t))
+ if (write (fd, nvram, sizeof (spc300_nvram_t)) < (int) sizeof (spc300_nvram_t))
{
close (fd);
return LIBSPID_ERROR_SYSTEM;
@@ -656,7 +656,7 @@ libspid_system_get_date (char *buffer, const int buffer_len)
sprintf(time_buffer, "%ld", now);
/* check length of time buffer */
- if (strlen (time_buffer) > buffer_len)
+ if ((int) strlen (time_buffer) > buffer_len)
return LIBSPID_ERROR_NO_SPACE;
strcpy (buffer, time_buffer);
@@ -719,7 +719,7 @@ libspid_system_file_update_register (pid_t rx_pid, const char *filename,
const char delimiter = *LIBSPID_SIGNAL_INFO_DELIMITER;
char pid_str[8] = {0};
char *elt[LIBSPID_CONFIG_ELT_MAX_NB] = {NULL};
- char key[LIBSPID_CONFIG_KEY_MAX_LEN] = {0};
+ char key[LIBSPID_CONFIG_KEY_MAX_LEN + 1] = {0};
unsigned int elt_number = LIBSPID_CONFIG_ELT_MAX_NB;
char buffer[LIBSPID_CONFIG_LINE_MAX_LEN] = {0};
unsigned int i = 0;
@@ -817,7 +817,7 @@ error:
libspid_error_t
libspid_system_file_update_unregister (pid_t rx_pid, const char *filename)
{
- char key[LIBSPID_CONFIG_KEY_MAX_LEN] = {0};
+ char key[LIBSPID_CONFIG_KEY_MAX_LEN + 1] = {0};
unsigned int elt_number = LIBSPID_CONFIG_ELT_MAX_NB;
char *elt[LIBSPID_CONFIG_ELT_MAX_NB] = { NULL };
char buffer[LIBSPID_CONFIG_LINE_MAX_LEN] = {0};
@@ -924,7 +924,7 @@ libspid_system_file_update_is_registered (pid_t rx_pid, const char *filename,
libspid_boolean_t *is_registered)
{
libspid_error_t ret = LIBSPID_SUCCESS;
- char key[LIBSPID_CONFIG_KEY_MAX_LEN] = {0};
+ char key[LIBSPID_CONFIG_KEY_MAX_LEN + 1] = {0};
unsigned int elt_number = LIBSPID_CONFIG_ELT_MAX_NB;
char *elt[LIBSPID_CONFIG_ELT_MAX_NB] = {NULL};
char buffer[LIBSPID_CONFIG_LINE_MAX_LEN] = {0};
@@ -987,15 +987,13 @@ libspid_system_file_update_is_registered (pid_t rx_pid, const char *filename,
* - LIBSPID_ERROR_PARAM if bad input parameters
* - LIBSPID_ERROR_SYSTEM if system error, see errno set by kill() system call:
* - EPERM in case of authorization constraints
- * - ESRCH if pid not found
- * - EINVAL if signal_nb < 0 or signal_nb >= NSIG
* - error from libspid_config_read_line()
*/
libspid_error_t
libspid_system_file_update_warn (pid_t tx_pid, const char *filename)
{
libspid_error_t ret = LIBSPID_SUCCESS;
- char key[LIBSPID_CONFIG_KEY_MAX_LEN] = {0};
+ char key[LIBSPID_CONFIG_KEY_MAX_LEN + 1] = {0};
unsigned int elt_number = LIBSPID_CONFIG_ELT_MAX_NB;
char *elt[LIBSPID_CONFIG_ELT_MAX_NB] = {NULL};
char buffer[LIBSPID_CONFIG_LINE_MAX_LEN] = {0};
@@ -1039,11 +1037,14 @@ libspid_system_file_update_warn (pid_t tx_pid, const char *filename)
/* Check that rx_pid is different from the calling process.
* Note that if input tx_pid = 0, the calling process will also receive the signal. */
if ((0 != (rx_pid = atoi (elt[i])))
- && (tx_pid != rx_pid)
- && (0 != kill (rx_pid, SIGHUP)))
+ && (tx_pid != rx_pid))
{
- return LIBSPID_ERROR_SYSTEM;
+ if (kill (rx_pid, SIGHUP) != 0 && errno != ESRCH)
+ {
+ return LIBSPID_ERROR_SYSTEM;
+ }
}
+
}
return LIBSPID_SUCCESS;
diff --git a/cleopatre/application/libspid/src/upgrade_eoc.c b/cleopatre/application/libspid/src/upgrade_eoc.c
index 9d91612f52..05e77b7cf6 100644
--- a/cleopatre/application/libspid/src/upgrade_eoc.c
+++ b/cleopatre/application/libspid/src/upgrade_eoc.c
@@ -33,10 +33,6 @@
#include "nvram.h"
#include "libmme.h"
-#ifdef __UTESTS__
- #include "eoc_utests.h"
-#endif /* __UTESTS__ */
-
/**
* Get information on the given image file: software version and board type.
* The provided version and board strings are filled from given image file.
@@ -216,7 +212,7 @@ libspid_update_transfer (char *mac_address, char *file)
/* finish the transfer */
if (psize == 0) break;
- if (psize < LIBSPID_TRANSFER_MAX_SLICE) not_done = 0;
+ if (psize < (int) LIBSPID_TRANSFER_MAX_SLICE) not_done = 0;
/* initialize transfer MME */
mme_init (&request_ctx, MME_TYPE_VS_UPDATE_TRANSFER | MME_TYPE_REQ, snd_buffer, ETH_DATA_LEN);
@@ -573,7 +569,7 @@ libspid_eoc_upgrade_local_image (char *file)
spc300_nvram_t nvram;
char mtd_name[32], version[32], board[32];
char cmd[50];
- int size, rc, fd = -1, type = -1;
+ int rc, fd = -1, type = -1;
libspid_error_t ret = -1;
struct stat st;
char enable[LIBSPID_CONFIG_LINE_MAX_LEN] = {0};
@@ -658,7 +654,6 @@ libspid_eoc_upgrade_local_image (char *file)
LIBSPID_EOC_LOG_1 ("%s: Cannot determine firmware file size", __FUNCTION__);
return LIBSPID_ERROR_SYSTEM;
}
- size = st.st_size;
/* make sure flash is properly cleaned */
sprintf (cmd, "flash_eraseall %s > /dev/null", mtd_name);
diff --git a/cleopatre/application/libspid/src/wl_eoc.c b/cleopatre/application/libspid/src/wl_eoc.c
index c8b4c38f2d..e51fbeb07b 100644
--- a/cleopatre/application/libspid/src/wl_eoc.c
+++ b/cleopatre/application/libspid/src/wl_eoc.c
@@ -33,9 +33,17 @@
#include "libmme.h"
#ifdef __UTESTS__
- #include "eoc_utests.h"
-#endif /* __UTESTS__ */
-
+libspid_error_t
+wl_send_single_value (unsigned int mmtype, const void *value,
+ unsigned int length);
+libspid_error_t
+wl_receive_single_value(unsigned int mmtype,
+ const void *value,
+ unsigned int length,
+ unsigned char *response);
+int
+wl_compute_dak (const unsigned char *dpw, unsigned char *dak);
+#endif
/* reverse string s in place */
static void
@@ -660,7 +668,8 @@ libspid_eoc_wl_retrieve (libspid_eoc_wl_entry_t *eoc_wl_entry, int *mac_address_
libspid_error_t error = LIBSPID_SUCCESS;
unsigned char response[ETH_DATA_LEN];
unsigned char index = 0, i, j;
- unsigned int result, total_wl_entry_nb = LIBSPID_WHITE_LIST_MAX_STA_NUM, first_wl_entry, curr_wl_entry_nb = LIBSPID_EOC_WL_MAX_STA_CNT;
+ unsigned int total_wl_entry_nb = LIBSPID_WHITE_LIST_MAX_STA_NUM, \
+ curr_wl_entry_nb = LIBSPID_EOC_WL_MAX_STA_CNT;
libspid_eoc_wl_entry_t *curr_wl_entry = eoc_wl_entry;
/* check input parameters */
@@ -675,9 +684,7 @@ libspid_eoc_wl_retrieve (libspid_eoc_wl_entry_t *eoc_wl_entry, int *mac_address_
unsigned char *rsp_ptr = response;
- result = rsp_ptr[0];
total_wl_entry_nb = rsp_ptr[1];
- first_wl_entry = rsp_ptr[2];
curr_wl_entry_nb = rsp_ptr[3];
rsp_ptr += 4;
@@ -1003,18 +1010,14 @@ libspid_eoc_wl_sync (void)
libspid_eoc_wl_info_entry_t *wl_entries;
libspid_error_t error = LIBSPID_SUCCESS;
- int i, j, t;
- int idx;
+ unsigned int i, j, time_hr, time_min, time_sec, config_count, current_count, \
+ curr_count, mme_num, remain;
+ int t, idx, temp_count, count;
int ret = 0;
char enable[LIBSPID_CONFIG_LINE_MAX_LEN] = {0};
static unsigned char *mme_body;
-
- unsigned int time_hr, time_min, time_sec;
- int temp_count, count;
- unsigned int config_count, current_count, curr_count;
- unsigned int mme_num, remain;
-
+
unsigned char dak[LIBSPID_SECU_OUTPUT_KEY_SIZE];
ret = libspid_config_read_item (LIBSPID_SYSTEM_CONF_PATH,
@@ -1139,7 +1142,10 @@ libspid_eoc_wl_sync (void)
t = j*LIBSPID_EOC_WL_BYTE_NR_STA;
/* pack MAC address */
- if ((error = libspid_mac_str_to_bin (wl_entries[idx].mac_addr, mme_body+t+1)) < 0) return error;
+ if ((error = libspid_mac_str_to_bin (wl_entries[idx].mac_addr,
+ mme_body + t + 1)) != \
+ LIBSPID_SUCCESS)
+ return error;
/* pack TEI */
mme_body[t+7] = (uint8_t) strtol (wl_entries[idx].tei, NULL, 10);
diff --git a/cleopatre/application/managerd/Module b/cleopatre/application/managerd/Module
new file mode 100644
index 0000000000..83fda265da
--- /dev/null
+++ b/cleopatre/application/managerd/Module
@@ -0,0 +1,2 @@
+SOURCES := bridge.c gpio_event.c managerd.c mme_nl.c vs_mme.c \
+ js_eoc_mme.c vs_eoc_mme.c
diff --git a/cleopatre/application/managerd/inc/bridge.h b/cleopatre/application/managerd/inc/bridge.h
index 17ebeb0443..5b9599e848 100644
--- a/cleopatre/application/managerd/inc/bridge.h
+++ b/cleopatre/application/managerd/inc/bridge.h
@@ -24,6 +24,7 @@
#include "libmme.h"
#include "mme_nl.h"
#include "managerd.h"
+#include "vs_mme.h"
/** Interfaces name */
#define BR_IFNAME "br0"
diff --git a/cleopatre/application/managerd/inc/managerd.h b/cleopatre/application/managerd/inc/managerd.h
index 024876b26c..181700e2b4 100644
--- a/cleopatre/application/managerd/inc/managerd.h
+++ b/cleopatre/application/managerd/inc/managerd.h
@@ -27,6 +27,7 @@
#include <linux/if_ether.h>
#include <linux/netlink.h>
#include <sys/time.h>
+#include <stdio.h> /* for FILE */
#include "../../linux/gpio.h"
#include "libspid.h"
diff --git a/cleopatre/application/managerd/inc/vs_mme.h b/cleopatre/application/managerd/inc/vs_mme.h
index 7b121b0e24..021a8908c8 100644
--- a/cleopatre/application/managerd/inc/vs_mme.h
+++ b/cleopatre/application/managerd/inc/vs_mme.h
@@ -182,7 +182,7 @@ typedef struct {
extern enum bridge_status vs_mme_get_version (struct managerd_ctx *ctx, MME_t *request, MME_t * confirm, int len);
extern enum bridge_status vs_mme_eth_stats (struct managerd_ctx *ctx, MME_t *request, MME_t * confirm, int len);
-extern enum bridge_status vs_mme_reset (struct managerd_ctx *ctx, MME_t *request, MME_t * confirm, int len);
+extern enum bridge_status vs_mme_reset (struct managerd_ctx *ctx, MME_t *request, MME_t *confirm, int len);
extern enum bridge_status vs_mme_reset_handler (struct managerd_ctx *ctx, MME_t *request, MME_t * confirm, int len);
extern enum bridge_status vs_mme_update_start (struct managerd_ctx *ctx, MME_t *request, MME_t *confirm, int len);
extern enum bridge_status vs_mme_update_transfer (struct managerd_ctx *ctx, MME_t *request, MME_t *confirm, int len);
diff --git a/cleopatre/application/managerd/src/managerd.c b/cleopatre/application/managerd/src/managerd.c
index 5c21b8f938..ed912618b6 100644
--- a/cleopatre/application/managerd/src/managerd.c
+++ b/cleopatre/application/managerd/src/managerd.c
@@ -37,19 +37,26 @@
* and has now to be processed. */
volatile sig_atomic_t is_process_signal_needed;
+/* Global variable indicating if a SIGTERM signal occurred, should exit. */
+volatile sig_atomic_t exit_requested;
+
/**
- * Handle SIGHUP reception.
+ * Handle signal reception.
*
* \param signal_nb signal identifier
*/
void
managerd_signal_handler (int signal_nb)
{
- /* check that we received a SIGHUP signal (other signals must be ignored) */
+ /* Check received signal. */
if (SIGHUP == signal_nb)
{
is_process_signal_needed = 1;
}
+ else if (SIGTERM == signal_nb)
+ {
+ exit_requested = 1;
+ }
}
/**
@@ -145,7 +152,7 @@ managerd_process (struct managerd_ctx *ctx)
return -1;
}
- while (1)
+ while(!exit_requested)
{
fd_set readfds, exceptfds;
struct timeval timeout;
@@ -357,6 +364,9 @@ managerd_init (struct managerd_ctx *ctx)
return -1;
}
+ /* Catch SIGTERM. */
+ signal (SIGTERM, managerd_signal_handler);
+
return 0;
}
@@ -385,6 +395,9 @@ managerd_uninit (struct managerd_ctx *ctx)
//Uninitialize simple connect part (close "/dev/gpio")
simple_connect_uninit (ctx);
+
+ /* Unregister to file update. */
+ libspid_system_file_update_unregister (getpid (), LIBSPID_HPAV_INFO_PATH);
}
/**
diff --git a/cleopatre/application/managerd/src/mme_nl.c b/cleopatre/application/managerd/src/mme_nl.c
index 5eeff85d1a..ac4288bc0f 100644
--- a/cleopatre/application/managerd/src/mme_nl.c
+++ b/cleopatre/application/managerd/src/mme_nl.c
@@ -101,7 +101,7 @@ mme_nl_receive (struct managerd_ctx *ctx, uint8_t *buffer, int len)
struct nlmsghdr *nlh;
struct sockaddr_nl kernel_addr;
struct iovec iov;
- int msg_len, result;
+ int msg_len;
/* create message from MME netlink */
nlh = (struct nlmsghdr *)malloc (sizeof (struct nlmsghdr) + len);
@@ -130,9 +130,8 @@ mme_nl_receive (struct managerd_ctx *ctx, uint8_t *buffer, int len)
}
memcpy (buffer, NLMSG_DATA (nlh), msg_len);
- result = msg_len;
free (nlh);
- return result;
+ return msg_len;
}
/**
@@ -148,7 +147,7 @@ mme_nl_send (struct managerd_ctx *ctx, uint8_t *buffer, int len)
{
struct sockaddr_nl kernel_addr;
struct nlmsghdr *nlh;
- int msg_len, result;
+ int msg_len;
struct iovec iov;
struct msghdr msg;
diff --git a/cleopatre/application/managerd/src/vs_mme.c b/cleopatre/application/managerd/src/vs_mme.c
index ba11902712..115b63521d 100644
--- a/cleopatre/application/managerd/src/vs_mme.c
+++ b/cleopatre/application/managerd/src/vs_mme.c
@@ -20,11 +20,11 @@
*/
#include <stdio.h>
-#include <stdlib.h>
#include <string.h>
#include <syslog.h>
-#include <pthread.h>
+#include <stdlib.h>
#include <unistd.h>
+#include <pthread.h>
#include <fcntl.h>
#include <signal.h>
#include <sys/time.h>
@@ -89,7 +89,7 @@ vs_mme_get_version (struct managerd_ctx *ctx, MME_t *request, MME_t *confirm, in
assert (NULL != ctx);
assert (NULL != request);
assert (NULL != confirm);
- assert (len >= sizeof (vs_get_version_cnf_t) + sizeof (MME_t));
+ assert ((unsigned int)len >= sizeof (vs_get_version_cnf_t) + sizeof (MME_t));
/* check for request content */
if (memcmp ((char *) request + sizeof (MME_t), OUI_SPIDCOM, 3))
@@ -187,7 +187,7 @@ vs_mme_eth_stats (struct managerd_ctx *ctx, MME_t *request, MME_t *confirm, int
assert (NULL != ctx);
assert (NULL != request);
assert (NULL != confirm);
- assert (len >= sizeof (vs_eth_stats_cnf_t) + sizeof (MME_t));
+ assert ((unsigned int) len >= sizeof (vs_eth_stats_cnf_t) + sizeof (MME_t));
eth_stats_req = (vs_eth_stats_req_t *) ((unsigned char*)request + sizeof (MME_t));
eth_stats_cnf = (vs_eth_stats_cnf_t *) ((unsigned char*)confirm + sizeof (MME_t));
@@ -287,7 +287,7 @@ vs_mme_reset (struct managerd_ctx *ctx, MME_t *request, MME_t *confirm, int len)
assert (NULL != ctx);
assert (NULL != request);
assert (NULL != confirm);
- assert (len >= sizeof (vs_reset_cnf_t) + sizeof (MME_t));
+ assert ((unsigned int) len >= sizeof (vs_reset_cnf_t) + sizeof (MME_t));
/* check for request content */
if (memcmp ((char*) request + sizeof (MME_t), OUI_SPIDCOM, 3))
diff --git a/cleopatre/application/upnpd/src/.upnpd.c.swp b/cleopatre/application/upnpd/src/.upnpd.c.swp
deleted file mode 100644
index 0b1d13580c..0000000000
--- a/cleopatre/application/upnpd/src/.upnpd.c.swp
+++ /dev/null
Binary files differ
diff --git a/cleopatre/buildroot/package/fw_wd/fw_wd.mk b/cleopatre/buildroot/package/fw_wd/fw_wd.mk
index b6163e13bb..b66281a7c0 100644
--- a/cleopatre/buildroot/package/fw_wd/fw_wd.mk
+++ b/cleopatre/buildroot/package/fw_wd/fw_wd.mk
@@ -42,20 +42,28 @@ $(TARGET_DIR)/usr/bin/fw_wd: $(FW_WD_DIR)/fw_wd
mkdir -p $(TARGET_DIR)/usr/bin
cp $(FW_WD_DIR)/fw_wd $(TARGET_DIR)/usr/bin/fw_wd
-$(TARGET_DIR)/etc/init.d/S99trace: $(FW_WD_DIR)/S99trace
+$(TARGET_DIR)/usr/bin/fwwatchd: $(FW_WD_DIR)/fwwatchd
+ mkdir -p $(TARGET_DIR)/usr/bin
+ cp $< $@
+
+$(TARGET_DIR)/etc/init.d/S99fwwatchd: $(FW_WD_DIR)/S99fwwatchd
mkdir -p $(TARGET_DIR)/etc/init.d
cp $< $@
-$(TARGET_DIR)/etc/default/trace: $(FW_WD_DIR)/trace
+$(TARGET_DIR)/etc/default/fwwatchd: $(FW_WD_DIR)/fwwatchd.default
mkdir -p $(TARGET_DIR)/etc/default/
cp $< $@
-fw_wd: uclibc $(TARGET_DIR)/usr/bin/fw_wd $(TARGET_DIR)/etc/init.d/S99trace $(TARGET_DIR)/etc/default/trace
+fw_wd: uclibc $(TARGET_DIR)/usr/bin/fw_wd \
+ $(TARGET_DIR)/usr/bin/fwwatchd \
+ $(TARGET_DIR)/etc/init.d/S99fwwatchd \
+ $(TARGET_DIR)/etc/default/fwwatchd
fw_wd-clean:
rm -f $(TARGET_DIR)/usr/bin/fw_wd
- rm -f $(TARGET_DIR)/etc/init.d/S99trace
- rm -f $(TARGET_DIR)/etc/default/trace
+ rm -f $(TARGET_DIR)/usr/bin/fwwatchd
+ rm -f $(TARGET_DIR)/etc/init.d/S99fwwatchd
+ rm -f $(TARGET_DIR)/etc/default/fwwatchd
-$(MAKE) -C $(FW_WD_DIR) clean
fw_wd-dirclean:
diff --git a/cleopatre/buildroot/target/device/Spidcom/scr310/target_skeleton/etc/init.d/S30plc b/cleopatre/buildroot/target/device/Spidcom/scr310/target_skeleton/etc/init.d/S30plc
index 9c42349720..6392b92c30 100755
--- a/cleopatre/buildroot/target/device/Spidcom/scr310/target_skeleton/etc/init.d/S30plc
+++ b/cleopatre/buildroot/target/device/Spidcom/scr310/target_skeleton/etc/init.d/S30plc
@@ -30,7 +30,7 @@ start() {
stop() {
echo -n "Unloading PLC driver..."
/sbin/rmmod plcdrv || exit 1
- rm -f /dev/plcdrv
+ rm -f /dev/plcdrv /dev/trace
}
restart() {
diff --git a/cleopatre/buildroot/target/device/Spidcom/spk300/target_skeleton/etc/init.d/S30plc b/cleopatre/buildroot/target/device/Spidcom/spk300/target_skeleton/etc/init.d/S30plc
index 9c42349720..6392b92c30 100755
--- a/cleopatre/buildroot/target/device/Spidcom/spk300/target_skeleton/etc/init.d/S30plc
+++ b/cleopatre/buildroot/target/device/Spidcom/spk300/target_skeleton/etc/init.d/S30plc
@@ -30,7 +30,7 @@ start() {
stop() {
echo -n "Unloading PLC driver..."
/sbin/rmmod plcdrv || exit 1
- rm -f /dev/plcdrv
+ rm -f /dev/plcdrv /dev/trace
}
restart() {
diff --git a/cleopatre/buildroot/target/device/Spidcom/spk300g/target_skeleton/etc/init.d/S30plc b/cleopatre/buildroot/target/device/Spidcom/spk300g/target_skeleton/etc/init.d/S30plc
index 9c42349720..6392b92c30 100755
--- a/cleopatre/buildroot/target/device/Spidcom/spk300g/target_skeleton/etc/init.d/S30plc
+++ b/cleopatre/buildroot/target/device/Spidcom/spk300g/target_skeleton/etc/init.d/S30plc
@@ -30,7 +30,7 @@ start() {
stop() {
echo -n "Unloading PLC driver..."
/sbin/rmmod plcdrv || exit 1
- rm -f /dev/plcdrv
+ rm -f /dev/plcdrv /dev/trace
}
restart() {
diff --git a/cleopatre/buildroot/target/device/Spidcom/spk310/target_skeleton/etc/init.d/S30plc b/cleopatre/buildroot/target/device/Spidcom/spk310/target_skeleton/etc/init.d/S30plc
index 9c42349720..6392b92c30 100755
--- a/cleopatre/buildroot/target/device/Spidcom/spk310/target_skeleton/etc/init.d/S30plc
+++ b/cleopatre/buildroot/target/device/Spidcom/spk310/target_skeleton/etc/init.d/S30plc
@@ -30,7 +30,7 @@ start() {
stop() {
echo -n "Unloading PLC driver..."
/sbin/rmmod plcdrv || exit 1
- rm -f /dev/plcdrv
+ rm -f /dev/plcdrv /dev/trace
}
restart() {
diff --git a/cleopatre/buildroot/target/device/Spidcom/spr300/target_skeleton/etc/init.d/S30plc b/cleopatre/buildroot/target/device/Spidcom/spr300/target_skeleton/etc/init.d/S30plc
index 9c42349720..6392b92c30 100755
--- a/cleopatre/buildroot/target/device/Spidcom/spr300/target_skeleton/etc/init.d/S30plc
+++ b/cleopatre/buildroot/target/device/Spidcom/spr300/target_skeleton/etc/init.d/S30plc
@@ -30,7 +30,7 @@ start() {
stop() {
echo -n "Unloading PLC driver..."
/sbin/rmmod plcdrv || exit 1
- rm -f /dev/plcdrv
+ rm -f /dev/plcdrv /dev/trace
}
restart() {
diff --git a/cleopatre/buildroot/target/device/Spidcom/spr310/target_skeleton/etc/init.d/S30plc b/cleopatre/buildroot/target/device/Spidcom/spr310/target_skeleton/etc/init.d/S30plc
index 9c42349720..6392b92c30 100755
--- a/cleopatre/buildroot/target/device/Spidcom/spr310/target_skeleton/etc/init.d/S30plc
+++ b/cleopatre/buildroot/target/device/Spidcom/spr310/target_skeleton/etc/init.d/S30plc
@@ -30,7 +30,7 @@ start() {
stop() {
echo -n "Unloading PLC driver..."
/sbin/rmmod plcdrv || exit 1
- rm -f /dev/plcdrv
+ rm -f /dev/plcdrv /dev/trace
}
restart() {
diff --git a/cleopatre/devkit/doc/cleopatre_mme_specs.odt b/cleopatre/devkit/doc/cleopatre_mme_specs.odt
index 6cfeb3a977..805ce0e286 100644
--- a/cleopatre/devkit/doc/cleopatre_mme_specs.odt
+++ b/cleopatre/devkit/doc/cleopatre_mme_specs.odt
Binary files differ
diff --git a/cleopatre/devkit/plcd/src/plcd_main.c b/cleopatre/devkit/plcd/src/plcd_main.c
index 21cc043a50..153c40a09a 100644
--- a/cleopatre/devkit/plcd/src/plcd_main.c
+++ b/cleopatre/devkit/plcd/src/plcd_main.c
@@ -41,6 +41,7 @@ static spc300_nvram_t g_nvram;
volatile sig_atomic_t is_process_signal_needed;
+volatile sig_atomic_t exit_requested;
/******************************************************************************/
/* DEBUG FUNCTION */
@@ -74,11 +75,15 @@ plcd_print_usage (const char *cmd)
void
plcd_signal_handler (int signal_nb)
{
- /* check that we received a SIGHUP signal (other signals must be ignored) */
+ /* Check received signal. */
if (SIGHUP == signal_nb)
{
is_process_signal_needed = 1;
}
+ else if (SIGTERM == signal_nb)
+ {
+ exit_requested = 1;
+ }
}
@@ -314,8 +319,11 @@ main (int argc, char **argv)
exit (EXIT_FAILURE);
}
+ /* Catch SIGTERM. */
+ signal (SIGTERM, plcd_signal_handler);
+
/* now get all events from plcdrv (i.e. DRV MME-s) */
- while (1)
+ while (!exit_requested)
{
if (0 > plcd_stack_event_dispatch (&ctx))
{
@@ -323,6 +331,9 @@ main (int argc, char **argv)
}
}
+ libspid_system_file_update_unregister (pid, LIBSPID_HPAV_CONF_PATH);
+ libspid_system_file_update_unregister (pid, LIBSPID_HPAV_INFO_PATH);
+ libspid_system_file_update_unregister (pid, LIBSPID_MULTICAST_INFO_PATH);
plcd_uninit (&ctx);
exit (EXIT_SUCCESS);
}
diff --git a/cleopatre/devkit/plcdrv/arm/Module b/cleopatre/devkit/plcdrv/arm/Module
new file mode 100644
index 0000000000..d644569e21
--- /dev/null
+++ b/cleopatre/devkit/plcdrv/arm/Module
@@ -0,0 +1 @@
+SOURCES = hal.c linux_drv.c mailbox.c processing.c
diff --git a/cleopatre/devkit/plcdrv/arm/inc/common.h b/cleopatre/devkit/plcdrv/arm/inc/common.h
index bb6ba032d4..a9ca8cd850 100644
--- a/cleopatre/devkit/plcdrv/arm/inc/common.h
+++ b/cleopatre/devkit/plcdrv/arm/inc/common.h
@@ -20,7 +20,9 @@
#include <linux/kernel.h> //for printk...
#include <linux/string.h> //for memcpy, memset...
#include <linux/if_ether.h>//for ETH_ALEN
-#include <asm/bitops.h> //test_bit using on TRACE
+#else
+#include <linux/types.h>
+#include <linux/if_ether.h>
#endif
/** Define different trace levels */
diff --git a/cleopatre/devkit/plcdrv/arm/inc/hal.h b/cleopatre/devkit/plcdrv/arm/inc/hal.h
index 7d3bedf738..db99ef1479 100644
--- a/cleopatre/devkit/plcdrv/arm/inc/hal.h
+++ b/cleopatre/devkit/plcdrv/arm/inc/hal.h
@@ -17,9 +17,11 @@
*/
#ifdef __UTESTS__
-#include "hal_utests.h"
+# include "common.h"
+# include <linux/spinlock.h>
+#else
+# include <linux/spinlock.h>
#endif
-#include <linux/spinlock.h>
#define A2L_RING_MASK (A2L_RING_SIZE-1)
#define L2A_RING_MASK (L2A_RING_SIZE-1)
diff --git a/cleopatre/devkit/plcdrv/arm/inc/linux_drv.h b/cleopatre/devkit/plcdrv/arm/inc/linux_drv.h
index 0dc85eb7b6..75f09038ef 100644
--- a/cleopatre/devkit/plcdrv/arm/inc/linux_drv.h
+++ b/cleopatre/devkit/plcdrv/arm/inc/linux_drv.h
@@ -16,15 +16,20 @@
* linux_drv layer
*/
+#ifndef __UTESTS__
#include <linux/netdevice.h>
#include <net/seq_check.h>
+#else
+#include <linux/types.h>
+#include <linux/wait.h>
+#include <linux/interrupt.h>
+#include <linux/dma-mapping.h>
+#include <linux/netdevice.h>
+#endif
+
#include "common.h"
#include "hal.h"
-#ifdef __UTESTS__
-#include "linux_drv_utests.h"
-#endif
-
/** */
enum pkt_dest {
OTHER = 0,
diff --git a/cleopatre/devkit/plcdrv/arm/inc/mailbox.h b/cleopatre/devkit/plcdrv/arm/inc/mailbox.h
index 429e23bb79..c6cbfabd2c 100644
--- a/cleopatre/devkit/plcdrv/arm/inc/mailbox.h
+++ b/cleopatre/devkit/plcdrv/arm/inc/mailbox.h
@@ -19,7 +19,7 @@
#include "common.h"
#ifdef __UTESTS__
-#include "mailbox_utests.h"
+#include <linux/netdevice.h>
#endif
/**
diff --git a/cleopatre/devkit/plcdrv/arm/inc/processing.h b/cleopatre/devkit/plcdrv/arm/inc/processing.h
index 47297387ae..62c64c368e 100644
--- a/cleopatre/devkit/plcdrv/arm/inc/processing.h
+++ b/cleopatre/devkit/plcdrv/arm/inc/processing.h
@@ -18,10 +18,6 @@
#include "common.h"
-#ifdef __UTESTS__
-#include "processing_utests.h"
-#endif
-
/** Define HPAV Ethernet type */
#define ETH_P_HPAV 0x88E1
/** Define MME fcall type */
diff --git a/cleopatre/devkit/plcdrv/arm/src/boot_params.c b/cleopatre/devkit/plcdrv/arm/src/boot_params.c
index c57005bdf7..63ef4498b5 100644
--- a/cleopatre/devkit/plcdrv/arm/src/boot_params.c
+++ b/cleopatre/devkit/plcdrv/arm/src/boot_params.c
@@ -45,25 +45,44 @@ char custom_boot_params[BOOT_PARAMS_STR_SIZE] = "";
static int plcdrv_add_boot_param(char *params_str, const char *param_name,
const char *param_value)
{
- int ret;
+ size_t len;
BUG_ON(params_str == NULL);
BUG_ON(param_name == NULL);
- ret = snprintf(params_str, BOOT_PARAMS_STR_SIZE, "%s%s%s%s%s",
- params_str, param_name,
- (param_value != NULL) ? BOOT_PARAMS_KEY_VALUE_DELIMITER : "",
- (param_value != NULL) ? param_value: "",
- BOOT_PARAMS_DELIMITER);
+ len = strlen(params_str);
- if ((ret <= -1) || (ret >= BOOT_PARAMS_STR_SIZE))
+ /* If params_str is not empty, add a delimiter before adding the boot param. */
+ if (len > 0)
{
- printk (KERN_ERR
- "Boot parameters string too long (after adding default parameter)\n");
- return -1;
+ len += strlen(BOOT_PARAMS_DELIMITER);
+ if (len >= BOOT_PARAMS_STR_SIZE)
+ goto overflow;
+ strcat(params_str, BOOT_PARAMS_DELIMITER);
}
- return 0;
+ /* Add param_name. */
+ len += strlen(param_name);
+ if (len >= BOOT_PARAMS_STR_SIZE)
+ goto overflow;
+ strcat(params_str, param_name);
+
+ /* Add param_value, if any. */
+ if (param_value != NULL)
+ {
+ len += strlen(BOOT_PARAMS_KEY_VALUE_DELIMITER) + strlen(param_value);
+ if (len >= BOOT_PARAMS_STR_SIZE)
+ goto overflow;
+ strcat(params_str, BOOT_PARAMS_KEY_VALUE_DELIMITER);
+ strcat(params_str, param_value);
+ }
+
+ return 0;
+
+overflow:
+ printk (KERN_ERR
+ "Boot parameters string too long (while adding default parameter)\n");
+ return -1;
}
/**
diff --git a/cleopatre/devkit/plcdrv/arm/src/hal.c b/cleopatre/devkit/plcdrv/arm/src/hal.c
index de5fd68630..e8fd144774 100644
--- a/cleopatre/devkit/plcdrv/arm/src/hal.c
+++ b/cleopatre/devkit/plcdrv/arm/src/hal.c
@@ -15,15 +15,16 @@
*/
#ifndef __UTESTS__
-#include <linux/delay.h>
+# include <linux/delay.h>
+#else
+# include <linux/delay.h>
+# include <linux/bitops.h>
+# include <linux/kernel.h>
+#endif
#include "mailbox.h"
#include "hal.h"
#include "registers.h"
-#else
-#include <stdio.h>
#include "common.h"
-#include "hal.h"
-#endif
/** Define Debug/Trace Level */
#define TRACE(...) if(test_bit(TRACE_HAL, (const volatile unsigned long*)&trace)) printk(KERN_INFO "SPC300: HAL : " __VA_ARGS__)
diff --git a/cleopatre/devkit/plcdrv/arm/src/linux_drv.c b/cleopatre/devkit/plcdrv/arm/src/linux_drv.c
index 74f30707bd..faf050e289 100644
--- a/cleopatre/devkit/plcdrv/arm/src/linux_drv.c
+++ b/cleopatre/devkit/plcdrv/arm/src/linux_drv.c
@@ -20,31 +20,68 @@
#ifndef __UTESTS__
-#include <linux/types.h>
-#include <linux/kernel.h>
-#include <linux/module.h>
-//#include <linux/version.h>
-#include <linux/afe.h>
-#include <linux/init.h>
-#include <linux/errno.h>
-#include <linux/netdevice.h>
-#include <linux/etherdevice.h>
-#include <asm/semaphore.h>
-#include <linux/kdev_t.h>
-#include <linux/cdev.h>
-#include <linux/fs.h>
-#include <linux/proc_fs.h>
-#include <asm/uaccess.h>
-#include <linux/list.h>
-#include <linux/netlink.h>
-#include <linux/poll.h>
-#include <linux/wait.h>
-#include "net/seq_check.h"
-
-#include <asm/arch/nvram.h>
-#include <asm/arch/hardware/spi.h>
-#include <asm/arch/hardware/regbank.h>
-#include <asm-arm/arch-spc300/ioctl.h>
+# include <linux/types.h>
+# include <linux/kernel.h>
+# include <linux/module.h>
+# include <linux/afe.h>
+# include <linux/init.h>
+# include <linux/errno.h>
+# include <linux/netdevice.h>
+# include <linux/etherdevice.h>
+# include <asm/semaphore.h>
+# include <linux/kdev_t.h>
+# include <linux/cdev.h>
+# include <linux/fs.h>
+# include <linux/proc_fs.h>
+# include <asm/uaccess.h>
+# include <linux/list.h>
+# include <linux/netlink.h>
+# include <linux/poll.h>
+# include <linux/wait.h>
+# include "net/seq_check.h"
+
+# include <asm/arch/nvram.h>
+# include <asm/arch/hardware/spi.h>
+# include <asm/arch/hardware/regbank.h>
+# include <asm-arm/arch-spc300/ioctl.h>
+#else
+# include <linux/types.h>
+# include <linux/kernel.h>
+# include <linux/init.h>
+# include <linux/mutex.h>
+# include <linux/list.h>
+# include <linux/wait.h>
+# include <linux/afe.h>
+# include <linux/fs.h>
+# include <linux/poll.h>
+# include <linux/bitops.h> /* non present au-dessus, inclus par qqn ? */
+# include <linux/gfp.h> /* non present au-dessus, inclus par qqn ? */
+# include <linux/skbuff.h>
+# include <linux/netlink.h>
+# include <linux/interrupt.h>
+# include <linux/irqreturn.h>
+# include <linux/module.h>
+# include <linux/moduleparam.h>
+# include <linux/kdev_t.h>
+# include <linux/cdev.h>
+# include <linux/if_ether.h>
+# include <linux/errno.h>
+# include <linux/sched.h>
+# include <linux/dma-mapping.h>
+# include <net/net_namespace.h>
+# include <net/seq_check.h>
+
+# include <asm/arch/nvram.h>
+# include <asm/arch/hardware/regbank.h>
+
+/* TODO : move this ! */
+unsigned char plccode[124];
+#define VIRT_PLCCODE_BASE (&plccode[0])
+#define jiffies 1234
+struct net init_net;
+spc300_nvram_t spc300_nvram;
+
+#endif
#include "boot_params.h"
#include "common.h"
@@ -54,12 +91,6 @@
#include "hal.h"
#include "registers.h"
-
-#else
-#include "common.h"
-#include "linux_drv.h"
-#endif
-
MODULE_AUTHOR("SPiDCOM Technologies");
MODULE_DESCRIPTION("SPC300 PLC driver");
MODULE_LICENSE("SPiDCOM Technologies 2009");
@@ -111,6 +142,9 @@ static struct cdev plcdrv_char_dev;
/** Our trace character device. */
static struct cdev trace_cdev;
+/** Our plc directory in procfs. */
+static struct proc_dir_entry *proc_plc_dir;
+
/** Our mutex between firmware download and network driver start-up */
static uint8_t write_called = 0;
@@ -150,6 +184,9 @@ module_param(debug, int, 0644);
MODULE_PARM_DESC(debug, "Let's the user start PLC Processor by debugger");
module_param(trace, uint, 0644);
+void plcdrv_uninit(struct net_device *dev);
+
+
static const unsigned char __hexdigits[] = "0123456789ABCDEF";
static void sprintf_hex(unsigned char * str, const unsigned char * ptr, int len, unsigned char delim)
{
@@ -362,13 +399,50 @@ static int plcdrv_readproc_plc_stats(char *buf, char **start, off_t offset, int
*/
int plcdrv_reset_leon(int activate)
{
- RB_RST_GROUP_VA &= ~RST_LEONSS;
- if(RB_RST_GROUP_VA & RST_LEONSS)
- return -1;
+ if(activate)
+ {
+ RB_RST_GROUP_VA |= RST_LEONSS;
+ if(!(RB_RST_GROUP_VA & RST_LEONSS))
+ return -1;
- RB_RST_MODULE_VA &= ~RST_LCPU;
- if(RB_RST_MODULE_VA & RST_LCPU)
- return -1;
+ RB_RST_MODULE_VA |= RST_LCPU;
+ if(!(RB_RST_MODULE_VA & RST_LCPU))
+ return -1;
+ }
+ else
+ {
+ RB_RST_GROUP_VA &= ~RST_LEONSS;
+ if(RB_RST_GROUP_VA & RST_LEONSS)
+ return -1;
+
+ RB_RST_MODULE_VA &= ~RST_LCPU;
+ if(RB_RST_MODULE_VA & RST_LCPU)
+ return -1;
+ }
+
+ return 0;
+}
+
+/**
+ * Set/Unset Reset the DSP.
+ *
+ * \param activate 1 to activate reset.
+ * \return error code.
+ */
+int plcdrv_reset_dsp(int activate)
+{
+ if(activate)
+ {
+ RB_RST_GROUP_VA |= RST_DSP;
+ if(!(RB_RST_GROUP_VA & RST_DSP))
+ return -1;
+ }
+ else
+ {
+ RB_RST_GROUP_VA &= ~RST_DSP;
+ if(RB_RST_GROUP_VA & RST_DSP)
+ return -1;
+ }
return 0;
}
@@ -1625,11 +1699,18 @@ int plcdrv_open(struct net_device *dev)
return -EPERM;
}
+ //Prepare mutex
+ spin_lock_init(&priv->lock);
+
//Prepare sk_buff in used list
INIT_LIST_HEAD(&priv->list_head_skbs_tx);
INIT_LIST_HEAD(&priv->list_head_skbs_rx);
INIT_LIST_HEAD(&priv->list_head_skbs_rx_misc);
+ //Configure AFE with the default configuration
+ if (init_afe())
+ return -EFAULT;
+
//Allocate rings for each mailbox
if((priv->virt_ring_base_addr =
(uint32_t)dma_alloc_coherent(NULL,
@@ -1646,34 +1727,49 @@ int plcdrv_open(struct net_device *dev)
//Flush rings for each mailbox
memset((void*)priv->virt_ring_base_addr, 0, A2L_RING_SIZE+L2A_RING_SIZE);
- //Configure AFE with the default configuration
- if (init_afe())
- return -EFAULT;
+ //Request Receive IRQ
+ if(request_irq(priv->num_mbx_it, plcdrv_it_rx, 0, dev->name, dev) != 0)
+ {
+ printk(KERN_ERR DRV_NAME ": %s - interrupt %d request fail\n", dev->name, dev->irq);
+ result = -ENODEV;
+ goto err_open;
+ }
- //Prepare mutex
- spin_lock_init(&priv->lock);
+ //Request Transmit Acknowledge IRQ
+ if(request_irq(priv->num_mbx_it_ack, plcdrv_it_txdone, 0, dev->name, dev) != 0)
+ {
+ printk(KERN_ERR DRV_NAME ": %s - interrupt %d request fail\n", dev->name, dev->irq);
+ result = -ENODEV;
+ goto err_rq_ack;
+ }
- //Prepare init structure from lower layers
- info.ring_base_addr = priv->virt_ring_base_addr;
- info.phys_ring_base_addr = priv->phys_ring_base_addr;
- info.mbx_reg_base_addr = dev->base_addr;
- info.debug_mode = debug;
- info.launch_leon = &plcdrv_launch_leon;
- memcpy(info.mac_addr, dev->dev_addr, sizeof(info.mac_addr));
+ //Request Leon Watchdog IRQ
+ if(request_irq(priv->num_mbx_it_wd, plcdrv_it_wd, 0, dev->name, dev) != 0)
+ {
+ printk(KERN_ERR DRV_NAME ": %s - interrupt %d request fail\n", dev->name, dev->irq);
+ result = -ENODEV;
+ goto err_rq_wd;
+ }
//Unreset Leon Processor
if(plcdrv_reset_leon(0))
{
result = -1;
- goto err_open;
+ goto err_rq_wd;
}
//Start lower Layers
+ info.ring_base_addr = priv->virt_ring_base_addr;
+ info.phys_ring_base_addr = priv->phys_ring_base_addr;
+ info.mbx_reg_base_addr = dev->base_addr;
+ info.debug_mode = debug;
+ info.launch_leon = &plcdrv_launch_leon;
+ memcpy(info.mac_addr, dev->dev_addr, sizeof(info.mac_addr));
if(processing_init(&info, dev))
{
printk(KERN_ERR DRV_NAME ": %s: Error initializing hardware (firmware)\n", dev->name);
result = -1;
- goto err_open;
+ goto err_rq_wd;
}
//Allocate RX buffer pool to give to CESAR
@@ -1683,7 +1779,7 @@ int plcdrv_open(struct net_device *dev)
{
printk(KERN_ERR DRV_NAME ": %s: Error creating DATA buffer pool\n", dev->name);
result = -1;
- goto err_open;
+ goto err_rq_wd;
}
// update plc stats
priv->plc_stats.rx_pool++;
@@ -1694,7 +1790,7 @@ int plcdrv_open(struct net_device *dev)
{
printk(KERN_ERR DRV_NAME ": %s: Error creating MME buffer pool\n", dev->name);
result = -1;
- goto err_open;
+ goto err_rq_wd;
}
}
for(i=0 ; i<nb_rx_interface_buffers ; i++)
@@ -1703,40 +1799,12 @@ int plcdrv_open(struct net_device *dev)
{
printk(KERN_ERR DRV_NAME ": %s: Error creating INTERFACE buffer pool\n", dev->name);
result = -1;
- goto err_open;
+ goto err_rq_wd;
}
// update plc stats
priv->plc_stats.rx_pool++;
}
- //Prepare Linux as link up
- netif_carrier_on(dev);
- netif_start_queue(dev);
-
- //Request Receive IRQ
- if(request_irq(priv->num_mbx_it, plcdrv_it_rx, 0, dev->name, dev) != 0)
- {
- printk(KERN_ERR DRV_NAME ": %s - interrupt %d request fail\n", dev->name, dev->irq);
- result = -ENODEV;
- goto err_open;
- }
-
- //Request Transmit Acknowledge IRQ
- if(request_irq(priv->num_mbx_it_ack, plcdrv_it_txdone, 0, dev->name, dev) != 0)
- {
- printk(KERN_ERR DRV_NAME ": %s - interrupt %d request fail\n", dev->name, dev->irq);
- result = -ENODEV;
- goto err_rq_ack;
- }
-
- //Request Leon Watchdog IRQ
- if(request_irq(priv->num_mbx_it_wd, plcdrv_it_wd, 0, dev->name, dev) != 0)
- {
- printk(KERN_ERR DRV_NAME ": %s - interrupt %d request fail\n", dev->name, dev->irq);
- result = -ENODEV;
- goto err_rq_wd;
- }
-
//Enable tasklet for reception
tasklet_enable(&priv->tasklet_it_rx);
@@ -1744,6 +1812,10 @@ int plcdrv_open(struct net_device *dev)
priv->nl_drv_sock = netlink_kernel_create(&init_net, NETLINK_PLC_DRV, 0, plcdrv_netlink_drv_tx, NULL, THIS_MODULE);
priv->nl_mme_sock = netlink_kernel_create(&init_net, NETLINK_PLC_MME, 0, plcdrv_netlink_mme_tx, NULL, THIS_MODULE);
+ //Prepare Linux as link up
+ netif_carrier_on(dev);
+ netif_start_queue(dev);
+
return 0;
err_rq_wd:
@@ -1789,14 +1861,19 @@ int plcdrv_stop(struct net_device *dev)
//Stop tasklet for reception
tasklet_disable(&priv->tasklet_it_rx);
+ //Stop lower layers
+ processing_uninit();
+
+ //Reset LEON and DSP
+ plcdrv_reset_leon(1);
+ plcdrv_reset_dsp(1);
+ plcdrv_reset_dsp(0);
+
//Disconnect from IRQ
free_irq(priv->num_mbx_it, dev);
free_irq(priv->num_mbx_it_ack, dev);
free_irq(priv->num_mbx_it_wd, dev);
- //Stop lower layers
- processing_uninit();
-
//Free mailboxes ring
dma_free_coherent(NULL,
A2L_RING_SIZE+L2A_RING_SIZE,
@@ -1864,6 +1941,7 @@ int plcdrv_init(struct net_device *dev)
//Initialise device functions
ether_setup(dev);
+ dev->uninit = plcdrv_uninit;
dev->open = plcdrv_open;
dev->stop = plcdrv_stop;
dev->do_ioctl = plcdrv_ioctl;
@@ -1895,6 +1973,26 @@ int plcdrv_init(struct net_device *dev)
return 0;
}// plcdrv_init
+/**
+ * Uninitialise the network device.
+ *
+ * \param dev device structure.
+ */
+void plcdrv_uninit(struct net_device *dev)
+{
+ struct net_priv *priv;
+ BUG_ON(!dev);
+ priv = (struct net_priv *)dev->priv;
+ BUG_ON(!priv);
+
+ //Kill tasklet for reception
+ tasklet_kill(&priv->tasklet_it_rx);
+
+ //Unmap IP address
+ BUG_ON(!dev->base_addr);
+ iounmap((void*)dev->base_addr);
+}// plcdrv_uninit
+
/** Character device functions */
static struct file_operations plcdrv_char_fops = {
.owner = THIS_MODULE,
@@ -1921,7 +2019,6 @@ int __init plcdrv_module_init(void)
{
int result;
struct net_device *dev = NULL;
- struct proc_dir_entry *plc_dir;
struct proc_dir_entry *entry;
struct net_priv *priv;
@@ -1996,8 +2093,8 @@ int __init plcdrv_module_init(void)
}
//Create a proc entry for version
- plc_dir = proc_mkdir("plc", init_net.proc_net);
- entry = create_proc_entry("version", 0, plc_dir);
+ proc_plc_dir = proc_mkdir("plc", init_net.proc_net);
+ entry = create_proc_entry("version", 0, proc_plc_dir);
entry->read_proc = plcdrv_readproc_version;
entry->data = (int*)plcdrv_device;
@@ -2007,7 +2104,7 @@ int __init plcdrv_module_init(void)
entry->data = (int*)plcdrv_device;
// Create stats entries
- entry = create_proc_entry ("stats", 0, plc_dir);
+ entry = create_proc_entry ("stats", 0, proc_plc_dir);
entry->read_proc = plcdrv_readproc_plc_stats;
entry->data = (int*)plcdrv_device;
@@ -2025,7 +2122,7 @@ int __init plcdrv_module_init(void)
*/
void __exit plcdrv_module_exit(void)
{
- struct net_priv *priv = NULL;
+ BUG_ON(!plcdrv_device);
//Unregister character device
cdev_del(&plcdrv_char_dev);
@@ -2033,35 +2130,14 @@ void __exit plcdrv_module_exit(void)
unregister_chrdev_region(number, 2);
//Unregister network device
- if(plcdrv_device)
- {
- //Remove proc
- remove_proc_entry("plc/stats", init_net.proc_net);
- remove_proc_entry("plc/version", init_net.proc_net);
- remove_proc_entry("plc/regbank", init_net.proc_net);
- remove_proc_entry("plc", init_net.proc_net);
-
- //Unmap IP address
- if(plcdrv_device->base_addr)
- iounmap((void*)plcdrv_device->base_addr);
-
- priv = plcdrv_device->priv;
- if(priv)
- {
- //Kill tasklet for reception
- tasklet_kill(&priv->tasklet_it_rx);
-
- //Freeing private field of the net device structure
- kfree(priv);
- }
-
- //Unregister net device
- unregister_netdev(plcdrv_device);
-
- //Freeing network device
- free_netdev(plcdrv_device);
- }
-
+ unregister_netdev(plcdrv_device);
+ free_netdev(plcdrv_device);
+
+ //Remove proc
+ remove_proc_entry("stats", proc_plc_dir);
+ remove_proc_entry("version", proc_plc_dir);
+ remove_proc_entry("plc", init_net.proc_net);
+ remove_proc_entry("plc/regbank", init_net.proc_net);
}// plcdrv_module_exit
module_init(plcdrv_module_init);
diff --git a/cleopatre/devkit/plcdrv/arm/src/mailbox.c b/cleopatre/devkit/plcdrv/arm/src/mailbox.c
index b7fa76db5c..c7eab7a24d 100644
--- a/cleopatre/devkit/plcdrv/arm/src/mailbox.c
+++ b/cleopatre/devkit/plcdrv/arm/src/mailbox.c
@@ -14,15 +14,20 @@
* provide all mechanisms to manage mailboxes.
*/
-#ifndef __UTESTS__
#include "common.h"
#include "linux_drv.h"
#include "processing.h"
#include "mailbox.h"
#include "hal.h"
-#else
-#include "common.h"
-#include "mailbox.h"
+
+#include <linux/bitops.h>
+#include <linux/kernel.h>
+
+#ifdef __UTESTS__
+/* TODO : move this ! */
+uint32_t mbx_send_result[2];
+uint32_t mbx_buffer_add_result[2];
+uint32_t mbx_rx_ptr_result;
#endif
/** Define Debug/Trace Level */
@@ -152,7 +157,9 @@ int mailbox_init(struct init_info *info, struct net_device *dev)
L2At_it_disable(ctx);
L2Awd_it_disable(ctx);
- //Clear watchdog interrupt
+ //Clear interrupts
+ clr_A2La_interrupt(ctx);
+ clr_L2At_interrupt(ctx);
clr_L2Awd_interrupt(ctx);
//Unmask sending interrupts
diff --git a/cleopatre/devkit/plcdrv/arm/src/processing.c b/cleopatre/devkit/plcdrv/arm/src/processing.c
index cc37f5969c..c6276167a7 100644
--- a/cleopatre/devkit/plcdrv/arm/src/processing.c
+++ b/cleopatre/devkit/plcdrv/arm/src/processing.c
@@ -14,49 +14,22 @@
* (TX ans RX) and decided to pass and drop it.
*/
-#ifndef __UTESTS__
#include "common.h"
#include "linux_drv.h"
#include "processing.h"
#include "mailbox.h"
-#else
-#include "common.h"
-#include "processing.h"
-#endif
-#ifdef __LINUX__
+#ifndef __UTESTS__
#include <linux/if_ether.h>
#include <linux/if_vlan.h>
#include <asm/byteorder.h>
-#else // __LINUX__
-//Linux not define so we have to redefine all eth header structure and fields
-#define ETH_ALEN 6 //Octets in one Ethernet address
-#define ETH_HLEN 14 //Total octets in header
-#define VLAN_ETH_ALEN 6
-#define VLAN_ETH_HLEN 18
-struct ethhdr
-{
- unsigned char h_dest[ETH_ALEN]; //destination eth address
- unsigned char h_source[ETH_ALEN]; //source eth address
- unsigned short int h_proto; //packet type ID field
-} __attribute__((packed));
-
-struct vlan_ethhdr
-{
- unsigned char h_dest[ETH_ALEN];
- unsigned char h_source[ETH_ALEN];
- unsigned short int h_vlan_proto;
- unsigned short int h_vlan_TCI;
- unsigned short int h_vlan_encapsulated_proto;
-} __attribute__((packed));
-
-#define VLAN_VID_MASK 0x0fff
-
-static inline unsigned short int ntohs(unsigned short int x)
-{
- return x<<8 | x>>8;
-}
-#endif // __LINUX__
+#else //__UTESTS__
+#include <linux/types.h>
+#include <linux/bitops.h>
+#include <linux/kernel.h>
+#include <linux/if_ether.h>
+#include <linux/if_vlan.h>
+#endif // __UTESTS__
/** Define Debug/Trace Level */
#define TRACE(...) if(test_bit(TRACE_PROCESS, (const volatile unsigned long*)&trace)) printk(KERN_INFO "SPC300: PROC: " __VA_ARGS__)
diff --git a/cleopatre/devkit/tests/common/Makefile b/cleopatre/devkit/tests/common/Makefile
new file mode 100644
index 0000000000..5fd841ee8a
--- /dev/null
+++ b/cleopatre/devkit/tests/common/Makefile
@@ -0,0 +1,46 @@
+# Build target busybox for host machine.
+
+BUILDROOT_DIR = ../../../buildroot
+BUILDROOT_TARGET = spk300g_eoc_master
+BUILDROOT_BUSYBOX_DIR = $(BUILDROOT_DIR)/project_build_$(BR2_ARCH)/$(BUILDROOT_TARGET)/busybox-$(BR2_BUSYBOX_VERSION)
+BUILDROOT_BUSYBOX_CONFIG = $(BUILDROOT_DIR)/$(subst ",,$(BR2_PACKAGE_BUSYBOX_CONFIG)) #")
+
+.PHONY: all busybox busybox-config busybox-unpacked \
+ buildroot-config clean
+
+all:
+
+-include $(BUILDROOT_DIR)/.config
+
+ifdef BR2_PROJECT
+ ifneq ($(BR2_PROJECT),"$(BUILDROOT_TARGET)")
+ ifndef FORCE
+ $(error Should clean buildroot project $(BR2_PROJECT) != $(BUILDROOT_TARGET))
+ endif
+ endif
+endif
+
+busybox: busybox-config
+ $(MAKE) -C busybox
+
+busybox-config: busybox/.config
+
+busybox/.config: $(BUILDROOT_BUSYBOX_CONFIG) busybox-unpacked
+ test -n '$(BR2_PACKAGE_BUSYBOX_CONFIG)'
+ mkdir -p busybox
+ cp $< $@
+ sed -i 's/CONFIG_HALT=y/# CONFIG_HALT is not set/' $@
+ $(MAKE) -C $(BUILDROOT_BUSYBOX_DIR) O=$(CURDIR)/busybox oldconfig
+
+busybox-unpacked: buildroot-config
+ $(MAKE) -C $(BUILDROOT_DIR) dirs busybox-unpacked
+
+buildroot-config: $(BUILDROOT_DIR)/.config
+
+$(BUILDROOT_DIR)/.config:
+ $(MAKE) -C $(BUILDROOT_DIR) $(BUILDROOT_TARGET)_defconfig
+
+clean:
+ if test -f busybox/Makefile; then \
+ $(MAKE) -C busybox clean; \
+ fi
diff --git a/cleopatre/devkit/tests/fw_wd/Makefile b/cleopatre/devkit/tests/fw_wd/Makefile
new file mode 100644
index 0000000000..de2cfaefcd
--- /dev/null
+++ b/cleopatre/devkit/tests/fw_wd/Makefile
@@ -0,0 +1,15 @@
+BUSYBOX = ../common/busybox/busybox
+
+.PHONY: all busybox tests clean
+
+all: busybox
+
+busybox:
+ $(MAKE) -C ../common busybox
+
+tests: busybox
+ ./run-test
+
+clean:
+ $(MAKE) -C ../common clean
+ rm -rf root
diff --git a/cleopatre/devkit/tests/fw_wd/run-test b/cleopatre/devkit/tests/fw_wd/run-test
new file mode 100755
index 0000000000..ce1d77218e
--- /dev/null
+++ b/cleopatre/devkit/tests/fw_wd/run-test
@@ -0,0 +1,248 @@
+#!/usr/bin/python
+"""Test FW watch daemon."""
+from shutil import copy, rmtree
+from os import symlink, mkdir, chmod
+import sys
+import subprocess
+import gzip
+import time
+
+busybox_path = '../common/busybox/busybox'
+fw_wd_path = '../../../application/fw_wd'
+
+trace_content = """\
+Test trace line 1
+Test trace line 2
+Test trace line 3
+Test trace line 4
+Test trace line 5
+"""
+
+trace_files_content = {
+'/etc/hpav.info': """\
+hpav.info file line 1
+hpav.info file line 2
+""",
+'/proc/uptime': """\
+uptime line 1
+""",
+}
+
+fw_wd_stub = """\
+#!/bin/sh
+test -f /tmp/fw_wd_run && echo "fw_wd stop test" && exit 1
+touch /tmp/fw_wd_run
+echo "fw_wd run"
+exit %(retcode)s
+"""
+
+fw_wd_wait_stub = """\
+#!/bin/sh
+echo "fw_wd run"
+trap : TERM
+sleep 100 &
+pid=$!
+wait $pid
+kill $pid
+"""
+
+reboot_stub = """\
+#!/bin/sh
+echo "reboot run"
+exit %(retcode)s
+"""
+
+default_content = """\
+REBOOT=%(reboot)s
+TRACE_ENABLED=%(trace_enabled)s
+TRACE_FOLDER="/usr/local/trace/"
+TRACE_FILES="%(trace_files)s"
+TRACE_CMDS="%(trace_cmds)s"
+"""
+
+chroot_env = {
+ 'PATH': '/bin:/sbin:/usr/bin:/usr/sbin',
+ 'USER': 'testuser',
+ 'SHELL': '/bin/sh',
+ }
+
+trace_cmds = [ [ ], [ 'echo choucroute' ] ]
+trace_cmds_result = [ [ ], [ 'choucroute\n' ] ]
+
+class TestParams:
+ def __init__(self, test_name, **kw):
+ self.test_name = test_name
+ self.fw_wd_retcode = 0
+ self.reboot = True
+ self.reboot_retcode = 0
+ self.trace_enabled = True
+ self.trace_present = True
+ self.trace_files = [ '/proc/uptime', '/etc/hpav.info' ]
+ self.trace_cmds_test = False
+ self.trace_dir = True
+ self.old_traces = [ ]
+ self.kill = False
+ self.__dict__.update(kw)
+
+def chroot_call(root_path, command):
+ """Call a command in the chrooted environment, raise error on any
+ problem."""
+ subprocess.check_call([ 'fakechroot', '/usr/sbin/chroot', root_path ] +
+ command)
+
+def create_file(root_path, filename, content, executable=False):
+ """Create a text file in rootfs with given content. Give execution
+ permissions if requested."""
+ f = open(root_path + filename, 'w')
+ f.write(content)
+ f.close()
+ if executable:
+ chmod(root_path + filename, 0755)
+
+def create_rootfs(root_path, test_params):
+ """Create a full rootfs from given test parameters. Clean up if rootfs is
+ existent."""
+ # Create basic rootfs.
+ rmtree(root_path, ignore_errors=True)
+ mkdir(root_path)
+ for p in [ '/bin', '/sbin', '/usr', '/usr/bin', '/usr/sbin', '/usr/local',
+ '/proc', '/proc/self', '/dev', '/etc', '/etc/default', '/tmp' ]:
+ mkdir(root_path + p)
+ copy(busybox_path, root_path + '/bin')
+ symlink('/bin/busybox', root_path + '/proc/self/exe')
+ chroot_call(root_path, [ '/bin/busybox', '--install', '-s' ])
+ copy(fw_wd_path + '/fwwatchd', root_path + '/usr/bin')
+ create_file(root_path, '/dev/null', '')
+ # Create test stubs.
+ if not test_params.kill:
+ create_file(root_path, '/usr/bin/fw_wd',
+ fw_wd_stub % { 'retcode': test_params.fw_wd_retcode },
+ executable=True)
+ else:
+ create_file(root_path, '/usr/bin/fw_wd', fw_wd_wait_stub,
+ executable=True)
+ create_file(root_path, '/sbin/reboot',
+ reboot_stub % { 'retcode': test_params.reboot_retcode },
+ executable=True)
+ if test_params.trace_present:
+ create_file(root_path, '/dev/trace', trace_content)
+ for f in test_params.trace_files:
+ create_file(root_path, f, trace_files_content[f])
+ if test_params.trace_dir:
+ mkdir(root_path + '/usr/local/trace')
+ for i in test_params.old_traces:
+ create_file(root_path, '/usr/local/trace/trace_%d.gz' % i,
+ 'Old trace %d' % i)
+ # Create default file.
+ def bool_value(b):
+ return 'true' if b else 'false'
+ def list_value(l):
+ return ':'.join(l)
+ create_file(root_path, '/etc/default/fwwatchd', default_content % {
+ 'reboot': bool_value(test_params.reboot),
+ 'trace_enabled': bool_value(test_params.trace_enabled),
+ 'trace_files': list_value(test_params.trace_files),
+ 'trace_cmds': list_value(trace_cmds[test_params.trace_cmds_test]),
+ })
+
+def check(root_path, test_params, stdout):
+ """Check test result."""
+ # Check stdout.
+ if not test_params.trace_enabled:
+ expected_stdout = ''
+ else:
+ expected_stdout = 'fw_wd run\n'
+ if test_params.fw_wd_retcode == 0 and not test_params.kill:
+ if test_params.reboot:
+ expected_stdout += 'reboot run\n'
+ if test_params.reboot_retcode == 0:
+ expected_stdout += 'fw_wd stop test\n'
+ if expected_stdout != stdout:
+ print test_params.test_name, "failed (%s != %s)" % (repr(stdout),
+ repr(expected_stdout))
+ return False
+ # Check trace file.
+ expected_trace = ''
+ expected_last_head_trace = ''
+ if test_params.trace_enabled and test_params.fw_wd_retcode == 0 \
+ and not test_params.kill:
+ if test_params.trace_present:
+ expected_last_head_trace = \
+ '\n'.join(trace_content.split('\n')[0:3]) + '\n'
+ expected_trace += expected_last_head_trace + trace_content
+ for f in test_params.trace_files:
+ expected_trace += "==== %s ====\n" % f
+ expected_trace += trace_files_content[f]
+ expected_trace += "\n"
+ for cmd, result in zip(trace_cmds[test_params.trace_cmds_test],
+ trace_cmds_result[test_params.trace_cmds_test]):
+ expected_trace += "==== %s ====\n" % cmd
+ expected_trace += result
+ expected_trace += "\n"
+ expected_trace_nb = max(test_params.old_traces + [ 0 ] ) + 1
+ expected_file_name = '/usr/local/trace/trace_%d.gz' % expected_trace_nb
+ try:
+ f = gzip.open(root_path + expected_file_name)
+ if not expected_trace:
+ print test_params.test_name, \
+ "failed (%s exists)" % expected_file_name
+ return False
+ else:
+ trace = f.read()
+ if expected_trace != trace:
+ print test_params.test_name, "failed"
+ print "expected trace:\n", expected_trace
+ print "trace:\n", trace
+ return False
+ f.close()
+ except IOError:
+ if expected_trace:
+ print test_params.test_name, \
+ "failed (can not open %s)" % expected_file_name
+ return False
+ return True
+
+def run_test(root_path, test_params):
+ """Run FW watch daemon in a chrooted environment and check result. Return
+ a number of failed test."""
+ create_rootfs('root', test_params)
+ proc = subprocess.Popen([ 'fakechroot', '/usr/sbin/chroot', root_path,
+ '/usr/bin/fwwatchd' ], stdout=subprocess.PIPE, stderr=subprocess.PIPE,
+ env=chroot_env)
+ if test_params.kill:
+ time.sleep(0.1)
+ proc.terminate()
+ stdout = proc.communicate()[0]
+ result = check('root', test_params, stdout)
+ return 0 if result else 1
+
+if __name__ == '__main__':
+ failed = 0
+ tp = TestParams("default params")
+ failed += run_test('root', tp)
+ # Watchdog test.
+ tp = TestParams("fw_wd fail", fw_wd_retcode=1)
+ failed += run_test('root', tp)
+ tp = TestParams("kill script", kill=True)
+ failed += run_test('root', tp)
+ # Trace tests.
+ tp = TestParams("trace disabled", trace_enabled=False)
+ failed += run_test('root', tp)
+ tp = TestParams("trace not available", trace_present=False)
+ failed += run_test('root', tp)
+ tp = TestParams("no trace files", trace_files=[ ])
+ failed += run_test('root', tp)
+ tp = TestParams("trace commands", trace_cmds_test=True)
+ failed += run_test('root', tp)
+ tp = TestParams("no trace dir", trace_dir=False)
+ failed += run_test('root', tp)
+ tp = TestParams("old traces", old_traces=[ 1, 2, 8 ])
+ failed += run_test('root', tp)
+ # Reboot tests.
+ tp = TestParams("no reboot", reboot=False)
+ failed += run_test('root', tp)
+ tp = TestParams("reboot fail", reboot_retcode=1)
+ failed += run_test('root', tp)
+ # Bye.
+ print "failed %d tests" % failed
+ sys.exit (1 if failed else 0)
diff --git a/cleopatre/devkit/tests/hal/gidel/ftests/Makefile b/cleopatre/devkit/tests/hal/gidel/ftests/Makefile
deleted file mode 100644
index a3224c5321..0000000000
--- a/cleopatre/devkit/tests/hal/gidel/ftests/Makefile
+++ /dev/null
@@ -1,34 +0,0 @@
-BASE := $(CURDIR)/../../../../..
-OBJPATH := ./obj
-SRCPATH := ./src
-PRJPATH := $(BASE)/devkit/hal/gidel
-INC_PRJPATH := $(PRJPATH)
-###################################################
-
-# Common stuff
-CC := g++
-CFLAGS := -Wall -g3 -DLINUX -I. -I$(INC_PRJPATH)
-LIBS := -L$(PRJPATH) -lgidel -lgidelproc
-export LD_LIBRARY_PATH=\$$LD_LIBRARY_PATH:$(PRJPATH)
-
-SRCS=$(subst $(SRCPATH)/,,$(wildcard $(SRCPATH)/*.cpp))
-BINS=$(addprefix $(OBJPATH)/,$(SRCS:.cpp=.elf))
-
-
-# Rules
-all: $(PRJPATH)/libgidel.so $(OBJPATH) $(BINS)
-
-$(PRJPATH)/libgidel.so:
- $(MAKE) -C $(PRJPATH)
-
-$(OBJPATH)/%.elf: $(OBJPATH)/%.o
- $(CC) -shared -o $@ $^ $(LIBS)
-
-$(OBJPATH)/%.o : $(SRCPATH)/%.cpp
- $(CC) $(CFLAGS) -c -o $@ $<
-
-$(OBJPATH):
- mkdir -p $@
-
-clean :
- rm -rf $(OBJPATH)
diff --git a/cleopatre/devkit/tests/hal/gidel/ftests/src/start.cpp b/cleopatre/devkit/tests/hal/gidel/ftests/src/start.cpp
deleted file mode 100644
index bf7acf4975..0000000000
--- a/cleopatre/devkit/tests/hal/gidel/ftests/src/start.cpp
+++ /dev/null
@@ -1,139 +0,0 @@
-/* Cesar project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file test.cpp
- * \brief simple loader and basic test program
- * \ingroup
- *
- * this program load an rbf file into the gidel's FPGA
- * and start some tests
- */
-
-#include <stdio.h>
-#include <ctype.h>
-#include <signal.h>
-#include "AHBMemory.h"
-#include "AHBRegister.h"
-#include "Gidel.h"
-
-#define FPGA_NUM 1
-#define RBF "/home/spidcom/Maria_proto/projects/Maria_Proto_11/modules/maria_proto/board/hardware/proto_maria_ddr/fpga.rbf"
-
-CGidel *m_gidel = NULL;
-char rbf[_MAX_PATH];
-
-static void catch_sigint(int sig)
-{
- if(m_gidel != NULL)
- {
- printf("freeing memory...\n");
- delete m_gidel;
- }
- exit(0);
-}
-
-void test_irq(LPVOID pData)
-{
- printf("Oh What a pretty IRQ !\n");
-}
-
-int main(int argc, char* argv[])
-{
- unsigned char user;
-
- signal(SIGINT, catch_sigint);
-
- memset(rbf, 0, sizeof(rbf));
- strcpy(rbf, RBF);
-
- //download .rbf into the FPGA
- printf("\nLoading FPGA under GIDEL..........");
- try
- {
- m_gidel = new CGidel(rbf, FPGA_NUM, 0);
- }
- catch(const ProcException& e)
- {
- e.ErrorMsg();
- exit(-1);
- }
- catch(...)
- {
- printf("failed\nUnable to Load FPGA under Gidel\n");
- exit(-1);
- }
- //print rbf version
- printf("done (V%d)\n", m_gidel->GetRBFVersion());
- //start processor and ahb
- printf("Starting processor and AHB........");
- m_gidel->f_rst_ahb = 0;
- m_gidel->f_rst_proc = 0;
-
- if(!m_gidel->f_rst_ahb && !m_gidel->f_rst_proc)
- printf("done\n");
- else
- printf("failed\nUnable to UnReset processor and AHB\n");
-
- unsigned int test;
- AHBRegister leon_cfg_reg(m_gidel, 0x80000024);
- test = leon_cfg_reg;
- printf("leon_cfg_reg=%x\n",test);
- printf("leon_cfg_reg=%x\n",(unsigned int)leon_cfg_reg);
-
- unsigned int test1;
- AHBRegister myreg(m_gidel, 0xB5000010);
- test1 = myreg;
- printf("test1=%x\n",test1);
- myreg = 0x12345678;
- printf("myreg=%x\n",(unsigned int)myreg);
-
- unsigned int test2, test3, val[4] = {0x11111111, 0x22222222, 0x33333333, 0x44444444};
- AHBMemoryPtr<DWORD> memory(m_gidel, 0x00000030, 4);
- for(int i=0 ; i<4 ; i++)
- {
- *memory = val[i];
- test2 = *memory;
- test3 = memory.GetAddr();
- printf("memory 0x%08x=%08x\n", test3, test2);
- memory = memory + 1;
-// memory += 1;
-// memory++;
- }
-
- //set interrupt handler (interrupt from LEON)
- m_gidel->SetUserInterruptHandler(&test_irq);
- m_gidel->EnableInterrupt(true);
-
- //config interrupt to LEON
- //active interrupt 5 with GPIO14 on positive edge
- printf("Waiting debuggueur..."); scanf("%c",&user);
- unsigned int cfg;
- AHBRegister gpio_int_cfg(m_gidel, 0x800000A8);
- cfg = gpio_int_cfg;
- printf("GPIO int cfg before : %x\n",cfg);
- gpio_int_cfg = (cfg & 0xFFFF00FF) | 0xEE00; //active interrupt on GPIO 14 on positive edge
- printf("GPIO int cfg after : %x\n",(unsigned int)gpio_int_cfg);
-
- do {
- //start interrupt to LEON
- printf("Start Interrupt to LEON (%x) ? (y/n): ", (unsigned int)m_gidel->r_Pciit);
- scanf("%c",&user);
-
- if(user == 'y')
- {
- printf("Interrupt sending\n");
- if(m_gidel->f_pciit_to_leon == 1)
- m_gidel->f_pciit_to_leon = 0;
- else
- m_gidel->f_pciit_to_leon = 1;
- }
- } while(1); //wait Ctrl+C
-
- return 0;
-}
-
diff --git a/cleopatre/devkit/tests/hal/gidel/ftests/src/start2.cpp b/cleopatre/devkit/tests/hal/gidel/ftests/src/start2.cpp
deleted file mode 100644
index a5d2c1a08b..0000000000
--- a/cleopatre/devkit/tests/hal/gidel/ftests/src/start2.cpp
+++ /dev/null
@@ -1,117 +0,0 @@
-/* Cesar project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file test.cpp
- * \brief simple loader and basic test program
- * \ingroup
- *
- * this program load an rbf file into the gidel's FPGA
- * and start some tests
- */
-
-#include <stdio.h>
-#include <ctype.h>
-#include <signal.h>
-#include "AHBMemory.h"
-#include "AHBRegister.h"
-#include "Gidel.h"
-
-#define FPGA_NUM 1
-#define RBF "/home/spidcom/Maria_proto/projects/Maria_Proto_11/modules/maria_proto/board/hardware/proto_maria_ddr/fpga.rbf"
-
-CGidel *m_gidel = NULL;
-char rbf[_MAX_PATH];
-
-static void catch_sigint(int sig)
-{
- if(m_gidel != NULL)
- {
- printf("freeing memory...\n");
- delete m_gidel;
- }
- exit(0);
-}
-
-void test_irq(LPVOID pData)
-{
- printf("Oh What a pretty IRQ !\n");
-}
-
-int main(int argc, char* argv[])
-{
- signal(SIGINT, catch_sigint);
-
- memset(rbf, 0, sizeof(rbf));
- strcpy(rbf, RBF);
-
- //download .rbf into the FPGA
- printf("\nLoading FPGA under GIDEL..........");
- try
- {
- m_gidel = new CGidel(rbf, FPGA_NUM, 0);
- }
- catch(const ProcException& e)
- {
- e.ErrorMsg();
- exit(-1);
- }
- catch(...)
- {
- printf("failed\nUnable to Load FPGA under Gidel\n");
- exit(-1);
- }
- //print rbf version
- printf("done (V%d)\n", m_gidel->GetRBFVersion());
- //start processor and ahb
- printf("Starting processor and AHB........");
- m_gidel->f_rst_ahb = 0;
- m_gidel->f_rst_proc = 0;
-
- if(!m_gidel->f_rst_ahb && !m_gidel->f_rst_proc)
- printf("done\n");
- else
- printf("failed\nUnable to UnReset processor and AHB\n");
-
- //set interrupt handler (interrupt from LEON)
- m_gidel->SetUserInterruptHandler(&test_irq);
- m_gidel->EnableInterrupt(true);
-
- AHBRegister L2A_head(m_gidel, 0xB500001C);
-
- unsigned int error = 0;
- unsigned int result;
- printf("Read/Write test starting... ");
-
- for(unsigned int i=0;;i++)
- {
- L2A_head = i;
- result = L2A_head;
- if(result != i)
- {
- printf("i=0x%08x ; result=0x%08x\n",i,result);
- printf("PCI latency Last=%d ; PCI latency Max=%d\n", (unsigned int)m_gidel->r_PCILatencyLast, (unsigned int)m_gidel->r_PCILatencyMax);
- error++;
- }
- if((!(i%100000)) && (i!=0))
- {
- if(error)
- {
- printf("%d on %d Errors\n", error, i);
- i = 0;
- error = 0;
- }
- else
- {
- i = 0;
- printf("No Errors\n");
- }
- }
- }
- return 0;
-}
-
diff --git a/cleopatre/devkit/tests/hal/gidel/ftests/src/start3.cpp b/cleopatre/devkit/tests/hal/gidel/ftests/src/start3.cpp
deleted file mode 100644
index a5953dd508..0000000000
--- a/cleopatre/devkit/tests/hal/gidel/ftests/src/start3.cpp
+++ /dev/null
@@ -1,137 +0,0 @@
-/* Cesar project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file test.cpp
- * \brief simple loader and basic test program
- * \ingroup
- *
- * this program load an rbf file into the gidel's FPGA
- * and start some tests
- */
-
-#include <stdio.h>
-#include <ctype.h>
-#include <signal.h>
-#include "AHBMemory.h"
-#include "AHBRegister.h"
-#include "Gidel.h"
-
-#define FPGA_NUM 1
-#define RBF "/home/spidcom/Maria_proto/projects/Maria_Proto_11/modules/maria_proto/board/hardware/proto_maria_ddr/fpga.rbf"
-
-CGidel *m_gidel = NULL;
-char rbf[_MAX_PATH];
-
-static void catch_sigint(int sig)
-{
- if(m_gidel != NULL)
- {
- printf("freeing memory...\n");
- delete m_gidel;
- }
- exit(0);
-}
-
-void test_irq(LPVOID pData)
-{
- printf("Oh What a pretty IRQ !\n");
-}
-
-int main(int argc, char* argv[])
-{
- signal(SIGINT, catch_sigint);
-
- memset(rbf, 0, sizeof(rbf));
- strcpy(rbf, RBF);
-
- //download .rbf into the FPGA
- printf("\nLoading FPGA under GIDEL..........");
- try
- {
- m_gidel = new CGidel(rbf, FPGA_NUM, 0);
- }
- catch(const ProcException& e)
- {
- e.ErrorMsg();
- exit(-1);
- }
- catch(...)
- {
- printf("failed\nUnable to Load FPGA under Gidel\n");
- exit(-1);
- }
- //print rbf version
- printf("done (V%d)\n", m_gidel->GetRBFVersion());
- //start processor and ahb
- printf("Starting processor and AHB........");
- m_gidel->f_rst_ahb = 0;
- m_gidel->f_rst_proc = 0;
-
- if(!m_gidel->f_rst_ahb && !m_gidel->f_rst_proc)
- printf("done\n");
- else
- printf("failed\nUnable to UnReset processor and AHB\n");
-
- //set interrupt handler (interrupt from LEON)
- m_gidel->SetUserInterruptHandler(&test_irq);
- m_gidel->EnableInterrupt(true);
-
- AHBMemoryPtr<uint32_t> ddr2(m_gidel, 0x50000, 4);
-
- unsigned int error = 0;
- unsigned int result[4];
- printf("Read/Write test starting... \n");
-
- for(unsigned int i=0;;i++)
- {
- *ddr2 = i;
- *(ddr2+1) = i+1;
- *(ddr2+2) = i+2;
- *(ddr2+3) = i+3;
- result[0] = *ddr2;
- result[1] = *(ddr2+1);
- result[2] = *(ddr2+2);
- result[3] = *(ddr2+3);
- if(result[0] != i)
- {
- printf("00000 i=0x%08x ; result=0x%08x\n",i,result[0]);
- error++;
- }
- if(result[1] != i+1)
- {
- printf("11111 i=0x%08x ; result=0x%08x\n",i+1,result[1]);
- error++;
- }
- if(result[2] != i+2)
- {
- printf("22222 i=0x%08x ; result=0x%08x\n",i+2,result[2]);
- error++;
- }
- if(result[3] != i+3)
- {
- printf("44444 i=0x%08x ; result=0x%08x\n",i+3,result[3]);
- error++;
- }
- if((!(i%25000)) && (i!=0))
- {
- if(error)
- {
- printf("%d on %d Errors\n", error, i);
- i = 0;
- error = 0;
- }
- else
- {
- i = 0;
- printf("No Errors\n");
- }
- }
- }
- return 0;
-}
-
diff --git a/cleopatre/devkit/tests/kernel/drivers/gpio/ftests/interrupt/Makefile b/cleopatre/devkit/tests/kernel/drivers/gpio/ftests/interrupt/Makefile
index 4328624292..ffa0511e7d 100644
--- a/cleopatre/devkit/tests/kernel/drivers/gpio/ftests/interrupt/Makefile
+++ b/cleopatre/devkit/tests/kernel/drivers/gpio/ftests/interrupt/Makefile
@@ -1,33 +1,16 @@
-BIN=gpio_interrupt
-OBJPATH=./obj
-SRCPATH=./src
-INCPATH=./inc
+BASE = ../../../../../../../../cesar
+CLEO_BASE = ../cleopatre
-CC=arm-linux-gcc
-CC_WITH_CFLAGS=$(CC) -I/opt/spidcom/spc300/usr/include -g -Os
-CC_WITHOUT_CFLAGS=$(CC)
-LINUX_DIR=../../../../../../../linux-2.6.25.10-spc300
-EXTRA_CFLAGS=-I$(INCPATH) -I$(LINUX_DIR)/include -MMD
+LINUX_PATH = $(CLEO_BASE)/linux-2.6.25.10-spc300
-SRCS=$(subst $(SRCPATH)/,,$(wildcard $(SRCPATH)/*.c))
-OBJS=$(addprefix $(OBJPATH)/,$(SRCS:.c=.o))
-DEPS=$(patsubst %o,%d,$(OBJS))
+INCLUDES = $(LINUX_PATH)/include/
-all: $(BIN)
+EXTRA_TARGET_CFLAGS = -I/opt/spidcom/spc300/usr/include
-$(BIN): $(OBJPATH) $(OBJS)
- $(CC_WITHOUT_CFLAGS) -o $@ $(OBJS)
+TARGET_PROGRAMS = gpio_interrupt
-$(OBJPATH)/%.o: $(SRCPATH)/%.c
- $(CC_WITH_CFLAGS) $(EXTRA_CFLAGS) -o $@ -c $<
+TARGET = arm
-$(OBJPATH):
- mkdir -p $(OBJPATH)
-
--include $(DEPS)
-
-.PHONY: all clean
-
-clean:
- rm -f $(OBJS) $(DEPS) $(BIN)
+gpio_interrupt_SOURCES = gpio_interrupt.c
+include $(BASE)/common/make/top.mk
diff --git a/cleopatre/devkit/tests/kernel/drivers/gpio/ftests/module/Kbuild b/cleopatre/devkit/tests/kernel/drivers/gpio/ftests/module/Kbuild
new file mode 100644
index 0000000000..e1b0e05f31
--- /dev/null
+++ b/cleopatre/devkit/tests/kernel/drivers/gpio/ftests/module/Kbuild
@@ -0,0 +1,4 @@
+obj-m := testgpio.o
+testgpio-objs := src/gpio_kernel.o
+
+EXTRA_CFLAGS += -I$(M)/inc
diff --git a/cleopatre/devkit/tests/kernel/drivers/gpio/ftests/module/Makefile b/cleopatre/devkit/tests/kernel/drivers/gpio/ftests/module/Makefile
index ef8c67ab26..2f302c9c7d 100644
--- a/cleopatre/devkit/tests/kernel/drivers/gpio/ftests/module/Makefile
+++ b/cleopatre/devkit/tests/kernel/drivers/gpio/ftests/module/Makefile
@@ -1,47 +1,12 @@
-BASEPATH=../../../../../../..
-TESTSUBPATH=devkit/tests/kernel/drivers/gpio/ftests/module
-TESTPATH=$(BASEPATH)/$(TESTSUBPATH)
-KRNPATH=$(BASEPATH)/linux-2.6.25.10-spc300
-DEBUG = n
+KERNELDIR := ../../../../../../../linux-2.6.25.10-spc300
-# Add our debugging flag to CFLAGS
-ifeq ($(DEBUG),y)
- DEBFLAGS = -O -g
-else
- DEBFLAGS = -Os
-endif
+# all rules is buggy for external modules, default to modules rule
+all:
+ $(MAKE) -C $(KERNELDIR) M=`pwd` ARCH=arm CROSS_COMPILE=arm-linux- modules
-#We cannot modify CFLAGS but we have to methods to add CFLAGS
-#1st for all files
-EXTRA_CFLAGS += $(DEBFLAGS) -D__LINUX__
-EXTRA_CFLAGS += -I../$(TESTSUBPATH)/inc
-#2nd for each file
-#CFLAGS_gpio_kernel.o := $(DEBFLAGS) -D__LINUX__ -I../$(TESTSUBPATH)/inc
+%::
+ $(MAKE) -C $(KERNELDIR) M=`pwd` ARCH=arm CROSS_COMPILE=arm-linux- $@
-ifneq ($(KERNELRELEASE),)
-# call from kernel build system
-
-testgpio-objs := src/gpio_kernel.o
-obj-m := testgpio.o
-
-else
-
-KERNELDIR ?= $(KRNPATH)
-PWD := $(CURDIR)
-
-modules:
- $(MAKE) -C $(KERNELDIR) ARCH=arm CROSS_COMPILE=arm-linux- M=$(PWD) modules
-endif
-
-
-clean:
- rm -f $(TESTPATH)/src/*.o
- rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c *.mod.o .tmp_versions modules.order Module.symvers
-
-depend .depend dep:
- $(CC) $(CFLAGS) -M *.c > .depend
-
-
-ifeq (.depend,$(wildcard .depend))
-include .depend
-endif
+clean::
+ $(MAKE) -C $(KERNELDIR) M=`pwd` ARCH=arm CROSS_COMPILE=arm-linux- $@
+ rm -f $(CURDIR)/modules.order
diff --git a/cleopatre/devkit/tests/kernel/drivers/gpio/ftests/user/Makefile b/cleopatre/devkit/tests/kernel/drivers/gpio/ftests/user/Makefile
index 4a4646eec4..3d4924c1ad 100644
--- a/cleopatre/devkit/tests/kernel/drivers/gpio/ftests/user/Makefile
+++ b/cleopatre/devkit/tests/kernel/drivers/gpio/ftests/user/Makefile
@@ -1,33 +1,16 @@
-BIN=gpio_user
-OBJPATH=./obj
-SRCPATH=./src
-INCPATH=./inc
+BASE = ../../../../../../../../cesar
+CLEO_BASE = ../cleopatre
-CC=arm-linux-gcc
-CC_WITH_CFLAGS=$(CC) -I/opt/spidcom/spc300/usr/include -g -Os
-CC_WITHOUT_CFLAGS=$(CC)
-LINUX_DIR=../../../../../../../linux-2.6.25.10-spc300
-EXTRA_CFLAGS=-I$(INCPATH) -I$(LINUX_DIR)/include -MMD
+LINUX_PATH = $(CLEO_BASE)/linux-2.6.25.10-spc300
-SRCS=$(subst $(SRCPATH)/,,$(wildcard $(SRCPATH)/*.c))
-OBJS=$(addprefix $(OBJPATH)/,$(SRCS:.c=.o))
-DEPS=$(patsubst %o,%d,$(OBJS))
+INCLUDES = $(LINUX_PATH)/include/
-all: $(BIN)
+EXTRA_TARGET_CFLAGS = -I/opt/spidcom/spc300/usr/include
-$(BIN): $(OBJPATH) $(OBJS)
- $(CC_WITHOUT_CFLAGS) -o $@ $(OBJS)
+TARGET_PROGRAMS = gpio_user
-$(OBJPATH)/%.o: $(SRCPATH)/%.c
- $(CC_WITH_CFLAGS) $(EXTRA_CFLAGS) -o $@ -c $<
+TARGET = arm
-$(OBJPATH):
- mkdir -p $(OBJPATH)
-
--include $(DEPS)
-
-.PHONY: all clean
-
-clean:
- rm -f $(OBJS) $(DEPS) $(BIN)
+gpio_user_SOURCES = gpio_user.c
+include $(BASE)/common/make/top.mk
diff --git a/cleopatre/devkit/tests/libmme/utests/Makefile b/cleopatre/devkit/tests/libmme/utests/Makefile
index 2d2cc67eb2..740ad756b8 100644
--- a/cleopatre/devkit/tests/libmme/utests/Makefile
+++ b/cleopatre/devkit/tests/libmme/utests/Makefile
@@ -1,8 +1,18 @@
-BASE = ../../../..
-PRJ_BASE = $(BASE)/application/libmme
-LINUX_DIR = $(BASE)/linux-2.6.25.10-spc300/include
-EXTRA_CFLAGS = -I$(LINUX_DIR)
-FILES = mme
+BASE = ../../../../../cesar
+CLEO_BASE = ../cleopatre
-include ../../utests_makerules
+LINUX_PATH = $(CLEO_BASE)/linux-2.6.25.10-spc300
+# We test libmme.
+PROJECT_DIR = $(CLEO_BASE)/application/libmme
+
+INCLUDES = $(PROJECT_DIR)/inc $(LINUX_PATH)/include
+
+EXTRA_HOST_LDLIBS = -lcheck -lpthread
+
+HOST_PROGRAMS = mme_utests
+
+mme_utests_SOURCES = mme_utests.c
+mme_utests_MODULES = $(PROJECT_DIR)
+
+include $(BASE)/common/make/top.mk
diff --git a/cleopatre/devkit/tests/libmme/utests/src/mme_utests.c b/cleopatre/devkit/tests/libmme/utests/src/mme_utests.c
index 73a31771ea..17772c72a9 100644
--- a/cleopatre/devkit/tests/libmme/utests/src/mme_utests.c
+++ b/cleopatre/devkit/tests/libmme/utests/src/mme_utests.c
@@ -182,8 +182,8 @@ static int send_message()
MME_t *mh = &hdr;
int nbpkt;
unsigned short hfmi;
- int fo; /* current fragment offset */
- int fs; /* current fragment size */
+ unsigned int fo; /* current fragment offset */
+ unsigned int fs; /* current fragment size */
int i;
unsigned char *pkt = NULL;
int pkt_len;
@@ -279,6 +279,25 @@ static void* thread_sender(void *unused)
TRACE("Thread 'sender' starting...\n");
+ /* form the thread MME context */
+ thr_ctx->buffer = thr_buff;
+ thr_ctx->mmtype = mmtype; /* type of MME that server thread will be sending */
+ thr_ctx->length = sizeof(thr_buff);
+ thr_ctx->head = HEAD;
+ thr_ctx->tail = HEAD + MSG_LEN;
+ thr_ctx->status = MME_STATUS_OK;
+
+ /* clean temporary buffer */
+ memset(thr_buff, 0x0, sizeof(thr_buff));
+
+ /* write in it server thread message */
+ /* we will form test payload like this :
+ * |MME_HEADER|00...00|cc...ccee...ee|00..00|
+ * head tail
+ */
+ memset(thr_buff + HEAD, 0xcc, MSG_LEN/2);
+ memset(thr_buff+ HEAD + MSG_LEN/2, 0xee, MSG_LEN/2);
+
while (1)
{
/*
@@ -292,28 +311,6 @@ static void* thread_sender(void *unused)
if (end)
break;
- /*
- * Now you can do the work
- */
- /* form the thread MME context */
- thr_ctx->buffer = thr_buff;
- thr_ctx->mmtype = mmtype; /* type of MME that server thread will be sending */
- thr_ctx->length = sizeof(thr_buff);
- thr_ctx->head = HEAD;
- thr_ctx->tail = HEAD + MSG_LEN;
- thr_ctx->status = MME_STATUS_OK;
-
- /* clean temporary buffer */
- memset(thr_buff, 0x0, sizeof(thr_buff));
-
- /* write in it server thread message */
- /* we will form test payload like this :
- * |MME_HEADER|00...00|cc...ccee...ee|00..00|
- * head tail
- */
- memset(thr_buff + HEAD, 0xcc, MSG_LEN/2);
- memset(thr_buff+ HEAD + MSG_LEN/2, 0xee, MSG_LEN/2);
-
/* send the payload */
send_message();
} /* while */
@@ -425,7 +422,7 @@ static void* thread_receiver(void *unused)
mh = (MME_t *)frame_tx;
if ( (rcv_len > 0) &&
- (rcv_len >= sizeof(MME_t)) &&
+ (rcv_len >= (int)sizeof(MME_t)) &&
(memcmp(mh->mme_dest, dst_addr, 6) == 0) &&
(mh->mmtype == mmtype)
) /* if packet was ment for us and mmetype is expected*/
@@ -569,7 +566,7 @@ END_TEST
START_TEST (test_mme_push)
{
mme_error_t ret;
- int i;
+ unsigned int i;
unsigned int size;
unsigned int res;
@@ -616,7 +613,7 @@ END_TEST
START_TEST (test_mme_put)
{
mme_error_t ret;
- int i;
+ unsigned int i;
unsigned int size;
unsigned int res;
@@ -631,7 +628,7 @@ START_TEST (test_mme_put)
*/
/* initialize data array to some value, for example 0, 1, 2, ... */
- for (i=0; i<sizeof(data_put); i--)
+ for (i=0; i<sizeof(data_put); i++)
{
data_put[i] = i;
}
@@ -639,7 +636,7 @@ START_TEST (test_mme_put)
/* make space in the begining */
ctx->head = 512; /* move head on the right to 512 */
- ctx->head = 768; /* it was already here after mme_push, but just to be sure */
+ ctx->tail = 768; /* it was already here after mme_push, but just to be sure */
memset(ctx->buffer, 0x0, 512); /* zero-out the begining, so we can observe payload shift */
/*
* state of buffer :
@@ -650,21 +647,20 @@ START_TEST (test_mme_put)
*/
//Check arguments
- /* firs put a little chun k, to check if it works */
+ /* first put a little chunk, to check if it works */
size = sizeof(data_put) / 4;
ret = mme_put(ctx, (void *)data_put, size, &res);
fail_if(ret != MME_SUCCESS, "mme_put fail");
-
- fail_if ( memcmp( ctx->buffer + ctx->tail - sizeof(data_put), data_put, sizeof(data_put) / 4 ) != 0, "wrong data put");
+ fail_if ( memcmp( ctx->buffer + ctx->tail - size, data_put, size) != 0, "wrong data put");
/* this leaves us with 512 (before head) + 128 (after tail) bytes of free space */
size = sizeof(data_put); /* bigger size of trailing 128 bytes that will provoke shifting payload left */
ret = mme_put(ctx, (void *)data_put, size, &res);
fail_if(ret != MME_SUCCESS, "mme_put fail");
- if (sizeof(data_put) > BUFF_LEN - ctx->tail) /* in this case we have shift */
+ if (size > BUFF_LEN - ctx->tail) /* in this case we have shift */
{
- fail_if ( memcmp( ctx->buffer + ctx->tail - sizeof(data_put), data_put, sizeof(data_put)) != 0, "wrong data shift");
- if ( sizeof(data_put) < ctx->head + (BUFF_LEN - ctx->tail) - 3 ) /* if we have at least 3 bytes of free space left */
+ fail_if ( memcmp( ctx->buffer + ctx->tail - size, data_put, size) != 0, "wrong data shift");
+ if ( size < ctx->head + (BUFF_LEN - ctx->tail) - 3 ) /* if we have at least 3 bytes of free space left */
{
fail_if ( memcmp( ctx->buffer + ctx->head - 3, "\x00\x00\x00", 3) != 0, "wrong data shift");
}
@@ -850,7 +846,7 @@ START_TEST (test_mme_send)
}
END_TEST
-mme_error_t listen_cb (mme_ctx_t *ctx, unsigned char *iface, unsigned char *source)
+mme_error_t listen_cb (mme_ctx_t *ctx, char *iface, unsigned char *source)
{
TRACE("Inside callback function.\n");
listen_var = 1;
diff --git a/cleopatre/devkit/tests/libspid/ftests/Makefile b/cleopatre/devkit/tests/libspid/ftests/Makefile
index 30746afdca..74db15cd9e 100644
--- a/cleopatre/devkit/tests/libspid/ftests/Makefile
+++ b/cleopatre/devkit/tests/libspid/ftests/Makefile
@@ -1,33 +1,21 @@
-BASE := $(CURDIR)/../../../..
-OBJPATH := ./obj
-PRJPATH := $(BASE)/application/libspid
-INC_PRJPATH := $(PRJPATH)/inc
-LINUX_PATH := $(BASE)/linux-2.6.25.10-spc300
-###################################################
+BASE = ../../../../../cesar
+CLEO_BASE = ../cleopatre
-# Common stuff
-CC := arm-linux-gcc
-CFLAGS := -Wall -g3 -DLINUX -I. -I./inc -I$(INC_PRJPATH) -I$(LINUX_PATH)/include/asm-arm/arch-spc300
-LIBS := -L$(PRJPATH) -lspid
+# We test libspid.
+PROJECT_DIR = $(CLEO_BASE)/application/libspid
-SRCS=$(wildcard *.c)
-OBJS=$(addprefix $(OBJPATH)/,$(SRCS:.c=.o))
+LINUX_PATH = $(CLEO_BASE)/linux-2.6.25.10-spc300
+INCLUDES = $(PROJECT_DIR)/inc $(CLEO_BASE)/include
-# Rules
-all: $(PRJPATH)/libspid.a
- mkdir -p $(OBJPATH)
- $(MAKE) $(OBJPATH)/libspid_ftests
+TARGET_PROGRAMS = libspid_ftest
-$(LIBPATH)/libspid.a:
- $(MAKE) -C $(LIBPATH) libspid.a
+TARGET = arm
-$(OBJPATH)/libspid_ftests : $(OBJS)
- $(CC) $(CFLAGS) -static -o $@ $^ $(LIBS)
+libspid_ftest_SOURCES = spidlib_ftests.c
+libspid_ftest_MODULES = $(CLEO_BASE)/application/libspid
-$(OBJPATH)/%.o : %.c
- $(CC) $(CFLAGS) -c -o $@ $<
-
-clean :
- rm -rf $(OBJPATH)
+EXTRA_TARGET_LDFLAGS = -static
+DEFS = -DLINUX
+include $(BASE)/common/make/top.mk
diff --git a/cleopatre/devkit/tests/libspid/ftests/spidlib_ftests.c b/cleopatre/devkit/tests/libspid/ftests/src/spidlib_ftests.c
index 9ff0eb4d30..9ff0eb4d30 100644
--- a/cleopatre/devkit/tests/libspid/ftests/spidlib_ftests.c
+++ b/cleopatre/devkit/tests/libspid/ftests/src/spidlib_ftests.c
diff --git a/cleopatre/devkit/tests/libspid/utests/Makefile b/cleopatre/devkit/tests/libspid/utests/Makefile
index bc07c52447..756c8f43da 100644
--- a/cleopatre/devkit/tests/libspid/utests/Makefile
+++ b/cleopatre/devkit/tests/libspid/utests/Makefile
@@ -1,11 +1,41 @@
-PRJ_BASE = ../../../../application/libspid
-FILES = system network config_item config_line image hpav_info misc misc_eoc upgrade_eoc wl_eoc service_eoc port_eoc autoconf_eoc master_config_eoc discrete_alarm_eoc analog_alarm_eoc current_alarm_eoc tonemap_snr_eoc
-OBJ_FILES = $(PRJ_OBJPATH)/openssl_md5.o $(PRJ_OBJPATH)/misc.o $(PRJ_OBJPATH)/config_line.o $(PRJ_OBJPATH)/config_item.o $(PRJ_OBJPATH)/system.o $(PRJ_OBJPATH)/image.o $(PRJ_OBJPATH)/network.o $(PRJ_OBJPATH)/wl_eoc.o $(PRJ_OBJPATH)/service_eoc.o $(PRJ_OBJPATH)/port_eoc.o $(TEST_OBJPATH)/wl_eoc_stubs.o $(TEST_OBJPATH)/service_eoc_stubs.o $(TEST_OBJPATH)/port_eoc_stubs.o
+BASE = ../../../../../cesar
+CLEO_BASE = ../cleopatre
-LIBSPID_DIR=../../../../application/libspid
-LIBMME_DIR=../../../../application/libmme
-LINUX_DIR=../../../../linux-2.6.25.10-spc300
+# We test libspid.
+PROJECT_DIR = $(CLEO_BASE)/application/libspid
+LIBMME_DIR = $(CLEO_BASE)/application/libmme
+LINUX_DIR = $(CLEO_BASE)/linux-2.6.25.10-spc300
+UTESTS_DIR = $(CLEO_BASE)/devkit/tests/libspid/utests/
+OVERRIDE_DIR = $(UTESTS_DIR)/override
+LIBMME_OVERRIDE_DIR = $(CLEO_BASE)/devkit/tests/managerd/utests/override
-EXTRA_CFLAGS = -I$(LIBSPID_DIR)/inc -I$(LIBMME_DIR)/inc -I$(LINUX_DIR)/include/asm-arm/arch-spc300 -MMD
+INCLUDES = $(PROJECT_DIR)/inc $(CLEO_BASE)/include $(LIBMME_DIR)/inc \
+ $(LINUX_DIR)/include/asm-arm/arch-spc300 $(LIBMME_OVERRIDE_DIR)/inc \
+ $(OVERRIDE_DIR)/inc $(UTESTS_DIR)/inc
-include ../../utests_makerules
+DEFS = -D__UTESTS__
+
+EXTRA_HOST_LDLIBS = -lcheck
+
+EXTRA_CFLAGS = -MMD
+
+# Templates to define list of sources & module to use.
+# Parameter: $1 is executabe & source name (without .c).
+define utest_libspid
+$(1)_SOURCES = $(1).c
+$(1)_MODULES = $(PROJECT_DIR) $(LIBMME_OVERRIDE_DIR) $(OVERRIDE_DIR)
+endef
+
+HOST_PROGRAMS = system_utests network_utests config_item_utests \
+ config_line_utests hpav_info_utests image_utests \
+ misc_utests misc_eoc_utests upgrade_eoc_utests wl_eoc_utests \
+ service_eoc_utests port_eoc_utests autoconf_eoc_utests \
+ master_config_eoc_utests discrete_alarm_eoc_utests analog_alarm_eoc_utests \
+ current_alarm_eoc_utests tonemap_snr_eoc_utests
+
+.._cleopatre_devkit_tests_managerd_utests_override_MODULE_SOURCES = libmme_stub.c
+
+# Generate sources & module list for each host programs.
+$(foreach prog,$(HOST_PROGRAMS),$(eval $(call utest_libspid,$(prog))))
+
+include $(BASE)/common/make/top.mk
diff --git a/cleopatre/devkit/tests/libspid/utests/inc/config_item_utests.h b/cleopatre/devkit/tests/libspid/utests/inc/config_item_utests.h
index 501d65fe8b..cb682c1869 100644
--- a/cleopatre/devkit/tests/libspid/utests/inc/config_item_utests.h
+++ b/cleopatre/devkit/tests/libspid/utests/inc/config_item_utests.h
@@ -22,18 +22,6 @@
/* VARIABLE STUB */
/* none */
/* FUNCTION STUB */
-/* true if character is a blank (space or tab). C99. */
-#undef isblank
-/*
-static int isblank(int c)
-{
- return (c == ' ') || (c == '\t');
-}
-*/
/* none */
-/* PLCD FUNCTION DECLARATIONS */
-/* system.c */
-libspid_error_t libspid_config_read_item (const char *filename, const char *label, char *value, int buffer_len);
-libspid_error_t libspid_config_write_item(const char *filename, const char *label, const char *value);
#endif /* system_utests_h */
diff --git a/cleopatre/devkit/tests/libspid/utests/inc/config_line_utests.h b/cleopatre/devkit/tests/libspid/utests/inc/config_line_utests.h
index b217a1c021..cb682c1869 100644
--- a/cleopatre/devkit/tests/libspid/utests/inc/config_line_utests.h
+++ b/cleopatre/devkit/tests/libspid/utests/inc/config_line_utests.h
@@ -24,9 +24,4 @@
/* FUNCTION STUB */
/* none */
-/* PLCD FUNCTION DECLARATIONS */
-/* system.c */
-libspid_error_t libspid_config_read_line (const char *filename, const char *label, char *value, int buffer_len);
-libspid_error_t libspid_config_write_line(const char *filename, const char *label, const char *value);
-pidlib_error_t libspid_config_remove_line(const char *filename, const char *delimiters, const char *key);
#endif /* system_utests_h */
diff --git a/cleopatre/devkit/tests/libspid/utests/inc/image_utests.h b/cleopatre/devkit/tests/libspid/utests/inc/image_utests.h
index 2492f52931..bab1572d36 100644
--- a/cleopatre/devkit/tests/libspid/utests/inc/image_utests.h
+++ b/cleopatre/devkit/tests/libspid/utests/inc/image_utests.h
@@ -24,8 +24,4 @@
/* FUNCTION STUB */
/* none */
-/* PLCD FUNCTION DECLARATIONS */
-/* image.c */
-/* system.c */
-
#endif /* image_utests_h */
diff --git a/cleopatre/devkit/tests/libspid/utests/inc/network_utests.h b/cleopatre/devkit/tests/libspid/utests/inc/network_utests.h
index 85a00727c3..c3f9eadd79 100644
--- a/cleopatre/devkit/tests/libspid/utests/inc/network_utests.h
+++ b/cleopatre/devkit/tests/libspid/utests/inc/network_utests.h
@@ -24,10 +24,4 @@
/* FUNCTION STUB */
/* none */
-/* PLCD FUNCTION DECLARATIONS */
-/* system.c */
-libspid_error_t libspid_network_get_ip (const char *interface, libspid_ip_t *ip);
-libspid_error_t libspid_network_set_ip (const char *interface, const libspid_ip_t *ip);
-libspid_error_t libspid_network_get_mac (const char *interface, unsigned char *mac);
-
#endif /* system_utests_h */
diff --git a/cleopatre/devkit/tests/libspid/utests/inc/system_utests.h b/cleopatre/devkit/tests/libspid/utests/inc/system_utests.h
index 7e3117edc3..c3f9eadd79 100644
--- a/cleopatre/devkit/tests/libspid/utests/inc/system_utests.h
+++ b/cleopatre/devkit/tests/libspid/utests/inc/system_utests.h
@@ -24,17 +24,4 @@
/* FUNCTION STUB */
/* none */
-/* PLCD FUNCTION DECLARATIONS */
-/* system.c */
-libspid_error_t libspid_system_get_kernel_version(char *buffer, int buffer_len);
-libspid_error_t libspid_system_get_plc_version (char *buffer, const int buffer_len);
-libspid_error_t libspid_system_get_av_version (char *buffer, const int buffer_len);
-libspid_error_t libspid_system_get_uptime(unsigned int *total_s, unsigned int *idle_s);
-libspid_error_t libspid_system_get_meminfo(char *buffer, int buffer_len);
-libspid_error_t libspid_system_save(void);
-libspid_error_t libspid_system_factory(void);
-libspid_error_t libspid_system_get_nvram(spc300_nvram_t *nvram);
-libspid_error_t libspid_system_set_nvram(spc300_nvram_t *nvram);
-libspid_error_t libspid_system_get_date (char *buffer, const int buffer_len);
-
#endif /* system_utests_h */
diff --git a/cleopatre/devkit/tests/libspid/utests/override/Module b/cleopatre/devkit/tests/libspid/utests/override/Module
new file mode 100644
index 0000000000..f70b890893
--- /dev/null
+++ b/cleopatre/devkit/tests/libspid/utests/override/Module
@@ -0,0 +1 @@
+SOURCES := port_eoc_stub.c service_eoc_stub.c wl_eoc_stub.c
diff --git a/cleopatre/devkit/tests/libspid/utests/inc/eoc_utests.h b/cleopatre/devkit/tests/libspid/utests/override/inc/eoc_utests.h
index 8e855d9ec2..8e855d9ec2 100644
--- a/cleopatre/devkit/tests/libspid/utests/inc/eoc_utests.h
+++ b/cleopatre/devkit/tests/libspid/utests/override/inc/eoc_utests.h
diff --git a/cleopatre/devkit/tests/libspid/utests/stubs/port_eoc_stubs.c b/cleopatre/devkit/tests/libspid/utests/override/src/port_eoc_stub.c
index 3893777ab1..3893777ab1 100644
--- a/cleopatre/devkit/tests/libspid/utests/stubs/port_eoc_stubs.c
+++ b/cleopatre/devkit/tests/libspid/utests/override/src/port_eoc_stub.c
diff --git a/cleopatre/devkit/tests/libspid/utests/stubs/service_eoc_stubs.c b/cleopatre/devkit/tests/libspid/utests/override/src/service_eoc_stub.c
index 049d8b8ad1..049d8b8ad1 100644
--- a/cleopatre/devkit/tests/libspid/utests/stubs/service_eoc_stubs.c
+++ b/cleopatre/devkit/tests/libspid/utests/override/src/service_eoc_stub.c
diff --git a/cleopatre/devkit/tests/libspid/utests/stubs/wl_eoc_stubs.c b/cleopatre/devkit/tests/libspid/utests/override/src/wl_eoc_stub.c
index 835c49295d..835c49295d 100644
--- a/cleopatre/devkit/tests/libspid/utests/stubs/wl_eoc_stubs.c
+++ b/cleopatre/devkit/tests/libspid/utests/override/src/wl_eoc_stub.c
diff --git a/cleopatre/devkit/tests/libspid/utests/src/analog_alarm_eoc_utests.c b/cleopatre/devkit/tests/libspid/utests/src/analog_alarm_eoc_utests.c
index 30afcd739a..abcf328633 100644
--- a/cleopatre/devkit/tests/libspid/utests/src/analog_alarm_eoc_utests.c
+++ b/cleopatre/devkit/tests/libspid/utests/src/analog_alarm_eoc_utests.c
@@ -49,14 +49,14 @@
void
setup (void)
{
- int ret, rc;
+ int ret;
struct stat st;
char buf[256];
/* initialize - delete testing dir if it exists */
if ((stat (UTESTS_TMP_DIR, &st) == 0))
{
- rc = system ("rm -r " UTESTS_TMP_DIR);
+ system ("rm -r " UTESTS_TMP_DIR);
}
ret = mkdir (UTESTS_TMP_DIR, 0770);
if (ret < 0 && errno != EEXIST)
@@ -111,7 +111,7 @@ tc_param (void)
START_TEST (test_libspid_eoc_analog_alarm_set)
{
- int ret, rc;
+ int ret;
char oid[LIBSPID_OID_MAX_LEN];
libspid_eoc_analog_alarm_entry_t entry;
@@ -131,7 +131,7 @@ START_TEST (test_libspid_eoc_analog_alarm_set)
entry.lolo = 5;
entry.deadband = 6;
- rc = system ("cp " ANALOG_ALARM_CONF " " UTESTS_TMP_DIR "/etc");
+ system ("cp " ANALOG_ALARM_CONF " " UTESTS_TMP_DIR "/etc");
ret = libspid_eoc_analog_alarm_set (oid, &entry);
fail_if (ret != LIBSPID_SUCCESS, "libspid_eoc_analog_alarm_set fail");
}
@@ -139,7 +139,7 @@ END_TEST
START_TEST (test_libspid_eoc_analog_alarm_get)
{
- int ret, rc;
+ int ret;
char oid[LIBSPID_OID_MAX_LEN];
libspid_eoc_analog_alarm_entry_t entry;
@@ -148,7 +148,7 @@ START_TEST (test_libspid_eoc_analog_alarm_get)
strcpy (oid, ".1.3.6.1.4.1.22764.3.1.5.2.4.1.10");
- rc = system ("cp " ANALOG_ALARM_CONF " " UTESTS_TMP_DIR "/etc");
+ system ("cp " ANALOG_ALARM_CONF " " UTESTS_TMP_DIR "/etc");
ret = libspid_eoc_analog_alarm_get (oid, &entry);
@@ -168,7 +168,7 @@ END_TEST
START_TEST (test_libspid_eoc_analog_alarm_get_list)
{
- int ret, rc;
+ int ret;
libspid_eoc_analog_alarm_entry_t entries[ANALOG_ALARM_ENTRY_NUM];
int i;
int count;
@@ -185,7 +185,7 @@ START_TEST (test_libspid_eoc_analog_alarm_get_list)
memset (entries, 0, ANALOG_ALARM_ENTRY_NUM * sizeof (libspid_eoc_analog_alarm_entry_t));
- rc = system ("cp " ANALOG_ALARM_CONF " " UTESTS_TMP_DIR "/etc");
+ system ("cp " ANALOG_ALARM_CONF " " UTESTS_TMP_DIR "/etc");
ret = libspid_eoc_analog_alarm_get_list (entries, &count);
@@ -201,7 +201,7 @@ START_TEST (test_libspid_eoc_analog_alarm_get_list)
"libspid_eoc_analog_alarm_get_list corrupts alarm OID");
fail_if (entries[i].enable.LOLO_alarm_enable != atoi (enable[i]),
"libspid_eoc_analog_alarm_get_list corrupts alarm enable");
- fail_if (entries[i].state != atoi (state[i]),
+ fail_if ((int) entries[i].state != atoi (state[i]),
"libspid_eoc_analog_alarm_get_list corrupts alarm state");
fail_if (entries[i].hihi != atoi (hihi[i]),
"libspid_eoc_analog_alarm_get_list corrupts alarm HIHI threshold");
diff --git a/cleopatre/devkit/tests/libspid/utests/src/autoconf_eoc_utests.c b/cleopatre/devkit/tests/libspid/utests/src/autoconf_eoc_utests.c
index a35867b6fa..fd93da9532 100644
--- a/cleopatre/devkit/tests/libspid/utests/src/autoconf_eoc_utests.c
+++ b/cleopatre/devkit/tests/libspid/utests/src/autoconf_eoc_utests.c
@@ -46,216 +46,17 @@
#define CONFIG_TAR_FILE "config.tar"
#define CONFIG_GZIP_FILE "config.tar.gz"
-static unsigned int seq_cnt = 1;
-
-/**
- * Pull (get) data from beginning of MME payload. MME data head and length are updated
- * If there is not enough data to pull, an error is returned and the remaining payload length is returned.
- *
- * \param ctx MME context where to get data
- * \param data buffer where to get data from the beginning of MME payload
- * \param length length of data to pull
- * \param result_length length of data pulled; if there is not enough data into the MME to fit the length, the remaining data length is returned
- * \return error type (MME_SUCCESS if success)
- * \return MME_ERROR_NOT_INIT: context not initialized
- */
-mme_error_t mme_pull (mme_ctx_t *ctx, void *data, unsigned int length, unsigned int *result_length)
-{
- /* protect from null pointers */
- if (ctx == NULL || data == NULL || result_length == NULL)
- return MME_ERROR_GEN;
- /* check if ctx has been inititalized */
- if (ctx->status == MME_STATUS_INIT)
- return MME_ERROR_NOT_INIT;
-
- /* check if it is demanded more data than we have in payload */
- if (length > ctx->tail - ctx->head)
- {
- *result_length = ctx->tail - ctx->head;
- return MME_ERROR_ENOUGH;
- }
-
- *result_length = length;
-
- memcpy(data, (unsigned char *)(ctx->buffer + ctx->head), length);
-
- ctx->head += length;
-
- return MME_SUCCESS;
-}
-
-/**
- * Create a MME message context. This context is used to build the MME message step by step.
- * The provided buffer must be enough large to contain all the final payload.
- * The MME payload can be bigger than an ethernet payload, as the fragmentation is managed by the 'send' function.
- *
- * \param ctx MME context to fill with init value
- * \param mmtype type of MME message (must be in official type list)
- * \param buffer the buffer to put the payload
- * \param length the buffer length
- * \return error type (MME_SUCCESS if success)
- */
-mme_error_t mme_init (mme_ctx_t *ctx, const mme_type_t mmtype, unsigned char *buffer, const unsigned int length)
-{
- /* protect from null pointers */
- if (ctx == NULL || buffer == NULL)
- return MME_ERROR_GEN;
-
- ctx->buffer = buffer;
- ctx->mmtype = mmtype;
- ctx->length = length;
- ctx->head = 0;
- ctx->tail = 0;
-
- ctx->status = MME_STATUS_OK;
-
- return MME_SUCCESS;
-}
-
-/**
- * Put data at the end of MME payload. MME data tail and length are updated<br>
- * If there is not enough free place to put data, an error is returned and the remaining free space length is returned.
- *
- * \param ctx MME context where to put data
- * \param data data to put at the end of MME payload
- * \param length length of data to put
- * \param result_length length of data really put
- * \return error type (MME_SUCCESS if success)
- * \return MME_ERROR_NOT_INIT: context not initialized
- * \return MME_ERROR_SPACE: not enough available space
- */
-mme_error_t mme_put (mme_ctx_t *ctx, const void *data, unsigned int length, unsigned int *result_length)
-{
- int free = 0;
- int delta = 0;
-
- /* protect from null pointers */
- if (ctx == NULL || data == NULL || result_length == NULL)
- return MME_ERROR_GEN;
- /* check if ctx has been inititalized */
- if (ctx->status == MME_STATUS_INIT)
- return MME_ERROR_NOT_INIT;
-
- free = ctx->length - (ctx->tail - ctx->head);
- if (length > free)
- {
- *result_length = free;
- return MME_ERROR_SPACE;
- }
-
- *result_length = length;
-
- /* make place after payload, if needed */
- if (length > ctx->length - ctx->tail)
- {
- /*
- * *length
- * .---------------^-----------------.
- * |-----------|------------|xxxxxxx|-------------------------|
- * buff head tail ctx->length
- * \________ ________/
- * \/
- * payload
- *
- * we have to shift left our payload for this difference delta marked with 'x'
- * in order for *length bytes to fit in from beginning of the buffer
- */
- delta = length - (ctx->length - ctx->tail);
- memmove( (unsigned char *)(ctx->buffer + ctx->head - delta), (unsigned char *)(ctx->buffer + ctx->head), ctx->tail - ctx->head );
-
- /* update head and tail pointers (offsets) */
- ctx->head -= delta;
- ctx->tail -= delta;
- }
-
- memcpy( (unsigned char *)(ctx->buffer + ctx->tail), (unsigned char *)data, length );
- ctx->tail += length;
-
- return MME_SUCCESS;
-}
-
-/**
- * Send fake MME by filling buffer: confirm_ctx->buffer
- *
- * \param ctx MME context to send
- * \param type transaction type
- * \param iface selected communication interface
- * \param dest destination MAC address in binary format (6 bytes)
- * \param confirm_ctx MME context given to put the received MME answer packet. A adapted buffer must have been provided.
- * \return error type (MME_SUCCESS if success)
- * \return MME_ERROR_NOT_INIT: context not initialized
- */
-mme_error_t mme_send (mme_ctx_t *ctx, mme_send_type_t type, char *iface, unsigned char *dest, mme_ctx_t *confirm_ctx)
-{
- /* protect from null pointers */
- if (ctx == NULL || confirm_ctx == NULL || iface == NULL || dest == NULL)
- return MME_ERROR_GEN;
-
- /* check if ctx has been inititalized */
- if (ctx->status == MME_STATUS_INIT)
- return MME_ERROR_NOT_INIT;
-
- confirm_ctx->buffer[0] = 0x00;
- if ((ctx->mmtype >> 12) == 0xA)
- {
- confirm_ctx->buffer[1] = 0x13;
- confirm_ctx->buffer[2] = 0xD7;
-
- if (ctx->mmtype == (MME_TYPE_VS_EOC_AUTOCONF_START | MME_TYPE_REQ))
- {
- seq_cnt = 0;
- if (memcmp(dest, "\x00\x11\x22\x33\x44\x66", LIBSPID_MAC_BIN_LEN) == 0)
- confirm_ctx->buffer[3] = LIBSPID_EOC_AUTOCONF_START_MODEM_BUSY;
- else if (memcmp(dest, "\x00\x11\x22\x33\x44\x77", LIBSPID_MAC_BIN_LEN) == 0)
- confirm_ctx->buffer[3] = LIBSPID_EOC_AUTOCONF_START_BAD_PROTOCOL;
- else if (memcmp(dest, "\x00\x11\x22\x33\x44\x88", LIBSPID_MAC_BIN_LEN) == 0)
- confirm_ctx->buffer[3] = LIBSPID_EOC_AUTOCONF_START_FAILED;
- else if (memcmp(dest, "\x00\x11\x22\x33\x44\xcc", LIBSPID_MAC_BIN_LEN) == 0)
- confirm_ctx->buffer[3] = LIBSPID_EOC_AUTOCONF_START_CONFIG_EXIST;
- else
- confirm_ctx->buffer[3] = LIBSPID_EOC_AUTOCONF_START_SUCCESS;
- }
- if (ctx->mmtype == (MME_TYPE_VS_EOC_AUTOCONF_TRANSFER | MME_TYPE_REQ))
- {
- seq_cnt++;
- if (memcmp (dest, "\x00\x11\x22\x33\x44\x99", LIBSPID_MAC_BIN_LEN) == 0)
- confirm_ctx->buffer[3] = LIBSPID_EOC_AUTOCONF_TRANSFER_FAILED;
- else
- {
- confirm_ctx->buffer[3] = LIBSPID_EOC_AUTOCONF_TRANSFER_SUCCESS;
- confirm_ctx->buffer[4] = (seq_cnt >> 0) & 0xFF;
- confirm_ctx->buffer[5] = (seq_cnt >> 8) & 0xFF;
- confirm_ctx->buffer[6] = (seq_cnt >> 16) & 0xFF;
- confirm_ctx->buffer[7] = (seq_cnt >> 24) & 0xFF;
- }
- }
- if (ctx->mmtype == (MME_TYPE_VS_EOC_AUTOCONF_END | MME_TYPE_REQ))
- {
- if (memcmp (dest, "\x00\x11\x22\x33\x44\xbb", LIBSPID_MAC_BIN_LEN) == 0)
- confirm_ctx->buffer[3] = LIBSPID_EOC_AUTOCONF_END_MD5_ERROR;
- else if (memcmp (dest, "\x00\x11\x22\x33\x44\xaa", LIBSPID_MAC_BIN_LEN) == 0)
- confirm_ctx->buffer[3] = LIBSPID_EOC_AUTOCONF_END_FAILED;
- else
- confirm_ctx->buffer[3] = LIBSPID_EOC_AUTOCONF_END_SUCCESS;
- }
- }
-
- confirm_ctx->tail = ETH_DATA_LEN;
-
- return MME_SUCCESS;
-}
-
/* fixtures - run before and after each unit test */
void setup(void)
{
- int ret, rc;
+ int ret;
struct stat st;
char buf[256];
/* initialize - delete testing dir if it exists */
if ( (stat (UTESTS_TMP_DIR, &st) == 0) )
{
- rc = system ("rm -r " UTESTS_TMP_DIR);
+ system ("rm -r " UTESTS_TMP_DIR);
}
ret = mkdir (UTESTS_TMP_DIR, 0770);
if (ret < 0 && errno != EEXIST)
@@ -299,7 +100,7 @@ END_TEST
START_TEST (test_libspid_eoc_configure)
{
- int ret, i, rc;
+ int ret, i;
char tar_file[] = UTESTS_TMP_DIR "/" CONFIG_TAR_FILE;
char gzip_file[] = UTESTS_TMP_DIR "/" CONFIG_GZIP_FILE;
int exp_ret[8] = {
@@ -312,7 +113,7 @@ START_TEST (test_libspid_eoc_configure)
"00:11:22:33:44:99", "00:11:22:33:44:aa", "00:11:22:33:44:bb", "00:11:22:33:44:cc"
};
- rc = system ("cp " LOCAL_CONFIG_TAR_FILE " " UTESTS_TMP_DIR);
+ system ("cp " LOCAL_CONFIG_TAR_FILE " " UTESTS_TMP_DIR);
/* Check for NULL parameters */
ret = libspid_eoc_configure (NULL, tar_file);
@@ -326,7 +127,7 @@ START_TEST (test_libspid_eoc_configure)
fail_if (ret != exp_ret[i], "[MAC %s] libspid_eoc_configure return is incorrect", mac_addr[i]);
}
- rc = system ("mv " UTESTS_TMP_DIR "/" CONFIG_TAR_FILE " " UTESTS_TMP_DIR "/" CONFIG_GZIP_FILE);
+ system ("mv " UTESTS_TMP_DIR "/" CONFIG_TAR_FILE " " UTESTS_TMP_DIR "/" CONFIG_GZIP_FILE);
/* Check wrong archive */
ret = libspid_eoc_configure ("00:11:22:33:44:55", tar_file);
diff --git a/cleopatre/devkit/tests/libspid/utests/src/config_item_utests.c b/cleopatre/devkit/tests/libspid/utests/src/config_item_utests.c
index 722964a1ae..a8175aa610 100644
--- a/cleopatre/devkit/tests/libspid/utests/src/config_item_utests.c
+++ b/cleopatre/devkit/tests/libspid/utests/src/config_item_utests.c
@@ -34,7 +34,7 @@
#include <net/if.h>
#include <libgen.h> /* for basename() */
-#include "config_item_utests.h"
+#include "inc/config_item_utests.h"
//#define DEBUG 1
@@ -376,8 +376,8 @@ int main(void)
s = libspid_config_item_suite();
SRunner *sr = srunner_create(s);
- srunner_set_fork_status (sr, CK_NOFORK);
- //srunner_set_fork_status (sr, CK_FORK);
+ //srunner_set_fork_status (sr, CK_NOFORK);
+ srunner_set_fork_status (sr, CK_FORK);
srunner_run_all(sr, CK_NORMAL);
number_failed = srunner_ntests_failed(sr);
srunner_free(sr);
diff --git a/cleopatre/devkit/tests/libspid/utests/src/config_line_utests.c b/cleopatre/devkit/tests/libspid/utests/src/config_line_utests.c
index 09269769ba..d7742b8512 100644
--- a/cleopatre/devkit/tests/libspid/utests/src/config_line_utests.c
+++ b/cleopatre/devkit/tests/libspid/utests/src/config_line_utests.c
@@ -34,7 +34,7 @@
#include <net/if.h>
#include <libgen.h> /* for basename() */
-#include "config_item_utests.h"
+#include "inc/config_item_utests.h"
//#define DEBUG 1
@@ -86,9 +86,9 @@ START_TEST (test_read_param)
int ret = 7;
char delimiters[32] = " :";
char buffer[LIBSPID_CONFIG_LINE_MAX_LEN] = {0};
- char *elt[10];
+ char *elt[9];
unsigned int elt_nb = 2;
- char key[32] = "key";
+ char key[LIBSPID_CONFIG_KEY_MAX_LEN + 1] = "key";
char filename[128];
@@ -154,7 +154,7 @@ START_TEST (test_read_param)
/* get a big element with a shorter buffer */
strcpy(key, "key3");
elt_nb = 10;
- fail_unless(((libspid_config_read_line(filename, " ", key, &elt_nb, elt, buffer, 32) >= 0)
+ fail_unless(((libspid_config_read_line(filename, " ", key, &elt_nb, elt, buffer, 32) == 0)
&& (elt_nb == 3)
&& !strcmp(elt[2], "very_very_very")),
"get limited size element: key=%s, elt_nb=%d, elt[2]='%s'\n", key, elt_nb, elt[2]);
@@ -162,7 +162,7 @@ START_TEST (test_read_param)
/* ask for no element */
strcpy(key, "key2");
elt_nb = 0;
- fail_unless(((libspid_config_read_line(filename, " ", key, &elt_nb, elt, buffer, LIBSPID_CONFIG_LINE_MAX_LEN) >= 0)
+ fail_unless(((libspid_config_read_line(filename, " ", key, &elt_nb, elt, buffer, LIBSPID_CONFIG_LINE_MAX_LEN) == 0)
&& !strcmp(key, "key3")
&& (elt_nb == 0)),
"get 0 element");
@@ -170,7 +170,7 @@ START_TEST (test_read_param)
/* other delimiter */
strcpy(key, "key4");
elt_nb = 10;
- fail_unless(((libspid_config_read_line(filename, ":", key, &elt_nb, elt, buffer, LIBSPID_CONFIG_LINE_MAX_LEN) >= 0)
+ fail_unless(((libspid_config_read_line(filename, ":", key, &elt_nb, elt, buffer, LIBSPID_CONFIG_LINE_MAX_LEN) == 0)
&& (elt_nb == 8)
&& !strcmp(elt[3], "elt54 elt")),
"other delimiter");
@@ -178,7 +178,7 @@ START_TEST (test_read_param)
/* 2 delimiters */
strcpy(key, "key4");
elt_nb = 10;
- fail_unless(((libspid_config_read_line(filename, " :", key, &elt_nb, elt, buffer, LIBSPID_CONFIG_LINE_MAX_LEN) >= 0)
+ fail_unless(((libspid_config_read_line(filename, " :", key, &elt_nb, elt, buffer, LIBSPID_CONFIG_LINE_MAX_LEN) == 0)
&& !strcmp(key, "key5")
&& (elt_nb == 9)
&& !strcmp(elt[3], "elt54")
@@ -188,7 +188,7 @@ START_TEST (test_read_param)
/* long comment line */
strcpy(key, "key1");
elt_nb = 10;
- fail_unless(((libspid_config_read_line(filename, " ", key, &elt_nb, elt, buffer, LIBSPID_CONFIG_LINE_MAX_LEN) >= 0)
+ fail_unless(((libspid_config_read_line(filename, " ", key, &elt_nb, elt, buffer, LIBSPID_CONFIG_LINE_MAX_LEN) == 0)
&& !strcmp(key, "key2")),
"long comment line");
@@ -201,7 +201,8 @@ START_TEST (test_write_param)
char delimiter = 'a';
char *elt[8];
unsigned int elt_nb = 2;
- char key[128] = "key";
+ char key[LIBSPID_CONFIG_KEY_MAX_LEN + 1] = "key";
+ char key_too_long[LIBSPID_CONFIG_KEY_MAX_LEN * 2] = "key_too_long";
char filename[128];
system("cp " LINE_CNF " " UTESTS_TMP_DIR);
@@ -238,8 +239,8 @@ START_TEST (test_write_param)
fail_unless( ret == LIBSPID_ERROR_PARAM, "elt = NULL");
/* key too long */
- strcpy(key, "very_very_very_very_very_very_very_very_very_very_very_very_very_long_key");
- ret = libspid_config_write_line(filename, delimiter, key, elt_nb, elt);
+ strcpy(key_too_long, "very_very_very_very_very_very_very_very_very_very_very_very_very_long_key");
+ ret = libspid_config_write_line(filename, delimiter, key_too_long, elt_nb, elt);
fail_unless( ret == LIBSPID_ERROR_PARAM, "key too long");
/* key = "" */
@@ -259,7 +260,8 @@ START_TEST (test_remove_param)
{
int ret;
char delimiters[32] = " :";
- char key[128] = "key";
+ char key[LIBSPID_CONFIG_KEY_MAX_LEN + 1] = "key";
+ char key_too_long[LIBSPID_CONFIG_KEY_MAX_LEN * 2] = "key_too_long";
char filename[128];
system("cp " LINE_CNF " " UTESTS_TMP_DIR);
@@ -284,8 +286,8 @@ START_TEST (test_remove_param)
fail_unless( ret == LIBSPID_ERROR_PARAM, "key = NULL");
/* key too long */
- strcpy(key, "very_very_very_very_very_very_very_very_very_very_very_very_very_long_key");
- ret = libspid_config_remove_line(filename, delimiters, key);
+ strcpy(key_too_long, "very_very_very_very_very_very_very_very_very_very_very_very_very_long_key");
+ ret = libspid_config_remove_line(filename, delimiters, key_too_long);
fail_unless( ret == LIBSPID_ERROR_PARAM, "key too long");
/* key = "" */
@@ -320,7 +322,7 @@ START_TEST (test_libspid_config_read_line)
char buffer[LIBSPID_CONFIG_LINE_MAX_LEN] = {0};
char *elt[8];
unsigned int elt_nb;
- char key[32];
+ char key[LIBSPID_CONFIG_KEY_MAX_LEN + 1];
system ("cp " LINE_CNF " " UTESTS_TMP_DIR);
sprintf (filename, "%s/%s", UTESTS_TMP_DIR, basename (LINE_CNF));
@@ -391,7 +393,7 @@ START_TEST (test_libspid_config_write_line)
char delimiter = ' ';
char *elt[2];
unsigned int elt_nb;
- char key[32];
+ char key[LIBSPID_CONFIG_KEY_MAX_LEN + 1];
FILE *fp;
char line[LIBSPID_CONFIG_LINE_MAX_LEN];
char el0[32] = {0};
@@ -445,14 +447,12 @@ START_TEST (test_libspid_config_remove_line)
int ret;
char filename[128];
char delimiters[32] = " ";
- unsigned int elt_nb;
- char key[32];
+ char key[LIBSPID_CONFIG_KEY_MAX_LEN + 1];
char cmd[256];
struct stat file_stat;
system ("cp " LINE_CNF " " UTESTS_TMP_DIR);
sprintf (filename, "%s/%s", UTESTS_TMP_DIR, basename (LINE_CNF));
- elt_nb = 3;
strcpy (key, "00:13:D7:d0:a0:b2");
ret = libspid_config_remove_line (filename, delimiters, key);
fail_if (ret != LIBSPID_SUCCESS, "libspid_config_remove_line fail");
@@ -490,8 +490,8 @@ int main(void)
s = libspid_config_line_suite();
SRunner *sr = srunner_create(s);
- srunner_set_fork_status (sr, CK_NOFORK);
- //srunner_set_fork_status (sr, CK_FORK);
+ //srunner_set_fork_status (sr, CK_NOFORK);
+ srunner_set_fork_status (sr, CK_FORK);
srunner_run_all(sr, CK_NORMAL);
number_failed = srunner_ntests_failed(sr);
srunner_free(sr);
diff --git a/cleopatre/devkit/tests/libspid/utests/src/current_alarm_eoc_utests.c b/cleopatre/devkit/tests/libspid/utests/src/current_alarm_eoc_utests.c
index e6f25670fe..f42d5ee6a0 100644
--- a/cleopatre/devkit/tests/libspid/utests/src/current_alarm_eoc_utests.c
+++ b/cleopatre/devkit/tests/libspid/utests/src/current_alarm_eoc_utests.c
@@ -48,14 +48,14 @@
/* fixtures - run before and after each unit test */
void setup(void)
{
- int ret, rc;
+ int ret;
struct stat st;
char buf[256];
/* initialize - delete testing dir if it exists */
if ( (stat (UTESTS_TMP_DIR, &st) == 0) )
{
- rc = system ("rm -r " UTESTS_TMP_DIR);
+ system ("rm -r " UTESTS_TMP_DIR);
}
ret = mkdir (UTESTS_TMP_DIR, 0770);
if (ret < 0 && errno != EEXIST)
@@ -109,7 +109,7 @@ tc_param (void)
START_TEST (test_libspid_eoc_current_alarm_get)
{
- int ret, rc;
+ int ret;
char oid[LIBSPID_OID_MAX_LEN];
libspid_eoc_current_alarm_entry_t entry;
@@ -117,7 +117,7 @@ START_TEST (test_libspid_eoc_current_alarm_get)
strcpy (oid, ".1.3.6.1.4.1.22764.3.1.5.1.6.1.6");
- rc = system ("cp " ALARM_INFO " " UTESTS_TMP_DIR "/etc");
+ system ("cp " ALARM_INFO " " UTESTS_TMP_DIR "/etc");
ret = libspid_eoc_current_alarm_get (oid, &entry);
fail_if (ret != LIBSPID_SUCCESS, "libspid_eoc_current_alarm_get return unsuccessful");
@@ -130,7 +130,7 @@ END_TEST
/* TODO */
START_TEST (test_libspid_eoc_current_alarm_get_list)
{
- int ret, rc;
+ int ret;
libspid_eoc_current_alarm_entry_t entries[CURRENT_ALARM_ENTRY_NUM];
int i;
int count;
@@ -143,7 +143,7 @@ START_TEST (test_libspid_eoc_current_alarm_get_list)
memset (entries, 0, CURRENT_ALARM_ENTRY_NUM * sizeof (libspid_eoc_current_alarm_entry_t));
- rc = system ("cp " ALARM_INFO " " UTESTS_TMP_DIR "/etc");
+ system ("cp " ALARM_INFO " " UTESTS_TMP_DIR "/etc");
ret = libspid_eoc_current_alarm_get_list (entries, &count);
@@ -154,7 +154,7 @@ START_TEST (test_libspid_eoc_current_alarm_get_list)
fail_if (ret != LIBSPID_SUCCESS, "libspid_eoc_current_alarm_get_list return is unsuccessful");
fail_if (strcmp (entries[i].oid, oid[i]) != 0, "libspid_eoc_current_alarm_get_list corrupts alarm OID");
- fail_if (entries[i].state != atoi (state[i]), "libspid_eoc_current_alarm_get_list corrupts alarm state");
+ fail_if ((int) entries[i].state != atoi (state[i]), "libspid_eoc_current_alarm_get_list corrupts alarm state");
fail_if (entries[i].value != atoi (value[i]), "libspid_eoc_current_alarm_get_list corrupts alarm value");
}
}
diff --git a/cleopatre/devkit/tests/libspid/utests/src/discrete_alarm_eoc_utests.c b/cleopatre/devkit/tests/libspid/utests/src/discrete_alarm_eoc_utests.c
index fa0f4c4efd..fa1730071f 100644
--- a/cleopatre/devkit/tests/libspid/utests/src/discrete_alarm_eoc_utests.c
+++ b/cleopatre/devkit/tests/libspid/utests/src/discrete_alarm_eoc_utests.c
@@ -49,14 +49,14 @@
void
setup(void)
{
- int ret, rc;
+ int ret;
struct stat st;
char buf[256];
/* initialize - delete testing dir if it exists */
if ( (stat (UTESTS_TMP_DIR, &st) == 0) )
{
- rc = system ("rm -r " UTESTS_TMP_DIR);
+ system ("rm -r " UTESTS_TMP_DIR);
}
ret = mkdir (UTESTS_TMP_DIR, 0770);
if (ret < 0 && errno != EEXIST)
@@ -110,7 +110,7 @@ tc_param (void)
START_TEST (test_libspid_eoc_discrete_alarm_set)
{
- int ret, rc;
+ int ret;
char oid[LIBSPID_OID_MAX_LEN];
libspid_eoc_discrete_alarm_entry_t entry;
@@ -122,7 +122,7 @@ START_TEST (test_libspid_eoc_discrete_alarm_set)
entry.enable = 2;
entry.state = 1;
- rc = system ("cp " DISCRETE_ALARM_CONF " " UTESTS_TMP_DIR "/etc");
+ system ("cp " DISCRETE_ALARM_CONF " " UTESTS_TMP_DIR "/etc");
ret = libspid_eoc_discrete_alarm_set (oid, &entry);
fail_if (ret != LIBSPID_SUCCESS, "libspid_eoc_discrete_alarm_set fail");
}
@@ -130,7 +130,7 @@ END_TEST
START_TEST (test_libspid_eoc_discrete_alarm_get)
{
- int ret, rc;
+ int ret;
char oid[LIBSPID_OID_MAX_LEN];
libspid_eoc_discrete_alarm_entry_t entry;
@@ -138,7 +138,7 @@ START_TEST (test_libspid_eoc_discrete_alarm_get)
strcpy (oid, ".1.3.6.1.4.1.22764.3.1.5.1.6.1.6");
- rc = system ("cp " DISCRETE_ALARM_CONF " " UTESTS_TMP_DIR "/etc");
+ system ("cp " DISCRETE_ALARM_CONF " " UTESTS_TMP_DIR "/etc");
ret = libspid_eoc_discrete_alarm_get (oid, &entry);
fail_if (ret != LIBSPID_SUCCESS, "libspid_eoc_discrete_alarm_get return unsuccessful");
@@ -151,7 +151,7 @@ END_TEST
START_TEST (test_libspid_eoc_discrete_alarm_get_list)
{
- int ret, rc;
+ int ret;
libspid_eoc_discrete_alarm_entry_t entries[DISCRETE_ALARM_ENTRY_NUM];
int i;
int count;
@@ -164,7 +164,7 @@ START_TEST (test_libspid_eoc_discrete_alarm_get_list)
memset (entries, 0, DISCRETE_ALARM_ENTRY_NUM * sizeof (libspid_eoc_discrete_alarm_entry_t));
- rc = system ("cp " DISCRETE_ALARM_CONF " " UTESTS_TMP_DIR "/etc");
+ system ("cp " DISCRETE_ALARM_CONF " " UTESTS_TMP_DIR "/etc");
ret = libspid_eoc_discrete_alarm_get_list (entries, &count);
@@ -176,8 +176,8 @@ START_TEST (test_libspid_eoc_discrete_alarm_get_list)
fail_if (strcmp (entries[i].oid, oid[i]) != 0, "libspid_eoc_discrete_alarm_get_list corrupts alarm OID");
fail_if (entries[i].trigger != atoi (trigger[i]), "libspid_eoc_discrete_alarm_get_list corrupts alarm trigger");
- fail_if (entries[i].enable != atoi (enable[i]), "libspid_eoc_discrete_alarm_get_list corrupts alarm enable");
- fail_if (entries[i].state != atoi (state[i]), "libspid_eoc_discrete_alarm_get_list corrupts alarm state");
+ fail_if ((int) entries[i].enable != atoi (enable[i]), "libspid_eoc_discrete_alarm_get_list corrupts alarm enable");
+ fail_if ((int) entries[i].state != atoi (state[i]), "libspid_eoc_discrete_alarm_get_list corrupts alarm state");
}
}
END_TEST
diff --git a/cleopatre/devkit/tests/libspid/utests/src/hpav_info_utests.c b/cleopatre/devkit/tests/libspid/utests/src/hpav_info_utests.c
index 506df36a2d..36e16d9fe7 100644
--- a/cleopatre/devkit/tests/libspid/utests/src/hpav_info_utests.c
+++ b/cleopatre/devkit/tests/libspid/utests/src/hpav_info_utests.c
@@ -106,7 +106,8 @@ main (void)
{
Suite *s = libspid_hpav_info_suite ();
SRunner *sr = srunner_create (s);
- srunner_set_fork_status (sr, CK_NOFORK);
+ //srunner_set_fork_status (sr, CK_NOFORK);
+ srunner_set_fork_status (sr, CK_FORK);
srunner_run_all (sr, CK_NORMAL);
int number_failed = srunner_ntests_failed (sr);
srunner_free (sr);
diff --git a/cleopatre/devkit/tests/libspid/utests/src/image_utests.c b/cleopatre/devkit/tests/libspid/utests/src/image_utests.c
index 86b17f3085..1553bda0eb 100644
--- a/cleopatre/devkit/tests/libspid/utests/src/image_utests.c
+++ b/cleopatre/devkit/tests/libspid/utests/src/image_utests.c
@@ -29,7 +29,7 @@
#include <dirent.h>
#include <sys/stat.h>
-#include "image_utests.h"
+#include "inc/image_utests.h"
//#define DEBUG 1
@@ -52,7 +52,6 @@
/** stub functions */
-
/* fixtures - run before and after each unit test */
void setup(void)
{
@@ -406,7 +405,7 @@ extern Suite* libspid_image_suite(void)
tcase_add_test(tc_core, test_libspid_image_select);
suite_add_tcase(s, tc_core);
- //suite_add_tcase(s, tc_param());
+ suite_add_tcase(s, tc_param());
return s;
}
@@ -419,8 +418,8 @@ int main(void)
s = libspid_image_suite();
SRunner *sr = srunner_create(s);
- srunner_set_fork_status (sr, CK_NOFORK);
- //srunner_set_fork_status (sr, CK_FORK);
+ //srunner_set_fork_status (sr, CK_NOFORK);
+ srunner_set_fork_status (sr, CK_FORK);
srunner_run_all(sr, CK_NORMAL);
number_failed = srunner_ntests_failed(sr);
srunner_free(sr);
diff --git a/cleopatre/devkit/tests/libspid/utests/src/master_config_eoc_utests.c b/cleopatre/devkit/tests/libspid/utests/src/master_config_eoc_utests.c
index 2dc2cf1a6e..4fbc75a8a9 100644
--- a/cleopatre/devkit/tests/libspid/utests/src/master_config_eoc_utests.c
+++ b/cleopatre/devkit/tests/libspid/utests/src/master_config_eoc_utests.c
@@ -53,7 +53,7 @@
/* fixtures - run before and after each unit test */
void setup(void)
{
- int ret, rc;
+ int ret;
struct stat st;
char buf[256];
@@ -79,7 +79,7 @@ void setup(void)
/* initialize - delete testing dir if it exists */
if ( (stat (UTESTS_TMP_DIR, &st) == 0) )
{
- rc = system ("rm -r " UTESTS_TMP_DIR);
+ system ("rm -r " UTESTS_TMP_DIR);
}
ret = mkdir(UTESTS_TMP_DIR, 0770);
if (ret < 0 && errno != EEXIST)
@@ -114,11 +114,11 @@ void teardown(void)
/* --- TEST PROCEDURES --- */
START_TEST (test_libspid_eoc_master_vlan_action)
{
- int rc, ret;
+ int ret;
/* prepare configuration files */
- rc = system("cp " NETWORK_BR_TST " " LIBSPID_NETWORK_CONF_PATH );
- rc = system("cp " MASTER_CONF " " UTESTS_TMP_DIR "/etc");
+ system("cp " NETWORK_BR_TST " " LIBSPID_NETWORK_CONF_PATH );
+ system("cp " MASTER_CONF " " UTESTS_TMP_DIR "/etc");
ret = libspid_eoc_master_vlan_action();
@@ -128,11 +128,11 @@ END_TEST
START_TEST (test_libspid_eoc_master_disable_vlan_action)
{
- int rc, ret;
+ int ret;
/* prepare configuration files */
- rc = system("cp " NETWORK_BR_TST " " LIBSPID_NETWORK_CONF_PATH );
- rc = system("cp " MASTER_CONF " " UTESTS_TMP_DIR "/etc");
+ system("cp " NETWORK_BR_TST " " LIBSPID_NETWORK_CONF_PATH );
+ system("cp " MASTER_CONF " " UTESTS_TMP_DIR "/etc");
ret = libspid_eoc_master_disable_vlan_action();
diff --git a/cleopatre/devkit/tests/libspid/utests/src/misc_eoc_utests.c b/cleopatre/devkit/tests/libspid/utests/src/misc_eoc_utests.c
index 39095bb2c7..ed26a1c762 100644
--- a/cleopatre/devkit/tests/libspid/utests/src/misc_eoc_utests.c
+++ b/cleopatre/devkit/tests/libspid/utests/src/misc_eoc_utests.c
@@ -49,191 +49,17 @@
typedef char mac_t[6];
typedef char mac_string_t[18];
-/**
- * Pull (get) data from beginning of MME payload. MME data head and length are updated
- * If there is not enough data to pull, an error is returned and the remaining payload length is returned.
- *
- * \param ctx MME context where to get data
- * \param data buffer where to get data from the beginning of MME payload
- * \param length length of data to pull
- * \param result_length length of data pulled; if there is not enough data into the MME to fit the length, the remaining data length is returned
- * \return error type (MME_SUCCESS if success)
- * \return MME_ERROR_NOT_INIT: context not initialized
- */
-mme_error_t mme_pull (mme_ctx_t *ctx, void *data, unsigned int length, unsigned int *result_length)
-{
- /* protect from null pointers */
- if (ctx == NULL || data == NULL || result_length == NULL)
- return MME_ERROR_GEN;
- /* check if ctx has been inititalized */
- if (ctx->status == MME_STATUS_INIT)
- return MME_ERROR_NOT_INIT;
-
- /* check if it is demanded more data than we have in payload */
- if (length > ctx->tail - ctx->head)
- {
- *result_length = ctx->tail - ctx->head;
- return MME_ERROR_ENOUGH;
- }
-
- *result_length = length;
-
- memcpy(data, (unsigned char *)(ctx->buffer + ctx->head), length);
-
- ctx->head += length;
-
- return MME_SUCCESS;
-}
-
-/**
- * Create a MME message context. This context is used to build the MME message step by step.
- * The provided buffer must be enough large to contain all the final payload.
- * The MME payload can be bigger than an ethernet payload, as the fragmentation is managed by the 'send' function.
- *
- * \param ctx MME context to fill with init value
- * \param mmtype type of MME message (must be in official type list)
- * \param buffer the buffer to put the payload
- * \param length the buffer length
- * \return error type (MME_SUCCESS if success)
- */
-mme_error_t mme_init (mme_ctx_t *ctx, const mme_type_t mmtype, unsigned char *buffer, const unsigned int length)
-{
- /* protect from null pointers */
- if (ctx == NULL || buffer == NULL)
- return MME_ERROR_GEN;
-
- ctx->buffer = buffer;
- ctx->mmtype = mmtype;
- ctx->length = length;
- ctx->head = 0;
- ctx->tail = 0;
-
- ctx->status = MME_STATUS_OK;
-
- return MME_SUCCESS;
-}
-
-/**
- * Put data at the end of MME payload. MME data tail and length are updated<br>
- * If there is not enough free place to put data, an error is returned and the remaining free space length is returned.
- *
- * \param ctx MME context where to put data
- * \param data data to put at the end of MME payload
- * \param length length of data to put
- * \param result_length length of data really put
- * \return error type (MME_SUCCESS if success)
- * \return MME_ERROR_NOT_INIT: context not initialized
- * \return MME_ERROR_SPACE: not enough available space
- */
-mme_error_t mme_put (mme_ctx_t *ctx, const void *data, unsigned int length, unsigned int *result_length)
-{
- int free = 0;
- int delta = 0;
-
- /* protect from null pointers */
- if (ctx == NULL || data == NULL || result_length == NULL)
- return MME_ERROR_GEN;
- /* check if ctx has been inititalized */
- if (ctx->status == MME_STATUS_INIT)
- return MME_ERROR_NOT_INIT;
-
- free = ctx->length - (ctx->tail - ctx->head);
- if (length > free)
- {
- *result_length = free;
- return MME_ERROR_SPACE;
- }
-
- *result_length = length;
-
- /* make place after payload, if needed */
- if (length > ctx->length - ctx->tail)
- {
- /*
- * *length
- * .---------------^-----------------.
- * |-----------|------------|xxxxxxx|-------------------------|
- * buff head tail ctx->length
- * \________ ________/
- * \/
- * payload
- *
- * we have to shift left our payload for this difference delta marked with 'x'
- * in order for *length bytes to fit in from beginning of the buffer
- */
- delta = length - (ctx->length - ctx->tail);
- memmove( (unsigned char *)(ctx->buffer + ctx->head - delta), (unsigned char *)(ctx->buffer + ctx->head), ctx->tail - ctx->head );
-
- /* update head and tail pointers (offsets) */
- ctx->head -= delta;
- ctx->tail -= delta;
- }
-
- memcpy( (unsigned char *)(ctx->buffer + ctx->tail), (unsigned char *)data, length );
- ctx->tail += length;
-
- return MME_SUCCESS;
-}
-
-/**
- * Send fake MME by filling buffer: confirm_ctx->buffer
- *
- * \param ctx MME context to send
- * \param type transaction type
- * \param iface selected communication interface
- * \param dest destination MAC address in binary format (6 bytes)
- * \param confirm_ctx MME context given to put the received MME answer packet. A adapted buffer must have been provided.
- * \return error type (MME_SUCCESS if success)
- * \return MME_ERROR_NOT_INIT: context not initialized
- */
-mme_error_t mme_send (mme_ctx_t *ctx, mme_send_type_t type, char *iface, unsigned char *dest, mme_ctx_t *confirm_ctx)
-{
- /* protect from null pointers */
- if (ctx == NULL || confirm_ctx == NULL || dest == NULL)
- return MME_ERROR_GEN;
-
- /* check if ctx has been inititalized */
- if (ctx->status == MME_STATUS_INIT)
- return MME_ERROR_NOT_INIT;
-
- confirm_ctx->buffer[0] = 0x00;
- confirm_ctx->buffer[1] = 0x13;
- confirm_ctx->buffer[2] = 0xD7;
- confirm_ctx->buffer[3] = 0x00;
-
- if (ctx->mmtype == (MME_TYPE_VS_EOC_REAL_TIME_STATISTICS | MME_TYPE_REQ))
- {
- if (memcmp (dest, "\x00\x11\x22\x33\x44\xaa", LIBSPID_MAC_BIN_LEN) == 0)
- confirm_ctx->buffer[3] = 0;
- if (memcmp (dest, "\x00\x11\x22\x33\x44\xbb", LIBSPID_MAC_BIN_LEN) == 0)
- confirm_ctx->buffer[3] = 1;
- if (memcmp (dest, "\x00\x11\x22\x33\x44\xcc", LIBSPID_MAC_BIN_LEN) == 0)
- return MME_ERROR_GEN;
- if (memcmp (dest, "\x00\x11\x22\x33\x44\xdd", LIBSPID_MAC_BIN_LEN) == 0)
- {
- confirm_ctx->buffer[4] = 0x0;
- confirm_ctx->buffer[5] = 0x3;
- confirm_ctx->buffer[6] = 0x55;
- confirm_ctx->buffer[7] = 0x17;
- }
- }
-
- confirm_ctx->tail = ETH_DATA_LEN;
-
- return MME_SUCCESS;
-}
-
/* fixtures - run before and after each unit test */
void setup(void)
{
- int ret, rc;
+ int ret;
struct stat st;
char buf[256];
/* initialize - delete testing dir if it exists */
if ( (stat (UTESTS_TMP_DIR, &st) == 0) )
{
- rc = system ("rm -r " UTESTS_TMP_DIR);
+ system ("rm -r " UTESTS_TMP_DIR);
}
ret = mkdir(UTESTS_TMP_DIR, 0770);
if (ret < 0 && errno != EEXIST)
@@ -319,11 +145,11 @@ END_TEST
START_TEST (test_libspid_eoc_get_topo)
{
- int ret, rc;
+ int ret;
mac_t mac_address_list[5];
int mac_address_count = 0;
- rc = system("cp " ONLINE_INFO " " UTESTS_TMP_DIR "/etc");
+ system("cp " ONLINE_INFO " " UTESTS_TMP_DIR "/etc");
ret = libspid_eoc_get_topo(mac_address_list[0], &mac_address_count);
fail_if(ret != LIBSPID_SUCCESS, "libspid_eoc_get_topo fail");
fail_if(strcmp(mac_address_list[0], "\x00\xd7\x20\x00\x00\x01") != 0, "libspid_eoc_get_topo gets wrong mac address 1");
@@ -340,13 +166,13 @@ START_TEST (test_libspid_eoc_get_device_info)
mac_string_t mac_address;
libspid_eoc_dev_info_t eoc_dev_info;
libspid_error_t ret;
- int rc;
- rc = system("cp " ONLINE_INFO " " UTESTS_TMP_DIR "/etc");
+ system("cp " ONLINE_INFO " " UTESTS_TMP_DIR "/etc");
strcpy(mac_address, "00:d7:20:00:00:03");
ret = libspid_eoc_get_device_info(mac_address, &eoc_dev_info);
+ fail_if (ret != LIBSPID_SUCCESS, "libspid_eoc_get_device_info fail");
fail_if(strcmp(eoc_dev_info.sw_version, "software3") != 0, "libspid_eoc_get_device_info gets wrong software version");
fail_if(eoc_dev_info.eth_port_nb != 1, "libspid_eoc_get_device_info gets wrong ethernet port number");
fail_if(strcmp(eoc_dev_info.model_no, "model3") != 0, "libspid_eoc_get_device_info gets wrong model string");
@@ -359,13 +185,13 @@ START_TEST (test_libspid_eoc_get_link)
mac_string_t mac_address;
libspid_eoc_link_quality_t eoc_link_quality;
libspid_error_t ret;
- int rc;
- rc = system("cp " ONLINE_INFO " " UTESTS_TMP_DIR "/etc");
+ system("cp " ONLINE_INFO " " UTESTS_TMP_DIR "/etc");
strcpy(mac_address, "00:d7:20:00:00:03");
ret = libspid_eoc_get_link(mac_address, &eoc_link_quality);
+ fail_if (ret != LIBSPID_SUCCESS, "libspid_eoc_get_link fail");
fail_if(eoc_link_quality.down_att != 30, "libspid_eoc_get_link gets wrong downstream attenuation");
fail_if(eoc_link_quality.up_att != 103, "libspid_eoc_get_link gets wrong upstream attenuation ");
fail_if(eoc_link_quality.down_quality != 100, "libspid_eoc_get_link gets wrong downstream quality");
@@ -384,13 +210,13 @@ START_TEST (test_libspid_eoc_get_stat)
int ret = 0;
ret = libspid_eoc_get_stat (mac_addr[0], &eoc_rt_stat);
- fail_if (ret != exp_ret[0], "libspid_eoc_get_stat failed");
+ fail_if (ret != exp_ret[0], "libspid_eoc_get_stat 1 failed");
ret = libspid_eoc_get_stat (mac_addr[1], &eoc_rt_stat);
- fail_if (ret != exp_ret[1], "libspid_eoc_get_stat failed");
+ fail_if (ret != exp_ret[1], "libspid_eoc_get_stat 2 failed");
ret = libspid_eoc_get_stat (mac_addr[2], &eoc_rt_stat);
- fail_if (ret != exp_ret[2], "libspid_eoc_get_stat failed");
+ fail_if (ret != exp_ret[2], "libspid_eoc_get_stat 3 failed");
ret = libspid_eoc_get_stat (mac_addr[3], &eoc_rt_stat);
fail_if (eoc_rt_stat.rx_pkt != data_exp, "libspid_eoc_get_stat data error");
diff --git a/cleopatre/devkit/tests/libspid/utests/src/network_utests.c b/cleopatre/devkit/tests/libspid/utests/src/network_utests.c
index 9fb31b2be7..143bb5acdf 100644
--- a/cleopatre/devkit/tests/libspid/utests/src/network_utests.c
+++ b/cleopatre/devkit/tests/libspid/utests/src/network_utests.c
@@ -32,7 +32,7 @@
#include <fcntl.h>
#include <net/if.h>
-#include "network_utests.h"
+#include "inc/network_utests.h"
//#define DEBUG 1
@@ -232,7 +232,7 @@ START_TEST (test_libspid_network_get_mac)
if((error = ioctl(fd, TUNSETIFF, (void *)&ifr)) < 0)
{
close(fd);
- if (error == EPERM)
+ if (error == -EPERM)
printf("TUN/TAP creation error.\nYou need to be root to create an network interface.\n");
else
printf("TUN/TAP creation error(%d).\n",error);
diff --git a/cleopatre/devkit/tests/libspid/utests/src/port_eoc_utests.c b/cleopatre/devkit/tests/libspid/utests/src/port_eoc_utests.c
index 0ebb671d13..b12de7106c 100644
--- a/cleopatre/devkit/tests/libspid/utests/src/port_eoc_utests.c
+++ b/cleopatre/devkit/tests/libspid/utests/src/port_eoc_utests.c
@@ -53,14 +53,14 @@
void
setup (void)
{
- int ret, rc;
+ int ret;
struct stat st;
char buf[256];
/* initialize - delete testing dir if it exists */
if ( (stat (UTESTS_TMP_DIR, &st) == 0) )
{
- rc = system ("rm -r " UTESTS_TMP_DIR);
+ system ("rm -r " UTESTS_TMP_DIR);
}
ret = mkdir (UTESTS_TMP_DIR, 0770);
if (ret < 0 && errno != EEXIST)
@@ -119,7 +119,7 @@ tc_param (void)
START_TEST (test_libspid_eoc_port_set)
{
- int ret, rc;
+ int ret;
char mac_address[LIBSPID_MAC_STR_LEN];
char index[2];
libspid_eoc_port_entry_t entry;
@@ -134,7 +134,7 @@ START_TEST (test_libspid_eoc_port_set)
strcpy (entry.vlan_tag_en, "1");
strcpy (entry.vlan_mark_id, "5");
- rc = system ("cp " PORT_CONF " " UTESTS_TMP_DIR "/etc");
+ system ("cp " PORT_CONF " " UTESTS_TMP_DIR "/etc");
ret = libspid_eoc_port_set (mac_address, index, &entry);
fail_if (ret != LIBSPID_SUCCESS, "libspid_eoc_port_set fail");
}
@@ -142,7 +142,7 @@ END_TEST
START_TEST (test_libspid_eoc_port_get)
{
- int ret, rc;
+ int ret;
char mac_address[LIBSPID_MAC_STR_LEN];
char index[2];
libspid_eoc_port_entry_t entry;
@@ -152,7 +152,7 @@ START_TEST (test_libspid_eoc_port_get)
strcpy (mac_address, "00:13:D7:00:00:01");
strcpy (index, "4");
- rc = system ("cp " PORT_CONF " " UTESTS_TMP_DIR "/etc");
+ system ("cp " PORT_CONF " " UTESTS_TMP_DIR "/etc");
ret = libspid_eoc_port_get (mac_address, index, &entry);
fail_if (ret != LIBSPID_SUCCESS, "libspid_eoc_port_get return unsuccessful");
@@ -167,7 +167,7 @@ END_TEST
START_TEST (test_libspid_eoc_port_get_list)
{
- int ret, rc;
+ int ret;
libspid_eoc_port_entry_t entries[PORT_ENTRY_NUM];
int i;
int count;
@@ -202,7 +202,7 @@ START_TEST (test_libspid_eoc_port_get_list)
memset (entries, 0, PORT_ENTRY_NUM * sizeof (libspid_eoc_port_entry_t));
- rc = system ("cp " PORT_CONF " " UTESTS_TMP_DIR "/etc");
+ system ("cp " PORT_CONF " " UTESTS_TMP_DIR "/etc");
ret = libspid_eoc_port_get_list (entries, &count);
@@ -254,9 +254,9 @@ END_TEST
START_TEST (test_libspid_eoc_port_sync)
{
- int ret, rc;
+ int ret;
- rc = system ("cp " PORT_SYNC_CONF " " UTESTS_TMP_DIR PORT_CONF_SYSTEM);
+ system ("cp " PORT_SYNC_CONF " " UTESTS_TMP_DIR PORT_CONF_SYSTEM);
ret = libspid_eoc_port_sync ();
diff --git a/cleopatre/devkit/tests/libspid/utests/src/service_eoc_utests.c b/cleopatre/devkit/tests/libspid/utests/src/service_eoc_utests.c
index 669056292c..ab9b45525a 100644
--- a/cleopatre/devkit/tests/libspid/utests/src/service_eoc_utests.c
+++ b/cleopatre/devkit/tests/libspid/utests/src/service_eoc_utests.c
@@ -55,14 +55,14 @@
void
setup (void)
{
- int ret, rc;
+ int ret;
struct stat st;
char buf[256];
/* initialize - delete testing dir if it exists */
if ( (stat (UTESTS_TMP_DIR, &st) == 0) )
{
- rc = system ("rm -r " UTESTS_TMP_DIR);
+ system ("rm -r " UTESTS_TMP_DIR);
}
ret = mkdir (UTESTS_TMP_DIR, 0770);
if (ret < 0 && errno != EEXIST)
@@ -119,7 +119,7 @@ tc_param (void)
START_TEST (test_libspid_eoc_service_set)
{
- int ret, rc;
+ int ret;
char index[4];
libspid_eoc_service_entry_t entry;
@@ -138,7 +138,7 @@ START_TEST (test_libspid_eoc_service_set)
strcpy (entry.max_jitter, "0");
strcpy (entry.acs_en, "0");
- rc = system ("cp " SERVICE_CONF " " UTESTS_TMP_DIR "/etc");
+ system ("cp " SERVICE_CONF " " UTESTS_TMP_DIR "/etc");
ret = libspid_eoc_service_set (index, &entry);
fail_if (ret != LIBSPID_SUCCESS, "libspid_eoc_service_set fail");
}
@@ -146,15 +146,15 @@ END_TEST
START_TEST (test_libspid_eoc_service_get)
{
- int ret, rc;
+ int ret;
char index[4];
libspid_eoc_service_entry_t entry;
memset (&entry, 0, sizeof (entry));
strcpy (index, "8");
- rc = system ("cp " SERVICE_CONF " " UTESTS_TMP_DIR "/etc");
- rc = system ("cp " EOC_CONF " " UTESTS_TMP_DIR "/etc");
+ system ("cp " SERVICE_CONF " " UTESTS_TMP_DIR "/etc");
+ system ("cp " EOC_CONF " " UTESTS_TMP_DIR "/etc");
ret = libspid_eoc_service_get (index, &entry);
fail_if (ret != LIBSPID_SUCCESS, "libspid_eoc_service_get return unsuccessful");
@@ -176,7 +176,7 @@ END_TEST
START_TEST (test_libspid_eoc_service_get_list)
{
- int ret, rc;
+ int ret;
libspid_eoc_service_entry_t entries[SERVICE_ENTRY_NUM];
int i;
int count;
@@ -198,8 +198,8 @@ START_TEST (test_libspid_eoc_service_get_list)
memset (entries, 0, SERVICE_ENTRY_NUM * sizeof (libspid_eoc_service_entry_t));
- rc = system ("cp " SERVICE_CONF " " UTESTS_TMP_DIR "/etc");
- rc = system ("cp " EOC_CONF " " UTESTS_TMP_DIR "/etc");
+ system ("cp " SERVICE_CONF " " UTESTS_TMP_DIR "/etc");
+ system ("cp " EOC_CONF " " UTESTS_TMP_DIR "/etc");
ret = libspid_eoc_service_get_list(entries, &count);
@@ -229,9 +229,9 @@ END_TEST
START_TEST (test_libspid_eoc_service_remove)
{
char index[4];
- int ret, rc;
+ int ret;
- rc = system ("cp " SERVICE_CONF " " UTESTS_TMP_DIR "/etc");
+ system ("cp " SERVICE_CONF " " UTESTS_TMP_DIR "/etc");
strcpy (index, "7");
@@ -243,9 +243,9 @@ END_TEST
START_TEST (test_libspid_eoc_service_flush)
{
- int ret, rc;
+ int ret;
- rc = system ("cp " SERVICE_CONF " " UTESTS_TMP_DIR "/etc");
+ system ("cp " SERVICE_CONF " " UTESTS_TMP_DIR "/etc");
ret = libspid_eoc_service_flush ();
@@ -305,10 +305,10 @@ END_TEST
START_TEST (test_libspid_eoc_service_sync)
{
- int ret, rc;
+ int ret;
- rc = system ("cp " SERVICE_SYNC_CONF " " UTESTS_TMP_DIR SERVICE_CONF_SYSTEM);
- rc = system ("cp " EOC_CONF " " UTESTS_TMP_DIR "/etc");
+ system ("cp " SERVICE_SYNC_CONF " " UTESTS_TMP_DIR SERVICE_CONF_SYSTEM);
+ system ("cp " EOC_CONF " " UTESTS_TMP_DIR "/etc");
ret = libspid_eoc_service_sync ();
diff --git a/cleopatre/devkit/tests/libspid/utests/src/system_utests.c b/cleopatre/devkit/tests/libspid/utests/src/system_utests.c
index 0d066fe80d..778d5f6242 100644
--- a/cleopatre/devkit/tests/libspid/utests/src/system_utests.c
+++ b/cleopatre/devkit/tests/libspid/utests/src/system_utests.c
@@ -24,11 +24,13 @@
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
+#include <sys/wait.h>
#include <dirent.h>
#include <sys/stat.h>
#include <time.h>
-#include "system_utests.h"
+#include "inc/system_utests.h"
+#include "path.h"
//#define DEBUG 1
@@ -98,6 +100,14 @@ void setup(void)
exit(EXIT_FAILURE);
}
+ sprintf(buf, "%s/factory", UTESTS_TMP_DIR);
+ ret = mkdir(buf, 0770);
+ if (ret < 0 && errno != EEXIST)
+ {
+ perror("mkdir(UTESTS_TMP_DIR, 0770)");
+ exit(EXIT_FAILURE);
+ }
+
sprintf(buf, "%s/dev", UTESTS_TMP_DIR);
ret = mkdir(buf, 0770);
if (ret < 0 && errno != EEXIST)
@@ -387,60 +397,24 @@ START_TEST (test_libspid_system_factory)
char tst_file[128] = {0};
struct stat st;
-#ifdef DEBUG
- struct dirent *d;
- DIR *dir;
-#endif /* DEBUG */
-
- sprintf (tst_file, "%s/test_F1", LIBSPID_CONF_SAVE_PATH);
- mknod(tst_file, 0770, S_IFREG);
- sprintf (tst_file, "%s/test_F2", LIBSPID_CONF_SAVE_PATH);
- mknod(tst_file, 0770, S_IFREG);
- sprintf (tst_file, "%s/test_F3.conf", LIBSPID_CONF_SAVE_PATH);
- mknod(tst_file, 0770, S_IFREG);
+ sprintf (tst_file, "%s/test1", LIBSPID_CONF_SAVE_PATH);
+ fail_if ( stat(tst_file,&st) != 0, "missing file before test" );
+ sprintf (tst_file, "%s/test2", LIBSPID_CONF_SAVE_PATH);
+ fail_if ( stat(tst_file,&st) != 0, "missing file before test" );
+ sprintf (tst_file, "%s/test3.conf", LIBSPID_CONF_SAVE_PATH);
+ fail_if ( stat(tst_file,&st) != 0, "missing file before test" );
ret = libspid_system_factory();
fail_if(ret != LIBSPID_SUCCESS, "libspid_system_factory fail");
/* test if files have been deleted */
- sprintf (tst_file, "%s/test_F1", LIBSPID_CONF_SAVE_PATH);
- fail_if ( stat(tst_file,&st) == 0, "libspid_system_factory did not delete F1 file" );
- sprintf (tst_file, "%s/test_F2", LIBSPID_CONF_SAVE_PATH);
- fail_if ( stat(tst_file,&st) == 0, "libspid_system_factory did not delete F2 file" );
- sprintf (tst_file, "%s/test_F3.conf", LIBSPID_CONF_SAVE_PATH);
- fail_if ( stat(tst_file,&st) == 0, "libspid_system_factory did not delete F3 file" );
-
-#ifdef DEBUG
- /* print contents for debug */
- dir = opendir (LIBSPID_CONF_SAVE_PATH);
- if (dir == NULL)
- {
- perror("opendir()");
- exit(1);
- }
- TRACE ("Listing LIBSPID_CONF_SAVE_PATH, %s:\n", LIBSPID_CONF_SAVE_PATH);
- while( (d = readdir(dir)) != NULL )
- {
- TRACE("%s\n",d->d_name);
- }
-
- sprintf (tst_file, "%s/test_F1", LIBSPID_CONF_SAVE_PATH);
- if ( stat(tst_file,&st) == 0 )
- {
- printf("%s is present\n", tst_file);
- }
-
- sprintf (tst_file, "%s/test_NON_EXISTANT", LIBSPID_CONF_SAVE_PATH);
- if ( stat(tst_file,&st) == 0 )
- {
- printf("%s is present\n", tst_file);
- }
- else
- {
- printf("%s is *NOT* present\n", tst_file);
- }
-#endif /* DEBUG */
+ sprintf (tst_file, "%s/test1", LIBSPID_CONF_SAVE_PATH);
+ fail_if ( stat(tst_file,&st) == 0, "file not removed" );
+ sprintf (tst_file, "%s/test2", LIBSPID_CONF_SAVE_PATH);
+ fail_if ( stat(tst_file,&st) == 0, "file not removed" );
+ sprintf (tst_file, "%s/test3.conf", LIBSPID_CONF_SAVE_PATH);
+ fail_if ( stat(tst_file,&st) == 0, "file not removed" );
}
END_TEST
@@ -530,7 +504,7 @@ START_TEST (test_libspid_system_set_nvram)
perror("Cannot open NVRAM path for reading");
exit(EXIT_FAILURE);
}
- fread(&ret_nvram, sizeof(spc300_nvram_t), 1, fp);
+ fail_if (fread (&ret_nvram, sizeof (spc300_nvram_t), 1, fp) != 1);
fclose(fp);
ret = memcmp(&ret_nvram, &nvram, sizeof(spc300_nvram_t));
@@ -566,15 +540,15 @@ void callback (int signal_nb)
START_TEST (test_libspid_system_file_update_register)
{
pid_t rx_pid = 1;
- char filename[LIBSPID_CONFIG_KEY_MAX_LEN];
+ char filename[LIBSPID_CONFIG_KEY_MAX_LEN + 1];
char filename_too_long[LIBSPID_CONFIG_KEY_MAX_LEN + 2];
libspid_boolean_t is_registered = LIBSPID_FALSE;
unsigned int elt_number = LIBSPID_CONFIG_ELT_MAX_NB;
char *elt[LIBSPID_CONFIG_ELT_MAX_NB] = { NULL };
char buffer[LIBSPID_CONFIG_LINE_MAX_LEN] = {0};
- char key[LIBSPID_CONFIG_KEY_MAX_LEN];
- memset (filename, 'f', LIBSPID_CONFIG_KEY_MAX_LEN-1);
- filename[LIBSPID_CONFIG_KEY_MAX_LEN-1] = '\0';
+ char key[LIBSPID_CONFIG_KEY_MAX_LEN + 1];
+ memset (filename, 'f', LIBSPID_CONFIG_KEY_MAX_LEN);
+ filename[LIBSPID_CONFIG_KEY_MAX_LEN] = '\0';
memset (filename_too_long, 'l', LIBSPID_CONFIG_KEY_MAX_LEN + 1);
filename_too_long[LIBSPID_CONFIG_KEY_MAX_LEN + 1] = '\0';
strcpy (key, filename);
@@ -819,8 +793,29 @@ START_TEST (test_libspid_system_file_update_warn)
fail_if (LIBSPID_SUCCESS != libspid_system_file_update_is_registered (getpid(),
filename, &is_registered));
fail_if (LIBSPID_TRUE != is_registered);
+ fail_if (LIBSPID_SUCCESS != libspid_system_file_update_warn (getpid(), filename));
+ fail_if (handler_called);
fail_if (LIBSPID_SUCCESS != libspid_system_file_update_warn (tx_pid, filename));
fail_if (!handler_called);
+ fail_if (LIBSPID_SUCCESS != libspid_system_file_update_unregister (getpid(), filename));
+ handler_called = 0;
+
+ /* Test with a registered process that no longer exists. */
+ pid_t child_pid = fork ();
+ fail_if (child_pid == -1);
+ if (child_pid)
+ {
+ fail_if (waitpid (child_pid, NULL, 0) != child_pid);
+ fail_if (LIBSPID_SUCCESS != libspid_system_file_update_register (child_pid, filename,
+ callback));
+ fail_if (LIBSPID_SUCCESS != libspid_system_file_update_warn (tx_pid, filename));
+ fail_if (handler_called);
+ fail_if (LIBSPID_SUCCESS != libspid_system_file_update_unregister (child_pid, filename));
+ }
+ else
+ {
+ exit (0);
+ }
}
END_TEST
@@ -860,8 +855,8 @@ int main(void)
s = libspid_system_suite();
SRunner *sr = srunner_create(s);
- //srunner_set_fork_status (sr, CK_NOFORK);
- srunner_set_fork_status (sr, CK_FORK);
+ srunner_set_fork_status (sr, CK_NOFORK);
+ //srunner_set_fork_status (sr, CK_FORK);
srunner_run_all(sr, CK_NORMAL);
number_failed = srunner_ntests_failed(sr);
srunner_free(sr);
diff --git a/cleopatre/devkit/tests/libspid/utests/src/tonemap_snr_eoc_utests.c b/cleopatre/devkit/tests/libspid/utests/src/tonemap_snr_eoc_utests.c
index ada26d86f2..11b0b7d8ad 100644
--- a/cleopatre/devkit/tests/libspid/utests/src/tonemap_snr_eoc_utests.c
+++ b/cleopatre/devkit/tests/libspid/utests/src/tonemap_snr_eoc_utests.c
@@ -43,242 +43,6 @@
#define TRACE(...)
#endif
-
-/**
- * Pull (get) data from beginning of MME payload. MME data head and length are updated
- * If there is not enough data to pull, an error is returned and the remaining payload length is returned.
- *
- * \param ctx MME context where to get data
- * \param data buffer where to get data from the beginning of MME payload
- * \param length length of data to pull
- * \param result_length length of data pulled; if there is not enough data into the MME to fit the length, the remaining data length is returned
- * \return error type (MME_SUCCESS if success)
- * \return MME_ERROR_NOT_INIT: context not initialized
- */
-mme_error_t mme_pull (mme_ctx_t *ctx, void *data, unsigned int length, unsigned int *result_length)
-{
- /* protect from null pointers */
- if (ctx == NULL || data == NULL || result_length == NULL)
- return MME_ERROR_GEN;
- /* check if ctx has been inititalized */
- if (ctx->status == MME_STATUS_INIT)
- return MME_ERROR_NOT_INIT;
-
- /* check if it is demanded more data than we have in payload */
- if (length > ctx->tail - ctx->head)
- {
- *result_length = ctx->tail - ctx->head;
- return MME_ERROR_ENOUGH;
- }
-
- *result_length = length;
-
- memcpy (data, (unsigned char *)(ctx->buffer + ctx->head), length);
-
- ctx->head += length;
-
- return MME_SUCCESS;
-}
-
-/**
- * Create a MME message context. This context is used to build the MME message step by step.
- * The provided buffer must be enough large to contain all the final payload.
- * The MME payload can be bigger than an ethernet payload, as the fragmentation is managed by the 'send' function.
- *
- * \param ctx MME context to fill with init value
- * \param mmtype type of MME message (must be in official type list)
- * \param buffer the buffer to put the payload
- * \param length the buffer length
- * \return error type (MME_SUCCESS if success)
- */
-mme_error_t mme_init (mme_ctx_t *ctx, const mme_type_t mmtype, unsigned char *buffer, const unsigned int length)
-{
- /* protect from null pointers */
- if (ctx == NULL || buffer == NULL)
- return MME_ERROR_GEN;
-
- ctx->buffer = buffer;
- ctx->mmtype = mmtype;
- ctx->length = length;
- ctx->head = 0;
- ctx->tail = 0;
-
- ctx->status = MME_STATUS_OK;
-
- return MME_SUCCESS;
-}
-
-/**
- * Put data at the end of MME payload. MME data tail and length are updated<br>
- * If there is not enough free place to put data, an error is returned and the remaining free space length is returned.
- *
- * \param ctx MME context where to put data
- * \param data data to put at the end of MME payload
- * \param length length of data to put
- * \param result_length length of data really put
- * \return error type (MME_SUCCESS if success)
- * \return MME_ERROR_NOT_INIT: context not initialized
- * \return MME_ERROR_SPACE: not enough available space
- */
-mme_error_t mme_put (mme_ctx_t *ctx, const void *data, unsigned int length, unsigned int *result_length)
-{
- int free = 0;
- int delta = 0;
-
- /* protect from null pointers */
- if (ctx == NULL || data == NULL || result_length == NULL)
- return MME_ERROR_GEN;
- /* check if ctx has been inititalized */
- if (ctx->status == MME_STATUS_INIT)
- return MME_ERROR_NOT_INIT;
-
- free = ctx->length - (ctx->tail - ctx->head);
- if (length > free)
- {
- *result_length = free;
- return MME_ERROR_SPACE;
- }
-
- *result_length = length;
-
- /* make place after payload, if needed */
- if (length > ctx->length - ctx->tail)
- {
- /*
- * *length
- * .---------------^-----------------.
- * |-----------|------------|xxxxxxx|-------------------------|
- * buff head tail ctx->length
- * \________ ________/
- * \/
- * payload
- *
- * we have to shift left our payload for this difference delta marked with 'x'
- * in order for *length bytes to fit in from beginning of the buffer
- */
- delta = length - (ctx->length - ctx->tail);
- memmove( (unsigned char *)(ctx->buffer + ctx->head - delta), (unsigned char *)(ctx->buffer + ctx->head), ctx->tail - ctx->head );
-
- /* update head and tail pointers (offsets) */
- ctx->head -= delta;
- ctx->tail -= delta;
- }
-
- memcpy( (unsigned char *)(ctx->buffer + ctx->tail), (unsigned char *)data, length );
- ctx->tail += length;
-
- return MME_SUCCESS;
-}
-
-/**
- * Send fake MME by filling buffer: confirm_ctx->buffer
- *
- * \param ctx MME context to send
- * \param type transaction type
- * \param iface selected communication interface
- * \param dest destination MAC address in binary format (6 bytes)
- * \param confirm_ctx MME context given to put the received MME answer packet. A adapted buffer must have been provided.
- * \return error type (MME_SUCCESS if success)
- * \return MME_ERROR_NOT_INIT: context not initialized
- */
-mme_error_t mme_send (mme_ctx_t *ctx, mme_send_type_t type, char *iface, unsigned char *dest, mme_ctx_t *confirm_ctx)
-{
- libspid_eoc_snr_entry_t snr;
- libspid_eoc_tonemap_entry_t tonemap;
-
- snr.int_id = 0;
- snr.int_length = 1;
- snr.tm_ber = 789;
-
- /* result */
- unsigned char result = 0;
-
- /* protect from null pointers */
- if (ctx == NULL || confirm_ctx == NULL || dest == NULL)
- return MME_ERROR_GEN;
-
- /* check if ctx has been inititalized */
- if (ctx->status == MME_STATUS_INIT)
- return MME_ERROR_NOT_INIT;
-
- if (ctx->mmtype == (MME_TYPE_VS_GET_SNR | MME_TYPE_REQ))
- {
- snr.carrier_group = ctx->buffer[11];
-
- confirm_ctx->buffer[0] = 0x00;
- confirm_ctx->buffer[1] = 0x13;
- confirm_ctx->buffer[2] = 0xD7;
-
- confirm_ctx->buffer[3] = result;
- confirm_ctx->buffer[4] = snr.int_id;
- confirm_ctx->buffer[5] = snr.int_length;
- snr.int_et[0] = 537;
- memcpy(&confirm_ctx->buffer[6], &snr.int_et[0], 2);
- memcpy(&confirm_ctx->buffer[8], &snr.tm_ber, 2);
-
- confirm_ctx->buffer[10] = snr.carrier_group;
-
- snr.snr_list[5] = 203;
- memcpy(&confirm_ctx->buffer[11], snr.snr_list, LIBSPID_EOC_SNR_LIST_MAX_SIZE);
-
- }
- if (ctx->mmtype == (MME_TYPE_VS_GET_TONEMAP | MME_TYPE_REQ))
- {
- confirm_ctx->buffer[0] = 0x00;
- confirm_ctx->buffer[1] = 0x13;
- confirm_ctx->buffer[2] = 0xD7;
-
- if (ctx->buffer[9] == 255)
- {
- confirm_ctx->buffer[3] = result;
- tonemap.int_id = 35;
- confirm_ctx->buffer[8] = tonemap.int_id;
- }
- else
- {
- confirm_ctx->buffer[3] = result;
-
- tonemap.int_id = 35;
- confirm_ctx->buffer[8] = tonemap.int_id;
-
- tonemap.tmi_default = 3;
- confirm_ctx->buffer[9] = tonemap.tmi_default;
-
- tonemap.tmi_length = 1;
- confirm_ctx->buffer[10] = tonemap.tmi_length;
-
- tonemap.tmi_data[0] = 67;
- confirm_ctx->buffer[11] = tonemap.tmi_data[0];
-
- tonemap.int_length = 1;
- confirm_ctx->buffer[12] = tonemap.int_length;
-
- tonemap.int_et[0] = 633;
- memcpy(&confirm_ctx->buffer[13], &tonemap.int_et[0], 2);
-
- tonemap.int_tmi[0] = 56;
- confirm_ctx->buffer[15] = tonemap.int_tmi[0];
-
- tonemap.tmi = 3;
- confirm_ctx->buffer[16] = tonemap.tmi;
-
- tonemap.tm_fec = 7;
- confirm_ctx->buffer[17] = tonemap.tm_fec;
-
- tonemap.tm_gi = 5;
- confirm_ctx->buffer[18] = tonemap.tm_gi;
-
- tonemap.modulation_list[3] = 31;
- memcpy(&confirm_ctx->buffer[19], tonemap.modulation_list, LIBSPID_EOC_MODULATION_LIST_MAX_SIZE);
- }
-
- }
-
- confirm_ctx->tail = ETH_DATA_LEN;
-
- return MME_SUCCESS;
-}
-
START_TEST (test_libspid_eoc_get_tonemap)
{
int ret = 0;
diff --git a/cleopatre/devkit/tests/libspid/utests/src/upgrade_eoc_utests.c b/cleopatre/devkit/tests/libspid/utests/src/upgrade_eoc_utests.c
index a0794259ec..f2db459b9f 100644
--- a/cleopatre/devkit/tests/libspid/utests/src/upgrade_eoc_utests.c
+++ b/cleopatre/devkit/tests/libspid/utests/src/upgrade_eoc_utests.c
@@ -50,263 +50,17 @@
typedef char mac_t[6];
typedef char mac_string_t[18];
-static unsigned int seq_cnt = 1;
-
-/**
- * Pull (get) data from beginning of MME payload. MME data head and length are updated
- * If there is not enough data to pull, an error is returned and the remaining payload length is returned.
- *
- * \param ctx MME context where to get data
- * \param data buffer where to get data from the beginning of MME payload
- * \param length length of data to pull
- * \param result_length length of data pulled; if there is not enough data into the MME to fit the length, the remaining data length is returned
- * \return error type (MME_SUCCESS if success)
- * \return MME_ERROR_NOT_INIT: context not initialized
- */
-mme_error_t mme_pull (mme_ctx_t *ctx, void *data, unsigned int length, unsigned int *result_length)
-{
- /* protect from null pointers */
- if (ctx == NULL || data == NULL || result_length == NULL)
- return MME_ERROR_GEN;
- /* check if ctx has been inititalized */
- if (ctx->status == MME_STATUS_INIT)
- return MME_ERROR_NOT_INIT;
-
- /* check if it is demanded more data than we have in payload */
- if (length > ctx->tail - ctx->head)
- {
- *result_length = ctx->tail - ctx->head;
- return MME_ERROR_ENOUGH;
- }
-
- *result_length = length;
-
- memcpy(data, (unsigned char *)(ctx->buffer + ctx->head), length);
-
- ctx->head += length;
-
- return MME_SUCCESS;
-}
-
-/**
- * Create a MME message context. This context is used to build the MME message step by step.
- * The provided buffer must be enough large to contain all the final payload.
- * The MME payload can be bigger than an ethernet payload, as the fragmentation is managed by the 'send' function.
- *
- * \param ctx MME context to fill with init value
- * \param mmtype type of MME message (must be in official type list)
- * \param buffer the buffer to put the payload
- * \param length the buffer length
- * \return error type (MME_SUCCESS if success)
- */
-mme_error_t mme_init (mme_ctx_t *ctx, const mme_type_t mmtype, unsigned char *buffer, const unsigned int length)
-{
- /* protect from null pointers */
- if (ctx == NULL || buffer == NULL)
- return MME_ERROR_GEN;
-
- ctx->buffer = buffer;
- ctx->mmtype = mmtype;
- ctx->length = length;
- ctx->head = 0;
- ctx->tail = 0;
-
- ctx->status = MME_STATUS_OK;
-
- return MME_SUCCESS;
-}
-
-/**
- * Put data at the end of MME payload. MME data tail and length are updated<br>
- * If there is not enough free place to put data, an error is returned and the remaining free space length is returned.
- *
- * \param ctx MME context where to put data
- * \param data data to put at the end of MME payload
- * \param length length of data to put
- * \param result_length length of data really put
- * \return error type (MME_SUCCESS if success)
- * \return MME_ERROR_NOT_INIT: context not initialized
- * \return MME_ERROR_SPACE: not enough available space
- */
-mme_error_t mme_put (mme_ctx_t *ctx, const void *data, unsigned int length, unsigned int *result_length)
-{
- int free = 0;
- int delta = 0;
-
- /* protect from null pointers */
- if (ctx == NULL || data == NULL || result_length == NULL)
- return MME_ERROR_GEN;
- /* check if ctx has been inititalized */
- if (ctx->status == MME_STATUS_INIT)
- return MME_ERROR_NOT_INIT;
-
- free = ctx->length - (ctx->tail - ctx->head);
- if (length > free)
- {
- *result_length = free;
- return MME_ERROR_SPACE;
- }
-
- *result_length = length;
-
- /* make place after payload, if needed */
- if (length > ctx->length - ctx->tail)
- {
- /*
- * *length
- * .---------------^-----------------.
- * |-----------|------------|xxxxxxx|-------------------------|
- * buff head tail ctx->length
- * \________ ________/
- * \/
- * payload
- *
- * we have to shift left our payload for this difference delta marked with 'x'
- * in order for *length bytes to fit in from beginning of the buffer
- */
- delta = length - (ctx->length - ctx->tail);
- memmove( (unsigned char *)(ctx->buffer + ctx->head - delta), (unsigned char *)(ctx->buffer + ctx->head), ctx->tail - ctx->head );
-
- /* update head and tail pointers (offsets) */
- ctx->head -= delta;
- ctx->tail -= delta;
- }
-
- memcpy( (unsigned char *)(ctx->buffer + ctx->tail), (unsigned char *)data, length );
- ctx->tail += length;
-
- return MME_SUCCESS;
-}
-
-/**
- * Send fake MME by filling buffer: confirm_ctx->buffer
- *
- * \param ctx MME context to send
- * \param type transaction type
- * \param iface selected communication interface
- * \param dest destination MAC address in binary format (6 bytes)
- * \param confirm_ctx MME context given to put the received MME answer packet. A adapted buffer must have been provided.
- * \return error type (MME_SUCCESS if success)
- * \return MME_ERROR_NOT_INIT: context not initialized
- */
-mme_error_t mme_send (mme_ctx_t *ctx, mme_send_type_t type, char *iface, unsigned char *dest, mme_ctx_t *confirm_ctx)
-{
- /* protect from null pointers */
- if (ctx == NULL || confirm_ctx == NULL ||iface == NULL || dest == NULL)
- return MME_ERROR_GEN;
-
- /* check if ctx has been inititalized */
- if (ctx->status == MME_STATUS_INIT)
- return MME_ERROR_NOT_INIT;
-
- confirm_ctx->buffer[0] = 0x00;
- if ((ctx->mmtype >> 12) == 0xA)
- {
- confirm_ctx->buffer[1] = 0x13;
- confirm_ctx->buffer[2] = 0xD7;
-
- if (ctx->mmtype == (MME_TYPE_VS_UPDATE_START | MME_TYPE_REQ))
- {
- seq_cnt = 0;
- if (memcmp(dest, "\x00\x11\x22\x33\x44\x66", LIBSPID_MAC_BIN_LEN) == 0)
- confirm_ctx->buffer[3] = LIBSPID_UPDATE_START_VERSION_OK;
- else if(memcmp(dest, "\x00\x11\x22\x33\x44\x77", LIBSPID_MAC_BIN_LEN) == 0)
- confirm_ctx->buffer[3] = LIBSPID_UPDATE_START_BAD_ARCH;
- else if(memcmp(dest, "\x00\x11\x22\x33\x44\x88", LIBSPID_MAC_BIN_LEN) == 0)
- confirm_ctx->buffer[3] = LIBSPID_UPDATE_START_BAD_TYPE;
- else if(memcmp(dest, "\x00\x11\x22\x33\x44\x99", LIBSPID_MAC_BIN_LEN) == 0)
- confirm_ctx->buffer[3] = LIBSPID_UPDATE_START_MODEM_BUSY;
- else
- confirm_ctx->buffer[3] = LIBSPID_UPDATE_START_SUCCESS;
- }
- if (ctx->mmtype == (MME_TYPE_VS_UPDATE_TRANSFER | MME_TYPE_REQ))
- {
- seq_cnt++;
- if (memcmp(dest, "\x00\x11\x22\x33\x44\xbb", LIBSPID_MAC_BIN_LEN) == 0)
- confirm_ctx->buffer[3] = LIBSPID_UPDATE_TRANSFER_FAILED;
- else
- {
- confirm_ctx->buffer[3] = LIBSPID_UPDATE_TRANSFER_SUCCESS;
- confirm_ctx->buffer[4] = (seq_cnt >> 0) & 0xFF;
- confirm_ctx->buffer[5] = (seq_cnt >> 8) & 0xFF;
- confirm_ctx->buffer[6] = (seq_cnt >> 16) & 0xFF;
- confirm_ctx->buffer[7] = (seq_cnt >> 24) & 0xFF;
- }
- }
- if (ctx->mmtype == (MME_TYPE_VS_UPDATE_END | MME_TYPE_REQ))
- {
- if (memcmp(dest, "\x00\x11\x22\x33\x44\xdd", LIBSPID_MAC_BIN_LEN) == 0)
- confirm_ctx->buffer[3] = LIBSPID_UPDATE_END_MD5_ERROR;
- else
- confirm_ctx->buffer[3] = LIBSPID_UPDATE_END_SUCCESS;
- }
- }
-
- confirm_ctx->tail = ETH_DATA_LEN;
-
- return MME_SUCCESS;
-}
-
-/**
- * Wait for an MME request and call an user function to build and send the answer.<br>
- * As MME are level 2 and IP routing does not apply, the network interface where to listen to data packet must be selected inside
- * iface paramater. For instance : "eth0", "br0", ...<br>
- * If a received MME is fragmented, the receive process re-assemble it before delivering.<br>
- * When received MME has been processed and put into a MME context, the user function is called with the context in parameter.
- *
- * \param ctx context to receive the MME data
- * \param iface interface where to listen to the MME
- * \param source buffer where is filled the source MAC address of received MMA
- * \param listen_cb callback function used when MME packet is received.
- * \param tout timeout in seconds after which listening expires.
- * \return error type (MME_SUCCESS if success)
- * \return MME_ERROR_NOT_INIT: context not initialized
- */
-mme_error_t mme_listen (mme_ctx_t *ctx, char *iface, unsigned char *source, mme_listen_cb_t listen_cb, unsigned int tout)
-{
- unsigned int result_len;
- char data[4];
-
- /* protect from null pointers */
- if (ctx == NULL || iface == NULL || source == NULL) return MME_ERROR_GEN;
- /* check if ctx has been inititalized */
- if (ctx->status == MME_STATUS_INIT) return MME_ERROR_NOT_INIT;
-
- data[0] = 0x00;
- data[1] = 0x13;
- data[2] = 0xD7;
-
- if (ctx->mmtype == (MME_TYPE_VS_UPDATE_END | MME_TYPE_IND))
- {
- if (memcmp(source, "\x00\x11\x22\x33\x44\xee", LIBSPID_MAC_BIN_LEN) == 0)
- data[3] = LIBSPID_UPDATE_END_FLASH_ERROR;
- else
- data[3] = LIBSPID_UPDATE_END_SUCCESS;
- }
- else if (ctx->mmtype == (MME_TYPE_VS_UPDATE_TRANSFER | MME_TYPE_IND))
- {
- if (memcmp(source, "\x00\x11\x22\x33\x44\xee", LIBSPID_MAC_BIN_LEN) == 0)
- data[3] = LIBSPID_UPDATE_TRANSFER_FAILED;
- else
- data[3] = LIBSPID_UPDATE_TRANSFER_SUCCESS;
- }
-
- mme_put(ctx, data, 4, &result_len);
-
- return MME_SUCCESS;
-}
-
/* fixtures - run before and after each unit test */
void setup(void)
{
- int ret, rc;
+ int ret;
struct stat st;
char buf[256];
/* initialize - delete testing dir if it exists */
if ( (stat (UTESTS_TMP_DIR, &st) == 0) )
{
- rc = system ("rm -r " UTESTS_TMP_DIR);
+ system ("rm -r " UTESTS_TMP_DIR);
}
ret = mkdir(UTESTS_TMP_DIR, 0770);
if (ret < 0 && errno != EEXIST)
@@ -359,7 +113,7 @@ END_TEST
START_TEST (test_libspid_eoc_upgrade_remote_image)
{
int exp_ret[10] = { 0, 4, 4, 4, 4, 0, 4, 0, 4, 4 };
- int ret, i, rc;
+ int ret, i;
char mac_addr[10][LIBSPID_MAC_STR_LEN] = {
"00:11:22:33:44:55", "00:11:22:33:44:66", "00:11:22:33:44:77",
"00:11:22:33:44:88", "00:11:22:33:44:99", "00:11:22:33:44:aa",
@@ -368,7 +122,7 @@ START_TEST (test_libspid_eoc_upgrade_remote_image)
};
char file[] = UTESTS_TMP_DIR "/" IMAGE_FILE;
- rc = system("cp " LOCAL_IMAGE_FILE " " UTESTS_TMP_DIR);
+ system("cp " LOCAL_IMAGE_FILE " " UTESTS_TMP_DIR);
for (i=0; i<10; i++) {
ret = libspid_eoc_upgrade_remote_image(mac_addr[i], file);
@@ -383,7 +137,7 @@ END_TEST
START_TEST (test_libspid_eoc_tftp_upgrade_remote_image)
{
- int ret, rc, i;
+ int ret, i;
int exp_ret[10] = { 0, 4, 4, 4, 4, 0, 0, 0, 4, 4 };
char mac_addr[10][LIBSPID_MAC_STR_LEN] = {
"00:11:22:33:44:55", "00:11:22:33:44:66", "00:11:22:33:44:77",
@@ -393,7 +147,7 @@ START_TEST (test_libspid_eoc_tftp_upgrade_remote_image)
};
char file[] = UTESTS_TMP_DIR "/" IMAGE_FILE;
- rc = system("cp " LOCAL_IMAGE_FILE " " UTESTS_TMP_DIR);
+ system("cp " LOCAL_IMAGE_FILE " " UTESTS_TMP_DIR);
for (i=0; i<10; i++) {
ret = libspid_eoc_tftp_upgrade_remote_image (mac_addr[i], file);
diff --git a/cleopatre/devkit/tests/libspid/utests/src/wl_eoc_utests.c b/cleopatre/devkit/tests/libspid/utests/src/wl_eoc_utests.c
index ea47c9809a..4fb9bc85c7 100644
--- a/cleopatre/devkit/tests/libspid/utests/src/wl_eoc_utests.c
+++ b/cleopatre/devkit/tests/libspid/utests/src/wl_eoc_utests.c
@@ -90,181 +90,18 @@ itoa (int n, char* s, int b)
reverse(s);
}
-/* stub functions */
-
-/**
- * Pull (get) data from beginning of MME payload. MME data head and length are updated
- * If there is not enough data to pull, an error is returned and the remaining payload length is returned.
- *
- * \param ctx MME context where to get data
- * \param data buffer where to get data from the beginning of MME payload
- * \param length length of data to pull
- * \param result_length length of data pulled; if there is not enough data into the MME to fit the length, the remaining data length is returned
- * \return error type (MME_SUCCESS if success)
- * \return MME_ERROR_NOT_INIT: context not initialized
- */
-mme_error_t
-mme_pull (mme_ctx_t *ctx, void *data, unsigned int length, unsigned int *result_length)
-{
- /* protect from null pointers */
- if (ctx == NULL || data == NULL || result_length == NULL)
- return MME_ERROR_GEN;
- /* check if ctx has been inititalized */
- if (ctx->status == MME_STATUS_INIT)
- return MME_ERROR_NOT_INIT;
-
- /* check if it is demanded more data than we have in payload */
- if (length > ctx->tail - ctx->head)
- {
- *result_length = ctx->tail - ctx->head;
- return MME_ERROR_ENOUGH;
- }
-
- *result_length = length;
-
- memcpy (data, (unsigned char *)(ctx->buffer + ctx->head), length);
-
- ctx->head += length;
-
- return MME_SUCCESS;
-}
-
-/**
- * Create a MME message context. This context is used to build the MME message step by step.
- * The provided buffer must be enough large to contain all the final payload.
- * The MME payload can be bigger than an ethernet payload, as the fragmentation is managed by the 'send' function.
- *
- * \param ctx MME context to fill with init value
- * \param mmtype type of MME message (must be in official type list)
- * \param buffer the buffer to put the payload
- * \param length the buffer length
- * \return error type (MME_SUCCESS if success)
- */
-mme_error_t
-mme_init (mme_ctx_t *ctx, const mme_type_t mmtype, unsigned char *buffer, const unsigned int length)
-{
- /* protect from null pointers */
- if (ctx == NULL || buffer == NULL)
- return MME_ERROR_GEN;
-
- ctx->buffer = buffer;
- ctx->mmtype = mmtype;
- ctx->length = length;
- ctx->head = 0;
- ctx->tail = 0;
-
- ctx->status = MME_STATUS_OK;
-
- return MME_SUCCESS;
-}
-
-/**
- * Put data at the end of MME payload. MME data tail and length are updated<br>
- * If there is not enough free place to put data, an error is returned and the remaining free space length is returned.
- *
- * \param ctx MME context where to put data
- * \param data data to put at the end of MME payload
- * \param length length of data to put
- * \param result_length length of data really put
- * \return error type (MME_SUCCESS if success)
- * \return MME_ERROR_NOT_INIT: context not initialized
- * \return MME_ERROR_SPACE: not enough available space
- */
-mme_error_t
-mme_put (mme_ctx_t *ctx, const void *data, unsigned int length, unsigned int *result_length)
-{
- int free = 0;
- int delta = 0;
-
- /* protect from null pointers */
- if (ctx == NULL || data == NULL || result_length == NULL)
- return MME_ERROR_GEN;
- /* check if ctx has been inititalized */
- if (ctx->status == MME_STATUS_INIT)
- return MME_ERROR_NOT_INIT;
-
- free = ctx->length - (ctx->tail - ctx->head);
- if (length > free)
- {
- *result_length = free;
- return MME_ERROR_SPACE;
- }
-
- *result_length = length;
-
- /* make place after payload, if needed */
- if (length > ctx->length - ctx->tail)
- {
- /*
- * *length
- * .---------------^-----------------.
- * |-----------|------------|xxxxxxx|-------------------------|
- * buff head tail ctx->length
- * \________ ________/
- * \/
- * payload
- *
- * we have to shift left our payload for this difference delta marked with 'x'
- * in order for *length bytes to fit in from beginning of the buffer
- */
- delta = length - (ctx->length - ctx->tail);
- memmove ( (unsigned char *)(ctx->buffer + ctx->head - delta), (unsigned char *)(ctx->buffer + ctx->head), ctx->tail - ctx->head );
-
- /* update head and tail pointers (offsets) */
- ctx->head -= delta;
- ctx->tail -= delta;
- }
-
- memcpy ( (unsigned char *)(ctx->buffer + ctx->tail), (unsigned char *)data, length );
- ctx->tail += length;
-
- return MME_SUCCESS;
-}
-
-/**
- * Send fake MME by filling buffer: confirm_ctx->buffer
- *
- * \param ctx MME context to send
- * \param type transaction type
- * \param iface selected communication interface
- * \param dest destination MAC address in binary format (6 bytes)
- * \param confirm_ctx MME context given to put the received MME answer packet. A adapted buffer must have been provided.
- * \return error type (MME_SUCCESS if success)
- * \return MME_ERROR_NOT_INIT: context not initialized
- */
-mme_error_t
-mme_send (mme_ctx_t *ctx, mme_send_type_t type, char *iface, unsigned char *dest, mme_ctx_t *confirm_ctx)
-{
- /* protect from null pointers */
- if (ctx == NULL || confirm_ctx == NULL ||iface == NULL || dest == NULL)
- return MME_ERROR_GEN;
-
- /* check if ctx has been inititalized */
- if (ctx->status == MME_STATUS_INIT)
- return MME_ERROR_NOT_INIT;
-
- confirm_ctx->buffer[0] = 0x00;
- confirm_ctx->buffer[1] = 0x13;
- confirm_ctx->buffer[2] = 0xD7;
- confirm_ctx->buffer[3] = 0x00;
-
- confirm_ctx->tail = ETH_DATA_LEN;
-
- return MME_SUCCESS;
-}
-
/* fixtures - run before and after each unit test */
void
setup (void)
{
- int ret, rc;
+ int ret;
struct stat st;
char buf[256];
/* initialize - delete testing dir if it exists */
if ( (stat (UTESTS_TMP_DIR, &st) == 0) )
{
- rc = system ("rm -r " UTESTS_TMP_DIR);
+ system ("rm -r " UTESTS_TMP_DIR);
}
ret = mkdir (UTESTS_TMP_DIR, 0770);
if (ret < 0 && errno != EEXIST)
@@ -313,7 +150,7 @@ END_TEST
START_TEST (test_libspid_eoc_wl_set)
{
- int ret, rc;
+ int ret;
mac_string_t mac_address;
libspid_eoc_wl_entry_t entry;
@@ -328,8 +165,8 @@ START_TEST (test_libspid_eoc_wl_set)
strcpy (entry.end_time, "20:00");
strcpy (entry.dpw, "MALIKA-2");
- rc = system ("cp " WHITE_LIST_CONF " " UTESTS_TMP_DIR "/etc");
- rc = system ("cp " PORT_CONF " " UTESTS_TMP_DIR "/etc");
+ system ("cp " WHITE_LIST_CONF " " UTESTS_TMP_DIR "/etc");
+ system ("cp " PORT_CONF " " UTESTS_TMP_DIR "/etc");
ret = libspid_eoc_wl_set (mac_address, &entry);
fail_if (ret != LIBSPID_SUCCESS, "libspid_eoc_wl_set fail");
}
@@ -337,14 +174,14 @@ END_TEST
START_TEST (test_libspid_eoc_wl_get)
{
- int ret, rc;
+ int ret;
mac_string_t mac_address;
libspid_eoc_wl_entry_t entry;
memset (&entry, 0, sizeof (entry));
strcpy (mac_address, "00:13:D7:00:00:02");
- rc = system ("cp " WHITE_LIST_CONF " " UTESTS_TMP_DIR "/etc");
+ system ("cp " WHITE_LIST_CONF " " UTESTS_TMP_DIR "/etc");
ret = libspid_eoc_wl_get (mac_address, &entry);
fail_if (ret != LIBSPID_SUCCESS, "libspid_eoc_wl_get return unsuccessful");
@@ -360,7 +197,7 @@ END_TEST
START_TEST (test_libspid_eoc_wl_get_list)
{
- int ret, rc;
+ int ret;
libspid_eoc_wl_entry_t entries[WL_ENTRY_NUM];
int idx;
int count;
@@ -376,7 +213,7 @@ START_TEST (test_libspid_eoc_wl_get_list)
memset (entries, 0, WL_ENTRY_NUM * sizeof (libspid_eoc_wl_entry_t));
- rc = system ("cp " WHITE_LIST_CONF " " UTESTS_TMP_DIR "/etc");
+ system ("cp " WHITE_LIST_CONF " " UTESTS_TMP_DIR "/etc");
ret = libspid_eoc_wl_get_list (entries, &count);
@@ -399,10 +236,10 @@ END_TEST
START_TEST (test_libspid_eoc_wl_remove)
{
mac_string_t mac_address;
- int ret, rc;
+ int ret;
- rc = system ("cp " WHITE_LIST_CONF " " UTESTS_TMP_DIR "/etc");
- rc = system ("cp " PORT_CONF " " UTESTS_TMP_DIR "/etc");
+ system ("cp " WHITE_LIST_CONF " " UTESTS_TMP_DIR "/etc");
+ system ("cp " PORT_CONF " " UTESTS_TMP_DIR "/etc");
strcpy (mac_address, "00:13:D7:00:00:02");
@@ -414,10 +251,10 @@ END_TEST
START_TEST (test_libspid_eoc_wl_flush)
{
- int ret, rc;
+ int ret;
- rc = system ("cp " WHITE_LIST_CONF " " UTESTS_TMP_DIR "/etc");
- rc = system ("cp " PORT_CONF " " UTESTS_TMP_DIR "/etc");
+ system ("cp " WHITE_LIST_CONF " " UTESTS_TMP_DIR "/etc");
+ system ("cp " PORT_CONF " " UTESTS_TMP_DIR "/etc");
ret = libspid_eoc_wl_flush ();
@@ -427,9 +264,9 @@ END_TEST
START_TEST (test_libspid_eoc_wl_sync)
{
- int ret, rc;
+ int ret;
- rc = system ("cp " WHITE_LIST_INFO " " UTESTS_TMP_DIR WHITE_LIST_CONF_SYSTEM);
+ system ("cp " WHITE_LIST_INFO " " UTESTS_TMP_DIR WHITE_LIST_CONF_SYSTEM);
ret = libspid_eoc_wl_sync ();
fail_if (ret != LIBSPID_SUCCESS, "libspid_eoc_wl_sync return is unsuccessful");
@@ -478,9 +315,9 @@ START_TEST (test_libspid_eoc_wl_set_output_level)
char expected_output_level[] = "95";
libspid_eoc_wl_entry_t entries[WL_ENTRY_NUM];
int count = 0;
- int ret, rc, idx;
+ int ret, idx;
- rc = system ("cp " WHITE_LIST_CONF " " UTESTS_TMP_DIR "/etc");
+ system ("cp " WHITE_LIST_CONF " " UTESTS_TMP_DIR "/etc");
libspid_eoc_wl_set_output_level (expected_output_level);
@@ -496,7 +333,7 @@ END_TEST
START_TEST (test_libspid_eoc_wl_mac_change)
{
- int rc = 0, ret = 0, i = 0;
+ int ret = 0, i = 0;
libspid_eoc_wl_entry_t entry;
char index[2];
libspid_eoc_port_entry_t port_entry;
@@ -518,8 +355,8 @@ START_TEST (test_libspid_eoc_wl_mac_change)
char vlan_tag_en[LIBSPID_PORT_PER_SLAVE_MAX][2] = {"1", "0", "1", "0", "1"};
char vlan_mark_id[LIBSPID_PORT_PER_SLAVE_MAX][2] = {"1", "3", "4", "1", "2"};
- rc = system ("cp " WHITE_LIST_CONF " " UTESTS_TMP_DIR "/etc");
- rc = system ("cp " PORT_CONF " " UTESTS_TMP_DIR "/etc");
+ system ("cp " WHITE_LIST_CONF " " UTESTS_TMP_DIR "/etc");
+ system ("cp " PORT_CONF " " UTESTS_TMP_DIR "/etc");
/* change mac_addr[1] to mac_addr[2] */
ret = libspid_eoc_wl_mac_change (mac_addr[0], mac_addr[1]);
diff --git a/cleopatre/devkit/tests/managerd/ftests/Makefile b/cleopatre/devkit/tests/managerd/ftests/Makefile
deleted file mode 100644
index 28399e20d3..0000000000
--- a/cleopatre/devkit/tests/managerd/ftests/Makefile
+++ /dev/null
@@ -1,32 +0,0 @@
-BASE = ../../../..
-
-TEST_DIR = devkit/tests/managerd/ftests
-PRJ_DIR = $(BASE)/application/managerd
-LIBMME_DIR = $(BASE)/application/libmme
-LIBSPID_DIR = $(BASE)/application/libspid
-
-SRCPATH = src
-INCPATH = inc
-OBJPATH = obj
-BOARD_OBJPATH = $(OBJPATH)/board
-
-CC_FOR_BOARD = arm-linux-gcc
-AR_FOR_BOARD = arm-linux-ar
-
-INC = -I$(INCPATH) -I$(PRJ_DIR)/$(INCPATH) -I$(LIBMME_DIR)/$(INCPATH) -I$(LIBSPID_DIR)/$(INCPATH)
-CFLAGS_FOR_BOARD = -D__FTEST_PC__ -Wall $(INC)
-
-all: preall board
-
-preall:
- mkdir -p $(BOARD_OBJPATH)
-
-board: board-prj
-
-clean:
- rm -rf $(OBJPATH)
- $(MAKE) clean -C $(PRJ_DIR)
-
-board-prj:
- $(MAKE) -C $(PRJ_DIR) TEST=y CC_FOR_TEST=$(CC_FOR_BOARD) CFLAGS_FOR_TEST=$(CFLAGS_FOR_BOARD) AR_FOR_TEST=$(AR_FOR_BOARD) OBJPATH_FOR_TEST=$(TEST_DIR)/$(BOARD_OBJPATH)
-
diff --git a/cleopatre/devkit/tests/managerd/utests/Makefile b/cleopatre/devkit/tests/managerd/utests/Makefile
index a0a9aaf64e..8e02157bab 100644
--- a/cleopatre/devkit/tests/managerd/utests/Makefile
+++ b/cleopatre/devkit/tests/managerd/utests/Makefile
@@ -1,94 +1,36 @@
-TEST_NAME = utests
+BASE = ../../../../../cesar
+CLEO_BASE = ../cleopatre
-OBJPATH = obj
-PRJ_OBJPATH = $(OBJPATH)/prj
-TEST_OBJPATH = $(OBJPATH)/test
-LIBSPID_OBJPATH = $(OBJPATH)/libspid
-STUB_OBJPATH = $(OBJPATH)/stub
-LIBMME_STUB_OBJPATH = $(STUB_OBJPATH)/libmme
-LIBSPID_STUB_OBJPATH = $(STUB_OBJPATH)/libspid
+LINUX_PATH = $(CLEO_BASE)/linux-2.6.25.10-spc300
-BASE = ../../../..
+# We test managerd.
+PROJECT_DIR = $(CLEO_BASE)/application/managerd
-PRJ_DIR = $(BASE)/application/managerd
-LIBMME_DIR = $(BASE)/application/libmme
-LIBSPID_DIR = $(BASE)/application/libspid
-STUB_DIR = $(BASE)/devkit/tests/stub
-LIBMME_STUB_DIR = $(STUB_DIR)/libmme
-LIBSPID_STUB_DIR = $(STUB_DIR)/libspid
-LINUX_DIR = $(BASE)/linux-2.6.25.10-spc300
+LIBMME_BASE = $(CLEO_BASE)/application/libmme
+LIBSPID_BASE = $(CLEO_BASE)/application/libspid
+OVERRIDE_BASE = $(CLEO_BASE)/devkit/tests/managerd/utests/override
-SRCPATH = ./src
-INCPATH = ./inc
+INCLUDES = $(PROJECT_DIR)/inc $(LINUX_PATH)/include/asm-arm/arch-spc300 \
+ $(LIBMME_BASE)/inc $(LIBSPID_BASE)/inc $(LINUX_PATH)/include \
+ $(OVERRIDE_BASE)/inc
-FILES = vs_eoc_mme vs_mme
-
-INCLUDES = -I$(LINUX_DIR)/include -I$(LINUX_DIR)/include/asm-arm/arch-spc300 -I$(INCPATH) -I$(PRJ_DIR)/$(INCPATH) \
--I$(LIBMME_DIR)/$(INCPATH) -I$(LIBSPID_DIR)/$(INCPATH) -I$(LIBSPID_STUB_DIR)/$(INCPATH) \
--I$(LIBMME_STUB_DIR)/$(INCPATH)
-
-BINS = $(foreach file, $(FILES), $(OBJPATH)/$(file).elf)
+EXTRA_HOST_LDLIBS = -lcheck -lpthread
EXTRA_CFLAGS = -MMD
-CC = gcc
-CFLAGS = -Wall -g -D__UTESTS__ -D__MANAGERD__ $(EXTRA_CFLAGS) $(INCLUDES)
-LDFLAGS =
-LIBS = -lcheck -lpthread
-
-all: preall $(BINS)
-
-clean:
- rm -rf $(TEST_OBJPATH)
- rm -rf $(PRJ_OBJPATH)
- rm -rf $(LIB_STUB_OBJPATH)
- rm -rf $(OBJPATH)
-
-preall:
- mkdir -p $(PRJ_OBJPATH)
- mkdir -p $(TEST_OBJPATH)
- mkdir -p $(LIBSPID_OBJPATH)
- mkdir -p $(LIBMME_STUB_OBJPATH)
- mkdir -p $(LIBSPID_STUB_OBJPATH)
-
-.PHONY: all clean
-.PRECIOUS: $(PRJ_OBJPATH)/%.o $(TEST_OBJPATH)/%.o $(LIBSPID_OBJPATH)/%.o \
-$(LIBMME_STUB_OBJPATH)/mme.o $(LIBSPID_STUB_OBJPATH)/system.o $(LIBSPID_STUB_OBJPATH)/image.o $(LIBSPID_STUB_OBJPATH)/upgrade_eoc.o \
-$(LIBSPID_OBJPATH)/misc.o $(LIBSPID_OBJPATH)/config_item.o $(LIBSPID_OBJPATH)/network.o $(LIBSPID_OBJPATH)/config_line.o $(LIBSPID_OBJPATH)/openssl_md5.o
-
-$(OBJPATH)/%.elf: $(PRJ_OBJPATH)/%.o $(TEST_OBJPATH)/%_$(TEST_NAME).o \
-$(LIBMME_STUB_OBJPATH)/mme.o $(LIBSPID_STUB_OBJPATH)/system.o $(LIBSPID_STUB_OBJPATH)/image.o $(LIBSPID_STUB_OBJPATH)/upgrade_eoc.o \
-$(LIBSPID_OBJPATH)/misc.o $(LIBSPID_OBJPATH)/config_item.o $(LIBSPID_OBJPATH)/network.o $(LIBSPID_OBJPATH)/config_line.o $(LIBSPID_OBJPATH)/openssl_md5.o
- $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
-
-$(TEST_OBJPATH)/%.o: $(SRCPATH)/%.c
- $(CC) $(CFLAGS) -c -o $@ $<
-
-$(PRJ_OBJPATH)/%.o: $(PRJ_DIR)/$(SRCPATH)/%.c
- $(CC) $(CFLAGS) -c -o $@ $<
-
-$(LIBMME_STUB_OBJPATH)/mme.o: $(LIBMME_STUB_DIR)/$(SRCPATH)/mme.c
- $(CC) $(CFLAGS) -c -o $@ $<
-
-$(LIBSPID_OBJPATH)/network.o: $(LIBSPID_DIR)/$(SRCPATH)/network.c
- $(CC) $(CFLAGS) -c -o $@ $<
-$(LIBSPID_STUB_OBJPATH)/system.o: $(LIBSPID_STUB_DIR)/$(SRCPATH)/system.c
- $(CC) $(CFLAGS) -c -o $@ $<
+MANAGERD_MODE = 0
+DEFS = -D__UTESTS__ -DMANAGERD_MODE=$(MANAGERD_MODE)
-$(LIBSPID_STUB_OBJPATH)/image.o: $(LIBSPID_STUB_DIR)/$(SRCPATH)/image.c
- $(CC) $(CFLAGS) -c -o $@ $<
+HOST_PROGRAMS = vs_mme_utests vs_eoc_mme_utests
-$(LIBSPID_STUB_OBJPATH)/upgrade_eoc.o: $(LIBSPID_STUB_DIR)/$(SRCPATH)/upgrade_eoc.c
- $(CC) $(CFLAGS) -c -o $@ $<
+vs_mme_utests_SOURCES = vs_mme_utests.c
+vs_mme_utests_MODULES = $(PROJECT_DIR) $(OVERRIDE_BASE)
-$(LIBSPID_OBJPATH)/config_item.o: $(LIBSPID_DIR)/$(SRCPATH)/config_item.c
- $(CC) $(CFLAGS) -c -o $@ $<
+vs_eoc_mme_utests_SOURCES = vs_eoc_mme_utests.c
+vs_eoc_mme_utests_MODULES = $(PROJECT_DIR) $(OVERRIDE_BASE)
-$(LIBSPID_OBJPATH)/config_line.o: $(LIBSPID_DIR)/$(SRCPATH)/config_line.c
- $(CC) $(CFLAGS) -c -o $@ $<
+.._cleopatre_application_managerd_MODULE_SOURCES = bridge.c mme_nl.c vs_mme.c \
+ vs_eoc_mme.c js_eoc_mme.c
-$(LIBSPID_OBJPATH)/misc.o: $(LIBSPID_DIR)/$(SRCPATH)/misc.c
- $(CC) $(CFLAGS) -c -o $@ $<
+include $(BASE)/common/make/top.mk
-$(LIBSPID_OBJPATH)/openssl_md5.o: $(LIBSPID_DIR)/$(SRCPATH)/openssl_md5.c
- $(CC) $(CFLAGS) -c -o $@ $<
diff --git a/cleopatre/devkit/tests/managerd/utests/override/Module b/cleopatre/devkit/tests/managerd/utests/override/Module
new file mode 100644
index 0000000000..8b45b59efe
--- /dev/null
+++ b/cleopatre/devkit/tests/managerd/utests/override/Module
@@ -0,0 +1 @@
+SOURCES := libspid_stub.c libmme_stub.c misc_stub.c
diff --git a/cleopatre/devkit/tests/managerd/utests/override/inc/stub.h b/cleopatre/devkit/tests/managerd/utests/override/inc/stub.h
new file mode 100644
index 0000000000..5066b2d254
--- /dev/null
+++ b/cleopatre/devkit/tests/managerd/utests/override/inc/stub.h
@@ -0,0 +1,46 @@
+#ifndef override_inc_stub_h
+#define override_inc_stub_h
+/* Cleopatre project {{{
+ *
+ * Copyright (C) 2011 SPiDCOM Technologies
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file override/inc/stub.h
+ * \brief datas for stub and tests sources
+ * \ingroup Cleopatre - managerd
+ */
+
+#include <setjmp.h>
+
+#define IMAGE_DESC_VERSION "utest_mme"
+#define PLC_FIRMWARE_VERSION "0.1-rc3-1-unit_test"
+
+#define PLC_VERSION_FILE "testfiles/plc_version"
+#define NET_DEV_FILE "testfiles/net_dev"
+
+#define BR_MAC_ADDR "\x00\x13\xd7\x00\x00\x10"
+
+#define MAX_ITEM_NB 8
+#define CONF_TABLE_INDEX 0
+#define INFO_TABLE_INDEX 1
+
+enum test_id_en {
+ TEST_GET_VERSION = 0,
+ TEST_ETH_STATS,
+ TEST_GET_DEVICE_INFO,
+ TEST_NB
+};
+extern enum test_id_en test_id;
+
+struct check_ctx_st {
+ int assert_id;
+ int test_id;
+ jmp_buf jmp_env;
+
+};
+extern struct check_ctx_st check_ctx;
+
+#endif /* override_inc_stub_h */
diff --git a/cleopatre/devkit/tests/managerd/utests/override/src/libmme_stub.c b/cleopatre/devkit/tests/managerd/utests/override/src/libmme_stub.c
new file mode 100644
index 0000000000..fc7cb96302
--- /dev/null
+++ b/cleopatre/devkit/tests/managerd/utests/override/src/libmme_stub.c
@@ -0,0 +1,340 @@
+/* Cleopatre project {{{
+ *
+ * Copyright (C) 2011 SPiDCOM Technologies
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file override/src/libmme_stub.c
+ * \brief Stub for some libmme functions used in libspid
+ * \ingroup Cleopatre - managerd
+ */
+
+#include <string.h>
+#include "libmme.h"
+#include "libspid.h"
+
+static unsigned int seq_cnt = 1;
+
+mme_error_t mme_init (mme_ctx_t *ctx, const mme_type_t mmtype, unsigned char *buffer, const unsigned int length)
+{
+ /* protect from null pointers */
+ if (ctx == NULL || buffer == NULL)
+ return MME_ERROR_GEN;
+
+ ctx->buffer = buffer;
+ ctx->mmtype = mmtype;
+ ctx->length = length;
+ ctx->head = 0;
+ ctx->tail = 0;
+ ctx->status = MME_STATUS_OK;
+ return MME_SUCCESS;
+}
+
+mme_error_t mme_push (mme_ctx_t *ctx, const void *data, unsigned int length, unsigned int *result_length)
+{
+ return MME_SUCCESS;
+}
+
+mme_error_t mme_pull (mme_ctx_t *ctx, void *data, unsigned int length, unsigned int *result_length)
+{
+ /* protect from null pointers */
+ if (ctx == NULL || data == NULL || result_length == NULL)
+ return MME_ERROR_GEN;
+ /* check if ctx has been inititalized */
+ if (ctx->status == MME_STATUS_INIT)
+ return MME_ERROR_NOT_INIT;
+
+ /* check if it is demanded more data than we have in payload */
+ if (length > ctx->tail - ctx->head)
+ {
+ *result_length = ctx->tail - ctx->head;
+ return MME_ERROR_ENOUGH;
+ }
+
+ *result_length = length;
+ memcpy(data, (unsigned char *)(ctx->buffer + ctx->head), length);
+ ctx->head += length;
+ return MME_SUCCESS;
+}
+
+mme_error_t mme_put (mme_ctx_t *ctx, const void *data, unsigned int length, unsigned int *result_length)
+{
+ unsigned int free = 0;
+ int delta = 0;
+
+ /* protect from null pointers */
+ if (ctx == NULL || data == NULL || result_length == NULL)
+ return MME_ERROR_GEN;
+ /* check if ctx has been inititalized */
+ if (ctx->status == MME_STATUS_INIT)
+ return MME_ERROR_NOT_INIT;
+
+ free = ctx->length - (ctx->tail - ctx->head);
+ if (length > free)
+ {
+ *result_length = free;
+ return MME_ERROR_SPACE;
+ }
+
+ /* make place after payload, if needed */
+ if (length > ctx->length - ctx->tail)
+ {
+ /*
+ * *length
+ * .---------------^-----------------.
+ * |-----------|------------|xxxxxxx|-------------------------|
+ * buff head tail ctx->length
+ * \________ ________/
+ * \/
+ * payload
+ *
+ * we have to shift left our payload for this difference delta marked with 'x'
+ * in order for *length bytes to fit in from beginning of the buffer
+ */
+ delta = length - (ctx->length - ctx->tail);
+ memmove ( (unsigned char *)(ctx->buffer + ctx->head - delta), (unsigned char *)(ctx->buffer + ctx->head), ctx->tail - ctx->head );
+
+ /* update head and tail pointers (offsets) */
+ ctx->head -= delta;
+ ctx->tail -= delta;
+ }
+
+ *result_length = length;
+ memcpy( (unsigned char *)(ctx->buffer + ctx->tail), (unsigned char *)data, length );
+ ctx->tail += length;
+ return MME_SUCCESS;
+}
+
+mme_error_t
+mme_send (mme_ctx_t *ctx, mme_send_type_t type, char *iface, unsigned char *dest,
+ mme_ctx_t *confirm_ctx)
+{
+ libspid_eoc_snr_entry_t snr;
+ libspid_eoc_tonemap_entry_t tonemap;
+
+ snr.int_id = 0;
+ snr.int_length = 1;
+ snr.tm_ber = 789;
+
+ /* result */
+ unsigned char result = 0;
+
+ /* protect from null pointers */
+ if (ctx == NULL || confirm_ctx == NULL || dest == NULL)
+ return MME_ERROR_GEN;
+
+ /* check if ctx has been inititalized */
+ if (ctx->status == MME_STATUS_INIT)
+ return MME_ERROR_NOT_INIT;
+
+ confirm_ctx->buffer[0] = 0x00;
+ if ((ctx->mmtype >> 12) == 0xA)
+ {
+ confirm_ctx->buffer[1] = 0x13;
+ confirm_ctx->buffer[2] = 0xD7;
+ confirm_ctx->buffer[3] = 0x00;
+ }
+
+ if (ctx->mmtype == (MME_TYPE_VS_EOC_REAL_TIME_STATISTICS | MME_TYPE_REQ))
+ {
+ if (memcmp (dest, "\x00\x11\x22\x33\x44\xaa", LIBSPID_MAC_BIN_LEN) == 0)
+ confirm_ctx->buffer[3] = 0;
+ if (memcmp (dest, "\x00\x11\x22\x33\x44\xbb", LIBSPID_MAC_BIN_LEN) == 0)
+ confirm_ctx->buffer[3] = 1;
+ if (memcmp (dest, "\x00\x11\x22\x33\x44\xcc", LIBSPID_MAC_BIN_LEN) == 0)
+ return MME_ERROR_GEN;
+ if (memcmp (dest, "\x00\x11\x22\x33\x44\xdd", LIBSPID_MAC_BIN_LEN) == 0)
+ {
+ confirm_ctx->buffer[4] = 0x0;
+ confirm_ctx->buffer[5] = 0x3;
+ confirm_ctx->buffer[6] = 0x55;
+ confirm_ctx->buffer[7] = 0x17;
+ }
+ }
+ if (ctx->mmtype == (MME_TYPE_VS_UPDATE_START | MME_TYPE_REQ))
+ {
+ seq_cnt = 0;
+ if (memcmp(dest, "\x00\x11\x22\x33\x44\x66", LIBSPID_MAC_BIN_LEN) == 0)
+ confirm_ctx->buffer[3] = LIBSPID_UPDATE_START_VERSION_OK;
+ else if(memcmp(dest, "\x00\x11\x22\x33\x44\x77", LIBSPID_MAC_BIN_LEN) == 0)
+ confirm_ctx->buffer[3] = LIBSPID_UPDATE_START_BAD_ARCH;
+ else if(memcmp(dest, "\x00\x11\x22\x33\x44\x88", LIBSPID_MAC_BIN_LEN) == 0)
+ confirm_ctx->buffer[3] = LIBSPID_UPDATE_START_BAD_TYPE;
+ else if(memcmp(dest, "\x00\x11\x22\x33\x44\x99", LIBSPID_MAC_BIN_LEN) == 0)
+ confirm_ctx->buffer[3] = LIBSPID_UPDATE_START_MODEM_BUSY;
+ else
+ confirm_ctx->buffer[3] = LIBSPID_UPDATE_START_SUCCESS;
+ }
+ if (ctx->mmtype == (MME_TYPE_VS_UPDATE_TRANSFER | MME_TYPE_REQ))
+ {
+ seq_cnt++;
+ if (memcmp(dest, "\x00\x11\x22\x33\x44\xbb", LIBSPID_MAC_BIN_LEN) == 0)
+ confirm_ctx->buffer[3] = LIBSPID_UPDATE_TRANSFER_FAILED;
+ else
+ {
+ confirm_ctx->buffer[3] = LIBSPID_UPDATE_TRANSFER_SUCCESS;
+ confirm_ctx->buffer[4] = (seq_cnt >> 0) & 0xFF;
+ confirm_ctx->buffer[5] = (seq_cnt >> 8) & 0xFF;
+ confirm_ctx->buffer[6] = (seq_cnt >> 16) & 0xFF;
+ confirm_ctx->buffer[7] = (seq_cnt >> 24) & 0xFF;
+ }
+ }
+ if (ctx->mmtype == (MME_TYPE_VS_UPDATE_END | MME_TYPE_REQ))
+ {
+ if (memcmp(dest, "\x00\x11\x22\x33\x44\xdd", LIBSPID_MAC_BIN_LEN) == 0)
+ confirm_ctx->buffer[3] = LIBSPID_UPDATE_END_MD5_ERROR;
+ else
+ confirm_ctx->buffer[3] = LIBSPID_UPDATE_END_SUCCESS;
+ }
+ if (ctx->mmtype == (MME_TYPE_VS_EOC_AUTOCONF_START | MME_TYPE_REQ))
+ {
+ seq_cnt = 0;
+ if (memcmp(dest, "\x00\x11\x22\x33\x44\x66", LIBSPID_MAC_BIN_LEN) == 0)
+ confirm_ctx->buffer[3] = LIBSPID_EOC_AUTOCONF_START_MODEM_BUSY;
+ else if (memcmp(dest, "\x00\x11\x22\x33\x44\x77", LIBSPID_MAC_BIN_LEN) == 0)
+ confirm_ctx->buffer[3] = LIBSPID_EOC_AUTOCONF_START_BAD_PROTOCOL;
+ else if (memcmp(dest, "\x00\x11\x22\x33\x44\x88", LIBSPID_MAC_BIN_LEN) == 0)
+ confirm_ctx->buffer[3] = LIBSPID_EOC_AUTOCONF_START_FAILED;
+ else if (memcmp(dest, "\x00\x11\x22\x33\x44\xcc", LIBSPID_MAC_BIN_LEN) == 0)
+ confirm_ctx->buffer[3] = LIBSPID_EOC_AUTOCONF_START_CONFIG_EXIST;
+ else
+ confirm_ctx->buffer[3] = LIBSPID_EOC_AUTOCONF_START_SUCCESS;
+ }
+ if (ctx->mmtype == (MME_TYPE_VS_EOC_AUTOCONF_TRANSFER | MME_TYPE_REQ))
+ {
+ seq_cnt++;
+ if (memcmp (dest, "\x00\x11\x22\x33\x44\x99", LIBSPID_MAC_BIN_LEN) == 0)
+ confirm_ctx->buffer[3] = LIBSPID_EOC_AUTOCONF_TRANSFER_FAILED;
+ else
+ {
+ confirm_ctx->buffer[3] = LIBSPID_EOC_AUTOCONF_TRANSFER_SUCCESS;
+ confirm_ctx->buffer[4] = (seq_cnt >> 0) & 0xFF;
+ confirm_ctx->buffer[5] = (seq_cnt >> 8) & 0xFF;
+ confirm_ctx->buffer[6] = (seq_cnt >> 16) & 0xFF;
+ confirm_ctx->buffer[7] = (seq_cnt >> 24) & 0xFF;
+ }
+ }
+ if (ctx->mmtype == (MME_TYPE_VS_EOC_AUTOCONF_END | MME_TYPE_REQ))
+ {
+ if (memcmp (dest, "\x00\x11\x22\x33\x44\xbb", LIBSPID_MAC_BIN_LEN) == 0)
+ confirm_ctx->buffer[3] = LIBSPID_EOC_AUTOCONF_END_MD5_ERROR;
+ else if (memcmp (dest, "\x00\x11\x22\x33\x44\xaa", LIBSPID_MAC_BIN_LEN) == 0)
+ confirm_ctx->buffer[3] = LIBSPID_EOC_AUTOCONF_END_FAILED;
+ else
+ confirm_ctx->buffer[3] = LIBSPID_EOC_AUTOCONF_END_SUCCESS;
+ }
+ if (ctx->mmtype == (MME_TYPE_VS_GET_SNR | MME_TYPE_REQ))
+ {
+ snr.carrier_group = ctx->buffer[11];
+
+ confirm_ctx->buffer[0] = 0x00;
+ confirm_ctx->buffer[1] = 0x13;
+ confirm_ctx->buffer[2] = 0xD7;
+
+ confirm_ctx->buffer[3] = result;
+ confirm_ctx->buffer[4] = snr.int_id;
+ confirm_ctx->buffer[5] = snr.int_length;
+ snr.int_et[0] = 537;
+ memcpy(&confirm_ctx->buffer[6], &snr.int_et[0], 2);
+ memcpy(&confirm_ctx->buffer[8], &snr.tm_ber, 2);
+
+ confirm_ctx->buffer[10] = snr.carrier_group;
+
+ snr.snr_list[5] = 203;
+ memcpy(&confirm_ctx->buffer[11], snr.snr_list, LIBSPID_EOC_SNR_LIST_MAX_SIZE);
+
+ }
+ if (ctx->mmtype == (MME_TYPE_VS_GET_TONEMAP | MME_TYPE_REQ))
+ {
+ confirm_ctx->buffer[0] = 0x00;
+ confirm_ctx->buffer[1] = 0x13;
+ confirm_ctx->buffer[2] = 0xD7;
+
+ if (ctx->buffer[9] == 255)
+ {
+ confirm_ctx->buffer[3] = result;
+ tonemap.int_id = 35;
+ confirm_ctx->buffer[8] = tonemap.int_id;
+ }
+ else
+ {
+ confirm_ctx->buffer[3] = result;
+
+ tonemap.int_id = 35;
+ confirm_ctx->buffer[8] = tonemap.int_id;
+
+ tonemap.tmi_default = 3;
+ confirm_ctx->buffer[9] = tonemap.tmi_default;
+
+ tonemap.tmi_length = 1;
+ confirm_ctx->buffer[10] = tonemap.tmi_length;
+
+ tonemap.tmi_data[0] = 67;
+ confirm_ctx->buffer[11] = tonemap.tmi_data[0];
+
+ tonemap.int_length = 1;
+ confirm_ctx->buffer[12] = tonemap.int_length;
+
+ tonemap.int_et[0] = 633;
+ memcpy(&confirm_ctx->buffer[13], &tonemap.int_et[0], 2);
+
+ tonemap.int_tmi[0] = 56;
+ confirm_ctx->buffer[15] = tonemap.int_tmi[0];
+
+ tonemap.tmi = 3;
+ confirm_ctx->buffer[16] = tonemap.tmi;
+
+ tonemap.tm_fec = 7;
+ confirm_ctx->buffer[17] = tonemap.tm_fec;
+
+ tonemap.tm_gi = 5;
+ confirm_ctx->buffer[18] = tonemap.tm_gi;
+
+ tonemap.modulation_list[3] = 31;
+ memcpy(&confirm_ctx->buffer[19], tonemap.modulation_list, LIBSPID_EOC_MODULATION_LIST_MAX_SIZE);
+ }
+ }
+
+ confirm_ctx->tail = ETH_DATA_LEN;
+
+ return MME_SUCCESS;
+}
+
+mme_error_t
+mme_listen (mme_ctx_t *ctx, char *iface, unsigned char *source,
+ mme_listen_cb_t listen_cb, unsigned int tout)
+{
+ unsigned int result_len;
+ char data[4];
+
+ /* protect from null pointers */
+ if (ctx == NULL || iface == NULL || source == NULL) return MME_ERROR_GEN;
+ /* check if ctx has been inititalized */
+ if (ctx->status == MME_STATUS_INIT) return MME_ERROR_NOT_INIT;
+
+ data[0] = 0x00;
+ data[1] = 0x13;
+ data[2] = 0xD7;
+
+ if (ctx->mmtype == (MME_TYPE_VS_UPDATE_END | MME_TYPE_IND))
+ {
+ if (memcmp(source, "\x00\x11\x22\x33\x44\xee", LIBSPID_MAC_BIN_LEN) == 0)
+ data[3] = LIBSPID_UPDATE_END_FLASH_ERROR;
+ else
+ data[3] = LIBSPID_UPDATE_END_SUCCESS;
+ }
+ else if (ctx->mmtype == (MME_TYPE_VS_UPDATE_TRANSFER | MME_TYPE_IND))
+ {
+ if (memcmp(source, "\x00\x11\x22\x33\x44\xee", LIBSPID_MAC_BIN_LEN) == 0)
+ data[3] = LIBSPID_UPDATE_TRANSFER_FAILED;
+ else
+ data[3] = LIBSPID_UPDATE_TRANSFER_SUCCESS;
+ }
+
+ mme_put(ctx, data, 4, &result_len);
+
+ return MME_SUCCESS;
+}
+
diff --git a/cleopatre/devkit/tests/managerd/utests/override/src/libspid_stub.c b/cleopatre/devkit/tests/managerd/utests/override/src/libspid_stub.c
new file mode 100644
index 0000000000..5c695777ca
--- /dev/null
+++ b/cleopatre/devkit/tests/managerd/utests/override/src/libspid_stub.c
@@ -0,0 +1,219 @@
+/* SPC300-eoc bundle {{{
+ *
+ * Copyright (C) 2009 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file devkit/tests/onlined/utests/override/src/libspid_stub.c
+ * \brief Stub functions for some libspid functions used in onlined daemon
+ * \ingroup onlined
+ *
+ * Functions definition
+ */
+#include <check.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <linux/if_ether.h>
+#include <fcntl.h>
+#include "path.h"
+#include "libspid.h"
+
+#include "stub.h"
+
+static int test_nr;
+
+static char label_table[2][MAX_ITEM_NB][64];
+static char value_table[2][MAX_ITEM_NB][64];
+
+/**
+ * Get the NVRAM content.
+ *
+ * \return error type (LIBSPID_SUCCESS if success)
+ * \return LIBSPID_ERROR_PARAM: bad input parameters
+ * \return LIBSPID_ERROR_NOT_FOUND: key not found or no more
+ * line to read
+ * \return LIBSPID_ERROR_SYSTEM: system error, see errno
+ */
+libspid_error_t libspid_system_get_nvram(spc300_nvram_t *nvram)
+{
+ if (nvram == NULL)
+ return LIBSPID_ERROR_PARAM;
+
+ // correct response
+ if ((test_nr == 0) || (test_nr == 2))
+ {
+ strcpy(nvram->product_name, "SPiDCOMmodem1Test");
+ nvram->img_0_offset = 4;
+ nvram->eth_port_nb = 4;
+ }
+ // returns LIBSPID_ERROR_SYSTEM
+ else if (test_nr == 1)
+ {
+ test_nr++;
+ return LIBSPID_ERROR_SYSTEM;
+ }
+ else{}
+
+ return LIBSPID_SUCCESS;
+}
+
+void libspid_system_reboot(void)
+{
+}
+
+libspid_error_t
+libspid_image_get_index (const char *mtd_path, int *index)
+{
+ *index = 0;
+ return LIBSPID_SUCCESS;
+}
+
+libspid_error_t libspid_config_read_item (const char *filename, const char *label, char *value, int buffer_len)
+{
+ int i, conf;
+ conf = (!strcmp (filename, "conf") ? CONF_TABLE_INDEX : INFO_TABLE_INDEX);
+ for(i = 0; i < MAX_ITEM_NB; i++)
+ {
+ if(!strcmp (label, label_table[conf][i]))
+ {
+ strcpy (value, value_table[conf][i]);
+ return LIBSPID_SUCCESS;
+ }
+ }
+ return LIBSPID_ERROR_NOT_FOUND;
+}
+
+libspid_error_t libspid_config_write_item(const char *filename, const char *label, const char *value)
+{
+ int i, conf;
+ conf = (!strcmp (filename, "conf") ? CONF_TABLE_INDEX : INFO_TABLE_INDEX);
+ for (i = 0; i < MAX_ITEM_NB; i++)
+ {
+ if(label_table[conf][i][0] == '\0')
+ break;
+ if(!strcmp (label_table[conf][i], label))
+ {
+ strcpy (value_table[conf][i], value);
+ return LIBSPID_SUCCESS;
+ }
+ }
+ if(i >= MAX_ITEM_NB)
+ return LIBSPID_ERROR_NO_SPACE;
+ strcpy (label_table[conf][i], label);
+ strcpy (value_table[conf][i], value);
+ return LIBSPID_SUCCESS;
+}
+
+libspid_error_t libspid_system_save_file(const char *filename)
+{
+ return LIBSPID_SUCCESS;
+}
+
+libspid_error_t libspid_image_get_desc(libspid_image_desc_type_t type, spidcom_image_desc_t *image_desc, char *mtd_name)
+{
+ memset (image_desc, '\0', sizeof(spidcom_image_desc_t));
+ strcpy (image_desc->version, IMAGE_DESC_VERSION);
+
+ return LIBSPID_SUCCESS;
+}
+
+libspid_error_t
+libspid_eoc_upgrade_local_image (char *file)
+{
+ return LIBSPID_SUCCESS;
+}
+
+libspid_error_t
+libspid_image_select (libspid_image_select_t select)
+{
+ return LIBSPID_SUCCESS;
+}
+
+libspid_error_t
+libspid_image_get_running_version (char *image_version)
+{
+ memset (image_version, '\0', LIBSPID_IMAGE_VERSION_STR_MAX_LEN);
+ strcpy (image_version, IMAGE_DESC_VERSION);
+
+ return LIBSPID_SUCCESS;
+}
+
+libspid_error_t
+libspid_mac_bin_to_str (const unsigned char *bin, char *str)
+{
+ return LIBSPID_SUCCESS;
+}
+
+libspid_error_t
+libspid_system_file_update_warn (pid_t tx_pid, const char *filename)
+{
+ return LIBSPID_SUCCESS;
+}
+
+int
+MD5_Init (MD5_CTX *c)
+{
+ return 0;
+}
+
+int
+MD5_Update (MD5_CTX *c, const void *data, size_t len)
+{
+ return 0;
+}
+
+int
+MD5_Final (unsigned char *md, MD5_CTX *c)
+{
+ return 0;
+}
+
+libspid_error_t
+libspid_config_read_line (const char *filename, const char* delimiters,
+ char *key, unsigned int *elt_number, char *elt[],
+ char *buffer, unsigned int buffer_len)
+{
+ return LIBSPID_SUCCESS;
+}
+
+libspid_error_t
+libspid_config_write_line (const char *filename, const char delimiter,
+ const char *key, unsigned int elt_number, char *elt[])
+{
+ return LIBSPID_SUCCESS;
+}
+
+libspid_error_t
+libspid_network_get_ip (const char *interface, libspid_ip_t *ip)
+{
+ return LIBSPID_SUCCESS;
+}
+
+libspid_error_t
+libspid_ip_str_to_bin (const char *str, unsigned char *bin)
+{
+ return LIBSPID_SUCCESS;
+}
+
+libspid_error_t
+libspid_ip_bin_to_str (const unsigned char *bin, char *str)
+{
+ return LIBSPID_SUCCESS;
+}
+
+libspid_error_t
+libspid_network_set_ip (const char *interface, const libspid_ip_t *ip)
+{
+ return LIBSPID_SUCCESS;
+}
+
+/* as each unit test is independant, you should not have a common
+ * test_nb variable between all test files but stub this function for
+ * each test file
+ */
diff --git a/cleopatre/devkit/tests/managerd/utests/override/src/misc_stub.c b/cleopatre/devkit/tests/managerd/utests/override/src/misc_stub.c
new file mode 100644
index 0000000000..dfae7cdea0
--- /dev/null
+++ b/cleopatre/devkit/tests/managerd/utests/override/src/misc_stub.c
@@ -0,0 +1,43 @@
+/* Cleopatre project {{{
+ *
+ * Copyright (C) 2011 SPiDCOM Technologies
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file override/src/misc_stub.c
+ * \brief Stub for some Linux functions
+ * \ingroup Cleopatre - managerd
+ */
+
+#include <stdio.h>
+#include <fcntl.h>
+#include <setjmp.h>
+#include "stub.h"
+
+static int test_fd;
+
+void __assert_fail (__const char *__assertion, __const char *__file,
+ unsigned int __line, __const char *__function)
+{
+ check_ctx.assert_id = check_ctx.test_id;
+ longjmp (check_ctx.jmp_env, check_ctx.assert_id);
+}
+
+FILE *fopen (const char *path, const char *mode)
+{
+ switch(test_id)
+ {
+ case TEST_GET_VERSION:
+ test_fd = open (PLC_VERSION_FILE, O_RDONLY);
+ break;
+ case TEST_ETH_STATS:
+ test_fd = open (NET_DEV_FILE, O_RDONLY);
+ break;
+ default:
+ return NULL;
+ }
+ return fdopen (test_fd, "r");
+}
+
diff --git a/cleopatre/devkit/tests/managerd/utests/src/vs_eoc_mme_utests.c b/cleopatre/devkit/tests/managerd/utests/src/vs_eoc_mme_utests.c
index 4402a524ff..e312049011 100644
--- a/cleopatre/devkit/tests/managerd/utests/src/vs_eoc_mme_utests.c
+++ b/cleopatre/devkit/tests/managerd/utests/src/vs_eoc_mme_utests.c
@@ -27,21 +27,14 @@
#include "vs_eoc_mme.h"
#include "vs_mme.h"
+#include "stub.h"
+
#define BR_MAC_ADDR "\x00\x13\xd7\x00\x00\x10"
#define LOCAL_SLAVE_CONF_FILE "testfiles/slave.conf"
-static struct check_ctx {
- int assert_id;
- int test_id;
- jmp_buf jmp_env;
-
-} check_ctx;
-
-enum test_id {
- TEST_GET_DEVICE_INFO = 0
-};
+struct check_ctx_st check_ctx;
-enum test_id test_id;
+enum test_id_en test_id;
struct managerd_ctx ctx;
struct managerd_ctx *pctx = &ctx;
@@ -53,25 +46,6 @@ static char confirm_buffer[1518];
static MME_t *request = (MME_t *)request_buffer;
static MME_t *confirm = (MME_t *)confirm_buffer;
-
-/*
-######################################
-# FUNCTION STUB
-# (redefinition of libc functions)
-######################################
-*/
-void __assert_fail (__const char *__assertion, __const char *__file,
- unsigned int __line, __const char *__function)
-{
- check_ctx.assert_id = check_ctx.test_id;
- longjmp (check_ctx.jmp_env, check_ctx.assert_id);
-}
-
-int bridge_send(struct managerd_ctx *ctx, uint8_t *buffer, int len)
-{
- return 0;
-}
-
/* fixtures - run before and after each unit test */
void setup(void)
{
@@ -144,14 +118,12 @@ START_TEST (test_get_device_info_success)
vs_eoc_get_device_info_cnf_t *get_device_info_cnf;
char model_no[64] = "SPiDCOMmodem1Test";
unsigned int eth_port_nb = 4;
- char sw_version[16] = "eoc-alpha0-test";
char downstream_attenuation = 0;
- int rc;
test_id = TEST_GET_DEVICE_INFO;
- rc = system ("mkdir -p /tmp/utests/etc");
- rc = system ("cp " LOCAL_SLAVE_CONF_FILE " " LIBSPID_CONF_ROOT_PATH);
+ system ("mkdir -p /tmp/utests/etc");
+ system ("cp " LOCAL_SLAVE_CONF_FILE " " LIBSPID_CONF_ROOT_PATH);
get_device_info_cnf = (vs_eoc_get_device_info_cnf_t *)((unsigned char*)confirm + sizeof(MME_t));
/* fill request */
@@ -171,7 +143,7 @@ START_TEST (test_get_device_info_success)
fail_if ((get_device_info_cnf->result != 0), "vs_mme_eoc_get_device_info success (7)");
fail_if (memcmp(get_device_info_cnf->model_no, model_no, sizeof(model_no)), "vs_mme_eoc_get_device_info success (8)");
fail_if ((get_device_info_cnf->eth_port_nb != eth_port_nb), "vs_mme_eoc_get_device_info success (9)");
- fail_if (memcmp (get_device_info_cnf->sw_version, sw_version, sizeof(sw_version)), "vs_mme_eoc_get_device_info success (10)");
+ fail_if (memcmp (get_device_info_cnf->sw_version, IMAGE_DESC_VERSION, strlen (IMAGE_DESC_VERSION)), "vs_mme_eoc_get_device_info success (10)");
fail_if ((get_device_info_cnf->downstream_attenuation != downstream_attenuation), "vs_mme_eoc_get_device_info success (11)");
}
diff --git a/cleopatre/devkit/tests/managerd/utests/src/vs_mme_utests.c b/cleopatre/devkit/tests/managerd/utests/src/vs_mme_utests.c
index b71d47500d..54d3471f69 100644
--- a/cleopatre/devkit/tests/managerd/utests/src/vs_mme_utests.c
+++ b/cleopatre/devkit/tests/managerd/utests/src/vs_mme_utests.c
@@ -15,21 +15,13 @@
*/
#include <check.h>
-#include <stdio.h>
#include <string.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <sys/time.h> /* for select() */
#include <linux/if_ether.h> /* for ETH_ALEN */
-#include <unistd.h>
-#include <setjmp.h>
-#include <assert.h>
-#include <errno.h>
#include "libmme.h"
-#include "libspid.h"
-#include "bridge.h"
#include "vs_mme.h"
+#include "stub.h"
+
#define DEBUG 1
#ifdef DEBUG
@@ -38,32 +30,9 @@
#define TRACE(...)
#endif
-#define IMAGE_DESC_VERSION "eoc-alpha0-test"
-#define PLC_FIRMWARE_VERSION "0.1-rc3-1-unit_test"
-
-#define PLC_VERSION_FILE "testfiles/plc_version"
-#define NET_DEV_FILE "testfiles/net_dev"
-
-#define BR_MAC_ADDR "\x00\x13\xd7\x00\x00\x10"
-
-#define MAX_ITEM_NB 8
-#define CONF_TABLE_INDEX 0
-#define INFO_TABLE_INDEX 1
-
-static struct check_ctx {
- int assert_id;
- int test_id;
- jmp_buf jmp_env;
-
-} check_ctx;
-
-enum test_id {
- TEST_GET_VERSION = 0,
- TEST_ETH_STATS,
- TEST_NB
-};
+struct check_ctx_st check_ctx;
-enum test_id test_id;
+enum test_id_en test_id;
/** local variables */
static struct managerd_ctx managerd_ctx;
@@ -72,56 +41,6 @@ static char request_buffer[1518];
static char confirm_buffer[1518];
static MME_t *request = (MME_t *)request_buffer;
static MME_t *confirm = (MME_t *)confirm_buffer;
-int test_fd;
-
-unsigned char label_table[2][MAX_ITEM_NB][64];
-unsigned char value_table[2][MAX_ITEM_NB][64];
-unsigned char msg_buf[ETH_FRAME_LEN]; /* local buffer to store netlink messages */
-
-/*
- ######################################
- # FUNCTION STUB
- # (redefinition of libc functions)
- ######################################
-*/
-void __assert_fail (__const char *__assertion, __const char *__file,
- unsigned int __line, __const char *__function)
-{
- check_ctx.assert_id = check_ctx.test_id;
- longjmp (check_ctx.jmp_env, check_ctx.assert_id);
-}
-
-FILE *fopen (const char *path, const char *mode)
-{
- switch(test_id)
- {
- case TEST_GET_VERSION:
- test_fd = open (PLC_VERSION_FILE, O_RDONLY);
- break;
- case TEST_ETH_STATS:
- test_fd = open (NET_DEV_FILE, O_RDONLY);
- break;
- default:
- return NULL;
- }
- return fdopen (test_fd, "r");
-}
-
-
-void dump_table (unsigned char table[MAX_ITEM_NB][64])
-{
- int i;
- for (i = 0; i < MAX_ITEM_NB; i++)
- printf ("%s-", table[i]);
- printf ("\n");
-}
-
-
-
-int bridge_send (struct managerd_ctx *ctx, uint8_t *buffer, int len)
-{
- return 0;
-}
/* fixtures - run before and after each unit test */
void setup(void)
@@ -129,7 +48,7 @@ void setup(void)
check_ctx.test_id = 0;
check_ctx.assert_id = 0;
memcpy (ctx->br_mac_addr, BR_MAC_ADDR, ETH_ALEN);
- }
+}
void teardown(void)
{
@@ -327,8 +246,7 @@ START_TEST (test_eth_stats_get_success)
&& (eth_stats_cnf->tx_dropped == 1010)
&& (eth_stats_cnf->tx_fifo == 1111)
&& (eth_stats_cnf->tx_collisions == 1212)
- && (eth_stats_cnf->tx_carrier == 1313)
- ,
+ && (eth_stats_cnf->tx_carrier == 1313),
"vs_eth_stats_get success");
}
END_TEST
@@ -346,9 +264,9 @@ TCase *vs_eth_stats_tcase (void)
return tc;
}
-Suite* managerd_mme_suite(void)
+Suite* vs_mme_suite(void)
{
- Suite *s = suite_create ("MANAGERD_MME");
+ Suite *s = suite_create ("vs_mme");
suite_add_tcase (s, vs_get_version_tcase ());
suite_add_tcase (s, vs_eth_stats_tcase ());
return s;
@@ -356,13 +274,10 @@ Suite* managerd_mme_suite(void)
int main(void)
{
+ Suite *s = suite_create ("vs_mme");
int number_failed = 0;
- Suite *s;
-
- s = managerd_mme_suite ();
-
SRunner *sr = srunner_create (s);
-
+ srunner_add_suite (sr, vs_mme_suite ());
//srunner_set_fork_status (sr, CK_NOFORK);
srunner_set_fork_status (sr, CK_FORK);
srunner_run_all (sr, CK_NORMAL);
diff --git a/cleopatre/devkit/tests/plcd/Makefile b/cleopatre/devkit/tests/plcd/Makefile
deleted file mode 100644
index d355d358fe..0000000000
--- a/cleopatre/devkit/tests/plcd/Makefile
+++ /dev/null
@@ -1,25 +0,0 @@
-PRJ_BASE = ../../plcd
-FILES = eoc
-
-LIBMME_DIR = ../../../application/libmme
-LIBSPID_DIR=../../../application/libspid
-LIBMME_TEST_DIR = ../libmme/utests
-LIBSPID_TEST_DIR = ../libspid/utests
-LIBMME_TEST_OBJ = $(wildcard $(LIBMME_TEST_DIR)/obj/prj/*.o)
-LIBSPID_TEST_OBJ = $(wildcard $(LIBSPID_TEST_DIR)/obj/prj/*.o)
-
-EXTRA_CFLAGS = -I$(LIBMME_DIR)/inc -I$(LIBSPID_DIR)/inc -I../../../include
-EXTRA_LIBS =
-
-PREBINS =
-
-include ../../tests/utests_makerules
-
-make_libs:
- $(MAKE) -C $(LIBMME_TEST_DIR)
- $(MAKE) -C $(LIBSPID_TEST_DIR)
-
-#OVERRIDE_VARS = CC=gcc AR=ar
-
-.PHONY: all clean make_libs
-
diff --git a/cleopatre/devkit/tests/plcd/inc/check_event.h b/cleopatre/devkit/tests/plcd/inc/check_event.h
deleted file mode 100644
index 4d502c7e8c..0000000000
--- a/cleopatre/devkit/tests/plcd/inc/check_event.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#ifndef _check_event_h
-#define _check_event_h
-/* Cesar project {{{
- *
- * Copyright (C) 2007 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file devkit/tests/plcd/utests/inc/check_event.h
- * \brief « brief description »
- * \ingroup « module »
- *
- * « long description »
- */
-
-typedef enum {
- EVENT_NONE = 0,
- EVENT_REFRESH_STATUS_1,
-} check_event_t;
-
-
-#endif /* _check_event_h */
diff --git a/cleopatre/devkit/tests/plcd/inc/eoc_utests.h b/cleopatre/devkit/tests/plcd/inc/eoc_utests.h
deleted file mode 100755
index 6225b7b565..0000000000
--- a/cleopatre/devkit/tests/plcd/inc/eoc_utests.h
+++ /dev/null
@@ -1,32 +0,0 @@
-#ifndef eoc_utests_h
-#define eoc_utests_h
-/* Cleopatre project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file eoc_utests.h
- * \brief interfaces for unitary tests of functions bellonging to module eoc.c
- * \ingroup plcd
- *
- * this file content interfaces and exported macros, variables... For the
- * unitary tests of functions bellonging to module eoc.c
- */
-
-#include <sys/types.h>
-#include "libmme.h"
-#include "libspid.h"
-#include "plcd.h"
-
-/* FUNCTION STUB */
-ssize_t sendmsg (int socket, const struct msghdr *message, int flags);
-int recvmsg (int s, struct msghdr *message, int flags);
-int hpav_compute_dak (const char *dpw, unsigned char *dak);
-
-/* PLCD FUNCTION DECLARATIONS */
-int hpav_send_white_list (const plcd_ctx_t *plcd_ctx);
-
-#endif /* mme_utests_h */
diff --git a/cleopatre/devkit/tests/plcd/inc/hpav_utests.h b/cleopatre/devkit/tests/plcd/inc/hpav_utests.h
deleted file mode 100644
index 68c158d386..0000000000
--- a/cleopatre/devkit/tests/plcd/inc/hpav_utests.h
+++ /dev/null
@@ -1,43 +0,0 @@
-#ifndef hpav_utests_h
-#define hpav_utests_h
-/* Cleopatre project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file hpav_utests.h
- * \brief interfaces for unitary tests of libMME
- * \ingroup Cleopatre - LibMME
- *
- * this file content interfaces and exported macros, variables... For the
- * unitary tests of libMME
- */
-
-#include <sys/types.h>
-#include "libmme.h"
-#include "libspid.h"
-#include "plcd.h"
-
-/* FUNCTION STUB */
-ssize_t sendmsg (int socket, const struct msghdr *message, int flags);
-int recvmsg(int s, struct msghdr *message, int flags);
-
-/* PLCD FUNCTION DECLARATIONS */
-int hpav_send_mac_address (const plcd_ctx_t *plcd_ctx, const unsigned char *mac_addr);
-int hpav_send_cco_preferred (const plcd_ctx_t *plcd_ctx, const int is_cco_preferred);
-int hpav_send_was_cco (const plcd_ctx_t *plcd_ctx, const int is_was_cco);
-int hpav_compute_nmk (const char *npw, unsigned char *nmk);
-int hpav_compute_dak (const char *dpw, unsigned char *dak);
-int hpav_send_key (const plcd_ctx_t *plcd_ctx, const unsigned char *nmk, const unsigned char *nid, const char *sl);
-int hpav_send_dak (const plcd_ctx_t *plcd_ctx, const unsigned char *dak);
-int hpav_send_mfg_hfid (const plcd_ctx_t *plcd_ctx, const char *mfg_hfid);
-int hpav_send_user_hfid (const plcd_ctx_t *plcd_ctx, const char *user_hfid);
-int hpav_send_avln_hfid (const plcd_ctx_t *plcd_ctx, const char *avln_hfid);
-int hpav_send_tonemask (const plcd_ctx_t *plcd_ctx, const unsigned char *tonemask);
-int hpav_send_start (const plcd_ctx_t *plcd_ctx);
-
-#endif /* mme_utests_h */
-
diff --git a/cleopatre/devkit/tests/plcd/inc/plcd_utests.h b/cleopatre/devkit/tests/plcd/inc/plcd_utests.h
deleted file mode 100644
index 283eff559f..0000000000
--- a/cleopatre/devkit/tests/plcd/inc/plcd_utests.h
+++ /dev/null
@@ -1,43 +0,0 @@
-#ifndef mme_utests_h
-#define mme_utests_h
-/* Cleopatre project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file mme_utests.h
- * \brief interfaces for unitary tests of libMME
- * \ingroup Cleopatre - LibMME
- *
- * this file content interfaces and exported macros, variables... For the
- * unitary tests of libMME
- */
-
-#include <sys/types.h>
-#include "libmme.h"
-#include "libspid.h"
-#include "plcd.h"
-
-/* VARIABLE STUB */
-#define NETLINK_PLC NETLINK_ROUTE /* to enable a compilation on X86 */
-
-/* FUNCTION STUB */
-inline static int hpav_init (plcd_ctx_t *plcd_ctx)
-{
- return 0;
-}
-
-static inline libspid_error_t utests_libspid_system_get_nvram(spc300_nvram_t *nvram)
-{
- return LIBSPID_SUCCESS;
-}
-
-/* PLCD FUNCTION DECLARATIONS */
-/* plcd.c*/
-int plcd_init (plcd_ctx_t *ctx);
-void plcd_uninit (plcd_ctx_t *ctx);
-
-#endif /* mme_utests_h */
diff --git a/cleopatre/devkit/tests/plcd/inc/stub.h b/cleopatre/devkit/tests/plcd/inc/stub.h
deleted file mode 100644
index 67fb3079cb..0000000000
--- a/cleopatre/devkit/tests/plcd/inc/stub.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef _stub_h
-#define _stub_h
-/* Cesar project {{{
- *
- * Copyright (C) 2007 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file /home/lefranc/Dev/git/cleopatre/devkit/tests/plcd/utests/inc/stub.h
- * \brief « brief description »
- * \ingroup « module »
- *
- * « long description »
- */
-
-
-
-#endif /* _stub_h */
diff --git a/cleopatre/devkit/tests/plcd/src/eoc_utests.c b/cleopatre/devkit/tests/plcd/src/eoc_utests.c
deleted file mode 100755
index 84c371e1c1..0000000000
--- a/cleopatre/devkit/tests/plcd/src/eoc_utests.c
+++ /dev/null
@@ -1,198 +0,0 @@
-/* Cleopatre project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file eoc_utests.c
- * \brief Unitary tests for plcd
- * \ingroup Cleopatre - plcd
- *
- * This file content all the unitary tests for eoc, part of plcd
- * (the interface between the PLC driver and the Linux filesystem).
- */
-
-#include <check.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <sys/time.h> /* for select() */
-#include <linux/if_ether.h> /* for ETH_ALEN */
-#include <unistd.h>
-#include <errno.h>
-#include "plcd.h"
-#include "eoc_utests.h"
-
-#define DEBUG 1
-
-#ifdef DEBUG
-#define TRACE(...) printf("HPAV UTESTS: " __VA_ARGS__)
-#else
-#define TRACE(...)
-#endif
-
-/** local defines */
-#define MAC_ADDR "00:11:22:33:44:55" /* mac addr that will be used for testing */
-#define PLC_ADDR "FF:EE:DD:98:76:54" /* mac addr that will be used for testing */
-
-/** local variables */
-plcd_ctx_t plcd_ctx;
-plcd_ctx_t *ctx = &plcd_ctx;
-
-unsigned char msg_buf[ETH_FRAME_LEN]; /* local buffer to store netlink messages */
-
-/*
-######################################
-# FUNCTION STUB
-# (redefinition of glibc functions)
-######################################
-*/
-ssize_t sendmsg (int socket, const struct msghdr *message, int flags)
-{
- struct nlmsghdr *nlh;
-
- nlh = (struct nlmsghdr *)(message->msg_iov->iov_base);
-
- /* store message to local buffer */
- memcpy(msg_buf, nlh, message->msg_iov->iov_len);
-
- return 1;
-}
-
-int recvmsg(int s, struct msghdr *message, int flags)
-{
- struct nlmsghdr *nlh;
- MME_t *mme_hdr;
-
- nlh = (struct nlmsghdr *)(message->msg_iov->iov_base);
- mme_hdr = (MME_t *)NLMSG_DATA(msg_buf);
-
- /* change mme type to CNF */
- mme_hdr->mmtype = (mme_hdr->mmtype & ~MME_TYPE_MASK) | MME_TYPE_CNF;
-
- /* copy local buffer to response message */
- memcpy(nlh, msg_buf, message->msg_iov->iov_len);
-
- return 1;
-}
-
-int select(int nfds, fd_set *readfds, fd_set *writefds,
- fd_set *exceptfds, struct timeval *timeout)
-{
- return 1;
-}
-
-int hpav_send_single_value (const plcd_ctx_t *plcd_ctx, unsigned int mmtype, const void *value, unsigned int length)
-{
- unsigned char sta_num = 0x01;
- unsigned char mac1[ETH_ALEN] = {0x00, 0x11, 0x22, 0x33, 0x44, 0x55};
- unsigned char tei1 = 0x20;
- unsigned char authorisation1 = 0x01;
- unsigned char rfol1 = 0x03;
- unsigned char stime1[4] = {0x12, 0x34, 0x56, 0x78};
- unsigned char etime1[4] = {0xaa, 0xbb, 0xcc, 0xdd};
- unsigned char dak1[8] = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88};
- unsigned char action1 = 0x01;
-
- fail_if( memcmp(value, &sta_num, 1) != 0, "fail: wrong number of STAs" );
- fail_if( memcmp(value + 1, mac1, ETH_ALEN) != 0, "fail: wrong MAC1 address" );
- fail_if( memcmp(value + 7, &tei1, 1) != 0, "fail: wrong TEI1" );
- fail_if( memcmp(value + 8, &authorisation1, 1) != 0, "fail: wrong authorisation1" );
- fail_if( memcmp(value + 9, &rfol1, 1) != 0, "fail: wrong RF output value 1 (rfol1)" );
- fail_if( memcmp(value + 10, stime1, 4) != 0, "fail: wrong start of time limitation (stime1)" );
- fail_if( memcmp(value + 14, etime1, 4) != 0, "fail: wrong end of time limitation (etime1)" );
- fail_if( memcmp(value + 18, dak1, 8) != 0, "fail: wrong dak1" );
- fail_if( memcmp(value, &action1, 1) != 0, "fail: wrong action1" );
-
- return 0;
-}
-
-int hpav_compute_dak (const char *dpw, unsigned char *dak)
-{
- dak[0] = 0x11;
- dak[1] = 0x22;
- dak[2] = 0x33;
- dak[3] = 0x44;
- dak[4] = 0x55;
- dak[5] = 0x66;
- dak[6] = 0x77;
- dak[7] = 0x88;
-
- return 0;
-}
-
-/* fixtures - run before and after each unit test */
-void setup(void)
-{
- int i;
- char pa[] = PLC_ADDR;
- char *s, *e;
-
- ctx->hardware_info_path = (char *)malloc(64);
- ctx->hpav_info_path = (char *)malloc(64);
- ctx->hpav_conf_path = (char *)malloc(64);
-
- /* initialize plcd context */
- strcpy(ctx->hardware_info_path, LIBSPID_HARDWARE_INFO_PATH);
- strcpy(ctx->hpav_info_path, LIBSPID_HPAV_INFO_PATH);
- strcpy(ctx->hpav_conf_path, LIBSPID_HPAV_CONF_PATH);
- ctx->plc_sock = 0;
- ctx->nvram = (spc300_nvram_t *) malloc(sizeof(spc300_nvram_t));
- s = pa;
- for (i = 0; i < 6; ++i)
- {
- ctx->nvram->plc_address[i] = s ? strtoul (s, &e, 16) : 0;
- if (s)
- s = (*e) ? e + 1 : e;
- }
-}
-
-void teardown(void)
-{
-}
-
-/* --- TEST PROCEDURES --- */
-/** test procedures */
-START_TEST (test_hpav_send_white_list)
-{
- int ret;
-
- ret = hpav_send_white_list(ctx);
- fail_if( ret != 0, "hpav_send_white_list fail" );
-}
-END_TEST
-
-extern Suite* hpav_suite(void)
-{
- Suite *s = suite_create("EOC");
- TCase *tc_core = tcase_create("Core");
-
- tcase_add_checked_fixture (tc_core, setup, teardown);
-
- //Test hpav_send_white_list
- tcase_add_test(tc_core, test_hpav_send_white_list);
-
- suite_add_tcase(s, tc_core);
- return s;
-}
-
-int main(void)
-{
- int number_failed = 0;
- Suite *s;
-
- //Run hpav tests
- s = hpav_suite();
-
- SRunner *sr = srunner_create(s);
- //srunner_set_fork_status (sr, CK_NOFORK);
- srunner_set_fork_status (sr, CK_FORK);
- srunner_run_all(sr, CK_NORMAL);
- number_failed = srunner_ntests_failed(sr);
- srunner_free(sr);
-
- return (number_failed == 0) ? 0 : -1;
-}
-
diff --git a/cleopatre/devkit/tests/plcd/src/event_utests.c b/cleopatre/devkit/tests/plcd/src/event_utests.c
deleted file mode 100644
index 48b0dccf58..0000000000
--- a/cleopatre/devkit/tests/plcd/src/event_utests.c
+++ /dev/null
@@ -1,777 +0,0 @@
-/* Cleopatre project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file check_event.c
- * \brief Unitary tests for plcd
- * \ingroup Cleopatre - plcd
- *
- * This file content all the unitary tests for event, part of plcd
- * (the interface between the PLC driver and the Linux filesystem).
- */
-
-#include <check.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <sys/time.h> /* for select() */
-#include <linux/if_ether.h> /* for ETH_ALEN */
-#include <unistd.h>
-#include <setjmp.h>
-#include <assert.h>
-#include <errno.h>
-#include "plcd.h"
-#include "stub.h"
-#include "libmme.h"
-#include "libspid.h"
-
-#define DEBUG 1
-
-#ifdef DEBUG
-#define TRACE(...) printf("EVENT UTESTS: " __VA_ARGS__)
-#else
-#define TRACE(...)
-#endif
-
-#define HPAV_CONF_TMP_PATH "hpav_tmp.conf"
-#define HPAV_INFO_TMP_PATH "hpav_tmp.info"
-
-#define HPAV_CONF_FILE_BAD_STATUS "../testfiles/hpav_bad_status.conf"
-#define HPAV_CONF_FILE_BAD_CCO "../testfiles/hpav_bad_cco.conf"
-#define HPAV_CONF_FILE_3 "../testfiles/hpav_3.conf"
-#define HPAV_CONF_FILE_4 "../testfiles/hpav_4.conf"
-
-#define HPAV_INFO_FILE_1 "../testfiles/hpav_1.info"
-
-static struct check_ctx {
- int assert_id;
- int test_id;
- jmp_buf jmp_env;
-
-} check_ctx;
-
-#define CHECK_ASSERT(result, id, jmpbuf) if(0 == (result = setjmp (jmpbuf)))
-
-/** local defines */
-#define MAC_ADDR "AA:BB:CC:12:34:56" /* mac addr that will be used for testing */
-#define PLC_ADDR "FF:EE:DD:98:76:54" /* mac addr that will be used for testing */
-#define MAX_ITEM_NB 8
-#define CONF_TABLE_INDEX 0
-#define INFO_TABLE_INDEX 1
-
-/** local variables */
-static plcd_ctx_t plcd_ctx;
-static plcd_ctx_t *ctx = &plcd_ctx;
-static int is_info_manager_needed, is_save_conf_needed;
-static mme_ctx_t mme_ctx;
-static char mme_buffer[256];
-unsigned char label_table[2][MAX_ITEM_NB][64];
-unsigned char value_table[2][MAX_ITEM_NB][64];
-unsigned char msg_buf[ETH_FRAME_LEN]; /* local buffer to store netlink messages */
-
-extern int check_sc_start (plcd_ctx_t *ctx);
-extern int refresh_status (plcd_ctx_t *ctx, mme_ctx_t *status_ctx, int *is_save_conf_needed, int *is_info_manager_needed);
-
-
-/*
- ######################################
- # FUNCTION STUB
- # (redefinition of libc functions)
- ######################################
-*/
-void __assert_fail (__const char *__assertion, __const char *__file,
- unsigned int __line, __const char *__function)
-{
- check_ctx.assert_id = check_ctx.test_id;
- longjmp (check_ctx.jmp_env, check_ctx.assert_id);
-}
-
-ssize_t sendmsg (int socket, const struct msghdr *message, int flags)
-{
- struct nlmsghdr *nlh;
-
- nlh = (struct nlmsghdr *)(message->msg_iov->iov_base);
-
- /* store message to local buffer */
- memcpy(msg_buf, nlh, message->msg_iov->iov_len);
-
- return 1;
-}
-
-int recvmsg(int s, struct msghdr *message, int flags)
-{
- struct nlmsghdr *nlh;
- MME_t *mme_hdr;
-
- nlh = (struct nlmsghdr *)(message->msg_iov->iov_base);
- mme_hdr = (MME_t *)NLMSG_DATA(msg_buf);
-
- /* change mme type to CNF */
- mme_hdr->mmtype = (mme_hdr->mmtype & ~MME_TYPE_MASK) | MME_TYPE_CNF;
-
- /* copy local buffer to response message */
- memcpy(nlh, msg_buf, message->msg_iov->iov_len);
-
- return 1;
-}
-
-int select(int nfds, fd_set *readfds, fd_set *writefds,
- fd_set *exceptfds, struct timeval *timeout)
-{
- return 1;
-}
-
-void syslog(int priority, const char *format, ...)
-{
- return;
-}
-
-int hpav_send_single_value (const plcd_ctx_t *plcd_ctx, unsigned int mmtype, const void *value, unsigned int length)
-{
- int len;
- mme_init (&mme_ctx, mmtype, mme_buffer, sizeof(mme_buffer));
- mme_put (&mme_ctx, value, length, &len);
- return 0;
-}
-
-mme_error_t mme_init (mme_ctx_t *ctx, const mme_type_t mmtype, unsigned char *buffer, const unsigned int length)
-{
- ctx->buffer = buffer;
- ctx->mmtype = mmtype;
- ctx->length = length;
- ctx->head = 0;
- ctx->tail = 0;
- return MME_SUCCESS;
-}
-
-mme_error_t mme_push (mme_ctx_t *ctx, const void *data, unsigned int length, unsigned int *result_length)
-{
- return MME_SUCCESS;
-}
-
-mme_error_t mme_pull (mme_ctx_t *ctx, void *data, unsigned int length, unsigned int *result_length)
-{
- *result_length = length;
- memcpy(data, (unsigned char *)(ctx->buffer + ctx->head), length);
- ctx->head += length;
- //printf ("head=%d, data=%02x\n", ctx->head, *((unsigned char *)data));
- return MME_SUCCESS;
-}
-
-mme_error_t mme_put (mme_ctx_t *ctx, const void *data, unsigned int length, unsigned int *result_length)
-{
- *result_length = length;
- memcpy( (unsigned char *)(ctx->buffer + ctx->tail), (unsigned char *)data, length );
- ctx->tail += length;
- return MME_SUCCESS;
-}
-
-void dump_table (unsigned char table[MAX_ITEM_NB][64])
-{
- int i;
- for (i = 0; i < MAX_ITEM_NB; i++)
- printf ("%s-", table[i]);
- printf ("\n");
-}
-
-libspid_error_t libspid_config_read_item (const char *filename, const char *label, char *value, int buffer_len)
-{
- int i, conf;
- conf = (!strcmp (filename, "conf") ? CONF_TABLE_INDEX : INFO_TABLE_INDEX);
- for(i = 0; i < MAX_ITEM_NB; i++)
- {
- if(!strcmp (label, label_table[conf][i]))
- {
- strcpy (value, value_table[conf][i]);
- return LIBSPID_SUCCESS;
- }
- }
- return LIBSPID_ERROR_NOT_FOUND;
-}
-
-libspid_error_t libspid_config_write_item(const char *filename, const char *label, const char *value)
-{
- int i, conf;
- conf = (!strcmp (filename, "conf") ? CONF_TABLE_INDEX : INFO_TABLE_INDEX);
- for (i = 0; i < MAX_ITEM_NB; i++)
- {
- if(label_table[conf][i][0] == '\0')
- break;
- if(!strcmp (label_table[conf][i], label))
- {
- strcpy (value_table[conf][i], value);
- return LIBSPID_SUCCESS;
- }
- }
- if(i >= MAX_ITEM_NB)
- return LIBSPID_ERROR_NO_SPACE;
- strcpy (label_table[conf][i], label);
- strcpy (value_table[conf][i], value);
- return LIBSPID_SUCCESS;
-}
-
-extern libspid_error_t libspid_system_save_file(const char *filename)
-{
- return LIBSPID_SUCCESS;
-}
-
-/* fixtures - run before and after each unit test */
-void setup(void)
-{
- plcd_ctx.hpav_conf_path = HPAV_CONF_TMP_PATH;
- plcd_ctx.hpav_info_path = HPAV_INFO_TMP_PATH;
- mme_init (&mme_ctx, MME_TYPE_DRV_STA_STATUS | MME_TYPE_IND, mme_buffer, sizeof(mme_buffer));
- is_info_manager_needed = LIBSPID_FALSE;
- is_save_conf_needed = LIBSPID_FALSE;
- check_ctx.test_id = 0;
- check_ctx.assert_id = 0;
- memset (label_table, '\0', sizeof(label_table));
- memset (value_table, '\0', sizeof(value_table));
- libspid_config_write_item (plcd_ctx.hpav_info_path, LIBSPID_HPAV_INFO_LABEL_STATUS, "unassociated");
- libspid_config_write_item (plcd_ctx.hpav_info_path, LIBSPID_HPAV_INFO_LABEL_CCO, "station");
- libspid_config_write_item (plcd_ctx.hpav_info_path, LIBSPID_HPAV_INFO_LABEL_BACKUP_CCO, "no");
- libspid_config_write_item (plcd_ctx.hpav_info_path, LIBSPID_HPAV_INFO_LABEL_SC, "no");
- libspid_config_write_item (plcd_ctx.hpav_info_path, LIBSPID_HPAV_INFO_LABEL_SC_BUTTON, "no");
-
-}
-
-void teardown(void)
-{
-}
-
-/***********************************************************
- *
- * check_sc_start() test cases
- *
- *******************************************************/
-
-/* check when plcd_ctx = NULL */
-START_TEST (test_check_sc_start_param_1)
-{
- check_ctx.test_id = 1;
- if(0 == setjmp (check_ctx.jmp_env))
- {
- check_sc_start (NULL);
- fail ("check_sc_start plcd_ctx = NULL (1)");
- }
- fail_unless ((check_ctx.test_id == check_ctx.assert_id),
- "check_sc_start plcd_ctx = NULL (2)");
-}
-END_TEST
-
-/* check if no MME is sent if SC_BUTTON!=yes or SC!=no */
-START_TEST (test_check_sc_start_cond_1)
-{
- libspid_config_write_item (plcd_ctx.hpav_info_path, LIBSPID_HPAV_INFO_LABEL_SC_BUTTON, "yes");
- libspid_config_write_item (plcd_ctx.hpav_info_path, LIBSPID_HPAV_INFO_LABEL_SC, "yes");
- check_sc_start (&plcd_ctx);
- fail_unless ((mme_ctx.head == mme_ctx.tail),
- "check_sc_start SC_BUTTON=yes, SC=yes");
-
-}
-END_TEST
-
-/* check if no MME is sent if SC_BUTTON!=no or SC!=no */
-START_TEST (test_check_sc_start_cond_2)
-{
- libspid_config_write_item (plcd_ctx.hpav_info_path, LIBSPID_HPAV_INFO_LABEL_SC_BUTTON, "no");
- libspid_config_write_item (plcd_ctx.hpav_info_path, LIBSPID_HPAV_INFO_LABEL_SC, "no");
- check_sc_start (&plcd_ctx);
- fail_unless ((mme_ctx.head == mme_ctx.tail),
- "check_sc_start SC_BUTTON=no, SC=no");
-
-}
-END_TEST
-
-/* check if MME is sent with SC_JOIN */
-START_TEST (test_check_sc_start_assoc_1)
-{
- unsigned char sc;
- unsigned int length;
- libspid_config_write_item (plcd_ctx.hpav_info_path, LIBSPID_HPAV_INFO_LABEL_SC_BUTTON, "yes");
- libspid_config_write_item (plcd_ctx.hpav_info_path, LIBSPID_HPAV_INFO_LABEL_SC, "no");
- libspid_config_write_item (plcd_ctx.hpav_info_path, LIBSPID_HPAV_INFO_LABEL_STATUS, "unassociated");
-
- check_sc_start (&plcd_ctx);
- mme_pull (&mme_ctx, &sc, 1, &length);
- fail_unless ((MME_DRV_SC_JOIN == sc)
- && (1 == length),
- "check_sc_start SC_JOIN");
-}
-END_TEST
-
-/* check if MME is sent with SC_ADD */
-START_TEST (test_check_sc_start_assoc_2)
-{
- unsigned char sc;
- unsigned int length;
- libspid_config_write_item (plcd_ctx.hpav_info_path, LIBSPID_HPAV_INFO_LABEL_SC_BUTTON, "yes");
- libspid_config_write_item (plcd_ctx.hpav_info_path, LIBSPID_HPAV_INFO_LABEL_SC, "no");
- libspid_config_write_item (plcd_ctx.hpav_info_path, LIBSPID_HPAV_INFO_LABEL_STATUS, "authenticated");
-
- check_sc_start (&plcd_ctx);
- mme_pull (&mme_ctx, &sc, 1, &length);
- fail_unless ((MME_DRV_SC_ADD == sc)
- && (1 == length),
- "check_sc_start SC_ADD");
-}
-END_TEST
-
-TCase *event_refresh_check_sc_start_tcase (void)
-{
- TCase *tc = tcase_create ("check_sc_start");
- tcase_add_checked_fixture (tc, setup, teardown);
- // check STATUS field
- tcase_add_test (tc, test_check_sc_start_param_1);
- tcase_add_test (tc, test_check_sc_start_cond_1);
- tcase_add_test (tc, test_check_sc_start_cond_2);
- tcase_add_test (tc, test_check_sc_start_assoc_1);
- tcase_add_test (tc, test_check_sc_start_assoc_2);
- return (tc);
-}
-
-/***********************************************************
- *
- * refresh_status() test cases
- *
- *******************************************************/
-
-/* check when plcd_ctx = NULL */
-START_TEST (test_refresh_status_param_1)
-{
- check_ctx.test_id = 1;
- if(0 == setjmp (check_ctx.jmp_env))
- {
- refresh_status (NULL, &mme_ctx, &is_save_conf_needed, &is_info_manager_needed);
- fail ("refresh_status plcd_ctx = NULL (1)");
- }
- fail_unless ((check_ctx.test_id == check_ctx.assert_id),
- "refresh status plcd_ctx = NULL (2)");
-}
-END_TEST
-
-/* check when mme_ctx = NULL */
-START_TEST (test_refresh_status_param_2)
-{
- check_ctx.test_id = 2;
- if(0 == setjmp (check_ctx.jmp_env))
- {
- refresh_status (&plcd_ctx, NULL, &is_save_conf_needed, &is_info_manager_needed);
- fail ("refresh_status mme_ctx = NULL (1)");
- }
- fail_unless ((check_ctx.test_id == check_ctx.assert_id),
- "refresh status mme_ctx = NULL (2)");
-}
-END_TEST
-
-/* check when mme_ctx.mmtype has wrong value */
-START_TEST (test_refresh_status_param_3)
-{
- mme_ctx.mmtype = MME_TYPE_DRV_STA_STATUS | MME_TYPE_CNF;
- check_ctx.test_id = 3;
- if(0 == setjmp (check_ctx.jmp_env))
- {
- refresh_status (&plcd_ctx, &mme_ctx, &is_save_conf_needed, &is_info_manager_needed);
- fail ("refresh_status mme_ctx.mmtype (1)");
- }
- fail_unless ((check_ctx.test_id == check_ctx.assert_id),
- "refresh status mme_ctx.mmtype (2)");
-}
-END_TEST
-
-/* check when is_save_conf_needed = NULL */
-START_TEST (test_refresh_status_param_4)
-{
- check_ctx.test_id = 4;
- if(0 == setjmp (check_ctx.jmp_env))
- {
- refresh_status (&plcd_ctx, &mme_ctx, NULL, &is_info_manager_needed);
- fail ("refresh_status is_save_conf_needed (1)");
- }
- fail_unless ((check_ctx.test_id == check_ctx.assert_id),
- "refresh status is_save_conf_needed (2)");
-}
-END_TEST
-
-/* check when is_info_manager_needed = NULL */
-START_TEST (test_refresh_status_param_5)
-{
- check_ctx.test_id = 5;
- if(0 == setjmp (check_ctx.jmp_env))
- {
- refresh_status (&plcd_ctx, &mme_ctx, &is_save_conf_needed, NULL);
- fail ("refresh_status is_info_manager_needed (1)");
- }
- fail_unless ((check_ctx.test_id == check_ctx.assert_id),
- "refresh status is_info_manager_needed (2)");
-}
-END_TEST
-
-TCase *event_refresh_status_param_tcase (void)
-{
- TCase *tc = tcase_create ("refresh_status_param");
- tcase_add_checked_fixture (tc, setup, teardown);
- // check params plcd_ctx = NULL
- tcase_add_test (tc, test_refresh_status_param_1);
- // check param mme_ctx = NULL
- tcase_add_test (tc, test_refresh_status_param_2);
- // check param mme_ctx.mmtype has wrong value
- tcase_add_test (tc, test_refresh_status_param_3);
- // check param is_save_conf_needed = NULL
- tcase_add_test (tc, test_refresh_status_param_4);
- // check param is_info_manager_needed = NULL
- tcase_add_test (tc, test_refresh_status_param_5);
- return tc;
-}
-
-/* check assoc status switch to unassociated */
-START_TEST (test_refresh_status_assoc_1)
-{
- unsigned int length;
- char buffer[1024];
-
- mme_put (&mme_ctx, "\x00\x00\x00\x00\x00", 5, &length);
- libspid_config_write_item (plcd_ctx.hpav_info_path, LIBSPID_HPAV_INFO_LABEL_STATUS, "unassociated");
-
- refresh_status (&plcd_ctx, &mme_ctx, &is_save_conf_needed, &is_info_manager_needed);
- libspid_config_read_item (plcd_ctx.hpav_info_path, LIBSPID_HPAV_INFO_LABEL_STATUS, buffer, sizeof(buffer));
-
- fail_unless (!strcmp (buffer, "unassociated")
- && (LIBSPID_FALSE == is_info_manager_needed),
- "STATUS = unassociated");
-}
-END_TEST
-
-/* check assoc status switch to associated */
-START_TEST (test_refresh_status_assoc_2)
-{
- unsigned int length;
- char buffer[1024];
-
- mme_put (&mme_ctx, "\x01\x00\x00\x00\x00", 5, &length);
- libspid_config_write_item (plcd_ctx.hpav_info_path, LIBSPID_HPAV_INFO_LABEL_STATUS, "unassociated");
-
-// dump_table (label_table[INFO_TABLE_INDEX]);
-// dump_table (value_table[INFO_TABLE_INDEX]);
-
- refresh_status (&plcd_ctx, &mme_ctx, &is_save_conf_needed, &is_info_manager_needed);
- libspid_config_read_item (plcd_ctx.hpav_info_path, LIBSPID_HPAV_INFO_LABEL_STATUS, buffer, sizeof(buffer));
-
-// dump_table (label_table[INFO_TABLE_INDEX]);
-// dump_table (value_table[INFO_TABLE_INDEX]);
-
- fail_unless (!strcmp (buffer, "associated")
- && (LIBSPID_TRUE == is_info_manager_needed),
- "STATUS = associated");
-}
-END_TEST
-
-/* check assoc status switch to associated */
-START_TEST (test_refresh_status_assoc_3)
-{
- unsigned int length;
- char buffer[1024];
-
- mme_put (&mme_ctx, "\x02\x00\x00\x00\x00", 5, &length);
- libspid_config_write_item (plcd_ctx.hpav_info_path, LIBSPID_HPAV_INFO_LABEL_STATUS, "unassociated");
-
- refresh_status (&plcd_ctx, &mme_ctx, &is_save_conf_needed, &is_info_manager_needed);
- libspid_config_read_item (plcd_ctx.hpav_info_path, LIBSPID_HPAV_INFO_LABEL_STATUS, buffer, sizeof(buffer));
-
- fail_unless (!strcmp (buffer, "authenticated")
- && (LIBSPID_TRUE == is_info_manager_needed),
- "STATUS = authenticated");
-}
-END_TEST
-
-/* check assoc status wrong value */
-START_TEST (test_refresh_status_assoc_4)
-{
- unsigned int length;
- char buffer[1024];
-
- mme_put (&mme_ctx, "\x03\x00\x00\x00\x00", 5, &length);
- libspid_config_write_item (plcd_ctx.hpav_info_path, LIBSPID_HPAV_INFO_LABEL_STATUS, "associated");
-
- refresh_status (&plcd_ctx, &mme_ctx, &is_save_conf_needed, &is_info_manager_needed);
- libspid_config_read_item (plcd_ctx.hpav_info_path, LIBSPID_HPAV_INFO_LABEL_STATUS, buffer, sizeof(buffer));
-
- fail_unless (!strcmp (buffer, "associated")
- && (LIBSPID_FALSE == is_info_manager_needed),
- "wrong STATUS value");
-}
-END_TEST
-
-TCase *event_refresh_status_assoc_tcase (void)
-{
- TCase *tc = tcase_create ("refresh_status_assoc");
- tcase_add_checked_fixture (tc, setup, teardown);
- // check STATUS field
- tcase_add_test (tc, test_refresh_status_assoc_1);
- tcase_add_test (tc, test_refresh_status_assoc_2);
- tcase_add_test (tc, test_refresh_status_assoc_3);
- tcase_add_test (tc, test_refresh_status_assoc_4);
-
- return tc;
-}
-
-/* check cco switch to proxy */
-START_TEST (test_refresh_status_cco_1)
-{
- unsigned int length;
- char buffer[1024];
-
- mme_put (&mme_ctx, "\x00\x01\x00\x00\x00", 5, &length);
- libspid_config_write_item (plcd_ctx.hpav_info_path, LIBSPID_HPAV_INFO_LABEL_CCO, "station");
-
- refresh_status (&plcd_ctx, &mme_ctx, &is_save_conf_needed, &is_info_manager_needed);
- libspid_config_read_item (plcd_ctx.hpav_info_path, LIBSPID_HPAV_INFO_LABEL_CCO, buffer, sizeof(buffer));
-
- fail_unless (!strcmp (buffer, "proxy")
- && (LIBSPID_TRUE == is_info_manager_needed),
- "CCO = proxy");
-}
-END_TEST
-
-/* check cco switch to station */
-START_TEST (test_refresh_status_cco_2)
-{
- unsigned int length;
- char buffer[1024];
-
- mme_put (&mme_ctx, "\x00\x00\x00\x00\x00", 5, &length);
- libspid_config_write_item (plcd_ctx.hpav_info_path, LIBSPID_HPAV_INFO_LABEL_CCO, "proxy");
-
- refresh_status (&plcd_ctx, &mme_ctx, &is_save_conf_needed, &is_info_manager_needed);
- libspid_config_read_item (plcd_ctx.hpav_info_path, LIBSPID_HPAV_INFO_LABEL_CCO, buffer, sizeof(buffer));
-
- fail_unless (!strcmp (buffer, "station")
- && (LIBSPID_TRUE == is_info_manager_needed),
- "CCO = station");
-}
-END_TEST
-
-/* check cco switch to main with WAS_CCO=no update */
-START_TEST (test_refresh_status_cco_3)
-{
- unsigned int length;
- char buffer1[256], buffer2[256];
-
- mme_put (&mme_ctx, "\x02\x02\x00\x00\x00", 5, &length);
- libspid_config_write_item (plcd_ctx.hpav_info_path, LIBSPID_HPAV_INFO_LABEL_CCO, "station");
- libspid_config_write_item (plcd_ctx.hpav_conf_path, LIBSPID_HPAV_CONF_LABEL_WAS_CCO, "no");
-
- refresh_status (&plcd_ctx, &mme_ctx, &is_save_conf_needed, &is_info_manager_needed);
- libspid_config_read_item (plcd_ctx.hpav_info_path, LIBSPID_HPAV_INFO_LABEL_CCO, buffer1, sizeof(buffer1));
- libspid_config_read_item (plcd_ctx.hpav_conf_path, LIBSPID_HPAV_CONF_LABEL_WAS_CCO, buffer2, sizeof(buffer2));
-
- fail_unless (!strcmp (buffer1, "main")
- && !strcmp (buffer2, "yes")
- && (LIBSPID_TRUE == is_info_manager_needed)
- && (LIBSPID_TRUE == is_save_conf_needed),
- "CCO = main with WAS_CCO = no (status=%s, was_cco=%s)", buffer1, buffer2);
-}
-END_TEST
-
-/* check cco switch to station with WAS_CCO=yes update */
-START_TEST (test_refresh_status_cco_4)
-{
- unsigned int length;
- char buffer1[256], buffer2[256];
-
- mme_put (&mme_ctx, "\x02\x00\x00\x00\x00", 5, &length);
- libspid_config_write_item (plcd_ctx.hpav_info_path, LIBSPID_HPAV_INFO_LABEL_CCO, "main");
- libspid_config_write_item (plcd_ctx.hpav_conf_path, LIBSPID_HPAV_CONF_LABEL_WAS_CCO, "yes");
-
- refresh_status (&plcd_ctx, &mme_ctx, &is_save_conf_needed, &is_info_manager_needed);
- libspid_config_read_item (plcd_ctx.hpav_info_path, LIBSPID_HPAV_INFO_LABEL_CCO, buffer1, sizeof(buffer1));
- libspid_config_read_item (plcd_ctx.hpav_conf_path, LIBSPID_HPAV_CONF_LABEL_WAS_CCO, buffer2, sizeof(buffer2));
-
- fail_unless (!strcmp (buffer1, "station")
- && !strcmp (buffer2, "no")
- && (LIBSPID_TRUE == is_info_manager_needed)
- && (LIBSPID_TRUE == is_save_conf_needed),
- "CCO = station with WAS_CCO = yes (status=%s, was_cco=%s)", buffer1, buffer2);
-}
-END_TEST
-
-TCase *event_refresh_status_cco_tcase (void)
-{
- TCase *tc = tcase_create ("refresh_status_cco");
- tcase_add_checked_fixture (tc, setup, teardown);
- // check STATUS field
- tcase_add_test (tc, test_refresh_status_cco_1);
- tcase_add_test (tc, test_refresh_status_cco_2);
- tcase_add_test (tc, test_refresh_status_cco_3);
- tcase_add_test (tc, test_refresh_status_cco_4);
- return tc;
-}
-
-/* check cco preferred from no to yes*/
-START_TEST (test_refresh_status_cco_preferred_1)
-{
- unsigned int length;
- char buffer[256];
-
- mme_put (&mme_ctx, "\x00\x00\x01\x00\x00", 5, &length);
- libspid_config_write_item (plcd_ctx.hpav_conf_path, LIBSPID_HPAV_CONF_LABEL_CCO_PREFERRED, "no");
-
- refresh_status (&plcd_ctx, &mme_ctx, &is_save_conf_needed, &is_info_manager_needed);
- libspid_config_read_item (plcd_ctx.hpav_conf_path, LIBSPID_HPAV_CONF_LABEL_CCO_PREFERRED, buffer, sizeof(buffer));
-
- fail_unless (!strcmp (buffer, "yes")
- && (LIBSPID_TRUE == is_save_conf_needed),
- "CCO_PREFERRED = yes");
-}
-END_TEST
-
-/* check cco preferred from yes to no */
-START_TEST (test_refresh_status_cco_preferred_2)
-{
- unsigned int length;
- char buffer[256];
-
- mme_put (&mme_ctx, "\x00\x00\x00\x00\x00", 5, &length);
- libspid_config_write_item (plcd_ctx.hpav_conf_path, LIBSPID_HPAV_CONF_LABEL_CCO_PREFERRED, "yes");
-
- refresh_status (&plcd_ctx, &mme_ctx, &is_save_conf_needed, &is_info_manager_needed);
- libspid_config_read_item (plcd_ctx.hpav_conf_path, LIBSPID_HPAV_CONF_LABEL_CCO_PREFERRED, buffer, sizeof(buffer));
-
- fail_unless (!strcmp (buffer, "no")
- && (LIBSPID_TRUE == is_save_conf_needed),
- "CCO_PREFERRED = no");
-}
-END_TEST
-
-TCase *event_refresh_status_cco_preferred_tcase (void)
-{
- TCase *tc = tcase_create ("refresh_status_cco_preferred");
- tcase_add_checked_fixture (tc, setup, teardown);
- tcase_add_test (tc, test_refresh_status_cco_preferred_1);
- tcase_add_test (tc, test_refresh_status_cco_preferred_2);
- return tc;
-}
-
-/* check cco backup from no to yes */
-START_TEST (test_refresh_status_cco_backup_1)
-{
- unsigned int length;
- char buffer[256];
-
- mme_put (&mme_ctx, "\x00\x00\x00\x01\x00", 5, &length);
- libspid_config_write_item (plcd_ctx.hpav_info_path, LIBSPID_HPAV_INFO_LABEL_BACKUP_CCO, "no");
-
- refresh_status (&plcd_ctx, &mme_ctx, &is_save_conf_needed, &is_info_manager_needed);
- libspid_config_read_item (plcd_ctx.hpav_info_path, LIBSPID_HPAV_INFO_LABEL_BACKUP_CCO, buffer, sizeof(buffer));
-
- fail_unless (!strcmp (buffer, "yes")
- && (LIBSPID_TRUE == is_info_manager_needed),
- "BACKUP_CCO = yes");
-}
-END_TEST
-
-/* check cco backup from yes to no */
-START_TEST (test_refresh_status_cco_backup_2)
-{
- unsigned int length;
- char buffer[256];
-
- mme_put (&mme_ctx, "\x00\x00\x00\x00\x00", 5, &length);
- libspid_config_write_item (plcd_ctx.hpav_info_path, LIBSPID_HPAV_INFO_LABEL_BACKUP_CCO, "yes");
-
- refresh_status (&plcd_ctx, &mme_ctx, &is_save_conf_needed, &is_info_manager_needed);
- libspid_config_read_item (plcd_ctx.hpav_info_path, LIBSPID_HPAV_INFO_LABEL_BACKUP_CCO, buffer, sizeof(buffer));
-
- fail_unless (!strcmp (buffer, "no")
- && (LIBSPID_TRUE == is_info_manager_needed),
- "BACKUP_CCO = no");
-}
-END_TEST
-
-TCase *event_refresh_status_cco_backup_tcase (void)
-{
- TCase *tc = tcase_create ("refresh_status_cco_backup");
- tcase_add_checked_fixture (tc, setup, teardown);
- tcase_add_test (tc, test_refresh_status_cco_backup_1);
- tcase_add_test (tc, test_refresh_status_cco_backup_2);
- return tc;
-}
-
-/* check SC from no to yes */
-START_TEST (test_refresh_status_sc_1)
-{
- unsigned int length;
- char buffer[256];
-
- mme_put (&mme_ctx, "\x00\x00\x00\x00\x01", 5, &length);
- libspid_config_write_item (plcd_ctx.hpav_info_path, LIBSPID_HPAV_INFO_LABEL_SC, "no");
-
- refresh_status (&plcd_ctx, &mme_ctx, &is_save_conf_needed, &is_info_manager_needed);
- libspid_config_read_item (plcd_ctx.hpav_info_path, LIBSPID_HPAV_INFO_LABEL_SC, buffer, sizeof(buffer));
-
- fail_unless (!strcmp (buffer, "yes")
- && (LIBSPID_TRUE == is_info_manager_needed),
- "SC = yes");
-}
-END_TEST
-
-/* check sc from yes to no */
-START_TEST (test_refresh_status_sc_2)
-{
- unsigned int length;
- char buffer[256];
-
- mme_put (&mme_ctx, "\x00\x00\x00\x00\x00", 5, &length);
- libspid_config_write_item (plcd_ctx.hpav_info_path, LIBSPID_HPAV_INFO_LABEL_SC, "yes");
-
- refresh_status (&plcd_ctx, &mme_ctx, &is_save_conf_needed, &is_info_manager_needed);
- libspid_config_read_item (plcd_ctx.hpav_info_path, LIBSPID_HPAV_INFO_LABEL_SC, buffer, sizeof(buffer));
-
- fail_unless (!strcmp (buffer, "no")
- && (LIBSPID_TRUE == is_info_manager_needed),
- "BACKUP_SC = no");
-}
-END_TEST
-
-TCase *event_refresh_status_sc_tcase (void)
-{
- TCase *tc = tcase_create ("refresh_status_sc");
- tcase_add_checked_fixture (tc, setup, teardown);
- tcase_add_test (tc, test_refresh_status_sc_1);
- tcase_add_test (tc, test_refresh_status_sc_2);
- return tc;
-}
-
-
-Suite* event_suite(void)
-{
- Suite *s = suite_create ("event");
- suite_add_tcase (s, event_refresh_status_param_tcase ());
- suite_add_tcase (s, event_refresh_status_assoc_tcase());
- suite_add_tcase (s, event_refresh_status_cco_tcase());
- suite_add_tcase (s, event_refresh_status_cco_preferred_tcase());
- suite_add_tcase (s, event_refresh_status_cco_backup_tcase());
- suite_add_tcase (s, event_refresh_status_sc_tcase());
- suite_add_tcase (s, event_refresh_check_sc_start_tcase ());
- return s;
-}
-
-int main(void)
-{
- Suite *s = suite_create ("event");
- int number_failed = 0;
- SRunner *sr = srunner_create(s);
- srunner_add_suite (sr, event_suite ());
- //srunner_set_fork_status (sr, CK_NOFORK);
- srunner_set_fork_status (sr, CK_FORK);
- srunner_run_all(sr, CK_NORMAL);
- number_failed = srunner_ntests_failed(sr);
- srunner_free(sr);
-
- return (number_failed == 0) ? 0 : -1;
-}
-
diff --git a/cleopatre/devkit/tests/plcd/src/hpav_utests.c b/cleopatre/devkit/tests/plcd/src/hpav_utests.c
deleted file mode 100644
index 5e6c2d2f3d..0000000000
--- a/cleopatre/devkit/tests/plcd/src/hpav_utests.c
+++ /dev/null
@@ -1,375 +0,0 @@
-/* Cleopatre project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file hpav_utests.c
- * \brief Unitary tests for plcd
- * \ingroup Cleopatre - plcd
- *
- * This file content all the unitary tests for hpav, part of plcd
- * (the interface between the PLC driver and the Linux filesystem).
- */
-
-#include <check.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <sys/time.h> /* for select() */
-#include <linux/if_ether.h> /* for ETH_ALEN */
-#include <unistd.h>
-#include <errno.h>
-#include "plcd.h"
-#include "hpav_utests.h"
-
-#define DEBUG 1
-
-#ifdef DEBUG
-#define TRACE(...) printf("HPAV UTESTS: " __VA_ARGS__)
-#else
-#define TRACE(...)
-#endif
-
-/** local defines */
-#define MAC_ADDR "AA:BB:CC:12:34:56" /* mac addr that will be used for testing */
-#define PLC_ADDR "FF:EE:DD:98:76:54" /* mac addr that will be used for testing */
-
-/** local variables */
-plcd_ctx_t plcd_ctx;
-plcd_ctx_t *ctx = &plcd_ctx;
-
-unsigned char msg_buf[ETH_FRAME_LEN]; /* local buffer to store netlink messages */
-
-/*
- ######################################
- # FUNCTION STUB
- # (redefinition of glibc functions)
- ######################################
-*/
-ssize_t sendmsg (int socket, const struct msghdr *message, int flags)
-{
- struct nlmsghdr *nlh;
-
- nlh = (struct nlmsghdr *)(message->msg_iov->iov_base);
-
- /* store message to local buffer */
- memcpy(msg_buf, nlh, message->msg_iov->iov_len);
-
- return 1;
-}
-
-int recvmsg(int s, struct msghdr *message, int flags)
-{
- struct nlmsghdr *nlh;
- MME_t *mme_hdr;
-
- nlh = (struct nlmsghdr *)(message->msg_iov->iov_base);
- mme_hdr = (MME_t *)NLMSG_DATA(msg_buf);
-
- /* change mme type to CNF */
- mme_hdr->mmtype = (mme_hdr->mmtype & ~MME_TYPE_MASK) | MME_TYPE_CNF;
-
- /* copy local buffer to response message */
- memcpy(nlh, msg_buf, message->msg_iov->iov_len);
-
- return 1;
-}
-
-int select(int nfds, fd_set *readfds, fd_set *writefds,
- fd_set *exceptfds, struct timeval *timeout)
-{
- return 1;
-}
-
-
-
-/* fixtures - run before and after each unit test */
-void setup(void)
-{
- int i;
- char pa[] = PLC_ADDR;
- char *s, *e;
-
- ctx->hardware_info_path = (char *)malloc(64);
- ctx->hpav_info_path = (char *)malloc(64);
- ctx->hpav_conf_path = (char *)malloc(64);
-
- /* initialize plcd context */
- strcpy(ctx->hardware_info_path, LIBSPID_HARDWARE_INFO_PATH);
- strcpy(ctx->hpav_info_path, LIBSPID_HPAV_INFO_PATH);
- strcpy(ctx->hpav_conf_path, LIBSPID_HPAV_CONF_PATH);
- ctx->plc_sock = 0;
- ctx->nvram = (spc300_nvram_t *) malloc(sizeof(spc300_nvram_t));
- s = pa;
- for (i = 0; i < 6; ++i)
- {
- ctx->nvram->plc_address[i] = s ? strtoul (s, &e, 16) : 0;
- if (s)
- s = (*e) ? e + 1 : e;
- }
-
-}
-
-void teardown(void)
-{
-}
-
-/* --- TEST PROCEDURES --- */
-
-/** test procedures */
-START_TEST (test_hpav_send_mac_address)
-{
- int ret;
- struct nlmsghdr *nlh;
- unsigned char *payload= NLMSG_DATA(msg_buf) + sizeof(MME_t);
-
- //Check arguments
- ret = hpav_send_mac_address(ctx, MAC_ADDR);
- fail_if( ret != 0, "hpav_send_mac_address fail" );
- fail_if( memcmp(payload, MAC_ADDR, ETH_ALEN) != 0, "hpav_send_mac_address sends wrong payload" );
-
-}
-END_TEST
-
-
-START_TEST (test_hpav_send_cco_preferred)
-{
- int ret;
- struct nlmsghdr *nlh;
- unsigned char *payload= NLMSG_DATA(msg_buf) + sizeof(MME_t);
- const unsigned char is_cco_preferred = 5;
-
- ret = hpav_send_cco_preferred (ctx, is_cco_preferred);
- fail_if( ret != 0, "hpav_send_cco_preferred fail" );
- fail_if( memcmp(payload, &is_cco_preferred, 1) != 0, "hpav_send_cco_preferred sends wrong payload" );
-}
-END_TEST
-
-START_TEST (test_hpav_send_was_cco)
-{
- int ret;
- struct nlmsghdr *nlh;
- unsigned char *payload= NLMSG_DATA(msg_buf) + sizeof(MME_t);
- const unsigned char was_cco = 6;
-
- ret = hpav_send_was_cco(ctx, was_cco);
- fail_if( ret != 0, " fail" );
- fail_if( memcmp(payload, &was_cco, 1) != 0, "hpav_send_was_cco sends wrong payload" );
-}
-END_TEST
-
-START_TEST (test_hpav_compute_nmk)
-{
- /* XXX: TBD */
-}
-END_TEST
-
-START_TEST (test_hpav_send_key)
-{
- int ret;
- int i;
- struct nlmsghdr *nlh;
- unsigned char *payload= NLMSG_DATA(msg_buf) + sizeof(MME_t);
- unsigned char nmk[16];
- unsigned char nid[7];
- char sl[16];
- char c;
-
- for (i=0; i<16; i++)
- nmk[i] = 0xA;
- for (i=0; i<7; i++)
- nid[i] = 0xE;
- strcpy(sl, LIBSPID_HPAV_CONF_VALUE_SL_HS);
- ret = hpav_send_key(ctx, nmk, nid, sl);
- fail_if( ret != 0, " fail" );
-
- fail_if( memcmp(payload, nmk, 16) != 0, "hpav_send_key sends wrong nmk" );
- i = 0x1;
- fail_if( memcmp(payload + 16, &i, 1) != 0, "hpav_send_key sends wrong payload" );
- fail_if( memcmp(payload + 16 + 8, &i, 1) != 0, "hpav_send_key sends wrong payload" );
- for (i=0; i<8; i++)
- sl[i] = '\0';
- fail_if( memcmp(payload + 16 + 1, sl, 7) != 0, "hpav_send_key sends wrong payload" );
-
- ret = hpav_send_key(ctx, nmk, nid, NULL);
- fail_if( ret != 0, " fail" );
-
- fail_if( memcmp(payload, nmk, 16) != 0, "hpav_send_key sends wrong nmk" );
- c = '\0';
- fail_if( memcmp(payload + 16, &c, 1) != 0, "hpav_send_key sends wrong payload" );
- fail_if( memcmp(payload + 16 + 1, nid, 7) != 0, "hpav_send_key sends wrong payload" );
- fail_if( memcmp(payload + 16 + 1 + 7, &c, 1) != 0, "hpav_send_key sends wrong payload" );
-}
-END_TEST
-
-START_TEST (test_hpav_compute_dak)
-{
- /* XXX: TBD */
-}
-END_TEST
-
-START_TEST (test_hpav_send_dak)
-{
- int ret;
- int i;
- struct nlmsghdr *nlh;
- unsigned char *payload= NLMSG_DATA(msg_buf) + sizeof(MME_t);
- unsigned char dak[16];
-
- for (i=0; i<16; i++)
- dak[i] = i;
-
- ret = hpav_send_dak(ctx, &dak);
- fail_if( ret != 0, "hpav_send_dak fail" );
- fail_if( memcmp(payload, &dak, 16) != 0, "hpav_send_dak sends wrong payload" );
-}
-END_TEST
-
-START_TEST (test_hpav_send_mfg_hfid)
-{
- int ret;
- int i;
- struct nlmsghdr *nlh;
- unsigned char *payload= NLMSG_DATA(msg_buf) + sizeof(MME_t);
- char mfg_hfid[64];
-
- for (i=0; i<64; i++)
- mfg_hfid[i] = i;
-
- ret = hpav_send_mfg_hfid (ctx, &mfg_hfid);
- fail_if( ret != 0, "hpav_send_mfg_hfid fail" );
- fail_if( memcmp(payload, &mfg_hfid, 64) != 0, "hpav_send_mfg_hfid sends wrong payload" );
-}
-END_TEST
-
-START_TEST (test_hpav_send_user_hfid)
-{
- int ret;
- int i;
- struct nlmsghdr *nlh;
- unsigned char *payload= NLMSG_DATA(msg_buf) + sizeof(MME_t);
- char user_hfid[64];
-
- for (i=0; i<64; i++)
- user_hfid[i] = i;
-
- ret = hpav_send_user_hfid(ctx, &user_hfid);
- fail_if( ret != 0, "hpav_send_user_hfid fail" );
- fail_if( memcmp(payload, &user_hfid, 64) != 0, "hpav_send_user_hfid sends wrong payload" );
-}
-END_TEST
-
-START_TEST (test_hpav_send_avln_hfid)
-{
- int ret;
- int i;
- struct nlmsghdr *nlh;
- unsigned char *payload= NLMSG_DATA(msg_buf) + sizeof(MME_t);
- char avln_hfid[64];
-
- for (i=0; i<64; i++)
- avln_hfid[i] = i;
-
- ret = hpav_send_avln_hfid(ctx, &avln_hfid);
- fail_if( ret != 0, "hpav_send_avln_hfid fail" );
- fail_if( memcmp(payload, &avln_hfid, 64) != 0, "hpav_send_avln_hfid sends wrong payload" );
-}
-END_TEST
-
-
-START_TEST (test_hpav_send_tonemask)
-{
- int ret;
- int i;
- struct nlmsghdr *nlh;
- unsigned char *payload= NLMSG_DATA(msg_buf) + sizeof(MME_t);
- char tonemask[192];
-
- for (i=0; i<192; i++)
- tonemask[i] = i;
-
- ret = hpav_send_tonemask(ctx, &tonemask);
- fail_if( ret != 0, "hpav_send_tonemask fail" );
- fail_if( memcmp(payload, &tonemask, 192) != 0, "hpav_send_tonemask sends wrong payload" );
-}
-END_TEST
-
-START_TEST (test_hpav_send_start)
-{
- int ret;
- struct nlmsghdr *nlh;
- unsigned char *payload= NLMSG_DATA(msg_buf) + sizeof(MME_t);
-
- ret = hpav_send_start(ctx);
- fail_if( ret != 0, "hpav_send_start fail" );
-}
-END_TEST
-
-extern Suite* hpav_suite(void)
-{
- Suite *s = suite_create("HPAV");
- TCase *tc_core = tcase_create("Core");
-
- tcase_add_checked_fixture (tc_core, setup, teardown);
-
- //Test hpav_send_mac_address
- tcase_add_test(tc_core, test_hpav_send_mac_address);
-
- //Test hpav_send_cco_preferred
- tcase_add_test(tc_core, test_hpav_send_cco_preferred);
-
- //Test hpav_send_was_cco
- tcase_add_test(tc_core, test_hpav_send_was_cco);
-
- //Test hpav_compute_nmk
- tcase_add_test(tc_core, test_hpav_compute_nmk);
-
- //Test hpav_send_key
- tcase_add_test(tc_core, test_hpav_send_key);
-
- //Test hpav_compute_dak
- tcase_add_test(tc_core, test_hpav_compute_dak);
-
- //Test hpav_send_dak
- tcase_add_test(tc_core, test_hpav_send_dak);
-
- //Test hpav_send_mfg_hfid
- tcase_add_test(tc_core, test_hpav_send_mfg_hfid);
-
- //Test hpav_send_user_hfid
- tcase_add_test(tc_core, test_hpav_send_user_hfid);
-
- //Test hpav_send_avln_hfid
- tcase_add_test(tc_core, test_hpav_send_avln_hfid);
-
- //Test hpav_send_tonemask
- tcase_add_test(tc_core, test_hpav_send_tonemask);
-
- //Test hpav_send_start
- tcase_add_test(tc_core, test_hpav_send_start);
-
- suite_add_tcase(s, tc_core);
- return s;
-}
-
-int main(void)
-{
- int number_failed = 0;
- Suite *s;
-
- //Run hpav tests
- s = hpav_suite();
-
- SRunner *sr = srunner_create(s);
- //srunner_set_fork_status (sr, CK_NOFORK);
- srunner_set_fork_status (sr, CK_FORK);
- srunner_run_all(sr, CK_NORMAL);
- number_failed = srunner_ntests_failed(sr);
- srunner_free(sr);
-
- return (number_failed == 0) ? 0 : -1;
-}
-
diff --git a/cleopatre/devkit/tests/plcd/src/plcd_utests.c b/cleopatre/devkit/tests/plcd/src/plcd_utests.c
deleted file mode 100644
index 3e999f20e9..0000000000
--- a/cleopatre/devkit/tests/plcd/src/plcd_utests.c
+++ /dev/null
@@ -1,132 +0,0 @@
-/* Cleopatre project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file hpav_utests.c
- * \brief Unitary tests for plcd
- * \ingroup Cleopatre - plcd
- *
- * This file content all the unitary tests for plcd,
- * (interface between the PLC driver and the Linux filesystem).
- */
-
-#include <check.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <stdlib.h>
-#include <sys/time.h>
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>
-#include <unistd.h>
-#include <errno.h>
-#include <linux/if_packet.h>
-#include <linux/if_ether.h>
-#include <sys/ioctl.h>
-#include <net/if.h>
-#include <net/ethernet.h>
-#include <netinet/ether.h>
-
-#include <inttypes.h>
-#include <fcntl.h>
-#include <signal.h>
-
-#include <unistd.h>
-#include <pthread.h>
-#include <linux/if_tun.h>
-
-#include "plcd.h"
-#include "plcd_utests.h"
-
-#define DEBUG 1
-
-
-#ifdef DEBUG
-#define TRACE(...) printf("PLCD UTESTS: " __VA_ARGS__)
-#else
-#define TRACE(...)
-#endif
-
-/** local variables */
-plcd_ctx_t plcd_ctx;
-plcd_ctx_t *ctx = &plcd_ctx;
-
-#if 0
-/* fixtures - run before and after each unit test */
-void setup(void)
-{
-}
-
-void teardown(void)
-{
-}
-#endif
-
-/* --- TEST PROCEDURES --- */
-
-/** test procedures */
-START_TEST (test_plcd_init)
-{
- int ret;
-
- /* zero-out plcd ctx */
- memset(ctx, 0x0, sizeof(plcd_ctx_t));
-
- //Check arguments
- ret = plcd_init(ctx);
- fail_if( 0 != ret, "plcd_init fail");
-
- TRACE("ctx->hardware_info_path=%s\n", ctx->hardware_info_path);
- TRACE("ctx->hpav_info_path=%s\n", ctx->hpav_info_path);
- TRACE("ctx->hpav_conf_path=%s\n", ctx->hpav_conf_path);
-
- fail_if( strcmp(ctx->hardware_info_path, LIBSPID_HARDWARE_INFO_PATH) != 0,
- "hardware_info_path was not correctly initialized" );
- fail_if( strcmp(ctx->hpav_info_path, LIBSPID_HPAV_INFO_PATH) != 0,
- "hpav_info_path was not correctly initialized" );
- fail_if( strcmp(ctx->hpav_conf_path, LIBSPID_HPAV_CONF_PATH) != 0,
- "hpav_conf_path was not correctly initialized" );
-
- /* close netlink fd opened in plcd_init() */
- plcd_uninit (ctx);
-}
-END_TEST
-
-extern Suite* plcd_suite(void)
-{
- Suite *s = suite_create("PLCD");
- TCase *tc_core = tcase_create("Core");
-
- //Test plcd_init
- tcase_add_test(tc_core, test_plcd_init);
-
- suite_add_tcase(s, tc_core);
- return s;
-}
-
-int main(void)
-{
- int number_failed = 0;
- Suite *s;
-
- //Run plcd tests
- s = plcd_suite();
-
- SRunner *sr = srunner_create(s);
- //srunner_set_fork_status (sr, CK_NOFORK);
- srunner_set_fork_status (sr, CK_FORK);
- srunner_run_all(sr, CK_NORMAL);
- number_failed = srunner_ntests_failed(sr);
- srunner_free(sr);
-
- return (number_failed == 0) ? 0 : -1;
-}
-
diff --git a/cleopatre/devkit/tests/plcdrv/arm/ftests/lo_ecos/Makefile b/cleopatre/devkit/tests/plcdrv/arm/ftests/lo_ecos/Makefile
index 286f3cb463..7e7acd5606 100644
--- a/cleopatre/devkit/tests/plcdrv/arm/ftests/lo_ecos/Makefile
+++ b/cleopatre/devkit/tests/plcdrv/arm/ftests/lo_ecos/Makefile
@@ -8,6 +8,6 @@ DEFS = -DLOOPBACK_DEBUG
TARGET_PROGRAMS = loopback
loopback_SOURCES = loopback.c
-loopback_MODULES = lib hal/hle
+loopback_MODULES = lib hal/hle hal/arch
include $(BASE)/common/make/top.mk
diff --git a/cleopatre/devkit/tests/plcdrv/arm/ftests/lo_ecos/src/loopback.c b/cleopatre/devkit/tests/plcdrv/arm/ftests/lo_ecos/src/loopback.c
index 3f9c843b25..87a62a0a0e 100644
--- a/cleopatre/devkit/tests/plcdrv/arm/ftests/lo_ecos/src/loopback.c
+++ b/cleopatre/devkit/tests/plcdrv/arm/ftests/lo_ecos/src/loopback.c
@@ -21,7 +21,6 @@
#include "hal/hle/ipmbox.h"
#include "hal/hle/defs.h"
#include "lib/utils.h"
-#include "hal/hle/inc/trace.h"
/** Debug mode */
#ifdef LOOPBACK_DEBUG
@@ -47,9 +46,6 @@ void mail_thread(cyg_addrword_t index)
while(1)
{
cyg_thread_delay(300);
-// diag_printf("ct=%d\n",my_counter);
- if(!my_counter)
- ipmbox_trace_print(ipmbox_ctx);
my_counter++;
}
}
diff --git a/cleopatre/devkit/tests/plcdrv/arm/ftests/wd_leon/Makefile b/cleopatre/devkit/tests/plcdrv/arm/ftests/wd_leon/Makefile
index 5a416e8f72..53347893d1 100644
--- a/cleopatre/devkit/tests/plcdrv/arm/ftests/wd_leon/Makefile
+++ b/cleopatre/devkit/tests/plcdrv/arm/ftests/wd_leon/Makefile
@@ -1,37 +1,7 @@
-BIN = wd_leon
-OBJPATH = obj
-SRCPATH = src
+BASE = ../../../../../../../cesar
-ifeq ($(CC_FOR_TARGET),) # direct compile
-CC = arm-linux-gcc
-CC_WITH_CFLAGS = $(CC) -I/opt/spidcom/spc300/usr/include -g -Os
-CC_WITHOUT_CFLAGS = $(CC)
-LINUX_DIR = ../../../../../../linux-2.6.25.10-spc300
-else # compile from buildroot
-CC_WITH_CFLAGS = $(CC)
-CC_WITHOUT_CFLAGS = $(CC_FOR_TARGET)
-endif
-EXTRA_CFLAGS = -I$(LINUX_DIR)/include/asm-arm/arch-spc300 -MMD
-LIBS =
+HOST_PROGRAMS = wd_leon
-SRCS = $(subst $(SRCPATH)/,,$(wildcard $(SRCPATH)/*.c))
-OBJS = $(addprefix $(OBJPATH)/,$(SRCS:.c=.o))
-DEPS = $(patsubst %o,%d,$(OBJS))
+wd_leon_SOURCES = wd_leon.c
-all: $(BIN)
-
-$(BIN): $(OBJPATH) $(OBJS)
- $(CC_WITHOUT_CFLAGS) -static -o $@ $(OBJS) $(LIBS)
-
-$(OBJPATH)/%.o: $(SRCPATH)/%.c
- $(CC_WITH_CFLAGS) $(EXTRA_CFLAGS) -o $@ -c $<
-
-$(OBJPATH):
- mkdir -p $(OBJPATH)
-
--include $(DEPS)
-
-.PHONY: all clean
-
-clean:
- rm -f $(OBJS) $(DEPS) $(BIN)
+include $(BASE)/common/make/top.mk
diff --git a/cleopatre/devkit/tests/plcdrv/arm/utests/Makefile b/cleopatre/devkit/tests/plcdrv/arm/utests/Makefile
index 6042aa45ed..5367a5264b 100644
--- a/cleopatre/devkit/tests/plcdrv/arm/utests/Makefile
+++ b/cleopatre/devkit/tests/plcdrv/arm/utests/Makefile
@@ -1,7 +1,21 @@
-PRJ_BASE = ../../../../plcdrv/arm
-FILES = hal
-FILES += mailbox
-FILES += processing
-#FILES += linux_drv
+BASE = ../../../../../../cesar
+CLEO_BASE = ../cleopatre
-include ../../../utests_makerules
+# We test PLCDrv.
+PROJECT_DIR = $(CLEO_BASE)/devkit/plcdrv/arm/
+
+LINUX_STUB_BASE = $(CLEO_BASE)/devkit/tests/plcdrv/arm/utests/stub/linux
+
+INCLUDES = $(PROJECT_DIR)/inc $(LINUX_STUB_BASE)/inc
+
+EXTRA_HOST_LDLIBS = -lcheck
+
+DEFS = -D__UTESTS__ -DDRV_VERSION=\"test\"
+
+#Do not compile linux_drv_utests, mailbox_utests and processing_utests
+HOST_PROGRAMS = hal_utests
+
+hal_utests_SOURCES = hal_utests.c
+hal_utests_MODULES = $(PROJECT_DIR) $(LINUX_STUB_BASE)
+
+include $(BASE)/common/make/top.mk
diff --git a/cleopatre/devkit/tests/plcdrv/arm/utests/inc/linux_drv_utests.h b/cleopatre/devkit/tests/plcdrv/arm/utests/inc/linux_drv_utests.h
index d113446741..f58f615ce1 100644
--- a/cleopatre/devkit/tests/plcdrv/arm/utests/inc/linux_drv_utests.h
+++ b/cleopatre/devkit/tests/plcdrv/arm/utests/inc/linux_drv_utests.h
@@ -21,187 +21,15 @@
#include <stdint.h>
#include <string.h>
+#include "registers.h"
+
/****************************************************/
/***** SPECIFIC STUB *****/
/****************************************************/
-unsigned char plccode[124];
-#define VIRT_PLCCODE_BASE (&plccode[0])
-#define MBX_BASE_ADDR 0x1234567
-#define NB_MBX_REGISTERS 8
-#define INT_MBX 12
-#define INT_MBX_ACK 13
-static inline int processing_init(struct init_info *info){return 0;}
-static inline int processing_uninit(void){return 0;}
-static inline int processing_send(void *pointer, int length){return 0;}
-static inline int processing_buffer_add(void *pointer, enum buffer_type type){return 0;}
-
-static inline int mailbox_buffer_add(void *pointer, enum buffer_type type){return 0;}
-static inline int mailbox_receive(void){return 0;}
-static inline int mailbox_txdone(void){return 0;}
/****************************************************/
/***** LINUX STUB *****/
/****************************************************/
-#define kfree free
-#define printk(...)
-#define irqreturn_t int
-#define jiffies 1234
-#define IRQ_HANDLED 1
-#define IRQ_NONE 0
-#define EOPNOTSUPP 1
-#define EINVAL 1
-#define ENODEV 1
-#define ENOMEM 1
-#define EFAULT 1
-#define EPERM 1
-#define KERN_ERR
-#define __init
-#define __exit
-#define __devinitdata
-#define __user
-#define MODULE_AUTHOR(a)
-#define MODULE_DESCRIPTION(a)
-#define MODULE_LICENSE(a)
-#define MODULE_PARM_DESC(a,b)
-#define module_param(a,b,c)
-#define module_init(a)
-#define module_exit(a)
-#define DMA_BIDIRECTIONAL 1
-#define GFP_KERNEL 1
-#define GFP_DMA 1
-#define DMA_FROM_DEVICE 1
-#define DMA_TO_DEVICE 1
-#define CHECKSUM_UNNECESSARY 1
-#define TASK_INTERRUPTIBLE 1
-#define HZ 100
-
-typedef irqreturn_t (*irq_handler_t)(int, void *);
-
-struct file {
- unsigned int not_used;
-};
-struct list_head {
- struct list_head *next, *prev;
-};
-struct sk_buff {
- unsigned char *data;
- struct net_device *dev;
- unsigned int len;
- unsigned short protocol;
- unsigned char ip_summed;
-};
-struct net_device_stats {
- unsigned long rx_packets;
- unsigned long tx_packets;
- unsigned long rx_bytes;
- unsigned long tx_bytes;
- unsigned long rx_dropped;
- unsigned long tx_dropped;
- unsigned long tx_fifo_errors;
-};
-struct ifreq {
- char dummy;
-};
-#define ETH_ALEN 6
-struct ethhdr {
- unsigned char h_dest[ETH_ALEN];
- unsigned char h_source[ETH_ALEN];
- unsigned short h_proto;
-};
-struct sockaddr {
- char sa_data[14];
-};
-struct net_device {
- char name[16];
- unsigned long base_addr;
- void *priv;
- unsigned char dev_addr[32];
- unsigned char addr_len;
- unsigned int irq;
- unsigned int mtu;
- unsigned long trans_start;
- int (*init)(struct net_device *dev);
- int (*hard_start_xmit)(struct sk_buff *skb, struct net_device *dev);
- int (*open)(struct net_device *dev);
- int (*stop)(struct net_device *dev);
- int (*set_mac_address)(struct net_device *dev, void *addr);
- struct net_device_stats* (*get_stats)(struct net_device *dev);
- int (*do_ioctl)(struct net_device *dev, struct ifreq *ifr, int cmd);
- int (*change_mtu)(struct net_device *dev, int new_mtu);
-};
-
-static inline void set_current_state(int state){}
-static inline void schedule_timeout(int timeout){}
-static inline void *ioremap(unsigned long phys_addr, unsigned int size){return (void*)phys_addr;}
-static inline void iounmap(void* addr){}
-static inline void ether_setup(struct net_device *dev){}
-static inline unsigned short eth_type_trans(struct sk_buff *skb, struct net_device *dev){return 5;}
-static inline void netif_carrier_on(struct net_device *dev){}
-static inline void netif_start_queue(struct net_device *dev){}
-static inline void netif_carrier_off(struct net_device *dev){}
-static inline void netif_stop_queue(struct net_device *dev){}
-static inline void netif_wake_queue(struct net_device *dev){}
-static inline int netif_rx(struct sk_buff *skb){return 0;}
-static inline int netif_queue_stopped(const struct net_device *dev){return 0;}
-static inline int register_netdev(struct net_device *dev){return 0;}
-static inline void unregister_netdev(struct net_device *dev){}
-static inline int request_irq(unsigned int irq, irq_handler_t handler, unsigned long irqflags, const char *devname, void *dev_id){return 0;}
-static inline void free_irq(unsigned int irq, void *dev_id){}
-static inline unsigned int virt_to_dma(void* dev, unsigned int addr){return addr;}
-static inline unsigned int dma_to_virt(void* dev, unsigned int addr){return addr;}
-static inline unsigned int dma_map_single(void *dev, void *ptr, unsigned int size, int dir){return (unsigned int)ptr;}
-static inline void dma_unmap_single(void *dev, unsigned int dma_addr, unsigned int size, int dir){}
-static inline void* dma_alloc_coherent(int *dummy, unsigned int size, unsigned int *handle, int gfp){return (void*)handle;}
-static inline void dma_free_coherent(int *dummy, unsigned int size, void *cpu_addr, unsigned int handle){}
-static inline struct sk_buff *alloc_skb(unsigned int size, int priority)
-{
- struct sk_buff* skb;
- skb = (struct sk_buff*)malloc((unsigned int)(sizeof(struct sk_buff)));
- return skb;
-}
-static inline void kfree_skb(struct sk_buff *skb)
-{
- if(skb)
- free(skb);
-}
-static inline struct net_device *alloc_netdev(int sizeof_priv, const char *name, void (*setup)(struct net_device *))
-{
- struct net_device* dev;
- dev = (struct net_device*)malloc((unsigned int)(sizeof(struct net_device)));
- dev->priv = malloc((unsigned int)(sizeof_priv));
- return dev;
-}
-static inline void free_netdev(struct net_device* dev)
-{
- if(dev->priv)
- free(dev->priv);
- free((void*)(dev));
-}
-static inline int copy_to_user(void *to, const void *from, unsigned long n)
-{
- if(n)
- {
- memcpy(to, from, sizeof(plccode));
- return 0;
- }
- else
- {
- return -1;
- }
-}
-static inline int copy_from_user(void *to, const void *from, unsigned long n)
-{
- if(n)
- {
- memcpy(to, from, sizeof(plccode));
- return 0;
- }
- else
- {
- return -1;
- }
-}
-
/****************************************************/
/***** STATIC FUNCTION PROTOTYPES *****/
diff --git a/cleopatre/devkit/tests/plcdrv/arm/utests/inc/mailbox_utests.h b/cleopatre/devkit/tests/plcdrv/arm/utests/inc/mailbox_utests.h
index 3bb12a70b6..4d161d65fb 100644
--- a/cleopatre/devkit/tests/plcdrv/arm/utests/inc/mailbox_utests.h
+++ b/cleopatre/devkit/tests/plcdrv/arm/utests/inc/mailbox_utests.h
@@ -32,11 +32,6 @@
/****************************************************/
/***** SPECIFICS VARIABLES *****/
/****************************************************/
-static int nbtests_A2L_status_queue = 0;
-static int nbtests_L2A_status_queue = 0;
-uint32_t mbx_send_result[2];
-uint32_t mbx_buffer_add_result[2];
-uint32_t mbx_rx_ptr_result;
/****************************************************/
/***** LOWER STUB *****/
diff --git a/cleopatre/devkit/tests/plcdrv/arm/utests/src/hal_utests.c b/cleopatre/devkit/tests/plcdrv/arm/utests/src/hal_utests.c
index 0a4dfc9638..57cd7db0b1 100644
--- a/cleopatre/devkit/tests/plcdrv/arm/utests/src/hal_utests.c
+++ b/cleopatre/devkit/tests/plcdrv/arm/utests/src/hal_utests.c
@@ -18,6 +18,9 @@
#include <stdio.h>
#include <string.h>
#include "hal.h"
+#include "common.h"
+
+#include "inc/hal_utests.h"
/** local defines */
#define L2A_RING_BASE_ADDR ((uint32_t)&MBX_ring[A2L_RING_SIZE/4])
diff --git a/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/Module b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/Module
new file mode 100644
index 0000000000..c0143da23f
--- /dev/null
+++ b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/Module
@@ -0,0 +1,2 @@
+SOURCES := af_netlink.c afe.c bitops.c char_dev.c delay.c dma.c eth.c \
+ ioremap.c irq_manage.c mutex.c net_dev.c softirq.c uaccess.c wait.c
diff --git a/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/asm/arch/hardware/regbank.h b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/asm/arch/hardware/regbank.h
new file mode 100644
index 0000000000..bbcc8e4de8
--- /dev/null
+++ b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/asm/arch/hardware/regbank.h
@@ -0,0 +1,13 @@
+#ifndef stub_linux_inc_linux_asm_arch_hardware_regbank_h
+#define stub_linux_inc_linux_asm_arch_hardware_regbank_h
+
+#include <linux/types.h>
+
+#define RB_LEON_ADD_START (0x120)
+#define RB_RST_GROUP_VA (*(volatile uint32_t *)0x12345678)
+#define RB_RST_MODULE_VA (*(volatile uint32_t *)0x87654321)
+#define RB_RST_GLOBAL_VA (*(volatile uint32_t *)0x55555555)
+#define RST_LEONSS (0x8)
+#define RST_LCPU (0x800)
+
+#endif /* stub_linux_inc_linux_asm_arch_hardware_regbank_h */
diff --git a/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/asm/arch/nvram.h b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/asm/arch/nvram.h
new file mode 100644
index 0000000000..180868a766
--- /dev/null
+++ b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/asm/arch/nvram.h
@@ -0,0 +1,37 @@
+#ifndef stub_linux_inc_linux_asm_arch_nvram_h
+#define stub_linux_inc_linux_asm_arch_nvram_h
+
+typedef struct
+{
+ char magic[8]; // Magic number "NVRAM\0\0\0"
+ uint32_t pkg_cfg; // SPC300 package configuration register
+ uint32_t gpio_0_7_cfg; // SPC300 GPIO 0 to 7 configuration register
+ uint32_t gpio_8_15_cfg; // SPC300 GPIO 8 to 15 configuration register
+ uint32_t gpio_allow_dir; // SPC300 GPIO allowed directions 0:none 1:in 2:out 3:bi
+ uint32_t sdram_config; // SPC300 SDRAM configuration register
+ uint32_t sdram_timing0; // SPC300 SDRAM timing register 0
+ uint32_t sdram_timing1; // SPC300 SDRAM timing register 1
+ uint32_t sdram_refresh; // SPC300 SDRAM refresh register
+ uint32_t flash_org; // Flash organization
+ uint32_t img_0_offset; // Offset of first image address
+ uint32_t nb_images; // Max Number of Images present in flash
+ char product_name[64]; // Product short name in string format
+ char product_partnb[64]; // Product part number in string format
+ char product_desc[128]; // Product long description in string format
+ char serial_number[64]; // Product serial number in string format
+ uint32_t eth_phy_addr; // Address of Ethernet PHY
+ unsigned char eth_address[6]; // Ethernet MAC address
+ unsigned char reserved1[2];
+ unsigned char plc_address[6]; // PowerLine MAC address
+ unsigned char reserved2[2];
+ char device_password[32]; // HomePlugAV device unique password (DPW)
+ char oem_info[64]; // Additional information for OEM
+ unsigned char tonemask[192]; // HomePlugAV tonemask
+ char manufactory_info[64]; // Name of the product manufacturer
+ uint32_t img_max_size; // Max size of an image in flash
+ uint32_t cpu_partnb; // SPC3x0 partnb
+} spc300_nvram_t; //Currently __attribute__((packed)) not needed
+
+extern spc300_nvram_t spc300_nvram;
+
+#endif /* stub_linux_inc_linux_asm_arch_nvram_h */
diff --git a/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/afe.h b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/afe.h
new file mode 100644
index 0000000000..641ca36b66
--- /dev/null
+++ b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/afe.h
@@ -0,0 +1,8 @@
+#ifndef stub_linux_inc_linux_afe_h
+#define stub_linux_inc_linux_afe_h
+
+#include <linux/types.h>
+
+extern int afe_write_reg(uint8_t reg, uint8_t val);
+
+#endif /* stub_linux_inc_linux_afe_h */
diff --git a/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/asm.h b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/asm.h
new file mode 100644
index 0000000000..20254883f1
--- /dev/null
+++ b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/asm.h
@@ -0,0 +1,70 @@
+#ifndef stub_linux_inc_linux_asm_h
+#define stub_linux_inc_linux_asm_h
+
+/** All stubs from linux/asm directory. */
+
+#include <linux/compiler.h>
+
+/* types.h */
+typedef unsigned char __u8;
+typedef unsigned short __u16;
+typedef unsigned int __u32;
+typedef unsigned short umode_t;
+typedef int ssize_t;
+
+/* atomic.h */
+typedef struct { volatile int counter; } atomic_t;
+#define ATOMIC_INIT(i) { (i) }
+#define atomic_read(v) ((v)->counter)
+#define atomic_set(v,i) (((v)->counter) = (i))
+
+/* rwsem.h */
+struct rw_semaphore {};
+
+/* poll.h */
+#define POLLPRI 0x0002
+#define POLLERR 0x0008
+
+/* bug.h */
+#define BUG_ON(condition) do { if (condition) {} } while(0)
+
+/* processor.h */
+static inline void prefetch(const void *ptr)
+{
+}
+
+#include <stdlib.h> /* for malloc & free */
+#include <string.h> /* for memset */
+#include <stdio.h> /* for sprintf */
+/* did not find these... */
+static inline void * kmalloc(int size, int flags)
+{
+ return NULL;
+}
+static inline void kfree(void * ptr)
+{
+}
+/* arch-spc300/irqs.h */
+#define INT_MBX 12
+#define INT_MBX_ACK 13
+#define INT_MBX_WD 13
+
+/* arch/param.h */
+#define HZ 100
+
+/* io.h */
+#define MT_DEVICE 0
+extern void * __arm_ioremap(unsigned long phys_addr, size_t size, unsigned int mtype);
+#define ioremap(cookie,size) __arm_ioremap(cookie, size, MT_DEVICE)
+extern void __iounmap(volatile void *addr);
+#define iounmap(cookie) __iounmap(cookie)
+
+/* memory.h */
+#define virt_to_dma(dev, addr) ((int) addr)
+#define dma_to_virt(dev, addr) ((int) addr)
+
+/* uaccess.h */
+extern unsigned long copy_from_user(void *to, const void __user *from, unsigned long n);
+extern unsigned long copy_to_user(void __user *to, const void *from, unsigned long n);
+
+#endif /* stub_linux_inc_linux_asm_h */
diff --git a/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/bitops.h b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/bitops.h
new file mode 100644
index 0000000000..83a16882b6
--- /dev/null
+++ b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/bitops.h
@@ -0,0 +1,6 @@
+#ifndef inc_linux_asm_bitops_h
+#define inc_linux_asm_bitops_h
+
+extern inline int test_bit(int nr, const volatile unsigned long *addr);
+
+#endif /* inc_linux_asm_bitops_h */
diff --git a/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/capability.h b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/capability.h
new file mode 100644
index 0000000000..7fbd3051c6
--- /dev/null
+++ b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/capability.h
@@ -0,0 +1,14 @@
+#ifndef stub_linux_inc_linux_capability_h
+#define stub_linux_inc_linux_capability_h
+
+#include <linux/types.h>
+
+#define _LINUX_CAPABILITY_U32S_3 2
+
+#define _KERNEL_CAPABILITY_U32S _LINUX_CAPABILITY_U32S_3
+
+typedef struct kernel_cap_struct {
+ __u32 cap[_KERNEL_CAPABILITY_U32S];
+} kernel_cap_t;
+
+#endif /* stub_linux_inc_linux_capability_h */
diff --git a/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/cdev.h b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/cdev.h
new file mode 100644
index 0000000000..168a437b50
--- /dev/null
+++ b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/cdev.h
@@ -0,0 +1,22 @@
+#ifndef stub_linux_inc_linux_cdev_h
+#define stub_linux_inc_linux_cdev_h
+
+#include <linux/module.h>
+#include <linux/fs.h>
+#include <linux/list.h>
+
+struct cdev {
+ struct module *owner;
+ const struct file_operations *ops;
+ struct list_head list;
+ dev_t dev;
+ unsigned int count;
+};
+
+extern void cdev_init(struct cdev *, const struct file_operations *);
+
+extern int cdev_add(struct cdev *, dev_t, unsigned);
+
+extern void cdev_del(struct cdev *);
+
+#endif /* stub_linux_inc_linux_cdev_h */
diff --git a/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/compiler.h b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/compiler.h
new file mode 100644
index 0000000000..bbe302a179
--- /dev/null
+++ b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/compiler.h
@@ -0,0 +1,8 @@
+#ifndef stub_linux_inc_linux_compiler_h
+#define stub_linux_inc_linux_compiler_h
+
+#define unlikely(x) x
+
+#define __user
+
+#endif /* stub_linux_inc_linux_compiler_h */
diff --git a/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/delay.h b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/delay.h
new file mode 100644
index 0000000000..25860b2565
--- /dev/null
+++ b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/delay.h
@@ -0,0 +1,6 @@
+#ifndef inc_linux_delay_h
+#define inc_linux_delay_h
+
+extern unsigned long msleep_interruptible(unsigned int msecs);
+
+#endif /* inc_linux_delay_h */
diff --git a/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/device.h b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/device.h
new file mode 100644
index 0000000000..309238757a
--- /dev/null
+++ b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/device.h
@@ -0,0 +1,6 @@
+#ifndef stub_linux_inc_linux_device_h
+#define stub_linux_inc_linux_device_h
+
+struct device;
+
+#endif /* stub_linux_inc_linux_device_h */
diff --git a/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/dma-mapping.h b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/dma-mapping.h
new file mode 100644
index 0000000000..327c7d0773
--- /dev/null
+++ b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/dma-mapping.h
@@ -0,0 +1,28 @@
+#ifndef stub_linux_inc_linux_dma_mapping_h
+#define stub_linux_inc_linux_dma_mapping_h
+
+#include <linux/types.h>
+#include <linux/device.h>
+
+enum dma_data_direction {
+ DMA_BIDIRECTIONAL = 0,
+ DMA_TO_DEVICE = 1,
+ DMA_FROM_DEVICE = 2,
+ DMA_NONE = 3,
+};
+
+/* Actually in asm/dma-mapping.h... */
+extern void *
+dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *handle, gfp_t gfp);
+
+extern void
+dma_free_coherent(struct device *dev, size_t size, void *cpu_addr,
+ dma_addr_t handle);
+
+extern dma_addr_t dma_map_single(struct device *dev, void *ptr, size_t size,
+ enum dma_data_direction dir);
+
+extern void dma_unmap_single(struct device *dev, dma_addr_t dma_addr,
+ size_t size, enum dma_data_direction dir);
+
+#endif /* stub_linux_inc_linux_dma_mapping_h */
diff --git a/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/errno.h b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/errno.h
new file mode 100644
index 0000000000..7e8a432ba4
--- /dev/null
+++ b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/errno.h
@@ -0,0 +1,12 @@
+#ifndef stub_linux_inc_linux_errno_h
+#define stub_linux_inc_linux_errno_h
+
+#define EOPNOTSUPP 1
+#define EINVAL 1
+#define ENODEV 1
+#define ENOMEM 1
+#define EFAULT 1
+#define EPERM 1
+#define EBUSY 1
+
+#endif /* stub_linux_inc_linux_errno_h */
diff --git a/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/file.h b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/file.h
new file mode 100644
index 0000000000..9e68db0e87
--- /dev/null
+++ b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/file.h
@@ -0,0 +1,6 @@
+#ifndef stub_linux_inc_linux_file_h
+#define stub_linux_inc_linux_file_h
+
+struct file_operations;
+
+#endif /* stub_linux_inc_linux_file_h */
diff --git a/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/fs.h b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/fs.h
new file mode 100644
index 0000000000..b9d92707c1
--- /dev/null
+++ b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/fs.h
@@ -0,0 +1,125 @@
+#ifndef stub_linux_inc_linux_fs_h
+#define stub_linux_inc_linux_fs_h
+
+#include <linux/types.h>
+#include <linux/asm.h>
+#include <linux/file.h>
+#include <linux/list.h>
+#include <linux/rcupdate.h>
+#include <linux/path.h>
+#include <linux/module.h>
+#include <linux/mutex.h>
+
+struct fown_struct {};
+struct file_ra_state {};
+struct address_space {};
+struct poll_table_struct;
+
+struct file {
+ /*
+ * fu_list becomes invalid after file_free is called and queued via
+ * fu_rcuhead for RCU freeing
+ */
+ union {
+ struct list_head fu_list;
+ struct rcu_head fu_rcuhead;
+ } f_u;
+ struct path f_path;
+#define f_dentry f_path.dentry
+#define f_vfsmnt f_path.mnt
+ const struct file_operations *f_op;
+ atomic_t f_count;
+ unsigned int f_flags;
+ mode_t f_mode;
+ loff_t f_pos;
+ struct fown_struct f_owner;
+ unsigned int f_uid, f_gid;
+ struct file_ra_state f_ra;
+ u64 f_version;
+//#ifdef CONFIG_SECURITY
+// void *f_security;
+//#endif
+ /* needed for tty driver, and maybe others */
+ void *private_data;
+//#ifdef CONFIG_EPOLL
+// /* Used by fs/eventpoll.c to link all the hooks to this file */
+// struct list_head f_ep_links;
+// spinlock_t f_ep_lock;
+//#endif /* #ifdef CONFIG_EPOLL */
+ struct address_space *f_mapping;
+};
+
+struct inode {
+ struct hlist_node i_hash;
+ struct list_head i_list;
+ struct list_head i_sb_list;
+ struct list_head i_dentry;
+ unsigned long i_ino;
+ atomic_t i_count;
+ unsigned int i_nlink;
+ uid_t i_uid;
+ gid_t i_gid;
+ dev_t i_rdev;
+ u64 i_version;
+ loff_t i_size;
+//#ifdef __NEED_I_SIZE_ORDERED
+// seqcount_t i_size_seqcount;
+//#endif
+ struct timespec i_atime;
+ struct timespec i_mtime;
+ struct timespec i_ctime;
+ unsigned int i_blkbits;
+ blkcnt_t i_blocks;
+ unsigned short i_bytes;
+ umode_t i_mode;
+ spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */
+ struct mutex i_mutex;
+ struct rw_semaphore i_alloc_sem;
+ const struct inode_operations *i_op;
+ const struct file_operations *i_fop; /* former ->i_op->default_file_ops */
+ struct super_block *i_sb;
+ struct file_lock *i_flock;
+ struct address_space *i_mapping;
+ struct address_space i_data;
+//#ifdef CONFIG_QUOTA
+// struct dquot *i_dquot[MAXQUOTAS];
+//#endif
+ struct list_head i_devices;
+ union {
+ struct pipe_inode_info *i_pipe;
+ struct block_device *i_bdev;
+ struct cdev *i_cdev;
+ };
+ int i_cindex;
+ __u32 i_generation;
+//#ifdef CONFIG_DNOTIFY
+// unsigned long i_dnotify_mask; /* Directory notify events */
+// struct dnotify_struct *i_dnotify; /* for directory notifications */
+//#endif
+//#ifdef CONFIG_INOTIFY
+// struct list_head inotify_watches; /* watches on this inode */
+// struct mutex inotify_mutex; /* protects the watches list */
+//#endif
+ unsigned long i_state;
+ unsigned long dirtied_when; /* jiffies of first dirtying */
+ unsigned int i_flags;
+ atomic_t i_writecount;
+//#ifdef CONFIG_SECURITY
+// void *i_security;
+//#endif
+ void *i_private; /* fs or device private pointer */
+};
+
+struct file_operations {
+ struct module *owner;
+ ssize_t (*read) (struct file *, char *, size_t, loff_t *);
+ ssize_t (*write) (struct file *, const char *, size_t, loff_t *);
+ unsigned int (*poll) (struct file *, struct poll_table_struct *);
+ int (*open) (struct inode *, struct file *);
+ int (*release) (struct inode *, struct file *);
+};
+
+extern int alloc_chrdev_region(dev_t *, unsigned, unsigned, const char *);
+extern void unregister_chrdev_region(dev_t, unsigned);
+
+#endif /* stub_linux_inc_linux_fs_h */
diff --git a/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/gfp.h b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/gfp.h
new file mode 100644
index 0000000000..e74554b782
--- /dev/null
+++ b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/gfp.h
@@ -0,0 +1,10 @@
+#ifndef stub_linux_inc_linux_gfp_h
+#define stub_linux_inc_linux_gfp_h
+
+#define __GFP_HIGH ((gfp_t)0x20u)
+#define GFP_ATOMIC (__GFP_HIGH)
+
+#define GFP_KERNEL 1
+#define GFP_DMA 1
+
+#endif /* stub_linux_inc_linux_gfp_h */
diff --git a/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/if.h b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/if.h
new file mode 100644
index 0000000000..0641cbde81
--- /dev/null
+++ b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/if.h
@@ -0,0 +1,8 @@
+#ifndef stub_linux_inc_linux_if_h
+#define stub_linux_inc_linux_if_h
+
+struct ifreq {
+ char dummy;
+};
+
+#endif /* stub_linux_inc_linux_if_h */
diff --git a/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/if_ether.h b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/if_ether.h
new file mode 100644
index 0000000000..ae973e4d35
--- /dev/null
+++ b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/if_ether.h
@@ -0,0 +1,17 @@
+#ifndef stub_linux_inc_linux_if_ether_h
+#define stub_linux_inc_linux_if_ether_h
+
+#include <linux/types.h>
+
+#define ETH_P_8021Q 0x8100
+
+#define ETH_ALEN 6 /* Octets in one ethernet addr */
+#define ETH_HLEN 14 /*Total octets in header */
+
+struct ethhdr {
+ unsigned char h_dest[ETH_ALEN]; /* destination eth addr */
+ unsigned char h_source[ETH_ALEN]; /* source ether addr */
+ __be16 h_proto; /* packet type ID field */
+} __attribute__((packed));
+
+#endif /* stub_linux_inc_linux_if_ether_h */
diff --git a/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/if_vlan.h b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/if_vlan.h
new file mode 100644
index 0000000000..3c4db05de9
--- /dev/null
+++ b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/if_vlan.h
@@ -0,0 +1,20 @@
+#ifndef stub_linux_inc_linux_if_vlan_h
+#define stub_linux_inc_linux_if_vlan_h
+
+#include <linux/types.h>
+
+#define VLAN_ETH_ALEN 6
+#define VLAN_ETH_HLEN 18
+
+#define VLAN_VID_MASK 0x0fff
+
+struct vlan_ethhdr
+{
+ unsigned char h_dest[ETH_ALEN];
+ unsigned char h_source[ETH_ALEN];
+ unsigned short int h_vlan_proto;
+ unsigned short int h_vlan_TCI;
+ unsigned short int h_vlan_encapsulated_proto;
+} __attribute__((packed));
+
+#endif /* stub_linux_inc_linux_if_vlan_h */
diff --git a/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/init.h b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/init.h
new file mode 100644
index 0000000000..761d2e53b2
--- /dev/null
+++ b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/init.h
@@ -0,0 +1,11 @@
+#ifndef stub_linux_inc_linux_init_h
+#define stub_linux_inc_linux_init_h
+
+#define module_init(a)
+#define module_exit(a)
+
+#define __init
+#define __exit
+#define __devinitdata
+
+#endif /* stub_linux_inc_linux_init_h */
diff --git a/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/interrupt.h b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/interrupt.h
new file mode 100644
index 0000000000..bf7348ce88
--- /dev/null
+++ b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/interrupt.h
@@ -0,0 +1,38 @@
+#ifndef stub_linux_inc_linux_interrupt_h
+#define stub_linux_inc_linux_interrupt_h
+
+#include <linux/asm.h>
+#include <linux/irqreturn.h>
+
+typedef irqreturn_t (*irq_handler_t)(int, void *);
+
+struct tasklet_struct
+{
+ struct tasklet_struct *next;
+ unsigned long state;
+ atomic_t count;
+ void (*func)(unsigned long);
+ unsigned long data;
+};
+
+static inline void tasklet_enable(struct tasklet_struct *t)
+{
+}
+
+static inline void tasklet_disable(struct tasklet_struct *t)
+{
+}
+
+extern void tasklet_schedule(struct tasklet_struct *t);
+
+extern void tasklet_kill(struct tasklet_struct *t);
+
+extern void tasklet_init(struct tasklet_struct *t,
+ void (*func)(unsigned long), unsigned long data);
+
+extern int request_irq(unsigned int, irq_handler_t handler,
+ unsigned long, const char *, void *);
+
+extern void free_irq(unsigned int, void *);
+
+#endif /* stub_linux_inc_linux_interrupt_h */
diff --git a/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/irqreturn.h b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/irqreturn.h
new file mode 100644
index 0000000000..355bea55ca
--- /dev/null
+++ b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/irqreturn.h
@@ -0,0 +1,9 @@
+#ifndef stub_linux_inc_linux_irqreturn_h
+#define stub_linux_inc_linux_irqreturn_h
+
+#define IRQ_HANDLED 1
+#define IRQ_NONE 0
+
+typedef int irqreturn_t;
+
+#endif /* stub_linux_inc_linux_irqreturn_h */
diff --git a/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/kdev_t.h b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/kdev_t.h
new file mode 100644
index 0000000000..8429e6f0c9
--- /dev/null
+++ b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/kdev_t.h
@@ -0,0 +1,11 @@
+#ifndef stub_linux_inc_linux_kdev_t_h
+#define stub_linux_inc_linux_kdev_t_h
+
+#define MINORBITS 20
+#define MINORMASK ((1U << MINORBITS) - 1)
+
+#define MAJOR(dev) ((unsigned int) ((dev) >> MINORBITS))
+#define MINOR(dev) ((unsigned int) ((dev) & MINORMASK))
+#define MKDEV(ma,mi) (((ma) << MINORBITS) | (mi))
+
+#endif /* stub_linux_inc_linux_kdev_t_h */
diff --git a/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/kernel.h b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/kernel.h
new file mode 100644
index 0000000000..022d68bad7
--- /dev/null
+++ b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/kernel.h
@@ -0,0 +1,34 @@
+#ifndef stub_linux_inc_linux_kernel_h
+#define stub_linux_inc_linux_kernel_h
+
+/* from stddef.h */
+#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
+
+#define container_of(ptr, type, member) ({ \
+ const typeof( ((type *)0)->member ) *__mptr = (ptr); \
+ (type *)( (char *)__mptr - offsetof(type,member) );})
+
+#define min(x,y) ({ \
+ typeof(x) _x = (x); \
+ typeof(y) _y = (y); \
+ (void) (&_x == &_y); \
+ _x < _y ? _x : _y; })
+
+#define KERN_ERR "<3>"
+#define KERN_WARNING "<4>"
+#define KERN_INFO "<6>"
+
+static inline int printk(const char *s, ...)
+{
+ return 0;
+}
+
+/* from byteorder/generic.h */
+static inline unsigned short int ntohs(unsigned short int x)
+{
+ return x<<8 | x>>8;
+}
+
+#define be16_to_cpu(x) ((__u16)(__be16)(x))
+
+#endif /* stub_linux_inc_linux_kernel_h */
diff --git a/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/list.h b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/list.h
new file mode 100644
index 0000000000..64a8de0366
--- /dev/null
+++ b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/list.h
@@ -0,0 +1,71 @@
+#ifndef stub_linux_inc_linux_list_h
+#define stub_linux_inc_linux_list_h
+
+/* from linux/poison.h */
+#define LIST_POISON1 ((void *) 0x00100100)
+#define LIST_POISON2 ((void *) 0x00200200)
+
+struct hlist_node {
+ struct hlist_node *next, **pprev;
+};
+
+struct list_head {
+ struct list_head *next, *prev;
+};
+
+#define LIST_HEAD_INIT(name) { &(name), &(name) }
+
+#define list_entry(ptr, type, member) \
+ container_of(ptr, type, member)
+
+#define list_for_each_entry(pos, head, member) \
+ for (pos = list_entry((head)->next, typeof(*pos), member); \
+ prefetch(pos->member.next), &pos->member != (head); \
+ pos = list_entry(pos->member.next, typeof(*pos), member))
+
+#define list_for_each_entry_safe(pos, n, head, member) \
+ for (pos = list_entry((head)->next, typeof(*pos), member), \
+ n = list_entry(pos->member.next, typeof(*pos), member); \
+ &pos->member != (head); \
+ pos = n, n = list_entry(n->member.next, typeof(*n), member))
+
+static inline void INIT_LIST_HEAD(struct list_head *list)
+{
+ list->next = list;
+ list->prev = list;
+}
+
+static inline void __list_add(struct list_head *new,
+ struct list_head *prev,
+ struct list_head *next)
+{
+ next->prev = new;
+ new->next = next;
+ new->prev = prev;
+ prev->next = new;
+}
+
+static inline void list_add_tail(struct list_head *new, struct list_head *head)
+{
+ __list_add(new, head->prev, head);
+}
+
+static inline void __list_del(struct list_head * prev, struct list_head * next)
+{
+ next->prev = prev;
+ prev->next = next;
+}
+
+static inline void list_del(struct list_head *entry)
+{
+ __list_del(entry->prev, entry->next);
+ entry->next = LIST_POISON1;
+ entry->prev = LIST_POISON2;
+}
+
+static inline int list_empty(const struct list_head *head)
+{
+ return head->next == head;
+}
+
+#endif /* stub_linux_inc_linux_list_h */
diff --git a/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/module.h b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/module.h
new file mode 100644
index 0000000000..1cb1188291
--- /dev/null
+++ b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/module.h
@@ -0,0 +1,13 @@
+#ifndef stub_linux_inc_linux_module_h
+#define stub_linux_inc_linux_module_h
+
+struct module;
+
+#define THIS_MODULE ((struct module *)0)
+
+#define MODULE_AUTHOR(a)
+#define MODULE_DESCRIPTION(a)
+#define MODULE_LICENSE(a)
+#define MODULE_PARM_DESC(a,b)
+
+#endif /* stub_linux_inc_linux_module_h */
diff --git a/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/moduleparam.h b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/moduleparam.h
new file mode 100644
index 0000000000..d932f30e88
--- /dev/null
+++ b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/moduleparam.h
@@ -0,0 +1,6 @@
+#ifndef stub_linux_inc_linux_moduleparam_h
+#define stub_linux_inc_linux_moduleparam_h
+
+#define module_param(a,b,c)
+
+#endif /* stub_linux_inc_linux_moduleparam_h */
diff --git a/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/mutex.h b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/mutex.h
new file mode 100644
index 0000000000..d22eee7353
--- /dev/null
+++ b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/mutex.h
@@ -0,0 +1,30 @@
+#ifndef stub_linux_inc_linux_mutex_h
+#define stub_linux_inc_linux_mutex_h
+
+#include <linux/types.h>
+#include <linux/list.h>
+#include <linux/spinlock.h>
+
+struct mutex {
+ /* 1: unlocked, 0: locked, negative: locked, possible waiters */
+ atomic_t count;
+ spinlock_t wait_lock;
+ struct list_head wait_list;
+};
+
+#define __MUTEX_INITIALIZER(lockname) \
+ { .count = ATOMIC_INIT(1) \
+ , .wait_lock = __SPIN_LOCK_UNLOCKED(lockname.wait_lock) \
+ , .wait_list = LIST_HEAD_INIT(lockname.wait_list) }
+
+#define DEFINE_MUTEX(mutexname) \
+ struct mutex mutexname = __MUTEX_INITIALIZER(mutexname)
+
+/* mutex_lock is defined in libcheck too, so we have to stub it using */
+/* a different name... */
+#define mutex_lock my_mutex_lock
+extern void my_mutex_lock(struct mutex *lock);
+
+extern void mutex_unlock(struct mutex *lock);
+
+#endif /* stub_linux_inc_linux_mutex_h */
diff --git a/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/netdevice.h b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/netdevice.h
new file mode 100644
index 0000000000..2b9ab7ceb6
--- /dev/null
+++ b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/netdevice.h
@@ -0,0 +1,92 @@
+#ifndef stub_linux_inc_linux_netdevice_h
+#define stub_linux_inc_linux_netdevice_h
+
+#include <linux/types.h>
+#include <linux/skbuff.h>
+#include <linux/if.h>
+
+struct net_device_stats {
+ unsigned long rx_packets; /* total packets received */
+ unsigned long tx_packets; /* total packets transmitted */
+ unsigned long rx_bytes; /* total bytes received */
+ unsigned long tx_bytes; /* total bytes transmitted */
+ unsigned long rx_errors; /* bad packets received */
+ unsigned long tx_errors; /* packet transmit problems */
+ unsigned long rx_dropped; /* no space in linux buffers */
+ unsigned long tx_dropped; /* no space available in linux */
+ unsigned long multicast; /* multicast packets received */
+ unsigned long collisions;
+
+ /* detailed rx_errors: */
+ unsigned long rx_length_errors;
+ unsigned long rx_over_errors; /* receiver ring buff overflow */
+ unsigned long rx_crc_errors; /* recved pkt with crc error */
+ unsigned long rx_frame_errors; /* recv'd frame alignment error */
+ unsigned long rx_fifo_errors; /* recv'r fifo overrun */
+ unsigned long rx_missed_errors; /* receiver missed packet */
+
+ /* detailed tx_errors */
+ unsigned long tx_aborted_errors;
+ unsigned long tx_carrier_errors;
+ unsigned long tx_fifo_errors;
+ unsigned long tx_heartbeat_errors;
+ unsigned long tx_window_errors;
+
+ /* for cslip etc */
+ unsigned long rx_compressed;
+ unsigned long tx_compressed;
+};
+
+/* linux_drv_utests.h stub */
+struct net_device {
+ char name[16];
+ unsigned long base_addr;
+ void *priv;
+ unsigned char dev_addr[32];
+ unsigned char addr_len;
+ unsigned int irq;
+ unsigned int mtu;
+ unsigned long trans_start;
+ int (*init)(struct net_device *dev);
+ int (*hard_start_xmit)(struct sk_buff *skb, struct net_device *dev);
+ int (*open)(struct net_device *dev);
+ int (*stop)(struct net_device *dev);
+ int (*set_mac_address)(struct net_device *dev, void *addr);
+ struct net_device_stats* (*get_stats)(struct net_device *dev);
+ int (*do_ioctl)(struct net_device *dev, struct ifreq *ifr, int cmd);
+ int (*change_mtu)(struct net_device *dev, int new_mtu);
+};
+
+static inline void *netdev_priv(const struct net_device *dev)
+{
+ return dev->priv;
+}
+
+extern int register_netdev(struct net_device *dev);
+extern void unregister_netdev(struct net_device *dev);
+extern struct net_device *alloc_netdev(int sizeof_priv, const char *name,
+ void (*setup)(struct net_device *));
+extern void free_netdev(struct net_device* dev);
+
+extern int netif_rx(struct sk_buff *skb);
+extern void netif_carrier_on(struct net_device *dev);
+extern void netif_carrier_off(struct net_device *dev);
+static inline void netif_start_queue(struct net_device *dev)
+{
+}
+static inline void netif_stop_queue(struct net_device *dev)
+{
+}
+static inline void netif_wake_queue(struct net_device *dev)
+{
+}
+static inline int netif_queue_stopped(const struct net_device *dev)
+{
+ return 0;
+}
+
+extern void ether_setup(struct net_device *dev);
+/* from etherdevice.h */
+extern __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev);
+
+#endif /* stub_linux_inc_linux_netdevice_h */
diff --git a/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/netlink.h b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/netlink.h
new file mode 100644
index 0000000000..efc020fe48
--- /dev/null
+++ b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/netlink.h
@@ -0,0 +1,84 @@
+#ifndef stub_linux_inc_linux_netlink_h
+#define stub_linux_inc_linux_netlink_h
+
+#include <linux/types.h>
+#include <linux/socket.h>
+#include <linux/capability.h>
+#include <linux/skbuff.h>
+#include <linux/compiler.h>
+#include <linux/mutex.h>
+#include <linux/module.h>
+#include <net/net_namespace.h>
+#include <net/sock.h>
+
+#define NETLINK_PLC_DRV 20
+#define NETLINK_PLC_MME 21
+
+struct nlmsghdr
+{
+ __u32 nlmsg_len; /* Length of message including header */
+ __u16 nlmsg_type; /* Message content */
+ __u16 nlmsg_flags; /* Additional flags */
+ __u32 nlmsg_seq; /* Sequence number */
+ __u32 nlmsg_pid; /* Sending process port ID */
+};
+
+#define NLMSG_DONE 0x3
+
+#define NLMSG_ALIGNTO 4
+#define NLMSG_ALIGN(len) ( ((len)+NLMSG_ALIGNTO-1) & ~(NLMSG_ALIGNTO-1) )
+#define NLMSG_HDRLEN ((int) NLMSG_ALIGN(sizeof(struct nlmsghdr)))
+#define NLMSG_LENGTH(len) ((len)+NLMSG_ALIGN(NLMSG_HDRLEN))
+#define NLMSG_SPACE(len) NLMSG_ALIGN(NLMSG_LENGTH(len))
+#define NLMSG_DATA(nlh) ((void*)(((char*)nlh) + NLMSG_LENGTH(0)))
+
+static inline struct nlmsghdr *nlmsg_hdr(const struct sk_buff *skb)
+{
+ return (struct nlmsghdr *)skb->data;
+}
+
+static __inline__ struct nlmsghdr *
+__nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len, int flags)
+{
+ struct nlmsghdr *nlh;
+ int size = NLMSG_LENGTH(len);
+
+ nlh = (struct nlmsghdr*)skb_put(skb, NLMSG_ALIGN(size));
+ nlh->nlmsg_type = type;
+ nlh->nlmsg_len = size;
+ nlh->nlmsg_flags = flags;
+ nlh->nlmsg_pid = pid;
+ nlh->nlmsg_seq = seq;
+ memset(NLMSG_DATA(nlh) + len, 0, NLMSG_ALIGN(size) - size);
+ return nlh;
+}
+
+#define NLMSG_NEW(skb, pid, seq, type, len, flags) \
+({ if (unlikely(skb_tailroom(skb) < (int)NLMSG_SPACE(len))) \
+ goto nlmsg_failure; \
+ __nlmsg_put(skb, pid, seq, type, len, flags); })
+
+#define NLMSG_PUT(skb, pid, seq, type, len) \
+ NLMSG_NEW(skb, pid, seq, type, len, 0)
+
+struct netlink_skb_parms
+{
+ struct ucred creds; /* Skb credentials */
+ __u32 pid;
+ __u32 dst_group;
+ kernel_cap_t eff_cap;
+ __u32 loginuid; /* Login (audit) uid */
+ __u32 sid; /* SELinux security id */
+};
+
+#define NETLINK_CB(skb) (*(struct netlink_skb_parms*)&((skb)->cb))
+
+extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 pid, int nonblock);
+
+extern struct sock *netlink_kernel_create(struct net *net, int unit,
+ unsigned int groups, void (*input)(struct sk_buff *skb),
+ struct mutex *cb_mutex, struct module *module);
+
+extern void netlink_kernel_release(struct sock *sk);
+
+#endif /* stub_linux_inc_linux_netlink_h */
diff --git a/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/path.h b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/path.h
new file mode 100644
index 0000000000..86f83ac02c
--- /dev/null
+++ b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/path.h
@@ -0,0 +1,12 @@
+#ifndef stub_linux_inc_linux_path_h
+#define stub_linux_inc_linux_path_h
+
+struct dentry;
+struct vfsmount;
+
+struct path {
+ struct vfsmount *mnt;
+ struct dentry *dentry;
+};
+
+#endif /* stub_linux_inc_linux_path_h */
diff --git a/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/poll.h b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/poll.h
new file mode 100644
index 0000000000..a0a441031b
--- /dev/null
+++ b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/poll.h
@@ -0,0 +1,20 @@
+#ifndef stub_linux_inc_linux_poll_h
+#define stub_linux_inc_linux_poll_h
+
+#include <linux/types.h>
+#include <linux/wait.h>
+#include <linux/fs.h>
+
+typedef void (*poll_queue_proc)(struct file *, wait_queue_head_t *, struct poll_table_struct *);
+
+typedef struct poll_table_struct {
+ poll_queue_proc qproc;
+} poll_table;
+
+static inline void poll_wait(struct file * filp, wait_queue_head_t * wait_address, poll_table *p)
+{
+ if (p && wait_address)
+ p->qproc(filp, wait_address, p);
+}
+
+#endif /* stub_linux_inc_linux_poll_h */
diff --git a/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/proc_fs.h b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/proc_fs.h
new file mode 100644
index 0000000000..dc3ac29603
--- /dev/null
+++ b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/proc_fs.h
@@ -0,0 +1,29 @@
+#ifndef stub_linux_inc_linux_proc_fs_h
+#define stub_linux_inc_linux_proc_fs_h
+
+#include <linux/types.h>
+#include <linux/spinlock.h>
+
+typedef int (read_proc_t)(char *page, char **start, off_t off,
+ int count, int *eof, void *data);
+
+struct proc_dir_entry {
+ void *data;
+ read_proc_t *read_proc;
+};
+
+static inline struct proc_dir_entry *proc_mkdir(const char *name,
+ struct proc_dir_entry *parent)
+{
+ return NULL;
+}
+
+static inline struct proc_dir_entry *create_proc_entry(const char *name,
+ mode_t mode, struct proc_dir_entry *parent)
+{
+ return NULL;
+}
+
+#define remove_proc_entry(name, parent) do {} while (0)
+
+#endif /* stub_linux_inc_linux_proc_fs_h */
diff --git a/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/rcupdate.h b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/rcupdate.h
new file mode 100644
index 0000000000..667c4d4896
--- /dev/null
+++ b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/rcupdate.h
@@ -0,0 +1,9 @@
+#ifndef stub_linux_inc_linux_rcupdate_h
+#define stub_linux_inc_linux_rcupdate_h
+
+struct rcu_head {
+ struct rcu_head *next;
+ void (*func)(struct rcu_head *head);
+};
+
+#endif /* stub_linux_inc_linux_rcupdate_h */
diff --git a/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/sched.h b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/sched.h
new file mode 100644
index 0000000000..6e180a080c
--- /dev/null
+++ b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/sched.h
@@ -0,0 +1,10 @@
+#ifndef stub_linux_inc_linux_sched_h
+#define stub_linux_inc_linux_sched_h
+
+#define TASK_INTERRUPTIBLE 1
+
+#define set_current_state(state_value) ((int) 0)
+
+extern signed long schedule_timeout(signed long timeout);
+
+#endif /* stub_linux_inc_linux_sched_h */
diff --git a/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/skbuff.h b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/skbuff.h
new file mode 100644
index 0000000000..523824e453
--- /dev/null
+++ b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/skbuff.h
@@ -0,0 +1,45 @@
+#ifndef stub_linux_inc_linux_skbuff_h
+#define stub_linux_inc_linux_skbuff_h
+
+#include <linux/types.h>
+
+#define CHECKSUM_UNNECESSARY 1
+
+/* linux_drv_utests.h stub */
+struct sk_buff {
+ unsigned char *data;
+ struct net_device *dev;
+ unsigned int len;
+ unsigned short protocol;
+ unsigned char ip_summed;
+ char cb[48];
+};
+
+static inline struct sk_buff *alloc_skb(unsigned int size, int priority)
+{
+ struct sk_buff* skb;
+ skb = (struct sk_buff*)malloc((unsigned int)(sizeof(struct sk_buff)));
+ return skb;
+}
+static inline void kfree_skb(struct sk_buff *skb)
+{
+ if(skb)
+ free(skb);
+}
+
+static inline unsigned char *skb_put(struct sk_buff *skb, unsigned int len)
+{
+ return NULL;
+}
+
+static inline int skb_tailroom(const struct sk_buff *skb)
+{
+ return 0;
+}
+
+static inline unsigned char *skb_pull(struct sk_buff *skb, unsigned int len)
+{
+ return NULL;
+}
+
+#endif /* stub_linux_inc_linux_skbuff_h */
diff --git a/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/socket.h b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/socket.h
new file mode 100644
index 0000000000..4160ed85a2
--- /dev/null
+++ b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/socket.h
@@ -0,0 +1,18 @@
+#ifndef stub_linux_inc_linux_socket_h
+#define stub_linux_inc_linux_socket_h
+
+#include <linux/types.h>
+
+#define MSG_DONTWAIT 0x40
+
+struct sockaddr {
+ char sa_data[14];
+};
+
+struct ucred {
+ __u32 pid;
+ __u32 uid;
+ __u32 gid;
+};
+
+#endif /* stub_linux_inc_linux_socket_h */
diff --git a/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/spinlock.h b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/spinlock.h
new file mode 100644
index 0000000000..76bb624db0
--- /dev/null
+++ b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/spinlock.h
@@ -0,0 +1,35 @@
+#ifndef stub_linux_inc_linux_spinlock_h
+#define stub_linux_inc_linux_spinlock_h
+
+#include <linux/types.h>
+
+# define SPIN_DEP_MAP_INIT(lockname)
+#define __RAW_SPIN_LOCK_UNLOCKED { 0 }
+
+/* From asm. */
+typedef struct {
+ volatile unsigned int lock;
+} raw_spinlock_t;
+
+typedef struct {
+ raw_spinlock_t raw_lock;
+// #ifdef CONFIG_GENERIC_LOCKBREAK
+// unsigned int break_lock;
+// #endif
+} spinlock_t;
+
+# define __SPIN_LOCK_UNLOCKED(lockname) \
+ (spinlock_t) { .raw_lock = __RAW_SPIN_LOCK_UNLOCKED, \
+ SPIN_DEP_MAP_INIT(lockname) }
+
+#define SPIN_LOCK_UNLOCKED __SPIN_LOCK_UNLOCKED(old_style_spin_init)
+
+# define spin_lock_init(lock) \
+ do { *(lock) = SPIN_LOCK_UNLOCKED; } while (0)
+
+#define spin_lock_irqsave(lock, flags) ((int) 0)
+#define spin_lock_irqrestore(lock, flags) ((int) 0)
+
+#define spin_unlock_irqrestore(lock, flags) ((int) 0)
+
+#endif /* stub_linux_inc_linux_spinlock_h */
diff --git a/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/types.h b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/types.h
new file mode 100644
index 0000000000..0643cc52b9
--- /dev/null
+++ b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/types.h
@@ -0,0 +1,23 @@
+#ifndef stub_linux_inc_linux_types_h
+#define stub_linux_inc_linux_types_h
+
+#include <linux/asm.h>
+
+#include <stdint.h>
+#include <sys/types.h>
+
+typedef _Bool bool;
+#define false 0
+#define true 1
+
+typedef unsigned char u8;
+typedef unsigned short u16;
+typedef unsigned long u32;
+typedef unsigned long long u64;
+
+typedef __u16 __be16;
+
+typedef unsigned int gfp_t;
+typedef unsigned int dma_addr_t;
+
+#endif /* stub_linux_inc_linux_types_h */
diff --git a/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/wait.h b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/wait.h
new file mode 100644
index 0000000000..c2b2fdd940
--- /dev/null
+++ b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/linux/wait.h
@@ -0,0 +1,32 @@
+#ifndef stub_linux_inc_linux_wait_h
+#define stub_linux_inc_linux_wait_h
+
+#include <linux/list.h>
+#include <linux/spinlock.h>
+
+struct __wait_queue_head {
+ spinlock_t lock;
+ struct list_head task_list;
+};
+
+typedef struct __wait_queue_head wait_queue_head_t;
+
+#define __WAIT_QUEUE_HEAD_INITIALIZER(name) { \
+ .lock = __SPIN_LOCK_UNLOCKED(name.lock), \
+ .task_list = { &(name).task_list, &(name).task_list } }
+
+#define DECLARE_WAIT_QUEUE_HEAD(name) \
+ wait_queue_head_t name = __WAIT_QUEUE_HEAD_INITIALIZER(name)
+
+#define wait_event_interruptible(wq, condition) ((int) 0)
+#define wake_up(x) ((int) 0)
+#define wake_up_interruptible(x) ((int) 0)
+
+static inline int waitqueue_active(wait_queue_head_t *q)
+{
+ return !list_empty(&q->task_list);
+}
+
+extern void init_waitqueue_head(wait_queue_head_t *q);
+
+#endif /* stub_linux_inc_linux_wait_h */
diff --git a/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/net/net_namespace.h b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/net/net_namespace.h
new file mode 100644
index 0000000000..62203caf20
--- /dev/null
+++ b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/net/net_namespace.h
@@ -0,0 +1,55 @@
+#ifndef stub_linux_inc_net_net_namespace_h
+#define stub_linux_inc_net_net_namespace_h
+
+#include <linux/types.h>
+#include <linux/list.h>
+#include <linux/netdevice.h>
+#include <linux/spinlock.h>
+#include <linux/proc_fs.h>
+#include <net/sock.h>
+
+struct net {
+ atomic_t count; /* To decided when the network
+ * namespace should be freed.
+ */
+ atomic_t use_count; /* To track references we
+ * destroy on demand
+ */
+ struct list_head list; /* list of network namespaces */
+// struct work_struct work; /* work struct for freeing */
+
+ struct proc_dir_entry *proc_net;
+ struct proc_dir_entry *proc_net_stat;
+
+ struct list_head sysctl_table_headers;
+
+ struct net_device *loopback_dev; /* The loopback */
+
+ struct list_head dev_base_head;
+// struct hlist_head *dev_name_head;
+// struct hlist_head *dev_index_head;
+
+ /* core fib_rules */
+ struct list_head rules_ops;
+ spinlock_t rules_mod_lock;
+
+ struct sock *rtnl; /* rtnetlink socket */
+
+// /* core sysctls */
+// struct ctl_table_header *sysctl_core_hdr;
+// int sysctl_somaxconn;
+//
+// struct netns_packet packet;
+// struct netns_unix unx;
+// struct netns_ipv4 ipv4;
+//#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
+// struct netns_ipv6 ipv6;
+//#endif
+//#ifdef CONFIG_NETFILTER
+// struct netns_xt xt;
+//#endif
+};
+
+extern struct net init_net;
+
+#endif /* stub_linux_inc_net_net_namespace_h */
diff --git a/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/net/seq_check.h b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/net/seq_check.h
new file mode 100644
index 0000000000..894ea52690
--- /dev/null
+++ b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/net/seq_check.h
@@ -0,0 +1,28 @@
+#ifndef stub_linux_inc_net_seq_check_h
+#define stub_linux_inc_net_seq_check_h
+
+#include <linux/types.h>
+#include <linux/skbuff.h>
+
+#define SEQ_CHECK_VLAN_MAX 64
+#define SEQ_CHECK_DRV_NAME_SZ 10
+
+/* seq_check context. */
+struct seq_check_ctx
+{
+ /* Expected sequence number for the next received packet. For each VLAN. */
+ uint16_t seq_num_expected_rx[SEQ_CHECK_VLAN_MAX];
+
+ /* Expected sequence number for the next sent packet. For each VLAN. */
+ uint16_t seq_num_expected_tx[SEQ_CHECK_VLAN_MAX];
+
+ /* Name of the network driver. */
+ char drv_name[SEQ_CHECK_DRV_NAME_SZ];
+};
+
+/* we will have to create a corresponding source file if we want to use these functions */
+#define seq_check_init(ctx, drv_name) do {} while(0)
+#define seq_check_rx(ctx, skb) do {} while(0)
+#define seq_check_tx(ctx, skb) do {} while(0)
+
+#endif /* stub_linux_inc_net_seq_check_h */
diff --git a/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/net/sock.h b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/net/sock.h
new file mode 100644
index 0000000000..0db9d16fb1
--- /dev/null
+++ b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/inc/net/sock.h
@@ -0,0 +1,13 @@
+#ifndef stub_linux_inc_net_sock_h
+#define stub_linux_inc_net_sock_h
+
+#include <linux/types.h>
+#include <linux/skbuff.h>
+#include <linux/socket.h>
+#include <linux/list.h>
+#include <linux/spinlock.h>
+
+struct sock_common;
+struct sock;
+
+#endif /* stub_linux_inc_linux_skbuff_h */
diff --git a/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/src/af_netlink.c b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/src/af_netlink.c
new file mode 100644
index 0000000000..10588fdbbf
--- /dev/null
+++ b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/src/af_netlink.c
@@ -0,0 +1,24 @@
+#include <linux/types.h>
+#include <linux/netlink.h>
+#include <linux/skbuff.h>
+#include <linux/mutex.h>
+#include <linux/module.h>
+#include <net/net_namespace.h>
+#include <net/sock.h>
+
+int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 pid, int nonblock)
+{
+ return 0;
+}
+
+struct sock *netlink_kernel_create(struct net *net, int unit,
+ unsigned int groups, void (*input)(struct sk_buff *skb),
+ struct mutex *cb_mutex, struct module *module)
+{
+ return NULL;
+}
+
+void netlink_kernel_release(struct sock *sk)
+{
+}
+
diff --git a/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/src/afe.c b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/src/afe.c
new file mode 100644
index 0000000000..55bfbfaa1b
--- /dev/null
+++ b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/src/afe.c
@@ -0,0 +1,6 @@
+# include <linux/afe.h>
+
+int afe_write_reg(uint8_t reg, uint8_t val)
+{
+ return 0;
+}
diff --git a/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/src/bitops.c b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/src/bitops.c
new file mode 100644
index 0000000000..824bdeeba1
--- /dev/null
+++ b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/src/bitops.c
@@ -0,0 +1,6 @@
+#include <linux/bitops.h>
+
+inline int test_bit(int nr, const volatile unsigned long *addr)
+{
+ return 0;
+}
diff --git a/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/src/char_dev.c b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/src/char_dev.c
new file mode 100644
index 0000000000..caeb5b8d3d
--- /dev/null
+++ b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/src/char_dev.c
@@ -0,0 +1,26 @@
+#include <linux/types.h>
+#include <linux/cdev.h>
+#include <linux/fs.h>
+
+int cdev_add(struct cdev *p, dev_t dev, unsigned count)
+{
+ return 0;
+}
+
+void cdev_del(struct cdev *p)
+{
+}
+
+void cdev_init(struct cdev *cdev, const struct file_operations *fops)
+{
+}
+
+int alloc_chrdev_region(dev_t *dev, unsigned baseminor, unsigned count,
+ const char *name)
+{
+ return 0;
+}
+
+void unregister_chrdev_region(dev_t from, unsigned count)
+{
+}
diff --git a/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/src/delay.c b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/src/delay.c
new file mode 100644
index 0000000000..dafdeee6f5
--- /dev/null
+++ b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/src/delay.c
@@ -0,0 +1,6 @@
+#include <linux/delay.h>
+
+unsigned long msleep_interruptible(unsigned int msecs)
+{
+ return 0;
+}
diff --git a/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/src/dma.c b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/src/dma.c
new file mode 100644
index 0000000000..0fdcd00a21
--- /dev/null
+++ b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/src/dma.c
@@ -0,0 +1,25 @@
+#include <linux/dma-mapping.h>
+#include <linux/device.h>
+#include <linux/asm.h>
+
+void *
+dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *handle, gfp_t gfp)
+{
+ return NULL;
+}
+
+void dma_free_coherent(struct device *dev, size_t size, void *cpu_addr,
+ dma_addr_t handle)
+{
+}
+
+dma_addr_t dma_map_single(struct device *dev, void *ptr, size_t size,
+ enum dma_data_direction dir)
+{
+ return 0;
+}
+
+void dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
+ enum dma_data_direction dir)
+{
+}
diff --git a/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/src/eth.c b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/src/eth.c
new file mode 100644
index 0000000000..37eac916a7
--- /dev/null
+++ b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/src/eth.c
@@ -0,0 +1,12 @@
+#include <linux/types.h>
+#include <linux/netdevice.h>
+#include <linux/skbuff.h>
+
+void ether_setup(struct net_device *dev)
+{
+}
+
+__be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev)
+{
+ return 5;
+}
diff --git a/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/src/ioremap.c b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/src/ioremap.c
new file mode 100644
index 0000000000..c5113eeaf9
--- /dev/null
+++ b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/src/ioremap.c
@@ -0,0 +1,10 @@
+#include <linux/asm.h>
+
+void * __arm_ioremap(unsigned long phys_addr, size_t size, unsigned int mtype)
+{
+ return (void*)phys_addr;
+}
+
+void __iounmap(volatile void *addr)
+{
+}
diff --git a/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/src/irq_manage.c b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/src/irq_manage.c
new file mode 100644
index 0000000000..e236dd44bb
--- /dev/null
+++ b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/src/irq_manage.c
@@ -0,0 +1,12 @@
+#include <linux/irqreturn.h>
+#include <linux/interrupt.h>
+
+void free_irq(unsigned int irq, void *dev_id)
+{
+}
+
+int request_irq(unsigned int irq, irq_handler_t handler,
+ unsigned long irqflags, const char *devname, void *dev_id)
+{
+ return 0;
+}
diff --git a/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/src/mutex.c b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/src/mutex.c
new file mode 100644
index 0000000000..e70b55bdab
--- /dev/null
+++ b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/src/mutex.c
@@ -0,0 +1,11 @@
+#include <linux/mutex.h>
+
+/* mutex_lock is defined in libcheck too, so we have to stub it using */
+/* a different name... */
+inline void my_mutex_lock(struct mutex *lock)
+{
+}
+
+inline void mutex_unlock(struct mutex *lock)
+{
+}
diff --git a/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/src/net_dev.c b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/src/net_dev.c
new file mode 100644
index 0000000000..31f63a46ba
--- /dev/null
+++ b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/src/net_dev.c
@@ -0,0 +1,42 @@
+#include <linux/netdevice.h>
+
+#include <stdlib.h>
+
+int register_netdev(struct net_device *dev)
+{
+ return 0;
+}
+
+void unregister_netdev(struct net_device *dev)
+{
+}
+
+struct net_device *alloc_netdev(int sizeof_priv, const char *name,
+ void (*setup)(struct net_device *))
+{
+ struct net_device* dev;
+ dev = (struct net_device*)malloc((unsigned int)(sizeof(struct net_device)));
+ dev->priv = malloc((unsigned int)(sizeof_priv));
+ return dev;
+}
+
+void free_netdev(struct net_device* dev)
+{
+ if(dev->priv)
+ free(dev->priv);
+ free((void*)(dev));
+}
+
+int netif_rx(struct sk_buff *skb)
+{
+ return 0;
+}
+
+void netif_carrier_on(struct net_device *dev)
+{
+}
+
+void netif_carrier_off(struct net_device *dev)
+{
+}
+
diff --git a/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/src/softirq.c b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/src/softirq.c
new file mode 100644
index 0000000000..fbcd75c2bf
--- /dev/null
+++ b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/src/softirq.c
@@ -0,0 +1,15 @@
+#include <linux/interrupt.h>
+#include <linux/asm.h>
+
+void tasklet_init(struct tasklet_struct *t,
+ void (*func)(unsigned long), unsigned long data)
+{
+}
+
+void tasklet_kill(struct tasklet_struct *t)
+{
+}
+
+void tasklet_schedule(struct tasklet_struct *t)
+{
+}
diff --git a/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/src/uaccess.c b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/src/uaccess.c
new file mode 100644
index 0000000000..8d03603f73
--- /dev/null
+++ b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/src/uaccess.c
@@ -0,0 +1,32 @@
+#include <linux/asm.h>
+#include <linux/compiler.h>
+#include <stdlib.h>
+
+/* temporary hack */
+#define sizeof(plccode) 124
+
+unsigned long copy_from_user(void *to, const void __user *from, unsigned long n)
+{
+ if(n)
+ {
+ memcpy(to, from, sizeof(plccode));
+ return 0;
+ }
+ else
+ {
+ return -1;
+ }
+}
+
+unsigned long copy_to_user(void __user *to, const void *from, unsigned long n)
+{
+ if(n)
+ {
+ memcpy(to, from, sizeof(plccode));
+ return 0;
+ }
+ else
+ {
+ return -1;
+ }
+}
diff --git a/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/src/wait.c b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/src/wait.c
new file mode 100644
index 0000000000..7a0f77f67f
--- /dev/null
+++ b/cleopatre/devkit/tests/plcdrv/arm/utests/stub/linux/src/wait.c
@@ -0,0 +1,7 @@
+#include <linux/wait.h>
+#include <linux/list.h>
+#include <linux/spinlock.h>
+
+void init_waitqueue_head(wait_queue_head_t *q)
+{
+}
diff --git a/cleopatre/devkit/tests/plcdrv/gidel/ftests/.exrc b/cleopatre/devkit/tests/plcdrv/gidel/ftests/.exrc
deleted file mode 100644
index 1a8f6166fd..0000000000
--- a/cleopatre/devkit/tests/plcdrv/gidel/ftests/.exrc
+++ /dev/null
@@ -1,74 +0,0 @@
-if &cp | set nocp | endif
-let s:cpo_save=&cpo
-set cpo&vim
-nmap \cv <Plug>VCSVimDiff
-nmap \cu <Plug>VCSUpdate
-nmap \cU <Plug>VCSUnlock
-nmap \cs <Plug>VCSStatus
-nmap \cr <Plug>VCSReview
-nmap \cq <Plug>VCSRevert
-nmap \cl <Plug>VCSLog
-nmap \cL <Plug>VCSLock
-nmap \ci <Plug>VCSInfo
-nmap \cg <Plug>VCSGotoOriginal
-nmap \cd <Plug>VCSDiff
-nmap \cD <Plug>VCSDelete
-nmap \cc <Plug>VCSCommit
-nmap \cG <Plug>VCSClearAndGotoOriginal
-nmap \cn <Plug>VCSAnnotate
-nmap \ca <Plug>VCSAdd
-nmap \f :FunctionHeader
-map \dk <Plug>DirDiffPrev
-map \dj <Plug>DirDiffNext
-map \dp <Plug>DirDiffPut
-map \dg <Plug>DirDiffGet
-nmap gx <Plug>NetrwBrowseX
-nnoremap <silent> <Plug>NetrwBrowseX :call netrw#NetBrowseX(expand("<cWORD>"),0)
-nnoremap <silent> <Plug>CVSWatchRemove :CVSWatch remove
-nnoremap <silent> <Plug>CVSWatchOn :CVSWatch on
-nnoremap <silent> <Plug>CVSWatchOff :CVSWatch off
-nnoremap <silent> <Plug>CVSWatchAdd :CVSWatch add
-nnoremap <silent> <Plug>CVSWatchers :CVSWatchers
-nnoremap <silent> <Plug>CVSUnedit :CVSUnedit
-nnoremap <silent> <Plug>CVSEditors :CVSEditors
-nnoremap <silent> <Plug>CVSEdit :CVSEdit
-nnoremap <silent> <Plug>VCSVimDiff :VCSVimDiff
-nnoremap <silent> <Plug>VCSUpdate :VCSUpdate
-nnoremap <silent> <Plug>VCSUnlock :VCSUnlock
-nnoremap <silent> <Plug>VCSStatus :VCSStatus
-nnoremap <silent> <Plug>VCSReview :VCSReview
-nnoremap <silent> <Plug>VCSRevert :VCSRevert
-nnoremap <silent> <Plug>VCSLog :VCSLog
-nnoremap <silent> <Plug>VCSLock :VCSLock
-nnoremap <silent> <Plug>VCSInfo :VCSInfo
-nnoremap <silent> <Plug>VCSClearAndGotoOriginal :VCSGotoOriginal!
-nnoremap <silent> <Plug>VCSGotoOriginal :VCSGotoOriginal
-nnoremap <silent> <Plug>VCSDiff :VCSDiff
-nnoremap <silent> <Plug>VCSDelete :VCSDelete
-nnoremap <silent> <Plug>VCSCommit :VCSCommit
-nnoremap <silent> <Plug>VCSAnnotate :VCSAnnotate
-nnoremap <silent> <Plug>VCSAdd :VCSAdd
-let &cpo=s:cpo_save
-unlet s:cpo_save
-set backspace=indent,eol,start
-set cindent
-set cinoptions=:0g0t0(0u0W1s
-set expandtab
-set fileencodings=ucs-bom,utf-8,default,latin1
-set grepprg=grep\ -r\ -n\ --exclude\ 'tags'\ --exclude\ 'CVS'\ --exclude\ '*.svn*'\ --exclude\ '*.cmd*'\ --exclude\ '*.hg*'\ $*\ *\ /dev/null
-set helplang=fr
-set hlsearch
-set incsearch
-set laststatus=2
-set printoptions=paper:a4
-set ruler
-set runtimepath=~/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim71,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,~/.vim/after
-set shiftwidth=4
-set showcmd
-set smarttab
-set suffixes=.bak,~,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.inx,.out,.toc
-set tags=./tags,./TAGS,tags,TAGS,~/undersvn/trunk/cleopatre/tags
-set textwidth=78
-set wildmenu
-set wildmode=longest:full,full
-" vim: set ft=vim :
diff --git a/cleopatre/devkit/tests/plcdrv/gidel/ftests/Makefile b/cleopatre/devkit/tests/plcdrv/gidel/ftests/Makefile
deleted file mode 100644
index b853d881d0..0000000000
--- a/cleopatre/devkit/tests/plcdrv/gidel/ftests/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-all:
- make -C ../../../../plcdrv/gidel
- make -C lo_ecos
-
-clean:
- make -C ../../../../plcdrv/gidel clean
- make -C lo_ecos clean
diff --git a/cleopatre/devkit/tests/plcdrv/gidel/ftests/lo_ecos/Config b/cleopatre/devkit/tests/plcdrv/gidel/ftests/lo_ecos/Config
deleted file mode 100644
index 50fb50f374..0000000000
--- a/cleopatre/devkit/tests/plcdrv/gidel/ftests/lo_ecos/Config
+++ /dev/null
@@ -1,2 +0,0 @@
-CONFIG_DEBUG = y
-CONFIG_TRACE = n
diff --git a/cleopatre/devkit/tests/plcdrv/gidel/ftests/lo_ecos/Makefile b/cleopatre/devkit/tests/plcdrv/gidel/ftests/lo_ecos/Makefile
deleted file mode 100644
index 286f3cb463..0000000000
--- a/cleopatre/devkit/tests/plcdrv/gidel/ftests/lo_ecos/Makefile
+++ /dev/null
@@ -1,13 +0,0 @@
-BASE = ../../../../../../../cesar
-
-ECOS = y
-TARGET = sparc
-
-DEFS = -DLOOPBACK_DEBUG
-
-TARGET_PROGRAMS = loopback
-
-loopback_SOURCES = loopback.c
-loopback_MODULES = lib hal/hle
-
-include $(BASE)/common/make/top.mk
diff --git a/cleopatre/devkit/tests/plcdrv/gidel/ftests/lo_ecos/Makefile_debug b/cleopatre/devkit/tests/plcdrv/gidel/ftests/lo_ecos/Makefile_debug
deleted file mode 100644
index 996536a124..0000000000
--- a/cleopatre/devkit/tests/plcdrv/gidel/ftests/lo_ecos/Makefile_debug
+++ /dev/null
@@ -1,30 +0,0 @@
-OBJPATH=obj
-CC=sparc-elf-
-
-
-FILES_ELF=$(shell (ls $(OBJPATH)/*.elf))
-FILES=$(foreach i,$(FILES_ELF),$(basename $(shell (basename $i))))
-TODO_HEX=$(foreach i,$(FILES),$(OBJPATH)/$i.hex)
-TODO_BIN=$(foreach i,$(FILES),$(OBJPATH)/$i.bin)
-TODO_DIS=$(foreach i,$(FILES),$(OBJPATH)/$i.dis)
-
-
-all: $(TODO_HEX) $(TODO_BIN) $(TODO_DIS)
-
-clean:
- rm -f $(TODO_HEX) $(TODO_DIS)
-
-$(OBJPATH)/%.bin: $(OBJPATH)/%.elf
- $(CC)objcopy -O binary $< $@
-
-$(OBJPATH)/%.hex: $(OBJPATH)/%.elf
- $(CC)objcopy -SO ihex $< $@
-
-$(OBJPATH)/%.dis: $(OBJPATH)/%.elf
- $(CC)objdump -DSt $< > $@
-
-$(OBJPATH)/%.elf:
- @if [ ! \( -f $@ \) ]; then \
- echo "Please compile the $@ before"; \
- false; \
- fi
diff --git a/cleopatre/devkit/tests/plcdrv/gidel/ftests/lo_ecos/common.h b/cleopatre/devkit/tests/plcdrv/gidel/ftests/lo_ecos/common.h
deleted file mode 100644
index 0e60d6c9fa..0000000000
--- a/cleopatre/devkit/tests/plcdrv/gidel/ftests/lo_ecos/common.h
+++ /dev/null
@@ -1,26 +0,0 @@
-#ifndef common_h
-#define common_h
-/* Cesar project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file common.h
- * \brief « brief description »
- * \ingroup « module »
- *
- * « long description »
- */
-
-/** Debug mode */
-#ifdef LOOPBACK_DEBUG
-#define TRACE diag_printf
-#else
-#define TRACE(...)
-#endif
-
-
-#endif /* common_h */
diff --git a/cleopatre/devkit/tests/plcdrv/gidel/ftests/lo_ecos/ecos.ecc.sh b/cleopatre/devkit/tests/plcdrv/gidel/ftests/lo_ecos/ecos.ecc.sh
deleted file mode 100644
index db2208c6cc..0000000000
--- a/cleopatre/devkit/tests/plcdrv/gidel/ftests/lo_ecos/ecos.ecc.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-config=${1:-ecos-gen.ecc}
-ecosconfig --config=$config new sparc_leon default
-cat >> $config <<'EOF'
-EOF
-ecosconfig --config=$config check
diff --git a/cleopatre/devkit/tests/plcdrv/gidel/ftests/lo_ecos/src/loopback.c b/cleopatre/devkit/tests/plcdrv/gidel/ftests/lo_ecos/src/loopback.c
deleted file mode 100644
index 5874119ddd..0000000000
--- a/cleopatre/devkit/tests/plcdrv/gidel/ftests/lo_ecos/src/loopback.c
+++ /dev/null
@@ -1,117 +0,0 @@
-/* Cesar project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file loopback.c
- * \brief « brief description »
- * \ingroup « module »
- *
- * « long description »
- */
-
-#include <cyg/kernel/kapi.h>
-#include <cyg/infra/diag.h>
-
-#include "common/std.h"
-#include "hal/hle/ipmbox.h"
-#include "hal/hle/defs.h"
-#include "lib/utils.h"
-#include "hal/hle/inc/trace.h"
-
-#include "common.h"
-
-#define MAIL_THREAD_STACK_SIZE (4096 / sizeof(int))
-
-int mail_thread_stack[MAIL_THREAD_STACK_SIZE];
-cyg_handle_t mail_thread_handle;
-cyg_thread mail_thread_obj;
-
-ipmbox_t *ipmbox_ctx;
-
-/**
- * Thread procedure.
- */
-void mail_thread(cyg_addrword_t index)
-{
- unsigned int my_counter = 0;
- while(1)
- {
- cyg_thread_delay(300);
-// diag_printf("ct=%d\n",my_counter);
- if(!my_counter)
- ipmbox_trace_print(ipmbox_ctx);
- my_counter++;
- }
-}
-
-/**
- * Mailbox receive handler functions.
- */
-void ipmbox_rx(void *user_data, u32 *first_msg, uint length)
-{
- ipmbox_msg_hdr_t *msg_hdr;
- uint offset = 0;
- uint msg_size;
-
- TRACE("\n\nin IPMBOX RX\n");
-
- while(length)
- {
- //Recover message header.
- msg_hdr = (ipmbox_msg_hdr_t*)(first_msg + offset);
- //Recover message size.
- msg_size = (sizeof(ipmbox_msg_hdr_t)/sizeof(u32)) + msg_hdr->length;
-
- switch((hle_msg_type_t)msg_hdr->type)
- {
- case HLE_MSG_TYPE_BUFFER_ADD:
- TRACE("RECEIVE a buffer add\n");
- //Transform buffer_add message into send_done.
- msg_hdr->type = (msg_hdr->type & ~BF_MASK(IPMBOX_REG__MSG_TYPE)) | BF_SHIFT(IPMBOX_REG__MSG_TYPE, 0x02);
- //Send this new message.
- ipmbox_tx(ipmbox_ctx, (u32*)msg_hdr, msg_size);
- break;
- case HLE_MSG_TYPE_INTERFACE:
- TRACE("RECEIVE an interface\n");
- //Send the same message.
- ipmbox_tx(ipmbox_ctx, (u32*)msg_hdr, msg_size);
- break;
- case HLE_MSG_TYPE_DATA:
- TRACE("RECEIVE a data\n");
- //Send the same message.
- ipmbox_tx(ipmbox_ctx, (u32*)msg_hdr, msg_size);
- break;
- default:
- break;
- }
- //Prepare ptrs for next messages
- offset += msg_size;
- length -= msg_size;
- }
-
- TRACE("end IPMBOX RX\n");
-}
-
-/**
- * Main starting point for the application.
- */
-void cyg_user_start(void)
-{
- //Initialise the mailbox.
- ipmbox_ctx = ipmbox_init(0, &ipmbox_rx);
-
- //Activate ipmboxes.
- ipmbox_activate(ipmbox_ctx, true);
-
- //Create a thread
- cyg_thread_create(12, mail_thread, (cyg_addrword_t) 0, "Mail Thread", &mail_thread_stack, MAIL_THREAD_STACK_SIZE, &mail_thread_handle, &mail_thread_obj);
-
- cyg_thread_resume(mail_thread_handle);
-
- cyg_scheduler_start();
-}
-
diff --git a/cleopatre/devkit/tests/plcdrv/gidel/htests/Makefile b/cleopatre/devkit/tests/plcdrv/gidel/htests/Makefile
deleted file mode 100644
index b65925e5c2..0000000000
--- a/cleopatre/devkit/tests/plcdrv/gidel/htests/Makefile
+++ /dev/null
@@ -1,43 +0,0 @@
-BASE := $(CURDIR)/../../../..
-OBJPATH := ./obj
-GIDEL_LIBPATH := $(BASE)/hal/gidel
-INC_GIDEL_LIBPATH := $(GIDEL_LIBPATH)
-PRJPATH := $(BASE)/plcdrv/gidel
-###################################################
-
-# Common stuff
-CC := g++
-CFLAGS := -Wall -g3 -D__HTESTS__ -DLINUX -I. -I./inc -I$(INC_GIDEL_LIBPATH) -I$(PRJPATH)/inc
-LIBS := -L$(GIDEL_LIBPATH) -lgidel -lgidelproc
-export LD_LIBRARY_PATH=\$$LD_LIBRARY_PATH:$(GIDEL_LIBPATH)
-
-# Rules
-all: $(GIDEL_LIBPATH)/libgidel.so
- mkdir -p $(OBJPATH)
- $(MAKE) $(OBJPATH)/mbx_htests
- $(MAKE) $(OBJPATH)/hal_htests
-
-$(GIDEL_LIBPATH)/libgidel.so:
- $(MAKE) -C $(GIDEL_LIBPATH)
-
-$(OBJPATH)/mbx_htests : $(OBJPATH)/mbx_htests.o $(OBJPATH)/mailbox.o $(OBJPATH)/hal.o $(OBJPATH)/processing.o $(OBJPATH)/plc_drv.o
- $(CC) $(CFLAGS) -o $@ $^ $(LIBS)
-
-$(OBJPATH)/hal_htests : $(OBJPATH)/hal_htests.o $(OBJPATH)/hal.o
- $(CC) $(CFLAGS) -o $@ $^ $(LIBS)
-
-$(OBJPATH)/%.o : src/%.cpp
- $(CC) $(CFLAGS) -c -o $@ $<
-
-$(OBJPATH)/%.o : src/%.c
- $(CC) $(CFLAGS) -c -o $@ $<
-
-$(OBJPATH)/%.o : $(PRJPATH)/src/%.cpp
- $(CC) $(CFLAGS) -c -o $@ $<
-
-$(OBJPATH)/%.o : $(PRJPATH)/src/%.c
- $(CC) $(CFLAGS) -c -o $@ $<
-
-clean :
- rm -rf $(OBJPATH)
-
diff --git a/cleopatre/devkit/tests/plcdrv/gidel/htests/src/hal_htests.cpp b/cleopatre/devkit/tests/plcdrv/gidel/htests/src/hal_htests.cpp
deleted file mode 100644
index 79b04d735c..0000000000
--- a/cleopatre/devkit/tests/plcdrv/gidel/htests/src/hal_htests.cpp
+++ /dev/null
@@ -1,270 +0,0 @@
-/* Cesar project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file test_hal.cpp
- * \brief tests of the HAL layer.
- * \ingroup Cleopatre - Isis
- *
- * For all tests of the hal procedure we have to check our functionnalities
- * directly with the hardware
- */
-
-#include <iostream>
-#include <vector>
-#include "hal.h"
-
-struct init_info init;
-static void test_handler(void* data)
-{
- printf("Catched Interrupt\n");
-}
-
-void test_init(void)
-{
- printf("Init................");
- //Test init procedure
- halmbx_init(&init, &test_handler);
- printf("OK\n");
-}
-
-
-void test_uninit(void)
-{
- printf("UnInit..............");
- //Test uninit procedure
- halmbx_uninit();
- printf("OK\n");
-}
-
-void test_A2La_it_disable(void)
-{
- printf("A2La_it_disable.....");
- //Test Arm to Leon ack interrupt disable procedure
- A2La_it_disable();
- printf("OK\n");
-}
-
-void test_L2At_it_disable(void)
-{
- printf("L2At_it_disable.....");
- //Test Leon to Arm interrupt disable procedure
- L2At_it_disable();
- printf("OK\n");
-}
-
-void test_A2La_it_enable(void)
-{
- printf("A2La_it_enable......");
- //Test Arm to Leon ack interrupt enable procedure
- A2La_it_enable();
- printf("OK\n");
-}
-
-void test_L2At_it_enable(void)
-{
- printf("L2At_it_enable......");
- //Test Leon to Arm interrupt enable procedure
- L2At_it_enable();
- printf("OK\n");
-}
-
-void test_A2Lmail_status_queue(void)
-{
- printf("A2L_satus_queue....\n");
- printf(" Prepare for FULL...");
- //Just wait you check hardware
- getchar();
- getchar();
- //Test Arm to Leon status queue procedure
- if(halmbx_A2Lmail_status_queue())
- printf("FULL\n");
- else
- printf("NOT FULL\n");
- printf(" Prepare for NOT FULL...");
- //Just wait you check hardware
- getchar();
- //Test Arm to Leon status queue procedure
- if(halmbx_A2Lmail_status_queue())
- printf("FULL\n");
- else
- printf("NOT FULL\n");
-}
-
-void test_set_A2Lt_interrupt()
-{
- printf("Set A2Lt_it......");
- //Test Arm to Leon interrupt set procedure
- set_A2Lt_interrupt();
- printf("OK\n");
-}
-void test_set_L2Aa_interrupt()
-{
- printf("Set L2Aa_it......");
- //Test Leon to Arm acknowledge interrupt set procedure
- set_L2Aa_interrupt();
- printf("OK\n");
-}
-void test_clr_L2At_interrupt()
-{
- printf("Clr L2At_it......");
- //Test Leon to Arm interrupt clear procedure
- clr_L2At_interrupt();
- printf("OK\n");
-}
-void test_clr_A2La_interrupt()
-{
- printf("Clr A2La_it......");
- //Test Arm to Leon acknowledge interrupt clear procedure
- clr_A2La_interrupt();
- printf("OK\n");
-}
-
-void test_check_its(void)
-{
- enum pending_its result;
- printf("check_its....");
- //Test interrupt handler for Leon to Arm interrupt
- result = check_its();
- if(result == ALL)
- printf("ALL\n");
- else if(result == A2LA)
- printf("A2LA\n");
- else if(result == L2AT)
- printf("L2AT\n");
- else if(result == NONE)
- printf("NONE\n");
-}
-
-void test_ring_copy(void)
-{
- uint32_t buffer[] = {0xDEADBEEF, 0xFEEDBEEF};
- printf("copy_to_ring....");
- //Test copy to ring buffers
- halmbx_copy_to_ring(buffer, 8);
- printf("OK\n");
-}
-
-void test_update_copy(void)
-{
- printf("ring update....");
- //Test update ring pointers
- halmbx_A2Lmail_update(8);
- printf("OK\n");
-}
-
-void test_gidel_buffers(void)
-{
- uint32_t msg;
- uint32_t buffer[] = {0xDEADBEEF, 0xFEEDBEEF};
-
- printf("gidel buffers....");
- //Test gidel buffer mechanism
- msg = halmbx_save_in_gidel_memory(buffer, 8);
- printf("(0x%x)....",msg);
- halmbx_free_in_gidel_memory((uint32_t*)msg);
- printf("OK\n");
-}
-
-int main(void)
-{
- int choice;
- int cont = 1;
-
- printf("Starting Tests for HAL layer with a real hardware\n");
-
- do
- {
- printf("\n[0] Exit\n");
- printf("[1] Init\n");
- printf("[2] UnInit\n");
- printf("[3] A2La_it_disable\n");
- printf("[4] L2At_it_disable\n");
- printf("[5] A2La_it_enable\n");
- printf("[6] L2At_it_enable\n");
- printf("[7] A2Lmail_status_queue\n");
- printf("[8] Set_A2Lt_interrupt\n");
- printf("[9] Set_L2Aa_interrupt\n");
- printf("[10] Clr_L2At_interrupt\n");
- printf("[11] Clr_A2La_interrupt\n");
- printf("[12] Check interrupts\n");
- printf("[13] Ring copy\n");
- printf("[14] Update ring pointers\n");
- printf("[15] Gidel buffers mechanism\n");
- printf("\nWhich test do you want ? : ");
- scanf("%d",&choice);
-
- switch(choice)
- {
- //Test hal init procedure
- case 1: test_init();
- break;
-
- //Test hal uninit procedure
- case 2: test_uninit();
- break;
-
- //Test Arm to Leon ack interrupt disable procedure
- case 3: test_A2La_it_disable();
- break;
-
- //Test Leon to Arm interrupt disable procedure
- case 4: test_L2At_it_disable();
- break;
-
- //Test Arm to Leon ack interrupt enable procedure
- case 5: test_A2La_it_enable();
- break;
-
- //Test Leon to Arm interrupt enable procedure
- case 6: test_L2At_it_enable();
- break;
-
- //Test Arm to Leon status queue procedure
- case 7: test_A2Lmail_status_queue();
- break;
-
- //Test Arm to Leon interrupt set procedure
- case 8: test_set_A2Lt_interrupt();
- break;
-
- //Test Leon to Arm acknowledge interrupt set procedure
- case 9: test_set_L2Aa_interrupt();
- break;
-
- //Test Leon to Arm interrupt clear procedure
- case 10: test_clr_L2At_interrupt();
- break;
-
- //Test Arm to Leon acknowledge interrupt clear procedure
- case 11: test_clr_A2La_interrupt();
- break;
-
- //Test interrupt handler for Leon to Arm interrupt
- case 12: test_check_its();
- break;
-
- //Test copy to ring buffers
- case 13: test_ring_copy();
- break;
-
- //Test update ring pointers
- case 14: test_update_copy();
- break;
-
- //Test gidel buffers
- case 15: test_gidel_buffers();
- break;
-
- case 0:
- default: cont = 0;
- }
- } while(cont);
-
- return 0;
-}
-
diff --git a/cleopatre/devkit/tests/plcdrv/gidel/htests/src/mbx_htests.cpp b/cleopatre/devkit/tests/plcdrv/gidel/htests/src/mbx_htests.cpp
deleted file mode 100644
index ae6a63e1d7..0000000000
--- a/cleopatre/devkit/tests/plcdrv/gidel/htests/src/mbx_htests.cpp
+++ /dev/null
@@ -1,109 +0,0 @@
-/* Cesar project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file test_hal.cpp
- * \brief tests of the HAL layer.
- * \ingroup Cleopatre - Isis
- *
- * For all tests of the hal procedure we have to check our functionnalities
- * directly with the hardware
- */
-
-#include <iostream>
-#include <vector>
-#include "mailbox.h"
-
-struct init_info init;
-static void test_handler(void)
-{
- printf("TX ack Interrupt\n");
-}
-
-void test_init(void)
-{
- printf("Init................");
-
- init.nb_data_buf_alloc = 1;
- init.nb_mme_buf_alloc = 1;
- init.nb_interface_buf_alloc = 1;
- init.txack_handler = &test_handler;
-
- //Test init procedure
- mailbox_init(&init);
- printf("OK\n");
-}
-
-
-void test_uninit(void)
-{
- printf("UnInit..............");
- //Test uninit procedure
- mailbox_uninit();
- printf("OK\n");
-}
-
-void test_send(void)
-{
- char msg[] = {0xEF, 0xBE, 0xAD, 0xDE, 0xEF, 0xBE, 0xED, 0xFE, 0xFE, 0xCA};
- printf("Send......................");
- printf("\nPrepare for FULL case.....");
- getchar();
- getchar();
- //Test mailbox send procedure
- if(mailbox_send((void*)msg, sizeof(msg), MME) != 0)
- printf("OK\n");
- else
- printf("KO\n");
-
- printf("Prepare for NORMAL case...");
- getchar();
- //Test mailbox send procedure
- if(mailbox_send((void*)msg, sizeof(msg), MME) == 0)
- printf("OK\n");
- else
- printf("KO\n");
-}
-
-int main(void)
-{
- int choice;
- int cont = 1;
-
- printf("Starting Tests for MAILBOX layer with a real hardware\n");
-
- do
- {
- printf("\n[0] Exit\n");
- printf("[1] Init\n");
- printf("[2] UnInit\n");
- printf("[3] Send\n");
- printf("\nWhich test do you want ? : ");
- scanf("%d",&choice);
-
- switch(choice)
- {
- //Test mailbox init procedure
- case 1: test_init();
- break;
-
- //Test mailbox uninit procedure
- case 2: test_uninit();
- break;
-
- //Test mailbox send procedure
- case 3: test_send();
- break;
-
- case 0:
- default: cont = 0;
- }
- } while(cont);
-
- return 0;
-}
-
diff --git a/cleopatre/devkit/tests/plcdrv/gidel/utests/Makefile b/cleopatre/devkit/tests/plcdrv/gidel/utests/Makefile
deleted file mode 100644
index ae3172b54f..0000000000
--- a/cleopatre/devkit/tests/plcdrv/gidel/utests/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-PRJ_BASE = ../../../../plcdrv/gidel
-FILES = hal
-FILES += mailbox
-FILES += processing
-FILES += plc_drv
-
-include ../../../utests_makerules
diff --git a/cleopatre/devkit/tests/plcdrv/gidel/utests/inc/hal_stub.h b/cleopatre/devkit/tests/plcdrv/gidel/utests/inc/hal_stub.h
deleted file mode 100644
index 4e9bfafddf..0000000000
--- a/cleopatre/devkit/tests/plcdrv/gidel/utests/inc/hal_stub.h
+++ /dev/null
@@ -1,507 +0,0 @@
-#ifndef hal_stub_h
-#define hal_stub_h
-/* Cesar project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file hal_stub.h
- * \brief HAL layer stub for mailbox tests.
- * \ingroup Cleopatre - Isis
- *
- * this layer provide all Hardware Abstraction:
- * registers, Gidel memory, interrupts.
- */
-
-#include "common.h"
-#include <string.h>
-#include <stdio.h>
-
-#define TYPICAL_BUFF_ADD_PTR 0x12345678
-#define TYPICAL_RCV_BUFF_PTR 0x12345678
-uint32_t gidel_ring[3];
-uint32_t gidel_size;
-uint32_t msg_ptr;
-uint32_t msg_size;
-
-/** Precise which IT arrived */
-enum pending_its {
- NONE = 0,
- A2LA = 1,
- L2AT = 2,
- ALL = 3,
-};
-
-/**
- * Initialize the hal layer.
- *
- * \param init user information.
- * \param irq_handler interrupt handler for L->A.
- */
-inline void halmbx_init(struct init_info *init, void(*irq_handler)(void*))
-{
-}
-
-/**
- * UnInitialize the hal layer.
- */
-inline void halmbx_uninit(void)
-{
-}
-
-/**
- * Check if Leon to Arm mailbox queue is empty.
- *
- * \return 0 if the queue is empty.
- */
-inline int halmbx_L2Amail_not_empty_queue(void)
-{
- static int nbtests = 0;
- if(nbtests == 0)
- { //return empty to test this function
- nbtests++;
- return 0;
- }
- else if(nbtests == 1)
- {//return empty to test copy_from_ring function
- nbtests++;
- return 8;
- }
- else if(nbtests == 2)
- {//return empty to test L2Amail_update function
- nbtests++;
- return 8;
- }
- else if(nbtests == 3)
- {//return empty to test send done false function
- nbtests++;
- return 8;
- }
- else if(nbtests == 4)
- {//return empty to test send done true function
- nbtests++;
- return 8;
- }
- else if(nbtests == 5)
- {//return empty to quit between each correct function tests
- nbtests++;
- return 0;
- }
- else if(nbtests == 6)
- {//return empty to test interface false with save memory function
- nbtests++;
- return 8;
- }
- else if(nbtests == 7)
- {//return empty to test interface false with processing receive function
- nbtests++;
- return 8;
- }
- else if(nbtests == 8)
- {//return empty to test interface true function
- nbtests++;
- return 8;
- }
- else if(nbtests == 9)
- {//return empty to quit between each correct function tests
- nbtests++;
- return 0;
- }
- else if(nbtests == 10)
- {//return empty to test data false with save memory function
- nbtests++;
- return 8;
- }
- else if(nbtests == 11)
- {//return empty to test data mme false with processing receive function
- nbtests++;
- return 8;
- }
- else if(nbtests == 12)
- {//return empty to test data mme true function
- nbtests++;
- return 8;
- }
- else if(nbtests == 13)
- {//return empty to quit between each correct function tests
- nbtests++;
- return 0;
- }
- else if(nbtests == 14)
- {//return empty to test data data false with processing receive function
- nbtests++;
- return 8;
- }
- else if(nbtests == 15)
- {//return empty to test data data true function
- nbtests++;
- return 8;
- }
- else if(nbtests == 16)
- {//return empty to quit between each correct function tests
- nbtests++;
- return 0;
- }
- else if(nbtests == 17)
- {//return empty to test general false case
- nbtests++;
- return 8;
- }
- else
- {
- nbtests++;
- return 8;
- }
-}
-
-/**
- * Check Arm to Leon mailbox queue status.
- *
- * \return queue state.
- */
-inline int halmbx_A2Lmail_status_queue(void)
-{
- //first time we will use it in a function it will generate an error
- static int nbtests = 0;
- if(nbtests++ == 0)
- return FULL;
- else
- return NOT_FULL;
-}
-
-/**
- * Check Leon to Arm mailbox queue status.
- *
- * \return queue state.
- */
-inline int halmbx_L2Amail_status_queue(void)
-{
- //first time we will use it in a function it will generate an error
- static int nbtests = 0;
- if(nbtests++ == 0)
- return FULL;
- else
- return NOT_FULL;
-}
-
-/**
- * Copy message from the Gidel Memory
- * to the PC Memory.
- *
- * \param message pointer to the message.
- * \param size message size in bytes.
- * \return address on the Gidel memory.
- */
-inline uint32_t halmbx_save_in_pc_memory(uint32_t *message, int size)
-{
- //first and third time we will use it in a function it will generate an error
- //for the interface type and the data type
- static int nbtests = 0;
- if(nbtests == 0 || nbtests == 3)
- {
- nbtests++;
- return 0;
- }
- else
- {
- nbtests++;
- msg_size = size;
- msg_ptr = (uint32_t)message;
- return (uint32_t)message;
- }
-}
-
-/**
- * Free message space in the PC Memory.
- *
- * \param message pointer to the message.
- * \return error code.
- */
-inline int halmbx_free_in_pc_memory(uint32_t *message)
-{
- return 0;
-}
-
-/**
- * Alloc message space on the Gidel Memory.
- *
- * \return address on the Gidel memory.
- */
-inline uint32_t halmbx_alloc_in_gidel_memory(void)
-{
- //first time we will use it in a function it will generate an error
- static int nbtests = 0;
- if(nbtests++ == 0)
- return 0;
- else
- return (uint32_t)TYPICAL_BUFF_ADD_PTR;
-}
-
-/**
- * Copy message from the PC Memory
- * to the Gidel Memory.
- *
- * \param message pointer to the message.
- * \param size message size in bytes.
- * \return address on the Gidel memory.
- */
-inline uint32_t halmbx_save_in_gidel_memory(uint32_t *message, int size)
-{
- //first time we will use it in a function it will generate an error
- static int nbtests = 0;
- if(nbtests++ == 0)
- return 0;
- else
- return (uint32_t)message;
-}
-
-/**
- * Free message space in the Gidel Memory.
- *
- * \param message pointer to the message.
- * \return error code.
- */
-inline int halmbx_free_in_gidel_memory(uint32_t *message)
-{
- //first time we will use it in a function it will generate an error
- static int nbtests = 0;
- if(nbtests++ == 0)
- return -1;
- else
- return 0;
-}
-
-/**
- * Copy message to the ring buffer.
- *
- * \param message pointer to the message align on 32bits.
- * \param size message size in bytes and align on 32bits.
- * \return error code.
- */
-inline int halmbx_copy_to_ring (uint32_t *message, int size)
-{
- //first time we will use it in a function it will generate an error
- static int nbtests = 0;
- if(nbtests++ == 0)
- return -1;
- else
- {
- memcpy(gidel_ring, message, size);
- return 0;
- }
-}
-
-/**
- * Copy message from the ring buffer.
- *
- * \param message pointer to the message align on 32bits.
- * \param size max message size in bytes and align on 32bits.
- * \return error code.
- */
-inline int halmbx_copy_from_ring (uint32_t *message, int size)
-{
- static int nbtests = 0;
- if(nbtests == 0)
- {
- nbtests++;
- return -1;
- }
- else if(nbtests == 1)
- {//L2A_update = error
- nbtests++;
- return 0;
- }
- else if(nbtests == 2)
- {//send done false
- nbtests++;
- *message = 0x00000102;
- *(message+1) = TYPICAL_RCV_BUFF_PTR;
- return 0;
- }
- else if(nbtests == 3)
- {//send done true
- nbtests++;
- *message = 0x00000102;
- *(message+1) = TYPICAL_RCV_BUFF_PTR;
- return 0;
- }
- else if(nbtests == 4)
- {//interface copy false
- nbtests++;
- *message = 0x00000103;
- *(message+1) = TYPICAL_RCV_BUFF_PTR;
- return 0;
- }
- else if(nbtests == 5)
- {//interface processing false
- nbtests++;
- *message = 0x00000103;
- *(message+1) = TYPICAL_RCV_BUFF_PTR;
- return 0;
- }
- else if(nbtests == 6)
- {//interface true
- nbtests++;
- *message = 0x00200103;
- *(message+1) = TYPICAL_RCV_BUFF_PTR;
- return 0;
- }
- else if(nbtests == 7)
- {//data copy false
- nbtests++;
- *message = 0x00000100;
- *(message+1) = TYPICAL_RCV_BUFF_PTR;
- return 0;
- }
- else if(nbtests == 8)
- {//data processing mme false
- nbtests++;
- *message = 0x00001100;
- *(message+1) = TYPICAL_RCV_BUFF_PTR;
- return 0;
- }
- else if(nbtests == 9)
- {//data processing mme true
- nbtests++;
- *message = 0x00000100;
- *(message+1) = TYPICAL_RCV_BUFF_PTR;
- return 0;
- }
- else if(nbtests == 10)
- {//data precessing data false
- nbtests++;
- *message = 0x00000100;
- *(message+1) = TYPICAL_RCV_BUFF_PTR;
- return 0;
- }
- else if(nbtests == 11)
- {//data precessing data true
- nbtests++;
- *message = 0x00004100;
- *(message+1) = TYPICAL_RCV_BUFF_PTR;
- return 0;
- }
- else if(nbtests == 12)
- {//type msg error
- nbtests++;
- *message = 0x00000105;
- *(message+1) = TYPICAL_RCV_BUFF_PTR;
- return 0;
- }
- else
- {
- nbtests++;
- return 0;
- }
-}
-
-/**
- * Update the ring management for Leon to Arm mailbox (TX).
- *
- * \param size real size of the last proceed message.
- * \return error code.
- */
-inline int halmbx_A2Lmail_update (int size)
-{
- //first time we will use it in a function it will generate an error
- static int nbtests = 0;
- if(nbtests++ == 0)
- return -1;
- else
- {
- //return the size for tests_mailbox.c with global variable
- gidel_size = size;
- return 0;
- }
-}
-
-/**
- * Update the ring management for Arm to Leon mailbox (RX).
- *
- * \param size real size of the last proceed message.
- * \return error code.
- */
-inline int halmbx_L2Amail_update (int size)
-{
- //first time we will use it in a function it will generate an error
- static int nbtests = 0;
- if(nbtests++ == 0)
- return -1;
- else
- {
- //return the size for tests_mailbox.c with global variable
- gidel_size = size;
- return 0;
- }
-}
-
-/**
- * Enable the Arm to Leon Acknowledge Interrupt.
- */
-inline void A2La_it_enable(void)
-{
-}
-
-/**
- * Enable the Leon to Arm Trigger Interrupt.
- */
-inline void L2At_it_enable(void)
-{
-}
-
-/**
- * Disable the Arm to Leon Acknowledge Interrupt.
- */
-inline void A2La_it_disable(void)
-{
-}
-
-/**
- * Disable the Leon to Arm Trigger Interrupt.
- */
-inline void L2At_it_disable(void)
-{
-}
-
-/**
- * Set the Arm to Leon Interrupt.
- */
-inline void set_A2Lt_interrupt(void)
-{
-}
-
-/**
- * Set the Arm to Leon acknowledge Interrupt.
- */
-inline void set_L2Aa_interrupt(void)
-{
-}
-
-/**
- * Clear the Leon to Arm Interrupt.
- */
-inline void clr_L2At_interrupt(void)
-{
-}
-
-/**
- * Clear the Leon to Arm acknowledge Interrupt.
- */
-inline void clr_A2La_interrupt(void)
-{
-}
-
-/**
- * Disable the Leon to Arm Trigger Interrupt.
- *
- * \return waiting its.
- */
-inline enum pending_its check_its(void)
-{
- return NONE;
-}
-
-#endif /* hal_stub_h */
diff --git a/cleopatre/devkit/tests/plcdrv/gidel/utests/inc/hard_stub.h b/cleopatre/devkit/tests/plcdrv/gidel/utests/inc/hard_stub.h
deleted file mode 100644
index cf82a2d9f1..0000000000
--- a/cleopatre/devkit/tests/plcdrv/gidel/utests/inc/hard_stub.h
+++ /dev/null
@@ -1,52 +0,0 @@
-#ifndef hard_stub_h
-#define hard_stub_h
-/* Cesar project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file hard_stub.h
- * \brief Hardware stub for tests.
- * \ingroup Cleopatre - Isis
- *
- * For tests we don't need the hardware so we have to stub it.
- */
-
-#define A2L_RING_SIZE (0x10)
-#define L2A_RING_SIZE (A2L_RING_SIZE)
-#define A2L_RING_MASK (A2L_RING_SIZE-1)
-#define L2A_RING_MASK (L2A_RING_SIZE-1)
-
-extern uint32_t A2L_ring[A2L_RING_SIZE];
-extern uint32_t L2A_ring[L2A_RING_SIZE];
-
-#define A2L_RING_BASE_ADDR ((uint32_t)&A2L_ring[0])
-#define L2A_RING_BASE_ADDR ((uint32_t)&L2A_ring[0])
-
-extern uint32_t **A2L_ptr;
-extern uint32_t **L2A_ptr;
-
-extern uint32_t *A2L_head;
-extern uint32_t *A2L_tail;
-extern uint32_t *L2A_head;
-extern uint32_t *L2A_tail;
-extern uint32_t *A2L_it;
-extern uint32_t *L2A_it;
-extern uint32_t *L2A_it_mask;
-
-#define L2AT_EN_MASK (0x00000001)
-#define L2AA_EN_MASK (0x00000002)
-#define A2LT_MASK (0x00000001)
-#define A2LA_MASK (0x00000002)
-#define L2AT_MASK (0x00000001)
-#define L2AA_MASK (0x00000002)
-
-
-#define MAX_GIDEL_BUFFER ((A2L_RING_SIZE+L2A_RING_SIZE)*2)
-extern uint32_t buffer_gidel[MAX_GIDEL_BUFFER][ETH_MAX_SIZE];
-#define BUFFER_GIDEL_BASE_ADDR ((uint32_t)&buffer_gidel[0][0])
-
-#endif /* hard_stub_h */
diff --git a/cleopatre/devkit/tests/plcdrv/gidel/utests/inc/mailbox_stub.h b/cleopatre/devkit/tests/plcdrv/gidel/utests/inc/mailbox_stub.h
deleted file mode 100644
index e7f39b1b9f..0000000000
--- a/cleopatre/devkit/tests/plcdrv/gidel/utests/inc/mailbox_stub.h
+++ /dev/null
@@ -1,60 +0,0 @@
-#ifndef mailbox_stub_h
-#define mailbox_stub_h
-/* Cesar project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file mailbox_stub.h
- * \brief Mailbox stub for the PLC driver processing layer tests.
- * \ingroup Cleopatre - Isis
- */
-
-#include "common.h"
-
-#define MAX_MSG_SIZE 12 //max size of a mailbox message in bytes
-
-/**
- * Initialize the mailbox layer.
- *
- * \param init user information.
- */
-inline void mailbox_init(struct init_info *init)
-{
-}
-
-/**
- * UnInitialize the mailbox layer.
- */
-inline void mailbox_uninit(void)
-{
-}
-
-/**
- * Send a message to the HLE layer.
- *
- * \param pointer the message pointer.
- * \param length the length of the message.
- * \param type type of message.
- * \return error code.
- */
-inline int mailbox_send(void *pointer, uint32_t length, enum buffer_type type)
-{
- return 0;
-}
-
-/**
- * Receive everything from the HLE layer.
- *
- * \return error code.
- */
-inline int mailbox_receive(void)
-{
- return 0;
-}
-
-
-#endif /* mailbox_stub_h */
diff --git a/cleopatre/devkit/tests/plcdrv/gidel/utests/inc/plc_drv_stub.h b/cleopatre/devkit/tests/plcdrv/gidel/utests/inc/plc_drv_stub.h
deleted file mode 100644
index da65b6995e..0000000000
--- a/cleopatre/devkit/tests/plcdrv/gidel/utests/inc/plc_drv_stub.h
+++ /dev/null
@@ -1,38 +0,0 @@
-#ifndef plc_drv_stub_h
-#define plc_drv_stub_h
-/* Cesar project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file plc_drv_stub.h
- * \brief OS layer stub for the PLC driver processing layer tests.
- * \ingroup Cleopatre - Isis
- */
-
-#include "common.h"
-
-/**
- * Receive a packet.
- *
- * \param pointer the packet pointer.
- * \param length the length of the packet.
- * \return error code.
- */
-inline int plcdrv_rx(void *pointer, int length)
-{
- return 0;
-}
-
-/**
- * Precedure executed when the frame is really sending to CESAR
- * and only when there are few buffer in the mailbox ring.
- */
-inline void plcdrv_tx_ack(void)
-{
-}
-
-#endif /* plc_drv_stub_h */
diff --git a/cleopatre/devkit/tests/plcdrv/gidel/utests/inc/processing_stub.h b/cleopatre/devkit/tests/plcdrv/gidel/utests/inc/processing_stub.h
deleted file mode 100644
index 03113f12a1..0000000000
--- a/cleopatre/devkit/tests/plcdrv/gidel/utests/inc/processing_stub.h
+++ /dev/null
@@ -1,102 +0,0 @@
-#ifndef processing_stub_h
-#define processing_stub_h
-/* Cesar project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file processing.h
- * \brief Processing layer for the PLC driver.
- * \ingroup Cleopatre - Isis
- *
- * this layer is used to check every packet received by CESAR or TUN/TAP
- * and sometime drop it.
- */
-
-#include "common.h"
-#include <stdio.h>
-
-static inline uint32_t hal_ctrl_dsp_ss_read(uint32_t offset)
-{
- return 0;
-}
-static inline int hal_ctrl_dsp_ss_write(uint32_t offset, uint32_t *value)
-{
- return 0;
-}
-static inline uint32_t hal_afredi_memory_read(uint32_t offset)
-{
- return 0;
-}
-static inline int hal_afredi_memory_write(uint32_t offset, uint32_t *value)
-{
- return 0;
-}
-
-/**
- * Initialize the processing layer.
- *
- * \param init user information.
- */
-inline void processing_init(struct init_info *init)
-{
-}
-
-/**
- * UnInitialize the processing layer.
- */
-inline void processing_uninit(void)
-{
-}
-
-/**
- * Processing procedure for a A->L message.
- *
- * \param pointer packet pointer.
- * \param length length of the packet pointed.
- * \return status queue.
- */
-inline int processing_send (void *pointer, int length)
-{
- //first time we will use it in a function it will generate an error
- static int nbtests = 0;
- if(nbtests == 0)
- {
- nbtests++;
- return -1;
- }
- else
- {
- nbtests++;
- return 0;
- }
-}
-
-/**
- * Processing procedure for a L->A message.
- *
- * \param pointer packet pointer.
- * \param length length of the packet pointed.
- * \param type type of message.
- * \return error code.
- */
-inline int processing_receive (void *pointer, int length, enum buffer_type type)
-{
- //half time we will use it in a function it will generate an error
- static int nbtests = 0;
- if(nbtests == 0 || nbtests == 2 || nbtests == 4)
- {
- nbtests++;
- return -1;
- }
- else
- {
- nbtests++;
- return 0;
- }
-}
-
-#endif /* processing_stub_h */
diff --git a/cleopatre/devkit/tests/plcdrv/gidel/utests/src/hal_utests.cpp b/cleopatre/devkit/tests/plcdrv/gidel/utests/src/hal_utests.cpp
deleted file mode 100644
index 8a6e337b18..0000000000
--- a/cleopatre/devkit/tests/plcdrv/gidel/utests/src/hal_utests.cpp
+++ /dev/null
@@ -1,430 +0,0 @@
-/* Cesar project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file test_hal.cpp
- * \brief tests of the HAL layer.
- * \ingroup Cleopatre - Isis
- */
-
-#include <iostream>
-#include <vector>
-#include <check.h>
-#include <stdio.h>
-#include "hal.h"
-
-/** global variables used by stub files to recover informations */
-extern std::vector<uint32_t> free_buff_list;
-
-/** local variables */
-static struct init_info init;
-void testhal_handler(void* data)
-{
- printf("testhal_handler\n");
-}
-
-/** init test procedure */
-START_TEST (test_halmbx_init)
-{
- int i;
- halmbx_init(&init, &testhal_handler);
-
- //Check mailbox pointer initialization
- fail_if(*A2L_head != A2L_RING_BASE_ADDR, "A2L_head pointer not initialize");
- fail_if(*A2L_tail != A2L_RING_BASE_ADDR, "A2L_tail pointer not initialize");
- fail_if(*L2A_head != L2A_RING_BASE_ADDR, "L2A_head pointer not initialize");
- fail_if(*L2A_tail != L2A_RING_BASE_ADDR, "L2A_tail pointer not initialize");
-
- //Check list of free buffers
- fail_if(free_buff_list.size() != MAX_GIDEL_BUFFER, "Number of free buffer uncorrect");
-
- std::vector<uint32_t>::iterator it;
- for(it=free_buff_list.begin(), i=0 ; it<free_buff_list.end(); it++, i++)
- {
- fail_if(*it != (BUFFER_GIDEL_BASE_ADDR+i*ETH_MAX_SIZE), "Free buffer address error");
- }
-}
-END_TEST
-
-START_TEST (test_set_A2Lt_interrupt)
-{
- *A2L_it = 0;
- set_A2Lt_interrupt();
- fail_if(*A2L_it != 0x01, "A2L trigger not set");
- *A2L_it = 3;
- set_A2Lt_interrupt();
- fail_if(*A2L_it != 0x03, "A2L trigger not set");
-}
-END_TEST
-
-START_TEST (test_set_L2Aa_interrupt)
-{
- *A2L_it = 0;
- set_L2Aa_interrupt();
- fail_if(*A2L_it != 0x02, "L2A acknowledge not set");
- *A2L_it = 3;
- set_L2Aa_interrupt();
- fail_if(*A2L_it != 0x03, "L2A acknowledge not set");
-}
-END_TEST
-
-START_TEST (test_clr_L2At_interrupt)
-{
- *L2A_it = 1;
- clr_L2At_interrupt();
- fail_if(*L2A_it != 0x01, "L2A trigger not clr");
- *L2A_it = 2;
- clr_L2At_interrupt();
- fail_if(*L2A_it != 0x01, "L2A trigger not clr");
-}
-END_TEST
-
-START_TEST (test_clr_A2La_interrupt)
-{
- *L2A_it = 2;
- clr_A2La_interrupt();
- fail_if(*L2A_it != 0x02, "A2L acknowledge not clr");
- *L2A_it = 1;
- clr_A2La_interrupt();
- fail_if(*L2A_it != 0x02, "A2L acknowledge not clr");
-}
-END_TEST
-
-START_TEST (test_A2La_it_enable)
-{
- *L2A_it_mask = 2;
- A2La_it_enable();
- fail_if(*L2A_it_mask != 0x00, "A2L acknowledge not enable");
- *L2A_it_mask = 1;
- A2La_it_enable();
- fail_if(*L2A_it_mask != 0x01, "A2L acknowledge not enable");
-}
-END_TEST
-
-START_TEST (test_L2At_it_enable)
-{
- *L2A_it_mask = 1;
- L2At_it_enable();
- fail_if(*L2A_it_mask != 0x00, "L2A trigger not enable");
- *L2A_it_mask = 2;
- L2At_it_enable();
- fail_if(*L2A_it_mask != 0x02, "L2A trigger not enable");
-}
-END_TEST
-
-START_TEST (test_A2La_it_disable)
-{
- *L2A_it_mask = 0;
- A2La_it_disable();
- fail_if(*L2A_it_mask != 0x02, "A2L acknowledge not disable");
- *L2A_it_mask = 3;
- A2La_it_disable();
- fail_if(*L2A_it_mask != 0x03, "A2L acknowledge not disable");
-}
-END_TEST
-
-START_TEST (test_L2At_it_disable)
-{
- *L2A_it_mask = 0;
- L2At_it_disable();
- fail_if(*L2A_it_mask != 0x01, "L2A trigger not disable");
- *L2A_it_mask = 3;
- L2At_it_disable();
- fail_if(*L2A_it_mask != 0x03, "L2A trigger not disable");
-}
-END_TEST
-
-START_TEST (test_halmbx_L2Amail_not_empty_queue)
-{
- //The ring size for the test is 0xF
- *L2A_tail = L2A_RING_BASE_ADDR + 0x5;
- *L2A_head = L2A_RING_BASE_ADDR + 0x5;
- fail_if(halmbx_L2Amail_not_empty_queue() != 0, "Error checking L2A not empty queue");
- *L2A_tail = L2A_RING_BASE_ADDR + 0xA;
- *L2A_head = L2A_RING_BASE_ADDR + 0x7;
- fail_if(halmbx_L2Amail_not_empty_queue() == 0, "Error checking L2A not empty queue");
- *L2A_tail = L2A_RING_BASE_ADDR + 0x0;
- *L2A_head = L2A_RING_BASE_ADDR + 0xE;
- fail_if(halmbx_L2Amail_not_empty_queue() == 0, "Error checking L2A not empty queue");
-}
-END_TEST
-
-START_TEST (test_halmbx_A2Lmail_status_queue)
-{
- //The ring size for the test is 0xF
- *A2L_tail = A2L_RING_BASE_ADDR + 0x5;
- *A2L_head = A2L_RING_BASE_ADDR + 0x5;
- fail_if(halmbx_A2Lmail_status_queue() != NOT_FULL, "Error checking A2L status queue");
- *A2L_tail = A2L_RING_BASE_ADDR + 0xA;
- *A2L_head = A2L_RING_BASE_ADDR + 0x7;
- fail_if(halmbx_A2Lmail_status_queue() != NOT_FULL, "Error checking A2L status queue");
- *A2L_tail = A2L_RING_BASE_ADDR + 0x0;
- *A2L_head = A2L_RING_BASE_ADDR + 0xE;
- fail_if(halmbx_A2Lmail_status_queue() != NOT_FULL, "Error checking A2L status queue");
- *A2L_tail = A2L_RING_BASE_ADDR + 0x7;
- *A2L_head = A2L_RING_BASE_ADDR + 0xA;
- fail_if(halmbx_A2Lmail_status_queue() != FULL, "Error checking A2L status queue");
-}
-END_TEST
-
-START_TEST (test_halmbx_L2Amail_status_queue)
-{
- //The ring size for the test is 0xF
- *L2A_tail = L2A_RING_BASE_ADDR + 0x5;
- *L2A_head = L2A_RING_BASE_ADDR + 0x5;
- fail_if(halmbx_L2Amail_status_queue() != NOT_FULL, "Error checking L2A status queue");
- *L2A_tail = L2A_RING_BASE_ADDR + 0xA;
- *L2A_head = L2A_RING_BASE_ADDR + 0x7;
- fail_if(halmbx_L2Amail_status_queue() != NOT_FULL, "Error checking L2A status queue");
- *L2A_tail = L2A_RING_BASE_ADDR + 0x0;
- *L2A_head = L2A_RING_BASE_ADDR + 0xE;
- fail_if(halmbx_L2Amail_status_queue() != NOT_FULL, "Error checking L2A status queue");
- *L2A_tail = L2A_RING_BASE_ADDR + 0x7;
- *L2A_head = L2A_RING_BASE_ADDR + 0xA;
- fail_if(halmbx_L2Amail_status_queue() != FULL, "Error checking L2A status queue");
-}
-END_TEST
-
-START_TEST (test_halmbx_alloc_free_in_gidel_memory)
-{
- //Init HAL to fill the vector
- halmbx_init(&init, &testhal_handler);
- //Alloc part
- uint32_t addr = free_buff_list.back();
- fail_if(halmbx_alloc_in_gidel_memory() != addr, "Uncorrect free buffer");
- fail_if(free_buff_list.back() == addr, "Error with free buffer allocation");
-
- //Free part
- halmbx_free_in_gidel_memory((uint32_t*)addr);
- fail_if(free_buff_list.back() != addr, "Error with free buffer liberation");
-}
-END_TEST
-
-START_TEST (test_halmbx_save_in_gidel_memory)
-{
- //Init HAL to fill the vector
- halmbx_init(&init, &testhal_handler);
-
- //Check arguments
- fail_if(halmbx_save_in_gidel_memory(NULL,ETH_MAX_SIZE+5) != 0, "Error with a too big size");
- fail_if(halmbx_save_in_gidel_memory(NULL,0) != 0, "Error without size");
- fail_if(halmbx_save_in_gidel_memory(NULL,5) != 0, "Error without pointer");
-
- //Check function
- char msg[] = "Hello I'm a test";
- char *new_msg = (char*)halmbx_save_in_gidel_memory((uint32_t*)msg, sizeof(msg));
- fail_if(strncmp(new_msg, msg, sizeof(msg)) != 0, "Error with copy");
- halmbx_free_in_gidel_memory((uint32_t*)new_msg);
-}
-END_TEST
-
-START_TEST (test_halmbx_save_in_pc_memory)
-{
- //Init HAL to fill the vector
- halmbx_init(&init, &testhal_handler);
-
- //Check arguments
- fail_if(halmbx_save_in_pc_memory(NULL,ETH_MAX_SIZE+5) != 0, "Error with a too big size");
- fail_if(halmbx_save_in_pc_memory(NULL,0) != 0, "Error without size");
- fail_if(halmbx_save_in_pc_memory(NULL,5) != 0, "Error without pointer");
-
- //Check function
- char msg_origin[] = "Hello I'm a test";
- char *msg = (char *)halmbx_alloc_in_gidel_memory();
- strncpy(msg, msg_origin, sizeof(msg_origin));
-
- uint32_t new_msg_addr = halmbx_save_in_pc_memory((uint32_t*)msg, sizeof(msg_origin));
- char* new_msg = (char*)new_msg_addr;
- fail_if(strncmp(new_msg, msg_origin, sizeof(msg_origin)) != 0, "Error with copy");
-
- halmbx_free_in_pc_memory((uint32_t*)new_msg_addr);
-}
-END_TEST
-
-START_TEST (test_halmbx_copy_to_ring)
-{
- //Init HAL to fill the vector
- halmbx_init(&init, &testhal_handler);
-
- //Check arguments
- fail_if(halmbx_copy_to_ring(NULL,ETH_MAX_SIZE+5) == 0, "Error with a too big size");
- fail_if(halmbx_copy_to_ring(NULL,0) == 0, "Error without size");
- fail_if(halmbx_copy_to_ring(NULL,3) == 0, "Error with size not align");
- fail_if(halmbx_copy_to_ring(NULL,4) == 0, "Error without pointer");
- fail_if(halmbx_copy_to_ring((uint32_t*)0x67546421,4) == 0, "Error with pointer not align");
-
- //Check function
- uint32_t msg[] = {0x12345678, 0xFEDCBA98};
- *A2L_tail = A2L_RING_BASE_ADDR + 0x4;
- *A2L_head = A2L_RING_BASE_ADDR + 0x4;
- fail_if(halmbx_copy_to_ring((uint32_t*)msg, sizeof(msg)) != 0, "Error before copy");
- uint32_t *res = (uint32_t*)*A2L_tail;
- fail_if(*res++ != msg[0], "Error with copy");
- fail_if(*res != msg[1], "Error with copy");
-
- *A2L_tail = A2L_RING_BASE_ADDR + 0xC;
- *A2L_head = A2L_RING_BASE_ADDR + 0xC;
- fail_if(halmbx_copy_to_ring((uint32_t*)msg, sizeof(msg)) != 0, "Error before copy");
- res = (uint32_t*)*A2L_tail;
- fail_if(*res != msg[0], "Error with rollover copy"); //offset=C to F
- res = (uint32_t*)A2L_RING_BASE_ADDR;
- fail_if(*res != msg[1], "Error with rollover copy"); //offset=0 to 3
-}
-END_TEST
-
-START_TEST (test_halmbx_copy_from_ring)
-{
- //Init HAL to fill the vector
- halmbx_init(&init, &testhal_handler);
-
- //Check arguments
- fail_if(halmbx_copy_from_ring(NULL,ETH_MAX_SIZE+5) == 0, "Error with a too big size");
- fail_if(halmbx_copy_from_ring(NULL,0) == 0, "Error without size");
- fail_if(halmbx_copy_from_ring(NULL,3) == 0, "Error with size not align");
- fail_if(halmbx_copy_from_ring(NULL,4) == 0, "Error without pointer");
- fail_if(halmbx_copy_from_ring((uint32_t*)0x67546421,4) == 0, "Error with pointer not align");
-
- //Check function
- uint32_t msg_origin[] = {0x87654321, 0x89ABCDEF};
- uint32_t msg[2];
- *L2A_tail = L2A_RING_BASE_ADDR + 0x4;
- *L2A_head = L2A_RING_BASE_ADDR + 0x4;
- uint32_t *res = (uint32_t*)*L2A_head;
- *res = msg_origin[0];
- *(res+1) = msg_origin[1];
- fail_if(halmbx_copy_from_ring((uint32_t*)msg, sizeof(msg_origin)) != 0, "Error before copy");
- fail_if(msg[0] != msg[0], "Error with copy");
- fail_if(msg[1] != msg[1], "Error with copy");
-
- memset((char*)*L2A_head, 0, 4);
- *L2A_tail = L2A_RING_BASE_ADDR + 0xC;
- *L2A_head = L2A_RING_BASE_ADDR + 0xC;
- res = (uint32_t*)*L2A_head; //offset=C to F
- *res = msg_origin[0];
- res = (uint32_t*)L2A_RING_BASE_ADDR; //offset=0 to 3
- *(res+1) = msg_origin[1];
- fail_if(halmbx_copy_from_ring((uint32_t*)msg, sizeof(msg_origin)) != 0, "Error before copy");
- fail_if(msg[0] != msg[0], "Error with rollover copy");
- fail_if(msg[1] != msg[1], "Error with rollover copy");
-}
-END_TEST
-
-START_TEST (test_halmbx_A2Lmail_update)
-{
- fail_if(halmbx_A2Lmail_update(0) == 0, "Error without size");
- *A2L_tail = A2L_RING_BASE_ADDR + 0x4;
- *A2L_head = A2L_RING_BASE_ADDR + 0x4;
- fail_if(halmbx_A2Lmail_update(8) != 0, "Error before update");
- fail_if(*A2L_tail != (A2L_RING_BASE_ADDR + 0xC), "Error with update");
- *A2L_tail = A2L_RING_BASE_ADDR + 0xC;
- *A2L_head = A2L_RING_BASE_ADDR + 0xC;
- fail_if(halmbx_A2Lmail_update(8) != 0, "Error before update");
- fail_if(*A2L_tail != (A2L_RING_BASE_ADDR + 0x4), "Error with rollover update");
-}
-END_TEST
-
-START_TEST (test_halmbx_L2Amail_update)
-{
- fail_if(halmbx_L2Amail_update(0) == 0, "Error without size");
- *L2A_tail = L2A_RING_BASE_ADDR + 0x4;
- *L2A_head = L2A_RING_BASE_ADDR + 0x4;
- fail_if(halmbx_L2Amail_update(4) != 0, "Error before update");
- fail_if(*L2A_head != (L2A_RING_BASE_ADDR + 0x8), "Error with update");
- *L2A_tail = L2A_RING_BASE_ADDR + 0xC;
- *L2A_head = L2A_RING_BASE_ADDR + 0xC;
- fail_if(halmbx_L2Amail_update(0xC) != 0, "Error before update");
- fail_if(*L2A_head != (L2A_RING_BASE_ADDR + 0x8), "Error with rollover update");
-}
-END_TEST
-
-START_TEST (test_check_its)
-{
- *L2A_it = 0x4;
- fail_if(check_its() != NONE, "Error with no It reception");
- *L2A_it = 0x0;
- fail_if(check_its() != NONE, "Error with no It reception");
- *L2A_it = 0x3;
- fail_if(check_its() != ALL, "Error with two It reception");
- *L2A_it = 0x2;
- fail_if(check_its() != A2LA, "Error with A2L acknowledge It reception");
- *L2A_it = 0x1;
- fail_if(check_its() != L2AT, "Error with L2A trigger It reception");
-}
-END_TEST
-
-extern "C" Suite* halmbx_suite(void)
-{
- Suite *s = suite_create("HAL");
- TCase *tc_core = tcase_create("Core");
-
- //Test halmbx_init
- tcase_add_test(tc_core, test_halmbx_init);
-
- //Test set_A2Lt_interrupt
- tcase_add_test(tc_core, test_set_A2Lt_interrupt);
- //Test set_L2Aa_interrupt
- tcase_add_test(tc_core, test_set_L2Aa_interrupt);
- //Test clr_L2At_interrupt
- tcase_add_test(tc_core, test_clr_L2At_interrupt);
- //Test clr_A2La_interrupt
- tcase_add_test(tc_core, test_clr_A2La_interrupt);
-
- //Test en_A2La_interrupt
- tcase_add_test(tc_core, test_A2La_it_enable);
- //Test en_L2At_interrupt
- tcase_add_test(tc_core, test_L2At_it_enable);
- //Test dis_A2La_interrupt
- tcase_add_test(tc_core, test_A2La_it_disable);
- //Test dis_L2At_interrupt
- tcase_add_test(tc_core, test_L2At_it_disable);
-
- //Test halmbx_L2Amail_not_empty_queue
- tcase_add_test(tc_core, test_halmbx_L2Amail_not_empty_queue);
- //Test halmbx_A2Lmail_status_queue
- tcase_add_test(tc_core, test_halmbx_A2Lmail_status_queue);
- //Test halmbx_L2Amail_status_queue
- tcase_add_test(tc_core, test_halmbx_L2Amail_status_queue);
-
- //Test halmbx_alloc_in_gidel_memory
- tcase_add_test(tc_core, test_halmbx_alloc_free_in_gidel_memory);
- //Test halmbx_save_in_gidel_memory
- tcase_add_test(tc_core, test_halmbx_save_in_gidel_memory);
- //Test halmbx_save_in_pc_memory
- tcase_add_test(tc_core, test_halmbx_save_in_pc_memory);
-
- //Test halmbx_copy_to_ring
- tcase_add_test(tc_core, test_halmbx_copy_to_ring);
- //Test halmbx_copy_from_ring
- tcase_add_test(tc_core, test_halmbx_copy_from_ring);
- //Test halmbx_A2Lmail_update
- tcase_add_test(tc_core, test_halmbx_A2Lmail_update);
- //Test halmbx_L2Amail_update
- tcase_add_test(tc_core, test_halmbx_L2Amail_update);
-
- //Test pending_its_check_its
- tcase_add_test(tc_core, test_check_its);
-
- suite_add_tcase(s, tc_core);
- return s;
-}
-
-int main(void)
-{
- int number_failed = 0;
- Suite *s;
-
- //Run HAL tests
- s = halmbx_suite();
-
- SRunner *sr = srunner_create(s);
- srunner_run_all(sr, CK_NORMAL);
- number_failed = srunner_ntests_failed(sr);
- srunner_free(sr);
-
- return (number_failed == 0) ? 0 : -1;
-}
-
diff --git a/cleopatre/devkit/tests/plcdrv/gidel/utests/src/mailbox_utests.c b/cleopatre/devkit/tests/plcdrv/gidel/utests/src/mailbox_utests.c
deleted file mode 100644
index da44081732..0000000000
--- a/cleopatre/devkit/tests/plcdrv/gidel/utests/src/mailbox_utests.c
+++ /dev/null
@@ -1,232 +0,0 @@
-/* Cesar project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file test_mailbox.c
- * \brief tests of the MAILBOX layer.
- * \ingroup Cleopatre - Isis
- */
-
-#include <check.h>
-#include <stdio.h>
-#include "mailbox.h"
-
-/** global variables used by stub files to recover informations */
-#define TYPICAL_BUFF_ADD_PTR 0x12345678
-#define TYPICAL_RCV_BUFF_PTR 0x12345678
-extern uint32_t gidel_ring[3];
-extern uint32_t gidel_size;
-extern uint32_t msg_ptr;
-extern uint32_t msg_size;
-extern void (*txack_handler)(void);
-
-/** local variables */
-static struct init_info init;
-void test_handler(void)
-{
- printf("txack_handler\n");
-}
-
-/** buffer add test procedure */
-START_TEST (test_mailbox_buffer_add)
-{
- uint32_t *res = &gidel_ring[0];
-
- //Check code with the status queue error (remember the first time we call
- //status_queue it returns an error)
- fail_if(mailbox_buffer_add(DATA) != FULL, "Error with status queue");
- //Check code with Alloc_in_gidel_memory error (remember the first time we call
- //Alloc_in_gidel_memory it returns an error)
- fail_if(mailbox_buffer_add(DATA) != FULL, "Error with Alloc_in_gidel");
- //Check code with copy_to_ring error (remember the first time we call
- //copy_to_ring it returns an error)
- fail_if(mailbox_buffer_add(DATA) == 0, "Error with copy to ring");
- //Check code with A2L_update error (remember the first time we call
- //A2L_update it returns an error)
- fail_if(mailbox_buffer_add(DATA) == 0, "Error with update ring pointer");
-
- //CHECK THE REAL FUNCTIONNALITY OF THE FUNCTION
- //WITH BUFFER_ADD TYPE DATA
- fail_if(mailbox_buffer_add(DATA) != 0, "Error with buffer add data");
- //Check msg header for buffer add type data
- fail_if(*res != 0x00000101,"Error with buffer add msg header construction");
- //Check size with the global variable of the hal_stub
- fail_if(gidel_size != 0x8,"Error with size msg");
- //the hal_stub always return TYPICAL_BUFF_ADD_PTR as message buffer_ptr
- fail_if(*(res+1) != TYPICAL_BUFF_ADD_PTR ,"Error with buffer add msg construction");
-
- *res = 0;
- *(res+1) = 0;
-
- //WITH BUFFER_ADD TYPE MME
- fail_if(mailbox_buffer_add(MME) != 0, "Error with buffer add data");
- //Check msg header for buffer add type mme
- fail_if(*res != 0x00001101,"Error with buffer add msg header construction");
- //Check size with the global variable of the hal_stub
- fail_if(gidel_size != 0x8,"Error with size msg");
- //the hal_stub always return TYPICAL_BUFF_ADD_PTR as message buffer_ptr
- fail_if(*(res+1) != TYPICAL_BUFF_ADD_PTR ,"Error with buffer add msg construction");
-}
-END_TEST
-
-/** init test procedure */
-START_TEST (test_mailbox_init)
-{
- //Fill init structure used with init
- init.txack_handler = &test_handler;
- init.nb_data_buf_alloc = 3;
- init.nb_mme_buf_alloc = 2;
-
- //Start function
- mailbox_init(&init);
-
- //Check irq handler pointer
- fail_if((uint32_t)(txack_handler) != (uint32_t)(&test_handler),"Error with IRQ handler pointer");
-}
-END_TEST
-
-/** send test procedure */
-START_TEST (test_mailbox_send)
-{
- uint32_t *res = &gidel_ring[0];
- uint32_t msg[] = {0x11223344, 0x55667788, 0x99AABBCC};
-
- //Check code error for each parameters
- fail_if(mailbox_send(NULL,5,DATA) == 0, "Error with null pointer");
- fail_if(mailbox_send((void*)TYPICAL_RCV_BUFF_PTR,0,DATA) == 0, "Error with null size");
-
- //Check code with the status queue error (remember the first time we call
- //status_queue it returns an error)
- fail_if(mailbox_send((void*)TYPICAL_RCV_BUFF_PTR,1,DATA) != FULL, "Error with status queue");
- //Check code with save_in_gidel_memory error (remember the first time we call
- //save_in_gidel_memory it returns an error)
- fail_if(mailbox_send((void*)TYPICAL_RCV_BUFF_PTR,1,DATA) != FULL, "Error with save_in_gidel");
- //Check code with copy_to_ring error (remember the first time we call
- //copy_to_ring it returns an error)
- fail_if(mailbox_send(msg, sizeof(msg), DATA) == 0, "Error with copy to ring");
- //Check code with A2L_update error (remember the first time we call
- //A2L_update it returns an error)
- fail_if(mailbox_send(msg, sizeof(msg), DATA) == 0, "Error with update ring pointer");
-
-
- //CHECK THE REAL FUNCTIONNALITY OF THE FUNCTION
- //WITH SEND TYPE DATA
- fail_if(mailbox_send(msg, sizeof(msg), DATA) != 0, "Error with send data");
- //Check msg header for send type data
- fail_if(*res != 0x00018100,"Error with send data msg header construction");
- //Check size with the global variable of the hal_stub
- fail_if(gidel_size != 0x8,"Error with size msg");
- //Check the if buffer_ptr is good
- fail_if(*(res+1) != (uint32_t)&msg[0] ,"Error with send msg construction");
-
- *res = 0;
- *(res+1) = 0;
-
- //WITH SEND TYPE MME
- fail_if(mailbox_send(msg, sizeof(msg), MME) != 0, "Error with send mme");
- //Check msg header for send type mme
- fail_if(*res != 0x00019100,"Error with send mme msg header construction");
- //Check size with the global variable of the hal_stub
- fail_if(gidel_size != 0x8,"Error with size msg");
- //Check the if buffer_ptr is good
- fail_if(*(res+1) != (uint32_t)&msg[0] ,"Error with send msg construction");
-}
-END_TEST
-
-/** receive test procedure */
-START_TEST (test_mailbox_receive)
-{
- //Check code with the L2Amail_not_empty_queue (remember the first time we call
- //L2Amail_not_empty_queue it returns empty)
- fail_if(mailbox_receive() != 0, "Error with not empty queue");
- //Check code with the copy_from_ring error (remember the first time we call
- //copy_from_ring it returns an error)
- fail_if(mailbox_receive() != -2, "Error with copy from ring");
- //Check code with the update_ring_pointer error (remember the first time we call
- //update_ring_pointer it returns an error)
- fail_if(mailbox_receive() != -3, "Error with update ring pointer");
-
- //CHECK THE REAL FUNCTIONNALITY OF THE FUNCTION
- //WITH SEND_DONE
- //Check code with the free_in_gidel_memory error (remember the first time we call
- //free_in_gidel_memory it returns an error)
- fail_if(mailbox_receive() != -4, "Error with send done false");
- //Check the real functionnality of send_done
- fail_if(mailbox_receive() != 0, "Error with send done true");
-
- //WITH INTERFACE
- //Check code with the save_in_pc_memory error (remember the first time we call
- //save_in_pc_memory it returns an error)
- fail_if(mailbox_receive() != -5, "Error with interface save memory false");
- //Check code with the processing_receive error (remember the first time we call
- //processing_receive it returns an error)
- fail_if(mailbox_receive() != -6, "Error with interface processing receive false");
- //Check the real functionnality of interface
- fail_if(mailbox_receive() != 0, "Error with interface true");
- //Check size with the global variable of the hal_stub
- fail_if(msg_size != 2, "Error with interface message format receive");
- //Check buffer_ptr with the global variable of the hal_stub
- fail_if(msg_ptr != TYPICAL_RCV_BUFF_PTR, "Error with interface message format receive");
-
- //WITH DATA
- //Check code with the save_in_pc_memory error (remember the first time we call
- //save_in_pc_memory it returns an error)
- fail_if(mailbox_receive() != -7, "Error with data save memory false");
- //Check code with the processing_receive error (remember the first time we call
- //processing_receive it returns an error)
- fail_if(mailbox_receive() != -8, "Error with data processing receive mme false");
- //Check the real functionnality of data under-type mme
- fail_if(mailbox_receive() != 0, "Error with data processing receive mme true");
- //Check code with the processing_receive error (remember the first time we call
- //processing_receive it returns an error)
- fail_if(mailbox_receive() != -9, "Error with data processing receive data false");
- //Check the real functionnality of data under-type mme
- fail_if(mailbox_receive() != 0, "Error with data processing receive data true");
- //Check size with the global variable of the hal_stub
- fail_if(msg_size != 2, "Error with data message format receive");
- //Check buffer_ptr with the global variable of the hal_stub
- fail_if(msg_ptr != TYPICAL_RCV_BUFF_PTR, "Error with data message format receive");
-
- //WITH ERROR TYPE
- fail_if(mailbox_receive() != -1, "Error with message type");
-}
-END_TEST
-
-extern Suite* mailbox_suite(void)
-{
- Suite *s = suite_create("MAILBOX");
- TCase *tc_core = tcase_create("Core");
-
- //Test buffer_add
- tcase_add_test(tc_core, test_mailbox_buffer_add);
- //Test mailbox_init
- tcase_add_test(tc_core, test_mailbox_init);
- //Test mailbox_send
- tcase_add_test(tc_core, test_mailbox_send);
- //Test mailbox_receive
- tcase_add_test(tc_core, test_mailbox_receive);
-
- suite_add_tcase(s, tc_core);
- return s;
-}
-
-int main(void)
-{
- int number_failed = 0;
- Suite *s;
-
- //Run MAILBOX tests
- s = mailbox_suite();
-
- SRunner *sr = srunner_create(s);
- srunner_run_all(sr, CK_NORMAL);
- number_failed = srunner_ntests_failed(sr);
- srunner_free(sr);
-
- return (number_failed == 0) ? 0 : -1;
-}
-
diff --git a/cleopatre/devkit/tests/plcdrv/gidel/utests/src/plc_drv_utests.c b/cleopatre/devkit/tests/plcdrv/gidel/utests/src/plc_drv_utests.c
deleted file mode 100644
index fa3a4dcb3f..0000000000
--- a/cleopatre/devkit/tests/plcdrv/gidel/utests/src/plc_drv_utests.c
+++ /dev/null
@@ -1,122 +0,0 @@
-/* Cesar project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file test_plc_drv.c
- * \brief tests of the PLC_DRV layer.
- * \ingroup Cleopatre - Isis
- */
-
-#include <check.h>
-#include <stdio.h>
-#include <string.h>
-#include "plc_drv.h"
-
-/** global variables used by stub files to recover informations */
-extern int help_function;
-
-/** local variables */
-static struct init_info init;
-
-/** parse arguments procedure */
-START_TEST (test_plc_drv_parse_args)
-{
- int argc;
- char values[11][30] = {"/toto/plcdrv", "--help", "--", "--rbf", "/test/rbf", "--tun", "./test/tun", "--data", "5", "--mme", "12"};
- char *argv[3];
-
- //Check the help procedure
- argc = 2;
- argv[0] = &values[0][0];
- argv[1] = &values[1][0];
- fail_if(parse_args(&init, argc, argv) != 0 && help_function != 1, "Error parse args with help");
- help_function = 0;
-
- //Check error procedure
- argc = 2;
- argv[0] = &values[0][0];
- argv[1] = &values[2][0];
- fail_if(parse_args(&init, argc, argv) != 0 && help_function != 1, "Error parse args with wrong parameter");
-
- //Check rbf parameter
- argc = 3;
- argv[0] = &values[0][0];
- argv[1] = &values[3][0];
- argv[2] = &values[4][0];
- fail_if(parse_args(&init, argc, argv) != 0 && strcmp(init.rbf,values[4]) != 0, "Error parse args with rbf parameter");
-
- //Check tun/tap parameter
- argc = 3;
- argv[0] = &values[0][0];
- argv[1] = &values[5][0];
- argv[2] = &values[6][0];
- fail_if(parse_args(&init, argc, argv) != 0 && strcmp(init.tuntap_name,values[6]) != 0, "Error parse args with tuntap parameter");
-
- //Check number of data buffer parameter
- argc = 3;
- argv[0] = &values[0][0];
- argv[1] = &values[7][0];
- argv[2] = &values[8][0];
- fail_if(parse_args(&init, argc, argv) != 0 && init.nb_data_buf_alloc != 5, "Error parse args with data parameter");
-
- //Check number of mme buffer parameter
- argc = 3;
- argv[0] = &values[0][0];
- argv[1] = &values[9][0];
- argv[2] = &values[10][0];
- fail_if(parse_args(&init, argc, argv) != 0 && init.nb_mme_buf_alloc != 12, "Error parse args with mme parameter");
-}
-END_TEST
-
-/** tun/tap creation procedure */
-START_TEST (test_plc_drv_create_tuntap)
-{
- //Check tun/tap name procedure with bad name
- strcpy(init.tuntap_name, "tap-1");
- fail_if(create_tuntap(&init) == 0, "Error with tuntap name during creation");
- //Check tun/tap name procedure with good name
- strcpy(init.tuntap_name, "tap0");
- fail_if(create_tuntap(&init) != 0, "Error with tuntap name during creation");
- //Check tun/tap name procedure with good name
- strcpy(init.tuntap_name, "tap5");
- fail_if(create_tuntap(&init) != 0, "Error with tuntap name during creation");
- //Check tun/tap name procedure with good name
- strcpy(init.tuntap_name, "tap10");
- fail_if(create_tuntap(&init) != 0, "Error with tuntap name during creation");
-}
-END_TEST
-
-extern Suite* plc_drv_suite(void)
-{
- Suite *s = suite_create("PLC_DRV");
- TCase *tc_core = tcase_create("Core");
-
- //Test parse_args
- tcase_add_test(tc_core, test_plc_drv_parse_args);
- //Test create_tuntap
- tcase_add_test(tc_core, test_plc_drv_create_tuntap);
-
- suite_add_tcase(s, tc_core);
- return s;
-}
-
-int main(void)
-{
- int number_failed = 0;
- Suite *s;
-
- //Run PLCDRV tests
- s = plc_drv_suite();
-
- SRunner *sr = srunner_create(s);
- srunner_run_all(sr, CK_NORMAL);
- number_failed = srunner_ntests_failed(sr);
- srunner_free(sr);
-
- return (number_failed == 0) ? 0 : -1;
-}
-
diff --git a/cleopatre/devkit/tests/plcdrv/gidel/utests/src/processing_utests.c b/cleopatre/devkit/tests/plcdrv/gidel/utests/src/processing_utests.c
deleted file mode 100644
index bbd5e9456f..0000000000
--- a/cleopatre/devkit/tests/plcdrv/gidel/utests/src/processing_utests.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Cesar project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file test_processing.c
- * \brief tests of the PROCESSING layer.
- * \ingroup Cleopatre - Isis
- */
-
-#include <check.h>
-#include <stdio.h>
-#include <string.h>
-#include "processing.h"
-
-extern Suite* processing_suite(void)
-{
- Suite *s = suite_create("PROCESSING");
- TCase *tc_core = tcase_create("Core");
-
- suite_add_tcase(s, tc_core);
- return s;
-}
-
-int main(void)
-{
- int number_failed = 0;
- Suite *s;
-
- //Run PROCESSING tests
- s = processing_suite();
-
- SRunner *sr = srunner_create(s);
- srunner_run_all(sr, CK_NORMAL);
- number_failed = srunner_ntests_failed(sr);
- srunner_free(sr);
-
- return (number_failed == 0) ? 0 : -1;
-}
-
diff --git a/cleopatre/devkit/tests/utests_makerules b/cleopatre/devkit/tests/utests_makerules
deleted file mode 100644
index 532afed988..0000000000
--- a/cleopatre/devkit/tests/utests_makerules
+++ /dev/null
@@ -1,70 +0,0 @@
-#You need to precise : PRJ_BASE and FILES before calling this file
-#EXTRA_CFLAGS and OBJ_FILES are optionnal
-# If some object files depend on function stubs in utests:
-# Source files with function stubs should be put in TEST_STUBPATH directory
-# Names of object files with stubs should be given in OBJ_FILES (under TEST_OBJPATH)
-
-TEST_NAME = utests
-
-PRJ_SRCPATH = $(PRJ_BASE)/src
-TEST_SRCPATH = src
-PRJ_INCPATH = $(PRJ_BASE)/inc
-TEST_INCPATH = ./inc
-
-OBJPATH = obj
-PRJ_OBJPATH = $(OBJPATH)/prj
-TEST_OBJPATH = $(OBJPATH)/test
-
-TEST_STUBPATH = stubs
-
-BINS = $(foreach file, $(FILES), $(OBJPATH)/$(file).elf)
-
-ifneq ($(wildcard $(PRJ_SRCPATH)/*.cpp),)
- LDCC=g++
-else
- ifneq ($(wildcard $(TEST_SRCPATH)/*.cpp),)
- LDCC=g++
- else
- LDCC=gcc
- endif
-endif
-CC=gcc
-CPP=g++
-CFLAGS = -Wall -g -D__UTESTS__ -I$(PRJ_INCPATH) -I$(TEST_INCPATH) $(EXTRA_CFLAGS)
-LDFLAGS = $(EXTRA_LDFLAGS)
-LIBS = -lcheck -lpthread $(EXTRA_LIBS)
-
-all: preall $(PREBINS) $(BINS)
-
-clean:
- rm -f $(OBJPATH)/*.elf
- rm -f $(PRJ_OBJPATH)/*.o $(TEST_OBJPATH)/*.o $(OBJPATH)/*.o
- rm -rf $(TEST_OBJPATH)
- rm -rf $(PRJ_OBJPATH)
- rm -rf $(OBJPATH)
-
-preall:
- mkdir -p $(OBJPATH)
- mkdir -p $(PRJ_OBJPATH)
- mkdir -p $(TEST_OBJPATH)
-
-.PHONY: all clean
-.PRECIOUS: $(PRJ_OBJPATH)/%.o $(TEST_OBJPATH)/%.o
-
-$(OBJPATH)/%.elf: $(PRJ_OBJPATH)/%.o $(TEST_OBJPATH)/%_$(TEST_NAME).o $(OBJ_FILES)
- $(LDCC) $(LDFLAGS) -o $@ $^ $(LIBS)
-
-$(TEST_OBJPATH)/%.o: $(TEST_STUBPATH)/%.c
- $(CC) $(CFLAGS) -c -o $@ $<
-
-$(TEST_OBJPATH)/%.o: $(TEST_SRCPATH)/%.c
- $(CC) $(CFLAGS) -c -o $@ $<
-
-$(TEST_OBJPATH)/%.o: $(TEST_SRCPATH)/%.cpp
- $(CPP) $(CFLAGS) -c -o $@ $<
-
-$(PRJ_OBJPATH)/%.o: $(PRJ_SRCPATH)/%.c
- $(CC) $(CFLAGS) -c -o $@ $<
-
-$(PRJ_OBJPATH)/%.o: $(PRJ_SRCPATH)/%.cpp
- $(CPP) $(CFLAGS) -c -o $@ $<
diff --git a/cleopatre/linux-2.6.25.10-spc300/arch/arm/boot/Makefile b/cleopatre/linux-2.6.25.10-spc300/arch/arm/boot/Makefile
index 5f562248a6..65ecac966d 100644
--- a/cleopatre/linux-2.6.25.10-spc300/arch/arm/boot/Makefile
+++ b/cleopatre/linux-2.6.25.10-spc300/arch/arm/boot/Makefile
@@ -70,7 +70,7 @@ $(obj)/uImage: $(obj)/zImage FORCE
@echo ' Image $@ is ready'
quiet_cmd_simage = SIMAGE $@
-cmd_simage = echo "$(PLC_MEM_SIZE_MB)" ; $(MKSIMAGE) --desc "SPC300 image" \
+cmd_simage = $(MKSIMAGE) --desc "SPC300 image" \
--ver "$(IMG_VERSION)" \
--size "$(shell du -sb $< | awk '{ print $$1 }')" \
--md5 "$(shell md5sum $< | awk '{ print $$1 }')" \
diff --git a/cleopatre/linux-2.6.25.10-spc300/drivers/net/arm/synop3504.c b/cleopatre/linux-2.6.25.10-spc300/drivers/net/arm/synop3504.c
index 3fd06c0f5f..6b7d02ac03 100644
--- a/cleopatre/linux-2.6.25.10-spc300/drivers/net/arm/synop3504.c
+++ b/cleopatre/linux-2.6.25.10-spc300/drivers/net/arm/synop3504.c
@@ -1305,6 +1305,10 @@ static void synop3504_on_link_up(struct net_device *dev)
struct net_priv *priv = (struct net_priv *)dev->priv;
Synopsys *synop = &priv->synop;
+ //Reset descriptors
+ synop3504_txdesc_reset(dev);
+ synop3504_rxdesc_reset(dev);
+
//Start TX and RX DMA
SynopsysStartTx(synop);
SynopsysStartRx(synop);
@@ -1338,10 +1342,6 @@ static void synop3504_on_link_down(struct net_device *dev)
SynopsysStopRx(synop);
SynopsysStopTx(synop);
- //Reset descriptors
- synop3504_txdesc_reset(dev);
- synop3504_rxdesc_reset(dev);
-
}// synop3504_on_link_down
diff --git a/cleopatre/u-boot-1.1.6/.gitignore b/cleopatre/u-boot-1.1.6/.gitignore
index df71dd5dcf..7f4a05d918 100644
--- a/cleopatre/u-boot-1.1.6/.gitignore
+++ b/cleopatre/u-boot-1.1.6/.gitignore
@@ -1,6 +1,7 @@
*.a
*.o
.depend
+/ctags
/examples
/include/asm
/include/asm-*/arch
diff --git a/common/lib/scammer/__init__.py b/common/lib/scammer/__init__.py
new file mode 100644
index 0000000000..0c9901a33a
--- /dev/null
+++ b/common/lib/scammer/__init__.py
@@ -0,0 +1,10 @@
+from cc import *
+from cp import *
+from nn import *
+from cm import *
+from vs import *
+from drv import *
+from beacon import BENTRY_HDR
+from scammer import MME, get_sniffed_mme
+from common import HPAV_MMTYPES, HPAV_MMTYPES_REVERSE, HPAV_RESULT, HPAV_PEKS
+from common import HPAV_PID
diff --git a/common/lib/scammer/beacon.py b/common/lib/scammer/beacon.py
new file mode 100644
index 0000000000..91e97323dc
--- /dev/null
+++ b/common/lib/scammer/beacon.py
@@ -0,0 +1,379 @@
+#!/usr/bin/python
+
+#############################################################################
+# Copyright (C) 2011 Spidcom
+#
+# Beacon description in a VS_SNIFFER.IND MME
+#
+# See scpay/layers/inet.py for IPOptions construction.
+#
+# To add a new beacon entry in the script, you need to create a new class
+# which derives Bentry class.
+# In this new class, the header must be filled as class attribute.
+#############################################################################
+
+from scapy.all import Packet, SourceMACField
+from scapy.fields import *
+from common import ETHER_TYPES, HPAV_CCO_LEVEL
+from commonfields import *
+
+BENTRY_HDR = {
+ "NON_PERSISTENT_SCHEDULE": 0x00,
+ "PERSISTENT_SCHEDULE": 0x01,
+ "REGIONS": 0x02,
+ "MAC_ADDRESS": 0x03,
+ "DISCOVER": 0x04,
+ "DISCOVERED_INFO": 0x05,
+ "BEACON_PERIOD_START_TIME_OFFSET": 0x06,
+ "ENCRYPTION_KEY_CHANGE": 0x07,
+ "CCO_HANDOVER": 0x08,
+ "BEACON_RELOCATION": 0x09,
+ "AC_LINE_SYNC_COUNTDOWN": 0x0A,
+ "CHANGE_NUMSLOTS": 0x0B,
+ "CHANGE_HM": 0x0C,
+ "CHANGE_SNID": 0x0D,
+ }
+
+class BEntryHDR (Packet):
+ """Beacon entry header."""
+ # Use the BENTRY_HDR dict to compose a new dict with the keyword
+ # inverted. i.e. bentry['CHANHE_SNID'] will be _bentry[0xd].
+ _bentry = {}
+ for i in BENTRY_HDR:
+ _bentry[BENTRY_HDR[i]] = i
+ fields_desc = [
+ ByteEnumField ("header", 0, _bentry),
+ ByteField ("length", 0)
+ ]
+
+class BEntry (Packet):
+ """Beacon entries are different depending on the Beacon Entry Header. So
+ we need to parse each header to know to which beacon entry it
+ corresponds."""
+ fields_desc = [
+ BEntryHDR,
+ ]
+
+ registered_bentry = {}
+ @classmethod
+ def register_variant(cls):
+ cls.registered_bentry [cls.header.default] = cls
+ @classmethod
+ def dispatch_hook(cls, pkt=None, *args, **kargs):
+ if pkt:
+ header = struct.unpack ('B', pkt[0])[0]
+ if header in cls.registered_bentry:
+ return cls.registered_bentry [header]
+ return cls
+
+ def extract_padding(self, s):
+ return "",s
+
+class BEntrySchedulesAllocations (Packet):
+ """Session Allocation Information."""
+ # The stpf flag indicates if there is a start time in the allocation or
+ # not.
+ fields_desc = [
+ LEBitField ("stpf", 0, 1),
+ LEBitField ("glid", 0, 7),
+ ConditionalField (LEBitField ("st_atu", 0, 12), lambda p: p.stpf),
+ LEBitField ("et_atu", 0, 12),
+ ConditionalField (LEBitField("pad", 0, 4), lambda p: not p.stpf),
+ ]
+
+ def extract_padding(self, s):
+ return "",s
+
+class BEntryNonPersistentSchedule (BEntry):
+ """Beacon entry Non Persistent Schedule."""
+ header = BENTRY_HDR['NON_PERSISTENT_SCHEDULE']
+ fields_desc = [
+ BEntryHDR,
+ LEBitField ("ns", 0, 6),
+ LEBitField ("benpsf_rsvd1", 0, 2),
+ PacketListField ("sai", None, BEntrySchedulesAllocations,
+ count_from=lambda p:p.ns),
+ ]
+
+class BEntryPersistentSchedule (BEntry):
+ """Beacon entry Non Persistent Schedule."""
+ header = BENTRY_HDR['PERSISTENT_SCHEDULE']
+ fields_desc = [
+ BEntryHDR,
+ LEBitField ("pscd", 0, 3),
+ LEBitField ("cscd", 0, 3),
+ LEBitField ("bepsf_rsvd1", 0, 2),
+ LEBitField ("ns", 0, 6),
+ LEBitField ("bepsf_rsvd2", 0, 2),
+ PacketListField ("sai", None, BEntrySchedulesAllocations,
+ count_from=lambda p:p.ns),
+ ]
+
+class BEntryRegionsDesc (Packet):
+ """Region definition."""
+ fields_desc = [
+ LEBitField ("rt", 0, 4),
+ LEBitField ("ret", 0, 12),
+ ]
+
+ def extract_padding(self, s):
+ return "",s
+
+class BEntryRegions (BEntry):
+ """Region beacon entry."""
+ header = BENTRY_HDR['REGIONS']
+ fields_desc = [
+ BEntryHDR,
+ LEBitField ("nr", 0, 6),
+ LEBitField ("ber_rvsd", 0, 2),
+ PacketListField ("rlist", None, BEntryRegionsDesc,
+ count_from=lambda p:p.nr),
+ ]
+
+class BEntryMacAddress (BEntry):
+ """Beacon entry for the mac address."""
+ header = BENTRY_HDR['MAC_ADDRESS']
+ fields_desc = [
+ BEntryHDR,
+ MACField("mac", ETHER_ANY),
+ ]
+
+class BEntryDiscover (BEntry):
+ """Discover beacon entry."""
+ header = BENTRY_HDR['DISCOVER']
+ fields_desc = [
+ BEntryHDR,
+ ByteField ("tei", 0),
+ ]
+
+class BEntryDiscoveredInfo (BEntry):
+ """Discover info beacon entry."""
+ header = BENTRY_HDR['DISCOVERED_INFO']
+ fields_desc = [
+ BEntryHDR,
+ LEBitField ("updated", 0, 1),
+ LEBitField ("cco_cap", 0, 2),
+ LEBitField ("proxy_networking_cap", 0, 1),
+ LEBitField ("backup_cco_cap", 0, 1),
+ LEBitField ("cco_status", 0, 1),
+ LEBitField ("pco_status", 0, 1),
+ LEBitField ("backup_cco_status", 0, 1),
+ ByteField ("numdissta", 0),
+ ByteField ("numdisnet", 0),
+ LEBitField ("authentication_status", 0, 1),
+ LEBitField ("user_appointed", 0, 1),
+ LEBitField ("bedi_rsvd", 0, 6),
+ ]
+
+class BEntryBeaconPeriodStartTimeOffset (BEntry):
+ """Beacon Period Start Time Offset."""
+ header = BENTRY_HDR['BEACON_PERIOD_START_TIME_OFFSET']
+ fields_desc = [
+ BEntryHDR,
+ LEBitField ("bpsto", 0, 24),
+ ]
+
+class BEntryEncryptionKeyChange (BEntry):
+ """Encryption Key change."""
+ header = BENTRY_HDR['ENCRYPTION_KEY_CHANGE']
+ fields_desc = [
+ BEntryHDR,
+ LEBitField ("kccd", 0, 6),
+ LEBitField ("kbc", 0, 1),
+ LEBitField ("beckc_rsvd", 0, 1),
+ LEBitField ("neweks", 0, 4),
+ LEBitField ("beckc_rsvd2", 0, 4),
+ ]
+
+class BEntryCcoHandover (BEntry):
+ """CCo Handover."""
+ header = BENTRY_HDR['CCO_HANDOVER']
+ fields_desc = [
+ BEntryHDR,
+ LEBitField ("hcd", 0, 6),
+ LEBitField ("bech_rsvd", 0, 2),
+ ByteField ("nctei", 0),
+ ]
+
+class BEntryBeaconRelocation (BEntry):
+ """Beacon Relocation"""
+ header = BENTRY_HDR['BEACON_RELOCATION']
+ fields_desc = [
+ BEntryHDR,
+ LEBitField ("rcd", 0, 6),
+ LEBitField ("rlt", 0, 1),
+ LEBitField ("lgf", 0, 1),
+ LEBitField ("rlo", 0, 17),
+ LEBitField ("rlslotid", 0, 3),
+ LEBitField ("bebr_rsvd", 0, 4),
+ ]
+
+class BEntryAcLineSyncCountdown (BEntry):
+ """AC Line Sync Countdown."""
+ header = BENTRY_HDR['AC_LINE_SYNC_COUNTDOWN']
+ fields_desc = [
+ BEntryHDR,
+ LEBitField ("countdown", 0, 6),
+ LEBitField ("beaclsc_rsvd1", 0, 2),
+ LEBitField ("reasoncode", 0, 2),
+ LEBitField ("beaclsc_rsvd2", 0, 6),
+ ]
+
+class BEntryChangeNumslots (BEntry):
+ """Change NumSlots."""
+ header = BENTRY_HDR['CHANGE_NUMSLOTS']
+ fields_desc = [
+ BEntryHDR,
+ LEBitField ("nsccd", 0, 6),
+ LEBitField ("becns_rsvd1", 0, 2),
+ LEBitField ("newnumslot", 0, 3),
+ LEBitField ("becns_rsvd2", 0, 5),
+ ]
+
+class BEntryChangeHm (BEntry):
+ """Change Hybrid Mode."""
+ header = BENTRY_HDR['CHANGE_HM']
+ fields_desc = [
+ BEntryHDR,
+ LEBitField ("hmccd", 0, 6),
+ LEBitField ("newhm", 0, 2),
+ ]
+
+class BEntryChangeSnid (BEntry):
+ """Change SNID."""
+ header = BENTRY_HDR['CHANGE_SNID']
+ fields_desc = [
+ BEntryHDR,
+ LEBitField ("sccd", 0, 4),
+ LEBitField ("newsnid", 0, 4),
+ ]
+
+class BeaconSniff (Packet):
+ """Beacon description inside a VS_SNIFFER.IND MME"""
+ name = "Beacon description inside a VS_SNIFFER.IND MME"
+ fields_desc = [
+ XLEBitField ("nid", 0, 54),
+ XLEBitField ("hm", 0, 2),
+ XByteField ("stei", 0),
+ XLEBitField ("bt", 0, 3),
+ XLEBitField ("ncnr", 0, 1),
+ XLEBitField ("npsm", 0, 1),
+ XLEBitField ("numslots", 0, 3),
+ XLEBitField ("slotusage", 7, 8),
+ XLEBitField ("slotid", 0, 3),
+ XLEBitField ("aclss", 0, 3),
+ XLEBitField ("hoip", 0, 1),
+ XLEBitField ("rtsbf", 0, 1),
+ XLEBitField ("nm", 0, 2),
+ XLEBitField ("ccocap", 0, 2),
+ XLEBitField ("rsvd", 0, 4),
+ FieldLenField("nbe", None, count_of="bentry",fmt="B"),
+ # From here the beacon entry are like Header, Length (in bytes),
+ # entry.
+ # Entries may have N repeated structure i.e. schedules, regions...
+ # So entries does not have the same length, all we know is that
+ # the beacon entries are ordered and there is nbe beacon entries
+ # in the beacon.
+ PacketListField("bentry", None, BEntry, count_from=lambda p:p.nbe),
+ ]
+
+if __name__ == '__main__':
+ """Create a beacon to check if the dissector is correct."""
+ from scapy.utils import str2mac
+ mac = '00:13:d7:00:00:%02x'
+ # Non Persistent schedules.
+ non_peristent_sais = [
+ BEntrySchedulesAllocations (stpf = False , glid = 1,
+ et_atu=50),
+ BEntrySchedulesAllocations (stpf = True, glid = 2,
+ st_atu=50, et_atu=1500),
+ ]
+ bnps = BEntryNonPersistentSchedule (
+ header=BENTRY_HDR['NON_PERSISTENT_SCHEDULE'],
+ length=11 ,ns=3, sai=non_peristent_sais)
+ # Persistent schedules.
+ persistent_sais = [
+ BEntrySchedulesAllocations (stpf = True, glid = 3,
+ st_atu=1500, et_atu=3907)
+ ]
+ bps = BEntryPersistentSchedule (
+ header=BENTRY_HDR['PERSISTENT_SCHEDULE'],
+ length=5, pscd=7, cscd=7, ns=1, sai=persistent_sais)
+ # Create regions.
+ r = BEntryRegions (
+ header = BENTRY_HDR['REGIONS'],
+ length = 4,
+ nr = 2,
+ rlist = [
+ BEntryRegionsDesc (rt=0, ret=50),
+ BEntryRegionsDesc (rt=1, ret=3907)
+ ])
+ # Store the mac address.
+ m = BEntryMacAddress (
+ header = BENTRY_HDR['MAC_ADDRESS'],
+ length = 6,
+ mac = mac % 5)
+ # Discover entry.
+ d = BEntryDiscover (
+ header = BENTRY_HDR['DISCOVER'],
+ length = 1,
+ tei = 0xA)
+ # Discover info entry.
+ di = BEntryDiscoveredInfo (
+ header = BENTRY_HDR['DISCOVERED_INFO'],
+ length = 4,
+ updated = False,
+ cco_cap = 1,
+ proxy_networking_cap = False,
+ backup_cco_cap = True,
+ cco_status = True,
+ pco_status = False,
+ backup_cco_status = False,
+ numdissta = 4,
+ numdisnet = 3,
+ authentication_status = True,
+ user_appointed = False)
+ # Beacon period start time offset.
+ bpsto = BEntryBeaconPeriodStartTimeOffset (
+ header = BENTRY_HDR['BEACON_PERIOD_START_TIME_OFFSET'],
+ length = 3,
+ bpsto = 1204)
+ # Encryption key change.
+ ekc = BEntryEncryptionKeyChange (
+ header = BENTRY_HDR['ENCRYPTION_KEY_CHANGE'],
+ length = 2,
+ kccd = 4,
+ kbc = 1,
+ neweks = 2)
+ # CCo handover.
+ ccoh = BEntryCcoHandover (
+ header = BENTRY_HDR['CCO_HANDOVER'],
+ length = 2,
+ hcd = 3, nctei = 0xb)
+ # Beacon relocation.
+ br = BEntryBeaconRelocation (
+ header = BENTRY_HDR['BEACON_RELOCATION'],
+ length = 4, rcd = 4, rlt = 1, lgf = 1, rlo = 1240, rlslotid = 2)
+ # Ac Line Sync Countdown
+ alsc = BEntryAcLineSyncCountdown (
+ header = BENTRY_HDR['AC_LINE_SYNC_COUNTDOWN'],
+ length = 2, countdown = 3, reasoncode = 1)
+ # Change num slots.
+ cn = BEntryChangeNumslots (
+ header = BENTRY_HDR['CHANGE_NUMSLOTS'],
+ length = 2, nsccd = 3, newnumslot = 2)
+ # Change Hybrid mode.
+ chm = BEntryChangeHm (
+ header = BENTRY_HDR['CHANGE_HM'],
+ length = 1, hmccd = 2, newhm = 1)
+ # Change snid.
+ csnid = BEntryChangeSnid (
+ header = BENTRY_HDR['CHANGE_SNID'],
+ length = 1, sccd = 3, newsnid = 2)
+ # Create the beacon.
+ m = BeaconSniff (nid=0x12345789abc, hm=0, stei=1, bt=1, ncnr=0,
+ npsm=0, numslots=7, slotusage=1, slotid=1, aclss=0, hoip=0,
+ rtsbf=0, nm=2, ccocap=1, rsvd=0,
+ bentry=[bnps, bps, r, m, d, di, bpsto, ekc, ccoh, br, alsc,
+ cn, chm, csnid])
+ m.show ()
diff --git a/common/lib/scammer/cc.py b/common/lib/scammer/cc.py
new file mode 100644
index 0000000000..a5936de884
--- /dev/null
+++ b/common/lib/scammer/cc.py
@@ -0,0 +1,189 @@
+#!/usr/bin/python
+
+#############################################################################
+# Copyright (C) 2011 Spidcom
+#############################################################################
+
+from scapy.all import Packet
+from scapy.fields import *
+from commonfields import *
+from common import HPAV_CCO_LEVEL, HPAV_RESULT
+from scammer import MMEPayload
+
+class CC_WHO_RU_REQ (MMEPayload):
+ """Handles the CC_WHO_RU.REQ MME."""
+ name = "HomePlug AV CC_WHO_RU.REQ"""
+ fields_desc = [
+ HPAVNIDField ("nid", 0),
+ ]
+
+class CC_WHO_RU_CNF (MMEPayload):
+ """Handles the CC_WHO_RU.CNF MME."""
+ name = "HomePlug AV CC_WHO_RU.CNF"""
+ fields_desc = [
+ HPAVNIDField ("nid", 0),
+ MACField ("mac", ETHER_ANY),
+ StrFixedLenField ("hfid", 0, 64),
+ ]
+
+class CC_LEAVE_REQ (MMEPayload):
+ """Handles the CC_LEAVE.REQ MME."""
+ name = "HomePlug AV CC_LEAVE.REQ"""
+ fields_desc = [
+ ByteEnumField ("reason", 0, {
+ 0: "USER_REQUEST",
+ 1: "POWER_DOWN",
+ }),
+ ]
+
+class CC_LEAVE_CNF (MMEPayload):
+ """Handles the CC_LEAVE.CNF MME."""
+ name = "HomePlug AV CC_LEAVE.CNF"""
+ fields_desc = [
+ ]
+
+class CC_LEAVE_IND (MMEPayload):
+ """Handles the CC_LEAVE.IND MME."""
+ name = "HomePlug AV CC_LEAVE.IND"""
+ fields_desc = [
+ XByteField ("reason", 0),
+ HPAVNIDField ("nid", 0),
+ ]
+
+class CC_LEAVE_RSP (MMEPayload):
+ """Handles the CC_LEAVE.RSP MME."""
+ name = "HomePlug AV CC_LEAVE.RSP"""
+ fields_desc = [
+ ]
+
+class CC_HANDOVER_REQ (MMEPayload):
+ """Handles the CC_HANDOVER.REQ MME."""
+ name = "HomePlug AV CC_HANDOVER.REQ"""
+ fields_desc = [
+ ByteEnumField ("soft_hard", 0, {
+ 0: "SOFT",
+ 1: "HARD",
+ }),
+ ByteEnumField ("reason", 0, {
+ 0x00: "USER_APPOINTED",
+ 0x01: "CCO_SELECTION",
+ 0x02: "CCO_LEAVING",
+ }),
+ ]
+
+class CC_HANDOVER_CNF (MMEPayload):
+ """Handles the CC_HANDOVER.CNF MME."""
+ name = "HomePlug AV CC_HANDOVER.CNF"""
+ fields_desc = [
+ ByteEnumField ("result", 0,
+ {
+ 0: "ACCEPT",
+ 1: "REJECT_SOFT_HANDOVER",
+ 2: "REJECT_ANY_HANDOVER",
+ }),
+ ]
+
+class CC_HANDOVER_INFO_IND_sta_info (Packet):
+ """Handles the CC_HANDOVER_INFO.IND MME."""
+ name = "HomePlug AV CC_HANDOVER_INFO.IND."
+ fields_desc = [
+ ByteField ("tei", 0),
+ MACField ("mac", 0),
+ ByteEnumField ("status", 0,
+ {
+ 0: "ASSOCIATED",
+ 1: "AUTHENTICATED",
+ }),
+ ByteField ("ptei", 0),
+ ]
+
+ def extract_padding(self, s):
+ return "",s
+
+class CC_HANDOVER_INFO_IND (MMEPayload):
+ """Handles the CC_HANDOVER_INFO.IND MME."""
+ name = "HomePlug AV CC_HANDOVER_INFO.IND"
+ fields_desc = [
+ ByteEnumField ("rsc", 0,
+ {
+ 0: "HOIP",
+ 1: "UPDATE_BCCO",
+ }),
+ ByteField ("backupcco", 0),
+ FieldLenField("num", None, count_of="stas",fmt="B"),
+ PacketListField ("stas", None, CC_HANDOVER_INFO_IND_sta_info,
+ count_from=lambda p: p.num),
+ ]
+
+class CC_HANDOVER_INFO_RSP (MMEPayload):
+ """Handles the CC_HANDOVER_INFO.RSP MME."""
+ name = "HomePlug AV CC_HANDOVER_INFO.RSP"
+ fields_desc = [
+ ]
+
+class CC_SET_TEI_MAP_REQ (MMEPayload):
+ """Handles the CC_SET_TEI_MAP.REQ MME."""
+ name = "HomePlug AV CC_SET_TEI_MAP.REQ"
+ fields_desc = [
+ ]
+
+class CC_SET_TEI_MAP_IND_station (Packet):
+ """Handle the station description within the CC_SET_TEI_MAP.IND."""
+ fields_desc = [
+ ByteField ("tei", 0),
+ MACField ("mac", 0),
+ ByteEnumField ("status", 0,
+ {
+ 0: "ASSOCIATED",
+ 1: "AUTHENTICATED",
+ 2: "DISASSOCIATED",
+ }),
+ ]
+
+ def extract_padding(self, s):
+ return "",s
+
+class CC_SET_TEI_MAP_IND (MMEPayload):
+ """Handles the CC_SET_TEI_MAP.IND MME."""
+ name = "HomePlug AV CC_SET_TEI_MAP.IND"
+ fields_desc = [
+ ByteEnumField ("mode", 0,
+ {
+ 0: "UPDATE",
+ 1: "ADD",
+ 2: "DELETE",
+ }),
+ FieldLenField("num", None, count_of="stations",fmt="B"),
+ PacketListField ("stations", None, CC_SET_TEI_MAP_IND_station,
+ count_from = lambda p: p.num),
+ ]
+
+class CC_ASSOC_REQ (MMEPayload):
+ """Handles the CC_ASSOC.REQ MME."""
+ name = "HomePlug AV CC_ASSOC.REQ"
+ fields_desc = [
+ ByteEnumField ("reqtype", 0, {
+ 0: "NEW",
+ 1: "RENEW",
+ }),
+ HPAVNIDField ("nid", 0),
+ ByteEnumField ("cco_cap", 0, HPAV_CCO_LEVEL),
+ ByteField ("proxy_cap", 0)
+ ]
+
+class CC_ASSOC_CNF (MMEPayload):
+ """Handles the CC_ASSOC.CNF MME."""
+ name = "HomePlug AV CC_ASSOC.CNF"
+ fields_desc = [
+ ByteEnumField ("result", 0, HPAV_RESULT),
+ HPAVNIDField ("nid", 0),
+ ByteField ("snid", 0),
+ ByteField ("stei", 0),
+ LEShortField ("tei_lease", 0),
+ ]
+
+if __name__ == '__main__':
+ m = CC_WHO_RU_REQ (nid = 0x03c3ffdd7d22d5)
+ hexdump (str (m))
+ s = CC_WHO_RU_REQ (str (m))
+ print hex (s.nid)
diff --git a/common/lib/scammer/cm.py b/common/lib/scammer/cm.py
new file mode 100644
index 0000000000..e83ffe4dfe
--- /dev/null
+++ b/common/lib/scammer/cm.py
@@ -0,0 +1,187 @@
+#!/usr/bin/python
+
+#############################################################################
+# Copyright (C) 2011 Spidcom
+#
+# All CM MME.
+#############################################################################
+
+from scapy.all import Packet
+from scapy.fields import *
+from common import HPAV_CCO_LEVEL, HPAV_PEKS, HPAV_PID, HPAV_KEY_TYPE
+from common import HPAV_RESULT
+from commonfields import *
+from scammer import MMEPayload
+
+class CM_UNASSOCIATED_STA_IND (MMEPayload):
+ """Handles the CM_UNASSOCIATED_STA.IND MME. """
+ name = "HomePlug AV CM_UNASSOCIATED_STA.IND"
+ fields_desc = [
+ HPAVNIDField ("nid", 0),
+ ByteEnumField ("cco_cap", 0, HPAV_CCO_LEVEL),
+ ]
+
+class CM_ENCRYPTED_PAYLOAD_IND (MMEPayload):
+ """Handles the CM_ENCRYPTED_PAYLOAD.IND MME."""
+ name = "HomePlug AV CM_ENCRYPTED_PAYLOAD.IND """
+ fields_desc = [
+ ByteEnumField ("peks", 0, HPAV_PEKS),
+ ByteField ("avln_status", 0),
+ ByteEnumField ("pid", 0, HPAV_PID),
+ LEShortField ("prn", 0),
+ ByteField ("pmn", 0),
+ BitField ("uuid", 0, 128),
+ ByteField ("length", 0),
+ ]
+
+class CM_BRG_INFO_REQ (MMEPayload):
+ """Handles the CM_BRG_INFO.REQ MME."""
+ name = "HomePlug AV CM_BRG_INFO.REQ """
+ fields_desc = [
+ ]
+
+class CM_BRG_INFO_CNF_bda (Packet):
+ """Handles CM_BRG_INFO.CNF bridge entry."""
+ name = "HomePlug AV CM_BRG_INFO.CNF bridge entry"""
+ fields_desc = [
+ MACField ("mac", ETHER_ANY),
+ ]
+
+ def extract_padding(self, s):
+ return "",s
+
+class CM_BRG_INFO_CNF (MMEPayload):
+ """Handles the CM_BRG_INFO.CNF MME."""
+ name = "HomePlug AV CM_BRG_INFO.CNF """
+ fields_desc = [
+ ByteField ("bsf", 0),
+ ByteField ("btei", 0),
+ FieldLenField ("nbda", None, count_of="bdas", fmt="B"),
+ PacketListField ("bdas", None, CM_BRG_INFO_CNF_bda,
+ count_from = lambda p: p.nbda),
+ ]
+
+class CM_SC_JOIN_REQ (MMEPayload):
+ """Handles the CM_SC_JOIN.REQ MME."""
+ name = "HomePlug AV CM_SC_JOIN.REQ """
+ fields_desc = [
+ BitField ("cco_cap", 0, 2),
+ BitField ("rsvd", 0, 6),
+ ]
+
+class CM_SC_JOIN_CNF (MMEPayload):
+ """Handles the CM_SC_JOIN.CNF MME."""
+ name = "HomePlug AV CM_SC_JOIN.CNF """
+ fields_desc = [
+ HPAVNIDField ("nid", 0),
+ BitField ("avln_status", 0, 1),
+ BitField ("cco_cap", 0, 2),
+ BitField ("proxy_cap", 0, 1),
+ BitField ("backup_cco_cap", 0, 1),
+ BitField ("cco_status", 0, 1),
+ BitField ("pco_status", 0, 1),
+ BitField ("backup_cco_status", 0, 1),
+ ]
+
+class CM_GET_KEY_REQ (MMEPayload):
+ """Handles the CM_GET_KEY.REQ MME."""
+ name = "HomePlug AV CM_GET_KEY.REQ """
+ fields_desc = [
+ ByteEnumField ("req_type", 0, {0: "DIRECT", 1: "RELAYED"}),
+ ByteEnumField ("req_keytype", 0, HPAV_KEY_TYPE),
+ HPAVNIDField ("nid", 0),
+ IntField ("my_nonce", 0),
+ ByteField ("pid", 0),
+ LEShortField ("prn", 0),
+ ByteField ("pmn", 0),
+ ConditionalField (StrLenField ("hash_key", "", length_from=384),
+ lambda p:p.req_keytype==4),
+ ]
+
+class CM_GET_KEY_CNF (MMEPayload):
+ """Handles the CM_GET_KEY.CNF MME."""
+ name = "HomePlug AV CM_GET_KEY.CNF """
+ fields_desc = [
+ ByteEnumField ("result", 0, HPAV_RESULT),
+ ByteEnumField ("req_keytype", 0, HPAV_KEY_TYPE),
+ IntField ("my_nonce", 0),
+ IntField ("your_nonce", 0),
+ HPAVNIDField ("nid", 0),
+ ByteField ("eks", 0),
+ ByteField ("pid", 0),
+ LEShortField ("prn", 0),
+ ByteField ("pmn", 0),
+ ConditionalField (BitField ("key", 0, 176),
+ lambda p:p.req_keytype!=4),
+ ConditionalField (BitField ("hash_key", 0, 3072),
+ lambda p:p.req_keytype==4),
+ ]
+
+class CM_NW_STATS_REQ (MMEPayload):
+ """Handles the CM_NW_STATS.REQ MME."""
+ name = "HomePlug AV CM_NW_STATS.REQ """
+ fields_desc = [
+ ]
+
+class CM_NW_STATS_CNF_station (Packet):
+ """Handles the CM_NW_STATS.CNF MME."""
+ name = "HomePlug AV CM_NW_STATS.CNF """
+ fields_desc = [
+ MACField ("mac", 0),
+ ByteField ("avgphydr_tx", 0),
+ ByteField ("avgphydr_rx", 0),
+ ]
+
+ def extract_padding(self, s):
+ return "",s
+
+class CM_NW_STATS_CNF (MMEPayload):
+ """Handles the CM_NW_STATS.CNF MME."""
+ name = "HomePlug AV CM_NW_STATS.CNF """
+ fields_desc = [
+ FieldLenField("num", None, count_of="stations",fmt="B"),
+ PacketListField ("stations", None, CM_NW_STATS_CNF_station,
+ count_from = lambda p: p.num)
+ ]
+
+class CM_NW_INFO_REQ (MMEPayload):
+ """Handles the CM_NW_INFO.REQ MME."""
+ name = "HomePlug AV CM_NW_INFO.REQ """
+ fields_desc = [
+ ]
+
+class CM_NW_INFO_CNF_nwinfo (Packet):
+ """Handles CM_NW_INFO_CNF.CNF network information entry."""
+ name = "HomePlug AV CM_NW_INFO_CNF.CNF network information entry"""
+ fields_desc = [
+ HPAVNIDField ("nid", 0),
+ ByteField ("snid", 0),
+ ByteField ("tei", 0),
+ ByteEnumField ("stationrole", 0, {
+ 0: "STA",
+ 1: "PROXY_COORDINATOR",
+ 2: "CCO" }),
+ MACField ("mac", ETHER_ANY),
+ ByteEnumField ("access", 0, {
+ 0: "IN_HOME",
+ 1: "ACCESS"
+ })
+ ]
+
+ def extract_padding(self, s):
+ return "",s
+
+class CM_NW_INFO_CNF (MMEPayload):
+ """Handles the CM_NW_INFO_CNF.CNF MME."""
+ name = "HomePlug AV CM_BRG_INFO.CNF """
+ fields_desc = [
+ FieldLenField ("numnws", None, count_of="nwinfo", fmt="B"),
+ PacketListField ("nwinfo", None, CM_NW_INFO_CNF_nwinfo,
+ count_from = lambda p: p.numnws),
+ ]
+
+if __name__ == '__main__':
+ # CM_UNASSOCIATED_STA_IND
+ m = CM_UNASSOCIATED_STA_IND (nid=0x123456789abc, cco_cap = 0)
+ p = CM_UNASSOCIATED_STA_IND (str (m))
+ p.show ()
diff --git a/common/lib/scammer/common.py b/common/lib/scammer/common.py
new file mode 100644
index 0000000000..519fcf4e09
--- /dev/null
+++ b/common/lib/scammer/common.py
@@ -0,0 +1,72 @@
+#!/usr/bin/python
+
+#############################################################################
+# Copyright (C) 2011 Spidcom
+#############################################################################
+
+from scapy.all import ETHER_TYPES
+import os
+import re
+import sys
+
+def find_base ():
+ """Find the base of the project."""
+ base = os.path.abspath (__file__)
+ m = re.match (r'(.*/)common/lib.*', base)
+ return m.group (1)
+
+# Add HPAV Ethernet type to the ETHER_TYPES of scapy.
+ETHER_TYPES['HPAV'] = 0x88e1
+
+# Add the CCo Level/Capability
+HPAV_CCO_LEVEL = {0:'CCo Level 0', 1:'CCo Level 1', 2:'CCo Level 2'}
+
+# SPC OUI
+SPC_OUI = 0x0013d7
+
+# Get the MME Types.
+base = find_base ()
+sys.path.append ("%s/cesar/maximus/python/lib/cesar/" % base)
+from defineparser import define_parser
+HPAV_MMTYPES_TEMP = define_parser ("%s/cesar/cp/mme.h" % base)
+HPAV_MMTYPES = {}
+types = ["_REQ", "_CNF", "_IND", "_RSP"]
+for i in HPAV_MMTYPES_TEMP:
+ if not i.startswith ('CP_MME_') and not i.endswith ('_MIN') \
+ and not i.endswith ('_MAX'):
+ for j in range (len (types)):
+ HPAV_MMTYPES["%s%s" % (i, types[j])] = \
+ HPAV_MMTYPES_TEMP[i] + j
+ elif i.endswith ('_MIN') or i.endswith ('_MAX'):
+ HPAV_MMTYPES[i] = HPAV_MMTYPES_TEMP[i]
+del base
+del types
+del HPAV_MMTYPES_TEMP
+
+# Dict with the keywords base on the hexadecimal value.
+HPAV_MMTYPES_REVERSE = {}
+for i in HPAV_MMTYPES:
+ HPAV_MMTYPES_REVERSE[HPAV_MMTYPES[i]] = i
+
+HPAV_RESULT = {'success':0, 'failure': 1}
+
+HPAV_PEKS = {0: "DAK", 1: "NMK"}
+for i in range (2, 0xf):
+ HPAV_PEKS[i] = "TEK"
+HPAV_PEKS[0xf] = "None"
+
+HPAV_PID = { 0: "AUTHENTICATION_REQUEST",
+ 1: "PROVISIONING_AUTH_STA_NEK_BY_CCO",
+ 2: "PROVISIONING_STA_WITH_NMK_USING_DAK",
+ 3: "PROVISIONING_STA_WITH_NMK_USING_UKE",
+ 4: "HLE",
+ }
+
+HPAV_KEY_TYPE = {
+ 0: "DAK",
+ 1: "NMK",
+ 2: "NEK",
+ 3: "TEK",
+ 4: "HASH_KEY",
+ 5: "NONCE_ONLY"
+ }
diff --git a/common/lib/scammer/commonfields.py b/common/lib/scammer/commonfields.py
new file mode 100644
index 0000000000..82f4eaad14
--- /dev/null
+++ b/common/lib/scammer/commonfields.py
@@ -0,0 +1,107 @@
+#!/usr/bin/python
+
+#############################################################################
+# Copyright (C) 2011 Spidcom
+#############################################################################
+
+from scapy.fields import *
+
+class XLEShortField (LEShortField):
+ """This class is used to represent LEShortField (scapy) in Hexadecimal
+ representation, this functionality should exist in the future version of
+ scapy called 'XLEShortField' """
+ def i2repr(self, pkt, x):
+ if x is None:
+ x = 0
+ return lhex(self.i2h(pkt, x))
+
+class LEBitField (BitField):
+ def __init__(self, name, default, size):
+ BitField.__init__(self, name, default, size)
+
+ def addfield (self, pkt, s, val):
+ val = self.i2m(pkt, val)
+ if type(s) is tuple:
+ s,bitsdone,v = s
+ else:
+ bitsdone = 0
+ v = 0
+ if self.rev:
+ val = self.reverse(val)
+ v |= val << bitsdone
+ bitsdone += self.size
+ while bitsdone >= 8:
+ bitsdone -= 8
+ s = s+struct.pack("B", v >> bitsdone)
+ v &= (1L<<bitsdone)-1
+ if bitsdone:
+ return s,bitsdone,v
+ else:
+ return s
+
+ def getfield(self, pkt, s):
+ if type(s) is tuple:
+ s,bn = s
+ else:
+ bn = 0
+ # we don't want to process all the string
+ nb_bytes = (self.size+bn-1)/8 + 1
+ w = s[:nb_bytes]
+
+ # split the substring byte by byte
+ bytes = struct.unpack('%dB' % nb_bytes , w)
+
+ b = 0L
+ for c in range(nb_bytes):
+ b |= long(bytes[nb_bytes - 1 - c]) << (nb_bytes-c-1)*8
+
+ # Decal of bn.
+ b = b >> bn
+ # get rid of high order bits
+ b &= (1L << (self.size)) - 1
+
+ if self.rev:
+ b = self.reverse(b)
+
+ bn += self.size
+ s = s[bn/8:]
+ if bn % 8 != 0:
+ sbyte = struct.unpack ('B', s[0])[0]
+ decal_bits = (8 - (nb_bytes * 8 - self.size))
+ sbyte &= ~((1 << decal_bits) - 1)
+ sbyte = struct.pack ('B', sbyte)
+ s = sbyte + s[1:]
+
+ bn = bn%8
+ b = self.m2i(pkt, b)
+ if bn:
+ return (s,bn),b
+ else:
+ return s,b
+
+class XLEBitField (LEBitField):
+ """This class is used to represent LEShortField (scapy) in Hexadecimal
+ representation, this functionality should exist in the future version of
+ scapy called 'XLEShortField' """
+ def i2repr(self, pkt, x):
+ if x is None:
+ x = 0
+ return lhex(self.i2h(pkt, x))
+
+class HPAVNIDField (Field):
+ """Special Field for NID HPAV field."""
+ def __init__(self, name, default):
+ Field.__init__(self, name, default, "7s")
+
+ def addfield (self, pkt, s, val):
+ nb_bytes = 7
+ w = struct.pack ('Q', val)
+ w = w[:nb_bytes]
+ return s + w
+
+ def getfield (self, pkt, s):
+ nb_bytes = 7
+ w = "%s\0" % s[0:nb_bytes]
+ w = struct.unpack ('Q', w)[0]
+ s = s[nb_bytes:]
+ return s,w
diff --git a/common/lib/scammer/cp.py b/common/lib/scammer/cp.py
new file mode 100644
index 0000000000..0472be116a
--- /dev/null
+++ b/common/lib/scammer/cp.py
@@ -0,0 +1,10 @@
+#!/usr/bin/python
+
+#############################################################################
+# Copyright (C) 2011 Spidcom
+#
+#############################################################################
+
+from scapy.all import Packet
+from scapy.fields import *
+from commonfields import *
diff --git a/common/lib/scammer/drv.py b/common/lib/scammer/drv.py
new file mode 100644
index 0000000000..b1ff6f5610
--- /dev/null
+++ b/common/lib/scammer/drv.py
@@ -0,0 +1,140 @@
+#!/usr/bin/python
+
+#############################################################################
+# Copyright (C) 2011 Spidcom
+#############################################################################
+
+from scapy.all import Packet
+from scapy.fields import *
+from commonfields import *
+from scammer import MMEPayload
+from common import HPAV_RESULT
+
+class DRV_STA_MAC_STOP_REQ (MMEPayload):
+ """Handles the DRV_STA_MAC_STOP.REQ MME."""
+ name = "HomePlug AV DRV_STA_MAC_STOP.REQ"""
+ fields_desc = [
+ ]
+
+class DRV_STA_MAC_STOP_CNF (MMEPayload):
+ """Handles the DRV_STA_MAC_STOP.CNF MME."""
+ name = "HomePlug AV DRV_STA_MAC_STOP.CNF"""
+ fields_desc = [
+ XByteField ("result", 0),
+ ]
+
+class DRV_STA_STATUS_IND (MMEPayload):
+ """Handles the DRV_STA_STATUS.IND MME."""
+ name = "HomePlug AV DRV_STA_STATUS.IND"""
+ fields_desc = [
+ ByteEnumField ("status", 0,
+ {0: "unassociated",
+ 1: "associated",
+ 2: "authenticated"}
+ ),
+ ByteEnumField ("role", 0,
+ {0: "Station",
+ 1: "Proxy CCo",
+ 2: "CCo",
+ }
+ ),
+ XByteField ("user_appoint_cco", 0),
+ XByteField ("backup_cco", 0),
+ XByteField ("simple_connect", 0),
+ ByteEnumField ("PLC_sync_freq", 0,
+ {0: "unknown",
+ 1: "50Hz",
+ 2: "60Hz",
+ 3: "Co-axial_Cable",
+ }
+ ),
+ ]
+
+class DRV_STA_SC_REQ (MMEPayload):
+ """Handles the DRV_STA_SC.REQ MME."""
+ name = "HomePlug AV DRV_STA_SC.REQ"""
+ fields_desc = [
+ ByteEnumField ("sc_join", 0, { 0: "SC_ADD", 1: "SC_JOIN" }),
+ ]
+
+class DRV_STA_SC_CNF (MMEPayload):
+ """Handles the DRV_STA_SC.CNF MME."""
+ name = "HomePlug AV DRV_STA_SC.CNF"""
+ fields_desc = [
+ ByteEnumField ("result", 0, HPAV_RESULT),
+ ]
+
+class DRV_MCAST_SET_LIST_REQ_member (Packet):
+ """Handles the DRV_MCAST_SET_LIST.REQ_member MME."""
+ name = "HomePlug AV DRV_MCAST_SET_LIST.REQ_member"""
+ fields_desc = [
+ MACField ("mac", ETHER_ANY),
+ ]
+
+ def extract_padding(self, s):
+ return "",s
+
+class DRV_MCAST_SET_LIST_REQ_group (Packet):
+ """Handles the DRV_MCAST_SET_LIST.REQ_group MME."""
+ name = "HomePlug AV DRV_MCAST_SET_LIST.REQ_group"""
+ fields_desc = [
+ MACField ("mac_group", ETHER_ANY),
+ FieldLenField("nbmembers", None, count_of="members",fmt="B"),
+ PacketListField ("members", None,
+ DRV_MCAST_SET_LIST_REQ_member,
+ count_from = lambda p: p.nbmembers),
+ ]
+
+ def extract_padding(self, s):
+ return "",s
+
+class DRV_MCAST_SET_LIST_REQ (MMEPayload):
+ """Handles the DRV_MCAST_SET_LIST.REQ MME."""
+ name = "HomePlug AV DRV_MCAST_SET_LIST.REQ"""
+ fields_desc = [
+ FieldLenField("nbgrps", None, count_of="groups",fmt="B"),
+ PacketListField ("groups", None, DRV_MCAST_SET_LIST_REQ_group,
+ count_from = lambda p: p.nbgrps),
+ ]
+
+class DRV_MCAST_SET_LIST_CNF (MMEPayload):
+ """Handles the DRV_MCAST_SET_LIST.CNF MME."""
+ name = "HomePlug AV DRV_MCAST_SET_LIST.CNF"""
+ fields_desc = [
+ ByteEnumField ("result", 0, HPAV_RESULT),
+ ]
+
+class DRV_STA_SET_KEY_REQ (MMEPayload):
+ """Handles the DRV_STA_SET_KEY.REQ MME."""
+ name = "HomePlug AV DRV_STA_SET_KEY.REQ"""
+ fields_desc = [
+ BitField ("nmk", 0, 128),
+ ByteEnumField ("type", 0,
+ {
+ 0: "CHANGE_NID",
+ 1: "CHANGE_SECURITY_LEVEL",
+ }),
+ HPAVNIDField ("nid", 0),
+ ByteField ("sl", 0),
+ ]
+
+class DRV_STA_SET_KEY_CNF (MMEPayload):
+ """Handles the DRV_STA_SET_KEY.CNF MME."""
+ name = "HomePlug AV DRV_STA_SET_KEY.CNF"""
+ fields_desc = [
+ ByteEnumField ("result", 0, HPAV_RESULT),
+ ]
+
+class DRV_STA_SET_KEY_IND (MMEPayload):
+ """Handles the DRV_STA_SET_KEY.IND MME."""
+ name = "HomePlug AV DRV_STA_SET_KEY.IND"""
+ fields_desc = [
+ BitField ("nmk", 0, 128),
+ ByteEnumField ("type", 0,
+ {
+ 0: "CHANGE_NID",
+ 1: "CHANGE_SECURITY_LEVEL",
+ }),
+ HPAVNIDField ("nid", 0),
+ ByteField ("sl", 0),
+ ]
diff --git a/common/lib/scammer/nn.py b/common/lib/scammer/nn.py
new file mode 100644
index 0000000000..d96c5d7ff5
--- /dev/null
+++ b/common/lib/scammer/nn.py
@@ -0,0 +1,9 @@
+#!/usr/bin/python
+
+#############################################################################
+# Copyright (C) 2011 Spidcom
+#############################################################################
+
+from scapy.all import Packet
+from scapy.fields import *
+from commonfields import *
diff --git a/common/lib/scammer/scammer.py b/common/lib/scammer/scammer.py
new file mode 100644
index 0000000000..c4ebdb42be
--- /dev/null
+++ b/common/lib/scammer/scammer.py
@@ -0,0 +1,53 @@
+#!/usr/bin/python
+
+#############################################################################
+# Copyright (C) 2011 Spidcom
+#
+# MME handler based on scapy.
+#
+# See http://www.secdev.org/projects/scapy/doc/build_dissect.html
+#
+# To see dissection errors add conf.debug_dissector = 1 anywhere in the
+# script.
+#############################################################################
+
+from scapy.all import Ether, Packet, bind_layers
+from scapy.fields import *
+from commonfields import *
+from common import ETHER_TYPES, HPAV_MMTYPES, HPAV_MMTYPES_REVERSE
+
+class MME (Packet):
+ """Create an Ethernet packet."""
+ name = "HomePlug AV MME"
+ fields_desc = [
+ XByteField("mmv", 1),
+ EnumField("mmtype", 0,
+ HPAV_MMTYPES_REVERSE,
+ fmt = "<H"),
+ ConditionalField (XBitField("nf_mi", 0, 4), lambda p:p.mmv==0x1),
+ ConditionalField (XBitField("fn_mi", 0, 4), lambda p:p.mmv==0x1),
+ ConditionalField (XByteField("fmsn", 0), lambda p:p.mmv==0x1),
+ ]
+
+bind_layers (Ether, MME, type = ETHER_TYPES['HPAV'])
+
+class MMEPayload (Packet):
+ """MME Payload Metaclass"""
+
+ @classmethod
+ def register_variant(cls):
+ if cls.__name__ in HPAV_MMTYPES:
+ bind_layers (MME, cls, mmtype = HPAV_MMTYPES[cls.__name__])
+
+def get_sniffed_mme (mme):
+ """Get the MME embedded in the VS_SNIFFER.IND."""
+ assert mme.mmtype == HPAV_MMTYPES['VS_SNIFFER_IND']
+ return mme.getlayer (3)
+
+if __name__ == '__main__':
+ mac = '00:13:d7:00:00:%02x'
+ m = Ether (dst=mac % 2, src=mac % 1) \
+ / MME (mmtype=0x6002, nf_mi=0, fn_mi=0, fmsn=0)
+ print "mme", repr (str (m))
+ p = Ether (str (m))
+ p.show ()
diff --git a/common/lib/scammer/vs.py b/common/lib/scammer/vs.py
new file mode 100644
index 0000000000..5ffef98020
--- /dev/null
+++ b/common/lib/scammer/vs.py
@@ -0,0 +1,109 @@
+#!/usr/bin/python
+
+#############################################################################
+# Copyright (C) 2011 Spidcom
+#
+# All VS MME.
+#############################################################################
+
+from scapy.all import Packet, Ether, bind_layers
+from scapy.fields import *
+from commonfields import *
+from common import SPC_OUI, HPAV_RESULT
+from scammer import MMEPayload
+from beacon import BeaconSniff
+
+class VS_HEADER (Packet):
+ """The vendor specific MME."""
+ name = "HomePlug AV VS MME"
+ fields_desc = [
+ XBitField ("oui", SPC_OUI, 24),
+ ]
+
+class VS_SNIFFER_REQ_CNF_command (Packet):
+ """Handles the command bit field of the VS_SNIFFER.REQ/CNF MME."""
+ name = "HomePlug AV VS_SNIFFER.REQ/CNF command bit field MME"
+ fields_desc = [
+ LEBitField ("mme_tx", 0, 1),
+ LEBitField ("mme_rx", 0, 1),
+ LEBitField ("beacon_tx", 0, 1),
+ LEBitField ("beacon_rx", 0, 1),
+ LEBitField ("fc_rx", 0, 1),
+ LEBitField ("mpdu_rx", 0, 1),
+ LEBitField ("rsvd", 0, 2),
+ ]
+
+class VS_SNIFFER_REQ (MMEPayload):
+ """Handles the VS_SNIFFER.REQ MME."""
+ name = "HomePlug AV VS_SNIFFER.REQ MME"
+ fields_desc = [
+ VS_HEADER,
+ VS_SNIFFER_REQ_CNF_command,
+ ]
+
+class VS_SNIFFER_CNF (MMEPayload):
+ """Handles the VS_SNIFFER.CNF MME."""
+ name = "HomePlug AV VS_SNIFFER.CNF MME"
+ fields_desc = [
+ VS_HEADER,
+ ByteEnumField ("result", 0, HPAV_RESULT),
+ VS_SNIFFER_REQ_CNF_command,
+ MACField ("dmac", ETHER_ANY),
+ ]
+
+class VS_SNIFFER_IND (MMEPayload):
+ """Handles a VS_SNIFFER.IND MME. """
+ name = "HomePlug AV VS_SNIFFER.IND"
+ fields_desc = [
+ VS_HEADER,
+ ByteEnumField ("sniff_type", 0, {0:'MME', 1:'Beacon', 2:'MPDU'}),
+ ByteEnumField ("direction", 0, {0:'transmitted', 1:'received'}),
+ ]
+
+bind_layers (VS_SNIFFER_IND, Ether, sniff_type = 0)
+bind_layers (VS_SNIFFER_IND, BeaconSniff, sniff_type = 1)
+
+class VS_GET_MACTOTEI_REQ (MMEPayload):
+ """Handles a VS_GET_MACTOTEI.REQ MME. """
+ name = "HomePlug AV VS_GET_MACTOTEI.REQ MME"
+ fields_desc = [
+ VS_HEADER,
+ ]
+
+class VS_GET_MACTOTEI_CNF_entry (Packet):
+ """Handles a VS_GET_MACTOTEI.CNF mac entry MME. """
+ name = "HomePlug AV VS_GET_MACTOTEI.CNF mac entry MME"
+ fields_desc = [
+ MACField ("mac", 0),
+ ByteField ("tei", 0),
+ ByteField ("tag", 0),
+ ]
+
+ def extract_padding(self, s):
+ return "",s
+
+class VS_GET_MACTOTEI_CNF (MMEPayload):
+ """Handles a VS_GET_MACTOTEI.CNF MME. """
+ name = "HomePlug AV VS_GET_MACTOTEI.CNF MME"
+ fields_desc = [
+ VS_HEADER,
+ FieldLenField ("nb", None, count_of="entries", fmt="<H"),
+ PacketListField ("entries", None, VS_GET_MACTOTEI_CNF_entry,
+ count_from = lambda p: p.nb),
+ ]
+
+if __name__ == '__main__':
+ from scapy.all import Ether
+ from scammer import MME
+ mac = '00:13:d7:00:00:%02x'
+ # VS_SNIFFER_IND
+ m = VS_SNIFFER_IND (sniff_type=1, direction=0)
+ p = VS_SNIFFER_IND (str (m))
+ p.show ()
+ # A full MME.
+ m = Ether (dst=mac % 2, src=mac % 1) \
+ / MME () \
+ / VS_SNIFFER_IND (sniff_type=1, direction=0)
+ m.show ()
+ p = Ether (str (m))
+ p.show ()
diff --git a/cesar/common/tests/Makefile b/common/tests/Makefile
index 2295421607..2295421607 100644
--- a/cesar/common/tests/Makefile
+++ b/common/tests/Makefile
diff --git a/cesar/common/tests/get-cov.pl b/common/tests/get-cov.pl
index 273db8509c..273db8509c 100755
--- a/cesar/common/tests/get-cov.pl
+++ b/common/tests/get-cov.pl
diff --git a/cesar/common/tests/run-test.pl b/common/tests/run-test.pl
index 04c1bfed62..04c1bfed62 100755
--- a/cesar/common/tests/run-test.pl
+++ b/common/tests/run-test.pl
diff --git a/cesar/common/tests/tests b/common/tests/tests
index d556cf7488..6a3270e908 100644
--- a/cesar/common/tests/tests
+++ b/common/tests/tests
@@ -17,146 +17,161 @@
#common/make/test::
#run: ./test_make.sh
-hal/arch/test/atomic:
+cleopatre/devkit/tests/libmme/utests:
+make: make
+
+cleopatre/devkit/tests/libspid/utests:
+make: make
+config_item: ./obj/config_item_utests
+config_line: ./obj/config_line_utests
+hpav_info: ./obj/hpav_info_utests
+image: ./obj/image_utests
+system: ./obj/system_utests
+
+cleopatre/devkit/tests/managerd/utests:
+make: make
+vs_mme: ./obj/vs_mme_utests
+
+cesar/hal/arch/test/atomic:
make: make COV=y
cov test_atomic: ./obj/test_atomic
-hal/boot_params/test/test_boot_params:
+cesar/hal/boot_params/test/test_boot_params:
make
test_boot_params: ./obj/test_boot_params
-hal/boot_params/test/test_bin_eof:
+cesar/hal/boot_params/test/test_bin_eof:
make
test_bin_eof: python ./test_bin_eof.py
-hal/mem/test:
+cesar/hal/mem/test:
make
test_mem: ./obj/test_mem
-hal/phy/maximus/test:
+cesar/hal/phy/maximus/test:
make: make COV=y
cov test_phy_maximus: ./obj/test_phy_maximus
-hal/phy/maximus/dur/test:
+cesar/hal/phy/maximus/dur/test:
make: make COV=y
cov test_dur: ./obj/test_dur
-hal/hle/maximus/test:
+cesar/hal/hle/maximus/test:
make: make COV=y
cov test_maximus_hle: ./obj/test_maximus_hle
-hal/hle/test:
+cesar/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:
+cesar/hal/leon/maximus/test:
make: make COV=y
cov test_maximus_timer: ./obj/test_maximus_timer
-lib/test/bitstream:
+cesar/lib/test/bitstream:
make: make HOST_COV=y
cov test_bitstream: ./obj/test_bitstream
-lib/test/blk:
+cesar/lib/test/blk:
make: make COV=y
cov test_blk: ./obj/test_blk
-lib/test/circular_buffer:
+cesar/lib/test/circular_buffer:
make: make COV=y
cov test_circular_buffer: ./obj/test_circular_list
-lib/test/crc:
+cesar/lib/test/crc:
make: make COV=y
cov test_crc: ./obj/test_crc
-lib/test/fixed:
+cesar/lib/test/fixed:
make: make COV=y
cov test_fixed: ./obj/test_fixed
-lib/test/heap:
+cesar/lib/test/heap:
make: make COV=y
cov test_heap: ./obj/test_heap
-lib/test/init:
+cesar/lib/test/init:
make: make COV=y
cov test_init: ./obj/test_init
-lib/test/list:
+cesar/lib/test/list:
make: make COV=y
cov test_list: ./obj/test_list
-lib/test/mac_lookup_table:
+cesar/lib/test/mac_lookup_table:
make: make COV=y
cov test_mac_lookup_table: ./obj/test_mac_lookup_table
-lib/test/mbox:
+cesar/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:
+cesar/lib/test/perf:
make: make
-lib/test/read_word:
+cesar/lib/test/read_word:
make: make COV=y
cov test_read_word: ./obj/test_read_word
-lib/test/restrack:
+cesar/lib/test/restrack:
make: make COV=y
cov test_restrack: ./obj/test_restrack
-lib/test/rnd:
+cesar/lib/test/rnd:
make: make COV=y
cov test_rnd: ./obj/test_rnd
-lib/test/set:
+cesar/lib/test/set:
make: make COV=y
cov test_set: ./obj/test_set
-lib/test/slab:
+cesar/lib/test/slab:
make: make COV=y
cov test_slab: ./obj/test_slab
-lib/test/slist:
+cesar/lib/test/slist:
make
run: ./obj/test_slist
-lib/test/stats:
+cesar/lib/test/stats:
make: make COV=y
cov test_stats: ./obj/test_stats
-lib/test/test:
+cesar/lib/test/test:
make
!run: ./obj/test_test
-lib/test/trace:
+cesar/lib/test/trace:
make: make HOST_COV=y
cov test_trace: ./obj/test_trace
-lib/test/try:
+cesar/lib/test/try:
make: make COV=y
cov test_try: ./obj/test_try
-lib/test/utils:
+cesar/lib/test/utils:
make: make COV=y
cov test_utils: ./obj/test_utils
-lib/scenario/test:
+cesar/lib/scenario/test:
make: make COV=y
cov test_scenario: ./obj/test_scenario
-lib/test/seq_check:
+cesar/lib/test/seq_check:
make: make COV=y
cov test_seq_check: ./obj/test_seq_check
-maximus/stationtest:
+cesar/maximus/stationtest:
make
-maximus/prototest/fcall:
+cesar/maximus/prototest/fcall:
make
-maximus/python:
+cesar/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
@@ -179,97 +194,97 @@ python py/test_tx_rx.py -e ../stationtest/obj/test_tx_rx.elf -d false -t 2500000
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:
+cesar/maximus/python/tools/csi/test:
python avln.py
python core.py
python station.py
-hal/phy/test/phy:
+cesar/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:
+cesar/hal/phy/test/bridgedma:
make
run: ./obj/host/bridgedma.elf
-mac/ca/test/ca:
+cesar/mac/ca/test/ca:
make: make COV=y
cov test_ca: ./obj/test_ca
-mac/ca/test/ca_eoc:
+cesar/mac/ca/test/ca_eoc:
make: make COV=y
cov test_ca_eoc: ./obj/test_ca
-mac/common/test/mfs:
+cesar/mac/common/test/mfs:
make
run: ./obj/test_mfs
-mac/common/test/pb:
+cesar/mac/common/test/pb:
make
run: ./obj/test_pb
-mac/common/test/store:
+cesar/mac/common/test/store:
make: make COV=y
cov test_store: ./obj/test_store
-mac/common/test/tonemap:
+cesar/mac/common/test/tonemap:
make: make COV=y
cov test_tonemap: ./obj/test_tonemap
-mac/common/test/interval:
+cesar/mac/common/test/interval:
make: make COV=y
cov test_interval: ./obj/test_interval
-mac/design/test/mfs_tx:
+cesar/mac/design/test/mfs_tx:
make
-mac/design/test/mfs_tx2:
+cesar/mac/design/test/mfs_tx2:
make
-mac/design/test/sacki:
+cesar/mac/design/test/sacki:
make
run: ./obj/test_sacki
-mac/pbproc/test/fc:
+cesar/mac/pbproc/test/fc:
make: make COV=y
cov test_fc: ./obj/test_fc
-mac/pbproc/test/fsm:
+cesar/mac/pbproc/test/fsm:
make: make COV=y
cov test_fsm: ./obj/test_fsm
-mac/pbproc/test/mfs:
+cesar/mac/pbproc/test/mfs:
make: make COV=y
cov test_mfs: ./obj/test_mfs
-mac/pbproc/test/pbproc:
+cesar/mac/pbproc/test/pbproc:
make: make COV=y
cov test_pbproc: ./obj/test_pbproc
-mac/pbproc/test/pbproc_eoc:
+cesar/mac/pbproc/test/pbproc_eoc:
make: make COV=y
cov test_pbproc_eoc: ./obj/test_pbproc
-mac/pbproc/test/int:
+cesar/mac/pbproc/test/int:
make
run: python py/host_test_pbproc.py --maximus
run: python py/test_coll.py --maximus
-mac/pbproc/test/sacki:
+cesar/mac/pbproc/test/sacki:
make: make COV=y
cov test_sacki: ./obj/test_sacki
-mac/sar/test/unit_test/ecos:
+cesar/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:
+cesar/mac/sar/test/unit_test/host:
make: make COV=y
cov lib_sar_mf: ./obj/lib_sar_mf
-mac/sar/test/functional:
+cesar/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
@@ -278,61 +293,61 @@ 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:
+cesar/cl/test/utest:
make: make COV=y
cov cl: ./obj/cl
-cl/test/functional:
+cesar/cl/test/functional:
make host
cl: ./obj/host/cl.elf
-cl/test/bridge_table:
+cesar/cl/test/bridge_table:
make: make COV=y
cov test_bridge_table: ./obj/test_bridge_table
-cl/test/data_rate:
+cesar/cl/test/data_rate:
make: make COV=y
cov data_rate: ./obj/data_rate
-ce/tx/test:
+cesar/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:
+cesar/ce/rx/test:
make: make COV=y
cov-target ce_rx_test_rx: ./obj/test_rx.elf
-ce/rx/bitloading/test:
+cesar/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:
+cesar/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:
+cesar/maximus/unittest:
make: make COV=y
obj/unittest -e ../stationtest/obj/stationtest.elf
-maximus/usertest:
+cesar/maximus/usertest:
make: make COV=y
obj/usertest -e ../stationtest/obj/stationtest.elf -d false -t 2500000000
-test_general/maximus/integration/cl-sar-pbproc:
+cesar/test_general/maximus/integration/cl-sar-pbproc:
make
python test1.py -d false -t 2500000000
-test_general/maximus/integration/sar-pbproc:
+cesar/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:
+cesar/test_general/maximus/integration/sar-pbproc-eoc:
make
python test1.py -d false -t 2500000000
python test2.py -d false -t 2500000000
@@ -343,78 +358,78 @@ 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:
+cesar/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:
+cesar/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:
+cesar/test_general/maximus/integration/interface-dp:
make
python test01.py -d false -t 2500000000
-interface/sniffer/test:
+cesar/interface/sniffer/test:
make
sniffer: ./obj/test-sniffer
-interface/test:
+cesar/interface/test:
make: make synth
interface: ./obj/synth/test-interface.elf
-hle/test/:
+cesar/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:
+cesar/host/test:
make: make COV=y
./obj/test_host
-host/sci/cesar/test:
+cesar/host/sci/cesar/test:
make: make COV=y
./obj/test_sci_cesar
-interface/fcall/test:
+cesar/interface/fcall/test:
make: make COV=y
./obj/test_interface_fcall
-cp/test/mme:
+cesar/cp/test/mme:
make: make COV=y host.all
cov test_mme: ./obj/test_mme
-cp/fsm/test/utest:
+cesar/cp/fsm/test/utest:
make: make COV=y
cov test_fsm: ./obj/test_fsm
-cp/sta/action/test/utest:
+cesar/cp/sta/action/test/utest:
make: make COV=y
cov test_sta_action: ./obj/test_sta_action
-cp/sta/mgr/test:
+cesar/cp/sta/mgr/test:
make
test_sta_mgr: obj/test_sta_mgr
-cp/cco/action/test:
+cesar/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:
+cesar/cp/cco/action/test/utest:
make
action: ./obj/test_cco_action
-cp/beacon/test:
+cesar/cp/beacon/test:
make
beacon: ./obj/beacon.elf
discover: ./obj/discover_process.elf
-cp/msg/test:
+cesar/cp/msg/test:
make: make COV=y
read-header: ./obj/test-msg-read-header
cc-msg: ./obj/test-msg-cc
@@ -427,7 +442,7 @@ vs-msg: ./obj/test_vs_msg
vs-msg: ./obj/test_vs_msg
test_allowed_mme: ./obj/test_allowed_mme
-cp/secu/test:
+cesar/cp/secu/test:
make: make -f host-Makefile COV=y
sha256: ./obj/host/test_sha2
aes128: ./obj/host/test_aes
@@ -435,133 +450,103 @@ prun: ./obj/host/test_prun
nmk: ./obj/host/test_nmk
hash: ./obj/host/test_hash
-cp/cl_interf/test:
+cesar/cp/cl_interf/test:
make
cl_interf: ./obj/test-cl-interf
-cp/sta/core/test:
+cesar/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
+cesar/test_general/station/scenario:
+make
+sc01_assoc_auth: python py/sc01_assoc_auth.py -d false -t 25000000000
+sc02_stas_communication: python py/sc02_stas_communication.py -d false -t 25000000000
+sc03_two_avln_coexisting: python py/sc03_two_avln_coexisting.py -d false -t 25000000000
+sc04_cc_whoru: python py/sc04_cc_whoru.py -d false -t 25000000000
+sc05_cc_leave: python py/sc05_cc_leave.py -d false -t 25000000000
+sc06_discover_procedure: python py/sc06_discover_procedure.py -d false -t 25000000000
+sc07_bridge: python py/sc07_bridge.py -d false -t 25000000000
+sc08_bentry_change: python py/sc08_bentry_change.py -d false -t 25000000000
+sc09_simple_connect: python py/sc09_simple_connect.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
+sc11_cm_nw_info: python py/sc11_cm_nw_info.py -d false -t 25000000000
+sc12_change_nmk: python py/sc12_change_nmk.py -d false -t 25000000000
+sc14_igmp: python py/sc14_igmp.py -d false -t 25000000000
-test_general/station/maximus:
+cesar/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:
+cesar/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:
+cesar/cp/cco/bw/test:
make
bw: ./obj/bw
-cp/cco/region/test:
+cesar/cp/cco/region/test:
make
region: ./obj/region
-hal/phy/spoc/test:
+cesar/hal/phy/spoc/test:
make host.all
spoc: ./obj/spoc_host_check_coeff
+test_spoc: ./obj/test_spoc
-cp/beacon/test/utest_eoc:
+cesar/cp/beacon/test/utest_eoc:
make
beaconeoc: ./obj/beacon.elf
-test_general/station/compliance-eoc:
+cesar/test_general/station/compliance-eoc:
make
test02_eoc_beacon: python py/test02_eoc_beacon.py --maximus
-cp/eoc/cco/action/test/utest:
+cesar/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:
+cesar/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:
+cesar/cp/eoc/multi_sta_fsm/test/utest:
make: make COV=y
cov test_fsm: ./obj/test_fsm
-cp/eoc/multi_sta/action/test/utest:
+cesar/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:
+cesar/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:
+cesar/bsu/beacon/test/utest:
make
beacon: ./obj/beacon
-bsu/test/utest:
+cesar/bsu/test/utest:
make
test_bsu: ./obj/test_bsu
-bsu/ntb/test/utest:
+cesar/bsu/ntb/test/utest:
make
bsu/ntb: ./obj/ntb
-bsu/aclf/test/utest:
+cesar/bsu/aclf/test/utest:
make
bsu/aclf: ./obj/aclf
-projects/plc:
+cesar/projects/plc:
make
make traces: make PROJECT_CONFIG=Config.traces
diff --git a/validation/test/test.py b/validation/test/test.py
new file mode 100755
index 0000000000..4d121fc345
--- /dev/null
+++ b/validation/test/test.py
@@ -0,0 +1,10 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+import test_io_group
+import test_power_strip
+import test_spc300
+
+#test_io_group.test()
+#test_power_strip.test()
+test_spc300.test()
diff --git a/validation/test/test_bench.dia b/validation/test/test_bench.dia
new file mode 100644
index 0000000000..d6dd6b94e6
--- /dev/null
+++ b/validation/test/test_bench.dia
Binary files differ
diff --git a/validation/test/test_io_group.py b/validation/test/test_io_group.py
new file mode 100644
index 0000000000..ce376fe57f
--- /dev/null
+++ b/validation/test/test_io_group.py
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+
+import validlib.io_group as io_group
+
+def test():
+ print "Executing", __file__, "..."
+ test_io_group_control()
+
+def test_io_group_control():
+ subindexes = io_group.subindexes()
+ for index in io_group.indexes():
+ io_group.switch("off", (index, subindexes))
+ for subindex in subindexes:
+ key = (index, subindex)
+ assert io_group.status(key) == "off"
+ io_group.switch("on", key)
+ assert io_group.status(key) == "on"
+ print "OK: The io", key, "can be controlled"
+ print "OK: The group of io's", index, "can be controlled"
+
diff --git a/validation/test/test_power_strip.py b/validation/test/test_power_strip.py
new file mode 100644
index 0000000000..73c95ab892
--- /dev/null
+++ b/validation/test/test_power_strip.py
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+
+import validlib.power_strip as power_strip
+
+def test():
+ print "Executing", __file__, "..."
+ test_power_strip_control()
+
+def test_power_strip_control():
+ subindexes = power_strip.subindexes()
+ for index in power_strip.indexes():
+ power_strip.switch("off", (index, subindexes))
+ for subindex in subindexes:
+ key = (index, subindex)
+ assert power_strip.status(key) == "off"
+ power_strip.switch("on", key)
+ assert power_strip.status(key) == "on"
+ print "OK: The power plug", key, "can be controlled"
+ print "OK: The power strip", index, "can be controlled"
+
diff --git a/validation/test/test_spc300.py b/validation/test/test_spc300.py
new file mode 100644
index 0000000000..18f1e62f30
--- /dev/null
+++ b/validation/test/test_spc300.py
@@ -0,0 +1,199 @@
+# -*- coding: utf-8 -*-
+
+import random
+import validlib.power_strip as power_strip
+import validlib.link as link
+import validlib.spc300 as spc300
+from validlib.spc300 import role, r_ping
+
+def test():
+ print
+ print "Executing", __file__, "..."
+
+# The OK or NOK in the comments below refer to the results obtained with av-1.2.1
+
+# test_shape()
+# test_kill()
+# test_split()
+# test_merge()
+# test_split_merge()
+# test_coexist()
+
+def test_shape():
+ test_shape_an_avln_cco_3_sta() # OK, except that everybody is UCCO
+
+def test_kill():
+ test_kill_cco_in_cco_2_sta() # OK, but the roles are not checked
+
+def test_split():
+ test_split_cco_1_sta_in_2_avlns_ucco() # OK, but the roles are not checked
+ test_split_cco_3_sta_in_2_avlns_cco_1_sta() # (#2869) NOK, it happens that avln_2 cannot be shaped
+
+def test_merge():
+ test_merge_ucco_with_ucco() # OK, but the roles are not checked
+ test_merge_cco_1_sta_with_ucco_scenario_1() # OK, but the roles are not checked
+ test_merge_cco_1_sta_with_ucco_scenario_2() # (#2535) NOK, it happens that avln_1 cannot be shaped
+ test_merge_cco_1_sta_with_cco_1_sta() # (#2243) NOK, the final AVLN can never be shaped
+
+def test_split_merge():
+ test_replace_cco_in_cco_1_sta() # OK, but the roles are not checked
+ test_split_merge_split_cco_3_sta_in_2_avlns_cco_1_sta() # (#2543) To be done, when the split will work
+
+def test_coexist():
+ test_coexist_cco_1_sta_with_cco_1_sta_scenario_1() # (#2713) NOK
+ test_coexist_cco_1_sta_with_cco_1_sta_scenario_2() # (#2713) NOK
+
+def test_shape_an_avln_cco_3_sta():
+ setup("attach")
+ title("Test shape an AVLN CCO + 3 STA...")
+ avln = [(1, 1), (1, 2), (2, 1), (2, 2)]
+ change_nmk(avln)
+ switch_on(avln)
+ check_networks(avln, [])
+
+def test_kill_cco_in_cco_2_sta():
+ setup("attach")
+ title("Test kill CCO in CCO + 2 STA...")
+ avln = [(1, 1), (1, 2), (2, 1)]
+ switch_on(avln)
+ check_networks(avln, [])
+ power_strip.switch("off", (1, 1))
+ check_networks([(1, 2), (2, 1)], [])
+
+def test_split_cco_1_sta_in_2_avlns_ucco():
+ setup("attach")
+ title("Test split CCO + 1 STA in 2 AVLNs UCCOs...")
+ avln = [(1, 1), (2, 1)]
+ switch_on(avln)
+ check_networks(avln, [])
+ link.detach(1)
+ check_networks([(1, 1)], [(2, 1)])
+
+def test_split_cco_3_sta_in_2_avlns_cco_1_sta():
+ setup("attach")
+ title("Test split CCO + 3 STA in 2 AVLNs CCO + 1 STA...")
+ avln = [(1, 1), (1, 2), (2, 1), (2, 2)]
+ switch_on(avln)
+ check_networks(avln, [])
+ link.detach(1)
+ check_networks([(1, 1), (1, 2)], [(2, 1), (2, 2)])
+
+def test_merge_ucco_with_ucco():
+ setup("detach")
+ title("Test merge UCCO with UCCO...")
+ switch_on([(1, 1), (2, 1)])
+ check_networks([(1, 1)], [(2, 1)])
+ link.attach(1)
+ check_networks([(1, 1), (2, 1)], [])
+
+def test_merge_cco_1_sta_with_ucco_scenario_1():
+ setup("detach")
+ title("Test merge CCO + 1 STA with UCCO...")
+ switch_on([(1, 1), (1, 2)])
+ check_networks([(1, 1), (1, 2)], [])
+ switch_on((2, 1))
+ check_networks([(1, 1), (1, 2)], [(2, 1)])
+ link.attach(1)
+ check_networks([(1, 1), (1, 2), (2, 1)], [])
+
+def test_merge_cco_1_sta_with_ucco_scenario_2():
+ setup("detach")
+ title("Test merge CCO + 1 STA with UCCO...")
+ switch_on([(1, 1), (2, 1)])
+ check_networks([(1, 1)], [(2, 1)])
+ switch_on((1, 2))
+ check_networks([(1, 1), (1, 2)], [(2, 1)])
+ link.attach(1)
+ check_networks([(1, 1), (1, 2), (2, 1)], [])
+
+def test_merge_cco_1_sta_with_cco_1_sta():
+ setup("detach")
+ title("Test merge CCO + 1 STA with CCO + 1 STA...")
+ avln_1 = [(1, 1), (1, 2)]
+ avln_2 = [(2, 1), (2, 2)]
+ switch_on(avln_1 + avln_2)
+ check_networks(avln_1, avln_2)
+ link.attach(1)
+ check_networks(avln_1 + avln_2, [])
+
+def test_replace_cco_in_cco_1_sta():
+ setup("attach")
+ title("Test replace CCO in CCO + 1 STA...")
+ switch_on([(1, 1), (1, 2)])
+ check_networks([(1, 1), (1, 2)], [])
+ power_strip.switch("off", (1, 1))
+ switch_on((2, 1))
+ check_networks([(1, 2), (2, 1)], [])
+
+def test_coexist_cco_1_sta_with_cco_1_sta_scenario_1():
+ setup("detach")
+ title("Test coexistence of 2 (CCO + 1 STA) with a different NMK...")
+ avln_1 = [(1, 1), (1, 2)]
+ avln_2 = [(2, 1), (2, 2)]
+ change_nmk(avln_1)
+ switch_on(avln_1 + avln_2)
+ check_networks(avln_1, avln_2)
+ link.attach(1)
+ check_networks(avln_1, avln_2)
+
+def test_coexist_cco_1_sta_with_cco_1_sta_scenario_2():
+ setup("attach")
+ title("Test coexistence of 2 (CCO + 1 STA) with a different NMK...")
+ avln_1 = [(1, 1), (1, 2)]
+ avln_2 = [(2, 1), (2, 2)]
+ change_nmk(avln_1)
+ switch_on(avln_1 + avln_2)
+ check_networks(avln_1, avln_2)
+
+def setup(action):
+ title("Initialize the test bench...")
+ power_strip.switch_off_all()
+ if action == "detach": link.detach(1)
+ if action == "attach": link.attach(1)
+
+def get_cco(avln):
+ for key in avln:
+ if role(key) == "CCO": return key
+ assert false
+
+def title(String):
+ print "+++++++++++++++++++++++++++"
+ print "+", String
+ print "+++++++++++++++++++++++++++"
+
+def check_networks(avln_1, avln_2):
+ print "Checking the networks", avln_1, "and", avln_2, "...{"
+ check_intra_network(avln_1)
+ check_intra_network(avln_2)
+ check_inter_networks(avln_1, avln_2)
+ print"OK: the networks are as expected"
+ print "}"
+
+def check_intra_network(avln):
+ for key_1 in avln:
+ for key_2 in avln:
+ assert r_ping(key_1, key_2) == "pong", (key_1, key_2)
+ if len(avln) > 1:
+ roles = [ role(key) for key in avln ]
+ roles.sort()
+ #assert roles[0] == "CCO", roles
+ #assert roles.count("STA") == len(avln) - 1, (roles, avln)
+
+def check_inter_networks(avln_1, avln_2):
+ for key_1 in avln_1:
+ for key_2 in avln_2:
+ assert r_ping(key_1, key_2) == "pang", (key_1, key_2)
+
+def change_nmk(keys):
+ new_nmk = str(random.random())
+ for key in keys:
+ switch_on(key)
+ spc300.change_nmk(key, new_nmk)
+ power_strip.switch("off", key)
+
+def switch_on(keys):
+ if type(keys) != list:
+ keys = [keys]
+ for key in keys:
+ spc300.switch_on(key)
+
diff --git a/validation/validlib/__init__.py b/validation/validlib/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/validation/validlib/__init__.py
diff --git a/validation/validlib/anellib.py b/validation/validlib/anellib.py
new file mode 100644
index 0000000000..731d559c53
--- /dev/null
+++ b/validation/validlib/anellib.py
@@ -0,0 +1,103 @@
+# -*- coding: utf-8 -*-
+
+"""Module allowing to command and control the Anel io's/power plugs.
+
+The parameters are the following:
+- "target": io or power plug - used for the messages printed to the user
+- "switch_path": HTML page allowing to switch on/off the target
+- "status_path": HTML page allowing to retrieve the status on/off of the
+ target
+- "body": body of the switching request
+- "letter": letter identifying the target in the statuses or switching requests
+- "config":configuration of the web server (IP address, login and password)
+- "size": number of the io's/power plugs
+
+What is called "key" is a couple identifying the power plug (resp. io):
+- the first element is the index of the power strip (resp. group of io's),
+- the second element is the index of the power plug (resp. io) on the power
+ strip (resp. group of io's)
+
+"""
+
+import base64
+import re
+import httplib
+
+def switch(command, keys, parameters):
+ """Switch on/off the io's/power plugs identified by the keys"""
+ (index, subindexes) = keys
+ if type(subindexes) != list:
+ subindexes = [subindexes]
+ assert (command == "off" or command == "on")
+ print "Switch", command, "the", parameters["target"], "(s)", keys
+ page = statuses_page(index, parameters)
+ new_subindexes = []
+ for subindex in subindexes:
+ if command != status_aux(page, subindex, parameters):
+ new_subindexes.append(subindex)
+ send_switching_request(index, new_subindexes, parameters)
+
+def send_request(index, path, body, parameters):
+ """Send an HTTP request to the web server managing the io's/power plugs"""
+ if body == "": method = "GET"
+ else: method = "POST"
+ (address, login, password) = parameters["config"][index]
+ token = base64.standard_b64encode(login + ":" + password)
+ headers = {"Authorization": "Basic " + token}
+ connection = httplib.HTTPConnection(address)
+ connection.request(method, path, body, headers)
+ response = connection.getresponse()
+ connection.close()
+ return response.read()
+
+def send_switching_request(index, subindexes, parameters):
+ """Send a switching request (on/off) to the web server managing the
+ io's/power plugs"""
+ body = parameters["body"]
+ assert body != ""
+ path = parameters["switch_path"]
+ letter = parameters["letter"]
+ for subindex in subindexes:
+ body = body + "&" + letter + str(subindex - 1) + "=S"
+ send_request(index, path, body, parameters)
+
+def status_aux(page, subindex, parameters):
+ """Return the status of the io's/power plugs contained in the page"""
+ letter = parameters["letter"]
+ green = "#00DD00"
+ criteria = "<td bgcolor=" + green + ">" + \
+ "<input class=bt type=submit value=[IO] name=" + \
+ letter + str(subindex - 1) + ">" + \
+ "</td>"
+ if re.search(criteria, page) is None: status = "off"
+ else: status = "on"
+ return status
+
+def statuses_page(index, parameters):
+ """Return the page containing the status of the io/power plug identified
+ by the index"""
+ return send_request(index, parameters["status_path"], "", parameters)
+
+def status(key, parameters):
+ """Return the status of the io/power plug identified by key"""
+ (index, subindex) = key
+ page = statuses_page(index, parameters)
+ return status_aux(page, subindex, parameters)
+
+def indexes(parameters):
+ """Return a list containing the index of each power strip or group of
+ io's"""
+ return parameters["config"].keys()
+
+def subindexes(parameters):
+ """Return a list containing the index of each power strip or group of
+ io's"""
+ return range(1, parameters["size"] + 1)
+
+def switch_off_all(parameters):
+ """Switch off all io's/power plugs"""
+ target = parameters["target"]
+ print "Switch off each", target, "...{"
+ for index in indexes(parameters):
+ switch("off", (index, subindexes(parameters)), parameters)
+ print "}"
diff --git a/validation/validlib/attenuator.py b/validation/validlib/attenuator.py
new file mode 100644
index 0000000000..d92eaad728
--- /dev/null
+++ b/validation/validlib/attenuator.py
@@ -0,0 +1,106 @@
+# -*- coding: utf-8 -*-
+
+"""Module allowing to command an attenuator"""
+
+import os
+
+config = [
+ #Name of the attenuator used by the GPIB driver
+ "Attenuator",
+ #List of the buttons with their attenuations
+ {1:1, 2:2, 3:4, 4:4, 5:10, 6:20, 7:40, 8:0}
+ ]
+
+#List of the possible attenuations, computed from the config,
+#with the corresponding arguments passed to gpib_control
+attenuation_arguments = None
+
+def init():
+ """Compute the possible attenuations of the attenuator"""
+ global attenuation_arguments
+ attenuation_arguments = get_commands(config[1])
+
+def set_attenuation(attenuation):
+ """Set the attenuation in dB"""
+ if attenuation_arguments is None:
+ init()
+ command = "gpib_control " + config[0] + " " + \
+ attenuation_arguments[attenuation]
+ return os.popen(command).read()
+
+##############################################################################
+# Internal functions
+##############################################################################
+
+def get_commands(buttons):
+ """Return a dictionary with all possible attenuations"""
+ combinations = get_combinations(buttons.keys())
+ commands = dict()
+ for combination in combinations:
+ (attenuation, command) = translate(combination, buttons)
+ commands[attenuation] = command
+ return commands
+
+def get_combinations(keys):
+ """Return all possible combinations obtained with the keys"""
+ acc = [[]]
+ for key in keys:
+ new_acc = []
+ for elem in acc:
+ new_acc.append(elem + [key])
+ acc.extend(new_acc)
+ return acc
+
+def translate(combination, buttons):
+ """Translate a combination of buttons in an attenuation
+ and a command"""
+ keys = buttons.keys()
+ string_a = ""
+ attenuation = 0
+ for key in combination:
+ string_a = string_a + str(key)
+ attenuation = attenuation + buttons[key]
+ keys.remove(key)
+ string_b = ""
+ for key in keys:
+ string_b = string_b + str(key)
+ string = ""
+ if string_a != "":
+ string = string + "A" + string_a
+ if string_b != "":
+ string = string + "B" + string_b
+ return (attenuation, string)
+
+if __name__ == "__main__":
+
+ def test_get_combinations():
+ assert get_combinations([]) == [[]]
+ assert get_combinations([1]) == [[], [1]]
+ assert get_combinations([1, 2]) == [[], [1], [2], [1, 2]]
+ assert get_combinations([1, 2, 3]) == [[], [1], [2], [1, 2], [3],
+ [1, 3], [2, 3], [1, 2, 3]]
+
+ def test_translate():
+ attenuations = {1:1, 2:2, 3:4}
+ assert translate([], attenuations) == (0, "B123")
+ assert translate([1], attenuations) == (1, "A1B23")
+ assert translate([2], attenuations) == (2, "A2B13")
+ assert translate([1, 2], attenuations) == (3, "A12B3")
+ assert translate([1, 2, 3], attenuations) == (7, "A123")
+
+ def test_get_commands():
+ assert get_commands({}) == {0: ''}
+ assert get_commands({1:1}) == {0: 'B1', 1: 'A1'}
+ assert get_commands({1:1, 2:2}) == {0: 'B12', 1: 'A1B2', 2: 'A2B1',
+ 3: 'A12'}
+ assert get_commands({1:1, 2:2, 3:4, 4:4}) == {0: 'B1234', 1: 'A1B234',
+ 2: 'A2B134', 3: 'A12B34',
+ 4: 'A4B123', 5: 'A14B23',
+ 6: 'A24B13', 7: 'A124B3',
+ 8: 'A34B12', 9: 'A134B2',
+ 10: 'A234B1', 11: 'A1234'}
+
+ print "Executing unit tests of", __file__, "..."
+ test_get_combinations()
+ test_translate()
+ test_get_commands()
diff --git a/validation/validlib/io_group.py b/validation/validlib/io_group.py
new file mode 100644
index 0000000000..0940775ff5
--- /dev/null
+++ b/validation/validlib/io_group.py
@@ -0,0 +1,43 @@
+# -*- coding: utf-8 -*-
+
+"""Module allowing to command and control the Anel io's"""
+
+import anellib
+
+config = {
+ #key: (IP adress, login, password)
+ 1: ("192.168.0.13", "admin", "anel")
+ }
+
+def parameters():
+ """Parameters specific to the command and control of the Anel io's"""
+ return {
+ "target":"io",
+ "switch_path":"/io.htm",
+ "status_path":"/io.htm",
+ "body":"n0=IO-1&e0=0&n1=IO-2&e1=0&n2=IO-3&e2=0&n3=IO-4&e3=0&" \
+ "n4=IO-5&e4=0&n5=IO-6&e5=0&n6=IO-7&e6=0&n7=IO-8&e7=0",
+ "letter":"E",
+ "config":config,
+ "size":8
+ }
+
+def switch(command, keys):
+ """Switch on/off of the io's specified by the keys"""
+ return anellib.switch(command, keys, parameters())
+
+def status(key):
+ """Return the status on/off of the io's specified by the keys"""
+ return anellib.status(key, parameters())
+
+def indexes():
+ """Return a list containing the index of each group of io's"""
+ return anellib.indexes(parameters())
+
+def subindexes():
+ """Return a list containing the index of each io in a group of io's"""
+ return anellib.subindexes(parameters())
+
+def switch_off_all():
+ """Switch off all io's"""
+ return anellib.switch_off_all(parameters())
diff --git a/validation/validlib/link.py b/validation/validlib/link.py
new file mode 100644
index 0000000000..6c22e9dc72
--- /dev/null
+++ b/validation/validlib/link.py
@@ -0,0 +1,36 @@
+# -*- coding: utf-8 -*-
+
+"""Module allowing to command and control a switch,
+which consists in an electrical switch located between two power plugs"""
+
+import power_strip
+import io_group
+import time
+
+config = {
+ #key: (key on the first power strip,
+ # key on the second power strip,
+ # key on the io group
+ # )
+ 1: ((1, 4), (2, 4), (1, 1))
+ }
+
+def attach(key):
+ """Attach the link identified by key"""
+ print "Attaching the power strips...{"
+ execute(key, "on", 3)
+ print "}"
+
+def detach(key):
+ """Detach the link identified by key"""
+ print "Detaching the power strips...{"
+ execute(key, "off", 0)
+ print "}"
+
+def execute(key, command, duration):
+ """Attach or detach a link"""
+ (power_strip_key_1, power_strip_key_2, io_group_key) = config[key]
+ power_strip.switch(command, power_strip_key_1),
+ power_strip.switch(command, power_strip_key_2),
+ io_group.switch(command, io_group_key)
+ time.sleep(duration)#To let the time to the AVLN to be reorganized
diff --git a/validation/validlib/power_strip.py b/validation/validlib/power_strip.py
new file mode 100644
index 0000000000..946ba5049b
--- /dev/null
+++ b/validation/validlib/power_strip.py
@@ -0,0 +1,44 @@
+# -*- coding: utf-8 -*-
+
+"""Module allowing to command and control the Anel power plugs"""
+
+import anellib
+
+config = {
+ #key: (IP adress, login, password)
+ 1: ("192.168.0.11", "admin", "anel"),
+ 2: ("192.168.0.13", "admin", "anel")
+ }
+
+def parameters():
+ """Parameters specific to the command and control of the Anel power plugs"""
+ return {
+ "target":"power plug",
+ "switch_path":"/ctrl.htm",
+ "status_path":"/mobile.htm",
+ "body":"x=10",
+ "letter":"F",
+ "config":config,
+ "size":8
+ }
+
+def switch(command, keys):
+ """Switch on/off of the power plugs specified by the keys"""
+ return anellib.switch(command, keys, parameters())
+
+def status(key):
+ """Return the status on/off of the power plugs specified by the keys"""
+ return anellib.status(key, parameters())
+
+def indexes():
+ """Return a list containing the index of each power strip"""
+ return anellib.indexes(parameters())
+
+def subindexes():
+ """Return a list containing the index of each power plug in a power strip"""
+ return anellib.subindexes(parameters())
+
+def switch_off_all():
+ """Switch off all power plugs"""
+ return anellib.switch_off_all(parameters())
+
diff --git a/validation/validlib/spc300.py b/validation/validlib/spc300.py
new file mode 100644
index 0000000000..97dda939f4
--- /dev/null
+++ b/validation/validlib/spc300.py
@@ -0,0 +1,144 @@
+# -*- coding: utf-8 -*-
+
+"""Module allowing to command and control the plug SPC300"""
+
+import telnetlib
+import power_strip
+import os
+
+config = {
+ "eth_netmask": "10.3.6.",
+ "plc_netmask": "10.4.6.",
+ "plugs":
+ {
+ #(Power strip index, Power strip subindex):(br0 address,
+ # eth0 address,
+ # plc0 address
+ # )
+ (1, 1): ("147", "146", "148"),
+ (1, 2): ("139", "138", "140"),
+ (2, 1): ("136", "135", "137"),
+ (2, 2): ("145", "144", "146")
+ }
+ }
+
+def r_ping(key_origin, key_destination):
+ """Ping the plug identified by key_destination from the plug identified by
+ key_origin"""
+ origin_network = config["eth_netmask"]
+ origin = origin_network + config["plugs"][key_origin][1]
+ destination_network = config["plc_netmask"]
+ destination = destination_network + config["plugs"][key_destination][2]
+ command = ping_command(destination)
+ response = r_execute(origin, command)
+ return ping(response)
+
+def switch_on(key):
+ """Switch on the plug identified by key"""
+ print "Starting the plug", key, "...{"
+ power_strip.switch("off", key)
+ power_strip.switch("on", key)
+ assert slow_ping(key, 0)[0] == "pong"
+ (address_0, address_1, address_2) = config["plugs"][key]
+ address_0 = config["eth_netmask"] + address_0
+ address_1 = config["eth_netmask"] + address_1
+ address_2 = config["plc_netmask"] + address_2
+ print "Activate the new address of eth0 of the plug" , key
+ r_execute(address_0, "ifconfig eth0 " + address_1)
+ print "Deactivate the address of br0 of the plug" , key
+ r_execute(address_1, "ifdown br0")
+ print "Activate the new address of plc0 of the plug" , key
+ r_execute(address_1, "ifconfig plc0 " + address_2)
+ print "Set the new route for eth0 on the plug", key
+ r_execute(address_1, "route add -net " + config["eth_netmask"] +
+ "0 netmask 255.255.255.0 dev eth0")
+ print "Set the new route for plc0 on the plug", key
+ r_execute(address_1, "route add -net " + config["plc_netmask"] +
+ "0 netmask 255.255.255.0 dev plc0")
+ assert l_ping(key, 0) == "pang"
+ assert l_ping(key, 1) == "pong"
+ assert l_ping(key, 2) == "pang"
+ print"OK: the plug", key, "has been successfully started"
+ print "}"
+
+def change_nmk(key, new_nmk):
+ """Change the NMK of the plug identified by key"""
+ print "Changing the NMK on the plug", key, "...{"
+ network = config["eth_netmask"]
+ host = network + config["plugs"][key][1]
+ command = "spidapp config -npw " + new_nmk
+ response = r_execute(host, command)
+ assert "NMK: updated" in response, response
+ print"OK: the NMK has been successfully changed on the plug", key
+ print "}"
+
+def role(key):
+ """Return the role of the plug identified by key in its AVLN: UCCO, USTA,
+ CCO or STA"""
+ network = config["eth_netmask"]
+ command = "cat /etc/hpav.info"
+ host = network + config["plugs"][key][1]
+ hpav_info = r_execute(host, command)
+ if "CCO \= main" in hpav_info:
+ cco = "station"
+ else:
+ cco = "main"
+ if "STATUS \= unassociated" in hpav_info:
+ status = "associated"
+ else:
+ status = "unassociated"
+ dictionnary = {("main", "associated"): "CCO",
+ ("main", "unassociated"): "UCCO",
+ ("station", "associated"): "STA",
+ ("station", "unassociated"): "USTA"}
+ return dictionnary[(cco, status)]
+
+################################################################################
+# Internal functions
+################################################################################
+
+def r_execute(host, command):
+ """Telnet the host and execute a command on it"""
+ telnet = telnetlib.Telnet(host)
+ telnet.read_until("login: ")
+ telnet.write("root\n")
+ telnet.write(command + "\n")
+ telnet.write("exit\n")
+ result = telnet.read_all()
+ return result
+
+def l_ping(key, interface_index):
+ """Ping the plug identified by key, using the address specified by the
+ interface_index (0 means br0, 1 means eth0 and 2 means plc0)"""
+ if interface_index == 2:
+ mask = "plc_netmask"
+ else:
+ mask = "eth_netmask"
+ destination = config[mask] + config["plugs"][key][interface_index]
+ command = ping_command(destination)
+ response = os.popen(command).read()
+ return ping(response)
+
+def ping(response):
+ """Return pong if the ping succeeded and pand otherwise"""
+ if "ttl" in response:
+ result = "pong"
+ else:
+ result = "pang"
+ return result
+
+def ping_command(destination):
+ """Ping the IP address destination"""
+ return "ping -c1 -W1 " + destination
+
+def slow_ping(key, interface_index):
+ """Ping the plug identified by key using the address specified by the
+ interface_index (0 means br0, 1 means eth0 and 2 means plc0).
+ One tries 40 times to let the time to the plug to start up."""
+ n = 0
+ result = "pang"
+ while (n < 40 and result == "pang"):
+ print "Attempt #", n, "to ping the address", (key, interface_index)
+ result = l_ping(key, interface_index)
+ n = n + 1
+ return (result, n)