diff options
author | victor.gao <victor.gao@huawei.com> | 2018-03-26 20:33:13 +0800 |
---|---|---|
committer | victor.gao <victor.gao@huawei.com> | 2018-03-26 20:37:40 +0800 |
commit | f9f45991d9a43fb18accc32ac25619862bf1db95 (patch) | |
tree | 6a3f6e55e344ee52fc2f23c7107e86e1bad968f5 /service/src/main/java | |
parent | 318cda0d7128149503a705e870e69e7f90e2ad29 (diff) |
Add multivimproxy code
Change-Id: I15e0a6c639727bfa1115c77c11c58dc8b252c3bf
Issue-ID: VFC-644
Signed-off-by: victor.gao <victor.gao@huawei.com>
Diffstat (limited to 'service/src/main/java')
6 files changed, 719 insertions, 0 deletions
diff --git a/service/src/main/java/org/onap/vfc/nfvo/multivimproxy/common/constant/Constant.java b/service/src/main/java/org/onap/vfc/nfvo/multivimproxy/common/constant/Constant.java new file mode 100644 index 0000000..e246b16 --- /dev/null +++ b/service/src/main/java/org/onap/vfc/nfvo/multivimproxy/common/constant/Constant.java @@ -0,0 +1,113 @@ +/* + * Copyright 2016-2017 Huawei Technologies Co., Ltd. + * + * 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.vfc.nfvo.multivimproxy.common.constant; + +/** + * HTTP constants<br/> + * <p> + * </p> + * + * @author + * @version VFC 1.0 Aug 25, 2016 + */ +public class Constant { + + public static final String RES_MANAGEMENT_DB = "resmanagementdb"; + + /** + * Database Delete/Modify/Add fail. + */ + public static final int ERROR_CODE = -1; + + /** + * Database Delete/Modify/Add success. + */ + public static final int OK_CODE = 1; + + /** + * Lack of resource. + */ + public static final int RES_NOT_ENOUGH_CODE = -2; + + /** + * Module name. + */ + public static final String MODULE_NAME = "Resmanagement"; + + public static final String RESPONSE_CONTENT = "responseContent"; + + public static final String STATUS_CODE = "statusCode"; + + /** + * Format Time + */ + public static final String DATE_FORMATE = "yyyy-MM-dd HH:mm:ss"; + + public static final String DATE_UTC_FORMATE = "yyyy-MM-dd'T'HH:mm:ss'Z'"; + + public static final String UTC_FORMATE = "UTC"; + + public static final String DATE_DAY_FORMATE = "yyyy-MM-dd 00:00:00"; + + /** + * IAM + */ + + public static final String HTTP_CONTENT_TYPE = "Content-Type"; + + public static final String HTTP_CONTENT_TYPE_VALUE = "application/json;charset=UTF-8"; + + public static final String X_TENANT_ID = "X-Tenant-Id"; + + public static final String IAM_TOKEN = "x-auth-token"; + + public static final String IAM_AUTH_TOKEN = "X-Auth-Token"; + + public static final String IAM_USER_ID = "X-User-Id"; + + public static final String IAM_USER_NAME = "X-User-Name"; + + public static final String IAM_DOMAIN_NAME = "X-Domain-Name"; + + public static final String HEADER_SUBJECT_TOKEN = "X-Subject-Token"; + + public static final int REPEAT_REG_TIME = 60 * 1000; + + public static final String CONF = "config.properties"; + + public static final String HOST = "host_url"; + + public static final String PORT = "port"; + + public static final String CLOUD_OWNER = "cloud-owner"; + + public static final String CLOUD_REGION_ID = "cloud-region-id"; + + public static final String TENANT_ID = "tenant-id"; + + public static final String GLOBAL_CUSTOMER_ID = "global-customer-id"; + + public static final String SERVICE_TYPE = "service-type"; + + public static final int HTTP_BAD_REQUEST = 400; + + public static final int HTTP_CREATED = 201; + + private Constant() { + // private constants + } +} diff --git a/service/src/main/java/org/onap/vfc/nfvo/multivimproxy/common/constant/HttpConstant.java b/service/src/main/java/org/onap/vfc/nfvo/multivimproxy/common/constant/HttpConstant.java new file mode 100644 index 0000000..e9b961e --- /dev/null +++ b/service/src/main/java/org/onap/vfc/nfvo/multivimproxy/common/constant/HttpConstant.java @@ -0,0 +1,79 @@ +/* + * Copyright 2016 Huawei Technologies Co., Ltd. + * + * 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.vfc.nfvo.multivimproxy.common.constant; + +/** + * + * Http constant class.<br> + * <p> + * </p> + * + * @author + * @version VFC 1.0 Sep 10, 2016 + */ +public class HttpConstant { + + public static final int ERROR_CODE = -1; + + public static final int OK_CODE = 1; + + public static final int HTTP_OK = 200; + + public static final int HTTP_CREATED = 201; + + public static final int HTTP_ACCEPTED = 202; + + public static final int HTTP_NOCONTENT = 204; + + public static final int HTTP_UNAUTHORIZED = 401; + + public static final int HTTP_BAD_REQUEST = 400; + + public static final int HTTP_NOTFOUND_CODE = 404; + + public static final int HTTP_CONFLICT_CODE = 409; + + public static final int HTTP_INVALID_PARAMETERS = 415; + + public static final int HTTP_INNERERROR_CODE = 500; + + public static final int INTERNAL_EXCEPTION_CODE = 600; + + public static final int TOKEN_HEAD_NULL_CODE = 601; + + public static final int TOKEN_USER_NULL_CODE = 602; + + public static final int SERVICE_URL_ERROR_CODE = 603; + + public static final int ACCESS_OBJ_NULL_CODE = 604; + + public static final int CONNECT_NOT_FOUND_CODE = 605; + + public static final int VCENTER_PARA_ERROR_CODE = 606; + + public static final int TYPE_PARA_ERROR_CODE = 607; + + public static final int CONNECT_FAIL_CODE = 608; + + public static final int DIS_CONNECT_FAIL_CODE = 609; + + public static final int HANDSHAKE_FAIL_CODE = 610; + + private HttpConstant() { + //private constructor + } +} diff --git a/service/src/main/java/org/onap/vfc/nfvo/multivimproxy/common/constant/ParamConstant.java b/service/src/main/java/org/onap/vfc/nfvo/multivimproxy/common/constant/ParamConstant.java new file mode 100644 index 0000000..e60d443 --- /dev/null +++ b/service/src/main/java/org/onap/vfc/nfvo/multivimproxy/common/constant/ParamConstant.java @@ -0,0 +1,370 @@ +/* + * Copyright 2016-2017 Huawei Technologies Co., Ltd. + * + * 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.vfc.nfvo.multivimproxy.common.constant; + +/** + * <br/> + * <p> + * Contstant for System interactive. + * </p> + * + * @author + * @version VFC 1.0 2016-3-17 + */ +public class ParamConstant { + + /** + * param key: vimId. + */ + public static final String PARAM_VIMID = "vimId"; + + /** + * param key: vimName + */ + public static final String PARAM_VIMNAME = "vimName"; + + /** + * param key: tenantId. + */ + public static final String PARAM_TENANTID = "tenantId"; + + public static final String TOTAL_CPU = "totalCPU"; + + public static final String USED_CPU = "usedCPU"; + + public static final String TOTAL_MEMORY = "totalMemory"; + + public static final String USED_MEMORY = "usedMemory"; + + public static final String TOTAL_DISK = "totalDisk"; + + public static final String USED_DISK = "usedDisk"; + + /** + * param key: data. + */ + public static final String PARAM_DATA = "data"; + + /** + * param key: id. + */ + public static final String PARAM_ID = "id"; + + /** + * param key: vimId + */ + public static final String PARAM_IP = "ip"; + + /** + * param key: role. + */ + public static final String PARAM_ROLE = "role"; + + /** + * param key: roleId. + */ + public static final String PARAM_ROLEID = "roleId"; + + /** + * param key: total. + */ + public static final String PARAM_TOTAL = "total"; + + /** + * param key: used. + */ + public static final String PARAM_USED = "used"; + + /** + * param key: vcpus. + */ + public static final String PARAM_VCPUS = "vcpus"; + + /** + * param key: disk. + */ + public static final String PARAM_DISK = "disk"; + + /** + * param key: cpumhz. + */ + public static final String PARAM_CPUMHZ = "cpumhz"; + + /** + * param key: countyr + */ + public static final String PARAM_COUNTRY = "country"; + + /** + * param key: vendorId + */ + public static final String PARAM_VENDORID = "vendorId"; + + /** + * param key: vendorName + */ + public static final String PARAM_VENDORNAME = "vendorName"; + + /** + * param key: memory. + */ + public static final String PARAM_MEMORY = "memory"; + + /** + * param key: name. + */ + public static final String PARAM_NAME = "name"; + + /** + * param key: status. + */ + public static final String PARAM_STATUS = "status"; + + /** + * param key: parent. + */ + public static final String PARAM_PARENT = "parent"; + + /** + * param key: location. + */ + public static final String PARAM_LOCATION = "location"; + + /** + * param key: siteName. + */ + public static final String PARAM_SITENAME = "siteName"; + + /** + * param key: vendor. + */ + public static final String PARAM_VENDOR = "vendor"; + + /** + * param key: vendors. + */ + public static final String PARAM_VENDORS = "vendors"; + + /** + * param key: tenantSites. + */ + public static final String PARAM_TENANTSITES = "tenantSites"; + + /** + * param key: siteId. + */ + public static final String PARAM_SITEID = "siteId"; + + /** + * param key: resArbitration. + */ + public static final String PARAM_RESARBITRATION = "resArbitration"; + + /** + * param key: userRole. + */ + public static final String PARAM_USERROLE = "userRole"; + + /** + * param key: admin. + */ + public static final String PARAM_ADMIN = "admin"; + + /** + * param key: tenant. + */ + public static final String PARAM_TENANT = "tenant"; + + /** + * param key: type. + */ + public static final String PARAM_TYPE = "type"; + + /** + * param key: action. + */ + public static final String PARAM_ACTION = "action"; + + /** + * param key: offline. + */ + public static final String PARAM_OFFLINE = "offline"; + + /** + * param key: online. + */ + public static final String PARAM_ONLINE = "online"; + + /** + * param key: drexecute. + */ + public static final String PARAM_DREXECUTE = "drexecute"; + + /** + * param key: drRollBack. + */ + public static final String PARAM_DRROLLBACK = "drrollback"; + + /** + * param key: scaleOut. + */ + public static final String PARAM_SCALEOUT = "scaleout"; + + /** + * param key: scaleIn. + */ + public static final String PARAM_SCALEIN = "scalein"; + + /** + * param key: network. + */ + public static final String PARAM_NETWORK = "networks"; + + /** + * param key: host. + */ + public static final String PARAM_HOST = "hosts"; + + /** + * param key: network. + */ + public static final String PARAM_PORT = "ports"; + + /** + * param key: providernetworks. + */ + public static final String PARAM_PROVIDERNETWORKS = "providernetworks"; + + /** + * param key: vims. + */ + public static final String PARAM_VIMS = "vims"; + + /** + * param key: vms. + */ + public static final String PARAM_VMS = "vms"; + + /** + * param key: vapps. + */ + public static final String PARAM_VAPPS = "vapps"; + + /** + * param key: vapp. + */ + public static final String PARAM_VAPP = "vapp"; + + /** + * param key: sites. + */ + public static final String PARAM_SITES = "sites"; + + /** + * param key: vduId. + */ + public static final String PARAM_VDUID = "vduId"; + + /** + * param key: vappId. + */ + public static final String PARAM_VAPPID = "vappId"; + + /** + * param key: hostId. + */ + public static final String PARAM_HOSTID = "hostId"; + + /** + * param key: projectId. + */ + public static final String PARAM_PROJECTID = "projectId"; + + /** + * param key: vnfmId. + */ + public static final String PARAM_VNFMID = "vnfmId"; + + /** + * param key: params. + */ + public static final String PARAM_PARAMS = "params"; + + /** + * param key: url. + */ + public static final String PARAM_URL = "url"; + + /** + * param key: post. + */ + public static final String PARAM_POST = "post"; + + /** + * param key: put. + */ + public static final String PARAM_PUT = "put"; + + /** + * param key: del. + */ + public static final String PARAM_DEL = "del"; + + /** + * param key: get. + */ + public static final String PARAM_GET = "get"; + + /** + * param key: retCode. + */ + public static final String PARAM_RETCODE = "retCode"; + + /** + * param key: ADD. + */ + public static final String PARAM_ADD = "add"; + + /** + * param key: active. + */ + public static final String PARAM_ACTIVE = "active"; + + /** + * param key: deleted. + */ + public static final String PARAM_DELETED = "deleted"; + + /** + * param key: deleting. + */ + public static final String PARAM_DELETING = "deleting"; + + /** + * param key: response + */ + public static final String PARAM_RESPONSE = "response"; + + /** + * param key: info + */ + public static final String PARAM_INFO = "info"; + + private ParamConstant() { + // private constructor + } +} diff --git a/service/src/main/java/org/onap/vfc/nfvo/multivimproxy/common/constant/ResponseConstant.java b/service/src/main/java/org/onap/vfc/nfvo/multivimproxy/common/constant/ResponseConstant.java new file mode 100644 index 0000000..9462db5 --- /dev/null +++ b/service/src/main/java/org/onap/vfc/nfvo/multivimproxy/common/constant/ResponseConstant.java @@ -0,0 +1,58 @@ +/* + * Copyright 2016-2017 Huawei Technologies Co., Ltd. + * + * 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.vfc.nfvo.multivimproxy.common.constant; + +import org.onap.vfc.nfvo.multivimproxy.common.util.ResourceUtil; + +/** + * Response constants.<br/> + * <p> + * </p> + * + * @author + * @version VFC 1.0 Aug 25, 2016 + */ +public class ResponseConstant { + + public static final String ADD_SUCESS_MSG = ResourceUtil.getMessage("add success"); + + public static final String ADD_FAIL_MSG = ResourceUtil.getMessage("add error"); + + public static final String DEL_SUCESS_MSG = ResourceUtil.getMessage("delete success"); + + public static final String DEL_FAIL_MSG = ResourceUtil.getMessage("delete error"); + + public static final String MOD_SUCESS_MSG = ResourceUtil.getMessage("update success"); + + public static final String MOD_FAIL_MSG = ResourceUtil.getMessage("update error"); + + public static final String QUERY_SUCESS_MSG = ResourceUtil.getMessage("query success"); + + public static final String QUERY_FAIL_MSG = ResourceUtil.getMessage("query error"); + + public static final String DELSODORES_FAIL_MSG = "delete sodores error"; + + public static final String DELVNFMINFO_FAIL_MSG = "delete vnfm error"; + + public static final String RES_VERIFY_SUCESS_MSG = "nsdata verify sucessfully"; + + public static final String RES_VERIFY_FAIL_MSG = "res verify failed"; + + private ResponseConstant() { + // private constructor + } +} diff --git a/service/src/main/java/org/onap/vfc/nfvo/multivimproxy/common/constant/UrlConstant.java b/service/src/main/java/org/onap/vfc/nfvo/multivimproxy/common/constant/UrlConstant.java new file mode 100644 index 0000000..5050bd4 --- /dev/null +++ b/service/src/main/java/org/onap/vfc/nfvo/multivimproxy/common/constant/UrlConstant.java @@ -0,0 +1,56 @@ +/* + * Copyright 2016-2017 Huawei Technologies Co., Ltd. + * + * 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.vfc.nfvo.multivimproxy.common.constant; + +/** + * <br/> + * <p> + * Constant for REST URL. + * </p> + * + * @author + * @version VFC 1.0 2016-3-17 + */ +public class UrlConstant { + + /** + * networks target. + */ + public static final String LOCATION_TARGET = "location"; + + /** + * MSB register url. + */ + public static final String REST_MSB_REGISTER = "/api/microservices/v1/services"; + + // /api/extsys/v1/vims/%s + public static final String ESR_GET_VIM_URL = + "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/%s/%s/esr-system-info-list/esr-system-info/%s"; + + // /api/extsys/v1/vims + public static final String ESR_GET_VIMS_URL = + "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/%s/%s/esr-system-info-list"; + + + public static final String MULTI_VIM_PREFIX = + "/api/multicloud/v0"; + + private UrlConstant() { + // private constructor + } + +} diff --git a/service/src/main/java/org/onap/vfc/nfvo/multivimproxy/common/util/ResourceUtil.java b/service/src/main/java/org/onap/vfc/nfvo/multivimproxy/common/util/ResourceUtil.java new file mode 100644 index 0000000..67444eb --- /dev/null +++ b/service/src/main/java/org/onap/vfc/nfvo/multivimproxy/common/util/ResourceUtil.java @@ -0,0 +1,43 @@ +/* + * Copyright 2016 Huawei Technologies Co., Ltd. + * + * 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.vfc.nfvo.multivimproxy.common.util; + +/** + * <br/> + * <p> + * </p> + * + * @author + * @version VFC 1.0 Aug 25, 2016 + */ +public class ResourceUtil { + + private ResourceUtil() { + + } + + /** + * It is used to get Message<br/> + * + * @param key + * @return + * @since VFC 1.0 + */ + public static String getMessage(String key) { + return key; + } +} |