2 * Copyright 2016-2017 ZTE Corporation.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org.onap.aai.esr;
19 import org.onap.aai.esr.externalservice.aai.AaiAdapterConfig;
20 import org.onap.aai.esr.externalservice.msb.MsbHelper;
21 import org.onap.aai.esr.externalservice.msb.MsbInfoConfig;
22 import org.onap.aai.esr.resource.EmsManager;
23 import org.onap.aai.esr.resource.ThirdpatySdncManager;
24 import org.onap.aai.esr.resource.VimManager;
25 import org.onap.aai.esr.resource.VnfmManager;
26 import org.onap.msb.sdk.httpclient.msb.MSBServiceClient;
27 import org.slf4j.Logger;
28 import org.slf4j.LoggerFactory;
30 import io.dropwizard.Application;
31 import io.dropwizard.setup.Environment;
33 public class ExtsysApp extends Application<ExtsysAppConfiguration> {
35 private static final Logger LOGGER = LoggerFactory.getLogger(ExtsysApp.class);
37 public static void main(String[] args) throws Exception {
38 new ExtsysApp().run(args);
42 public String getName() {
47 public void run(ExtsysAppConfiguration configuration, Environment environment) {
48 LOGGER.info("Start to initialize esr.");
49 AaiAdapterConfig.setCloudInfrastructureAddr(configuration.getCloudInfrastructureAddr());
50 AaiAdapterConfig.setExternalSystemAddr(configuration.getExternalSystemAddr());
51 MsbInfoConfig.setMsbDiscoveryIp(configuration.getMsbDiscoveryIp());
52 MsbInfoConfig.setMsbDiscoveryPort(configuration.getMsbDiscoveryPort());
53 environment.jersey().register(new EmsManager());
54 environment.jersey().register(new ThirdpatySdncManager());
55 environment.jersey().register(new VimManager());
56 environment.jersey().register(new VnfmManager());
58 if (configuration.getRegistByHand().endsWith("true")){
59 String MSB_IP=configuration.getMsbDiscoveryIp();
60 Integer MSB_Port= Integer.valueOf(configuration.getMsbDiscoveryPort());
61 MSBServiceClient msbClient = new MSBServiceClient(MSB_IP, MSB_Port);
62 MsbHelper helper = new MsbHelper(msbClient);
65 } catch (Exception e) {
66 LOGGER.error("Register esr-server to msb by java-sdk failed", e);
69 LOGGER.info("Initialize extsys finished.");