Adding ICN PlanetLab large experiment scenarios
[nepi.git] / misc / nepi_fdnetdev.patch
1 diff -r f860e2eac903 src/nepi/testbeds/ns3/connection_metadata.py
2 --- a/src/nepi/testbeds/ns3/connection_metadata.py      Wed Aug 15 18:22:33 2012 +0200
3 +++ b/src/nepi/testbeds/ns3/connection_metadata.py      Thu Aug 16 19:02:36 2012 +0200
4 @@ -121,7 +121,34 @@
5          (fd, msg) = passfd.recvfd(sock)
6          # Store a reference to the endpoint to keep the socket alive
7          fdnd.SetFileDescriptor(fd)
8 -    
9 +
10 +        try:
11 +            import fcntl
12 +            import struct
13 +            TUNGETIFF = 0x800454d2
14 +            IFF_NO_PI = 0x00001000
15 +            IFF_TUN = 0x00000001
16 +            IFF_TAP = 0x00000002
17 +            struct_ifreq = "x"*16+"H"+"x"*22
18 +            
19 +            (flags, ) = struct.unpack(struct_ifreq,
20 +                    fcntl.ioctl(fd, TUNGETIFF, struct.pack(struct_ifreq, 0)))
21 +
22 +            with_pi = (0 == (flags & IFF_NO_PI))
23 +            is_tap = (0 == (flags & IFF_TUN))
24 +
25 +            if is_tap and with_pi:
26 +                fdnd.SetEncapsulationMode(fdnd.DIXPI)
27 +            elif not is_tap and with_pi:
28 +                fdnd.SetEncapsulationMode(fdnd.PI)
29 +        except:
30 +            # maybe the kernel doesn't support the IOCTL,
31 +            # in which case, we assume it uses PI headers (as is usual)
32 +            pass
33 +
34 +            #import traceback
35 +            #err = traceback.format_exc()
36 +
37      import threading
38      import passfd
39      import socket
40 diff -r f860e2eac903 src/nepi/testbeds/ns3/ns3_bindings_import.py
41 --- a/src/nepi/testbeds/ns3/ns3_bindings_import.py      Wed Aug 15 18:22:33 2012 +0200
42 +++ b/src/nepi/testbeds/ns3/ns3_bindings_import.py      Thu Aug 16 19:02:36 2012 +0200
43 @@ -16,7 +16,7 @@
44  #from ns.click import *
45  from ns.mobility import *
46  from ns.wifi import *
47 -from ns.netanim import *
48 +#from ns.netanim import *
49  from ns.stats import *
50  from ns.uan import *
51  from ns.spectrum import *
52 diff -r f860e2eac903 src/nepi/testbeds/planetlab/application.py
53 --- a/src/nepi/testbeds/planetlab/application.py        Wed Aug 15 18:22:33 2012 +0200
54 +++ b/src/nepi/testbeds/planetlab/application.py        Thu Aug 16 19:02:36 2012 +0200
55 @@ -907,10 +907,12 @@
56          # We have to download the sources, untar, build...
57          #pygccxml_source_url = "http://leaseweb.dl.sourceforge.net/project/pygccxml/pygccxml/pygccxml-1.0/pygccxml-1.0.0.zip"
58          pygccxml_source_url = "http://yans.pl.sophia.inria.fr/libs/pygccxml-1.0.0.zip"
59 -        ns3_source_url = "http://nepi.inria.fr/code/nepi-ns3.13/archive/tip.tar.gz"
60 +        #ns3_source_url = "http://nepi.inria.fr/code/nepi-ns3.13/archive/tip.tar.gz"
61 +        ns3_source_url = "http://nepi.inria.fr/code/nepi-ns3.fdnetdev/archive/tip.tar.gz"
62          passfd_source_url = "http://nepi.inria.fr/code/python-passfd/archive/tip.tar.gz"
63          
64 -        pybindgen_version = "797"
65 +        #pybindgen_version = "797"
66 +        pybindgen_version = "809"
67  
68          self.build =(
69              " ( "
70 @@ -927,21 +929,21 @@
71                       "echo '7158877faff2254e6c094bf18e6b4283cac19137  pygccxml-1.0.0.zip' > archive_sums.txt && "
72                       " ( " # check existing files
73                       " sha1sum -c archive_sums.txt && "
74 -                     " test -f passfd-src.tar.gz && "
75 +                     " test -f passfd.tar.gz && "
76                       " test -f ns3-src.tar.gz "
77                       " ) || ( " # nope? re-download
78 -                     " rm -rf pybindgen pygccxml-1.0.0.zip passfd-src.tar.gz ns3-src.tar.gz && "
79 +                     " rm -rf pybindgen pygccxml-1.0.0.zip passfd.tar.gz ns3-src.tar.gz && "
80                       " bzr checkout lp:pybindgen -r %(pybindgen_version)s && " # continue, to exploit the case when it has already been dl'ed
81                       " wget -q -c -O pygccxml-1.0.0.zip %(pygccxml_source_url)s && " 
82 -                     " wget -q -c -O passfd-src.tar.gz %(passfd_source_url)s && "
83 +                     " wget -q -c -O passfd.tar.gz %(passfd_source_url)s && "
84                       " wget -q -c -O ns3-src.tar.gz %(ns3_source_url)s && "  
85                       " sha1sum -c archive_sums.txt " # Check SHA1 sums when applicable
86                       " ) && "
87                       "unzip -n pygccxml-1.0.0.zip && "
88                       "mkdir -p ns3-src && "
89 -                     "mkdir -p passfd-src && "
90 +                     "mkdir -p passfd && "
91                       "tar xzf ns3-src.tar.gz --strip-components=1 -C ns3-src && "
92 -                     "tar xzf passfd-src.tar.gz --strip-components=1 -C passfd-src && "
93 +                     "tar xzf passfd.tar.gz --strip-components=1 -C passfd && "
94                       "rm -rf target && "    # mv doesn't like unclean targets
95                       "mkdir -p target && "
96                       "cd pygccxml-1.0.0 && "
97 @@ -957,12 +959,12 @@
98                       "./waf clean && "
99                       "mv -f ${BUILD}/target/lib/python*/site-packages/pybindgen ${BUILD}/target/. && "
100                       "rm -rf ${BUILD}/target/lib && "
101 -                     "cd ../passfd-src && "
102 +                     "cd ../passfd && "
103                       "python setup.py build && "
104                       "python setup.py install --install-lib ${BUILD}/target && "
105                       "python setup.py clean && "
106                       "cd ../ns3-src && "
107 -                     "./waf configure --prefix=${BUILD}/target --with-pybindgen=../pybindgen-src -d release --disable-examples --disable-tests && "
108 +                     "./waf configure --prefix=${BUILD}/target --with-pybindgen=../pybindgen -d release --disable-examples --disable-tests && "
109                       "./waf &&"
110                       "./waf install && "
111                       "rm -f ${BUILD}/target/lib/*.so && "