trema 0.3.16 → 0.3.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.gitignore +1 -0
- data/.rvmrc +52 -0
- data/.travis.yml +3 -0
- data/Gemfile +1 -1
- data/Rakefile +259 -1
- data/Rantfile +79 -216
- data/features/.nav +12 -0
- data/features/dsl/switch_port_specifier.feature +15 -0
- data/features/examples/switch-event/C-add_forward_entry.feature +130 -0
- data/features/examples/switch-event/C-delete_forward_entry.feature +97 -0
- data/features/examples/switch-event/C-dump_forward_entries.feature +80 -0
- data/features/examples/switch-event/C-set_forward_entries.feature +85 -0
- data/features/examples/switch-event/README.md +40 -0
- data/features/examples/switch-event/add_forward_entry.feature +142 -0
- data/features/examples/switch-event/delete_forward_entry.feature +142 -0
- data/features/examples/switch-event/dump_forward_entries.feature +91 -0
- data/features/examples/switch-event/set_forward_entries.feature +90 -0
- data/features/support/hooks.rb +1 -0
- data/ruby/rake/c/dependency.rb +42 -0
- data/ruby/rake/c/library-task.rb +142 -0
- data/ruby/rake/c/shared-library-task.rb +38 -0
- data/ruby/rake/c/static-library-task.rb +32 -0
- data/ruby/trema/path.rb +1 -0
- data/ruby/trema/switch-event.c +647 -0
- data/{src/switch_manager/management_interface.h → ruby/trema/switch-event.h} +7 -21
- data/ruby/trema/trema.c +2 -0
- data/ruby/trema/version.rb +1 -1
- data/spec/spec_helper.rb +26 -2
- data/src/examples/switch_event_config/.gitignore +7 -0
- data/src/examples/switch_event_config/add_forward_entry.c +227 -0
- data/src/examples/switch_event_config/delete_forward_entry.c +226 -0
- data/src/examples/switch_event_config/dump_forward_entries.c +190 -0
- data/src/examples/switch_event_config/set_forward_entries.c +210 -0
- data/src/lib/event_forward_interface.c +783 -0
- data/src/lib/event_forward_interface.h +138 -0
- data/src/lib/trema.h +1 -0
- data/src/lib/utility.c +13 -1
- data/src/lib/utility.h +3 -0
- data/src/switch_manager/event_forward_entry_manipulation.c +120 -0
- data/src/switch_manager/event_forward_entry_manipulation.h +31 -0
- data/src/switch_manager/secure_channel_listener.c +23 -3
- data/src/switch_manager/switch.c +99 -29
- data/src/switch_manager/switch_manager.c +176 -3
- data/src/switch_manager/switch_manager.h +4 -0
- data/src/switch_manager/switch_option.c +30 -0
- data/src/switch_manager/switch_option.h +41 -0
- data/trema.gemspec +2 -1
- data/unittests/lib/event_forward_interface_test.c +1646 -0
- data/unittests/lib/utility_test.c +23 -1
- metadata +48 -10
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- 
         | 
| 2 | 
            -
            SHA512: 
         | 
| 3 | 
            -
              data.tar.gz: d3850c53230afbfcb3d7a8782c86f462ed944e9ab7be2147b8ba4eafb0d5156a6ec1bca29d82b05bd14031cc10efb08eedbb0f04ac4263203d0d275101fbec78
         | 
| 4 | 
            -
              metadata.gz: 13dfcef0ae4245fc63c35cb32379431e8d71f92a455d349ed63d3307ab8ee7c34734a54537a9e9749ca7bd3b6b2bdf4b186257c3d4f8198552e31e5961c04ab1
         | 
| 5 2 | 
             
            SHA1: 
         | 
| 6 | 
            -
               | 
| 7 | 
            -
               | 
| 3 | 
            +
              metadata.gz: 7fd5b47d45e7a0338002ebdb7c4a773cb38adad6
         | 
| 4 | 
            +
              data.tar.gz: 6394df3370fdea2695913e11c1ff935ca32c049e
         | 
| 5 | 
            +
            SHA512: 
         | 
| 6 | 
            +
              metadata.gz: b8f264d3ce3d2b393f07ec9f53df77dad75532813b25901e3c74c452d6d7c9c0995bfb3773b59e851f16a192a1a5373d6dbdd0a6525d745e824dac06fe02634c
         | 
| 7 | 
            +
              data.tar.gz: 1df9b3476330bad7da63ddc19f0a787f8cf94106be78bc57b7ade172d93f6908adf2cc2561aacb88a6a28045f82f19b0789ce8c83bbca007823eb90ccdda3608
         | 
    
        data/.gitignore
    CHANGED
    
    
    
        data/.rvmrc
    ADDED
    
    | @@ -0,0 +1,52 @@ | |
| 1 | 
            +
            #!/usr/bin/env bash
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            # This is an RVM Project .rvmrc file, used to automatically load the ruby
         | 
| 4 | 
            +
            # development environment upon cd'ing into the directory
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            # First we specify our desired <ruby>[@<gemset>], the @gemset name is optional,
         | 
| 7 | 
            +
            # Only full ruby name is supported here, for short names use:
         | 
| 8 | 
            +
            #     echo "rvm use 1.8.7" > .rvmrc
         | 
| 9 | 
            +
            environment_id="ruby-1.8.7-p371"
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            # Uncomment the following lines if you want to verify rvm version per project
         | 
| 12 | 
            +
            # rvmrc_rvm_version="1.18.6 (stable)" # 1.10.1 seams as a safe start
         | 
| 13 | 
            +
            # eval "$(echo ${rvm_version}.${rvmrc_rvm_version} | awk -F. '{print "[[ "$1*65536+$2*256+$3" -ge "$4*65536+$5*256+$6" ]]"}' )" || {
         | 
| 14 | 
            +
            #   echo "This .rvmrc file requires at least RVM ${rvmrc_rvm_version}, aborting loading."
         | 
| 15 | 
            +
            #   return 1
         | 
| 16 | 
            +
            # }
         | 
| 17 | 
            +
             | 
| 18 | 
            +
            # First we attempt to load the desired environment directly from the environment
         | 
| 19 | 
            +
            # file. This is very fast and efficient compared to running through the entire
         | 
| 20 | 
            +
            # CLI and selector. If you want feedback on which environment was used then
         | 
| 21 | 
            +
            # insert the word 'use' after --create as this triggers verbose mode.
         | 
| 22 | 
            +
            if [[ -d "${rvm_path:-$HOME/.rvm}/environments"
         | 
| 23 | 
            +
              && -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
         | 
| 24 | 
            +
            then
         | 
| 25 | 
            +
              \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
         | 
| 26 | 
            +
              [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]] &&
         | 
| 27 | 
            +
                \. "${rvm_path:-$HOME/.rvm}/hooks/after_use" || true
         | 
| 28 | 
            +
              if [[ $- == *i* ]] # check for interactive shells
         | 
| 29 | 
            +
              then echo "Using: $(tput setaf 2)$GEM_HOME$(tput sgr0)" # show the user the ruby and gemset they are using in green
         | 
| 30 | 
            +
              else echo "Using: $GEM_HOME" # don't use colors in non-interactive shells
         | 
| 31 | 
            +
              fi
         | 
| 32 | 
            +
            else
         | 
| 33 | 
            +
              # If the environment file has not yet been created, use the RVM CLI to select.
         | 
| 34 | 
            +
              rvm --create use  "$environment_id" || {
         | 
| 35 | 
            +
                echo "Failed to create RVM environment '${environment_id}'."
         | 
| 36 | 
            +
                return 1
         | 
| 37 | 
            +
              }
         | 
| 38 | 
            +
            fi
         | 
| 39 | 
            +
             | 
| 40 | 
            +
            # If you use bundler, this might be useful to you:
         | 
| 41 | 
            +
            # if [[ -s Gemfile ]] && {
         | 
| 42 | 
            +
            #   ! builtin command -v bundle >/dev/null ||
         | 
| 43 | 
            +
            #   builtin command -v bundle | GREP_OPTIONS= \grep $rvm_path/bin/bundle >/dev/null
         | 
| 44 | 
            +
            # }
         | 
| 45 | 
            +
            # then
         | 
| 46 | 
            +
            #   printf "%b" "The rubygem 'bundler' is not installed. Installing it now.\n"
         | 
| 47 | 
            +
            #   gem install bundler
         | 
| 48 | 
            +
            # fi
         | 
| 49 | 
            +
            # if [[ -s Gemfile ]] && builtin command -v bundle >/dev/null
         | 
| 50 | 
            +
            # then
         | 
| 51 | 
            +
            #   bundle install | GREP_OPTIONS= \grep -vE '^Using|Your bundle is complete'
         | 
| 52 | 
            +
            # fi
         | 
    
        data/.travis.yml
    CHANGED
    
    
    
        data/Gemfile
    CHANGED
    
    | @@ -14,7 +14,7 @@ gemspec | |
| 14 14 | 
             
            # Include everything needed to run rake, tests, features, etc.
         | 
| 15 15 | 
             
            group :development do
         | 
| 16 16 | 
             
              gem "aruba", "~> 0.5.1"
         | 
| 17 | 
            -
              gem "cucumber", "~> 1.2. | 
| 17 | 
            +
              gem "cucumber", "~> 1.2.3"
         | 
| 18 18 | 
             
              gem "flay", "~> 2.1.0"
         | 
| 19 19 | 
             
              gem "flog", "~> 3.2.2"
         | 
| 20 20 | 
             
              gem "rcov", "~> 1.0.0"
         | 
    
        data/Rakefile
    CHANGED
    
    | @@ -21,8 +21,10 @@ $LOAD_PATH.unshift( File.expand_path( File.dirname( __FILE__ ) + "/ruby" ) ) | |
| 21 21 |  | 
| 22 22 | 
             
            require "rubygems"
         | 
| 23 23 | 
             
            require "rake"
         | 
| 24 | 
            +
            require "trema/executables"
         | 
| 24 25 | 
             
            require "trema/path"
         | 
| 25 26 |  | 
| 27 | 
            +
             | 
| 26 28 | 
             
            task :default => :build_trema
         | 
| 27 29 |  | 
| 28 30 | 
             
            directory Trema.log
         | 
| @@ -35,6 +37,262 @@ task :build_trema => [ Trema.log, Trema.pid, Trema.sock ] do | |
| 35 37 | 
             
            end
         | 
| 36 38 |  | 
| 37 39 |  | 
| 40 | 
            +
            ################################################################################
         | 
| 41 | 
            +
            # Build libtrema.{a,so}
         | 
| 42 | 
            +
            ################################################################################
         | 
| 43 | 
            +
             | 
| 44 | 
            +
            require "rake/c/library-task"
         | 
| 45 | 
            +
            require "trema/version"
         | 
| 46 | 
            +
             | 
| 47 | 
            +
             | 
| 48 | 
            +
            CFLAGS = [
         | 
| 49 | 
            +
              "-g",
         | 
| 50 | 
            +
              "-std=gnu99",
         | 
| 51 | 
            +
              "-D_GNU_SOURCE",
         | 
| 52 | 
            +
              "-fno-strict-aliasing",
         | 
| 53 | 
            +
              "-Werror",
         | 
| 54 | 
            +
              "-Wall",
         | 
| 55 | 
            +
              "-Wextra",
         | 
| 56 | 
            +
              "-Wformat=2",
         | 
| 57 | 
            +
              "-Wcast-qual",
         | 
| 58 | 
            +
              "-Wcast-align",
         | 
| 59 | 
            +
              "-Wwrite-strings",
         | 
| 60 | 
            +
              "-Wconversion",
         | 
| 61 | 
            +
              "-Wfloat-equal",
         | 
| 62 | 
            +
              "-Wpointer-arith",
         | 
| 63 | 
            +
            ]
         | 
| 64 | 
            +
             | 
| 65 | 
            +
             | 
| 66 | 
            +
            desc "Build trema library (static library)."
         | 
| 67 | 
            +
            task "libtrema:static" => "vendor:openflow"
         | 
| 68 | 
            +
            Rake::C::StaticLibraryTask.new "libtrema:static" do | task |
         | 
| 69 | 
            +
              task.library_name = "libtrema"
         | 
| 70 | 
            +
              task.target_directory = Trema.lib
         | 
| 71 | 
            +
              task.sources = "#{ Trema.include }/*.c"
         | 
| 72 | 
            +
              task.includes = [ Trema.openflow ]
         | 
| 73 | 
            +
              task.cflags = CFLAGS
         | 
| 74 | 
            +
            end
         | 
| 75 | 
            +
             | 
| 76 | 
            +
             | 
| 77 | 
            +
            desc "Build trema library (coverage)."
         | 
| 78 | 
            +
            task "libtrema:gcov" => "vendor:openflow"
         | 
| 79 | 
            +
            Rake::C::StaticLibraryTask.new "libtrema:gcov" do | task |
         | 
| 80 | 
            +
              task.library_name = "libtrema"
         | 
| 81 | 
            +
              task.target_directory = File.join( Trema.objects, "unittests" )
         | 
| 82 | 
            +
              task.sources = "#{ Trema.include }/*.c"
         | 
| 83 | 
            +
              task.includes = [ Trema.openflow ]
         | 
| 84 | 
            +
              task.cflags = [ "--coverage" ] + CFLAGS
         | 
| 85 | 
            +
            end
         | 
| 86 | 
            +
             | 
| 87 | 
            +
             | 
| 88 | 
            +
            desc "Build trema library (shared library)."
         | 
| 89 | 
            +
            task "libtrema:shared" => "vendor:openflow"
         | 
| 90 | 
            +
            Rake::C::SharedLibraryTask.new "libtrema:shared" do | task |
         | 
| 91 | 
            +
              task.library_name = "libtrema"
         | 
| 92 | 
            +
              task.target_directory = Trema.lib
         | 
| 93 | 
            +
              task.version = Trema::VERSION
         | 
| 94 | 
            +
              task.sources = "#{ Trema.include }/*.c"
         | 
| 95 | 
            +
              task.includes = [ Trema.openflow ]
         | 
| 96 | 
            +
              task.cflags = CFLAGS
         | 
| 97 | 
            +
            end
         | 
| 98 | 
            +
             | 
| 99 | 
            +
             | 
| 100 | 
            +
            ################################################################################
         | 
| 101 | 
            +
            # Extract OpenFlow reference implementation
         | 
| 102 | 
            +
            ################################################################################
         | 
| 103 | 
            +
             | 
| 104 | 
            +
            task "vendor:openflow" => Trema.openflow_h
         | 
| 105 | 
            +
            file Trema.openflow_h => Trema.objects do
         | 
| 106 | 
            +
              sh "tar xzf #{ Trema.vendor_openflow }.tar.gz -C #{ Trema.vendor }"
         | 
| 107 | 
            +
              cp_r "#{ Trema.vendor_openflow }/include/openflow", Trema.objects
         | 
| 108 | 
            +
            end
         | 
| 109 | 
            +
            directory Trema.objects
         | 
| 110 | 
            +
             | 
| 111 | 
            +
            CLOBBER.include File.join( Trema.objects, "openflow" )
         | 
| 112 | 
            +
            CLOBBER.include File.join( Trema.vendor_openflow )
         | 
| 113 | 
            +
             | 
| 114 | 
            +
             | 
| 115 | 
            +
            ################################################################################
         | 
| 116 | 
            +
            # Build phost
         | 
| 117 | 
            +
            ################################################################################
         | 
| 118 | 
            +
             | 
| 119 | 
            +
            task "vendor:phost" => [ Trema::Executables.phost, Trema::Executables.cli ]
         | 
| 120 | 
            +
             | 
| 121 | 
            +
            def phost_src
         | 
| 122 | 
            +
              File.join Trema.vendor_phost, "src"
         | 
| 123 | 
            +
            end
         | 
| 124 | 
            +
             | 
| 125 | 
            +
            file Trema::Executables.phost do
         | 
| 126 | 
            +
              cd phost_src do
         | 
| 127 | 
            +
                sh "make"
         | 
| 128 | 
            +
              end
         | 
| 129 | 
            +
              mkdir_p File.dirname( Trema::Executables.phost )
         | 
| 130 | 
            +
              install File.join( phost_src, "phost" ), Trema::Executables.phost, :mode => 0755
         | 
| 131 | 
            +
            end
         | 
| 132 | 
            +
             | 
| 133 | 
            +
            file Trema::Executables.cli do
         | 
| 134 | 
            +
              cd phost_src do
         | 
| 135 | 
            +
                sh "make"
         | 
| 136 | 
            +
              end
         | 
| 137 | 
            +
              mkdir_p File.dirname( Trema::Executables.cli )
         | 
| 138 | 
            +
              install File.join( phost_src, "cli" ), Trema::Executables.cli, :mode => 0755
         | 
| 139 | 
            +
            end
         | 
| 140 | 
            +
             | 
| 141 | 
            +
            CLEAN.include FileList[ File.join( phost_src, "*.o" ) ]
         | 
| 142 | 
            +
            CLEAN.include File.join( phost_src, "phost" )
         | 
| 143 | 
            +
            CLEAN.include File.join( phost_src, "cli" )
         | 
| 144 | 
            +
            CLOBBER.include Trema.phost
         | 
| 145 | 
            +
             | 
| 146 | 
            +
             | 
| 147 | 
            +
            ################################################################################
         | 
| 148 | 
            +
            # Build vendor/*
         | 
| 149 | 
            +
            ################################################################################
         | 
| 150 | 
            +
             | 
| 151 | 
            +
            task :vendor => [
         | 
| 152 | 
            +
              "vendor:oflops",
         | 
| 153 | 
            +
              "vendor:openflow",
         | 
| 154 | 
            +
              "vendor:openvswitch",
         | 
| 155 | 
            +
              "vendor:phost",
         | 
| 156 | 
            +
            ]
         | 
| 157 | 
            +
             | 
| 158 | 
            +
             | 
| 159 | 
            +
            ################################################################################
         | 
| 160 | 
            +
            # Build Open vSwitch
         | 
| 161 | 
            +
            ################################################################################
         | 
| 162 | 
            +
             | 
| 163 | 
            +
            task "vendor:openvswitch" => Trema::Executables.ovs_openflowd
         | 
| 164 | 
            +
            file Trema::Executables.ovs_openflowd do
         | 
| 165 | 
            +
              sh "tar xzf #{ Trema.vendor_openvswitch }.tar.gz -C #{ Trema.vendor }"
         | 
| 166 | 
            +
              cd Trema.vendor_openvswitch do
         | 
| 167 | 
            +
                sh "./configure --prefix=#{ Trema.openvswitch } --with-rundir=#{ Trema.sock }"
         | 
| 168 | 
            +
                sh "make install"
         | 
| 169 | 
            +
                cp "./tests/test-openflowd", Trema::Executables.ovs_openflowd
         | 
| 170 | 
            +
              end
         | 
| 171 | 
            +
            end
         | 
| 172 | 
            +
             | 
| 173 | 
            +
            CLEAN.include Trema.vendor_openvswitch
         | 
| 174 | 
            +
            CLOBBER.include Trema.openvswitch
         | 
| 175 | 
            +
             | 
| 176 | 
            +
             | 
| 177 | 
            +
            ################################################################################
         | 
| 178 | 
            +
            # Build oflops
         | 
| 179 | 
            +
            ################################################################################
         | 
| 180 | 
            +
             | 
| 181 | 
            +
            def cbench_command
         | 
| 182 | 
            +
              File.join Trema.objects, "oflops/bin/cbench"
         | 
| 183 | 
            +
            end
         | 
| 184 | 
            +
             | 
| 185 | 
            +
            task "vendor:oflops" => cbench_command
         | 
| 186 | 
            +
            file cbench_command => Trema.openflow_h do
         | 
| 187 | 
            +
              sh "tar xzf #{ Trema.vendor_oflops }.tar.gz -C #{ Trema.vendor }"
         | 
| 188 | 
            +
              cd Trema.vendor_oflops do
         | 
| 189 | 
            +
                sh "./configure --prefix=#{ Trema.oflops } --with-openflow-src-dir=#{ Trema.vendor_openflow }"
         | 
| 190 | 
            +
                sh "make install"
         | 
| 191 | 
            +
              end
         | 
| 192 | 
            +
            end
         | 
| 193 | 
            +
             | 
| 194 | 
            +
            CLEAN.include Trema.oflops
         | 
| 195 | 
            +
            CLOBBER.include Trema.vendor_oflops
         | 
| 196 | 
            +
             | 
| 197 | 
            +
             | 
| 198 | 
            +
            ################################################################################
         | 
| 199 | 
            +
            # cmockery
         | 
| 200 | 
            +
            ################################################################################
         | 
| 201 | 
            +
             | 
| 202 | 
            +
            task "vendor:cmockery" => Trema.libcmockery_a
         | 
| 203 | 
            +
            file Trema.libcmockery_a do
         | 
| 204 | 
            +
              sh "tar xzf #{ Trema.vendor_cmockery }.tar.gz -C #{ Trema.vendor }"
         | 
| 205 | 
            +
              cd Trema.vendor_cmockery do
         | 
| 206 | 
            +
                sh "./configure --prefix=#{ Trema.cmockery }"
         | 
| 207 | 
            +
                sh "make install"
         | 
| 208 | 
            +
              end
         | 
| 209 | 
            +
            end
         | 
| 210 | 
            +
             | 
| 211 | 
            +
            CLEAN.include Trema.vendor_cmockery
         | 
| 212 | 
            +
            CLOBBER.include Trema.cmockery
         | 
| 213 | 
            +
             | 
| 214 | 
            +
             | 
| 215 | 
            +
            ################################################################################
         | 
| 216 | 
            +
            # Run cbench benchmarks
         | 
| 217 | 
            +
            ################################################################################
         | 
| 218 | 
            +
             | 
| 219 | 
            +
            def cbench_command
         | 
| 220 | 
            +
              File.join Trema.objects, "oflops/bin/cbench"
         | 
| 221 | 
            +
            end
         | 
| 222 | 
            +
             | 
| 223 | 
            +
             | 
| 224 | 
            +
            def cbench_latency_mode_options
         | 
| 225 | 
            +
              "--switches 1 --loops 10 --delay 1000"
         | 
| 226 | 
            +
            end
         | 
| 227 | 
            +
             | 
| 228 | 
            +
             | 
| 229 | 
            +
            def cbench_throughput_mode_options
         | 
| 230 | 
            +
              cbench_latency_mode_options + " --throughput"
         | 
| 231 | 
            +
            end
         | 
| 232 | 
            +
             | 
| 233 | 
            +
             | 
| 234 | 
            +
            def cbench controller, options
         | 
| 235 | 
            +
              begin
         | 
| 236 | 
            +
                sh "#{ controller }"
         | 
| 237 | 
            +
                sh "#{ cbench_command } #{ options }"
         | 
| 238 | 
            +
              ensure
         | 
| 239 | 
            +
                sh "./trema killall"
         | 
| 240 | 
            +
              end
         | 
| 241 | 
            +
            end
         | 
| 242 | 
            +
             | 
| 243 | 
            +
             | 
| 244 | 
            +
            def cbench_c_controller
         | 
| 245 | 
            +
              "./trema run ./objects/examples/cbench_switch/cbench_switch -d"
         | 
| 246 | 
            +
            end
         | 
| 247 | 
            +
             | 
| 248 | 
            +
             | 
| 249 | 
            +
            def cbench_ruby_controller
         | 
| 250 | 
            +
              "./trema run src/examples/cbench_switch/cbench-switch.rb -d"
         | 
| 251 | 
            +
            end
         | 
| 252 | 
            +
             | 
| 253 | 
            +
             | 
| 254 | 
            +
            def run_cbench controller
         | 
| 255 | 
            +
              cbench controller, cbench_latency_mode_options
         | 
| 256 | 
            +
              cbench controller, cbench_throughput_mode_options
         | 
| 257 | 
            +
            end
         | 
| 258 | 
            +
             | 
| 259 | 
            +
             | 
| 260 | 
            +
            def cbench_profile options
         | 
| 261 | 
            +
              valgrind = "valgrind --tool=callgrind --trace-children=yes"
         | 
| 262 | 
            +
              begin
         | 
| 263 | 
            +
                sh "#{ valgrind } #{ cbench_c_controller }"
         | 
| 264 | 
            +
                sh "#{ cbench_command } #{ options }"
         | 
| 265 | 
            +
              ensure
         | 
| 266 | 
            +
                sh "./trema killall"
         | 
| 267 | 
            +
              end
         | 
| 268 | 
            +
            end
         | 
| 269 | 
            +
             | 
| 270 | 
            +
            CLEAN.include FileList[ "callgrind.out.*" ]
         | 
| 271 | 
            +
             | 
| 272 | 
            +
             | 
| 273 | 
            +
            desc "Run the c cbench switch controller to benchmark"
         | 
| 274 | 
            +
            task "cbench" => "cbench:ruby"
         | 
| 275 | 
            +
             | 
| 276 | 
            +
             | 
| 277 | 
            +
            desc "Run the c cbench switch controller to benchmark"
         | 
| 278 | 
            +
            task "cbench:c" => :default do
         | 
| 279 | 
            +
              run_cbench cbench_c_controller
         | 
| 280 | 
            +
            end
         | 
| 281 | 
            +
             | 
| 282 | 
            +
             | 
| 283 | 
            +
            desc "Run the ruby cbench switch controller to benchmark"
         | 
| 284 | 
            +
            task "cbench:ruby" => :default do
         | 
| 285 | 
            +
              run_cbench cbench_ruby_controller
         | 
| 286 | 
            +
            end
         | 
| 287 | 
            +
             | 
| 288 | 
            +
             | 
| 289 | 
            +
            desc "Run cbench with profiling enabled."
         | 
| 290 | 
            +
            task "cbench:profile" => :default do
         | 
| 291 | 
            +
              cbench_profile cbench_latency_mode_options
         | 
| 292 | 
            +
              cbench_profile cbench_throughput_mode_options
         | 
| 293 | 
            +
            end
         | 
| 294 | 
            +
             | 
| 295 | 
            +
             | 
| 38 296 | 
             
            ################################################################################
         | 
| 39 297 | 
             
            # Maintenance Tasks
         | 
| 40 298 | 
             
            ################################################################################
         | 
| @@ -77,7 +335,7 @@ end | |
| 77 335 | 
             
            # Tests
         | 
| 78 336 | 
             
            ################################################################################
         | 
| 79 337 |  | 
| 80 | 
            -
            task :travis => [ :setup, : | 
| 338 | 
            +
            task :travis => [ :setup, :build_trema ]
         | 
| 81 339 |  | 
| 82 340 |  | 
| 83 341 | 
             
            begin
         | 
    
        data/Rantfile
    CHANGED
    
    | @@ -35,7 +35,7 @@ import "directedrule" | |
| 35 35 |  | 
| 36 36 | 
             
            desc "Build trema."
         | 
| 37 37 | 
             
            task :default => [
         | 
| 38 | 
            -
              : | 
| 38 | 
            +
              "libtrema:static",
         | 
| 39 39 | 
             
              :management_commands,
         | 
| 40 40 | 
             
              :rubylib,
         | 
| 41 41 | 
             
              :switch_manager,
         | 
| @@ -60,6 +60,7 @@ task :examples => [ | |
| 60 60 | 
             
              "examples:openflow_message",
         | 
| 61 61 | 
             
              "examples:packet_in",
         | 
| 62 62 | 
             
              "examples:repeater_hub",
         | 
| 63 | 
            +
              "examples:switch_event_config",
         | 
| 63 64 | 
             
              "examples:packetin_filter_config",
         | 
| 64 65 | 
             
              "examples:switch_info",
         | 
| 65 66 | 
             
              "examples:switch_monitor",
         | 
| @@ -124,82 +125,25 @@ var :CFLAGS => "-g -std=gnu99 -D_GNU_SOURCE -fno-strict-aliasing -Werror -Wall - | |
| 124 125 | 
             
            # Run cbench benchmarks.
         | 
| 125 126 | 
             
            ################################################################################
         | 
| 126 127 |  | 
| 127 | 
            -
             | 
| 128 | 
            -
            def cbench_command
         | 
| 129 | 
            -
              File.join Trema.objects, "oflops/bin/cbench"
         | 
| 130 | 
            -
            end
         | 
| 131 | 
            -
             | 
| 132 | 
            -
             | 
| 133 | 
            -
            def cbench_latency_mode_options
         | 
| 134 | 
            -
              "--switches 1 --loops 10 --delay 1000"
         | 
| 135 | 
            -
            end
         | 
| 136 | 
            -
             | 
| 137 | 
            -
             | 
| 138 | 
            -
            def cbench_throughput_mode_options
         | 
| 139 | 
            -
              cbench_latency_mode_options + " --throughput"
         | 
| 140 | 
            -
            end
         | 
| 141 | 
            -
             | 
| 142 | 
            -
             | 
| 143 | 
            -
            def cbench controller, options
         | 
| 144 | 
            -
              begin
         | 
| 145 | 
            -
                sys "#{ controller }"
         | 
| 146 | 
            -
                sys "#{ cbench_command } #{ options }"
         | 
| 147 | 
            -
              ensure
         | 
| 148 | 
            -
                sys "./trema killall"
         | 
| 149 | 
            -
              end
         | 
| 150 | 
            -
            end
         | 
| 151 | 
            -
             | 
| 152 | 
            -
             | 
| 153 | 
            -
            def cbench_c_controller
         | 
| 154 | 
            -
              "./trema run ./objects/examples/cbench_switch/cbench_switch -d"
         | 
| 155 | 
            -
            end
         | 
| 156 | 
            -
             | 
| 157 | 
            -
             | 
| 158 | 
            -
            def cbench_ruby_controller
         | 
| 159 | 
            -
              "./trema run src/examples/cbench_switch/cbench-switch.rb -d"
         | 
| 160 | 
            -
            end
         | 
| 161 | 
            -
             | 
| 162 | 
            -
             | 
| 163 | 
            -
            def run_cbench controller
         | 
| 164 | 
            -
              cbench controller, cbench_latency_mode_options
         | 
| 165 | 
            -
              cbench controller, cbench_throughput_mode_options
         | 
| 166 | 
            -
            end
         | 
| 167 | 
            -
             | 
| 168 | 
            -
             | 
| 169 | 
            -
            var[ :clean ].include sys[ "callgrind.out.*" ]
         | 
| 170 | 
            -
             | 
| 171 | 
            -
             | 
| 172 | 
            -
            def cbench_profile options
         | 
| 173 | 
            -
              valgrind = "valgrind --tool=callgrind --trace-children=yes"
         | 
| 174 | 
            -
              begin
         | 
| 175 | 
            -
                sys "#{ valgrind } #{ cbench_c_controller }"
         | 
| 176 | 
            -
                sys "#{ cbench_command } #{ options }"
         | 
| 177 | 
            -
              ensure
         | 
| 178 | 
            -
                sys "./trema killall"
         | 
| 179 | 
            -
              end
         | 
| 180 | 
            -
            end
         | 
| 181 | 
            -
             | 
| 182 | 
            -
             | 
| 183 128 | 
             
            desc "Run the c cbench switch controller to benchmark"
         | 
| 184 | 
            -
            task  | 
| 129 | 
            +
            task :cbench => "cbench:ruby"
         | 
| 185 130 |  | 
| 186 131 |  | 
| 187 | 
            -
            desc "Run the  | 
| 188 | 
            -
            task "cbench: | 
| 189 | 
            -
               | 
| 132 | 
            +
            desc "Run the ruby cbench switch controller to benchmark"
         | 
| 133 | 
            +
            task "cbench:ruby" do
         | 
| 134 | 
            +
              sys "rake cbench:ruby"
         | 
| 190 135 | 
             
            end
         | 
| 191 136 |  | 
| 192 137 |  | 
| 193 | 
            -
            desc "Run the  | 
| 194 | 
            -
            task "cbench: | 
| 195 | 
            -
               | 
| 138 | 
            +
            desc "Run the c cbench switch controller to benchmark"
         | 
| 139 | 
            +
            task "cbench:c" do
         | 
| 140 | 
            +
              sys "rake cbench:c"
         | 
| 196 141 | 
             
            end
         | 
| 197 142 |  | 
| 198 143 |  | 
| 199 144 | 
             
            desc "Run cbench with profiling enabled."
         | 
| 200 | 
            -
            task "cbench:profile"  | 
| 201 | 
            -
               | 
| 202 | 
            -
              cbench_profile cbench_throughput_mode_options
         | 
| 145 | 
            +
            task "cbench:profile" do
         | 
| 146 | 
            +
              sys "rake cbench:profile"
         | 
| 203 147 | 
             
            end
         | 
| 204 148 |  | 
| 205 149 |  | 
| @@ -210,20 +154,15 @@ end | |
| 210 154 | 
             
            import "sys/tgz"
         | 
| 211 155 |  | 
| 212 156 |  | 
| 213 | 
            -
            task :vendor  | 
| 214 | 
            -
              "vendor | 
| 215 | 
            -
             | 
| 216 | 
            -
              "vendor:openvswitch",
         | 
| 217 | 
            -
              "vendor:phost",
         | 
| 218 | 
            -
            ]
         | 
| 157 | 
            +
            task :vendor do
         | 
| 158 | 
            +
              sys "rake vendor"
         | 
| 159 | 
            +
            end
         | 
| 219 160 |  | 
| 220 | 
            -
            task :distclean =>  | 
| 221 | 
            -
             | 
| 222 | 
            -
             | 
| 223 | 
            -
              " | 
| 224 | 
            -
             | 
| 225 | 
            -
              "vendor:phost:distclean",
         | 
| 226 | 
            -
            ]
         | 
| 161 | 
            +
            task :distclean => :clobber
         | 
| 162 | 
            +
             | 
| 163 | 
            +
            task :clobber do
         | 
| 164 | 
            +
              sys "rake clobber"
         | 
| 165 | 
            +
            end
         | 
| 227 166 |  | 
| 228 167 |  | 
| 229 168 | 
             
            #
         | 
| @@ -234,14 +173,7 @@ gen Directory, Trema.objects | |
| 234 173 |  | 
| 235 174 | 
             
            task "vendor:openflow" => Trema.openflow_h
         | 
| 236 175 | 
             
            file Trema.openflow_h do
         | 
| 237 | 
            -
              sys | 
| 238 | 
            -
              sys.mkdir_p Trema.objects
         | 
| 239 | 
            -
              sys.cp_r "#{ Trema.vendor_openflow }/include/openflow", Trema.objects
         | 
| 240 | 
            -
              sys "chmod -R +r #{ File.join Trema.objects, "openflow" }"
         | 
| 241 | 
            -
            end
         | 
| 242 | 
            -
             | 
| 243 | 
            -
            task "vendor:openflow:distclean" do
         | 
| 244 | 
            -
              sys.rm_rf Trema.vendor_openflow
         | 
| 176 | 
            +
              sys "rake vendor:openflow"
         | 
| 245 177 | 
             
            end
         | 
| 246 178 |  | 
| 247 179 |  | 
| @@ -271,96 +203,13 @@ task "openflow_wireshark_plugin:distclean" do | |
| 271 203 | 
             
            end
         | 
| 272 204 |  | 
| 273 205 |  | 
| 274 | 
            -
            #
         | 
| 275 | 
            -
            # Open vSwitch
         | 
| 276 | 
            -
            #
         | 
| 277 | 
            -
             | 
| 278 | 
            -
            task "vendor:openvswitch" => Trema::Executables.ovs_openflowd
         | 
| 279 | 
            -
            file Trema::Executables.ovs_openflowd do
         | 
| 280 | 
            -
              sys.unpack_tgz "#{ Trema.vendor_openvswitch }.tar.gz", :in => Trema.vendor
         | 
| 281 | 
            -
              sys.cd Trema.vendor_openvswitch do
         | 
| 282 | 
            -
                sys "./configure --prefix=#{ Trema.openvswitch } --with-rundir=#{ Trema.sock }"
         | 
| 283 | 
            -
                sys "make install"
         | 
| 284 | 
            -
                sys "cp ./tests/test-openflowd #{ Trema::Executables.ovs_openflowd }"
         | 
| 285 | 
            -
              end
         | 
| 286 | 
            -
            end
         | 
| 287 | 
            -
             | 
| 288 | 
            -
            task "vendor:openvswitch:distclean" do
         | 
| 289 | 
            -
              sys.rm_rf Trema.vendor_openvswitch
         | 
| 290 | 
            -
            end
         | 
| 291 | 
            -
             | 
| 292 | 
            -
             | 
| 293 | 
            -
            #
         | 
| 294 | 
            -
            # oflops
         | 
| 295 | 
            -
            #
         | 
| 296 | 
            -
             | 
| 297 | 
            -
            task "vendor:oflops" => cbench_command
         | 
| 298 | 
            -
            file cbench_command => Trema.openflow_h do
         | 
| 299 | 
            -
              sys.unpack_tgz "#{ Trema.vendor_oflops }.tar.gz", :in => Trema.vendor
         | 
| 300 | 
            -
              sys.cd Trema.vendor_oflops do
         | 
| 301 | 
            -
                sys "./configure --prefix=#{ Trema.oflops } --with-openflow-src-dir=#{ Trema.vendor_openflow }"
         | 
| 302 | 
            -
                sys "make install"
         | 
| 303 | 
            -
              end
         | 
| 304 | 
            -
            end
         | 
| 305 | 
            -
             | 
| 306 | 
            -
            task "vendor:oflops:distclean" do
         | 
| 307 | 
            -
              sys.rm_rf Trema.vendor_oflops
         | 
| 308 | 
            -
            end
         | 
| 309 | 
            -
             | 
| 310 | 
            -
             | 
| 311 | 
            -
            #
         | 
| 312 | 
            -
            # phost
         | 
| 313 | 
            -
            #
         | 
| 314 | 
            -
             | 
| 315 | 
            -
            def phost_src
         | 
| 316 | 
            -
              File.join Trema.vendor_phost, "src"
         | 
| 317 | 
            -
            end
         | 
| 318 | 
            -
             | 
| 319 | 
            -
             | 
| 320 | 
            -
            task "vendor:phost" => [ Trema::Executables.phost, Trema::Executables.cli ]
         | 
| 321 | 
            -
             | 
| 322 | 
            -
            file Trema::Executables.phost do
         | 
| 323 | 
            -
              sys.cd phost_src do
         | 
| 324 | 
            -
                sys "make"
         | 
| 325 | 
            -
              end
         | 
| 326 | 
            -
              sys.mkdir_p File.dirname( Trema::Executables.phost )
         | 
| 327 | 
            -
              sys.install File.join( phost_src, "phost" ), Trema::Executables.phost, :mode => 0755
         | 
| 328 | 
            -
            end
         | 
| 329 | 
            -
             | 
| 330 | 
            -
            file Trema::Executables.cli do
         | 
| 331 | 
            -
              sys.cd phost_src do
         | 
| 332 | 
            -
                sys "make"
         | 
| 333 | 
            -
              end
         | 
| 334 | 
            -
              sys.mkdir_p File.dirname( Trema::Executables.cli )
         | 
| 335 | 
            -
              sys.install File.join( phost_src, "cli" ), Trema::Executables.cli, :mode => 0755
         | 
| 336 | 
            -
            end
         | 
| 337 | 
            -
             | 
| 338 | 
            -
            task "vendor:phost:distclean" do
         | 
| 339 | 
            -
              begin
         | 
| 340 | 
            -
                sys.cd phost_src do
         | 
| 341 | 
            -
                  sys "make clean"
         | 
| 342 | 
            -
                end
         | 
| 343 | 
            -
              rescue
         | 
| 344 | 
            -
                # ignore.
         | 
| 345 | 
            -
              end
         | 
| 346 | 
            -
            end
         | 
| 347 | 
            -
             | 
| 348 | 
            -
             | 
| 349 206 | 
             
            #
         | 
| 350 207 | 
             
            # cmockery
         | 
| 351 208 | 
             
            #
         | 
| 352 209 |  | 
| 353 210 | 
             
            task "vendor:cmockery" => Trema.libcmockery_a
         | 
| 354 211 | 
             
            file Trema.libcmockery_a do
         | 
| 355 | 
            -
              sys | 
| 356 | 
            -
              sys.cd Trema::vendor_cmockery do
         | 
| 357 | 
            -
                sys "./configure --prefix=#{ Trema.cmockery }"
         | 
| 358 | 
            -
                sys "make install"
         | 
| 359 | 
            -
              end
         | 
| 360 | 
            -
            end
         | 
| 361 | 
            -
             | 
| 362 | 
            -
            task "vendor:cmockery:distclean" do
         | 
| 363 | 
            -
              sys.rm_rf Trema.vendor_cmockery
         | 
| 212 | 
            +
              sys "rake vendor:cmockery"
         | 
| 364 213 | 
             
            end
         | 
| 365 214 |  | 
| 366 215 |  | 
| @@ -368,58 +217,26 @@ end | |
| 368 217 | 
             
            # Build libtrema.{a,so}
         | 
| 369 218 | 
             
            ################################################################################
         | 
| 370 219 |  | 
| 371 | 
            -
            build_libtrema_a = Proc.new do | t |
         | 
| 372 | 
            -
              sys "rm -f #{ t.name }"
         | 
| 373 | 
            -
              sys "ar -cq #{ t.name } #{ sys.sp t.prerequisites }"
         | 
| 374 | 
            -
              sys "ranlib #{ t.name }"
         | 
| 375 | 
            -
            end
         | 
| 376 | 
            -
             | 
| 377 | 
            -
            build_libtrema_so = Proc.new do | t |
         | 
| 378 | 
            -
              soname = File.basename( t.name ).sub( /\.\d+\.\d+\Z/, "" )
         | 
| 379 | 
            -
              sys "gcc -shared -Wl,-soname=#{ soname } -o #{ t.name } #{ sys.sp t.prerequisites }"
         | 
| 380 | 
            -
            end
         | 
| 381 | 
            -
             | 
| 382 | 
            -
             | 
| 383 | 
            -
            task dependency( "libtrema" ) => "vendor:openflow"
         | 
| 384 | 
            -
            gen C::Dependencies, dependency( "libtrema" ),
         | 
| 385 | 
            -
              :search => [ Trema.include, objects( "openflow" ) ],
         | 
| 386 | 
            -
              :sources => sys[ "#{ Trema.include }/*.{c,h}" ]
         | 
| 387 | 
            -
             | 
| 388 | 
            -
            gen Action do
         | 
| 389 | 
            -
              source dependency( "libtrema" )
         | 
| 390 | 
            -
            end
         | 
| 391 | 
            -
             | 
| 392 | 
            -
             | 
| 393 | 
            -
            gen Directory, Trema.lib
         | 
| 394 | 
            -
            gen Directory, "#{ Trema.home }/objects/unittests"
         | 
| 395 | 
            -
             | 
| 396 220 | 
             
            libtrema = File.join( Trema.lib, "libtrema.a" )
         | 
| 397 221 | 
             
            libtrema_so = File.join( Trema.lib, "libtrema.so." ) + Trema::VERSION
         | 
| 398 222 | 
             
            libtrema_gcov = File.join( "#{ Trema.home }/objects/unittests", "libtrema.a" )
         | 
| 399 223 |  | 
| 400 | 
            -
            libtrema_o = gen DirectedRule, Trema.lib => [ Trema.include ], :o => :c do | t |
         | 
| 401 | 
            -
              sys "gcc -I#{ objects "openflow" } #{ var :CFLAGS } -fPIC -c -o #{ t.name } #{ t.source }"
         | 
| 402 | 
            -
            end
         | 
| 403 | 
            -
            libtrema_gcov_o = gen DirectedRule, "#{ Trema.home }/objects/unittests" => [ Trema.include ], :o => :c do | t |
         | 
| 404 | 
            -
              sys "gcc --coverage -I#{ objects "openflow" } #{ var :CFLAGS } -fPIC -c -o #{ t.name } #{ t.source }"
         | 
| 405 | 
            -
            end
         | 
| 406 | 
            -
             | 
| 407 224 | 
             
            desc "Build trema library (static library)."
         | 
| 408 | 
            -
            task : | 
| 409 | 
            -
            file libtrema  | 
| 410 | 
            -
               | 
| 225 | 
            +
            task "libtrema:static" => libtrema
         | 
| 226 | 
            +
            file libtrema do | t |
         | 
| 227 | 
            +
              sys "rake libtrema:static"
         | 
| 411 228 | 
             
            end
         | 
| 412 229 |  | 
| 413 230 | 
             
            desc "Build trema library (shared library)."
         | 
| 414 | 
            -
            task : | 
| 415 | 
            -
            file libtrema_so  | 
| 416 | 
            -
               | 
| 231 | 
            +
            task "libtrema:shared" => libtrema_so
         | 
| 232 | 
            +
            file libtrema_so do | t |
         | 
| 233 | 
            +
              sys "rake libtrema:shared"
         | 
| 417 234 | 
             
            end
         | 
| 418 235 |  | 
| 419 236 | 
             
            desc "Build trema library (coverage)."
         | 
| 420 | 
            -
            task " | 
| 421 | 
            -
            file libtrema_gcov  | 
| 422 | 
            -
               | 
| 237 | 
            +
            task "libtrema:gcov" => libtrema_gcov
         | 
| 238 | 
            +
            file libtrema_gcov do | t |
         | 
| 239 | 
            +
              sys "rake libtrema:gcov"
         | 
| 423 240 | 
             
            end
         | 
| 424 241 |  | 
| 425 242 |  | 
| @@ -482,7 +299,9 @@ end | |
| 482 299 |  | 
| 483 300 | 
             
            switch_manager_objects = [
         | 
| 484 301 | 
             
              "dpid_table.o",
         | 
| 302 | 
            +
              "event_forward_entry_manipulation.o",
         | 
| 485 303 | 
             
              "switch_manager.o",
         | 
| 304 | 
            +
              "switch_option.o",
         | 
| 486 305 | 
             
              "secure_channel_listener.o"
         | 
| 487 306 | 
             
            ].collect do | each |
         | 
| 488 307 | 
             
              File.join switch_manager_objects_dir, each
         | 
| @@ -497,12 +316,14 @@ end | |
| 497 316 |  | 
| 498 317 | 
             
            switch_objects = [
         | 
| 499 318 | 
             
              "cookie_table.o",
         | 
| 319 | 
            +
              "event_forward_entry_manipulation.o",
         | 
| 500 320 | 
             
              "ofpmsg_recv.o",
         | 
| 501 321 | 
             
              "ofpmsg_send.o",
         | 
| 502 322 | 
             
              "secure_channel_receiver.o",
         | 
| 503 323 | 
             
              "secure_channel_sender.o",
         | 
| 504 324 | 
             
              "service_interface.o",
         | 
| 505 325 | 
             
              "switch.o",
         | 
| 326 | 
            +
              "switch_option.o",
         | 
| 506 327 | 
             
              "xid_table.o",
         | 
| 507 328 | 
             
            ].collect do | each |
         | 
| 508 329 | 
             
              File.join switch_manager_objects_dir, each
         | 
| @@ -774,6 +595,47 @@ openflow_messages.each do | each | | |
| 774 595 | 
             
            end
         | 
| 775 596 |  | 
| 776 597 |  | 
| 598 | 
            +
            ###############################################################################
         | 
| 599 | 
            +
            # Build switch_event_config
         | 
| 600 | 
            +
            ###############################################################################
         | 
| 601 | 
            +
             | 
| 602 | 
            +
            switch_event_config = [
         | 
| 603 | 
            +
              "add_forward_entry",
         | 
| 604 | 
            +
              "delete_forward_entry",
         | 
| 605 | 
            +
              "set_forward_entries",
         | 
| 606 | 
            +
              "dump_forward_entries",
         | 
| 607 | 
            +
            ]
         | 
| 608 | 
            +
             | 
| 609 | 
            +
            switch_event_config_source_dir = "src/examples/switch_event_config"
         | 
| 610 | 
            +
            switch_event_config_objects_dir = objects( "examples/switch_event_config" )
         | 
| 611 | 
            +
             | 
| 612 | 
            +
            gen C::Dependencies, dependency( "switch_event_config" ),
         | 
| 613 | 
            +
              :search => [ Trema.include ], :sources => sys[ "#{ switch_event_config_source_dir }/*.{c,h}" ]
         | 
| 614 | 
            +
             | 
| 615 | 
            +
            gen Action do
         | 
| 616 | 
            +
              source dependency( "switch_event_config" )
         | 
| 617 | 
            +
            end
         | 
| 618 | 
            +
             | 
| 619 | 
            +
            gen Directory, switch_event_config_objects_dir
         | 
| 620 | 
            +
             | 
| 621 | 
            +
             | 
| 622 | 
            +
            gen DirectedRule, switch_event_config_objects_dir => [ switch_event_config_source_dir ], :o => :c do | t |
         | 
| 623 | 
            +
              sys "gcc -I#{ Trema.include } -I#{ Trema.openflow } #{ var :CFLAGS } -c -o #{ t.name } #{ t.source }"
         | 
| 624 | 
            +
            end
         | 
| 625 | 
            +
             | 
| 626 | 
            +
             | 
| 627 | 
            +
            switch_event_config.each do | each |
         | 
| 628 | 
            +
              target = File.join( switch_event_config_objects_dir, each )
         | 
| 629 | 
            +
              task "examples:switch_event_config" => target
         | 
| 630 | 
            +
              file target => [
         | 
| 631 | 
            +
                File.join( switch_event_config_objects_dir, "#{ each }.o" ),
         | 
| 632 | 
            +
                libtrema
         | 
| 633 | 
            +
              ] do | t |
         | 
| 634 | 
            +
                sys "gcc -L#{ Trema.lib } -o #{ t.name } #{ t.source } -ltrema -lsqlite3 -ldl -lrt -lpthread"
         | 
| 635 | 
            +
              end
         | 
| 636 | 
            +
            end
         | 
| 637 | 
            +
             | 
| 638 | 
            +
             | 
| 777 639 | 
             
            ################################################################################
         | 
| 778 640 | 
             
            # Build packetin_filter_config
         | 
| 779 641 | 
             
            ################################################################################
         | 
| @@ -871,7 +733,7 @@ end | |
| 871 733 | 
             
            libtrema_unit_tests.keys.each do | each |
         | 
| 872 734 | 
             
              target = "unittests/objects/#{ each }"
         | 
| 873 735 |  | 
| 874 | 
            -
              task :build_old_unittests => target
         | 
| 736 | 
            +
              task :build_old_unittests => [ "vendor:openflow", target ]
         | 
| 875 737 | 
             
              task target => "vendor:cmockery"
         | 
| 876 738 | 
             
              file target => test_object_files( each ) + [ "#{ target }.o" ] do | t |
         | 
| 877 739 | 
             
                sys "gcc -L#{ File.dirname Trema.libcmockery_a } -o #{ t.name } #{ sys.sp t.prerequisites } -DUNIT_TESTING -lrt -lcmockery -lsqlite3 -ldl -lpthread --coverage --static"
         | 
| @@ -884,6 +746,7 @@ tests = [ | |
| 884 746 | 
             
              "objects/unittests/buffer_test",
         | 
| 885 747 | 
             
              "objects/unittests/doubly_linked_list_test",
         | 
| 886 748 | 
             
              "objects/unittests/ether_test",
         | 
| 749 | 
            +
              "objects/unittests/event_forward_interface_test",
         | 
| 887 750 | 
             
              "objects/unittests/hash_table_test",
         | 
| 888 751 | 
             
              "objects/unittests/linked_list_test",
         | 
| 889 752 | 
             
              "objects/unittests/log_test",
         | 
| @@ -907,8 +770,8 @@ end | |
| 907 770 |  | 
| 908 771 |  | 
| 909 772 | 
             
            tests.each do | each |
         | 
| 910 | 
            -
              task :build_unittests => [ " | 
| 911 | 
            -
              task each => [ " | 
| 773 | 
            +
              task :build_unittests => [ "libtrema:gcov", each ]
         | 
| 774 | 
            +
              task each => [ "libtrema:gcov", "vendor:cmockery", "objects/unittests/cmockery_trema.o" ]
         | 
| 912 775 | 
             
              file each => "unittests/lib/#{ File.basename each }.c" do | t |
         | 
| 913 776 | 
             
                sys "gcc --coverage -c unittests/lib/#{ File.basename t.name }.c -o #{ each }.o #{ var :CFLAGS } -I#{ Trema.include } -I#{ Trema.openflow } -I#{ File.dirname Trema.cmockery_h } -Iunittests"
         | 
| 914 777 | 
             
                sys "gcc --coverage -o #{ t.name } #{ each }.o objects/unittests/cmockery_trema.o -Lobjects/unittests -L#{ File.dirname Trema.libcmockery_a } -ltrema -lrt -lcmockery -lsqlite3 -ldl -lpthread --static"
         |