diff options
Diffstat (limited to 'esr-mgr/src/main/java')
42 files changed, 3429 insertions, 0 deletions
diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/ExtsysApp.java b/esr-mgr/src/main/java/org/onap/aai/esr/ExtsysApp.java new file mode 100644 index 0000000..6552d95 --- /dev/null +++ b/esr-mgr/src/main/java/org/onap/aai/esr/ExtsysApp.java @@ -0,0 +1,101 @@ +/** + * Copyright 2016-2017 ZTE Corporation. + * + * 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. + */ +package org.onap.aai.esr; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.dropwizard.Application; +import io.dropwizard.assets.AssetsBundle; +import io.dropwizard.server.SimpleServerFactory; +import io.dropwizard.setup.Bootstrap; +import io.dropwizard.setup.Environment; +import io.swagger.jaxrs.config.BeanConfig; +import io.swagger.jaxrs.listing.ApiListingResource; + +import org.glassfish.jersey.media.multipart.MultiPartFeature; +import org.onap.aai.esr.common.Config; +import org.onap.aai.esr.externalservice.msb.MsbHelper; +import org.onap.msb.sdk.httpclient.msb.MSBServiceClient; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class ExtsysApp extends Application<ExtsysAppConfiguration> { + + private static final Logger LOGGER = LoggerFactory.getLogger(ExtsysApp.class); + + public static void main(String[] args) throws Exception { + new ExtsysApp().run(args); + } + + @Override + public String getName() { + return "ONAP-ESR"; + } + + + @Override + public void initialize(Bootstrap<ExtsysAppConfiguration> bootstrap) { + bootstrap.addBundle(new AssetsBundle("/api-doc", "/api-doc", "index.html", "api-doc")); + } + + @Override + public void run(ExtsysAppConfiguration configuration, Environment environment) { + LOGGER.info("Start to initialize esr."); + environment.jersey().packages("org.onap.aai.esr.resource"); + environment.jersey().register(MultiPartFeature.class); + String MSB_IP=configuration.getMsbIp(); + int MSB_Port=configuration.getMsbPort(); + + initSwaggerConfig(environment, configuration); + Config.setConfigration(configuration); + MSBServiceClient msbClient = new MSBServiceClient(MSB_IP, MSB_Port); + + MsbHelper helper = new MsbHelper(msbClient); + try { + helper.registerMsb(); + } catch (Exception e) { + LOGGER.error("Register ESR to msb failed", e); + } + + LOGGER.info("Initialize extsys finished."); + } + + /** + * initialize swagger configuration. + * + * @param environment environment information + * @param configuration configuration + */ + private void initSwaggerConfig(Environment environment, ExtsysAppConfiguration configuration) { + environment.jersey().register(new ApiListingResource()); + environment.getObjectMapper().setSerializationInclusion(JsonInclude.Include.NON_NULL); + + BeanConfig config = new BeanConfig(); + config.setTitle("Open-o ExtSys Service rest API"); + config.setVersion("1.0.0"); + config.setResourcePackage("org.onap.aai.esr.resource"); + // set rest api basepath in swagger + SimpleServerFactory simpleServerFactory = + (SimpleServerFactory) configuration.getServerFactory(); + String basePath = simpleServerFactory.getApplicationContextPath(); + String rootPath = simpleServerFactory.getJerseyRootPath(); + rootPath = rootPath.substring(0, rootPath.indexOf("/*")); + basePath = basePath.equals("/") ? rootPath + : (new StringBuilder()).append(basePath).append(rootPath).toString(); + config.setBasePath(basePath); + config.setScan(true); + } + +} diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/ExtsysAppConfiguration.java b/esr-mgr/src/main/java/org/onap/aai/esr/ExtsysAppConfiguration.java new file mode 100644 index 0000000..862c6a5 --- /dev/null +++ b/esr-mgr/src/main/java/org/onap/aai/esr/ExtsysAppConfiguration.java @@ -0,0 +1,106 @@ +/** + * Copyright 2016-2017 ZTE Corporation. + * + * 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. + */ + +package org.onap.aai.esr; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.dropwizard.Configuration; +import io.dropwizard.db.DataSourceFactory; +import org.hibernate.validator.constraints.NotEmpty; + +import javax.validation.Valid; +import javax.validation.constraints.NotNull; + + + +public class ExtsysAppConfiguration extends Configuration { + @NotEmpty + private String template; + + @NotEmpty + private String defaultName = "ONAP-A&AI-ESR"; + + @NotEmpty + private String msbIp; + + @NotEmpty + private int msbPort; + + @NotEmpty + private String msbServerAddr; + + @Valid + private String serviceIp; + + @JsonProperty + public String getTemplate() { + return template; + } + + @JsonProperty + public void setTemplate(String template) { + this.template = template; + } + + @JsonProperty + public String getDefaultName() { + return defaultName; + } + + @JsonProperty + public void setDefaultName(String name) { + this.defaultName = name; + } + + @JsonProperty + public String getMsbIp() { + return msbIp; + } + + @JsonProperty + public String setMsbIp() { + return msbIp; + } + + @JsonProperty + public int getMsbPort() { + return msbPort; + } + + @JsonProperty + public int setMsbPort() { + return msbPort; + } + + @JsonProperty + public String getMsbServerAddr() { + return msbServerAddr; + } + + @JsonProperty + public void setMsbServerAddr(String msbServerAddr) { + this.msbServerAddr = msbServerAddr; + } + @JsonProperty + public String getServiceIp() { + return serviceIp; + } + + @JsonProperty + public void setServiceIp(String serviceIp) { + this.serviceIp = serviceIp; + } +} diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/common/Config.java b/esr-mgr/src/main/java/org/onap/aai/esr/common/Config.java new file mode 100644 index 0000000..3826bf8 --- /dev/null +++ b/esr-mgr/src/main/java/org/onap/aai/esr/common/Config.java @@ -0,0 +1,32 @@ +/** + * Copyright 2016-2017 ZTE Corporation. + * + * 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. + */ + +package org.onap.aai.esr.common; + +import org.onap.aai.esr.ExtsysAppConfiguration; + + +public class Config { + private static ExtsysAppConfiguration configration; + + public static ExtsysAppConfiguration getConfigration() { + return configration; + } + + public static void setConfigration(ExtsysAppConfiguration config) { + configration = config; + } +} diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/common/ExtSysResuorceType.java b/esr-mgr/src/main/java/org/onap/aai/esr/common/ExtSysResuorceType.java new file mode 100644 index 0000000..650cca8 --- /dev/null +++ b/esr-mgr/src/main/java/org/onap/aai/esr/common/ExtSysResuorceType.java @@ -0,0 +1,26 @@ +/** + * Copyright 2016-2017 ZTE Corporation. + * + * 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. + */ + +package org.onap.aai.esr.common; + + +public enum ExtSysResuorceType { + VIM, SDNC, EMS, VNFM, BASE; + + public static ExtSysResuorceType getType(String type) { + return valueOf(type); + } +} diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/common/MsbUtil.java b/esr-mgr/src/main/java/org/onap/aai/esr/common/MsbUtil.java new file mode 100644 index 0000000..0bd4f01 --- /dev/null +++ b/esr-mgr/src/main/java/org/onap/aai/esr/common/MsbUtil.java @@ -0,0 +1,29 @@ +/** + * Copyright 2017 ZTE Corporation. + * + * 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. + */ +package org.onap.aai.esr.common; + + +public class MsbUtil { + +// public static String getVimBaseUrl() { +// return Config.getConfigration().getMsbServerAddr() + "/api/vim/v1"; +// } +// +// public static String getAaiServiceUrl() { +// return Config.getConfigration().getMsbServerAddr() + "/aai/v11/"; +// } + +} diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/common/Parameters.java b/esr-mgr/src/main/java/org/onap/aai/esr/common/Parameters.java new file mode 100644 index 0000000..0e80e24 --- /dev/null +++ b/esr-mgr/src/main/java/org/onap/aai/esr/common/Parameters.java @@ -0,0 +1,27 @@ +/** + * Copyright 2016-2017 ZTE Corporation. + * + * 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. + */ + +package org.onap.aai.esr.common; + +/** + * Parameters. <br/> + * + * @author sun qi + * @version ESR V1 + */ +public enum Parameters { + emsId, sdnControllerId, vimId, vnfmId, id +} diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/BaseData.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/BaseData.java new file mode 100644 index 0000000..3f3f491 --- /dev/null +++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/BaseData.java @@ -0,0 +1,116 @@ +/** + * Copyright 2016-2017 ZTE Corporation. + * + * 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. + */ +package org.onap.aai.esr.entity.aai; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Inheritance; +import javax.persistence.InheritanceType; +import javax.persistence.Table; + +@Entity +@Table(name = "extsys_base_table") +@Inheritance(strategy = InheritanceType.JOINED) +public class BaseData { + @Id + @Column(name = "ID") + private String id; + + @Column(name = "NAME") + private String name; + + @Column(name = "VENDOR") + private String vendor; + + @Column(name = "VERSION") + private String version; + + @Column(name = "DESCRIPTION") + private String description; + + @Column(name = "TYPE") + private String type; + @Column(name = "CREATETIME") + private String createTime; + @Column(name = "CATAGORY") + private String category; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getVendor() { + return vendor; + } + + public void setVendor(String vendor) { + this.vendor = vendor; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getCategory() { + return category; + } + + public void setCategory(String category) { + this.category = category; + } + +} diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EmsData.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EmsData.java new file mode 100644 index 0000000..dc7fbed --- /dev/null +++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EmsData.java @@ -0,0 +1,81 @@ +/** + * Copyright 2016-2017 ZTE Corporation. + * + * 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. + */ +package org.onap.aai.esr.entity.aai; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.PrimaryKeyJoinColumn; +import javax.persistence.Table; + + + +@Entity +@Table(name = "extsys_ems_table") +@PrimaryKeyJoinColumn(name = "EMSID") +@JsonIgnoreProperties(ignoreUnknown = true) +public class EmsData extends BaseData { + + + @Column(name = "PRODUCTNAME") + private String productName; + + @Column(name = "URL") + private String url; + + @Column(name = "USERNAME") + private String userName; + + @Column(name = "PASSWORD") + private String password; + + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getProductName() { + return productName; + } + + public void setProductName(String productName) { + this.productName = productName; + } + + + +} diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/SdncData.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/SdncData.java new file mode 100644 index 0000000..c7b022d --- /dev/null +++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/SdncData.java @@ -0,0 +1,88 @@ +/** + * Copyright 2016-2017 ZTE Corporation. + * + * 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. + */ +package org.onap.aai.esr.entity.aai; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.PrimaryKeyJoinColumn; +import javax.persistence.Table; + + + +@Entity +@Table(name = "extsys_sdnc_table") +@PrimaryKeyJoinColumn(name = "SDNCONTROLLERID") +@JsonIgnoreProperties(ignoreUnknown = true) +public class SdncData extends BaseData { + + @Column(name = "URL") + private String url; + + @Column(name = "USERNAME") + private String userName; + + @Column(name = "PASSWORD") + private String password; + + @Column(name = "PRODUCTNAME") + private String productName; + + @Column(name = "PROTOCOL") + private String protocol; + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getProductName() { + return productName; + } + + public void setProductName(String productName) { + this.productName = productName; + } + + public String getProtocol() { + return protocol; + } + + public void setProtocol(String protocol) { + this.protocol = protocol; + } + +} diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/VimData.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/VimData.java new file mode 100644 index 0000000..0b546a8 --- /dev/null +++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/VimData.java @@ -0,0 +1,87 @@ +/** + * Copyright 2016-2017 ZTE Corporation. + * + * 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. + */ +package org.onap.aai.esr.entity.aai; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.PrimaryKeyJoinColumn; +import javax.persistence.Table; + +@Entity +@Table(name = "extsys_vim_table") +@PrimaryKeyJoinColumn(name = "VIMID") +@JsonIgnoreProperties(ignoreUnknown = true) +public class VimData extends BaseData { + + + @Column(name = "URL") + private String url; + + @Column(name = "USERNAME") + private String userName; + + @Column(name = "PASSWORD") + private String password; + + @Column(name = "DOMAIN") + private String domain; + + @Column(name = "TENANT") + private String tenant; + + public String getDomain() { + return domain; + } + + public void setDomain(String domain) { + this.domain = domain; + } + + public String getTenant() { + return tenant; + } + + public void setTenant(String tenant) { + this.tenant = tenant; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + +} diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/VnfmData.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/VnfmData.java new file mode 100644 index 0000000..795ba96 --- /dev/null +++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/VnfmData.java @@ -0,0 +1,85 @@ +/** + * Copyright 2016-2017 ZTE Corporation. + * + * 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. + */ +package org.onap.aai.esr.entity.aai; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.PrimaryKeyJoinColumn; +import javax.persistence.Table; + +@Entity +@Table(name = "extsys_vnfm_table") +@PrimaryKeyJoinColumn(name = "VNFMID") +@JsonIgnoreProperties(ignoreUnknown = true) +public class VnfmData extends BaseData { + + @Column(name = "URL") + private String url; + @Column(name = "USERNAME") + private String userName; + + @Column(name = "PASSWORD") + private String password; + + @Column(name = "VIMID") + private String vimId; + + @Column(name = "CERTIFICATEURL") + private String certificateUrl; + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getVimId() { + return vimId; + } + + public void setVimId(String vimId) { + this.vimId = vimId; + } + + public String getCertificateUrl() { + return certificateUrl; + } + + public void setCertificateUrl(String certificateUrl) { + this.certificateUrl = certificateUrl; + } + +} diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/AlarmAddr.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/AlarmAddr.java new file mode 100644 index 0000000..d777db3 --- /dev/null +++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/AlarmAddr.java @@ -0,0 +1,59 @@ +/** + * Copyright 2017 ZTE Corporation. + * + * 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. + */ +package org.onap.aai.esr.entity.rest; + +public class AlarmAddr { + + private String ip; + + private String port; + + private String user; + + private String password; + + public String getIp() { + return ip; + } + + public void setIp(String ip) { + this.ip = ip; + } + + public String getPort() { + return port; + } + + public void setPort(String port) { + this.port = port; + } + + public String getUser() { + return user; + } + + public void setUser(String user) { + this.user = user; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } +} diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/AuthInfoItem.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/AuthInfoItem.java new file mode 100644 index 0000000..4e9948a --- /dev/null +++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/AuthInfoItem.java @@ -0,0 +1,79 @@ +/** + * Copyright 2017 ZTE Corporation. + * + * 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. + */ +package org.onap.aai.esr.entity.rest; + +public class AuthInfoItem { + + private String cloudDomain; + + private String userName; + + private String password; + + private String authUrl; + + private String sslCacert; + + private String sslInsecure; + + public String getCloudDomain() { + return cloudDomain; + } + + public void setCloudDomain(String cloudDomain) { + this.cloudDomain = cloudDomain; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getAuthUrl() { + return authUrl; + } + + public void setAuthUrl(String authUrl) { + this.authUrl = authUrl; + } + + public String getSslCacert() { + return sslCacert; + } + + public void setSslCacert(String sslCacert) { + this.sslCacert = sslCacert; + } + + public String getSslInsecure() { + return sslInsecure; + } + + public void setSslInsecure(String sslInsecure) { + this.sslInsecure = sslInsecure; + } +} diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/BaseRestData.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/BaseRestData.java new file mode 100644 index 0000000..540d009 --- /dev/null +++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/BaseRestData.java @@ -0,0 +1,122 @@ +/** + * Copyright 2016-2017 ZTE Corporation. + * + * 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. + */ +package org.onap.aai.esr.entity.rest; + + +public class BaseRestData { + + private String instanceId; + + private String systemName; + + private String vendor; + + private String version; + + private String type; + + private String url; + + private String username; + + private String password; + + private String systemStatus; + + private String systemType; + + public String getInstanceId() { + return instanceId; + } + + public void setInstanceId(String instanceId) { + this.instanceId = instanceId; + } + + public String getSystemName() { + return systemName; + } + + public void setSystemName(String systemName) { + this.systemName = systemName; + } + + public String getVendor() { + return vendor; + } + + public void setVendor(String vendor) { + this.vendor = vendor; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getSystemStatus() { + return systemStatus; + } + + public void setSystemStatus(String systemStatus) { + this.systemStatus = systemStatus; + } + + public String getSystemType() { + return systemType; + } + + public void setSystemType(String systemType) { + this.systemType = systemType; + } + + +} diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/EmsRestData.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/EmsRestData.java new file mode 100644 index 0000000..205fc84 --- /dev/null +++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/EmsRestData.java @@ -0,0 +1,91 @@ +/** + * Copyright 2016-2017 ZTE Corporation. + * + * 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. + */ +package org.onap.aai.esr.entity.rest; + + +public class EmsRestData extends BaseRestData{ + + private String emsId; + + private String name; + + private String vendor; + + private String version; + + private FtpAddr resourceAddr; + + private FtpAddr performanceAddr; + + private AlarmAddr alarmAddr; + + public String getEmsId() { + return emsId; + } + + public void setEmsId(String emsId) { + this.emsId = emsId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getVendor() { + return vendor; + } + + public void setVendor(String vendor) { + this.vendor = vendor; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public FtpAddr getResourceAddr() { + return resourceAddr; + } + + public void setResourceAddr(FtpAddr resourceAddr) { + this.resourceAddr = resourceAddr; + } + + public FtpAddr getPerformanceAddr() { + return performanceAddr; + } + + public void setPerformanceAddr(FtpAddr performanceAddr) { + this.performanceAddr = performanceAddr; + } + + public AlarmAddr getAlarmAddr() { + return alarmAddr; + } + + public void setAlarmAddr(AlarmAddr alarmAddr) { + this.alarmAddr = alarmAddr; + } + +} diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/FtpAddr.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/FtpAddr.java new file mode 100644 index 0000000..fe60469 --- /dev/null +++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/FtpAddr.java @@ -0,0 +1,89 @@ +/** + * Copyright 2017 ZTE Corporation. + * + * 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. + */ +package org.onap.aai.esr.entity.rest; + +public class FtpAddr { + + private String ftptype; + + private String ip; + + private String port; + + private String user; + + private String password; + + private String remotepath; + + private String passive; + + public String getFtptype() { + return ftptype; + } + + public void setFtptype(String ftptype) { + this.ftptype = ftptype; + } + + public String getIp() { + return ip; + } + + public void setIp(String ip) { + this.ip = ip; + } + + public String getPort() { + return port; + } + + public void setPort(String port) { + this.port = port; + } + + public String getUser() { + return user; + } + + public void setUser(String user) { + this.user = user; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getRemotepath() { + return remotepath; + } + + public void setRemotepath(String remotepath) { + this.remotepath = remotepath; + } + + public String getPassive() { + return passive; + } + + public void setPassive(String passive) { + this.passive = passive; + } +} diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/RegisterResponse.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/RegisterResponse.java new file mode 100644 index 0000000..617edf9 --- /dev/null +++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/RegisterResponse.java @@ -0,0 +1,30 @@ +/** + * Copyright 2017 ZTE Corporation. + * + * 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. + */ +package org.onap.aai.esr.entity.rest; + +public class RegisterResponse { + + private String id; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + +} diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/ThirdPartySdncRestData.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/ThirdPartySdncRestData.java new file mode 100644 index 0000000..685e56d --- /dev/null +++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/ThirdPartySdncRestData.java @@ -0,0 +1,134 @@ +/** + * Copyright 2016-2017 ZTE Corporation. + * + * 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. + */ +package org.onap.aai.esr.entity.rest; + +public class ThirdPartySdncRestData { + + private String thirdpartySdncId; + + private String name; + + private String vendor; + + private String version; + + private String type; + + private String location; + + private String url; + + private String userName; + + private String password; + + private String productName; + + private String protocol; + + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getProductName() { + return productName; + } + + public void setProductName(String productName) { + this.productName = productName; + } + + public String getProtocol() { + return protocol; + } + + public void setProtocol(String protocol) { + this.protocol = protocol; + } + + public ThirdPartySdncRestData() { + + } + + public String getThirdpartySdncId() { + return thirdpartySdncId; + } + + public void setThirdpartySdncId(String thirdpartySdncId) { + this.thirdpartySdncId = thirdpartySdncId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getVendor() { + return vendor; + } + + public void setVendor(String vendor) { + this.vendor = vendor; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getLocation() { + return location; + } + + public void setLocation(String location) { + this.location = location; + } +} diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/VimRestData.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/VimRestData.java new file mode 100644 index 0000000..7f07f87 --- /dev/null +++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/VimRestData.java @@ -0,0 +1,110 @@ +/** + * Copyright 2016-2017 ZTE Corporation. + * + * 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. + */ +package org.onap.aai.esr.entity.rest; + +public class VimRestData extends BaseRestData { + + private String cloudOwner; + + private String cloudRegionId; + + private String cloudType; + + private String cloudRegionVersion; + + private String ownerDefinedType; + + private String cloudZone; + + private String complexName; + + private String cloudExtraInfo; + + private AuthInfoItem authInfoItem; + + public String getCloudOwner() { + return cloudOwner; + } + + public void setCloudOwner(String cloudOwner) { + this.cloudOwner = cloudOwner; + } + + public String getCloudRegionId() { + return cloudRegionId; + } + + public void setCloudRegionId(String cloudRegionId) { + this.cloudRegionId = cloudRegionId; + } + + public String getCloudType() { + return cloudType; + } + + public void setCloudType(String cloudType) { + this.cloudType = cloudType; + } + + public String getCloudRegionVersion() { + return cloudRegionVersion; + } + + public void setCloudRegionVersion(String cloudRegionVersion) { + this.cloudRegionVersion = cloudRegionVersion; + } + + public String getOwnerDefinedType() { + return ownerDefinedType; + } + + public void setOwnerDefinedType(String ownerDefinedType) { + this.ownerDefinedType = ownerDefinedType; + } + + public String getCloudZone() { + return cloudZone; + } + + public void setCloudZone(String cloudZone) { + this.cloudZone = cloudZone; + } + + public String getComplexName() { + return complexName; + } + + public void setComplexName(String complexName) { + this.complexName = complexName; + } + + public String getCloudExtraInfo() { + return cloudExtraInfo; + } + + public void setCloudExtraInfo(String cloudExtraInfo) { + this.cloudExtraInfo = cloudExtraInfo; + } + + public AuthInfoItem getAuthInfoItem() { + return authInfoItem; + } + + public void setAuthInfoItem(AuthInfoItem authInfoItem) { + this.authInfoItem = authInfoItem; + } + +} diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/VnfmRestData.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/VnfmRestData.java new file mode 100644 index 0000000..edefe54 --- /dev/null +++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/VnfmRestData.java @@ -0,0 +1,120 @@ +/** + * Copyright 2016-2017 ZTE Corporation. + * + * 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. + */ +package org.onap.aai.esr.entity.rest; + +public class VnfmRestData{ + + private String vnfmId; + + private String name; + + private String type; + + private String vimId; + + private String vendor; + + private String version; + + private String certificateUrl; + + private String url; + + private String userName; + + private String password; + + public String getVnfmId() { + return vnfmId; + } + + public void setVnfmId(String vnfmId) { + this.vnfmId = vnfmId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getVimId() { + return vimId; + } + + public void setVimId(String vimId) { + this.vimId = vimId; + } + + public String getVendor() { + return vendor; + } + + public void setVendor(String vendor) { + this.vendor = vendor; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public String getCertificateUrl() { + return certificateUrl; + } + + public void setCertificateUrl(String certificateUrl) { + this.certificateUrl = certificateUrl; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + +} diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/exception/ExtsysException.java b/esr-mgr/src/main/java/org/onap/aai/esr/exception/ExtsysException.java new file mode 100644 index 0000000..acfa459 --- /dev/null +++ b/esr-mgr/src/main/java/org/onap/aai/esr/exception/ExtsysException.java @@ -0,0 +1,48 @@ +/** + * Copyright 2016-2017 ZTE Corporation. + * + * 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. + */ +package org.onap.aai.esr.exception; + +public class ExtsysException extends Exception { + + private static final long serialVersionUID = 1L; + private String errorCode; + private String errorMsg; + + public String getErrorCode() { + return errorCode; + } + + public void setErrorCode(String errorCode) { + this.errorCode = errorCode; + } + + public String getErrorMsg() { + return errorMsg; + } + + public void setErrorMsg(String errorMsg) { + this.errorMsg = errorMsg; + } + + public ExtsysException() { + super(); + } + + public ExtsysException(String errorCode, String errorMsg) { + this.errorCode = errorCode; + this.errorMsg = errorMsg; + } +} diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/AaiAdapterConfig.java b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/AaiAdapterConfig.java new file mode 100644 index 0000000..68bf1c9 --- /dev/null +++ b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/AaiAdapterConfig.java @@ -0,0 +1,29 @@ +/** + * Copyright 2017 ZTE Corporation. + * + * 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. + */ +package org.onap.aai.esr.externalservice.aai; + +public class AaiAdapterConfig { + + protected static String aaiAdapterAddr; + + public static void setAaiAdapterAddr(String address){ + aaiAdapterAddr = "https://" + address; + } + + public static String getAaiAdapterAddr(){ + return aaiAdapterAddr; + } +} diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/AaiCommon.java b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/AaiCommon.java new file mode 100644 index 0000000..c2088a1 --- /dev/null +++ b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/AaiCommon.java @@ -0,0 +1,62 @@ +/** + * Copyright 2017 ZTE Corporation. + * + * 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. + */ +package org.onap.aai.esr.externalservice.aai; + +import java.io.IOException; +import java.io.StringReader; +import com.sun.jersey.api.client.ClientResponse; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + +import org.w3c.dom.Document; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; + +public class AaiCommon { + + private static String AAI_AUTHENTICATION_USER = "AAI"; + private static String AAI_AUTHENTICATION_PAASWORD = "AAI"; + private static String RESOURCE_VERSION_PARAM = "resource-version"; + +// public String getAuthenticationCredentials() { +// String usernameAndPassword = AAI_AUTHENTICATION_USER + ":" +// + AAI_AUTHENTICATION_PAASWORD; +// return "Basic " + java.util.Base64.getEncoder().encodeToString("AAI:AAI".getBytes()); +// } + + public String getResourceVersion(ClientResponse response) + throws ParserConfigurationException, SAXException, IOException { + String respData = response.getEntity(String.class); + + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + DocumentBuilder builder = factory.newDocumentBuilder(); + InputSource is = new InputSource(new StringReader(respData)); + Document doc = builder.parse(is); + + NodeList nodeList = doc.getDocumentElement().getChildNodes(); + for (int i = 0; i < nodeList.getLength(); i++) { + Node currentNode = nodeList.item(i); + if (currentNode.getNodeName().equals(RESOURCE_VERSION_PARAM)) { + return currentNode.getTextContent(); + } + } + + return null; + } +} diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/AaiServiceConsumer.java b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/AaiServiceConsumer.java new file mode 100644 index 0000000..cbb65ad --- /dev/null +++ b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/AaiServiceConsumer.java @@ -0,0 +1,32 @@ +/** + * Copyright 2017 ZTE Corporation. + * + * 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. + */ +package org.onap.aai.esr.externalservice.aai; + +import org.glassfish.jersey.client.ClientConfig; + +import com.eclipsesource.jaxrs.consumer.ConsumerFactory; + +public class AaiServiceConsumer { + private static IEsrVimRest aaiAdapterProxy; + + static { + ClientConfig config = new ClientConfig(); + aaiAdapterProxy = + ConsumerFactory.createConsumer(AaiAdapterConfig.getAaiAdapterAddr(), + config, IEsrVimRest.class); + } + +} diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/IEsrVimRest.java b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/IEsrVimRest.java new file mode 100644 index 0000000..0c45938 --- /dev/null +++ b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/IEsrVimRest.java @@ -0,0 +1,81 @@ +/** + * Copyright 2017 ZTE Corporation. + * + * 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. + */ + +package org.onap.aai.esr.externalservice.aai; + +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; + +import org.glassfish.jersey.client.ClientResponse; +import org.onap.aai.esr.externalservice.entity.CloudRegion; + +import retrofit2.http.Header; +import retrofit2.http.Headers; + + +@Path("/aai/v11/cloud-infrastructure/cloud-regions") +public interface IEsrVimRest { + +// @Headers({ +// "X-TransactionId: 9999", +// "Accept: application/json", +// "X-FromAppId: aai-esr" +// }) +// @Path("/cloud-region/{cloud_owner}/{cloud_region_id}") +// @PUT +// @Consumes(MediaType.APPLICATION_JSON) +// +// public ClientResponse registerVIMServce(@Header("Authorization") String authorization, @PathParam("cloud_owner") String cloud_owner, +// CloudRegion entity) throws Exception; +// +// @Headers({ +// "X-TransactionId: 9999", +// "Accept: application/json", +// "X-FromAppId: aai-esr" +// }) +// @Path("/cloud-region/{cloud_owner}/{cloud_region_id}?depth=all") +// @GET +// @Produces(MediaType.APPLICATION_JSON) +// public ClientResponse queryVIMDetail(@Header("Authorization") String authorization, @PathParam("cloud_owner") String cloud_owner, +// @PathParam("cloud_region_id") String cloud_region_id) throws Exception; +// +// @Headers({ +// "X-TransactionId: 9999", +// "Accept: application/json", +// "X-FromAppId: aai-esr" +// }) +// @Path("/") +// @GET +// @Produces(MediaType.APPLICATION_JSON) +// public ClientResponse queryVIMList(@Header("Authorization") String authorization) throws Exception; +// +// +// @Headers({ +// "X-TransactionId: 9999", +// "Accept: application/json", +// "X-FromAppId: aai-esr" +// }) +// @Path("/cloud-region/{cloud_owner}/{cloud_region_id}/esr-system-info/{esr_system_info_id}") +// @GET +// public ClientResponse delVIMAuthInfo(@Header("Authorization") String authorization, @PathParam("cloud_owner") String cloud_owner, +// @PathParam("cloud_region_id") String cloud_region_id, @PathParam("esr_system_info_id") String esr_system_info_id) throws Exception; + +} diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/entity/CloudRegion.java b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/entity/CloudRegion.java new file mode 100644 index 0000000..f4fcf20 --- /dev/null +++ b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/entity/CloudRegion.java @@ -0,0 +1,112 @@ +/** + * Copyright 2017 ZTE Corporation. + * + * 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. + */ +package org.onap.aai.esr.externalservice.entity; + +import java.util.ArrayList; + +public class CloudRegion { + + // required + private String cloudOwner; + //required + private String cloudRegionId; + //required + private String cloudType; + //required + private String cloudRegionVersion; + // not required + private String ownerDefinedType; + //not required + private String cloudZone; + //not required + private String complexName; + //not required + private String cloudExtraInfo; + + private ArrayList<EsrSystemInfo> esrSystemInfos; + + public String getCloudOwner() { + return cloudOwner; + } + + public void setCloudOwner(String cloudOwner) { + this.cloudOwner = cloudOwner; + } + + public String getCloudRegionId() { + return cloudRegionId; + } + + public void setCloudRegionId(String cloudRegionId) { + this.cloudRegionId = cloudRegionId; + } + + public String getCloudType() { + return cloudType; + } + + public void setCloudType(String cloudType) { + this.cloudType = cloudType; + } + + public String getCloudRegionVersion() { + return cloudRegionVersion; + } + + public void setCloudRegionVersion(String cloudRegionVersion) { + this.cloudRegionVersion = cloudRegionVersion; + } + + public String getOwnerDefinedType() { + return ownerDefinedType; + } + + public void setOwnerDefinedType(String ownerDefinedType) { + this.ownerDefinedType = ownerDefinedType; + } + + public String getCloudZone() { + return cloudZone; + } + + public void setCloudZone(String cloudZone) { + this.cloudZone = cloudZone; + } + + public String getComplexName() { + return complexName; + } + + public void setComplexName(String complexName) { + this.complexName = complexName; + } + + public String getCloudExtraInfo() { + return cloudExtraInfo; + } + + public void setCloudExtraInfo(String cloudExtraInfo) { + this.cloudExtraInfo = cloudExtraInfo; + } + + public ArrayList<EsrSystemInfo> getEsrSystemInfos() { + return esrSystemInfos; + } + + public void setEsrSystemInfos(ArrayList<EsrSystemInfo> esrSystemInfos) { + this.esrSystemInfos = esrSystemInfos; + } +} diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/entity/EsrEms.java b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/entity/EsrEms.java new file mode 100644 index 0000000..a11b5d4 --- /dev/null +++ b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/entity/EsrEms.java @@ -0,0 +1,60 @@ +/** + * Copyright 2017 ZTE Corporation. + * + * 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. + */ +package org.onap.aai.esr.externalservice.entity; + +import java.util.ArrayList; + +public class EsrEms { + private String emsId; + + private Boolean passive; + + private String remotePath; + + private ArrayList<EsrSystemInfo> esrSystemInfos; + + public String getEmsId() { + return emsId; + } + + public void setEmsId(String emsId) { + this.emsId = emsId; + } + + public Boolean getPassive() { + return passive; + } + + public void setPassive(Boolean passive) { + this.passive = passive; + } + + public String getRemotePath() { + return remotePath; + } + + public void setRemotePath(String remotePath) { + this.remotePath = remotePath; + } + + public ArrayList<EsrSystemInfo> getEsrSystemInfos() { + return esrSystemInfos; + } + + public void setEsrSystemInfos(ArrayList<EsrSystemInfo> esrSystemInfos) { + this.esrSystemInfos = esrSystemInfos; + } +} diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/entity/EsrSystemInfo.java b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/entity/EsrSystemInfo.java new file mode 100644 index 0000000..12bb2bc --- /dev/null +++ b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/entity/EsrSystemInfo.java @@ -0,0 +1,180 @@ +/** + * Copyright 2017 ZTE Corporation. + * + * 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. + */ +package org.onap.aai.esr.externalservice.entity; + +public class EsrSystemInfo { + + private String esrSystemInfoId; + + private String systemName; + + private String type; + + private String vendor; + + private String version; + + private String serviceUrl; + + private String userName; + + private String password; + + private String systemType; + + private String protocal; + + private String sslCacert; + + private Boolean sslInsecure; + + private Boolean ipAddress; + + private Boolean port; + + private Boolean cloudDomain; + + private Boolean defaultTenant; + + public String getEsrSystemInfoId() { + return esrSystemInfoId; + } + + public void setEsrSystemInfoId(String esrSystemInfoId) { + this.esrSystemInfoId = esrSystemInfoId; + } + + public String getSystemName() { + return systemName; + } + + public void setSystemName(String systemName) { + this.systemName = systemName; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getVendor() { + return vendor; + } + + public void setVendor(String vendor) { + this.vendor = vendor; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public String getServiceUrl() { + return serviceUrl; + } + + public void setServiceUrl(String serviceUrl) { + this.serviceUrl = serviceUrl; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getSystemType() { + return systemType; + } + + public void setSystemType(String systemType) { + this.systemType = systemType; + } + + public String getProtocal() { + return protocal; + } + + public void setProtocal(String protocal) { + this.protocal = protocal; + } + + public String getSslCacert() { + return sslCacert; + } + + public void setSslCacert(String sslCacert) { + this.sslCacert = sslCacert; + } + + public Boolean getSslInsecure() { + return sslInsecure; + } + + public void setSslInsecure(Boolean sslInsecure) { + this.sslInsecure = sslInsecure; + } + + public Boolean getIpAddress() { + return ipAddress; + } + + public void setIpAddress(Boolean ipAddress) { + this.ipAddress = ipAddress; + } + + public Boolean getPort() { + return port; + } + + public void setPort(Boolean port) { + this.port = port; + } + + public Boolean getCloudDomain() { + return cloudDomain; + } + + public void setCloudDomain(Boolean cloudDomain) { + this.cloudDomain = cloudDomain; + } + + public Boolean getDefaultTenant() { + return defaultTenant; + } + + public void setDefaultTenant(Boolean defaultTenant) { + this.defaultTenant = defaultTenant; + } + +} diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/entity/EsrThirdpartySdnc.java b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/entity/EsrThirdpartySdnc.java new file mode 100644 index 0000000..068e288 --- /dev/null +++ b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/entity/EsrThirdpartySdnc.java @@ -0,0 +1,50 @@ +/** + * Copyright 2017 ZTE Corporation. + * + * 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. + */ +package org.onap.aai.esr.externalservice.entity; + +public class EsrThirdpartySdnc { + + private String thirdpartySdncId; + + private String location; + + private String productName; + + public String getThirdpartySdncId() { + return thirdpartySdncId; + } + + public void setThirdpartySdncId(String thirdpartySdncId) { + this.thirdpartySdncId = thirdpartySdncId; + } + + public String getLocation() { + return location; + } + + public void setLocation(String location) { + this.location = location; + } + + public String getProductName() { + return productName; + } + + public void setProductName(String productName) { + this.productName = productName; + } + +} diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/entity/EsrVnfm.java b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/entity/EsrVnfm.java new file mode 100644 index 0000000..05d1789 --- /dev/null +++ b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/entity/EsrVnfm.java @@ -0,0 +1,62 @@ +/** + * Copyright 2017 ZTE Corporation. + * + * 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. + */ +package org.onap.aai.esr.externalservice.entity; + +import java.util.ArrayList; + +public class EsrVnfm { + + private String vnfmId; + + private String vimId; + + private String certificateUrl; + + private ArrayList<EsrSystemInfo> esrSystemInfos; + + public String getVnfmId() { + return vnfmId; + } + + public void setVnfmId(String vnfmId) { + this.vnfmId = vnfmId; + } + + public String getVimId() { + return vimId; + } + + public void setVimId(String vimId) { + this.vimId = vimId; + } + + public String getCertificateUrl() { + return certificateUrl; + } + + public void setCertificateUrl(String certificateUrl) { + this.certificateUrl = certificateUrl; + } + + public ArrayList<EsrSystemInfo> getEsrSystemInfos() { + return esrSystemInfos; + } + + public void setEsrSystemInfos(ArrayList<EsrSystemInfo> esrSystemInfos) { + this.esrSystemInfos = esrSystemInfos; + } + +} diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/entity/ServiceNode.java b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/entity/ServiceNode.java new file mode 100644 index 0000000..f79f584 --- /dev/null +++ b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/entity/ServiceNode.java @@ -0,0 +1,52 @@ +/** + * Copyright 2016-2017 ZTE Corporation. + * + * 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. + */ +package org.onap.aai.esr.externalservice.entity; + + +public class ServiceNode { + + private String ip; + + private String port; + + private int ttl; + + public String getIp() { + return ip; + } + + public void setIp(String ip) { + this.ip = ip; + } + + public String getPort() { + return port; + } + + public void setPort(String port) { + this.port = port; + } + + public int getTtl() { + return ttl; + } + + public void setTtl(int ttl) { + this.ttl = ttl; + } + + +} diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/msb/MsbHelper.java b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/msb/MsbHelper.java new file mode 100644 index 0000000..f385350 --- /dev/null +++ b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/msb/MsbHelper.java @@ -0,0 +1,56 @@ +/** + * Copyright 2017 ZTE Corporation. + * + * 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. + */ +package org.onap.aai.esr.externalservice.msb; + +import java.net.InetAddress; +import java.util.HashSet; +import java.util.Set; + +import org.onap.msb.sdk.discovery.entity.MicroServiceInfo; +import org.onap.msb.sdk.httpclient.msb.MSBServiceClient; +import org.onap.msb.sdk.discovery.entity.Node; + +public class MsbHelper { + + private MSBServiceClient msbClient; + + public MsbHelper(MSBServiceClient msbClient) { + super(); + this.msbClient = msbClient; + } + + + + public void registerMsb() throws Exception { + + + MicroServiceInfo msinfo = new MicroServiceInfo(); + + msinfo.setServiceName("animals"); + msinfo.setVersion("v1"); + msinfo.setUrl("/api/rpc/v1"); + msinfo.setProtocol("REST"); + msinfo.setVisualRange("0|1"); + + Set<Node> nodes = new HashSet<>(); + Node node1 = new Node(); + node1.setIp(InetAddress.getLocalHost().getHostAddress()); + node1.setPort("9090"); + nodes.add(node1); + msinfo.setNodes(nodes); + msbClient.registerMicroServiceInfo(msinfo, false); + } +} diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/resource/EmsManager.java b/esr-mgr/src/main/java/org/onap/aai/esr/resource/EmsManager.java new file mode 100644 index 0000000..368a0c3 --- /dev/null +++ b/esr-mgr/src/main/java/org/onap/aai/esr/resource/EmsManager.java @@ -0,0 +1,155 @@ +/** + * Copyright 2016-2017 ZTE Corporation. + * + * 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. + */ +package org.onap.aai.esr.resource; + +import com.codahale.metrics.annotation.Timed; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; + +import org.eclipse.jetty.http.HttpStatus; +import org.onap.aai.esr.entity.aai.EmsData; +import org.onap.aai.esr.entity.rest.EmsRestData; +import org.onap.aai.esr.exception.ExtsysException; +import org.onap.aai.esr.util.ExtsysUtil; +import org.onap.aai.esr.util.RestResponseUtil; +import org.onap.aai.esr.wrapper.EmsManagerWrapper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.ArrayList; +import java.util.List; +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + +@Path("/emses") +@Api(tags = {" ems Management "}) +public class EmsManager { + + private static final Logger LOGGER = LoggerFactory.getLogger(EmsManager.class); + + /** + * query all ems. + */ + @Path("") + @GET + @ApiOperation(value = "get all ems ") + @Produces(MediaType.APPLICATION_JSON) + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", + response = String.class), + @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, + message = "Unprocessable MicroServiceInfo Entity ", response = String.class), + @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", + response = String.class)}) + @Timed + public Response queryEmsList() { + LOGGER.info("start query all ems!"); + return EmsManagerWrapper.getInstance().queryEmsList(); + } + + /** + * query ems info by id. + */ + @Path("/{emsId}") + @GET + @ApiOperation(value = "get ems by id") + @Produces(MediaType.APPLICATION_JSON) + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", + response = String.class), + @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, + message = "Unprocessable MicroServiceInfo Entity ", response = String.class), + @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", + response = String.class)}) + @Timed + public Response queryemsById(@ApiParam(value = "ems id") @PathParam("emsId") String emsId) { + LOGGER.info("start query ems by id." + emsId); + return EmsManagerWrapper.getInstance().queryEmsById(emsId); + } + + /** + * delete ems by id. + */ + @Path("/{emsId}") + @DELETE + @ApiOperation(value = "delete a ems") + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", + response = String.class), + @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, + message = "Unprocessable MicroServiceInfo Entity ", response = String.class), + @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", + response = String.class)}) + @Timed + public Response delems(@ApiParam(value = "ems id") @PathParam("emsId") String emsId) { + LOGGER.info("start delete ems .id:" + emsId); + return EmsManagerWrapper.getInstance().delEms(emsId); + } + + /** + * update ems by id. + */ + @PUT + @Path("/{emsId}") + @Consumes(MediaType.APPLICATION_JSON) + @Produces({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON}) + @ApiOperation(value = "update a ems") + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", + response = String.class), + @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, + message = "Unprocessable MicroServiceInfo Entity ", response = String.class), + @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", + response = String.class)}) + @Timed + public Response updateEms(@ApiParam(value = "ems", required = true) EmsRestData ems, + @ApiParam(value = "ems id", required = true) @PathParam("emsId") String emsId) { + LOGGER.info("start update ems .id:" + emsId + " info:" + ExtsysUtil.objectToString(ems)); + return RestResponseUtil.getSuccessResponse(new EmsRestData()); + } + + /** + * register ems. + */ + @POST + @Path("") + @Consumes(MediaType.APPLICATION_JSON) + @Produces({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON}) + @ApiOperation(value = "create a ems") + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", + response = String.class), + @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, + message = "Unprocessable MicroServiceInfo Entity ", response = String.class), + @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", + response = String.class)}) + @Timed + public Response registerEms(@ApiParam(value = "ems", required = true) EmsRestData ems) { + LOGGER.info("start add ems" + " info:" + ExtsysUtil.objectToString(ems)); + return EmsManagerWrapper.getInstance().registerEms(ems); + } +} diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/resource/ThirdpatySdncManager.java b/esr-mgr/src/main/java/org/onap/aai/esr/resource/ThirdpatySdncManager.java new file mode 100644 index 0000000..1a3095c --- /dev/null +++ b/esr-mgr/src/main/java/org/onap/aai/esr/resource/ThirdpatySdncManager.java @@ -0,0 +1,150 @@ +/** + * Copyright 2016-2017 ZTE Corporation. + * + * 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. + */ +package org.onap.aai.esr.resource; + +import com.codahale.metrics.annotation.Timed; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; + +import org.eclipse.jetty.http.HttpStatus; +import org.onap.aai.esr.entity.rest.ThirdPartySdncRestData; +import org.onap.aai.esr.util.ExtsysUtil; +import org.onap.aai.esr.wrapper.ThirdpatySdncWrapper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + +@Path("/sdncontrollers") +@Api(tags = {"ThirdParty sdnc Management "}) +public class ThirdpatySdncManager { + + private static final Logger LOGGER = LoggerFactory.getLogger(ThirdpatySdncManager.class); + + /** + *query all thirdParty sdnc. + */ + @Path("") + @GET + @ApiOperation(value = "get all thirdParty sdnc ") + @Produces(MediaType.APPLICATION_JSON) + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", + response = String.class), + @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, + message = "Unprocessable MicroServiceInfo Entity ", response = String.class), + @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", + response = String.class)}) + @Timed + public Response queryThirdpartySdncList() { + LOGGER.info("start query all thirdParty sdnc!"); + return ThirdpatySdncWrapper.getInstance().queryThirdpartySdncList(); + } + + /** + *query thirdParty sdnc by id. + */ + @Path("/{thirdPartySdncId}") + @GET + @ApiOperation(value = "get thirdParty sdnc by id") + @Produces(MediaType.APPLICATION_JSON) + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", + response = String.class), + @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, + message = "Unprocessable MicroServiceInfo Entity ", response = String.class), + @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", + response = String.class)}) + @Timed + public Response queryThirdpartySdncById(@ApiParam(value = "thirdparty sdnc id") @PathParam("thirdPartySdncId") String thirdPartySdncId) { + LOGGER.info("start query thirdparty sdnc by id." + thirdPartySdncId); + return ThirdpatySdncWrapper.getInstance().queryThirdpartySdncById(thirdPartySdncId); + } + + /** + *delete thirdparty sdnc by id. + */ + @Path("/{thirdPartySdncId}") + @DELETE + @ApiOperation(value = "delete a thirdparty sdnc") + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", + response = String.class), + @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, + message = "Unprocessable MicroServiceInfo Entity ", response = String.class), + @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", + response = String.class)}) + @Timed + public Response delThirdpartySdnc(@ApiParam(value = "thirdparty sdnc id") @PathParam("thirdPartySdncId") String thirdPartySdncId) { + LOGGER.info("start delete thirdparty sdnc .id:" + thirdPartySdncId); + return ThirdpatySdncWrapper.getInstance().delThirdpartySdnc(thirdPartySdncId); + } + + /** + *update thirdParty sdnc by id. + */ + @PUT + @Path("/{thirdPartySdncId}") + @Consumes(MediaType.APPLICATION_JSON) + @Produces({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON}) + @ApiOperation(value = "update a thirdParty Sdnc") + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", + response = String.class), + @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, + message = "Unprocessable MicroServiceInfo Entity ", response = String.class), + @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", + response = String.class)}) + @Timed + public Response updateThirdpartySdnc(@ApiParam(value = "thirdpartySdnc", required = true) ThirdPartySdncRestData thirdPartySdnc, + @ApiParam(value = "sdnc id", required = true) @PathParam("thirdPartySdncId") String thirdPartySdncId) { + LOGGER.info("start update sdnc .id:" + thirdPartySdncId + " info:" + ExtsysUtil.objectToString(thirdPartySdnc)); + return ThirdpatySdncWrapper.getInstance().updateThirdpartySdnc(thirdPartySdnc); + } + + /** + *thirdParty sdnc register. + */ + @POST + @Path("") + @Consumes(MediaType.APPLICATION_JSON) + @Produces({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON}) + @ApiOperation(value = "register a thirdparty sdnc") + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", + response = String.class), + @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, + message = "Unprocessable MicroServiceInfo Entity ", response = String.class), + @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", + response = String.class)}) + @Timed + public Response registerThirdpatySdnc(@ApiParam(value = "thirdPartySdnc", required = true) ThirdPartySdncRestData thirdPartySdnc) { + LOGGER.info("start register sdnc" + " info:" + ExtsysUtil.objectToString(thirdPartySdnc)); + return ThirdpatySdncWrapper.getInstance().registerThirdpartySdnc(thirdPartySdnc); + } +} diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/resource/VimManager.java b/esr-mgr/src/main/java/org/onap/aai/esr/resource/VimManager.java new file mode 100644 index 0000000..f31140b --- /dev/null +++ b/esr-mgr/src/main/java/org/onap/aai/esr/resource/VimManager.java @@ -0,0 +1,153 @@ +/** + * Copyright 2016-2017 ZTE Corporation. + * + * 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. + */ +package org.onap.aai.esr.resource; + +import com.codahale.metrics.annotation.Timed; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; +import org.eclipse.jetty.http.HttpStatus; +import org.onap.aai.esr.entity.aai.VimData; +import org.onap.aai.esr.entity.rest.VimRestData; +import org.onap.aai.esr.exception.ExtsysException; +import org.onap.aai.esr.util.ExtsysUtil; +import org.onap.aai.esr.util.RestResponseUtil; +import org.onap.aai.esr.wrapper.VimManagerWrapper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.ArrayList; +import java.util.List; +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + +@Path("/vims") +@Api(tags = {" vim Management "}) +public class VimManager { + + private static final Logger LOGGER = LoggerFactory.getLogger(VimManager.class); + + /** + * query all VIM. + */ + @Path("") + @GET + @ApiOperation(value = "get all vim ") + @Produces(MediaType.APPLICATION_JSON) + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", + response = String.class), + @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, + message = "Unprocessable MicroServiceInfo Entity ", response = String.class), + @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", + response = String.class)}) + @Timed + public Response queryVimList() { + return VimManagerWrapper.getInstance().queryVimList(); + } + + /** + * query vim by id. + */ + @Path("/{vimId}") + @GET + @ApiOperation(value = "get vim by id") + @Produces(MediaType.APPLICATION_JSON) + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", + response = String.class), + @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, + message = "Unprocessable MicroServiceInfo Entity ", response = String.class), + @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", + response = String.class)}) + @Timed + public Response queryVimById(@ApiParam(value = "vim id") @PathParam("vimId") String vimId) { + LOGGER.info("start query vim by id." + vimId); + return VimManagerWrapper.getInstance().queryVimById(vimId); + } + + /** + * delete vim by id. + */ + @Path("/{vimId}") + @DELETE + @ApiOperation(value = "delete a vim") + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", + response = String.class), + @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, + message = "Unprocessable MicroServiceInfo Entity ", response = String.class), + @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", + response = String.class)}) + @Timed + public Response delvim(@ApiParam(value = "vim id") @PathParam("vimId") String vimId) { + LOGGER.info("start delete vim .id:" + vimId); + return VimManagerWrapper.getInstance().delVim(vimId); + } + + /** + * update vim by id. + */ + @PUT + @Path("/{vimId}") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + @ApiOperation(value = "update a vim") + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", + response = String.class), + @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, + message = "Unprocessable MicroServiceInfo Entity ", response = String.class), + @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", + response = String.class)}) + @Timed + public Response updatevims(@ApiParam(value = "vim", required = true) VimRestData vim, + @ApiParam(value = "vim id", required = true) @PathParam("vimId") String vimId) { + LOGGER.info("start update vim .id:" + vimId + " info:" + ExtsysUtil.objectToString(vim)); + return VimManagerWrapper.getInstance().updateVim(vim); + } + + /** + * register vim . + */ + @POST + @Path("") + @Consumes(MediaType.APPLICATION_JSON) + @Produces({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON}) + @ApiOperation(value = "create a vim") + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", + response = String.class), + @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, + message = "Unprocessable MicroServiceInfo Entity ", response = String.class), + @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", + response = String.class)}) + @Timed + public Response registerVims(@ApiParam(value = "vim", required = true) VimRestData vim) { + LOGGER.info("start add vim" + " info:" + ExtsysUtil.objectToString(vim)); + return VimManagerWrapper.getInstance().registerVim(vim); + } +} diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/resource/VnfmManager.java b/esr-mgr/src/main/java/org/onap/aai/esr/resource/VnfmManager.java new file mode 100644 index 0000000..f7e7097 --- /dev/null +++ b/esr-mgr/src/main/java/org/onap/aai/esr/resource/VnfmManager.java @@ -0,0 +1,153 @@ +/** + * Copyright 2016-2017 ZTE Corporation. + * + * 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. + */ +package org.onap.aai.esr.resource; + +import com.codahale.metrics.annotation.Timed; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; +import org.eclipse.jetty.http.HttpStatus; +import org.onap.aai.esr.entity.aai.VnfmData; +import org.onap.aai.esr.entity.rest.VnfmRestData; +import org.onap.aai.esr.exception.ExtsysException; +import org.onap.aai.esr.util.ExtsysUtil; +import org.onap.aai.esr.util.RestResponseUtil; +import org.onap.aai.esr.wrapper.VnfmManagerWrapper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.ArrayList; +import java.util.List; +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + +@Path("/vnfms") +@Api(tags = {" vnfm Management "}) +public class VnfmManager { + + private static final Logger LOGGER = LoggerFactory.getLogger(VnfmManager.class); + + /** + * query all vnfm. + */ + @Path("") + @GET + @ApiOperation(value = "get all vnfm ") + @Produces(MediaType.APPLICATION_JSON) + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", + response = String.class), + @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, + message = "Unprocessable MicroServiceInfo Entity ", response = String.class), + @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", + response = String.class)}) + @Timed + public Response queryVnfmList() { + LOGGER.info("start query all vnfm!"); + return VnfmManagerWrapper.getInstance().queryVnfmList(); + } + + /** + * query vnfm by id. + */ + @Path("/{vnfmId}") + @GET + @ApiOperation(value = "get vnfm by id") + @Produces(MediaType.APPLICATION_JSON) + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", + response = String.class), + @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, + message = "Unprocessable MicroServiceInfo Entity ", response = String.class), + @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", + response = String.class)}) + @Timed + public Response queryVnfmById(@ApiParam(value = "vnfm id") @PathParam("vnfmId") String vnfmId) { + LOGGER.info("start query vnfm by id." + vnfmId); + return VnfmManagerWrapper.getInstance().queryVnfmById(vnfmId); + } + + /** + * delete vnfm by id. + */ + @Path("/{vnfmId}") + @DELETE + @ApiOperation(value = "delete a vnfm") + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", + response = String.class), + @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, + message = "Unprocessable MicroServiceInfo Entity ", response = String.class), + @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", + response = String.class)}) + @Timed + public Response delVnfm(@ApiParam(value = "vnfm id") @PathParam("vnfmId") String vnfmId) { + LOGGER.info("start delete vnfm .id:" + vnfmId); + return VnfmManagerWrapper.getInstance().delVnfm(vnfmId); + } + + /** + * update vnfm by id. + */ + @PUT + @Path("/{vnfmId}") + @Consumes(MediaType.APPLICATION_JSON) + @Produces({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON}) + @ApiOperation(value = "update a vnfm") + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", + response = String.class), + @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, + message = "Unprocessable MicroServiceInfo Entity ", response = String.class), + @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", + response = String.class)}) + @Timed + public Response updateVnfm(@ApiParam(value = "vnfm", required = true) VnfmRestData vnfm, + @ApiParam(value = "vnfm id", required = true) @PathParam("vnfmId") String vnfmId) { + LOGGER.info("start update vnfm .id:" + vnfmId + " info:" + ExtsysUtil.objectToString(vnfm)); + return VnfmManagerWrapper.getInstance().updateVnfm(vnfm, vnfmId); + } + + /** + * add vnfm . + */ + @POST + @Path("") + @Consumes(MediaType.APPLICATION_JSON) + @Produces({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON}) + @ApiOperation(value = "create a vnfm") + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", + response = String.class), + @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, + message = "Unprocessable MicroServiceInfo Entity ", response = String.class), + @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", + response = String.class)}) + @Timed + public Response registerVnfm(@ApiParam(value = "vnfm", required = true) VnfmRestData vnfm) { + return VnfmManagerWrapper.getInstance().registerVnfm(vnfm); + } +} diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/util/ExtsysUtil.java b/esr-mgr/src/main/java/org/onap/aai/esr/util/ExtsysUtil.java new file mode 100644 index 0000000..72f8bd7 --- /dev/null +++ b/esr-mgr/src/main/java/org/onap/aai/esr/util/ExtsysUtil.java @@ -0,0 +1,54 @@ +/** + * Copyright 2016-2017 ZTE Corporation. + * + * 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. + */ +package org.onap.aai.esr.util; + +import com.google.gson.Gson; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.UUID; + +public class ExtsysUtil { + private final static Logger logger = LoggerFactory.getLogger(ExtsysUtil.class); + + public static String generateId() { + return UUID.randomUUID().toString(); + } + + public static boolean isNotEmpty(String str) { + return str != null && !"".equals(str) && str.length() > 0; + } + + /** + * change object to str. + */ + public static String objectToString(Object obj) { + Gson gson = new Gson(); + if (obj != null) { + return gson.toJson(obj); + } else { + return null; + } + } + + public static String getNowTime() { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + return sdf.format(new Date()); + } +} diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/util/RestResponseUtil.java b/esr-mgr/src/main/java/org/onap/aai/esr/util/RestResponseUtil.java new file mode 100644 index 0000000..3c27178 --- /dev/null +++ b/esr-mgr/src/main/java/org/onap/aai/esr/util/RestResponseUtil.java @@ -0,0 +1,49 @@ +/** + * Copyright 2016-2017 ZTE Corporation. + * + * 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. + */ +package org.onap.aai.esr.util; + +import javax.ws.rs.core.Response; +import javax.ws.rs.core.Response.Status; + +public class RestResponseUtil { + + /** + * get http success entity. + */ + public static Response getSuccessResponse(Object obj) { + if (obj != null) { + return Response.ok(obj).build(); + } else { + return Response.ok().build(); + } + } + + public static Response getCreateSussceeResponse(Object obj) { + return Response.status(Status.CREATED).entity(obj).build(); + } + + /** + * get http error entity. + */ + public static Response getErrorResponse(Object obj) { + if (obj != null) { + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(obj).build(); + } else { + return Response.serverError().build(); + } + + } +} diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/EmsManagerWrapper.java b/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/EmsManagerWrapper.java new file mode 100644 index 0000000..842feb2 --- /dev/null +++ b/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/EmsManagerWrapper.java @@ -0,0 +1,70 @@ +/** + * Copyright 2017 ZTE Corporation. + * + * 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. + */ +package org.onap.aai.esr.wrapper; + +import java.util.ArrayList; + +import javax.ws.rs.core.Response; + +import org.onap.aai.esr.entity.rest.EmsRestData; +import org.onap.aai.esr.entity.rest.RegisterResponse; +import org.onap.aai.esr.entity.rest.VnfmRestData; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class EmsManagerWrapper { + private static EmsManagerWrapper emsManagerWrapper; + private static final Logger LOG = LoggerFactory.getLogger(EmsManagerWrapper.class); + + /** + * get VnfmManagerWrapper instance. + * @return ems manager wrapper instance + */ + public static EmsManagerWrapper getInstance() { + if (emsManagerWrapper == null) { + emsManagerWrapper = new EmsManagerWrapper(); + } + return emsManagerWrapper; + } + + public Response registerEms(EmsRestData ems) { + //TODO + RegisterResponse result = null; + return Response.ok(result).build(); + } + + public Response updateEms(EmsRestData ems) { + //TODO + return Response.ok().build(); + } + + public Response queryEmsList() { + //TODO + ArrayList<EmsRestData> emsList = new ArrayList<EmsRestData>(); + return Response.ok(emsList).build(); + } + + public Response queryEmsById(String emsId) { + EmsRestData ems = new EmsRestData(); + //TODO + return Response.ok(ems).build(); + } + + public Response delEms(String emsId) { + //TODO + return Response.noContent().build(); + } +} diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/ThirdpatySdncWrapper.java b/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/ThirdpatySdncWrapper.java new file mode 100644 index 0000000..d88c9ae --- /dev/null +++ b/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/ThirdpatySdncWrapper.java @@ -0,0 +1,70 @@ +/** + * Copyright 2017 ZTE Corporation. + * + * 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. + */ +package org.onap.aai.esr.wrapper; + +import java.util.ArrayList; + +import javax.ws.rs.core.Response; + +import org.onap.aai.esr.entity.rest.RegisterResponse; +import org.onap.aai.esr.entity.rest.ThirdPartySdncRestData; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class ThirdpatySdncWrapper { + + private static ThirdpatySdncWrapper thirdpatySdncWrapper; + private static final Logger LOG = LoggerFactory.getLogger(ThirdpatySdncWrapper.class); + + /** + * get ThirdpatySdncWrapper instance. + * @return ThirdpatySdnc manager wrapper instance + */ + public static ThirdpatySdncWrapper getInstance() { + if (thirdpatySdncWrapper == null) { + thirdpatySdncWrapper = new ThirdpatySdncWrapper(); + } + return thirdpatySdncWrapper; + } + + public Response registerThirdpartySdnc(ThirdPartySdncRestData thirdpartySdnc) { + //TODO + RegisterResponse result = null; + return Response.ok(result).build(); + } + + public Response updateThirdpartySdnc(ThirdPartySdncRestData thirdpartySdnc) { + //TODO + return Response.ok().build(); + } + + public Response queryThirdpartySdncList() { + //TODO + ArrayList<ThirdPartySdncRestData> thirdpartySdncList = new ArrayList<ThirdPartySdncRestData>(); + return Response.ok(thirdpartySdncList).build(); + } + + public Response queryThirdpartySdncById(String thirdpartySdncId) { + ThirdPartySdncRestData thirdpartySdnc = new ThirdPartySdncRestData(); + //TODO + return Response.ok(thirdpartySdnc).build(); + } + + public Response delThirdpartySdnc(String thirdpartySdncId) { + //TODO + return Response.noContent().build(); + } +} diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/VimManagerWrapper.java b/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/VimManagerWrapper.java new file mode 100644 index 0000000..75cc4fc --- /dev/null +++ b/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/VimManagerWrapper.java @@ -0,0 +1,70 @@ +/** + * Copyright 2017 ZTE Corporation. + * + * 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. + */ +package org.onap.aai.esr.wrapper; + +import java.util.ArrayList; + +import javax.ws.rs.core.Response; + +import org.onap.aai.esr.entity.rest.RegisterResponse; +import org.onap.aai.esr.entity.rest.VimRestData; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class VimManagerWrapper { + + private static VimManagerWrapper vimManagerWrapper; + private static final Logger LOG = LoggerFactory.getLogger(VimManagerWrapper.class); + + /** + * get VimManagerWrapper instance. + * @return vim manager wrapper instance + */ + public static VimManagerWrapper getInstance() { + if (vimManagerWrapper == null) { + vimManagerWrapper = new VimManagerWrapper(); + } + return vimManagerWrapper; + } + + public Response registerVim(VimRestData vim) { + //TODO + RegisterResponse result = null; + return Response.ok(result).build(); + } + + public Response updateVim(VimRestData vim) { + //TODO + return Response.ok().build(); + } + + public Response queryVimList() { + //TODO + ArrayList<VimRestData> vimList = new ArrayList<VimRestData>(); + return Response.ok(vimList).build(); + } + + public Response queryVimById(String vimId) { + VimRestData vim = new VimRestData(); + //TODO + return Response.ok(vim).build(); + } + + public Response delVim(String vimId) { + //TODO + return Response.noContent().build(); + } +} diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/VnfmManagerWrapper.java b/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/VnfmManagerWrapper.java new file mode 100644 index 0000000..a1ac53c --- /dev/null +++ b/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/VnfmManagerWrapper.java @@ -0,0 +1,69 @@ +/** + * Copyright 2017 ZTE Corporation. + * + * 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. + */ +package org.onap.aai.esr.wrapper; + +import java.util.ArrayList; + +import javax.ws.rs.core.Response; + +import org.onap.aai.esr.entity.rest.RegisterResponse; +import org.onap.aai.esr.entity.rest.VnfmRestData; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class VnfmManagerWrapper { + private static VnfmManagerWrapper vnfmManagerWrapper; + private static final Logger LOG = LoggerFactory.getLogger(VnfmManagerWrapper.class); + + /** + * get VnfmManagerWrapper instance. + * @return vnfm manager wrapper instance + */ + public static VnfmManagerWrapper getInstance() { + if (vnfmManagerWrapper == null) { + vnfmManagerWrapper = new VnfmManagerWrapper(); + } + return vnfmManagerWrapper; + } + + public Response registerVnfm(VnfmRestData vnfm) { + //TODO + RegisterResponse result = null; + return Response.ok(result).build(); + } + + public Response updateVnfm(VnfmRestData vnfm, String vnfmId) { + //TODO + return Response.ok().build(); + } + + public Response queryVnfmList() { + ArrayList<VnfmRestData> vnfmList = new ArrayList<VnfmRestData>(); + //TODO + return Response.ok(vnfmList).build(); + } + + public Response queryVnfmById(String vnfmId) { + VnfmRestData vnfm = new VnfmRestData(); + //TODO + return Response.ok(vnfm).build(); + } + + public Response delVnfm(String vnfmId) { + //TODO + return Response.noContent().build(); + } +} |