LEFT | RIGHT |
1 ## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8;
-*- | 1 ## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8;
-*- |
2 | 2 |
3 import os | 3 import os |
4 import Options | 4 import Options |
5 | 5 |
6 def set_options(opt): | 6 def set_options(opt): |
7 opt.add_option('--with-openflow', | 7 opt.add_option('--with-openflow', |
8 help=('Path to OFSID source for NS-3 OpenFlow Integration sup
port'), | 8 help=('Path to OFSID source for NS-3 OpenFlow Integration sup
port'), |
9 » » dest='with_openflow', default=None)· | 9 » » default='', dest='with_openflow')· |
10 | 10 |
11 def configure(conf): | 11 def configure(conf): |
| 12 conf.check_tool('boost') |
| 13 conf.env['BOOST'] = conf.check_boost(lib = 'signals filesystem', |
| 14 kind = 'STATIC_BOTH', |
| 15 score_version = (-1000, 1000), |
| 16 tag_minscore = 1000,) |
| 17 |
| 18 if not conf.env['BOOST']: |
| 19 conf.report_optional_feature("openflow", "NS-3 OpenFlow Integration", Fa
lse, |
| 20 "Required boost libraries not found") |
| 21 return· |
| 22 |
12 if Options.options.with_openflow: | 23 if Options.options.with_openflow: |
13 if os.path.isdir(Options.options.with_openflow): | 24 if os.path.isdir(Options.options.with_openflow): |
14 » conf.check_message("libopenflow.a location", '', True, ("%s (given)"
% Options.options.with_openflow)) | 25 » conf.check_message("OpenFlow location", '', True, ("%s (given)" % Op
tions.options.with_openflow)) |
15 conf.env['WITH_OPENFLOW'] = os.path.abspath(Options.options.with_ope
nflow) | 26 conf.env['WITH_OPENFLOW'] = os.path.abspath(Options.options.with_ope
nflow) |
16 » else: | 27 else: |
17 » openflow_dir = os.path.join('..','openflow') | 28 openflow_dir = os.path.join('..','openflow') |
18 » if os.path.isdir(openflow_dir): | 29 if os.path.isdir(openflow_dir): |
19 » » conf.check_message("openflow location", '', True, ("%s (guessed)
" % openflow_dir)) | 30 conf.check_message("OpenFlow location", '', True, ("%s (guessed)" %
openflow_dir)) |
20 » » conf.env['WITH_OPENFLOW'] = os.path.abspath(openflow_dir) | 31 » conf.env['WITH_OPENFLOW'] = os.path.abspath(openflow_dir) |
21 » del openflow_dir | 32 » del openflow_dir |
22 if not conf.env['WITH_OPENFLOW']: | 33 if not conf.env['WITH_OPENFLOW']: |
23 » conf.check_message("openflow location", '', False) | 34 » conf.check_message("OpenFlow location", '', False) |
24 conf.report_optional_feature("openflow", "NS-3 OpenFlow Integration", Fa
lse, | 35 conf.report_optional_feature("openflow", "NS-3 OpenFlow Integration", Fa
lse, |
25 "OpenFlow not enabled (see option --with-op
enflow)") | 36 "OpenFlow not enabled (see option --with-op
enflow)") |
26 return· | 37 return· |
27 | 38 |
28 test_code = ''' | 39 test_code = ''' |
29 #include "openflow.h" | 40 #include "openflow.h" |
30 #include "nicira-ext.h" | 41 #include "nicira-ext.h" |
31 #include "ericsson-ext.h" | 42 #include "ericsson-ext.h" |
32 | 43 |
33 extern "C" | 44 extern "C" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 os.path.abspath(os.path.join(conf.env['WITH_
OPENFLOW'],'include','openflow')), | 93 os.path.abspath(os.path.join(conf.env['WITH_
OPENFLOW'],'include','openflow')), |
83 os.path.abspath(os.path.join(conf.env['WITH_
OPENFLOW'],'lib')), | 94 os.path.abspath(os.path.join(conf.env['WITH_
OPENFLOW'],'lib')), |
84 os.path.abspath(os.path.join(conf.env['WITH_
OPENFLOW'],'switch')) | 95 os.path.abspath(os.path.join(conf.env['WITH_
OPENFLOW'],'switch')) |
85 ] | 96 ] |
86 conf.env['LIBPATH_OPENFLOW'] = [os.path.abspath(os.path.join(conf.env['WITH_
OPENFLOW'],'build','default'))] | 97 conf.env['LIBPATH_OPENFLOW'] = [os.path.abspath(os.path.join(conf.env['WITH_
OPENFLOW'],'build','default'))] |
87 ···· | 98 ···· |
88 conf.env['OPENFLOW'] = conf.check(fragment=test_code, lib='openflow', uselib
='OPENFLOW DL XML2') | 99 conf.env['OPENFLOW'] = conf.check(fragment=test_code, lib='openflow', uselib
='OPENFLOW DL XML2') |
89 conf.report_optional_feature("openflow", "NS-3 OpenFlow Integration", | 100 conf.report_optional_feature("openflow", "NS-3 OpenFlow Integration", |
90 conf.env['OPENFLOW'], "openflow library not found") | 101 conf.env['OPENFLOW'], "openflow library not found") |
91 if conf.env['OPENFLOW']: | 102 if conf.env['OPENFLOW']: |
| 103 conf.env['ENABLE_OPENFLOW'] = True |
92 conf.env.append_value('CXXDEFINES', 'NS3_OPENFLOW') | 104 conf.env.append_value('CXXDEFINES', 'NS3_OPENFLOW') |
93 conf.env.append_value('CPPPATH', conf.env['CPPPATH_OPENFLOW'])· | 105 conf.env.append_value('CPPPATH', conf.env['CPPPATH_OPENFLOW'])· |
94 | 106 |
95 def build(bld): | 107 def build(bld): |
96 # Build the Switch module | 108 # Build the Switch module |
97 obj = bld.create_ns3_module('openflow', ['internet']) | 109 obj = bld.create_ns3_module('openflow', ['internet']) |
98 obj.source = [ | 110 obj.source = [ |
99 'model/openflow-interface.cc', | |
100 'model/openflow-switch-net-device.cc', | |
101 'helper/openflow-switch-helper.cc', | |
102 'test/openflow-switch-test-suite.cc', | |
103 ] | 111 ] |
104 | 112 |
105 if bld.env['OPENFLOW'] and bld.env['DL'] and bld.env['XML2']: | 113 if bld.env['OPENFLOW'] and bld.env['DL'] and bld.env['XML2']: |
106 obj.uselib = 'OPENFLOW DL XML2'· | 114 obj.uselib = 'OPENFLOW DL XML2'· |
107 | 115 |
108 headers = bld.new_task_gen('ns3header') | 116 headers = bld.new_task_gen('ns3header') |
109 headers.module = 'openflow' | 117 headers.module = 'openflow' |
110 headers.source = [ | 118 headers.source = [ |
111 'model/openflow-interface.h', | |
112 'model/openflow-switch-net-device.h', | |
113 'helper/openflow-switch-helper.h', | |
114 ] | 119 ] |
115 | 120 |
116 if bld.env['ENABLE_EXAMPLES'] and bld.env['OPENFLOW']: | 121 if bld.env['ENABLE_OPENFLOW']: |
| 122 » obj.source.append('model/openflow-interface.cc') |
| 123 obj.source.append('model/openflow-switch-net-device.cc') |
| 124 » obj.source.append('helper/openflow-switch-helper.cc') |
| 125 » obj.source.append('test/openflow-switch-test-suite.cc') |
| 126 » headers.source.append('model/openflow-interface.h') |
| 127 headers.source.append('model/openflow-switch-net-device.h') |
| 128 » headers.source.append('helper/openflow-switch-helper.h') |
| 129 |
| 130 if bld.env['ENABLE_EXAMPLES'] and bld.env['ENABLE_OPENFLOW']: |
117 bld.add_subdirs('examples') | 131 bld.add_subdirs('examples') |
LEFT | RIGHT |