summaryrefslogtreecommitdiffstats
path: root/resource-assignment/provider/src/test/resources/test-context.xml
blob: c3b09a1f5aa9d1cb9f550540115829106626ffdb (plain)
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
<?xml version="1.0" encoding="utf-8"?>
<!--
  ============LICENSE_START=======================================================
  openECOMP : SDN-C
  ================================================================================
  Copyright (C) 2017 AT&T Intellectual Property. All rights
                          reserved.
  ================================================================================
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at
  
       http://www.apache.org/licenses/LICENSE-2.0
  
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
  ============LICENSE_END=========================================================
  -->

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jdbc="http://www.springframework.org/schema/jdbc"
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
    http://www.springframework.org/schema/jdbc
    http://www.springframework.org/schema/jdbc/spring-jdbc-3.1.xsd
    http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context-3.1.xsd
                    ">

    <context:annotation-config />

    <!-- JDBC setup -->

    <bean id="test.dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource" lazy-init="false">
        <property name="driverClassName" value="org.h2.Driver" />
        <property name="url" value="jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;MODE=MySQL" />
    </bean>

    <jdbc:initialize-database data-source="test.dataSource">
        <jdbc:script location="sql/schema.sql" />
        <jdbc:script location="sql/data.sql" />
    </jdbc:initialize-database>

    <bean id="rm.jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
        <property name="dataSource" ref="test.dataSource" />
    </bean>

    <bean id="testDb" class="jtest.util.org.onap.ccsdk.sli.adaptors.ra.TestDb">
        <property name="jdbcTemplate" ref="rm.jdbcTemplate" />
    </bean>

    <bean id="dataSetup" class="jtest.org.onap.ccsdk.sli.adaptors.ra.DataSetup">
        <property name="testDb" ref="testDb" />
    </bean>

    <!-- Utils Configuration -->

    <bean id="speedUtil" class="org.onap.ccsdk.sli.adaptors.util.speed.SpeedUtil">
        <property name="unitFactor" value="1000" />
    </bean>

    <!-- Resource Lock Configuration -->

    <bean id="resourceLockDao" class="org.onap.ccsdk.sli.adaptors.lock.dao.ResourceLockDaoImpl">
        <property name="jdbcTemplate" ref="rm.jdbcTemplate" />
        <property name="testing" value="true" />
    </bean>

    <bean id="lockHelper" class="org.onap.ccsdk.sli.adaptors.lock.comp.LockHelperImpl">
        <property name="resourceLockDao" ref="resourceLockDao" />
        <property name="retryCount" value="10" />
        <property name="lockWait" value="5" /> <!-- Seconds -->
    </bean>

    <!-- RM Configuration -->

    <bean id="resourceJdbcDao" class="org.onap.ccsdk.sli.adaptors.rm.dao.jdbc.ResourceJdbcDaoImpl">
        <property name="jdbcTemplate" ref="rm.jdbcTemplate" />
    </bean>

    <bean id="allocationItemJdbcDao" class="org.onap.ccsdk.sli.adaptors.rm.dao.jdbc.AllocationItemJdbcDaoImpl">
        <property name="jdbcTemplate" ref="rm.jdbcTemplate" />
    </bean>

    <bean id="resourceLoadJdbcDao" class="org.onap.ccsdk.sli.adaptors.rm.dao.jdbc.ResourceLoadJdbcDaoImpl">
        <property name="jdbcTemplate" ref="rm.jdbcTemplate" />
    </bean>

    <bean id="resourceDao" class="org.onap.ccsdk.sli.adaptors.rm.dao.jdbc.ResourceDaoImpl">
        <property name="resourceJdbcDao" ref="resourceJdbcDao" />
        <property name="allocationItemJdbcDao" ref="allocationItemJdbcDao" />
        <property name="resourceLoadJdbcDao" ref="resourceLoadJdbcDao" />
    </bean>

    <bean id="resourceManager" class="org.onap.ccsdk.sli.adaptors.rm.comp.ResourceManagerImpl">
        <property name="lockHelper" ref="lockHelper" />
        <property name="resourceDao" ref="resourceDao" />
        <property name="applicationId" value="SDNC" />
        <property name="lockTimeout" value="600" /> <!-- Seconds -->
    </bean>

    <!-- Equipment DAO Configuration -->

    <bean id="serverDao" class="org.onap.ccsdk.sli.adaptors.ra.equip.dao.ServerDaoImpl">
        <property name="jdbcTemplate" ref="rm.jdbcTemplate" />
    </bean>

    <bean id="vpePortDao" class="org.onap.ccsdk.sli.adaptors.ra.equip.dao.VpePortDaoImpl">
        <property name="jdbcTemplate" ref="rm.jdbcTemplate" />
    </bean>

    <bean id="vplspePortDao" class="org.onap.ccsdk.sli.adaptors.ra.equip.dao.VplspePortDaoImpl">
        <property name="jdbcTemplate" ref="rm.jdbcTemplate" />
    </bean>

    <!-- Rule DAO Configuration -->

    <bean id="maxPortSpeedDao" class="org.onap.ccsdk.sli.adaptors.ra.rule.dao.MaxPortSpeedDaoImpl">
        <property name="jdbcTemplate" ref="rm.jdbcTemplate" />
        <property name="speedUtil" ref="speedUtil" />
    </bean>

    <bean id="maxServerSpeedDao" class="org.onap.ccsdk.sli.adaptors.ra.rule.dao.MaxServerSpeedDaoImpl">
        <property name="jdbcTemplate" ref="rm.jdbcTemplate" />
        <property name="speedUtil" ref="speedUtil" />
    </bean>

    <bean id="resourceRuleDao" class="org.onap.ccsdk.sli.adaptors.ra.rule.dao.ResourceRuleDaoImpl">
        <property name="jdbcTemplate" ref="rm.jdbcTemplate" />
    </bean>

    <bean id="rangeRuleDao" class="org.onap.ccsdk.sli.adaptors.ra.rule.dao.RangeRuleDaoImpl">
        <property name="jdbcTemplate" ref="rm.jdbcTemplate" />
    </bean>

    <bean id="vpeLockDao" class="org.onap.ccsdk.sli.adaptors.ra.rule.dao.VpeLockDaoImpl">
        <property name="jdbcTemplate" ref="rm.jdbcTemplate" />
    </bean>

    <bean id="parameterDao" class="org.onap.ccsdk.sli.adaptors.ra.rule.dao.ParameterDaoImpl">
        <property name="jdbcTemplate" ref="rm.jdbcTemplate" />
    </bean>

    <!-- Service DAO Configuration -->

    <bean id="serviceResourceDao" class="org.onap.ccsdk.sli.adaptors.ra.service.dao.ServiceResourceDaoImpl">
        <property name="jdbcTemplate" ref="rm.jdbcTemplate" />
    </bean>

    <!-- ResourceAllocator Configuration -->

    <bean id="allocationRequestBuilder" class="org.onap.ccsdk.sli.adaptors.ra.rule.comp.AllocationRequestBuilderImpl">
        <property name="resourceRuleDao" ref="resourceRuleDao" />
        <property name="rangeRuleDao" ref="rangeRuleDao" />
    </bean>

    <bean id="resourceAllocator" class="org.onap.ccsdk.sli.adaptors.ra.ResourceAllocator">
        <property name="speedUtil" ref="speedUtil" />
        <property name="parameterDao" ref="parameterDao" />
        <property name="serverDao" ref="serverDao" />
        <property name="vpePortDao" ref="vpePortDao" />
        <property name="vplspePortDao" ref="vplspePortDao" />
        <property name="maxPortSpeedDao" ref="maxPortSpeedDao" />
        <property name="maxServerSpeedDao" ref="maxServerSpeedDao" />
        <property name="serviceResourceDao" ref="serviceResourceDao" />
        <property name="allocationRequestBuilder" ref="allocationRequestBuilder" />
        <property name="resourceManager" ref="resourceManager" />
        <property name="endPointAllocator" ref="endPointAllocator" />
    </bean>

    <!-- EndPointAllocator Configuration -->

    <bean id="endPointAllocator" class="org.onap.ccsdk.sli.adaptors.ra.comp.EndPointAllocatorImpl">
        <property name="resourceManager" ref="resourceManager" />
        <property name="endPointAllocationDefinitionMap">
            <map>
                <entry key="L3AVPN-PORT">
                    <list>
                        <bean class="org.onap.ccsdk.sli.adaptors.ra.comp.EndPointAllocationDefinition">
                            <property name="serviceModel" value="L3AVPN-PORT" />
                            <property name="endPointPosition" value="VPE-Cust" />
                            <property name="equipmentReader" ref="vpePortReader" />
                            <property name="equipmentCheckList">
                                <list>
                                    <ref bean="provStatusCheck" />
                                    <ref bean="excludeVpeCheck" />
                                    <ref bean="anyVrfPresentCheck" />
                                </list>
                            </property>
                            <property name="preferenceRuleList">
                                <list>
                                    <ref bean="affinityLinkPref" />
                                </list>
                            </property>
                            <property name="allocationRuleList">
                                <list>
                                    <ref bean="dbAllocationRule" />
                                    <ref bean="affinityAllocationRule" />
                                </list>
                            </property>
                        </bean>
                    </list>
                </entry>
                <entry key="L3AVPN-EVC">
                    <list>
                        <bean class="org.onap.ccsdk.sli.adaptors.ra.comp.EndPointAllocationDefinition">
                            <property name="serviceModel" value="L3AVPN-EVC" />
                            <property name="endPointPosition" value="VPE-Cust" />
                            <property name="equipmentReader" ref="vpePortReader" />
                            <property name="equipmentCheckList">
                                <list>
                                    <ref bean="provStatusCheck" />
                                    <ref bean="excludeVpeCheck" />
                                    <ref bean="vpeLockCheck" />
                                    <ref bean="anyVrfPresentCheck" />
                                    <ref bean="oneMVrfCheck" />
                                    <ref bean="hubWithRgCheck" />
                                </list>
                            </property>
                            <property name="preferenceRuleList">
                                <list>
                                    <ref bean="affinityLinkPref" />
                                </list>
                            </property>
                            <property name="allocationRuleList">
                                <list>
                                    <ref bean="dbAllocationRule" />
                                    <ref bean="vrfAllocationRule" />
                                    <ref bean="servingSiteAllocationRule" />
                                    <ref bean="affinityAllocationRule" />
                                </list>
                            </property>
                        </bean>
                    </list>
                </entry>
            </map>
        </property>
    </bean>

    <!-- Equipment Readers Configuration -->

    <bean id="vpePortReader" class="org.onap.ccsdk.sli.adaptors.ra.reader.VpePortReader">
        <property name="vpePortDao" ref="vpePortDao" />
    </bean>

    <!-- Equipment Checks Configuration -->

    <bean id="provStatusCheck" class="org.onap.ccsdk.sli.adaptors.ra.check.ProvStatusCheck">
    </bean>

    <bean id="excludeVpeCheck" class="org.onap.ccsdk.sli.adaptors.ra.check.ExcludeVpeCheck">
    </bean>

    <bean id="vpeLockCheck" class="org.onap.ccsdk.sli.adaptors.ra.check.VpeLockCheck">
        <property name="vpeLockDao" ref="vpeLockDao" />
        <property name="resourceManager" ref="resourceManager" />
    </bean>

    <bean id="anyVrfPresentCheck" class="org.onap.ccsdk.sli.adaptors.ra.check.AnyVrfPresentCheck">
        <property name="resourceManager" ref="resourceManager" />
    </bean>

    <bean id="oneMVrfCheck" class="org.onap.ccsdk.sli.adaptors.ra.check.OneMVrfCheck">
        <property name="resourceManager" ref="resourceManager" />
    </bean>

    <bean id="hubWithRgCheck" class="org.onap.ccsdk.sli.adaptors.ra.check.HubWithRgCheck">
        <property name="resourceManager" ref="resourceManager" />
    </bean>

    <!-- Preference Rule Configuration -->

    <bean id="affinityLinkPref" class="org.onap.ccsdk.sli.adaptors.ra.pref.AffinityLinkPref">
        <property name="resourceManager" ref="resourceManager" />
    </bean>

    <!-- Resource Allocation Rule Configuration -->

    <bean id="dbAllocationRule" class="org.onap.ccsdk.sli.adaptors.ra.alloc.DbAllocationRule">
        <property name="resourceRuleDao" ref="resourceRuleDao" />
        <property name="rangeRuleDao" ref="rangeRuleDao" />
    </bean>

    <bean id="vrfAllocationRule" class="org.onap.ccsdk.sli.adaptors.ra.alloc.VrfAllocationRule">
    </bean>

    <bean id="servingSiteAllocationRule" class="org.onap.ccsdk.sli.adaptors.ra.alloc.ServingSiteAllocationRule">
    </bean>

    <bean id="affinityAllocationRule" class="org.onap.ccsdk.sli.adaptors.ra.alloc.AffinityAllocationRule">
    </bean>

</beans>