2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2019 Nordix Foundation.
4 * ================================================================================
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 * SPDX-License-Identifier: Apache-2.0
18 * ============LICENSE_END=========================================================
21 package org.onap.so.adapters.vnfmadapter.extclients.etsicatalog;
23 import static org.slf4j.LoggerFactory.getLogger;
24 import org.slf4j.Logger;
25 import org.springframework.beans.factory.annotation.Value;
26 import org.springframework.stereotype.Service;
29 * Provides the URLs for the REST Requests to the ETSI Catalog Manager.
31 * @author gareth.roper@est.tech
34 public class EtsiCatalogUrlProvider {
36 private static final Logger logger = getLogger(EtsiCatalogUrlProvider.class);
38 @Value("${msb.endpoint:#{\"http://msb_iag.onap:80\"}}")
39 private String msbEndpoint;
40 @Value("${msb.catalogServiceUrl:#{null}}")
41 private String catalogServiceUrl;
42 @Value("${msb.vnfpkgmServiceUrl:#{\"/api/vnfpkgm/v1\"}}")
43 private String vnfpkgmServiceUrl;
45 public EtsiCatalogUrlProvider() {}
48 * Get the URL for retrieving the Package Content from the ETSI Catalog.".
50 * @param vnfPkgId The ID of the VNF Package
51 * @return the URL for the GET operation
53 public String getVnfPackageContentUrl(final String vnfPkgId) {
54 final String url = msbEndpoint + vnfpkgmServiceUrl + "/vnf_packages/" + vnfPkgId + "/package_content";
55 logger.info("getEtsiCatalogVnfPackageContentUrl: {}", url);
60 * Get the URL for retrieving VNF packages information from ETSI Catalog.".
62 * @return the URL for the GET operation
64 public String getVnfPackagesUrl() {
65 final String url = msbEndpoint + vnfpkgmServiceUrl + "/vnf_packages";
66 logger.info("getEtsiCatalogVnfPackagesEndpoint: {}", url);
71 * Get the URL for retrieving specific VNF package information from the ETSI Catalog.".
73 * @param vnfPkgId The ID of the VNF Package
74 * @return the URL for the GET operation
76 public String getVnfPackageUrl(final String vnfPkgId) {
77 final String url = msbEndpoint + vnfpkgmServiceUrl + "/vnf_packages/" + vnfPkgId;
78 logger.info("getEtsiCatalogVnfPackageEndpoint: {}", url);
83 * Get the URL for retrieving VNF Package Artifacts
85 * @param vnfPkgId The ID of the VNF Package
86 * @param artifactPath The path to the Artifact
87 * @return the URL for the GET operation
89 public String getVnfPackageArtifactUrl(final String vnfPkgId, final String artifactPath) {
90 final String url = msbEndpoint + vnfpkgmServiceUrl + "/vnf_packages/" + vnfPkgId + "/artifacts/" + artifactPath;
91 logger.info("getVnfPackageArtifactUrl: {}", url);