/
SConscript
155 lines (130 loc) · 5.27 KB
/
SConscript
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# -*- mode: python; -*-
#
# Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
#
import sys
Import('AgentEnv')
env = AgentEnv.Clone()
# Generate the sandesh UVE source files
vrouter_pkg = env.SandeshGenPy('vrouter.sandesh', 'vrouter/', False)
virtual_machine_pkg = env.SandeshGenPy('virtual_machine.sandesh', 'vrouter/sandesh/', False)
virtual_network_pkg = env.SandeshGenPy('virtual_network.sandesh', 'vrouter/sandesh/', False)
cpuinfo_pkg = env.SandeshGenPy('#controller/src/base/sandesh/cpuinfo.sandesh', 'vrouter/vrouter/', False)
process_info_pkg = env.SandeshGenPy('#controller/src/base/sandesh/process_info.sandesh', 'vrouter/vrouter/', False)
port_bmap_pkg = env.SandeshGenPy('port_bmap.sandesh', 'vrouter/sandesh/virtual_machine/', False)
flow_pkg = env.SandeshGenPy('#controller/src/sandesh/common/flow.sandesh', 'vrouter/sandesh/', False)
env.Depends(cpuinfo_pkg, vrouter_pkg)
env.Depends(process_info_pkg, vrouter_pkg)
env.Depends(port_bmap_pkg, virtual_machine_pkg)
setup_sources = [
'setup.py',
'MANIFEST.in',
]
setup_sources_rules = []
for file in setup_sources:
setup_sources_rules.append(env.Install("", "#controller/src/vnsw/agent/uve/" + file))
vrouter_sources = [
'cpuinfo.py',
]
vrouter_sources_rules = []
for file in vrouter_sources:
vrouter_sources_rules.append(env.Install('vrouter', '#controller/src/vnsw/agent/uve/' + file))
sandesh_init_rules = []
sandesh_init_rules.append(env.Install('vrouter', env['TOP'] + '/vnsw/agent/uve/vrouter/vrouter/__init__.py'))
sandesh_init_rules.append(env.Install('vrouter/sandesh', env['TOP'] + '/vnsw/agent/uve/vrouter/vrouter/__init__.py'))
env.Depends(sandesh_init_rules, vrouter_pkg)
rel_path = Dir('vrouter').path
def BuildInfoAction(target, source, env):
env.GenerateBuildInfoPyCode(path=rel_path)
build_info_rules = [env.Command(target='buildinfo.py', source = None, action=BuildInfoAction)]
sdist_depends = []
sdist_depends.extend(setup_sources_rules)
sdist_depends.extend(vrouter_sources_rules)
sdist_depends.extend(vrouter_pkg)
sdist_depends.extend(cpuinfo_pkg)
sdist_depends.extend(process_info_pkg)
sdist_depends.extend(virtual_machine_pkg)
sdist_depends.extend(virtual_network_pkg)
sdist_depends.extend(port_bmap_pkg)
sdist_depends.extend(sandesh_init_rules)
sdist_depends.extend(build_info_rules)
sdist_depends.extend(flow_pkg)
cd_cmd = 'cd ' + Dir('.').path + ' && '
sdist_gen = env.Command('dist', 'setup.py', cd_cmd + 'python setup.py sdist')
env.Depends(sdist_gen, sdist_depends)
env.Default(sdist_gen)
env.Alias("vrouter:node_mgr", sdist_gen)
# Generate the C++ source files
SandeshGenFiles = env.SandeshGenCpp('interface.sandesh')
SandeshGenFiles += env.SandeshGenCpp('port_bmap.sandesh')
SandeshGenFiles += env.SandeshGenCpp('vrouter.sandesh')
SandeshGenFiles += env.SandeshGenCpp('virtual_machine.sandesh')
SandeshGenFiles += env.SandeshGenCpp('virtual_network.sandesh')
SandeshGenFiles += env.SandeshGenCpp('acl.sandesh')
SandeshGenFiles += env.SandeshGenCpp('prouter.sandesh')
SandeshGenSrcs = env.ExtractCpp(SandeshGenFiles)
SandeshGenObjs = env.Object(SandeshGenSrcs)
StatsSandeshGenFiles = env.SandeshGenCpp('stats_interval.sandesh')
StatsSandeshGenSrcs = env.ExtractCpp(StatsSandeshGenFiles)
StatsSandeshGenObjs = env.Object(StatsSandeshGenSrcs)
AgentStatsSandeshGenFiles = env.SandeshGenCpp('agent_stats_interval.sandesh')
AgentStatsSandeshGenSrcs = env.ExtractCpp(AgentStatsSandeshGenFiles)
AgentStatsSandeshGenObjs = env.Object(AgentStatsSandeshGenSrcs)
libuve = env.Library('uve',
SandeshGenObjs +
[
'agent_uve_base.cc',
'interface_uve_table.cc',
'l4_port_bitmap.cc',
'prouter_uve_table.cc',
'vm_uve_entry_base.cc',
'vm_uve_table_base.cc',
'vn_uve_entry_base.cc',
'vn_uve_table_base.cc',
'vrouter_stats_collector.cc',
'vrouter_uve_entry_base.cc'
])
libstatsuve = env.Library('statsuve',
StatsSandeshGenObjs +
[
'agent_uve.cc',
'interface_uve_stats_table.cc',
'stats_manager.cc',
'vm_stat.cc',
'vm_uve_entry.cc',
'vm_uve_table.cc',
'vn_uve_entry.cc',
'vn_uve_table.cc',
'vrouter_uve_entry.cc',
])
Import('BuildEnv')
mockEnv = BuildEnv.Clone()
def MapBuildDir(list):
return map(lambda x: Dir('../../../' + x).abspath, list)
mockEnv.Prepend(LIBS=[
'sandeshflow',
'sandeshvns',
'sandesh',
'http',
'http_parser',
'process_info',
'io',
'sandesh',
'base',
'boost_program_options',
'curl',
'pugixml',
'rt'
])
if sys.platform != 'darwin':
mockEnv.Append(LIBS = ['rt'])
libpath = MapBuildDir(
[
'base',
'io',
])
mockEnv.Append(LIBPATH=libpath)
mockgen = mockEnv.Program('mock_generator',
['mock_generator.cc'])
mockEnv.Alias("vrouter:mock_gen", mockgen)
env.SConscript('test/SConscript', exports='AgentEnv', duplicate=0)