summaryrefslogtreecommitdiffstats
path: root/catalog-be/src/main
diff options
context:
space:
mode:
authorMichael Lando <ml636r@att.com>2017-07-22 17:10:02 +0300
committerMichael Lando <ml636r@att.com>2017-07-22 17:10:02 +0300
commit9db4052423f34a76296ffdcda896cdeba2b4aead (patch)
tree7c3b779c6d09be40283158382dee2cf02767761e /catalog-be/src/main
parent3c3c833897dbfc0e85feaf36086a505f990ecb76 (diff)
[sdc] 1710 rebase code
Change-Id: Icedeac71c0a9d27518969effcd5d5519de9955a6 Signed-off-by: Michael Lando <ml636r@att.com>
Diffstat (limited to 'catalog-be/src/main')
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/HealthCheckBusinessLogic.java45
-rw-r--r--catalog-be/src/main/resources/config/SDC.zipbin29892 -> 0 bytes
-rw-r--r--catalog-be/src/main/resources/config/license.txt13
-rw-r--r--catalog-be/src/main/resources/import/tosca/artifact-types/artifactTypes.yml30
-rw-r--r--catalog-be/src/main/resources/import/tosca/artifact-types/artifactTypes.zipbin0 -> 991 bytes
-rw-r--r--catalog-be/src/main/resources/import/tosca/relationship-types/relationshipTypes.yml111
-rw-r--r--catalog-be/src/main/resources/import/tosca/relationship-types/relationshipTypes.zipbin0 -> 1396 bytes
7 files changed, 181 insertions, 18 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/HealthCheckBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/HealthCheckBusinessLogic.java
index 8a8937740f..fe9c8488aa 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/HealthCheckBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/HealthCheckBusinessLogic.java
@@ -57,6 +57,7 @@ import org.openecomp.sdc.be.switchover.detector.SwitchoverDetector;
import org.openecomp.sdc.common.api.HealthCheckInfo;
import org.openecomp.sdc.common.api.HealthCheckInfo.HealthCheckComponent;
import org.openecomp.sdc.common.api.HealthCheckInfo.HealthCheckStatus;
+import org.openecomp.sdc.common.api.HealthCheckWrapper;
import org.openecomp.sdc.common.impl.ExternalConfiguration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -253,9 +254,9 @@ public class HealthCheckBusinessLogic {
private List<HealthCheckInfo> getAmdocsHealthCheck(List<HealthCheckInfo> healthCheckInfos) {
HealthCheckStatus healthCheckStatus;
String description;
- Map<String, Object> amdocsHC = null;
String version = null;
- List<HealthCheckInfo> componentsInfo = null;
+ List<HealthCheckInfo> componentsInfo = new ArrayList<>();
+
CloseableHttpClient httpClient = getHttpClient();
String amdocsHealtchCheckUrl = buildHealthCheckUrl();
HttpGet httpGet = new HttpGet(amdocsHealtchCheckUrl);
@@ -265,37 +266,45 @@ public class HealthCheckBusinessLogic {
beResponse = httpClient.execute(httpGet);
beStatus = beResponse.getStatusLine().getStatusCode();
- HttpEntity entity = beResponse.getEntity();
- String beJsonResponse = EntityUtils.toString(entity);
- Gson gson = new Gson();
- amdocsHC = gson.fromJson(beJsonResponse, Map.class);
- version = amdocsHC.get("sdcVersion") != null ? amdocsHC.get("sdcVersion").toString() : null;
- Object object = amdocsHC.get("componentsInfo");
- Type listType = new TypeToken<List<HealthCheckInfo>>(){}.getType();
- componentsInfo = gson.fromJson(object.toString(), listType);
+ StringBuilder sb = new StringBuilder();
+
+ if (beStatus == HttpStatus.SC_OK || beStatus == HttpStatus.SC_INTERNAL_SERVER_ERROR) {
+ HttpEntity entity = beResponse.getEntity();
+ String beJsonResponse = EntityUtils.toString(entity);
+ Gson gson = new Gson();
+ HealthCheckWrapper healthCheckWrapper = gson.fromJson(beJsonResponse, HealthCheckWrapper.class);
+ version = healthCheckWrapper.getSdcVersion();
+ componentsInfo = healthCheckWrapper.getComponentsInfo();
+
+ if (componentsInfo != null) {
+ componentsInfo.forEach(x -> {
+ if (x.getHealthCheckStatus() == HealthCheckStatus.DOWN) {
+ sb.append("Component " + x.getHealthCheckComponent().name() + " is Down, ");
+ }
+ });
+ } else {
+ componentsInfo.add(new HealthCheckInfo(HealthCheckComponent.BE, HealthCheckStatus.DOWN, null, null));
+ }
+ }
if (beStatus != HttpStatus.SC_OK) {
healthCheckStatus = HealthCheckStatus.DOWN;
- StringBuilder sb = new StringBuilder();
- componentsInfo.forEach(x -> {
- if (x.getHealthCheckStatus()==HealthCheckStatus.DOWN){
- sb.append("Component "+x.getHealthCheckComponent().name()+" is Down,");
- }
- });
//Removing the last comma
description = sb.length()>0
? sb.substring(0, sb.length()-1)
: "Onboarding is Down, specific reason unknown";//No Amdocs inner component returned DOWN, but the status of Amdocs HC is still DOWN.
+ if (componentsInfo.size() == 0) {
+ componentsInfo.add(new HealthCheckInfo(HealthCheckComponent.BE, HealthCheckStatus.DOWN, null, description));
+ }
} else {
healthCheckStatus = HealthCheckStatus.UP;
description = "OK";
-
-
}
} catch (Exception e) {
healthCheckStatus = HealthCheckStatus.DOWN;
description = "Onboarding unexpected response: " + e.getMessage();
+ componentsInfo.add(new HealthCheckInfo(HealthCheckComponent.BE, HealthCheckStatus.DOWN, null, description));
} finally {
if (httpClient != null) {
try {
diff --git a/catalog-be/src/main/resources/config/SDC.zip b/catalog-be/src/main/resources/config/SDC.zip
deleted file mode 100644
index a4ff817216..0000000000
--- a/catalog-be/src/main/resources/config/SDC.zip
+++ /dev/null
Binary files differ
diff --git a/catalog-be/src/main/resources/config/license.txt b/catalog-be/src/main/resources/config/license.txt
new file mode 100644
index 0000000000..0a4f362316
--- /dev/null
+++ b/catalog-be/src/main/resources/config/license.txt
@@ -0,0 +1,13 @@
+#
+# 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.
+#
diff --git a/catalog-be/src/main/resources/import/tosca/artifact-types/artifactTypes.yml b/catalog-be/src/main/resources/import/tosca/artifact-types/artifactTypes.yml
new file mode 100644
index 0000000000..7b7e640a3c
--- /dev/null
+++ b/catalog-be/src/main/resources/import/tosca/artifact-types/artifactTypes.yml
@@ -0,0 +1,30 @@
+tosca.artifacts.Root:
+ description: This is the default (root) TOSCA Artifact Type definition that all other TOSCA base Artifact Types derive from.
+
+tosca.artifacts.Deployment.Image:
+ derived_from: tosca.artifacts.Deployment
+ description: This artifact type represents a parent type for any "image" which is an opaque packaging of a TOSCA Node's deployment (whether real or virtual) whose contents are typically already installed and pre-configured (i.e., "stateful") and prepared to be run on a known target container.
+
+tosca.artifacts.Implementation.Bash:
+ derived_from: tosca.artifacts.Implementation
+ description: This artifact type represents a Bash script type that contains Bash commands that can be executed on the Unix Bash shell.
+
+tosca.artifacts.Deployment.Image.VM:
+ derived_from: tosca.artifacts.Deployment
+ description: This artifact represents the parent type for all Virtual Machine (VM) image and container formatted deployment artifacts. These images contain a stateful capture of a machine (e.g., server) including operating system and installed software along with any configurations and can be run on another machine using a hypervisor which virtualizes typical server (i.e., hardware) resources.
+
+tosca.artifacts.Implementation.Python:
+ derived_from: tosca.artifacts.Implementation
+ description: This artifact type represents a Python file that contains Python language constructs that can be executed within a Python interpreter.
+
+tosca.artifacts.Deployment:
+ derived_from: tosca.artifacts.Root
+ description: This artifact type represents the parent type for all deployment artifacts in TOSCA. This class of artifacts typically represents a binary packaging of an application or service that is used to install/create or deploy it as part of a node's lifecycle.
+
+tosca.artifacts.File:
+ derived_from: tosca.artifacts.Root
+ description: This artifact type is used when an artifact definition needs to have its associated file simply treated as a file and no special handling/handlers are invoked (i.e., it is not treated as either an implementation or deployment artifact type).
+
+tosca.artifacts.Implementation:
+ derived_from: tosca.artifacts.Root
+ description: This artifact type represents the parent type for all implementation artifacts in TOSCA. These artifacts are used to implement operations of TOSCA interfaces either directly (e.g., scripts) or indirectly (e.g., config. files).
diff --git a/catalog-be/src/main/resources/import/tosca/artifact-types/artifactTypes.zip b/catalog-be/src/main/resources/import/tosca/artifact-types/artifactTypes.zip
new file mode 100644
index 0000000000..7a0a5d9404
--- /dev/null
+++ b/catalog-be/src/main/resources/import/tosca/artifact-types/artifactTypes.zip
Binary files differ
diff --git a/catalog-be/src/main/resources/import/tosca/relationship-types/relationshipTypes.yml b/catalog-be/src/main/resources/import/tosca/relationship-types/relationshipTypes.yml
new file mode 100644
index 0000000000..5fb5390721
--- /dev/null
+++ b/catalog-be/src/main/resources/import/tosca/relationship-types/relationshipTypes.yml
@@ -0,0 +1,111 @@
+ tosca.relationships.Root:
+ description: This is the default (root) TOSCA Relationship Type definition that all other TOSCA Relationship Types derive from.
+ attributes:
+ tosca_id:
+ description: A unique identifier of the realized instance of a Relationship Template that derives from any TOSCA normative type.
+ type: string
+ tosca_name:
+ description: This attribute reflects the name of the Relationship Template as defined in the TOSCA service template. This name is not unique to the realized instance model of corresponding deployed application as each template in the model can result in one or more instances (e.g., scaled) when orchestrated to a provider environment.
+ type: string
+ state:
+ description: The state of the relationship instance.
+ type: string
+ default: initial
+ interfaces:
+ Configure:
+ type: tosca.interfaces.relationship.Configure
+
+ tosca.relationships.RoutesTo:
+ derived_from: tosca.relationships.ConnectsTo
+ description: This type represents an intentional network routing between two Endpoints in different networks.
+ valid_target_types:
+ - tosca.capabilities.Endpoint
+
+ tosca.relationships.network.LinksTo:
+ derived_from: tosca.relationships.DependsOn
+ description: This relationship type represents an association relationship between Port and Network node types.
+ valid_target_types:
+ - tosca.capabilities.network.Linkable
+
+ tosca.relationships.AttachesTo:
+ derived_from: tosca.relationships.Root
+ description: This type represents an attachment relationship between two nodes. For example, an AttachesTo relationship type would be used for attaching a storage node to a Compute node.
+ valid_target_types:
+ - tosca.capabilities.Attachment
+ properties:
+ location:
+ description: 'The relative location (e.g., path on the file system), which
+ provides the root location to address an attached node. e.g., a mount point
+ / path such as ''/usr/data''. Note: The user must provide it and it cannot
+ be "root".'
+ type: string
+ constraints:
+ - min_length: 1
+ device:
+ description: The logical device name which for the attached device (which is represented by the target node in the model). e.g., '/dev/hda1'.
+ type: string
+ required: false
+ attributes:
+ device:
+ description: 'The logical name of the device as exposed to the instance. Note:
+ A runtime property that gets set when the model gets instantiated by the
+ orchestrator.'
+ type: string
+
+ tosca.relationships.network.BindsTo:
+ derived_from: tosca.relationships.DependsOn
+ description: This type represents a network association relationship between Port and Compute node types.
+ valid_target_types:
+ - tosca.capabilities.network.Bindable
+
+ tosca.relationships.HostedOn:
+ derived_from: tosca.relationships.Root
+ description: This type represents a hosting relationship between two nodes.
+ valid_target_types:
+ - tosca.capabilities.Container
+
+ tosca.relationships.DependsOn:
+ derived_from: tosca.relationships.Root
+ description: This type represents a general dependency relationship between two nodes.
+ valid_target_types:
+ - tosca.capabilities.Node
+
+ tosca.relationships.ConnectsTo:
+ derived_from: tosca.relationships.Root
+ description: This type represents a network connection relationship between two nodes.
+ valid_target_types:
+ - tosca.capabilities.Endpoint
+ properties:
+ credential:
+ type: tosca.datatypes.Credential
+ required: false
+
+ org.openecomp.relationships.VolumeAttachesTo:
+ derived_from: org.openecomp.relationships.AttachesTo
+ description: This type represents an attachment relationship for associating volume
+ properties:
+ volume_id:
+ description: The ID of the volume to be attached
+ type: string
+ status: SUPPORTED
+ required: true
+ instance_uuid:
+ description: The ID of the server to which the volume attaches
+ type: string
+ status: SUPPORTED
+ required: true
+ attributes:
+ show:
+ description: Detailed information about resource
+ type: string
+ status: SUPPORTED
+
+ org.openecomp.relationships.AttachesTo:
+ derived_from: tosca.relationships.AttachesTo
+ description: This type represents an attachment relationship
+ properties:
+ location:
+ description: The relative location (e.g., path on the file system), which provides the root location to address an attached node.
+ type: string
+ status: SUPPORTED
+ required: false \ No newline at end of file
diff --git a/catalog-be/src/main/resources/import/tosca/relationship-types/relationshipTypes.zip b/catalog-be/src/main/resources/import/tosca/relationship-types/relationshipTypes.zip
new file mode 100644
index 0000000000..dbb1ca02f2
--- /dev/null
+++ b/catalog-be/src/main/resources/import/tosca/relationship-types/relationshipTypes.zip
Binary files differ