summaryrefslogtreecommitdiff
path: root/cesar/cp/test_maximus/src/Maximus.py
diff options
context:
space:
mode:
Diffstat (limited to 'cesar/cp/test_maximus/src/Maximus.py')
-rw-r--r--cesar/cp/test_maximus/src/Maximus.py198
1 files changed, 198 insertions, 0 deletions
diff --git a/cesar/cp/test_maximus/src/Maximus.py b/cesar/cp/test_maximus/src/Maximus.py
new file mode 100644
index 0000000000..b0d38855a7
--- /dev/null
+++ b/cesar/cp/test_maximus/src/Maximus.py
@@ -0,0 +1,198 @@
+#!/usr/bin/env python
+
+import sys
+sys.path.append('../../maximus/python/obj');
+sys.path.append('../../maximus/python/');
+
+from interface import *
+from maximus import *
+from struct import *
+
+def my_eth_filter(eth):
+ try:
+ eth.get_type()
+ return True
+ except:
+ return False
+
+maximus = Maximus()
+maximus.init (sys.argv)
+
+# TEI of station 1 will be 1
+station1 = maximus.create_sta()
+#station1.debug()
+
+## TEI of station 2 will be 2
+#station2 = maximus.create_sta()
+##station2.debug()
+
+#fc1 = maximus.create_fcall ("fc_station_init_config")
+#fc1.set_sta (station1)
+#fc1.add_param_ushort ("snid", 1)
+#fc1.add_param_ushort ("tei", 1)
+#fc1.add_param_ushort ("auto", 1)
+#fc1.send()
+
+#fc2 = maximus.create_fcall ("fc_station_init_config")
+#fc2.set_sta (station2)
+#fc2.add_param_ushort ("snid", 1)
+#fc2.add_param_ushort ("tei", 2)
+#fc2.add_param_ushort ("auto", 1)
+#fc2.send()
+
+##neighbour discovery
+#fc1 = maximus.create_fcall ("fc_station_discover")
+#fc1.set_sta (station1)
+#fc1.add_param_ushort ("qte", 1)
+#fc1.add_param_ushort ("tei0", 2)
+#param = pack ('Q', 0x123456789abc)[0:6]
+#fc1.add_param ("mac0", param)
+#fc1.send()
+
+#fc2 = maximus.create_fcall ("fc_station_discover")
+#fc2.set_sta (station2)
+#fc2.add_param_ushort ("qte", 1)
+#fc2.add_param_ushort ("tei0", 1)
+#param = pack ('Q', 0x23456789abcd)[0:6]
+#fc2.add_param ("mac0", param)
+#fc2.send()
+
+#fc1 = maximus.create_fcall ("fc_station_link_add")
+#fc1.set_sta (station1)
+#fc1.add_param_ushort ("type", 1)
+#fc1.add_param_ushort ("bcast", 0)
+#fc1.add_param_ushort ("mme", 0)
+#fc1.add_param_ushort ("lid", 1)
+#fc1.add_param_ushort ("tei", 2)
+#fc1.send()
+
+#fc1 = maximus.create_fcall ("fc_station_link_add")
+#fc1.set_sta (station1)
+#fc1.add_param_ushort ("type", 1)
+#fc1.add_param_ushort ("bcast", 0)
+#fc1.add_param_ushort ("mme", 1)
+#fc1.add_param_ushort ("lid", 248)
+#fc1.add_param_ushort ("tei", 2)
+#fc1.send()
+
+#fc2 = maximus.create_fcall ("fc_station_link_add")
+#fc2.set_sta (station2)
+#fc2.add_param_ushort ("type", 0)
+#fc2.add_param_ushort ("bcast", 0)
+#fc2.add_param_ushort ("mme", 0)
+#fc2.add_param_ushort ("lid", 1)
+#fc2.add_param_ushort ("tei", 1)
+#fc2.send()
+
+#fc2 = maximus.create_fcall ("fc_station_link_add")
+#fc2.set_sta (station2)
+#fc2.add_param_ushort ("type", 0)
+#fc2.add_param_ushort ("bcast", 0)
+#fc2.add_param_ushort ("mme", 1)
+#fc2.add_param_ushort ("lid", 248)
+#fc2.add_param_ushort ("tei", 1)
+#fc2.send()
+
+## Add a buffer to the SAR
+#alloc_data_buffer (maximus, station2)
+
+##sends three buffers to the station 2
+#alloc_data_buffer (maximus, station2)
+#alloc_data_buffer (maximus, station2)
+#alloc_data_buffer (maximus, station2)
+
+##create three Ethernet Packets
+
+
+## read the ethernet full packet
+#packet_file = open ('../packet_max','r')
+#packet = packet_file.read()
+
+##first ethernet pack of 1500 bytes.
+#pack1 = packet
+
+##second one 424 bytes of length
+#pack2 = packet[0:423]
+
+##third one 1240 bytes
+#pack3 = packet[0:1239]
+
+##First one
+#frame0 = Eth()
+#frame0.src = '23:45:67:89:ab:cd'
+#frame0.dst = '12:34:56:78:9a:bc'
+#frame0.vlantag = 0x4D4E4F50
+#frame0.type = 0x5152
+#frame0.payload = pack1
+#frame0.send (maximus, station1)
+
+##Second frame
+#frame1 = Eth()
+#frame1.src = '23:45:67:89:ab:cd'
+#frame1.dst = '12:34:56:78:9a:bc'
+#frame1.vlantag = 0x4D4E4F50
+#frame1.type = 0x5152
+#frame1.payload = pack2;
+#frame1.send (maximus, station1)
+
+##third frame
+#frame2 = Eth()
+#frame2.src = '23:45:67:89:ab:cd'
+#frame2.dst = '12:34:56:78:9a:bc'
+#frame2.vlantag = 0x4D4E4F50
+#frame2.type = 0x5152
+#frame2.payload = pack3;
+#frame2.send (maximus, station1)
+
+##Catch the ethernet packets
+#rsp = recv(maximus, count=3, filter=my_eth_filter)
+
+#if (rsp[0].dst != frame0.dst) and (rsp[0].src != frame0.src) and (rsp[0].vlantag != frame0.vlantag) and (rsp[0].type != frame0.type):
+ #print "Frame0 dst dont correspond with the dst mac address of the frame"
+#else:
+ #if frame0.payload != rsp[0].payload:
+ #print "Error the frame 0 payload is deferent from the received one"
+
+maximus.wait (500000000)
+#while not station1.is_idle() and not station2.is_idle():
+ #maximus.wait (10000)
+
+#print the traces of the HLE
+print "\n\n ************** Station 1 Traces *******************\n"
+fc1 = maximus.create_fcall ("fc_hle_print_trace")
+fc1.set_sta (station1)
+fc1.send()
+
+print ""
+fc1 = maximus.create_fcall ("fc_cl_print_trace")
+fc1.set_sta (station1)
+fc1.send()
+
+print ""
+fc1 = maximus.create_fcall ("fc_sar_print_trace")
+fc1.set_sta (station1)
+fc1.send()
+
+print "\n\n ************ Station 1 Traces END ******************\n"
+
+station1.remove()
+
+##print the traces of the HLE
+#print "\n\n ************** Station 2 Traces *******************\n"
+#fc1 = maximus.create_fcall ("fc_hle_print_trace")
+#fc1.set_sta (station2)
+#fc1.send()
+
+#print ""
+#fc1 = maximus.create_fcall ("fc_cl_print_trace")
+#fc1.set_sta (station2)
+#fc1.send()
+
+#print ""
+#fc1 = maximus.create_fcall ("fc_sar_print_trace")
+#fc1.set_sta (station2)
+#fc1.send()
+
+#print "\n\n ************ Station 2 Traces END ******************\n"
+
+#station2.remove()