[VOL-2870]v2
- Enable YAML/JSON linting
- Fix formatting in files
- Fix minor shellcheck issue on voltha tool
Change-Id: I6d29830a7b60c32e09aca49b22125c350c4d1693
diff --git a/Makefile b/Makefile
index 4c61b4e..e22fe44 100644
--- a/Makefile
+++ b/Makefile
@@ -6,9 +6,9 @@
SHELL = bash -eu -o pipefail
.DEFAULT_GOAL := help
-.PHONY: test shellcheck yamllint jsonlint help
+.PHONY: test shellcheck yamllint lint-json help
-test: shellcheck ## run all tests
+test: shellcheck lint-json yamllint ## run all tests
SHELL_FILES := voltha
shellcheck: ## check shell scripts with shellcheck
@@ -23,11 +23,14 @@
-s $(YAML_FILES)
JSON_FILES ?= $(shell find . -type f -name '*.json' -print )
-jsonlint: ## lint check JSON files with yamllint
- echo "Not supported yet, would check these files: $(JSON_FILES)"
+lint-json: ## lint check JSON files by loading them with python
+ for jsonfile in $(JSON_FILES); do \
+ echo "Validating json file: $$jsonfile" ;\
+ python -m json.tool $$jsonfile > /dev/null ;\
+ done
-help: ## Print help for each target
+help: ## Print help for each Makefile target
@echo kind-voltha Makefile targets
@echo
- @grep '^[[:alpha:]_-]*:.* ##' $(MAKEFILE_LIST) \
+ @grep '^[[:alnum:]_-]*:.* ##' $(MAKEFILE_LIST) \
| sort | awk 'BEGIN {FS=":.* ## "}; {printf "%-25s %s\n", $$1, $$2};'
diff --git a/full-cluster.cfg b/full-cluster.cfg
index a2d6d71..6808558 100644
--- a/full-cluster.cfg
+++ b/full-cluster.cfg
@@ -1,3 +1,4 @@
+---
# Copyright 2019 Ciena Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -15,7 +16,7 @@
kind: Cluster
apiVersion: kind.sigs.k8s.io/v1alpha3
nodes:
-- role: control-plane
-- role: worker
-- role: worker
-- role: worker
+ - role: control-plane
+ - role: worker
+ - role: worker
+ - role: worker
diff --git a/full-values.yaml b/full-values.yaml
index e9402c1..c319432 100644
--- a/full-values.yaml
+++ b/full-values.yaml
@@ -1,3 +1,4 @@
+---
# Copyright 2019 Ciena Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -97,16 +98,16 @@
replicas: 3
onos_env:
-- name: POD_IP
- valueFrom:
- fieldRef:
- fieldPath: status.podIP
-- name: NAMESPACE
- valueFrom:
- fieldRef:
- fieldPath: metadata.namespace
-- name: ONOS_APPS
- value: "drivers,openflow-base,hostprovider"
+ - name: POD_IP
+ valueFrom:
+ fieldRef:
+ fieldPath: status.podIP
+ - name: NAMESPACE
+ valueFrom:
+ fieldRef:
+ fieldPath: metadata.namespace
+ - name: ONOS_APPS
+ value: "drivers,openflow-base,hostprovider"
# Customization for BBSIM
kafka_broker: 'voltha-kafka.voltha.svc.cluster.local:9092'
@@ -125,100 +126,100 @@
# If you want to be more selected then comment the blocks that pertain to the
# targets you care about.
-#extra_deployment_labels:
-# kube-monkey/enabled: enabled
-# kube-monkey/identifier: monkey-victim
-# kube-monkey/mtbf: 1
-# kube-monkey/kill-mode: fixed
-# kube-monkey/kill-value: 1
+# extra_deployment_labels:
+# kube-monkey/enabled: enabled
+# kube-monkey/identifier: monkey-victim
+# kube-monkey/mtbf: 1
+# kube-monkey/kill-mode: fixed
+# kube-monkey/kill-value: 1
#
-#extra_pod_labels:
-# kube-monkey/enabled: enabled
-# kube-monkey/identifier: monkey-victim
-# kube-monkey/mtbf: 1
-# kube-monkey/kill-mode: fixed
-# kube-monkey/kill-value: 1
+# extra_pod_labels:
+# kube-monkey/enabled: enabled
+# kube-monkey/identifier: monkey-victim
+# kube-monkey/mtbf: 1
+# kube-monkey/kill-mode: fixed
+# kube-monkey/kill-value: 1
#
-#rw_core_deployment_labels:
-# kube-monkey/enabled: enabled
-# kube-monkey/identifier: monkey-victim
-# kube-monkey/mtbf: 1
-# kube-monkey/kill-mode: fixed
-# kube-monkey/kill-value: 1
+# rw_core_deployment_labels:
+# kube-monkey/enabled: enabled
+# kube-monkey/identifier: monkey-victim
+# kube-monkey/mtbf: 1
+# kube-monkey/kill-mode: fixed
+# kube-monkey/kill-value: 1
#
-#rw_core_pod_labels:
-# kube-monkey/enabled: enabled
-# kube-monkey/identifier: monkey-victim
-# kube-monkey/mtbf: 1
-# kube-monkey/kill-mode: fixed
-# kube-monkey/kill-value: 1
+# rw_core_pod_labels:
+# kube-monkey/enabled: enabled
+# kube-monkey/identifier: monkey-victim
+# kube-monkey/mtbf: 1
+# kube-monkey/kill-mode: fixed
+# kube-monkey/kill-value: 1
#
-#ofagent_deployment_labels:
-# kube-monkey/enabled: enabled
-# kube-monkey/identifier: monkey-victim
-# kube-monkey/mtbf: 1
-# kube-monkey/kill-mode: fixed
-# kube-monkey/kill-value: 1
+# ofagent_deployment_labels:
+# kube-monkey/enabled: enabled
+# kube-monkey/identifier: monkey-victim
+# kube-monkey/mtbf: 1
+# kube-monkey/kill-mode: fixed
+# kube-monkey/kill-value: 1
#
-#ofagent_pod_labels:
-# kube-monkey/enabled: enabled
-# kube-monkey/identifier: monkey-victim
-# kube-monkey/mtbf: 1
-# kube-monkey/kill-mode: fixed
-# kube-monkey/kill-value: 1
+# ofagent_pod_labels:
+# kube-monkey/enabled: enabled
+# kube-monkey/identifier: monkey-victim
+# kube-monkey/mtbf: 1
+# kube-monkey/kill-mode: fixed
+# kube-monkey/kill-value: 1
#
-#openolt_deployment_labels:
-# kube-monkey/enabled: enabled
-# kube-monkey/identifier: monkey-victim
-# kube-monkey/mtbf: 1
-# kube-monkey/kill-mode: fixed
-# kube-monkey/kill-value: 1
+# openolt_deployment_labels:
+# kube-monkey/enabled: enabled
+# kube-monkey/identifier: monkey-victim
+# kube-monkey/mtbf: 1
+# kube-monkey/kill-mode: fixed
+# kube-monkey/kill-value: 1
#
-#openolt_pod_labels:
-# kube-monkey/enabled: enabled
-# kube-monkey/identifier: monkey-victim
-# kube-monkey/mtbf: 1
-# kube-monkey/kill-mode: fixed
-# kube-monkey/kill-value: 1
+# openolt_pod_labels:
+# kube-monkey/enabled: enabled
+# kube-monkey/identifier: monkey-victim
+# kube-monkey/mtbf: 1
+# kube-monkey/kill-mode: fixed
+# kube-monkey/kill-value: 1
#
-#openonu_deployment_labels:
-# kube-monkey/enabled: enabled
-# kube-monkey/identifier: monkey-victim
-# kube-monkey/mtbf: 1
-# kube-monkey/kill-mode: fixed
-# kube-monkey/kill-value: 1
+# openonu_deployment_labels:
+# kube-monkey/enabled: enabled
+# kube-monkey/identifier: monkey-victim
+# kube-monkey/mtbf: 1
+# kube-monkey/kill-mode: fixed
+# kube-monkey/kill-value: 1
#
-#openonu_pod_labels:
-# kube-monkey/enabled: enabled
-# kube-monkey/identifier: monkey-victim
-# kube-monkey/mtbf: 1
-# kube-monkey/kill-mode: fixed
-# kube-monkey/kill-value: 1
+# openonu_pod_labels:
+# kube-monkey/enabled: enabled
+# kube-monkey/identifier: monkey-victim
+# kube-monkey/mtbf: 1
+# kube-monkey/kill-mode: fixed
+# kube-monkey/kill-value: 1
#
-#simolt_deployment_labels:
-# kube-monkey/enabled: enabled
-# kube-monkey/identifier: monkey-victim
-# kube-monkey/mtbf: 1
-# kube-monkey/kill-mode: fixed
-# kube-monkey/kill-value: 1
+# simolt_deployment_labels:
+# kube-monkey/enabled: enabled
+# kube-monkey/identifier: monkey-victim
+# kube-monkey/mtbf: 1
+# kube-monkey/kill-mode: fixed
+# kube-monkey/kill-value: 1
#
-#simolt_pod_labels:
-# kube-monkey/enabled: enabled
-# kube-monkey/identifier: monkey-victim
-# kube-monkey/mtbf: 1
-# kube-monkey/kill-mode: fixed
-# kube-monkey/kill-value: 1
+# simolt_pod_labels:
+# kube-monkey/enabled: enabled
+# kube-monkey/identifier: monkey-victim
+# kube-monkey/mtbf: 1
+# kube-monkey/kill-mode: fixed
+# kube-monkey/kill-value: 1
#
-#simonu_deployment_labels:
-# kube-monkey/enabled: enabled
-# kube-monkey/identifier: monkey-victim
-# kube-monkey/mtbf: 1
-# kube-monkey/kill-mode: fixed
-# kube-monkey/kill-value: 1
+# simonu_deployment_labels:
+# kube-monkey/enabled: enabled
+# kube-monkey/identifier: monkey-victim
+# kube-monkey/mtbf: 1
+# kube-monkey/kill-mode: fixed
+# kube-monkey/kill-value: 1
#
-#simonu_pod_labels:
-# kube-monkey/enabled: enabled
-# kube-monkey/identifier: monkey-victim
-# kube-monkey/mtbf: 1
-# kube-monkey/kill-mode: fixed
-# kube-monkey/kill-value: 1
+# simonu_pod_labels:
+# kube-monkey/enabled: enabled
+# kube-monkey/identifier: monkey-victim
+# kube-monkey/mtbf: 1
+# kube-monkey/kill-mode: fixed
+# kube-monkey/kill-value: 1
diff --git a/minimal-cluster.cfg b/minimal-cluster.cfg
index 716bc95..127a19a 100644
--- a/minimal-cluster.cfg
+++ b/minimal-cluster.cfg
@@ -1,3 +1,4 @@
+---
# Copyright 2019 Ciena Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -15,7 +16,7 @@
kind: Cluster
apiVersion: kind.sigs.k8s.io/v1alpha3
nodes:
-- role: control-plane
- extraPortMappings:
-- role: worker
-- role: worker
+ - role: control-plane
+ extraPortMappings:
+ - role: worker
+ - role: worker
diff --git a/minimal-values.yaml b/minimal-values.yaml
index 006f853..16ec3f9 100644
--- a/minimal-values.yaml
+++ b/minimal-values.yaml
@@ -1,3 +1,4 @@
+---
# Copyright 2019 Ciena Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -114,16 +115,16 @@
replicas: 1
onos_env:
-- name: POD_IP
- valueFrom:
- fieldRef:
- fieldPath: status.podIP
-- name: NAMESPACE
- valueFrom:
- fieldRef:
- fieldPath: metadata.namespace
-- name: ONOS_APPS
- value: "drivers,openflow-base,hostprovider"
+ - name: POD_IP
+ valueFrom:
+ fieldRef:
+ fieldPath: status.podIP
+ - name: NAMESPACE
+ valueFrom:
+ fieldRef:
+ fieldPath: metadata.namespace
+ - name: ONOS_APPS
+ value: "drivers,openflow-base,hostprovider"
# Customization for BBSIM
kafka_broker: 'voltha-kafka.voltha.svc.cluster.local:9092'
@@ -142,100 +143,100 @@
# If you want to be more selected then comment the blocks that pertain to the
# targets you care about.
-#extra_deployment_labels:
-# kube-monkey/enabled: enabled
-# kube-monkey/identifier: monkey-victim
-# kube-monkey/mtbf: 1
-# kube-monkey/kill-mode: fixed
-# kube-monkey/kill-value: 1
+# extra_deployment_labels:
+# kube-monkey/enabled: enabled
+# kube-monkey/identifier: monkey-victim
+# kube-monkey/mtbf: 1
+# kube-monkey/kill-mode: fixed
+# kube-monkey/kill-value: 1
#
-#extra_pod_labels:
-# kube-monkey/enabled: enabled
-# kube-monkey/identifier: monkey-victim
-# kube-monkey/mtbf: 1
-# kube-monkey/kill-mode: fixed
-# kube-monkey/kill-value: 1
+# extra_pod_labels:
+# kube-monkey/enabled: enabled
+# kube-monkey/identifier: monkey-victim
+# kube-monkey/mtbf: 1
+# kube-monkey/kill-mode: fixed
+# kube-monkey/kill-value: 1
#
-#rw_core_deployment_labels:
-# kube-monkey/enabled: enabled
-# kube-monkey/identifier: monkey-victim
-# kube-monkey/mtbf: 1
-# kube-monkey/kill-mode: fixed
-# kube-monkey/kill-value: 1
+# rw_core_deployment_labels:
+# kube-monkey/enabled: enabled
+# kube-monkey/identifier: monkey-victim
+# kube-monkey/mtbf: 1
+# kube-monkey/kill-mode: fixed
+# kube-monkey/kill-value: 1
#
-#rw_core_pod_labels:
-# kube-monkey/enabled: enabled
-# kube-monkey/identifier: monkey-victim
-# kube-monkey/mtbf: 1
-# kube-monkey/kill-mode: fixed
-# kube-monkey/kill-value: 1
+# rw_core_pod_labels:
+# kube-monkey/enabled: enabled
+# kube-monkey/identifier: monkey-victim
+# kube-monkey/mtbf: 1
+# kube-monkey/kill-mode: fixed
+# kube-monkey/kill-value: 1
#
-#ofagent_deployment_labels:
-# kube-monkey/enabled: enabled
-# kube-monkey/identifier: monkey-victim
-# kube-monkey/mtbf: 1
-# kube-monkey/kill-mode: fixed
-# kube-monkey/kill-value: 1
+# ofagent_deployment_labels:
+# kube-monkey/enabled: enabled
+# kube-monkey/identifier: monkey-victim
+# kube-monkey/mtbf: 1
+# kube-monkey/kill-mode: fixed
+# kube-monkey/kill-value: 1
#
-#ofagent_pod_labels:
-# kube-monkey/enabled: enabled
-# kube-monkey/identifier: monkey-victim
-# kube-monkey/mtbf: 1
-# kube-monkey/kill-mode: fixed
-# kube-monkey/kill-value: 1
+# ofagent_pod_labels:
+# kube-monkey/enabled: enabled
+# kube-monkey/identifier: monkey-victim
+# kube-monkey/mtbf: 1
+# kube-monkey/kill-mode: fixed
+# kube-monkey/kill-value: 1
#
-#openolt_deployment_labels:
-# kube-monkey/enabled: enabled
-# kube-monkey/identifier: monkey-victim
-# kube-monkey/mtbf: 1
-# kube-monkey/kill-mode: fixed
-# kube-monkey/kill-value: 1
+# openolt_deployment_labels:
+# kube-monkey/enabled: enabled
+# kube-monkey/identifier: monkey-victim
+# kube-monkey/mtbf: 1
+# kube-monkey/kill-mode: fixed
+# kube-monkey/kill-value: 1
#
-#openolt_pod_labels:
-# kube-monkey/enabled: enabled
-# kube-monkey/identifier: monkey-victim
-# kube-monkey/mtbf: 1
-# kube-monkey/kill-mode: fixed
-# kube-monkey/kill-value: 1
+# openolt_pod_labels:
+# kube-monkey/enabled: enabled
+# kube-monkey/identifier: monkey-victim
+# kube-monkey/mtbf: 1
+# kube-monkey/kill-mode: fixed
+# kube-monkey/kill-value: 1
#
-#openonu_deployment_labels:
-# kube-monkey/enabled: enabled
-# kube-monkey/identifier: monkey-victim
-# kube-monkey/mtbf: 1
-# kube-monkey/kill-mode: fixed
-# kube-monkey/kill-value: 1
+# openonu_deployment_labels:
+# kube-monkey/enabled: enabled
+# kube-monkey/identifier: monkey-victim
+# kube-monkey/mtbf: 1
+# kube-monkey/kill-mode: fixed
+# kube-monkey/kill-value: 1
#
-#openonu_pod_labels:
-# kube-monkey/enabled: enabled
-# kube-monkey/identifier: monkey-victim
-# kube-monkey/mtbf: 1
-# kube-monkey/kill-mode: fixed
-# kube-monkey/kill-value: 1
+# openonu_pod_labels:
+# kube-monkey/enabled: enabled
+# kube-monkey/identifier: monkey-victim
+# kube-monkey/mtbf: 1
+# kube-monkey/kill-mode: fixed
+# kube-monkey/kill-value: 1
#
-#simolt_deployment_labels:
-# kube-monkey/enabled: enabled
-# kube-monkey/identifier: monkey-victim
-# kube-monkey/mtbf: 1
-# kube-monkey/kill-mode: fixed
-# kube-monkey/kill-value: 1
+# simolt_deployment_labels:
+# kube-monkey/enabled: enabled
+# kube-monkey/identifier: monkey-victim
+# kube-monkey/mtbf: 1
+# kube-monkey/kill-mode: fixed
+# kube-monkey/kill-value: 1
#
-#simolt_pod_labels:
-# kube-monkey/enabled: enabled
-# kube-monkey/identifier: monkey-victim
-# kube-monkey/mtbf: 1
-# kube-monkey/kill-mode: fixed
-# kube-monkey/kill-value: 1
+# simolt_pod_labels:
+# kube-monkey/enabled: enabled
+# kube-monkey/identifier: monkey-victim
+# kube-monkey/mtbf: 1
+# kube-monkey/kill-mode: fixed
+# kube-monkey/kill-value: 1
#
-#simonu_deployment_labels:
-# kube-monkey/enabled: enabled
-# kube-monkey/identifier: monkey-victim
-# kube-monkey/mtbf: 1
-# kube-monkey/kill-mode: fixed
-# kube-monkey/kill-value: 1
+# simonu_deployment_labels:
+# kube-monkey/enabled: enabled
+# kube-monkey/identifier: monkey-victim
+# kube-monkey/mtbf: 1
+# kube-monkey/kill-mode: fixed
+# kube-monkey/kill-value: 1
#
-#simonu_pod_labels:
-# kube-monkey/enabled: enabled
-# kube-monkey/identifier: monkey-victim
-# kube-monkey/mtbf: 1
-# kube-monkey/kill-mode: fixed
-# kube-monkey/kill-value: 1
+# simonu_pod_labels:
+# kube-monkey/enabled: enabled
+# kube-monkey/identifier: monkey-victim
+# kube-monkey/mtbf: 1
+# kube-monkey/kill-mode: fixed
+# kube-monkey/kill-value: 1
diff --git a/voltha b/voltha
index 97e2f24..a830ad4 100755
--- a/voltha
+++ b/voltha
@@ -1101,7 +1101,7 @@
espin - "$THEX"
>&2 echo -e "${RED}${BOLD}${ERROR}ERROR: unable to download kubectl: $(tail "$ERR_OUT")${NORMAL}"
cat "$ERR_OUT" >> "$LOG"
- rm -rf $"ERR_OUT" "$GOPATH/bin/kubectl"
+ rm -rf "$ERR_OUT" "$GOPATH/bin/kubectl"
exit 1
fi
(set -x; chmod 755 "$GOPATH/bin/kubectl" >>"$LOG" 2>&1) >>"$LOG" 2>&1
@@ -1139,7 +1139,7 @@
espin - "$THEX"
>&2 echo -e "${RED}${BOLD}${ERROR}ERROR: unable to download kind: $(tail "$ERR_OUT")${NORMAL}"
cat "$ERR_OUT" >> "$LOG"
- rm -rf $"ERR_OUT" "$GOPATH/bin/kind"
+ rm -rf "$ERR_OUT" "$GOPATH/bin/kind"
exit 1
fi
(set -x; chmod 755 "$GOPATH/bin/kind" >>"$LOG" 2>&1) >>"$LOG" 2>&1