diff options
27 files changed, 851 insertions, 1 deletions
diff --git a/vagrant/installer.sh b/vagrant/installer.sh index 5ac06513..dd5b77b6 100755 --- a/vagrant/installer.sh +++ b/vagrant/installer.sh @@ -181,7 +181,9 @@ function install_plugin { if [[ -n "${testing_enabled+x}" ]]; then docker-compose up -d pushd $krd_tests - bash plugin.sh + for functional_test in plugin plugin_edgex; do + bash ${functional_test}.sh + done popd fi popd diff --git a/vagrant/tests/edgex/deployments/command-deployment.yaml b/vagrant/tests/edgex/deployments/command-deployment.yaml new file mode 100644 index 00000000..ba4e3c12 --- /dev/null +++ b/vagrant/tests/edgex/deployments/command-deployment.yaml @@ -0,0 +1,46 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + io.kompose.service: edgex-core-command + name: edgex-core-command +spec: + selector: + matchLabels: + io.kompose.service: edgex-core-command + replicas: 1 + template: + metadata: + labels: + io.kompose.service: edgex-core-command + spec: + containers: + - image: edgexfoundry/docker-core-command:0.2.1 + name: edgex-core-command + ports: + - containerPort: 48082 + resources: {} + volumeMounts: + - mountPath: /data/db + name: data-db + - mountPath: /edgex/logs + name: edgex-logs + - mountPath: /consul/config + name: consul-config + - mountPath: /consul/data + name: consul-data + restartPolicy: Always + volumes: + - name: data-db + hostPath: + path: /data/db + - name: edgex-logs + hostPath: + path: /edgex/logs + - name: consul-config + hostPath: + path: /consul/config + - name: consul-data + hostPath: + path: /consul/data +status: {} diff --git a/vagrant/tests/edgex/deployments/consul-deployment.yaml b/vagrant/tests/edgex/deployments/consul-deployment.yaml new file mode 100644 index 00000000..157a2130 --- /dev/null +++ b/vagrant/tests/edgex/deployments/consul-deployment.yaml @@ -0,0 +1,48 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + io.kompose.service: edgex-core-consul + name: edgex-core-consul +spec: + selector: + matchLabels: + io.kompose.service: edgex-core-consul + replicas: 1 + template: + metadata: + labels: + io.kompose.service: edgex-core-consul + spec: + containers: + - image: edgexfoundry/docker-core-consul:latest + name: edgex-core-consul + ports: + - containerPort: 8400 + - containerPort: 8500 + - containerPort: 8600 + resources: {} + volumeMounts: + - mountPath: /data/db + name: data-db + - mountPath: /edgex/logs + name: edgex-logs + - mountPath: /consul/config + name: consul-config + - mountPath: /consul/data + name: consul-data + restartPolicy: Always + volumes: + - name: data-db + hostPath: + path: /data/db + - name: edgex-logs + hostPath: + path: /edgex/logs + - name: consul-config + hostPath: + path: /consul/config + - name: consul-data + hostPath: + path: /consul/data +status: {} diff --git a/vagrant/tests/edgex/deployments/data-deployment.yaml b/vagrant/tests/edgex/deployments/data-deployment.yaml new file mode 100644 index 00000000..64d28a4c --- /dev/null +++ b/vagrant/tests/edgex/deployments/data-deployment.yaml @@ -0,0 +1,47 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + io.kompose.service: edgex-core-data + name: edgex-core-data +spec: + selector: + matchLabels: + io.kompose.service: edgex-core-data + replicas: 1 + template: + metadata: + labels: + io.kompose.service: edgex-core-data + spec: + containers: + - image: edgexfoundry/docker-core-data:0.2.1 + name: edgex-core-data + ports: + - containerPort: 48080 + - containerPort: 5563 + resources: {} + volumeMounts: + - mountPath: /data/db + name: data-db + - mountPath: /edgex/logs + name: edgex-logs + - mountPath: /consul/config + name: consul-config + - mountPath: /consul/data + name: consul-data + restartPolicy: Always + volumes: + - name: data-db + hostPath: + path: /data/db + - name: edgex-logs + hostPath: + path: /edgex/logs + - name: consul-config + hostPath: + path: /consul/config + - name: consul-data + hostPath: + path: /consul/data +status: {} diff --git a/vagrant/tests/edgex/deployments/device-bluetooth-deployment.yaml b/vagrant/tests/edgex/deployments/device-bluetooth-deployment.yaml new file mode 100644 index 00000000..9dc96785 --- /dev/null +++ b/vagrant/tests/edgex/deployments/device-bluetooth-deployment.yaml @@ -0,0 +1,49 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + io.kompose.service: edgex-device-bluetooth + name: edgex-device-bluetooth +spec: + selector: + matchLabels: + io.kompose.service: edgex-device-bluetooth + replicas: 1 + template: + metadata: + creationTimestamp: null + labels: + io.kompose.service: edgex-device-bluetooth + spec: + containers: + - image: edgexfoundry/docker-device-bluetooth:0.2.1 + name: edgex-device-bluetooth + ports: + - containerPort: 49988 + resources: {} + securityContext: + privileged: true + volumeMounts: + - mountPath: /data/db + name: data-db + - mountPath: /edgex/logs + name: edgex-logs + - mountPath: /consul/config + name: consul-config + - mountPath: /consul/data + name: consul-data + restartPolicy: Always + volumes: + - name: data-db + hostPath: + path: /data/db + - name: edgex-logs + hostPath: + path: /edgex/logs + - name: consul-config + hostPath: + path: /consul/config + - name: consul-data + hostPath: + path: /consul/data +status: {} diff --git a/vagrant/tests/edgex/deployments/export-client-deployment.yaml b/vagrant/tests/edgex/deployments/export-client-deployment.yaml new file mode 100644 index 00000000..191abc4f --- /dev/null +++ b/vagrant/tests/edgex/deployments/export-client-deployment.yaml @@ -0,0 +1,46 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + io.kompose.service: edgex-export-client + name: edgex-export-client +spec: + selector: + matchLabels: + io.kompose.service: edgex-export-client + replicas: 1 + template: + metadata: + labels: + io.kompose.service: edgex-export-client + spec: + containers: + - image: edgexfoundry/docker-export-client:0.2.1 + name: edgex-export-client + ports: + - containerPort: 48071 + resources: {} + volumeMounts: + - mountPath: /data/db + name: data-db + - mountPath: /edgex/logs + name: edgex-logs + - mountPath: /consul/config + name: consul-config + - mountPath: /consul/data + name: consul-data + restartPolicy: Always + volumes: + - name: data-db + hostPath: + path: /data/db + - name: edgex-logs + hostPath: + path: /edgex/logs + - name: consul-config + hostPath: + path: /consul/config + - name: consul-data + hostPath: + path: /consul/data +status: {} diff --git a/vagrant/tests/edgex/deployments/export-distro-deployment.yaml b/vagrant/tests/edgex/deployments/export-distro-deployment.yaml new file mode 100644 index 00000000..ff0d880e --- /dev/null +++ b/vagrant/tests/edgex/deployments/export-distro-deployment.yaml @@ -0,0 +1,47 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + io.kompose.service: edgex-export-distro + name: edgex-export-distro +spec: + selector: + matchLabels: + io.kompose.service: edgex-export-distro + replicas: 1 + template: + metadata: + labels: + io.kompose.service: edgex-export-distro + spec: + containers: + - image: edgexfoundry/docker-export-distro:0.2.1 + name: edgex-export-distro + ports: + - containerPort: 48070 + - containerPort: 5566 + resources: {} + volumeMounts: + - mountPath: /data/db + name: data-db + - mountPath: /edgex/logs + name: edgex-logs + - mountPath: /consul/config + name: consul-config + - mountPath: /consul/data + name: consul-data + restartPolicy: Always + volumes: + - name: data-db + hostPath: + path: /data/db + - name: edgex-logs + hostPath: + path: /edgex/logs + - name: consul-config + hostPath: + path: /consul/config + - name: consul-data + hostPath: + path: /consul/data +status: {} diff --git a/vagrant/tests/edgex/deployments/logging-deployment.yaml b/vagrant/tests/edgex/deployments/logging-deployment.yaml new file mode 100644 index 00000000..a52085bc --- /dev/null +++ b/vagrant/tests/edgex/deployments/logging-deployment.yaml @@ -0,0 +1,47 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + io.kompose.service: edgex-support-logging + name: edgex-support-logging +spec: + selector: + matchLabels: + io.kompose.service: edgex-support-logging + replicas: 1 + template: + metadata: + labels: + io.kompose.service: edgex-support-logging + spec: + containers: + - image: edgexfoundry/docker-support-logging:0.2.1 + name: edgex-support-logging + ports: + - containerPort: 48061 + resources: {} + volumeMounts: + - mountPath: /data/db + name: data-db + - mountPath: /edgex/logs + name: edgex-logs + - mountPath: /consul/config + name: consul-config + - mountPath: /consul/data + name: consul-data + restartPolicy: Always + volumes: + - name: data-db + hostPath: + path: /data/db + - name: edgex-logs + hostPath: + path: /edgex/logs + - name: consul-config + hostPath: + path: /consul/config + - name: consul-data + hostPath: + path: /consul/data +status: {} + diff --git a/vagrant/tests/edgex/deployments/metadata-deployment.yaml b/vagrant/tests/edgex/deployments/metadata-deployment.yaml new file mode 100644 index 00000000..44eb8114 --- /dev/null +++ b/vagrant/tests/edgex/deployments/metadata-deployment.yaml @@ -0,0 +1,46 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + io.kompose.service: edgex-core-metadata + name: edgex-core-metadata +spec: + selector: + matchLabels: + io.kompose.service: edgex-core-metadata + replicas: 1 + template: + metadata: + labels: + io.kompose.service: edgex-core-metadata + spec: + containers: + - image: edgexfoundry/docker-core-metadata:0.2.1 + name: edgex-core-metadata + ports: + - containerPort: 48081 + resources: {} + volumeMounts: + - mountPath: /data/db + name: data-db + - mountPath: /edgex/logs + name: edgex-logs + - mountPath: /consul/config + name: consul-config + - mountPath: /consul/data + name: consul-data + restartPolicy: Always + volumes: + - name: data-db + hostPath: + path: /data/db + - name: edgex-logs + hostPath: + path: /edgex/logs + - name: consul-config + hostPath: + path: /consul/config + - name: consul-data + hostPath: + path: /consul/data +status: {} diff --git a/vagrant/tests/edgex/deployments/mongo-deployment.yaml b/vagrant/tests/edgex/deployments/mongo-deployment.yaml new file mode 100644 index 00000000..26df5f02 --- /dev/null +++ b/vagrant/tests/edgex/deployments/mongo-deployment.yaml @@ -0,0 +1,46 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + io.kompose.service: edgex-mongo + name: edgex-mongo +spec: + selector: + matchLabels: + io.kompose.service: edgex-mongo + replicas: 1 + template: + metadata: + labels: + io.kompose.service: edgex-mongo + spec: + containers: + - image: edgexfoundry/docker-edgex-mongo:0.2 + name: edgex-mongo + ports: + - containerPort: 27017 + resources: {} + volumeMounts: + - mountPath: /data/db + name: data-db + - mountPath: /edgex/logs + name: edgex-logs + - mountPath: /consul/config + name: consul-config + - mountPath: /consul/data + name: consul-data + restartPolicy: Always + volumes: + - name: data-db + hostPath: + path: /data/db + - name: edgex-logs + hostPath: + path: /edgex/logs + - name: consul-config + hostPath: + path: /consul/config + - name: consul-data + hostPath: + path: /consul/data +status: {} diff --git a/vagrant/tests/edgex/deployments/notifications-deployment.yaml b/vagrant/tests/edgex/deployments/notifications-deployment.yaml new file mode 100644 index 00000000..447789e3 --- /dev/null +++ b/vagrant/tests/edgex/deployments/notifications-deployment.yaml @@ -0,0 +1,46 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + io.kompose.service: edgex-support-notifications + name: edgex-support-notifications +spec: + selector: + matchLabels: + io.kompose.service: edgex-support-notifications + replicas: 1 + template: + metadata: + labels: + io.kompose.service: edgex-support-notifications + spec: + containers: + - image: edgexfoundry/docker-support-notifications:0.2 + name: edgex-support-notifications + ports: + - containerPort: 48060 + resources: {} + volumeMounts: + - mountPath: /data/db + name: data-db + - mountPath: /edgex/logs + name: edgex-logs + - mountPath: /consul/config + name: consul-config + - mountPath: /consul/data + name: consul-data + restartPolicy: Always + volumes: + - name: data-db + hostPath: + path: /data/db + - name: edgex-logs + hostPath: + path: /edgex/logs + - name: consul-config + hostPath: + path: /consul/config + - name: consul-data + hostPath: + path: /consul/data +status: {} diff --git a/vagrant/tests/edgex/deployments/rulesengine-deployment.yaml b/vagrant/tests/edgex/deployments/rulesengine-deployment.yaml new file mode 100644 index 00000000..1d49b67a --- /dev/null +++ b/vagrant/tests/edgex/deployments/rulesengine-deployment.yaml @@ -0,0 +1,46 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + io.kompose.service: edgex-support-rulesengine + name: rulesengine +spec: + selector: + matchLabels: + io.kompose.service: edgex-support-rulesengine + replicas: 1 + template: + metadata: + labels: + io.kompose.service: edgex-support-rulesengine + spec: + containers: + - image: edgexfoundry/docker-support-rulesengine:0.2.1 + name: edgex-support-rulesengine + ports: + - containerPort: 48075 + resources: {} + volumeMounts: + - mountPath: /data/db + name: data-db + - mountPath: /edgex/logs + name: edgex-logs + - mountPath: /consul/config + name: consul-config + - mountPath: /consul/data + name: consul-data + restartPolicy: Always + volumes: + - name: data-db + hostPath: + path: /data/db + - name: edgex-logs + hostPath: + path: /edgex/logs + - name: consul-config + hostPath: + path: /consul/config + - name: consul-data + hostPath: + path: /consul/data +status: {} diff --git a/vagrant/tests/edgex/deployments/scheduler-deployment.yaml b/vagrant/tests/edgex/deployments/scheduler-deployment.yaml new file mode 100644 index 00000000..94e4226b --- /dev/null +++ b/vagrant/tests/edgex/deployments/scheduler-deployment.yaml @@ -0,0 +1,46 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + io.kompose.service: edgex-support-scheduler + name: edgex-support-scheduler +spec: + selector: + matchLabels: + io.kompose.service: edgex-support-scheduler + replicas: 1 + template: + metadata: + labels: + io.kompose.service: edgex-support-scheduler + spec: + containers: + - image: edgexfoundry/docker-support-scheduler:0.2.1 + name: edgex-support-scheduler + ports: + - containerPort: 48085 + resources: {} + volumeMounts: + - mountPath: /data/db + name: data-db + - mountPath: /edgex/logs + name: edgex-logs + - mountPath: /consul/config + name: consul-config + - mountPath: /consul/data + name: consul-data + restartPolicy: Always + volumes: + - name: data-db + hostPath: + path: /data/db + - name: edgex-logs + hostPath: + path: /edgex/logs + - name: consul-config + hostPath: + path: /consul/config + - name: consul-data + hostPath: + path: /consul/data +status: {} diff --git a/vagrant/tests/edgex/metadata.yaml b/vagrant/tests/edgex/metadata.yaml new file mode 100644 index 00000000..63f784dc --- /dev/null +++ b/vagrant/tests/edgex/metadata.yaml @@ -0,0 +1,27 @@ +resources: + deployment: + - deployments/command-deployment.yaml + - deployments/consul-deployment.yaml + - deployments/data-deployment.yaml + - deployments/device-bluetooth-deployment.yaml + - deployments/export-client-deployment.yaml + - deployments/export-distro-deployment.yaml + - deployments/logging-deployment.yaml + - deployments/metadata-deployment.yaml + - deployments/mongo-deployment.yaml + - deployments/notifications-deployment.yaml + - deployments/rulesengine-deployment.yaml + - deployments/scheduler-deployment.yaml + service: + - services/command-service.yaml + - services/consul-service.yaml + - services/data-service.yaml + - services/device-bluetooth-service.yaml + - services/export-client-service.yaml + - services/export-distro-service.yaml + - services/logging-service.yaml + - services/metadata-service.yaml + - services/mongo-service.yaml + - services/notifications-service.yaml + - services/rulesengine-service.yaml + - services/scheduler-service.yaml
\ No newline at end of file diff --git a/vagrant/tests/edgex/services/command-service.yaml b/vagrant/tests/edgex/services/command-service.yaml new file mode 100644 index 00000000..f8d7d745 --- /dev/null +++ b/vagrant/tests/edgex/services/command-service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + io.kompose.service: edgex-core-command + name: edgex-core-command +spec: + ports: + - name: "48082" + port: 48082 + targetPort: 48082 + selector: + io.kompose.service: edgex-core-command +status: + loadBalancer: {} diff --git a/vagrant/tests/edgex/services/consul-service.yaml b/vagrant/tests/edgex/services/consul-service.yaml new file mode 100644 index 00000000..7b5c6ddc --- /dev/null +++ b/vagrant/tests/edgex/services/consul-service.yaml @@ -0,0 +1,21 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + io.kompose.service: edgex-core-consul + name: edgex-core-consul +spec: + ports: + - name: "8400" + port: 8400 + targetPort: 8400 + - name: "8500" + port: 8500 + targetPort: 8500 + - name: "8600" + port: 8600 + targetPort: 8600 + selector: + io.kompose.service: edgex-core-consul +status: + loadBalancer: {} diff --git a/vagrant/tests/edgex/services/data-service.yaml b/vagrant/tests/edgex/services/data-service.yaml new file mode 100644 index 00000000..fc6e5566 --- /dev/null +++ b/vagrant/tests/edgex/services/data-service.yaml @@ -0,0 +1,18 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + io.kompose.service: edgex-core-data + name: edgex-core-data +spec: + ports: + - name: "48080" + port: 48080 + targetPort: 48080 + - name: "5563" + port: 5563 + targetPort: 5563 + selector: + io.kompose.service: edgex-core-data +status: + loadBalancer: {} diff --git a/vagrant/tests/edgex/services/device-bluetooth-service.yaml b/vagrant/tests/edgex/services/device-bluetooth-service.yaml new file mode 100644 index 00000000..48ffc9ef --- /dev/null +++ b/vagrant/tests/edgex/services/device-bluetooth-service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + io.kompose.service: edgex-device-bluetooth + name: edgex-device-bluetooth +spec: + ports: + - name: "49988" + port: 49988 + targetPort: 49988 + selector: + io.kompose.service: edgex-device-bluetooth +status: + loadBalancer: {} diff --git a/vagrant/tests/edgex/services/export-client-service.yaml b/vagrant/tests/edgex/services/export-client-service.yaml new file mode 100644 index 00000000..709953cd --- /dev/null +++ b/vagrant/tests/edgex/services/export-client-service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + io.kompose.service: edgex-export-client + name: edgex-export-client +spec: + ports: + - name: "48071" + port: 48071 + targetPort: 48071 + selector: + io.kompose.service: edgex-export-client +status: + loadBalancer: {} diff --git a/vagrant/tests/edgex/services/export-distro-service.yaml b/vagrant/tests/edgex/services/export-distro-service.yaml new file mode 100644 index 00000000..19d6bf5e --- /dev/null +++ b/vagrant/tests/edgex/services/export-distro-service.yaml @@ -0,0 +1,18 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + io.kompose.service: edgex-export-distro + name: edgex-export-distro +spec: + ports: + - name: "48070" + port: 48070 + targetPort: 48070 + - name: "5566" + port: 5566 + targetPort: 5566 + selector: + io.kompose.service: edgex-export-distro +status: + loadBalancer: {} diff --git a/vagrant/tests/edgex/services/logging-service.yaml b/vagrant/tests/edgex/services/logging-service.yaml new file mode 100644 index 00000000..a25d9a9e --- /dev/null +++ b/vagrant/tests/edgex/services/logging-service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + io.kompose.service: edgex-support-logging + name: edgex-support-logging +spec: + ports: + - name: "48061" + port: 48061 + targetPort: 48061 + selector: + io.kompose.service: edgex-support-logging +status: + loadBalancer: {} diff --git a/vagrant/tests/edgex/services/metadata-service.yaml b/vagrant/tests/edgex/services/metadata-service.yaml new file mode 100644 index 00000000..12f76836 --- /dev/null +++ b/vagrant/tests/edgex/services/metadata-service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + io.kompose.service: edgex-core-metadata + name: edgex-core-metadata +spec: + ports: + - name: "48081" + port: 48081 + targetPort: 48081 + selector: + io.kompose.service: edgex-core-metadata +status: + loadBalancer: {} diff --git a/vagrant/tests/edgex/services/mongo-service.yaml b/vagrant/tests/edgex/services/mongo-service.yaml new file mode 100644 index 00000000..0c919b79 --- /dev/null +++ b/vagrant/tests/edgex/services/mongo-service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + io.kompose.service: edgex-mongo + name: edgex-mongo +spec: + ports: + - name: "27017" + port: 27017 + targetPort: 27017 + selector: + io.kompose.service: edgex-mongo +status: + loadBalancer: {} diff --git a/vagrant/tests/edgex/services/notifications-service.yaml b/vagrant/tests/edgex/services/notifications-service.yaml new file mode 100644 index 00000000..3245282b --- /dev/null +++ b/vagrant/tests/edgex/services/notifications-service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + io.kompose.service: edgex-support-notifications + name: edgex-support-notifications +spec: + ports: + - name: "48060" + port: 48060 + targetPort: 48060 + selector: + io.kompose.service: edgex-support-notifications +status: + loadBalancer: {} diff --git a/vagrant/tests/edgex/services/rulesengine-service.yaml b/vagrant/tests/edgex/services/rulesengine-service.yaml new file mode 100644 index 00000000..238c32ce --- /dev/null +++ b/vagrant/tests/edgex/services/rulesengine-service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + io.kompose.service: edgex-support-rulesengine + name: edgex-support-rulesengine +spec: + ports: + - name: "48075" + port: 48075 + targetPort: 48075 + selector: + io.kompose.service: edgex-support-rulesengine +status: + loadBalancer: {} diff --git a/vagrant/tests/edgex/services/scheduler-service.yaml b/vagrant/tests/edgex/services/scheduler-service.yaml new file mode 100644 index 00000000..03ac0818 --- /dev/null +++ b/vagrant/tests/edgex/services/scheduler-service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + io.kompose.service: edgex-support-scheduler + name: edgex-support-scheduler +spec: + ports: + - name: "48085" + port: 48085 + targetPort: 48085 + selector: + io.kompose.service: edgex-support-scheduler +status: + loadBalancer: {} diff --git a/vagrant/tests/plugin_edgex.sh b/vagrant/tests/plugin_edgex.sh new file mode 100755 index 00000000..575040bb --- /dev/null +++ b/vagrant/tests/plugin_edgex.sh @@ -0,0 +1,69 @@ +#!/bin/bash +# SPDX-license-identifier: Apache-2.0 +############################################################################## +# Copyright (c) 2018 +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +set -o errexit +set -o nounset +set -o pipefail +#set -o xtrace + +source _functions.sh + +base_url="http://localhost:8081/v1/vnf_instances/" +cloud_region_id="krd" +namespace="default" +csar_id=cb009bfe-bbee-11e8-9766-525400435678 + +# Setup +_checks_args ${csar_id} +cp -R ./edgex/* ${CSAR_DIR}/${csar_id}/ + +# Test +payload_raw=" +{ + \"cloud_region_id\": \"$cloud_region_id\", + \"namespace\": \"$namespace\", + \"csar_id\": \"$csar_id\" +} +" +payload=$(echo $payload_raw | tr '\n' ' ') + +echo "Creating EdgeX VNF Instance" + +vnf_id=$(curl -s -d "$payload" "${base_url}" | jq -r '.vnf_id') + +echo "=== Validating Kubernetes ===" +kubectl get --no-headers=true --namespace=${namespace} deployment ${cloud_region_id}-${namespace}-${vnf_id}-edgex-core-command +kubectl get --no-headers=true --namespace=${namespace} service ${cloud_region_id}-${namespace}-${vnf_id}-edgex-core-command +echo "VNF Instance created succesfully with id: $vnf_id" + +# TODO: Add heath checks to verify EdgeX services + +vnf_id_list=$(curl -s -X GET "${base_url}${cloud_region_id}/${namespace}" | jq -r '.vnf_id_list') +if [[ "$vnf_id_list" != *"${vnf_id}"* ]]; then + echo $vnf_id_list + echo "VNF Instance not stored" + exit 1 +fi + +vnf_details=$(curl -s -X GET "${base_url}${cloud_region_id}/${namespace}/${vnf_id}") +if [[ -z "$vnf_details" ]]; then + echo "Cannot retrieved VNF Instance details" + exit 1 +fi +echo "VNF details $vnf_details" + +echo "Deleting $vnf_id VNF Instance" +curl -X DELETE "${base_url}${cloud_region_id}/${namespace}/${vnf_id}" +if [[ -n $(curl -s -X GET "${base_url}${cloud_region_id}/${namespace}/${vnf_id}") ]]; then + echo "VNF Instance not deleted" + exit 1 +fi + +# Teardown |