[VOL-5053] - Pre-release triage build of voltha-lib-go
makefiles/
----------
o Added latest library makefile versions from repo:onf-make.
o Remove inlined GO* macros and replaced with makefile/docker/include.mk
o Proper handling of --it/--tty so jenkins can capture docker output in logs.
pkg/adapters/common/
pkg/config/
pkg/db/
pkg/db/kvstore/
pkg/events/eventif/
---------------------
o Bulk copyright notice end-date updates.
o Run gofmt -s -w on all *.go sources to fix potential job problems.
o Cosmetic edits to force a build for the release.
config.mk
---------
o Ignore more lint targets: groovy (tool needed), jjb (not-needed)
Makefile
--------
o echo enter/leave banners within targets to improve readability.
o Inline set -euo pipefail within testing else tee command masks exit status.
o Added LOCAL_FIX_PERMS= hack to adjust docker volume perms when working locally.
o make test depends on test-go and test-go-coverage.
o test-go: normal test run, exit with status.
o test-go-coverage: test with code -cover but ignore errors until sources can be identified and cleaned up.
o Split test target into
- gen-coverage-coverprofile
- gen-coverage-junit
- gen-coverage-cobertura
- Separate targets help unwrap run-on command and the need to capture exit status.
- Logic can now migrate into a library makefile for other repos to make use of.
Change-Id: Id680c8eb626ff6b7cd27ca783988f659fa1468df
diff --git a/.golangci.yml b/.golangci.yml
index de036f8..93a7d40 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -1,4 +1,4 @@
-# Copyright 2020-present Open Networking Foundation
+# Copyright 2020-2023 Open Networking Foundation (ONF) and the ONF Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -12,24 +12,25 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+---
run:
modules-download-mode: vendor
linters:
enable:
- #- gochecknoglobals
- #- gochecknoinits
- # - gocyclo
+ # - gochecknoglobals
+ # - gochecknoinits
+ # - gocyclo
- gofmt
- # - golint
- # - govet
- # - ineffassign
- # - misspell
+ # - golint
+ # - govet
+ # - ineffassign
+ # - misspell
- errcheck
- #- unparam
+ # - unparam
issues:
exclude:
- "Package github.com/golang/protobuf/proto is deprecated"
- "Package github.com/golang/protobuf/jsonpb is deprecated"
- - "SA1019: voltha.ImageDownload is deprecated"
\ No newline at end of file
+ - "SA1019: voltha.ImageDownload is deprecated"
diff --git a/Makefile b/Makefile
index bbb46e2..d51c5c5 100644
--- a/Makefile
+++ b/Makefile
@@ -20,32 +20,16 @@
##-------------------##
##---] GLOBALS [---##
##-------------------##
-TOP ?= .
-MAKEDIR ?= $(TOP)/makefiles
-
-NO-LINT-MAKEFILE := true # cleanup needed
-NO-LINT-PYTHON := true # cleanup needed
-NO-LINT-SHELL := true # cleanup needed
-
-export SHELL := bash -e -o pipefail
##--------------------##
##---] INCLUDES [---##
##--------------------##
-include $(MAKEDIR)/include.mk
+include config.mk
+include makefiles/include.mk
# Variables
VERSION ?= $(shell cat ./VERSION)
-# tool containers
-VOLTHA_TOOLS_VERSION ?= 2.4.0
-
-GO = docker run --rm --user $$(id -u):$$(id -g) -v ${CURDIR}:/app $(shell test -t 0 && echo "-it") -v gocache:/.cache -v gocache-${VOLTHA_TOOLS_VERSION}:/go/pkg voltha/voltha-ci-tools:${VOLTHA_TOOLS_VERSION}-golang go
-GO_JUNIT_REPORT = docker run --rm --user $$(id -u):$$(id -g) -v ${CURDIR}:/app -i voltha/voltha-ci-tools:${VOLTHA_TOOLS_VERSION}-go-junit-report go-junit-report
-GOCOVER_COBERTURA = docker run --rm --user $$(id -u):$$(id -g) -v ${CURDIR}:/app/src/github.com/opencord/voltha-lib-go/v7 -i voltha/voltha-ci-tools:${VOLTHA_TOOLS_VERSION}-gocover-cobertura gocover-cobertura
-GOLANGCI_LINT = docker run --rm --user $$(id -u):$$(id -g) -v ${CURDIR}:/app $(shell test -t 0 && echo "-it") -v gocache:/.cache -v gocache-${VOLTHA_TOOLS_VERSION}:/go/pkg voltha/voltha-ci-tools:${VOLTHA_TOOLS_VERSION}-golangci-lint golangci-lint
-
-
## -----------------------------------------------------------------------
## Local Development Helpers
## -----------------------------------------------------------------------
@@ -65,32 +49,59 @@
## build the library
## -----------------------------------------------------------------------
build: local-protos
-## ${GO} build -mod=vendor ./...
+ $(call banner-enter,Target $@)
${GO} build -mod=vendor ./...
-
-## lint and unit tests
+ $(call banner-leave,Target $@)
## -----------------------------------------------------------------------
## -----------------------------------------------------------------------
lint-mod:
+ $(call banner-entry,Target $@)
@echo "Running dependency check..."
@${GO} mod verify
@echo "Dependency check OK. Running vendor check..."
@git status > /dev/null
@git diff-index --quiet HEAD -- go.mod go.sum vendor || (echo "ERROR: Staged or modified files must be committed before running this test" && git status -- go.mod go.sum vendor && exit 1)
@[[ `git ls-files --exclude-standard --others go.mod go.sum vendor` == "" ]] || (echo "ERROR: Untracked files must be cleaned up before running this test" && git status -- go.mod go.sum vendor && exit 1)
- ${GO} mod tidy
- ${GO} mod vendor
+
+ $(HIDE)$(MAKE) --no-print-directory mod-update
+
@git status > /dev/null
@git diff-index --quiet HEAD -- go.mod go.sum vendor || (echo "ERROR: Modified files detected after running go mod tidy / go mod vendor" && git status -- go.mod go.sum vendor && git checkout -- go.mod go.sum vendor && exit 1)
@[[ `git ls-files --exclude-standard --others go.mod go.sum vendor` == "" ]] || (echo "ERROR: Untracked files detected after running go mod tidy / go mod vendor" && git status -- go.mod go.sum vendor && git checkout -- go.mod go.sum vendor && exit 1)
@echo "Vendor check OK."
+ $(call banner-leave,Target $@)
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+.PHONY: mod-update
+mod-update: mod-tidy mod-vendor
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+.PHONY: mod-tidy
+mod-tidy :
+ $(call banner-enter,Target $@)
+ ${GO} mod tidy
+ $(call banner-leave,Target $@)
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+.PHONY: mod-vendor
+mod-vendor : mod-tidy
+mod-vendor :
+ $(call banner-enter,Target $@)
+ $(if $(LOCAL_FIX_PERMS),chmod o+w $(CURDIR))
+ ${GO} mod vendor
+ $(if $(LOCAL_FIX_PERMS),chmod o-w $(CURDIR))
+ $(call banner-leave,Target $@)
## -----------------------------------------------------------------------
## -----------------------------------------------------------------------
lint: lint-mod
## -----------------------------------------------------------------------
+## Coverage report: Static code analysis
## -----------------------------------------------------------------------
sca:
@$(RM) -r ./sca-report
@@ -103,26 +114,136 @@
## -----------------------------------------------------------------------
## -----------------------------------------------------------------------
test: local-protos
+
+ $(call banner-enter,Target $@)
@mkdir -p ./tests/results
- @${GO} test -mod=vendor -v -coverprofile ./tests/results/go-test-coverage.out -covermode count ./... 2>&1 | tee ./tests/results/go-test-results.out ;\
- RETURN=$$? ;\
- ${GO_JUNIT_REPORT} < ./tests/results/go-test-results.out > ./tests/results/go-test-results.xml ;\
- ${GOCOVER_COBERTURA} < ./tests/results/go-test-coverage.out > ./tests/results/go-test-coverage.xml ;\
- exit $$RETURN
+
+ # No stream redirects, exit with shell status
+ $(MAKE) test-go
+
+ # Redirect I/O, ignore shell exit status (for now)
+ $(MAKE) test-go-cover
+
+ $(call banner-leave,Target $@)
## -----------------------------------------------------------------------
## -----------------------------------------------------------------------
-clean: distclean
+.PHONY: test-go
+test-go :
+
+ $(call banner-enter,Target $@)
+ @echo "** Testing attempt #1: exit-with-error-status: enabled"
+ -$(GO) test -mod=vendor ./...
+ $(call banner-leave,Target $@)
## -----------------------------------------------------------------------
## -----------------------------------------------------------------------
-distclean sterile:
+.PHONY: test-go-cover
+test-go : gen-coverage-coverprofile gen-coverage-junit gen-coverage-cobertura
+
+
+## -----------------------------------------------------------------------
+## Intent: Generate coverprofile data
+## -----------------------------------------------------------------------
+cover-dir := ./tests/results
+go-cover-out := $(cover-dir)/go-test-coverage.out
+go-result-out := $(cover-dir)/go-test-results.out
+
+.PHONY: gen-coverage-coverprofile
+gen-coverage-coverprofile:
+
+ $(call banner-enter,Target $@)
+ @echo "** Testing attempt #2: exit-with-error-status: disabled"
+
+ # Fix docker volume perms if building locally
+ touch "$(go-cover-out)"
+ $(if $(LOCAL_FIX_PERMS),chmod o+w "$(go-cover-out)")
+
+ # Fix docker volume perms if building locally
+ $(if $(LOCAL_FIX_PERMS),touch "$(go-result-out)")
+ $(if $(LOCAL_FIX_PERMS),chmod o+w "$(go-result-out)")
+
+ # ------------------------------------------
+ # set -euo pipefail else tee masks $? return
+ # ------------------------------------------
+ @echo '** Running test coverage: exit-on-error is currently disabled'
+ -(\
+ set -euo pipefail; \
+ $(GO) test -mod=vendor -v -coverprofile "$(go-cover-out)" -covermode count ./... 2>&1 | tee "$(go-result-out)" \
+ )
+
+ $(if $(LOCAL_FIX_PERMS),chmod o-w "$(go-result-out)")
+ $(call banner-leave,Target $@)
+
+## -----------------------------------------------------------------------
+## Intent: Morph coverage data into junit/xml content
+## -----------------------------------------------------------------------
+go-results-xml := $(cover-dir)/go-test-results.xml
+
+.PHONY: gen-coverage-junit
+gen-coverage-junit : gen-coverage-coverprofile
+gen-coverage-junit:
+ $(call banner-enter,Target $@)
+
+ # Fix docker volume perms if building locally
+ $(if $(LOCAL_FIX_PERMS),touch "$(go-results-xml)")
+ $(if $(LOCAL_FIX_PERMS),chmod o+w "$(go-results-xml)")
+
+ ${GO_JUNIT_REPORT} < $(go-result-out) > "$(go-results-xml)"
+
+ $(if $(LOCAL_FIX_PERMS),chmod o-w "$(go-results-xml)")
+ $(call banner-leave,Target $@)
+
+## -----------------------------------------------------------------------
+## Intent: Morph coverage data into cobertura xml
+## -----------------------------------------------------------------------
+go-cover-xml := $(cover-dir)/go-test-coverage.xml
+
+.PHONY: gen-coverage-cobertura
+gen-coverage-cobertura : gen-coverage-junit
+gen-coverage-cobertura :
+
+ $(call banner-enter,Target $@)
+
+ # Fix docker volume perms if building locally
+ $(if $(LOCAL_FIX_PERMS),touch "$(go-cover-xml)")
+ $(if $(LOCAL_FIX_PERMS),chmod o+w "$(coverproifle-xml)")
+
+ ${GOCOVER_COBERTURA} < "$(go-cover-out)" > "$(go-cover-xml)"
+
+ $(if $(LOCAL_FIX_PERMS),chmod o-w "$(go-cover-xml)")
+ $(call banner-leave,Target $@)
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+distclean:
$(RM) -r ./sca-report ./tests
## -----------------------------------------------------------------------
## -----------------------------------------------------------------------
-mod-update:
- ${GO} mod tidy
- ${GO} mod vendor
+clean :: distclean
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+sterile :: clean
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+help ::
+ @echo "Usage: make [<target>]"
+ @echo "where available targets are:"
+ @echo
+ @echo "build : Build the library"
+ @echo "clean : Remove files created by the build"
+ @echo "distclean : Remove build and testing artifacts and reports"
+ @echo "lint-mod : Verify the integrity of the 'mod' files"
+ @echo "mod-update : Update go.mod and the vendor directory"
+ @echo "test : Generate reports for all go tests"
+ @echo
+ @echo '[REPORT: coverage]'
+ @echo ' gen-coverage-coverprofile Generate profiling data'
+ @echo ' gen-coverage-junit Generate junit coverage report'
+ @echo ' gen-coverage-cobertura Generate cobertura report'
# [EOF]
+
diff --git a/VERSION b/VERSION
index 400ee78..4e61aee 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-7.4.4-dev
+7.4.4
diff --git a/config.mk b/config.mk
new file mode 100644
index 0000000..8421c74
--- /dev/null
+++ b/config.mk
@@ -0,0 +1,113 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# 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.
+# -----------------------------------------------------------------------
+# https://gerrit.opencord.org/plugins/gitiles/onf-make
+# ONF.makefiles.include.version = 1.1
+# ONF.confg.mk = 1.1
+# -----------------------------------------------------------------------
+
+--repo-name-- := voltha-lib-go
+--repo-name-- ?= $(error --repo-name--= is required)
+
+##--------------------------------##
+##---] Disable lint targets [---##
+##--------------------------------##
+# NO-LINT-DOC8 := true
+# NO-LINT-GOLANG := true
+NO-LINT-GROOVY := true# # Note[1]
+NO-LINT-JJB := true# # Note[2]
+NO-LINT-JSON := true# # Note[1]
+NO-LINT-MAKEFILE := true# # Note[1]
+NO-LINT-REUSE := true # License check
+NO-LINT-ROBOT := true
+NO-LINT-SHELLCHECK := true# # Note[1]
+NO-LINT-YAML := true# # Note[1]
+
+# NO-LINT-PYTHON := true# # Note[1]
+# NO-LINT-PYLINT := true# # Note[1]
+NO-LINT-TOX := true# # Note[1]
+
+# Note[1] - A boatload of source to cleanup prior to enable.
+# Note[2] - No sources available
+
+##---------------------------------##
+##---] Conditional make logic [---##
+##---------------------------------##
+USE-ONF-DOCKER-MK := true
+# USE-ONF-GERRIT-MK := true
+# USE-ONF-GIT-MK := true
+# USE-ONF-JJB-MK := ture
+# USE-VOLTHA-RELEASE-MK := true
+
+##----------------------##
+##---] Debug Mode [---##
+##----------------------##
+# export DEBUG := 1 # makefile debug
+# export DISTUTILS_DEBUG := 1 # verbose: pip
+# export DOCKER_DEBUG := 1 # verbose: docker
+# export VERBOSE := 1 # makefile debug
+
+##-----------------------------------##
+##---] JJB/Jenkins Job Builder [---##
+##-----------------------------------##
+JJB_VERSION ?= 2.8.0
+JOBCONFIG_DIR ?= job-configs
+
+##---------------------------------##
+##---] Filesystem exclusions [---##
+##---------------------------------##
+onf-excl-dirs := $(null) # make clean: dirs=
+onf-excl-dirs += .venv# # $(venv-name)
+onf-excl-dirs += vendor# # golang / voltha*-go
+onf-excl-dirs += patches# # voltha docs - python upgrade
+onf-excl-dirs += .tox # also a python dependency
+
+onf-excl-dirs ?= $(error onf-excl-dirs= is required)
+
+##-----------------------------##
+##---] Feature Detection [---##
+##-----------------------------##
+# [TODO] include makefiles/features/include.mk
+# [TODO] All logic below can migrate there.
+
+$(if $(filter %ci-management,$(--repo-name--)),\
+ $(eval --REPO-IS-CI-MANAGEMENT-- := true)\
+)
+
+# create makefiles/config/byrepo/{--repo-name--}.mk for one-off snowflakes ?
+# $(if $(wildcard docker */Docker*),$(eval USE-ONF-DOCKER-MK := true))
+
+##-------------------------##
+##---] Derived Flags [---##
+##-------------------------##
+ifdef --REPO-IS-CI-MANAGEMENT--
+ USE-ONF-JJB := true
+
+ onf-excl-dirs += global-jjb
+ onf-excl-dirs += lf-ansible
+ onf-excl-dirs += packer
+endif
+
+ifdef NO-LINT-PYTHON
+ NO-LINT-FLAKE8 := true
+ NO-LINT-PYLINT := true
+endif
+
+ifndef USE-ONF-JJB
+ NO-LINT-JJB := true
+endif
+
+# [EOF]
diff --git a/makefiles/bin/compare_sandbox_makefiles.sh b/makefiles/bin/compare_sandbox_makefiles.sh
new file mode 100755
index 0000000..ec00dc3
--- /dev/null
+++ b/makefiles/bin/compare_sandbox_makefiles.sh
@@ -0,0 +1,66 @@
+#!/bin/bash
+# -----------------------------------------------------------------------
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# 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.
+#
+# SPDX-FileCopyrightText: 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+# https://gerrit.opencord.org/plugins/gitiles/onf-make
+# ONF.makefile.version = 1.0
+# -----------------------------------------------------------------------
+# Intent: This script is used to bulk refactor and merge makefile changes
+## between development repositories and repo:onf-make.
+## -----------------------------------------------------------------------
+
+## -----------------------------------------------------------------------
+## Intent:
+## -----------------------------------------------------------------------
+function error
+{
+ echo "$*"
+ exit 1
+}
+
+##----------------##
+##---] MAIN [---##
+##----------------##
+# src="$HOME/projects/sandbox/onf-make/makefiles"
+src="$HOME/projects/sandbox/ci-management/makefiles"
+dst="$(realpath .)"
+
+while [ $# -gt 0 ]; do
+ fyl=$1; shift
+
+ echo "FYL: $fyl"
+ if [ -d "$fyl" ]; then
+ readarray -t fyls < <(find "$fyl" -type f -print)
+ [[ ${#@} -gt 0 ]] && fyls+=("$@")
+ # declare -p fyls
+ [[ ${#fyls} -gt 0 ]] && set -- "${fyls[@]}"
+ continue
+ fi
+
+ src0="$src/$fyl"
+ dst0="$dst/$fyl"
+
+ [[ ! -e "$src0" ]] && error "File does not exist in src= $src0"
+ [[ ! -e "$dst0" ]] && error "File does not exist in dst= $dst0"
+
+ if ! diff -qr "$src0" "$dst0"; then
+ emacs "$src0" "$dst0"
+ fi
+done
+
+# [EOF]
diff --git a/makefiles/bootstrap.mk b/makefiles/bootstrap.mk
new file mode 100644
index 0000000..ada8cd0
--- /dev/null
+++ b/makefiles/bootstrap.mk
@@ -0,0 +1,65 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Intent: Dependency-free macros used to source library makefiles
+# and define the build environment.
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG-bootstrap_mk),$(warning ENTER))
+
+##---------------------##
+##---] CONSTANTS [---##
+##---------------------##
+is-false = $(if $(1),true,$(null))
+is-true = $(if $(1),$(null),true)
+
+##--------------------------##
+##---] LIBRARY MACROS [---##
+##--------------------------##
+is-null = $(if $(1),$(null),$(error $(1)= is undef))
+is-null-var = $(if $$(1),$(null),$(error $(1)= is undef))
+is-null-var-indirect = $(if $(1),$(null),$(error $(1)= is undef))
+
+## variable flavor:
+# origin - undefned
+# default
+# environment
+# environment override
+# automatic
+# null(blah) ? - true
+
+## -----------------------------------------------------------------------
+## Intent: Given an indirect var containing varname of a makefile *_ROOT
+## parent director, derive a *_MKDIR variable and conditionally
+## include the makefile hierarchy.
+## -----------------------------------------------------------------------
+## Given:
+## o var containing OPT_ROOT=path
+## Return:
+## o OPT_MKDIR=$(OPT_ROOT)/makefiles
+## o If exists include $(OPT_MKDIR)/include.mk
+## -----------------------------------------------------------------------
+# library-include := $(call mk-library-include,blah)
+
+mk-library-include=$(error revisit mk-library-include)
+
+#$(strip \
+# $(warning mk-library-include: $$1[$(1)] = [$($(1))]))\
+# $(call is-null-var,1)\
+# $(foreach var,$($(1)),\
+# $(info var=$(var) is-null=$(call is-null-var,var))\
+# $(foreach val,$$(var),\
+# $(info val=$(val))\
+# $(foreach makedir,$(subst _ROOT,_MKDIR,$(var)),\
+#$(warning makedir=$(makedir))\
+# $(if $($(makedir)),$(null),\
+# $(eval $(makedir)=$$$$($(var))/makefiles)\
+#$(warning $(makedir) = $($($(makedir))))\
+#$(info $$(wildcard $(val)/makefiles/include.mk) = $(wildcard $(val)/makefiles/include.mk))\
+# $(foreach mf,$(wildcard $(wildcard $(val)/makefiles/include.mk)),\
+#$(warning $$(eval include $(mf)))\
+## $(eval include $(mf)))\
+# )
+
+$(if $(DEBUG-bootstrap_mk),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/commands/include.mk b/makefiles/commands/include.mk
new file mode 100644
index 0000000..01fa145
--- /dev/null
+++ b/makefiles/commands/include.mk
@@ -0,0 +1,36 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# 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.
+#
+# SPDX-FileCopyrightText: 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+# https://gerrit.opencord.org/plugins/gitiles/onf-make
+# ONF.makefile.version = 1.0
+# -----------------------------------------------------------------------
+
+ifndef mk-include--onf-commands
+
+$(if $(DEBUG),$(warning ENTER))
+
+include $(ONF_MAKEDIR)/commands/kail.mk
+
+$(if $(DEBUG),$(warning LEAVE))
+
+mk-include--onf-commands := true
+
+endif # mk-include--onf-make
+
+# [EOF]
diff --git a/makefiles/commands/kail.mk b/makefiles/commands/kail.mk
new file mode 100644
index 0000000..ff6691d
--- /dev/null
+++ b/makefiles/commands/kail.mk
@@ -0,0 +1,46 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# 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.
+# -----------------------------------------------------------------------
+
+MAKEDIR ?= $(error MAKEDIR= is required)
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+help::
+ @echo " kail Install the kail command"
+ifdef VERBOSE
+ @echo " make kail KAIL_PATH="
+endif
+
+# -----------------------------------------------------------------------
+# Install the 'kail' tool if needed: https://github.com/boz/kail
+# o WORKSPACE - jenkins aware
+# o Default to /usr/local/bin/kail
+# + revisit this, system directories should not be a default path.
+# + requires sudo and potential exists for overwrite conflict.
+# -----------------------------------------------------------------------
+KAIL_PATH ?= $(if $(WORKSPACE),$(WORKSPACE)/bin,/usr/local/bin)
+kail-cmd ?= $(KAIL_PATH)/kail
+$(kail-cmd):
+ etc/godownloader.sh -b .
+ rsync -v --checksum kail "$@"
+ $@ version
+ $(RM) kail
+
+.PHONY: kail
+kail : $(kail-cmd)
+
+# [EOF]
diff --git a/makefiles/commands/kail/README.md b/makefiles/commands/kail/README.md
new file mode 100644
index 0000000..470fd3c
--- /dev/null
+++ b/makefiles/commands/kail/README.md
@@ -0,0 +1,15 @@
+# -----------------------------------------------------------------------
+# Workaround for godownloader disappearing:
+# This is a complete hack to get bbsim and v-s-t functional again.
+# A more permanent answer is needed, copy binaries into a *tool* repo
+# and use directly from git clone w/o access or install overhead.
+# ----------------------------------------------------------------------
+
+1) Retrieve an archived copy of the script and place in v-s-t/etc.
+ https://searchcode.com/file/316605398/godownloader.sh
+2) A few script edits are needed:
+ o change download method from curl to wget.
+ o VERSION= variable requires a 'v' prefix.
+3) Update Makefile to install the new command.
+
+# [EOF]
diff --git a/makefiles/commands/kail/godownloader.sh b/makefiles/commands/kail/godownloader.sh
new file mode 100755
index 0000000..77ad5bf
--- /dev/null
+++ b/makefiles/commands/kail/godownloader.sh
@@ -0,0 +1,390 @@
+#!/bin/sh
+set -e
+# Code generated by godownloader on 2019-05-28T19:49:53Z. DO NOT EDIT.
+# Copyright 2019 - (disable makefiles/lint/license.mk)
+#
+
+usage() {
+ this=$1
+ cat <<EOF
+$this: download go binaries for boz/kail
+
+Usage: $this [-b] bindir [-d] [tag]
+ -b sets bindir or installation directory, Defaults to ./bin
+ -d turns on debug logging
+ [tag] is a tag from
+ https://github.com/boz/kail/releases
+ If tag is missing, then the latest will be used.
+
+ Generated by godownloader
+ https://github.com/goreleaser/godownloader
+
+EOF
+ exit 2
+}
+
+parse_args() {
+ #BINDIR is ./bin unless set be ENV
+ # over-ridden by flag below
+
+ BINDIR=${BINDIR:-./bin}
+ while getopts "b:dh?x" arg; do
+ case "$arg" in
+ b) BINDIR="$OPTARG" ;;
+ d) log_set_priority 10 ;;
+ h | \?) usage "$0" ;;
+ x) set -x ;;
+ esac
+ done
+ shift $((OPTIND - 1))
+ TAG=$1
+}
+# this function wraps all the destructive operations
+# if a curl|bash cuts off the end of the script due to
+# network, either nothing will happen or will syntax error
+# out preventing half-done work
+execute() {
+ tmpdir=$(mktemp -d)
+ log_debug "downloading files into ${tmpdir}"
+
+ # ---------------------------------------------------------
+ # [JOEY] - strange, curl fails to retrieve but wget is fine.
+ # ---------------------------------------------------------
+ # http_download "${tmpdir}/${TARBALL}" "${TARBALL_URL}"
+ http_download_wget "${tmpdir}/${TARBALL}" "${TARBALL_URL}"
+
+ http_download "${tmpdir}/${CHECKSUM}" "${CHECKSUM_URL}"
+ hash_sha256_verify "${tmpdir}/${TARBALL}" "${tmpdir}/${CHECKSUM}"
+ srcdir="${tmpdir}"
+ (cd "${tmpdir}" && untar "${TARBALL}")
+ test ! -d "${BINDIR}" && install -d "${BINDIR}"
+# shellcheck disable=SC2043
+ for binexe in "kail" ; do
+ if [ "$OS" = "windows" ]; then
+ binexe="${binexe}.exe"
+ fi
+ install "${srcdir}/${binexe}" "${BINDIR}/"
+ log_info "installed ${BINDIR}/${binexe}"
+ done
+ rm -rf "${tmpdir}"
+}
+is_supported_platform() {
+ platform=$1
+ found=1
+ case "$platform" in
+ darwin/amd64) found=0 ;;
+ linux/amd64) found=0 ;;
+ esac
+ return $found
+}
+check_platform() {
+ if is_supported_platform "$PLATFORM"; then
+ # optional logging goes here
+ true
+ else
+ log_crit "platform $PLATFORM is not supported. Make sure this script is up-to-date and file request at https://github.com/${PREFIX}/issues/new"
+ exit 1
+ fi
+}
+tag_to_version() {
+ if [ -z "${TAG}" ]; then
+ log_info "checking GitHub for latest tag"
+ else
+ log_info "checking GitHub for tag '${TAG}'"
+ fi
+ REALTAG=$(github_release "$OWNER/$REPO" "${TAG}") && true
+ if test -z "$REALTAG"; then
+ log_crit "unable to find '${TAG}' - use 'latest' or see https://github.com/${PREFIX}/releases for details"
+ exit 1
+ fi
+ # if version starts with 'v', remove it
+ TAG="$REALTAG"
+ VERSION=${TAG#v}
+}
+adjust_format() {
+ # change format (tar.gz or zip) based on OS
+ true
+}
+adjust_os() {
+ # adjust archive name based on OS
+ true
+}
+adjust_arch() {
+ # adjust archive name based on ARCH
+ true
+}
+
+cat /dev/null <<EOF
+------------------------------------------------------------------------
+https://github.com/client9/shlib - portable posix shell functions
+Public domain - http://unlicense.org
+https://github.com/client9/shlib/blob/master/LICENSE.md
+but credit (and pull requests) appreciated.
+------------------------------------------------------------------------
+EOF
+is_command() {
+ command -v "$1" >/dev/null
+}
+echoerr() {
+ echo "$@" 1>&2
+}
+log_prefix() {
+ echo "$0"
+}
+_logp=6
+log_set_priority() {
+ _logp="$1"
+}
+log_priority() {
+ if test -z "$1"; then
+ echo "$_logp"
+ return
+ fi
+ [ "$1" -le "$_logp" ]
+}
+log_tag() {
+ case $1 in
+ 0) echo "emerg" ;;
+ 1) echo "alert" ;;
+ 2) echo "crit" ;;
+ 3) echo "err" ;;
+ 4) echo "warning" ;;
+ 5) echo "notice" ;;
+ 6) echo "info" ;;
+ 7) echo "debug" ;;
+ *) echo "$1" ;;
+ esac
+}
+log_debug() {
+ log_priority 7 || return 0
+ echoerr "$(log_prefix)" "$(log_tag 7)" "$@"
+}
+log_info() {
+ log_priority 6 || return 0
+ echoerr "$(log_prefix)" "$(log_tag 6)" "$@"
+}
+log_err() {
+ log_priority 3 || return 0
+ echoerr "$(log_prefix)" "$(log_tag 3)" "$@"
+}
+log_crit() {
+ log_priority 2 || return 0
+ echoerr "$(log_prefix)" "$(log_tag 2)" "$@"
+}
+uname_os() {
+ os=$(uname -s | tr '[:upper:]' '[:lower:]')
+ case "$os" in
+ msys_nt) os="windows" ;;
+ esac
+ echo "$os"
+}
+uname_arch() {
+ arch=$(uname -m)
+ case $arch in
+ x86_64) arch="amd64" ;;
+ x86) arch="386" ;;
+ i686) arch="386" ;;
+ i386) arch="386" ;;
+ aarch64) arch="arm64" ;;
+ armv5*) arch="armv5" ;;
+ armv6*) arch="armv6" ;;
+ armv7*) arch="armv7" ;;
+ esac
+ echo ${arch}
+}
+uname_os_check() {
+ os=$(uname_os)
+ case "$os" in
+ darwin) return 0 ;;
+ dragonfly) return 0 ;;
+ freebsd) return 0 ;;
+ linux) return 0 ;;
+ android) return 0 ;;
+ nacl) return 0 ;;
+ netbsd) return 0 ;;
+ openbsd) return 0 ;;
+ plan9) return 0 ;;
+ solaris) return 0 ;;
+ windows) return 0 ;;
+ esac
+ log_crit "uname_os_check '$(uname -s)' got converted to '$os' which is not a GOOS value. Please file bug at https://github.com/client9/shlib"
+ return 1
+}
+uname_arch_check() {
+ arch=$(uname_arch)
+ case "$arch" in
+ 386) return 0 ;;
+ amd64) return 0 ;;
+ arm64) return 0 ;;
+ armv5) return 0 ;;
+ armv6) return 0 ;;
+ armv7) return 0 ;;
+ ppc64) return 0 ;;
+ ppc64le) return 0 ;;
+ mips) return 0 ;;
+ mipsle) return 0 ;;
+ mips64) return 0 ;;
+ mips64le) return 0 ;;
+ s390x) return 0 ;;
+ amd64p32) return 0 ;;
+ esac
+ log_crit "uname_arch_check '$(uname -m)' got converted to '$arch' which is not a GOARCH value. Please file bug report at https://github.com/client9/shlib"
+ return 1
+}
+untar() {
+ tarball=$1
+ case "${tarball}" in
+ *.tar.gz | *.tgz) tar -xzf "${tarball}" ;;
+ *.tar) tar -xf "${tarball}" ;;
+ *.zip) unzip "${tarball}" ;;
+ *)
+ log_err "untar unknown archive format for ${tarball}"
+ return 1
+ ;;
+ esac
+}
+http_download_curl() {
+ local_file=$1
+ source_url=$2
+ header=$3
+ if [ -z "$header" ]; then
+ code=$(curl -w '%{http_code}' -sL -o "$local_file" "$source_url")
+ else
+ code=$(curl -w '%{http_code}' -sL -H "$header" -o "$local_file" "$source_url")
+ fi
+ if [ "$code" != "200" ]; then
+ log_debug "http_download_curl received HTTP status $code"
+ return 1
+ fi
+ return 0
+}
+http_download_wget() {
+ local_file=$1
+ source_url=$2
+ header=$3
+ if [ -z "$header" ]; then
+ wget -q -O "$local_file" "$source_url"
+ else
+ wget -q --header "$header" -O "$local_file" "$source_url"
+ fi
+}
+http_download() {
+ log_debug "http_download $2"
+ if is_command curl; then
+ http_download_curl "$@"
+ return
+ elif is_command wget; then
+ http_download_wget "$@"
+ return
+ fi
+ log_crit "http_download unable to find wget or curl"
+ return 1
+}
+http_copy() {
+ tmp=$(mktemp)
+ http_download "${tmp}" "$1" "$2" || return 1
+ body=$(cat "$tmp")
+ rm -f "${tmp}"
+ echo "$body"
+}
+github_release() {
+ owner_repo=$1
+ version=$2
+ test -z "$version" && version="latest"
+ giturl="https://github.com/${owner_repo}/releases/${version}"
+ json=$(http_copy "$giturl" "Accept:application/json")
+ test -z "$json" && return 1
+ version=$(echo "$json" | tr -s '\n' ' ' | sed 's/.*"tag_name":"//' | sed 's/".*//')
+ test -z "$version" && return 1
+ echo "$version"
+}
+hash_sha256() {
+ TARGET=${1:-/dev/stdin}
+ if is_command gsha256sum; then
+ hash=$(gsha256sum "$TARGET") || return 1
+ echo "$hash" | cut -d ' ' -f 1
+ elif is_command sha256sum; then
+ hash=$(sha256sum "$TARGET") || return 1
+ echo "$hash" | cut -d ' ' -f 1
+ elif is_command shasum; then
+ hash=$(shasum -a 256 "$TARGET" 2>/dev/null) || return 1
+ echo "$hash" | cut -d ' ' -f 1
+ elif is_command openssl; then
+ hash=$(openssl -dst openssl dgst -sha256 "$TARGET") || return 1
+ echo "$hash" | cut -d ' ' -f a
+ else
+ log_crit "hash_sha256 unable to find command to compute sha-256 hash"
+ return 1
+ fi
+}
+hash_sha256_verify() {
+ TARGET=$1
+ checksums=$2
+ if [ -z "$checksums" ]; then
+ log_err "hash_sha256_verify checksum file not specified in arg2"
+ return 1
+ fi
+ BASENAME=${TARGET##*/}
+ want=$(grep "${BASENAME}" "${checksums}" 2>/dev/null | tr '\t' ' ' | cut -d ' ' -f 1)
+ if [ -z "$want" ]; then
+ log_err "hash_sha256_verify unable to find checksum for '${TARGET}' in '${checksums}'"
+ return 1
+ fi
+ got=$(hash_sha256 "$TARGET")
+ if [ "$want" != "$got" ]; then
+ log_err "hash_sha256_verify checksum for '$TARGET' did not verify ${want} vs $got"
+ return 1
+ fi
+}
+cat /dev/null <<EOF
+------------------------------------------------------------------------
+End of functions from https://github.com/client9/shlib
+------------------------------------------------------------------------
+EOF
+
+PROJECT_NAME="kail"
+OWNER=boz
+REPO="kail"
+# shellcheck disable=SC2034
+BINARY=kail
+FORMAT=tar.gz
+OS=$(uname_os)
+ARCH=$(uname_arch)
+PREFIX="$OWNER/$REPO"
+
+# use in logging routines
+log_prefix() {
+ echo "$PREFIX"
+}
+PLATFORM="${OS}/${ARCH}"
+GITHUB_DOWNLOAD=https://github.com/${OWNER}/${REPO}/releases/download
+
+uname_os_check "$OS"
+uname_arch_check "$ARCH"
+
+parse_args "$@"
+
+check_platform
+
+tag_to_version
+
+adjust_format
+
+adjust_os
+
+adjust_arch
+
+log_info "found version: ${VERSION} for ${TAG}/${OS}/${ARCH}"
+
+# ---------------------------------------------------------
+# [JOEY] - as of v0.16.1, download name contains an embedded 'v'
+# ---------------------------------------------------------
+# NAME=${PROJECT_NAME}_${VERSION}_${OS}_${ARCH}
+NAME=${PROJECT_NAME}_v${VERSION}_${OS}_${ARCH}
+
+TARBALL=${NAME}.${FORMAT}
+TARBALL_URL=${GITHUB_DOWNLOAD}/${TAG}/${TARBALL}
+CHECKSUM=checksums.txt
+CHECKSUM_URL=${GITHUB_DOWNLOAD}/${TAG}/${CHECKSUM}
+
+execute
diff --git a/makefiles/consts.mk b/makefiles/consts.mk
index 95d69a2..f1f717f 100644
--- a/makefiles/consts.mk
+++ b/makefiles/consts.mk
@@ -1,6 +1,6 @@
# -*- makefile -*-
# -----------------------------------------------------------------------
-# Copyright 2022 Open Networking Foundation (ONF) and the ONF Contributors
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -14,30 +14,52 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-# SPDX-FileCopyrightText: 2022 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-FileCopyrightText: 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
# SPDX-License-Identifier: Apache-2.0
# -----------------------------------------------------------------------
+# https://gerrit.opencord.org/plugins/gitiles/onf-make
+# ONF.makefile.version = 1.0
+# -----------------------------------------------------------------------
$(if $(DEBUG),$(warning ENTER))
-null :=#
-space := $(null) $(null)
-dot ?= .
+# include makefiles/constants.mk
+export dot :=.
+export null :=#
+export space := $(null) $(null)
+export quote-single := $(null)'$(null)#'
+export quote-double := $(null)"$(null)#"
-HIDE ?= @
+# [DEBUG] make {target} HIDE=
+HIDE ?= @
-env-clean = /usr/bin/env --ignore-environment
-xargs-n1 := xargs -0 -t -n1 --no-run-if-empty
+env-clean ?= /usr/bin/env --ignore-environment
+
+xargs-cmd := xargs -0 -t --no-run-if-empty
+xargs-n1 := $(xargs-cmd) -n1
+xargs-n1-clean := $(env-clean) $(xargs-n1)
+xargs-cmd-clean := $(env-clean) $(xargs-cmd)
## -----------------------------------------------------------------------
-## Not recommended but support (-u)ndef-less shell for pyenv activate
-## TODO: declare a pyenv shell
+## Intent: NOP command for targets whose dependencies do all heavy lifting
## -----------------------------------------------------------------------
+## usage: foo bar tans
+## <tab>$(nop-command)
+## -----------------------------------------------------------------------
+nop-cmd := :
+
+## -----------------------------------------------------------------------
+## Default shell:
+## o set -e enable error checking
+## o set -u report undefined errors
+## o set -o pipefail propogate shell pipeline failures.
+## -----------------------------------------------------------------------
+SHELL ?= /bin/bash
have-shell-bash := $(filter bash,$(subst /,$(space),$(SHELL)))
$(if $(have-shell-bash),$(null),\
- $(eval export SHELL := /bin/bash -euo pipefail))
+ $(eval export SHELL := bash -euo pipefail))
-shell-pyenv := bash -eo pipefail
+export SHELL ?= bash -euo pipefail
$(if $(DEBUG),$(warning LEAVE))
diff --git a/makefiles/docker/config/voltha-lib-go.mk b/makefiles/docker/config/voltha-lib-go.mk
new file mode 100644
index 0000000..4379237
--- /dev/null
+++ b/makefiles/docker/config/voltha-lib-go.mk
@@ -0,0 +1,28 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# 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.d
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+## repo:voltha-lib-go values for docker use
+
+go-cobertura-docker-mount := /app/src/github.com/opencord/voltha-lib-go/v7# #
+protoc-sh-docker-mount := /go/src/github.com/opencord/voltha-protos/v5# #
+# voltha-protos-v5 := /go/src/github.com/opencord/voltha-protos/v5
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/lint/yaml/yamllint.helm b/makefiles/docker/config/voltha-openolt-adapter.mk
similarity index 63%
copy from makefiles/lint/yaml/yamllint.helm
copy to makefiles/docker/config/voltha-openolt-adapter.mk
index 6c7787b..4e56be0 100644
--- a/makefiles/lint/yaml/yamllint.helm
+++ b/makefiles/docker/config/voltha-openolt-adapter.mk
@@ -1,6 +1,6 @@
# -*- makefile -*-
# -----------------------------------------------------------------------
-# Copyright 2022 Open Networking Foundation (ONF) and the ONF Contributors
+# Copyright 2023 Open Networking Foundation (ONF) and the ONF Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -12,21 +12,14 @@
# 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.
-#
-# SPDX-FileCopyrightText: 2022 Open Networking Foundation (ONF) and the ONF Contributors
-# SPDX-License-Identifier: Apache-2.0
+# limitations under the License.d
# -----------------------------------------------------------------------
----
-# yamllint.conf
-extends: default
+## repo:voltha-openolt-adapter values for docker use
-rules:
- empty-lines:
- max-end: 1
- line-length:
- max: 120
- braces:
- min-spaces-inside: 0
- max-spaces-inside: 1
+go-cobertura-docker-mount := /app/src/github.com/opencord/voltha-openolt-adapter
+protoc-sh-docker-mount := /go/src/github.com/opencord/voltha-protos/v5
+# voltha-protos-v5 := /go/src/github.com/opencord/voltha-protos/v5
+
+# [EOF]
+
diff --git a/makefiles/docker/include.mk b/makefiles/docker/include.mk
new file mode 100644
index 0000000..cd02827
--- /dev/null
+++ b/makefiles/docker/include.mk
@@ -0,0 +1,160 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2017-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# 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.d
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+# Per-repository
+include $(ONF_MAKEDIR)/docker/config/$(--repo-name--).mk
+
+# ------------------- ##
+# ---] GLOBALS [--- ##
+# ------------------- ##
+VOLTHA_TOOLS_VERSION ?= 2.4.0
+
+# ---------------------------------
+# Induce error for misconfiguration
+# ---------------------------------
+go-cobertura-docker-mount ?= $(error go-cobertura-docker-mount= is required)
+protoc-sh-docker-mount ?= $(error protoc-sh-docker-mount= is required)
+
+# ---------------------------
+# Macros: command refactoring
+# ---------------------------
+docker-iam ?= --user $$(id -u):$$(id -g)# # override for local use
+docker-run = docker run --rm $(docker-iam)# # Docker command stem
+docker-run-is = $(docker-run) $(is-stdin)# # Attach streams when interactive
+docker-run-app = $(docker-run-is) -v ${CURDIR}:/app# # w/filesystem mount
+
+# -----------------------------------------------------------------------
+# --interactive: Attach streams when stdout (fh==0) defined
+# --tty : Always create a pseudo-tty else jenkins:docker is silent
+# -----------------------------------------------------------------------
+is-stdin = $(shell test -t 0 && { echo '--interactive'; })
+is-stdin += --tty
+
+# Docker volume mounts: container:/app/release <=> localhost:{pwd}/release
+vee-golang = -v gocache-${VOLTHA_TOOLS_VERSION}:/go/pkg
+vee-citools = voltha/voltha-ci-tools:${VOLTHA_TOOLS_VERSION}
+
+# ---------------
+# Tool Containers
+# ---------------
+docker-go-stem = $(docker-run-app) -v gocache:/.cache $(vee-golang) $(vee-citools)-golang
+
+# -----------------------------------------------------------------------
+# Usage: GO := $(call get-cmd-docker-go)
+# -----------------------------------------------------------------------
+get-cmd-docker-go = $(docker-go-stem) go
+GO ?= $(call get-cmd-docker-go)
+
+# -----------------------------------------------------------------------
+# Usage: GO_SH := $(call get-docker-go-sh,./my.env.temp)
+# - populate my.env.temp with shell content to pass in
+# -----------------------------------------------------------------------
+get-cmd-docker-go-sh = $(docker-go-stem) $(if $(1),--env-file $(1)) sh -c
+GO_SH ?= $(call get-cmd-docker-go-sh,./my.env.temp)
+
+# -----------------------------------------------------------------------
+# Usage: PROTOC := $(call get-cmd-docker-protoc)
+# -----------------------------------------------------------------------
+get-cmd-docker-protoc = $(docker-run-app) $(vee-citools)-protoc protoc
+PROTOC ?= $(call get-cmd-docker-protoc)
+
+# -----------------------------------------------------------------------
+# Usage: PROTOC_SH := $(call get-cmd-docker-protoc-sh)
+# -----------------------------------------------------------------------
+get-cmd-docker-protoc-sh =\
+ $(strip \
+ $(docker-run-is) \
+ $(if $(protc-sh-docker-mount), \
+ -v ${CURDIR}:$(protoc-sh-docker-mount) \
+ --workdir=$(protoc-sh-docker-mount) \
+ ) \
+ $(vee-citools)-protoc \
+ sh -c \
+ )
+PROTOC_SH ?= $(call get-cmd-docker-protoc-sh)
+
+# get-docker-protoc-sh = $(strip )
+#PROTOC_SH = $(docker-run-is)
+#ifdef protc-sh-docker-mount
+# PROTOC_SH += -v ${CURDIR}:$(protoc-sh-docker-mount)
+# PROTOC_SH += --workdir=$(protoc-sh-docker-mount)
+#endif # protoc-sh-docker-mount
+#PROTOC_SH += $(vee-citools)-protoc sh -c
+
+# Usage: GO_JUNIT_REPORT := $(call get-docker-go-junit-repo)
+# get-docker-go-junit-repo = $(docker-run-app) $(vee-citools)-go-junit-report go-junit-report
+# GO_JUNIT_REPORT ?= $(call get-docker-go-junit-repo)
+
+# -----------------------------------------------------------------------
+# get-docker-gocover-cobertura = $(docker-run-app)/src/github.com/opencord/voltha-openolt-adapter $(vee-citools)-gocover-cobertura gocover-cobertura
+# GOCOVER_COBERTURA ?= $(call get-docker-gocover-cobertura)
+
+## -----------------------------------------------------------------------
+## Coverage report: junit
+## -----------------------------------------------------------------------
+## Usage: GO_JUNIT_REPORT ?= $(call get-go-junit-report-cmd)
+## -----------------------------------------------------------------------
+get-go-junit-report-cmd =\
+ $(strip \
+ $(docker-run) \
+ -v ${CURDIR}:/app \
+ -i $(vee-citools)-go-junit-report go-junit-report \
+ )
+GO_JUNIT_REPORT ?= $(call get-go-junit-report-cmd)
+
+## -----------------------------------------------------------------------
+## Coverage report: cobertura
+## -----------------------------------------------------------------------
+## Usage: GOCOVER_COBERTURA ?= $(call get-docker-gocover-cobertura-cmd)
+## -----------------------------------------------------------------------
+get-docker-go-cobertura-cmd =\
+ $(strip \
+ $(docker-run)\
+ -v ${CURDIR}:$(go-cobertura-docker-mount)\
+ -i $(vee-citools)-gocover-cobertura gocover-cobertura\
+ )
+GOCOVER_COBERTURA ?= $(call get-docker-go-cobertura-cmd)
+
+## -----------------------------------------------------------------------
+##
+## -----------------------------------------------------------------------
+get-cmd-docker-golangci-lint =\
+ $(strip \
+ $(docker-run-app) \
+ -v gocache:/.cache \
+ $(vee-golang)\
+ $(vee-citools)-golangci-lint\
+ golangci-lint\
+ )
+GOLANGCI_LINT ?= $(call get-cmd-docker-golangci-lint)
+
+## -----------------------------------------------------------------------
+##
+## -----------------------------------------------------------------------
+get-docker-hadolint =\
+ $(strip \
+ $(docker-run-app) \
+ $(vee-citools)-hadolint \
+ hadolint \
+ )
+HADOLINT ?= $(call get-docker-hadolint)
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/etc/features.mk b/makefiles/etc/features.mk
new file mode 100644
index 0000000..a48b42c
--- /dev/null
+++ b/makefiles/etc/features.mk
@@ -0,0 +1,48 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2017-2023 Open Networking Foundation
+#
+# 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.
+#
+# SPDX-FileCopyrightText: 2017-2023 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+# Usage:
+#
+# mytarget:
+# $(call banner-enter,target $@)
+# @echo "Hello World"
+# $(call banner-leave,target $@)
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+target-banner = ** ---------------------------------------------------------------------------
+
+## -----------------------------------------------------------------------
+## Intent: Return a command line able to display a banner hilighting
+## make target processing within a logfile.
+## -----------------------------------------------------------------------
+banner-enter=\
+ @echo -e \
+ "\n"\
+ "$(target-banner)\n"\
+ "** $(MAKE) ENTER: $(1)\n"\
+ "$(target-banner)"\
+
+banner-leave=\
+ @echo -e "** $(MAKE) LEAVE: $(1)"
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/etc/include.mk b/makefiles/etc/include.mk
new file mode 100644
index 0000000..a48b42c
--- /dev/null
+++ b/makefiles/etc/include.mk
@@ -0,0 +1,48 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2017-2023 Open Networking Foundation
+#
+# 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.
+#
+# SPDX-FileCopyrightText: 2017-2023 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+# Usage:
+#
+# mytarget:
+# $(call banner-enter,target $@)
+# @echo "Hello World"
+# $(call banner-leave,target $@)
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+target-banner = ** ---------------------------------------------------------------------------
+
+## -----------------------------------------------------------------------
+## Intent: Return a command line able to display a banner hilighting
+## make target processing within a logfile.
+## -----------------------------------------------------------------------
+banner-enter=\
+ @echo -e \
+ "\n"\
+ "$(target-banner)\n"\
+ "** $(MAKE) ENTER: $(1)\n"\
+ "$(target-banner)"\
+
+banner-leave=\
+ @echo -e "** $(MAKE) LEAVE: $(1)"
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/fixes/jjb b/makefiles/fixes/jjb
new file mode 100644
index 0000000..90c81bd
--- /dev/null
+++ b/makefiles/fixes/jjb
@@ -0,0 +1,5 @@
+make: *** No rule to make target 'checkout-ci-management-sub-modules', needed by 'lint-jjb'. Stop.
+
+ o lint-jjb should only be enabled for ci-management repos.
+ o Disable checking by assigning (NO_LINT_JJB := true) in ${repo-root}/config.mk
+
diff --git a/makefiles/gerrit/help.mk b/makefiles/gerrit/help.mk
new file mode 100644
index 0000000..2ba155b
--- /dev/null
+++ b/makefiles/gerrit/help.mk
@@ -0,0 +1,30 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2021-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# 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.
+# -----------------------------------------------------------------------
+
+# -----------------------------------------------------------------------
+# -----------------------------------------------------------------------
+help-summary ::
+ @echo ' help-gerrit Display help for gerrit targets'
+
+help-verbose :: help-gerrit
+
+help-gerrit:
+ @echo
+ @echo '[GERRIT]'
+ @echo ' replication-status Report sync status of the gerrit-to-github mirror.'
+
+# [EOF]
diff --git a/makefiles/gerrit/include.mk b/makefiles/gerrit/include.mk
new file mode 100644
index 0000000..5ae76a4
--- /dev/null
+++ b/makefiles/gerrit/include.mk
@@ -0,0 +1,44 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2021-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# 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.
+# -----------------------------------------------------------------------
+
+##--------------------##
+##---] INCLUDES [---##
+##--------------------##
+include $(ONF_MAKEDIR)/gerrit/help.mk
+
+# -----------------------------------------------------------------------
+# -----------------------------------------------------------------------
+replication-status:
+ ssh gerrit.opencord.org replication list --detail
+
+# -----------------------------------------------------------------------
+# NOTE: Gerrit ssh targets assume use of ~/.ssh config files
+# port, login, etc are
+# -----------------------------------------------------------------------
+# % ssh -p 29418 <username>@gerrit.opencord.org replication list --detail
+# % ssh gerrit.opencord.org replication list --detail
+# -----------------------------------------------------------------------
+# Host gerrit.opencord.org
+# Hostname gerrit.opencord.org
+# IdentityFile ~/.ssh/gerrit.opencord.org/{ssh_keyfile}
+# IdentitiesOnly yes
+# AddKeysToAgent yes
+# Port 29418
+# User tux@opennetworking.org
+# -----------------------------------------------------------------------
+
+# [EOF]
diff --git a/makefiles/git/byrepo/ci-management.mk b/makefiles/git/byrepo/ci-management.mk
new file mode 100644
index 0000000..373dc23
--- /dev/null
+++ b/makefiles/git/byrepo/ci-management.mk
@@ -0,0 +1,80 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# 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.
+#
+# SPDX-FileCopyrightText: 2022 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+GIT ?= git
+
+## -----------------------------------------------------------------------
+## Intent: Checkout submodules required by ci-management
+## -----------------------------------------------------------------------
+submodule-repos := $(null)
+submodule-repos += global-jjb
+submodule-repos += lf-ansible
+submodule-repos += packer
+
+submodule-deps := $(null)
+submodule-deps += submodules# # named pseudo target
+submodule-deps += $(submodule-repos)
+
+.PHONY: $(submodule-deps)
+$(submodule-deps):
+ @echo
+ @echo "Checkout dependent submodules"
+ $(GIT) submodule init
+ $(GIT) submodule update
+
+# Abstraction: named target for submodule checkout
+checkout-ci-management-sub-modules: $(submodule-repos)
+
+## -----------------------------------------------------------------------
+## Intent: Revert sandbox to a pristine state.
+## -----------------------------------------------------------------------
+sterile ::
+ $(RM) -r $(submodule-repos)
+
+ # FIXME:
+ # o restore hierarchy to avoid git status 'deleted:'
+ # o remove: externals should not be under revision control
+ $(GIT) co $(submodule-repos)
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+help ::
+ @echo
+ @echo '[GIT-SUBMODULES: docs]'
+ @echo ' reload Setup to auto-reload sphinx doc changes in browser'
+ @echo
+ @echo '[GIT-SUBMODULES: deps]'
+ @echo ' submodules Checkout dependent git submodules'
+ ifdef VERBOSE
+ @echo ' global-jjb Checkout ci-management submodule global-jjb'
+ @echo ' lf-ansible Checkout ci-management submodule lf-ansible'
+ @echo ' packer Checkout ci-management submodule packer'
+ endif
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+todo ::
+ @echo "Generalize logc, update to depend on .git/ rather than named targets."
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/git/ci-management.mk b/makefiles/git/ci-management.mk
new file mode 100644
index 0000000..373dc23
--- /dev/null
+++ b/makefiles/git/ci-management.mk
@@ -0,0 +1,80 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# 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.
+#
+# SPDX-FileCopyrightText: 2022 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+GIT ?= git
+
+## -----------------------------------------------------------------------
+## Intent: Checkout submodules required by ci-management
+## -----------------------------------------------------------------------
+submodule-repos := $(null)
+submodule-repos += global-jjb
+submodule-repos += lf-ansible
+submodule-repos += packer
+
+submodule-deps := $(null)
+submodule-deps += submodules# # named pseudo target
+submodule-deps += $(submodule-repos)
+
+.PHONY: $(submodule-deps)
+$(submodule-deps):
+ @echo
+ @echo "Checkout dependent submodules"
+ $(GIT) submodule init
+ $(GIT) submodule update
+
+# Abstraction: named target for submodule checkout
+checkout-ci-management-sub-modules: $(submodule-repos)
+
+## -----------------------------------------------------------------------
+## Intent: Revert sandbox to a pristine state.
+## -----------------------------------------------------------------------
+sterile ::
+ $(RM) -r $(submodule-repos)
+
+ # FIXME:
+ # o restore hierarchy to avoid git status 'deleted:'
+ # o remove: externals should not be under revision control
+ $(GIT) co $(submodule-repos)
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+help ::
+ @echo
+ @echo '[GIT-SUBMODULES: docs]'
+ @echo ' reload Setup to auto-reload sphinx doc changes in browser'
+ @echo
+ @echo '[GIT-SUBMODULES: deps]'
+ @echo ' submodules Checkout dependent git submodules'
+ ifdef VERBOSE
+ @echo ' global-jjb Checkout ci-management submodule global-jjb'
+ @echo ' lf-ansible Checkout ci-management submodule lf-ansible'
+ @echo ' packer Checkout ci-management submodule packer'
+ endif
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+todo ::
+ @echo "Generalize logc, update to depend on .git/ rather than named targets."
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/git/help.mk b/makefiles/git/help.mk
new file mode 100644
index 0000000..cbd33ee
--- /dev/null
+++ b/makefiles/git/help.mk
@@ -0,0 +1,31 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# 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.
+# -----------------------------------------------------------------------
+# Intent: Helper makefile target used to setup for a release
+# -----------------------------------------------------------------------
+
+## ---------------------------------------------------------------------------
+## Intent: Display supported targets
+## ---------------------------------------------------------------------------
+help-onf-git :
+ @echo
+ @echo '[GIT]'
+ @echo ' show-submodules Display a list of repository submodules and versions'
+
+help ::
+ @echo ' help-onf-git Display git makefile targets'
+
+# [EOF]
diff --git a/makefiles/git/include.mk b/makefiles/git/include.mk
new file mode 100644
index 0000000..db0623b
--- /dev/null
+++ b/makefiles/git/include.mk
@@ -0,0 +1,43 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# 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.
+#
+# SPDX-FileCopyrightText: 2022 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+ifdef USE-ONF-GIT-MK
+ --onf-make-git-- := seen
+endif
+
+ifndef --onf-make-git--
+
+##--------------------##
+##---] INCLUDES [---##
+##--------------------##
+include $(ONF_MAKEDIR)/git/help.mk
+include $(ONF_MAKEDIR)/git/required.mk
+
+## Special snowflake: per-repository logic loader
+-include $(ONF_MAKEDIR)/git/byrepo/$(--repo-name--).mk
+
+# Dynamic loading when targets are requested by name
+include $(ONF_MAKEDIR)/git/submodules.mk
+
+endif # --onf-make-git--
+
+# [EOF]
diff --git a/makefiles/git/required.mk b/makefiles/git/required.mk
new file mode 100644
index 0000000..44f498d
--- /dev/null
+++ b/makefiles/git/required.mk
@@ -0,0 +1,32 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# 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.
+# -----------------------------------------------------------------------
+# Intent: Conditionally load when named targets are requested.
+# var ?= $(error ...) definitions are fatal to "make help" and others
+# -----------------------------------------------------------------------
+
+git-mk-targets := $(NULL)
+git-mk-targets := show-submodules
+
+# -----------------------------------------------------------------------
+# Define a flag to only load release targets when mentioned by name
+# Makefile can also explicitly define the flag to force always loading.
+# -----------------------------------------------------------------------
+$(foreach tgt,$(git-mk-targets),\
+ $(if $(findstring $(tgt),$(MAKECMDGOALS)),$(eval USE-ONF-GIT-MK := true))\
+)
+
+# [EOF]
diff --git a/makefiles/git/submodules.mk b/makefiles/git/submodules.mk
new file mode 100644
index 0000000..42c2fc2
--- /dev/null
+++ b/makefiles/git/submodules.mk
@@ -0,0 +1,57 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# 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.
+#
+# SPDX-FileCopyrightText: 2022 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+show-submodules:
+
+ $(HIDE)cat .gitmodules
+
+ @echo
+ $(HIDE) git submodule
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# https://github.com/lfit/releng-global-jjb/tags
+# git checkout v0.86.7
+# [crucible:global-jjb] git checkout v0.86.7
+# Previous HEAD position was 5dc3432 Update regexp in lf-infra-ship-logs macro
+# HEAD is now at c5bd1d3 Fix: Pin urllib3~=1.26.15 in pypi dist jobs
+
+# 5dc3432cae2f13d9e5151a00a76a78ce73d92d70 global-jjb (v0.53.3)
+# 0d88f8b7a24b53b1c3e189e30ab94373c51eea91 lf-ansible (0d88f8b)
+# 4a5b0cd9032938194c4813fe36663ddee4f9e60e packer/common-packer (v0.1.0~22)
+
+# https://stackoverflow.com/questions/30301510/git-submodule-specify-version
+# cd global-jjb
+# git checkout v0.86.7
+# cd -
+# git commit . -m "use submodule v0.86.7"
+
+# https://github.com/lfit/releng-lf-ansible.git
+# tag==master, no release
+
+# https://github.com/lfit/releng-common-packer.git
+# cd packer/common-packer
+# git checkout v0.12.1
+# cd -
+# git commit . -m "use submodule v0.12.1""
+
+# [EOF]
diff --git a/makefiles/help.mk b/makefiles/help.mk
index f62f064..3744d74 100644
--- a/makefiles/help.mk
+++ b/makefiles/help.mk
@@ -38,4 +38,8 @@
@echo " lint-mod : Verify the integrity of the 'mod' files"
@echo " sca : "
+ @echo
+ @echo " % $(MAKE) help-{topic} VERBOSE=1"
+ @echo " : Extended makefile target help"
+
# [EOF]
diff --git a/makefiles/help/header.mk b/makefiles/help/header.mk
new file mode 100644
index 0000000..021ac0d
--- /dev/null
+++ b/makefiles/help/header.mk
@@ -0,0 +1,6 @@
+# -*- makefile -*-
+
+help :
+ @echo "Usage: make [options] [target] ..."
+ @echo "Targets:"
+ @echo " help This message"
diff --git a/makefiles/help/include.mk b/makefiles/help/include.mk
new file mode 100644
index 0000000..01efdc1
--- /dev/null
+++ b/makefiles/help/include.mk
@@ -0,0 +1,114 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2017-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# 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.
+# -----------------------------------------------------------------------
+
+##-------------------##
+##---] GLOBALS [---##
+##-------------------##
+.PHONY: help help-summary help-simple help-verbose
+
+##-------------------##
+##---] TARGETS [---##
+##-------------------##
+
+## -----------------------------------------------------------------------
+## Intent: Render topic/tool based makefile help
+## -----------------------------------------------------------------------
+## Three targets are used to render conditional makefile help
+## help-summary A one-line target summary for the topic
+## help-simple Common targets for the topic (lint-helm, build, test)
+## help-verbose Exhaustive display of supported targets
+## -----------------------------------------------------------------------
+## [COOKBOOK]
+## help colon-colon All 'help' targets are evaluated for 'make help'
+## help-banner Display a usage banner for help
+## help-summary Display all one-line topic summary help
+## [conditonal]
+## help-simple Display all common topic makefile targets.
+## help-verbose Exhaustive display of makefile target help.
+## VERBOSE=
+## -----------------------------------------------------------------------
+## [See Also] makefiles/gerrit/{include.mk, help.mk}
+## help-gerrit Summary targets can always be used to display topic help
+## help-verbose Exhaustive gerrit target display.
+## -----------------------------------------------------------------------
+help :: help-banner help-summary
+
+## -----------------------------------------------------------------------
+## Intent: Display a usage banner for help. Target will be evaluated
+## before all other help display.
+## -----------------------------------------------------------------------
+help-banner:
+ @echo "Usage: $(MAKE) [options] [target] ..."
+
+## -----------------------------------------------------------------------
+## Intent: Display extended help.
+## -----------------------------------------------------------------------
+## Question:
+## o Help display can be long based on volume of targets.
+## o Should a 3rd case be added to display:
+## - help-simple (one-liner help) by default
+## - conditional display of extended help:
+## - help-simple or help-verbose
+## o Current logic displays extended help by default.
+## -----------------------------------------------------------------------
+## Usage: see makefiles/targets/test.mk
+## test-verbose += help-check# # append help target to help-verbose
+## -----------------------------------------------------------------------
+ifdef VERBOSE
+ help-verbose += help-verbose
+ help :: $(help-verbose)
+else
+ help :: help-simple
+endif
+
+## -----------------------------------------------------------------------
+## Intent: Display context specific help for named targets.
+## -----------------------------------------------------------------------
+## [TODO] Display a list of help-* tokens for target specific content:
+## % make help-check
+## % make help-test
+## -----------------------------------------------------------------------
+## [TODO] Define LEVEL= or helper targets (help-lint-{level})
+## for extended help w/o information overload
+## [0] help # make help
+## [1] help-lint # make help-verbose or (VERBOSE=1)
+## [2] help-lint-shell # make help-lint VERBOSE=1 (??)
+## [2] help-lint-yaml
+## -----------------------------------------------------------------------
+help-index ::
+ @echo
+ @echo '[HELP] - An index of help context for common targets'
+ @echo ' help-index This message'
+ $(HIDE)\
+ for name in $(sort $(help-verbose)); do\
+ echo " $$name";\
+ done
+
+## -----------------------------------------------------------------------
+## Intent: Display simple extended target help
+## -----------------------------------------------------------------------
+help-simple :: help-index
+ @echo
+ @echo '[VIEW]'
+ @echo ' reload Setup to auto-reload sphinx doc changes in browser'
+ @echo ' view-html View generated documentation'
+ @echo
+ @echo '[TEST]'
+ @echo " test $(MAKE) lint linkcheck"
+ @echo " test-all $(MAKE) all-generation-targets"
+
+# [EOF]
diff --git a/makefiles/help/trailer.mk b/makefiles/help/trailer.mk
new file mode 100644
index 0000000..8fcdfa6
--- /dev/null
+++ b/makefiles/help/trailer.mk
@@ -0,0 +1,42 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2017-2023 Open Networking Foundation
+#
+# 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.
+# -----------------------------------------------------------------------
+
+# include this makefile late so text will be displayed at the end6
+
+help ::
+ @echo
+ @echo '[CLEAN]'
+ @echo ' clean Remove generated targets'
+ @echo ' sterile clean + remove virtual env interpreter install'
+
+help ::
+ @echo
+ @echo '[HELP]'
+ @echo ' help Display program help'
+ @echo ' help-verbose Display additional targets and help'
+
+## -----------------------------------------------------------------------
+# repo::voltha-docs -- patch logic not deployed everywhere.
+## -----------------------------------------------------------------------
+# help ::
+# @echo
+# @echo '[NOTE: python 3.10+]'
+# @echo ' The interpreter is not yet fully supported across foreign repositories.'
+# @echo ' While working locally, if make fails to build a target try:'
+# @echo ' $(MAKE) $${target} NO_OTHER_REPO_DOCS=1'
+
+# [EOF]
diff --git a/makefiles/help/variables.mk b/makefiles/help/variables.mk
new file mode 100644
index 0000000..a22b179
--- /dev/null
+++ b/makefiles/help/variables.mk
@@ -0,0 +1,36 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2017-2023 Open Networking Foundation
+#
+# 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.
+# -----------------------------------------------------------------------
+
+# Include variables.mk after library makefiles have been included
+
+ifdef VERBOSE
+ help :: help-variables
+else
+ help ::
+ @echo
+ @echo '[VARIABLES] - Conditional makefile behavior'
+ @echo ' see also: help-variables'
+endif
+
+help-variables:
+ @echo
+ @echo '[VARIABLES] - Conditional makefile behavior'
+ @echo ' NO_PATCHES= Do not apply patches to the python virtualenv'
+ @echo ' NO_OTHER_REPO_DOCS= No foreign repos, only apply target to local sources.'
+ @echo ' VERBOSE= Display extended help topics'
+
+# [EOF]
diff --git a/makefiles/include.mk b/makefiles/include.mk
index 023060e..a47a91c 100644
--- a/makefiles/include.mk
+++ b/makefiles/include.mk
@@ -14,25 +14,60 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-# SPDX-FileCopyrightText: 2022 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-FileCopyrightText: 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
# SPDX-License-Identifier: Apache-2.0
# -----------------------------------------------------------------------
+# https://gerrit.opencord.org/plugins/gitiles/onf-make
+# ONF.makefile.version = 1.0
+# -----------------------------------------------------------------------
+
+ifndef mk-include--onf-make # single-include guard macro
$(if $(DEBUG),$(warning ENTER))
-ONF_MAKE ?= $(MAKEDIR)# fix this -- two distinct makefile imports needed
-ONF_MAKE ?= $(error ONF_MAKE= is required)
-
## -----------------------------------------------------------------------
+## Define vars based on relative import (normalize symlinks)
+## Usage: include makefiles/onf/include.mk
## -----------------------------------------------------------------------
-help::
- @echo "Usage: make [options] [target] ..."
+onf-mk-abs ?= $(abspath $(lastword $(MAKEFILE_LIST)))
+onf-mk-top := $(subst /include.mk,$(null),$(onf-mk-abs))
+ONF_MAKEDIR := $(onf-mk-top)
-include $(ONF_MAKE)/consts.mk
-include $(ONF_MAKE)/help.mk
-include $(ONF_MAKE)/lint/include.mk
-# include $(ONF_MAKE)/python/include.mk
+TOP ?= $(patsubst %/makefiles/include.mk,%,$(onf-mk-abs))
+
+include $(ONF_MAKEDIR)/consts.mk
+include $(ONF_MAKEDIR)/help/include.mk # render target help
+include $(ONF_MAKEDIR)/utils/include.mk # dependency-less helper macros
+include $(ONF_MAKEDIR)/etc/include.mk # banner macros
+include $(ONF_MAKEDIR)/commands/include.mk # Tools and local installers
+
+include $(ONF_MAKEDIR)/virtualenv.mk# # lint-{jjb,python} depends on venv
+include $(ONF_MAKEDIR)/lint/include.mk
+
+include $(ONF_MAKEDIR)/gerrit/include.mk
+include $(ONF_MAKEDIR)/git/include.mk
+include $(ONF_MAKEDIR)/jjb/include.mk
+
+# include $(ONF_MAKEDIR)/release/include.mk
+
+include $(ONF_MAKEDIR)/todo.mk
+include $(ONF_MAKEDIR)/help/variables.mk
+
+##---------------------##
+##---] ON_DEMAND [---##
+##---------------------##
+$(if $(USE-ONF-GERRIT-MK),$(eval include $(ONF_MAKEDIR)/gerrit/include.mk))
+$(if $(USE-ONF-DOCKER-MK),$(eval include $(ONF_MAKEDIR)/docker/include.mk))
+
+##-------------------##
+##---] TARGETS [---##
+##-------------------##
+include $(ONF_MAKEDIR)/targets/include.mk # clean, sterile, tox
$(if $(DEBUG),$(warning LEAVE))
+mk-include--onf-make := true
+
+endif # mk-include--onf-make
+
# [EOF]
diff --git a/makefiles/jjb/help.mk b/makefiles/jjb/help.mk
new file mode 100644
index 0000000..331c68a
--- /dev/null
+++ b/makefiles/jjb/help.mk
@@ -0,0 +1,38 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# 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.
+# -----------------------------------------------------------------------
+# Intent: Helper makefile target used to setup for a release
+# -----------------------------------------------------------------------
+
+## ---------------------------------------------------------------------------
+## Intent: Display supported targets
+## ---------------------------------------------------------------------------
+help-jjb:
+ @echo
+ @echo '[JJB]'
+ @echo ' jjb-gen Generate a local set of JJB pipelines'
+
+ ifdef VERBOSE
+ @echo ' LOGS=1 Display log from jjb-gen target'
+ @echo ' VERBOSE=1 Display generated pipeline files'
+ endif
+
+## ---------------------------------------------------------------------------
+## ---------------------------------------------------------------------------
+help ::
+ @echo ' help-jjb Display Jenkins Job Builder targets'
+
+# [EOF]
diff --git a/makefiles/lint/yaml/yamllint.helm b/makefiles/jjb/include.mk
similarity index 60%
copy from makefiles/lint/yaml/yamllint.helm
copy to makefiles/jjb/include.mk
index 6c7787b..90121dc 100644
--- a/makefiles/lint/yaml/yamllint.helm
+++ b/makefiles/jjb/include.mk
@@ -1,6 +1,6 @@
# -*- makefile -*-
# -----------------------------------------------------------------------
-# Copyright 2022 Open Networking Foundation (ONF) and the ONF Contributors
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -14,19 +14,23 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-# SPDX-FileCopyrightText: 2022 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-FileCopyrightText: 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
# SPDX-License-Identifier: Apache-2.0
# -----------------------------------------------------------------------
----
-# yamllint.conf
-extends: default
+$(if $(DEBUG),$(warning ENTER))
-rules:
- empty-lines:
- max-end: 1
- line-length:
- max: 120
- braces:
- min-spaces-inside: 0
- max-spaces-inside: 1
+##--------------------##
+##---] INCLUDES [---##
+##--------------------##
+include $(ONF_MAKEDIR)/jjb/help.mk
+include $(ONF_MAKEDIR)/jjb/required.mk
+
+ifdef USE-ONF-JJB-MK
+ # Dynamic loading when targets are requested by name
+ include $(ONF_MAKEDIR)/jjb/targets.mk
+endif
+
+# [EOF]
+
+
diff --git a/makefiles/jjb/required.mk b/makefiles/jjb/required.mk
new file mode 100644
index 0000000..17371e9
--- /dev/null
+++ b/makefiles/jjb/required.mk
@@ -0,0 +1,33 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# 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.
+# -----------------------------------------------------------------------
+# Intent: Conditionally load when named targets are requested.
+# var ?= $(error ...) definitions are fatal to "make help" and others
+# -----------------------------------------------------------------------
+
+onf-mk-jjb-targets := $(NULL)
+onf-mk-jjb-targets += jjb-gen
+onf-mk-jjb-targets += sterile
+
+# -----------------------------------------------------------------------
+# Define a flag to only load release targets when mentioned by name
+# Makefile can also explicitly define the flag to force always loading.
+# -----------------------------------------------------------------------
+$(foreach tgt,$(onf-mk-jjb-targets),\
+ $(if $(findstring $(tgt),$(MAKECMDGOALS)),$(eval USE-ONF-JJB-MK := true))\
+)
+
+# [EOF]
diff --git a/makefiles/jjb/targets.mk b/makefiles/jjb/targets.mk
new file mode 100644
index 0000000..17fc78f
--- /dev/null
+++ b/makefiles/jjb/targets.mk
@@ -0,0 +1,64 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# 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.
+# -----------------------------------------------------------------------
+# Intent: Helper makefile target used to setup for a release
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+##-------------------##
+##---] GLOBALS [---##
+##-------------------##
+jjb-gen-dir := build
+
+##-------------------##
+##---] TARGETS [---##
+##-------------------##
+all: help
+
+## -----------------------------------------------------------------------
+## Intent: Generate pipeline jobs
+## -----------------------------------------------------------------------
+.PHONY: jjb-gen
+
+jjb-gen-log := $(jjb-gen-dir)/jjb-gen.log
+jjb-gen:
+ @mkdir -p $(jjb-gen-dir)
+
+ @echo
+ @echo "** Generating pipelines (target: $@)"
+ @touch "$(jjb-gen-dir)/.sentinel"
+ ( jenkins-jobs test $(PWD)/jjb -o $(jjb-gen-dir) 3>&1 2>&1 )\
+ > "$(jjb-gen-log)"
+
+ ifdef LOGS
+ -@less "$(jjb-gen-log)"
+ endif
+
+ ifdef VERBOSE
+ @echo
+ @echo "** Display generated pipelines"
+ find "$(jjb-gen-dir)" -newer "$(jjb-gen-dir)/.sentinel" -ls
+ endif
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+sterile ::
+ $(RM) -r $(jjb-gen-dir)
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/lint/groovy.mk b/makefiles/lint/groovy.mk
new file mode 100644
index 0000000..6baf70c
--- /dev/null
+++ b/makefiles/lint/groovy.mk
@@ -0,0 +1,51 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# 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.
+# -----------------------------------------------------------------------
+
+##-------------------##
+##---] GLOBALS [---##
+##-------------------##
+
+groovy-check := npm-groovy-lint
+
+groovy-check-args := $(null)
+# groovy-check-args += --loglevel info
+# groovy-check-args += --ignorepattern
+# groovy-check-args += --verbose
+
+##-------------------##
+##---] TARGETS [---##
+##-------------------##
+ifndef NO-LINT-GROOVY
+ lint : lint-groovy
+endif
+
+## -----------------------------------------------------------------------
+## Intent: Perform a lint check on command line script sources
+## -----------------------------------------------------------------------
+lint-groovy:
+ $(groovy-check) --version
+ @echo
+ $(HIDE)$(env-clean) find . -iname '*.groovy' -print0 \
+ | $(xargs-n1) $(groovy-check) $(groovy-check-args)
+
+## -----------------------------------------------------------------------
+## Intent: Display command help
+## -----------------------------------------------------------------------
+help-summary ::
+ @echo ' lint-groovy Syntax check groovy sources'
+
+# [EOF]
diff --git a/makefiles/lint/groovy/README.md b/makefiles/lint/groovy/README.md
new file mode 100644
index 0000000..aa9b41a
--- /dev/null
+++ b/makefiles/lint/groovy/README.md
@@ -0,0 +1,13 @@
+# lint: groovy source
+
+# Invoke the linting tool
+% make lint-groovy
+
+# Alt checking: groovy interpreter
+
+Odd syntax errors can be detected by the groovy interpreter.
+
+% groovy path/to/{source}.groovy
+
+jjb/ pipeline scripts will eventually due to syntax problems but groovy can
+still detect problems like mismatched quotes, invalid op tokens, etc.
diff --git a/makefiles/lint/groovy/urls b/makefiles/lint/groovy/urls
new file mode 100644
index 0000000..aa5c5eb
--- /dev/null
+++ b/makefiles/lint/groovy/urls
@@ -0,0 +1,8 @@
+# -*- makefile -*-
+
+# Config file and exclusions
+https://www.npmjs.com/package/npm-groovy-lint#Configuration
+
+https://github.com/nvuillam/npm-groovy-lint
+
+# [EOF]
diff --git a/makefiles/lint/yaml/yamllint.helm b/makefiles/lint/help.mk
similarity index 61%
copy from makefiles/lint/yaml/yamllint.helm
copy to makefiles/lint/help.mk
index 6c7787b..24a5aa1 100644
--- a/makefiles/lint/yaml/yamllint.helm
+++ b/makefiles/lint/help.mk
@@ -1,6 +1,6 @@
# -*- makefile -*-
# -----------------------------------------------------------------------
-# Copyright 2022 Open Networking Foundation (ONF) and the ONF Contributors
+# Copyright 2021-2023 Open Networking Foundation (ONF) and the ONF Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -13,20 +13,19 @@
# 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.
-#
-# SPDX-FileCopyrightText: 2022 Open Networking Foundation (ONF) and the ONF Contributors
-# SPDX-License-Identifier: Apache-2.0
# -----------------------------------------------------------------------
----
-# yamllint.conf
-extends: default
+help ::
-rules:
- empty-lines:
- max-end: 1
- line-length:
- max: 120
- braces:
- min-spaces-inside: 0
- max-spaces-inside: 1
+# -----------------------------------------------------------------------
+# -----------------------------------------------------------------------
+help-summary ::
+ @echo ' help-lint Display lint target help'
+
+help-simple :: help-lint
+help-lint :
+ @echo
+ @echo "[LINT]"
+ @echo ' help-lint Display lint target help'
+
+# [EOF]
diff --git a/makefiles/lint/include.mk b/makefiles/lint/include.mk
index 2a2d9ab..e831985 100644
--- a/makefiles/lint/include.mk
+++ b/makefiles/lint/include.mk
@@ -1,23 +1,52 @@
# -*- makefile -*-
# -----------------------------------------------------------------------
-# Copyright 2022 Open Networking Foundation (ONF) and the ONF Contributors
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# 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.
+#
+# SPDX-FileCopyrightText: 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+# https://gerrit.opencord.org/plugins/gitiles/onf-make
+# ONF.makefile.version = 1.1
# -----------------------------------------------------------------------
$(if $(DEBUG),$(warning ENTER))
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
help ::
@echo
@echo "[LINT]"
-include $(ONF_MAKE)/lint/makefile.mk
-include $(ONF_MAKE)/lint/python.mk
-include $(ONF_MAKE)/lint/shell.mk
+## moved to config.mk
+## Disable python linting in bulk ?
+# ifdef NO-LINT-PYTHON
+# NO-LINT-FLAKE8 := true
+# NO-LINT-PYLINT := true
+# endif
-ifdef YAML_FILES
- include $(ONF_MAKE)/lint/yaml/python.mk
-else
- include $(ONF_MAKE)/lint/yaml/yamllint.mk
-endif
+include $(ONF_MAKEDIR)/lint/groovy.mk
+include $(ONF_MAKEDIR)/lint/jjb.mk
+include $(ONF_MAKEDIR)/lint/json.mk
+include $(ONF_MAKEDIR)/lint/license/include.mk
+include $(ONF_MAKEDIR)/lint/makefile.mk
+include $(ONF_MAKEDIR)/lint/python/include.mk
+include $(ONF_MAKEDIR)/lint/shellcheck/include.mk
+include $(ONF_MAKEDIR)/lint/tox/include.mk
+include $(ONF_MAKEDIR)/lint/yaml/include.mk
+
+include $(ONF_MAKEDIR)/lint/help.mk
$(if $(DEBUG),$(warning LEAVE))
diff --git a/makefiles/lint/include.mk.bk b/makefiles/lint/include.mk.bk
new file mode 100644
index 0000000..2a2d9ab
--- /dev/null
+++ b/makefiles/lint/include.mk.bk
@@ -0,0 +1,24 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2022 Open Networking Foundation (ONF) and the ONF Contributors
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+help ::
+ @echo
+ @echo "[LINT]"
+
+include $(ONF_MAKE)/lint/makefile.mk
+include $(ONF_MAKE)/lint/python.mk
+include $(ONF_MAKE)/lint/shell.mk
+
+ifdef YAML_FILES
+ include $(ONF_MAKE)/lint/yaml/python.mk
+else
+ include $(ONF_MAKE)/lint/yaml/yamllint.mk
+endif
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/lint/jjb.mk b/makefiles/lint/jjb.mk
new file mode 100644
index 0000000..5f7e7c8
--- /dev/null
+++ b/makefiles/lint/jjb.mk
@@ -0,0 +1,67 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# 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.
+# -----------------------------------------------------------------------
+
+##-------------------##
+##---] GLOBALS [---##
+##-------------------##
+.PHONY: lint-venv
+
+##-------------------##
+##---] TARGETS [---##
+##-------------------##
+ifndef NO-LINT-JJB
+ lint : lint-jjb
+endif
+
+## -----------------------------------------------------------------------
+## Intent: Construct command line for linting jenkins-job-builder config
+## -----------------------------------------------------------------------
+
+ifdef DEBUG
+ lint-jjb-args += --log_level DEBUG# # verbosity: high
+else
+ lint-jjb-args += --log_level INFO# # verbosity: default
+endif
+lint-jjb-args += --ignore-cache
+lint-jjb-args += test# # command action
+lint-jjb-args += -o archives/job-configs# # Generated jobs written here
+lint-jjb-args += --recursive
+lint-jjb-args += --config-xml# # JJB v3.0 write to OUTPUT/jobname/config.xml
+lint-jjb-args += jjb/# # JJB config sources (input)
+
+lint-jjb-deps := $(null)
+lint-jjb-deps += $(venv-activate-script)
+lint-jjb-deps += checkout-ci-management-sub-modules
+lint-jjb: $(lint-jjb-deps)
+ $(activate) && { jenkins-jobs $(lint-jjb-args); }
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+help ::
+ @echo ' lint-jjb Validate jjb job generation'
+ifdef VERBOSE
+ @echo ' DEBUG=1 lint-jjb --log_level=DEBUG'
+endif
+
+# [ERRORS]
+# -----------------------------------------------------------------------
+# make: *** No rule to make target 'checkout-ci-management-sub-modules', needed by 'lint-jjb'. Stop.
+# o jjb lint checking is only valid for ci-management repos.
+# o Enable (NO_LINT_JJB := true) in ${repo-root}/config.mk
+# -----------------------------------------------------------------------
+
+# [EOF]
diff --git a/makefiles/lint/json.mk b/makefiles/lint/json.mk
new file mode 100644
index 0000000..1deeaba
--- /dev/null
+++ b/makefiles/lint/json.mk
@@ -0,0 +1,92 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2017-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# 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.
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+##-------------------##
+##---] GLOBALS [---##
+##-------------------##
+.PHONY: lint-json lint-json-all lint-json-modified
+
+have-json-files := $(if $(strip $(JSON_FILES)),true)
+JSON_FILES ?= $(error JSON_FILES= required)
+
+## -----------------------------------------------------------------------
+## Intent: Use the json command to perform syntax checking.
+## o If UNSTABLE=1 syntax check all sources
+## o else only check sources modified by the developer.
+## Usage:
+## % make lint UNSTABLE=1
+## % make lint-json-all
+## -----------------------------------------------------------------------
+ifndef NO-LINT-JSON
+ lint-json-mode := $(if $(have-json-files),modified,all)
+ lint : lint-json-$(lint-json-mode)
+endif# NO-LINT-JSON
+
+## -----------------------------------------------------------------------
+## Intent: exhaustive json syntax checking
+## -----------------------------------------------------------------------
+json-find-args := $(null)
+json-find-args += -name '$(venv-name)'
+lint-json-all:
+ $(HIDE)$(MAKE) --no-print-directory lint-json-install
+
+ $(activate)\
+ && find . \( $(json-find-args) \) -prune -o -name '*.json' -print0 \
+ | $(xargs-n1) python -m json.tool > /dev/null ;\
+
+## -----------------------------------------------------------------------
+## Intent: check deps for format and python3 cleanliness
+## Note:
+## json --py3k option no longer supported
+## -----------------------------------------------------------------------
+lint-json-modified: $(venv-activate-script)
+ $(HIDE)$(MAKE) --no-print-directory lint-json-install
+
+ $(activate)\
+ && for jsonfile in $(JSON_FILES); do \
+ echo "Validating json file: $$jsonfile" ;\
+ python -m json.tool $$jsonfile > /dev/null ;\
+ done
+
+## -----------------------------------------------------------------------
+## Intent:
+## -----------------------------------------------------------------------
+.PHONY: lint-json-install
+lint-json-install: $(venv-activate-script)
+ @echo
+ @echo "** -----------------------------------------------------------------------"
+ @echo "** json syntax checking"
+ @echo "** -----------------------------------------------------------------------"
+# $(activate) && pip install --upgrade json.tool
+# $(activate) && python -m json.tool --version (?-howto-?)
+ @echo
+
+## -----------------------------------------------------------------------
+## Intent: Display command usage
+## -----------------------------------------------------------------------
+help::
+ @echo ' lint-json Syntax check python using the json command'
+ ifdef VERBOSE
+ @echo ' lint-json-all json checking: exhaustive'
+ @echo ' lint-json-modified json checking: only modified'
+ endif
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/lint/license/include.mk b/makefiles/lint/license/include.mk
new file mode 100644
index 0000000..2b42049
--- /dev/null
+++ b/makefiles/lint/license/include.mk
@@ -0,0 +1,41 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# 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.
+# -----------------------------------------------------------------------
+
+##-------------------##
+##---] GLOBALS [---##
+##-------------------##
+
+##-------------------##
+##---] TARGETS [---##
+##-------------------##
+ifndef NO-LINT-REUSE
+ lint : lint-license
+endif
+
+## -----------------------------------------------------------------------
+## Intent: Perform a lint check on makefile sources
+## -----------------------------------------------------------------------
+lint-license:
+ reuse --root . lint
+
+## -----------------------------------------------------------------------
+## Intent: Display command help
+## -----------------------------------------------------------------------
+help-summary ::
+ @echo ' lint-reuse License syntax checking'
+
+# [EOF]
diff --git a/makefiles/lint/license/reuse.mk b/makefiles/lint/license/reuse.mk
new file mode 100644
index 0000000..5572bef
--- /dev/null
+++ b/makefiles/lint/license/reuse.mk
@@ -0,0 +1,41 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# 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.
+# -----------------------------------------------------------------------
+
+##-------------------##
+##---] GLOBALS [---##
+##-------------------##
+
+##-------------------##
+##---] TARGETS [---##
+##-------------------##
+ifndef NO-LINT-REUSE
+ lint : lint-license
+endif
+
+## -----------------------------------------------------------------------
+## Intent: Perform a lint check on makefile sources
+## -----------------------------------------------------------------------
+lint-license:
+ reuse --root . lint
+
+## -----------------------------------------------------------------------
+## Intent: Display command help
+## -----------------------------------------------------------------------
+help-summary ::
+ @echo ' lint-reuse License syntax checking"
+
+# [EOF]
diff --git a/makefiles/lint/makefile.mk b/makefiles/lint/makefile.mk
index 522d027..27206e0 100644
--- a/makefiles/lint/makefile.mk
+++ b/makefiles/lint/makefile.mk
@@ -1,6 +1,18 @@
# -*- makefile -*-
# -----------------------------------------------------------------------
-# Copyright 2022 Open Networking Foundation (ONF) and the ONF Contributors
+# Copyright 2017-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# 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.
# -----------------------------------------------------------------------
##-------------------##
@@ -14,7 +26,8 @@
make-check-find += -o \( -iname makefile -o -name '*.mk' \)
make-check-find += -type f -print0
-make-check := $(env-clean) $(MAKE)
+make-check := $(MAKE)
+
make-check-args += --dry-run
make-check-args += --keep-going
make-check-args += --warn-undefined-variables
@@ -31,14 +44,22 @@
endif
## -----------------------------------------------------------------------
+## Intent: Perform a lint check on makefile sources
## -----------------------------------------------------------------------
+lint-make-ignore += JSON_FILES=
+lint-make-ignore += YAML_FILES=
lint-make:
+ @echo
+ @echo "** -----------------------------------------------------------------------"
+ @echo "** Makefile syntax checking"
+ @echo "** -----------------------------------------------------------------------"
$(HIDE)$(env-clean) $(make-check-find) \
- | $(xargs-n1-local) $(make-check) $(make-check-args)
+ | $(xargs-n1-local) $(make-check) $(make-check-args) $(lint-make-ignore)
## -----------------------------------------------------------------------
+## Intent: Display command help
## -----------------------------------------------------------------------
-help ::
- @echo ' lint-make Syntax check [Mm]akefile and *.mk'
+help-summary ::
+ @echo ' lint-make Syntax check [Mm]akefile and *.mk'
# [EOF]
diff --git a/makefiles/lint/python.mk b/makefiles/lint/python.mk
deleted file mode 100644
index 9252657..0000000
--- a/makefiles/lint/python.mk
+++ /dev/null
@@ -1,39 +0,0 @@
-# -*- makefile -*-
-# -----------------------------------------------------------------------
-# Copyright 2022 Open Networking Foundation (ONF) and the ONF Contributors
-# -----------------------------------------------------------------------
-
-##-------------------##
-##---] GLOBALS [---##
-##-------------------##
-
-# Gather sources to check
-# TODO: implement deps, only check modified files
-python-check-find := find . -name '*venv*' -prune\
- -o \( -name '*.py' \)\
- -type f -print0
-
-# python-check := $(env-clean) pylint
-python-check := pylint
-
-# python-check-args += --dry-run
-
-##-------------------##
-##---] TARGETS [---##
-##-------------------##
-ifndef NO-LINT-PYTHON
- lint : lint-python
-endif
-
-## -----------------------------------------------------------------------
-## -----------------------------------------------------------------------
-lint-python:
- $(HIDE)$(env-clean) $(python-check-find) \
- | $(xargs-n1) $(python-check) $(python-check-args)
-
-## -----------------------------------------------------------------------
-## -----------------------------------------------------------------------
-help ::
- @echo ' lint-python Syntax check python sources'
-
-# [EOF]
diff --git a/makefiles/lint/python/find_utils.mk b/makefiles/lint/python/find_utils.mk
new file mode 100644
index 0000000..7ab4c4f
--- /dev/null
+++ b/makefiles/lint/python/find_utils.mk
@@ -0,0 +1,32 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Intent:
+# o Construct a find command able to gather python files with filtering.
+# o Used by library makefiles flake8.mk and pylint.mk for iteration.
+# -----------------------------------------------------------------------
+
+## -----------------------------------------------------------------------
+## Intent: Construct a string for invoking find \( excl-pattern \) -prune
+# -----------------------------------------------------------------------
+gen-python-find-excl = \
+ $(strip \
+ -name '__ignored__' \
+ $(foreach dir,$($(1)),-o -name $(dir)) \
+ )
+
+## -----------------------------------------------------------------------
+## Intent: Construct a find command to gather a list of python files
+## with exclusions.
+## -----------------------------------------------------------------------
+## Usage:
+# $(activate) & $(call gen-python-find-cmd) | $(args-n1) pylint
+## -----------------------------------------------------------------------
+gen-python-find-cmd = \
+ $(strip \
+ find . \
+ \( $(call gen-python-find-excl,onf-excl-dirs) \) -prune \
+ -o -name '*.py' \
+ -print0 \
+ )
+
+# [EOF]
diff --git a/makefiles/lint/python/flake8.mk b/makefiles/lint/python/flake8.mk
new file mode 100644
index 0000000..decdfe3
--- /dev/null
+++ b/makefiles/lint/python/flake8.mk
@@ -0,0 +1,89 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2017-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# 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.
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+##-------------------##
+##---] GLOBALS [---##
+##-------------------##
+.PHONY: lint-flake8 lint-flake8-all lint-flake8-modified
+
+PYTHON_FILES ?= $(error PYTHON_FILES= required)
+
+## -----------------------------------------------------------------------
+## Intent: Use the flake8 command to perform syntax checking.
+## Usage:
+## % make lint
+## % make lint-flake8-all
+## -----------------------------------------------------------------------
+ifndef NO-LINT-FLAKE8
+ lint-flake8-mode := $(if $(have-python-files),modified,all)
+ lint : lint-flake8
+ lint-flake8 : lint-flake8-$(lint-flake8-mode)
+endif# NO-LINT-FLAKE8
+
+## -----------------------------------------------------------------------
+## Intent: exhaustive flake8 syntax checking
+## -----------------------------------------------------------------------
+lint-flake8-all: $(venv-activate-script)
+ $(call banner-enter,Target $@)
+ $(HIDE)$(MAKE) --no-print-directory lint-flake8-install
+
+ $(activate) && $(call gen-python-find-cmd) \
+ | $(xargs-n1) flake8 --max-line-length=99 --count
+ $(call banner-leave,Target $@)
+
+## -----------------------------------------------------------------------
+## Intent: check deps for format and python3 cleanliness
+## Note:
+## pylint --py3k option no longer supported
+## -----------------------------------------------------------------------
+lint-flake8-modified: $(venv-activate-script)
+ $(call banner-enter,Target $@)
+ $(HIDE)$(MAKE) --no-print-directory lint-flake8-install
+
+ $(activate) && flake8 --max-line-length=99 --count $(PYTHON_FILES)
+ $(call banner-leave,Target $@)
+
+## -----------------------------------------------------------------------
+## Intent: Install the flake8 tool for checking
+## Todo:
+## o Update to use file dependencies VS generic target always called
+## -----------------------------------------------------------------------
+.PHONY: lint-flake8-install
+lint-flake8-install: $(venv-activate-script)
+ $(call banner-enter,Target $@)
+ $(activate) && pip install --upgrade flake8
+ $(activate) && flake8 --version
+ $(call banner-leave,Target $@)
+ @echo
+
+## -----------------------------------------------------------------------
+## Intent: Display command usage
+## -----------------------------------------------------------------------
+help::
+ @echo ' lint-flake8 Syntax check python using the flake8 command'
+ ifdef VERBOSE
+ @echo ' $(MAKE) lint-pylint PYTHON_FILES=...'
+ @echo ' lint-flake8-modified flake8 checking: only modified'
+ @echo ' lint-flake8-all flake8 checking: exhaustive'
+ @echo ' lint-flake8-install Install the flake8 command'
+ endif
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/lint/yaml/yamllint.helm b/makefiles/lint/python/include.mk
similarity index 62%
copy from makefiles/lint/yaml/yamllint.helm
copy to makefiles/lint/python/include.mk
index 6c7787b..ce7d7af 100644
--- a/makefiles/lint/yaml/yamllint.helm
+++ b/makefiles/lint/python/include.mk
@@ -1,6 +1,6 @@
# -*- makefile -*-
# -----------------------------------------------------------------------
-# Copyright 2022 Open Networking Foundation (ONF) and the ONF Contributors
+# Copyright 2017-2023 Open Networking Foundation (ONF) and the ONF Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -13,20 +13,19 @@
# 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.
-#
-# SPDX-FileCopyrightText: 2022 Open Networking Foundation (ONF) and the ONF Contributors
-# SPDX-License-Identifier: Apache-2.0
# -----------------------------------------------------------------------
----
-# yamllint.conf
-extends: default
+$(if $(DEBUG),$(warning ENTER))
-rules:
- empty-lines:
- max-end: 1
- line-length:
- max: 120
- braces:
- min-spaces-inside: 0
- max-spaces-inside: 1
+##-------------------##
+##---] GLOBALS [---##
+##-------------------##
+$(if $(UNSTABLE),$(eval lint-python-all := true))
+
+include $(ONF_MAKEDIR)/lint/python/find_utils.mk
+include $(ONF_MAKEDIR)/lint/python/flake8.mk
+include $(ONF_MAKEDIR)/lint/python/pylint.mk
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/lint/python/pylint.mk b/makefiles/lint/python/pylint.mk
new file mode 100644
index 0000000..489c347
--- /dev/null
+++ b/makefiles/lint/python/pylint.mk
@@ -0,0 +1,91 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2017-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# 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.
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+##-------------------##
+##---] GLOBALS [---##
+##-------------------##
+.PHONY: lint-pylint lint-pylint-all lint-pylint-modified
+
+PYTHON_FILES ?= $(error PYTHON_FILES= required)
+
+## -----------------------------------------------------------------------
+## Intent: Use the pylint command to perform syntax checking.
+## o If UNSTABLE=1 syntax check all sources
+## o else only check sources modified by the developer.
+## Usage:
+## % make lint UNSTABLE=1
+## % make lint-pylint-all
+## -----------------------------------------------------------------------
+ifndef NO-LINT-PYLINT
+ lint-pylint-mode := $(if $(have-python-files),modified,all)
+ lint : lint-pylint
+ lint-pylint : lint-pylint-$(lint-pylint-mode)
+endif# NO-LINT-PYLINT
+
+## -----------------------------------------------------------------------
+## Intent: exhaustive pylint syntax checking
+## -----------------------------------------------------------------------
+lint-pylint-all: $(venv-activate-script)
+ $(call banner-enter,Target $@)
+ $(MAKE) --no-print-directory lint-pylint-install
+
+ $(activate) && $(call gen-python-find-cmd) | $(xargs-n1) pylint
+ $(call banner-leave,Target $@)
+
+## -----------------------------------------------------------------------
+## Intent: check deps for format and python3 cleanliness
+## Note:
+## pylint --py3k option no longer supported
+## -----------------------------------------------------------------------
+lint-pylint-modified: $(venv-activate-script)
+ $(call banner-enter,Target $@)
+ $(MAKE) --no-print-directory lint-pylint-install
+
+ $(activate) && pylint $(PYTHON_FILES)
+ $(call banner-leave,Target $@)
+
+## -----------------------------------------------------------------------
+## Intent: Install the pylint tool for checking
+## Todo:
+## o Update to use file dependencies VS generic target always called
+## -----------------------------------------------------------------------
+.PHONY: lint-pylint-install
+lint-pylint-install: $(venv-activate-script)
+
+ $(call banner-enter,Target $@)
+ $(activate) && pip install --upgrade pylint
+ $(activate) && pylint --version
+ $(call banner-leave,Target $@)
+ @echo
+
+## -----------------------------------------------------------------------
+## Intent: Display command usage
+## -----------------------------------------------------------------------
+help::
+ @echo ' lint-pylint Syntax check python using the pylint command'
+ ifdef VERBOSE
+ @echo ' $(MAKE) lint-pylint PYTHON_FILES=...'
+ @echo ' lint-pylint-modified pylint checking: only modified'
+ @echo ' lint-pylint-all pylint checking: exhaustive'
+ @echo ' lint-pylint-install Install the pylint command'
+ endif
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/lint/robot.mk b/makefiles/lint/robot.mk
new file mode 100644
index 0000000..f33c4ba
--- /dev/null
+++ b/makefiles/lint/robot.mk
@@ -0,0 +1,43 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2017-2023 Open Networking Foundation
+#
+# 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.
+# -----------------------------------------------------------------------
+
+ROBOT_FILES ?= $(error ROBOT_FILES= is required)
+
+LINT_ARGS ?= --verbose --configure LineTooLong:130 -e LineTooLong \
+ --configure TooManyTestSteps:65 -e TooManyTestSteps \
+ --configure TooManyTestCases:50 -e TooManyTestCases \
+ --configure TooFewTestSteps:1 \
+ --configure TooFewKeywordSteps:1 \
+ --configure FileTooLong:2000 -e FileTooLong \
+ -e TrailingWhitespace
+
+
+.PHONY: lint-robot
+
+ifndef NO-LINT-ROBOT
+ lint : lint-robot
+endif
+
+lint-robot: vst_venv
+ source ./$</bin/activate \
+ ; set -u \
+ ; rflint $(LINT_ARGS) $(ROBOT_FILES)
+
+help::
+ @echo " lint-robot Syntax check robot sources using rflint"
+
+# [EOF]
diff --git a/makefiles/lint/shell.mk b/makefiles/lint/shell.mk
deleted file mode 100644
index cadc084..0000000
--- a/makefiles/lint/shell.mk
+++ /dev/null
@@ -1,43 +0,0 @@
-# -*- makefile -*-
-# -----------------------------------------------------------------------
-# Copyright 2022 Open Networking Foundation (ONF) and the ONF Contributors
-# -----------------------------------------------------------------------
-
-##-------------------##
-##---] GLOBALS [---##
-##-------------------##
-
-# Gather sources to check
-# TODO: implement deps, only check modified files
-shell-check-find := find .
-# vendor scripts but they really should be lintable
-shell-check-find += -name 'vendor' -prune
-shell-check-find += -o \( -name '*.sh' \)
-shell-check-find += -type f -print0
-
-# shell-check := $(env-clean) pylint
-shell-check := shellcheck
-
-shell-check-args += -a
-
-##-------------------##
-##---] TARGETS [---##
-##-------------------##
-ifndef NO-LINT-SHELL
- lint : lint-shell
-endif
-
-## -----------------------------------------------------------------------
-## -----------------------------------------------------------------------
-lint-shell:
- $(shell-check) -V
- @echo
- $(HIDE)$(env-clean) $(shell-check-find) \
- | $(xargs-n1) $(shell-check) $(shell-check-args)
-
-## -----------------------------------------------------------------------
-## -----------------------------------------------------------------------
-help ::
- @echo ' lint-shell Syntax check shell sources'
-
-# [EOF]
diff --git a/makefiles/lint/shellcheck/find_utils.mk b/makefiles/lint/shellcheck/find_utils.mk
new file mode 100644
index 0000000..0ea4e5d
--- /dev/null
+++ b/makefiles/lint/shellcheck/find_utils.mk
@@ -0,0 +1,31 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Intent:
+# o Construct a find command able to gather shell files for checking.
+# -----------------------------------------------------------------------
+
+## -----------------------------------------------------------------------
+## Intent: Construct a string for invoking find \( excl-pattern \) -prune
+# -----------------------------------------------------------------------
+gen-shellcheck-find-excl = \
+ $(strip \
+ -name '__ignored__' \
+ $(foreach dir,$($(1)),-o -name $(dir)) \
+ )
+
+## -----------------------------------------------------------------------
+## Intent: Construct a find command to gather a list of python files
+## with exclusions.
+## -----------------------------------------------------------------------
+## Usage:
+# $(activate) & $(call gen-python-find-cmd) | $(args-n1) pylint
+## -----------------------------------------------------------------------
+gen-shellcheck-find-cmd = \
+ $(strip \
+ find . \
+ \( $(call gen-shellcheck-find-excl,onf-excl-dirs) \) -prune \
+ -o \( -iname '*.sh' \) \
+ -print0 \
+ )
+
+# [EOF]
diff --git a/makefiles/lint/shellcheck/include.mk b/makefiles/lint/shellcheck/include.mk
new file mode 100644
index 0000000..2b8c6c6
--- /dev/null
+++ b/makefiles/lint/shellcheck/include.mk
@@ -0,0 +1,37 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2017-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# 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.
+# -----------------------------------------------------------------------
+
+ifndef mk-include--onf-lint-shellcheck # single-include guard macro
+
+$(if $(DEBUG),$(warning ENTER))
+
+##--------------------##
+##---] INCLUDES [---##
+##--------------------##
+# include $(ONF_MAKEDIR)/lint/shellcheck/help.mk
+include $(ONF_MAKEDIR)/lint/shellcheck/find_utils.mk
+
+# Standard lint-yaml targets
+include $(ONF_MAKEDIR)/lint/shellcheck/shellcheck.mk
+
+mk-include--onf-lint-shellcheck := true# # Flag to inhibit re-including
+
+$(if $(DEBUG),$(warning LEAVE))
+
+endif # mk-include--onf-lint-shellcheck
+
+# [EOF]
diff --git a/makefiles/lint/shellcheck/shellcheck.mk b/makefiles/lint/shellcheck/shellcheck.mk
new file mode 100644
index 0000000..5c466e4
--- /dev/null
+++ b/makefiles/lint/shellcheck/shellcheck.mk
@@ -0,0 +1,68 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# 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.
+# -----------------------------------------------------------------------
+# https://gerrit.opencord.org/plugins/gitiles/onf-make
+# ONF.makefile.version = 1.0
+# -----------------------------------------------------------------------
+
+##-------------------##
+##---] GLOBALS [---##
+##-------------------##
+
+shell-check := $(env-clean) shellcheck
+
+shell-check-args += --check-sourced
+shell-check-args += --external-sources
+
+##-------------------##
+##---] TARGETS [---##
+##-------------------##
+ifndef NO-LINT-SHELLCHECK
+ lint : lint-shellcheck
+endif
+
+## -----------------------------------------------------------------------
+## Intent: Perform a lint check on command line script sources
+## -----------------------------------------------------------------------
+lint-shellcheck: # shellcheck-version
+
+ $(call banner-enter,Target $@)
+ $(call gen-shellcheck-find-cmd) \
+ | $(xargs-cmd-clean) -I'{}' \
+ bash -c "$(shell-check) $(shell-check-args) {}"
+ $(call banner-leave,Target $@)
+
+## -----------------------------------------------------------------------
+## Intent: Display yamllint command version string.
+## Note: As a side effect, install yamllint by dependency
+## -----------------------------------------------------------------------
+.PHONY: shellcheck-cmd-version
+shellcheck-cmd-version :
+
+ @echo
+ $(shell-check) -V
+
+## -----------------------------------------------------------------------
+## Intent: Display command help
+## -----------------------------------------------------------------------
+help-summary ::
+ @echo ' lint-shellcheck Syntax check shell sources'
+
+# [SEE ALSO]
+# -----------------------------------------------------------------------
+# o https://www.shellcheck.net/wiki/Directive
+
+# [EOF]
diff --git a/makefiles/lint/yaml/yamllint.helm b/makefiles/lint/tox/include.mk
similarity index 69%
copy from makefiles/lint/yaml/yamllint.helm
copy to makefiles/lint/tox/include.mk
index 6c7787b..7d7cf3e 100644
--- a/makefiles/lint/yaml/yamllint.helm
+++ b/makefiles/lint/tox/include.mk
@@ -1,6 +1,6 @@
# -*- makefile -*-
# -----------------------------------------------------------------------
-# Copyright 2022 Open Networking Foundation (ONF) and the ONF Contributors
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -14,19 +14,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-# SPDX-FileCopyrightText: 2022 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-FileCopyrightText: 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
# SPDX-License-Identifier: Apache-2.0
# -----------------------------------------------------------------------
----
-# yamllint.conf
-extends: default
+$(if $(DEBUG),$(warning ENTER))
-rules:
- empty-lines:
- max-end: 1
- line-length:
- max: 120
- braces:
- min-spaces-inside: 0
- max-spaces-inside: 1
+include $(ONF_MAKEDIR)/lint/tox/tox.mk
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/lint/tox/tox.mk b/makefiles/lint/tox/tox.mk
new file mode 100644
index 0000000..35cec00
--- /dev/null
+++ b/makefiles/lint/tox/tox.mk
@@ -0,0 +1,91 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# 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.
+#
+# SPDX-FileCopyrightText: 2022 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+##-------------------##
+##---] GLOBALS [---##
+##-------------------##
+.PHONY: lint-tox lint-tox-all lint-tox-modified
+
+PYTHON_FILES ?= $(error PYTHON_FILES= required)
+
+## -----------------------------------------------------------------------
+## Intent: Sanity check incoming JJB config changes.
+## Todo: Depend on makefiles/lint/jjb.mk :: lint-jjb
+## -----------------------------------------------------------------------
+ifndef NO-LINT-TOX
+ lint-tox-mode := $(if $(have-python-files),modified,all)
+ lint : lint-tox
+ lint-tox : lint-tox-$(lint-tox-mode)
+endif# NO-LINT-TOX
+
+## -----------------------------------------------------------------------
+## Intent: Invoke tox on all sources
+## -----------------------------------------------------------------------
+lint-tox-all: $(venv-activate-script)
+ $(MAKE) --no-print-directory lint-tox-install
+
+ $(activate) && tox -e py310
+
+## -----------------------------------------------------------------------
+## Intent: Invoke tox on modified sources (target is mainly for consistency)
+## -----------------------------------------------------------------------
+lint-tox-modified: $(venv-activate-script)
+ $(MAKE) --no-print-directory lint-tox-install
+
+ $(activate) && tox -e py310 $(PYTHON_FILES)
+
+## -----------------------------------------------------------------------
+## Intent: https://tox.wiki/en/4.6.4/installation.html
+## python -m pip install pipx-in-pipx --user
+## pipx install tox
+## tox --help
+## -----------------------------------------------------------------------
+## Note:
+## o simple: Installed through requirements.txt
+## o This target can make usage on-demand.
+## -----------------------------------------------------------------------
+.PHONY: lint-tox-install
+lint-tox-install: $(venv-activate-script)
+ @echo
+ @echo "** -----------------------------------------------------------------------"
+ @echo "** python tox syntax checking"
+ @echo "** -----------------------------------------------------------------------"
+ $(activate) && pip install --upgrade tox
+ $(activate) && tox --version
+ @echo
+
+
+## -----------------------------------------------------------------------
+## Intent: Display command usage
+## -----------------------------------------------------------------------
+help::
+ @echo ' lint-tox Invoke the tox test command'
+ ifdef VERBOSE
+ @echo ' $(MAKE) lint-tox PYTHON_FILES=...'
+ @echo ' lint-tox-modified tox checking: only modified'
+ @echo ' lint-tox-all tox checking: exhaustive'
+ @echo ' lint-tox-install Install the tox command'
+ endif
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/lint/urls b/makefiles/lint/urls
new file mode 100644
index 0000000..5694a1b
--- /dev/null
+++ b/makefiles/lint/urls
@@ -0,0 +1,5 @@
+# -*- makefile -*-
+
+https://www.shellcheck.net/wiki/Directive
+
+# [EOF]
\ No newline at end of file
diff --git a/makefiles/lint/yaml/.yamllint b/makefiles/lint/yaml/.yamllint
index 6a4fc1e..c42c6d5 100644
--- a/makefiles/lint/yaml/.yamllint
+++ b/makefiles/lint/yaml/.yamllint
@@ -1,6 +1,6 @@
# -*- makefile -*-
# -----------------------------------------------------------------------
-# Copyright 2022 Open Networking Foundation (ONF) and the ONF Contributors
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
diff --git a/makefiles/lint/yaml/yamllint.helm b/makefiles/lint/yaml/byrepo/voltha-lib-go/include.mk
similarity index 66%
copy from makefiles/lint/yaml/yamllint.helm
copy to makefiles/lint/yaml/byrepo/voltha-lib-go/include.mk
index 6c7787b..6cbd0ea 100644
--- a/makefiles/lint/yaml/yamllint.helm
+++ b/makefiles/lint/yaml/byrepo/voltha-lib-go/include.mk
@@ -1,6 +1,6 @@
# -*- makefile -*-
# -----------------------------------------------------------------------
-# Copyright 2022 Open Networking Foundation (ONF) and the ONF Contributors
+# Copyright 2023 Open Networking Foundation (ONF) and the ONF Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -13,20 +13,15 @@
# 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.
-#
-# SPDX-FileCopyrightText: 2022 Open Networking Foundation (ONF) and the ONF Contributors
-# SPDX-License-Identifier: Apache-2.0
# -----------------------------------------------------------------------
----
-# yamllint.conf
-extends: default
+$(if $(DEBUG),$(warning ENTER))
-rules:
- empty-lines:
- max-end: 1
- line-length:
- max: 120
- braces:
- min-spaces-inside: 0
- max-spaces-inside: 1
+##--------------------##
+##---] INCLUDES [---##
+##--------------------##
+include $(ONF_MAKEDIR)/lint/yaml/byrepo/$(--repo-name--)/yamllint.mk
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/lint/yaml/python.mk b/makefiles/lint/yaml/byrepo/voltha-lib-go/python.mk
similarity index 93%
rename from makefiles/lint/yaml/python.mk
rename to makefiles/lint/yaml/byrepo/voltha-lib-go/python.mk
index 868d9b7..cf0eef5 100644
--- a/makefiles/lint/yaml/python.mk
+++ b/makefiles/lint/yaml/byrepo/voltha-lib-go/python.mk
@@ -1,6 +1,6 @@
# -*- makefile -*-
# -----------------------------------------------------------------------
-# Copyright 2022 Open Networking Foundation (ONF) and the ONF Contributors
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
diff --git a/makefiles/lint/yaml/byrepo/voltha-lib-go/repo b/makefiles/lint/yaml/byrepo/voltha-lib-go/repo
new file mode 100644
index 0000000..99e8451
--- /dev/null
+++ b/makefiles/lint/yaml/byrepo/voltha-lib-go/repo
@@ -0,0 +1 @@
+Source from voltha-lib-go
\ No newline at end of file
diff --git a/makefiles/lint/yaml/todo b/makefiles/lint/yaml/byrepo/voltha-lib-go/todo
similarity index 93%
rename from makefiles/lint/yaml/todo
rename to makefiles/lint/yaml/byrepo/voltha-lib-go/todo
index 8a9367b..8400c64 100644
--- a/makefiles/lint/yaml/todo
+++ b/makefiles/lint/yaml/byrepo/voltha-lib-go/todo
@@ -1,6 +1,6 @@
# -*- makefile -*-
# -----------------------------------------------------------------------
-# Copyright 2022 Open Networking Foundation (ONF) and the ONF Contributors
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
# -----------------------------------------------------------------------
##-------------------##
diff --git a/makefiles/lint/yaml/urls b/makefiles/lint/yaml/byrepo/voltha-lib-go/urls
similarity index 100%
rename from makefiles/lint/yaml/urls
rename to makefiles/lint/yaml/byrepo/voltha-lib-go/urls
diff --git a/makefiles/lint/yaml/yamllint.helm b/makefiles/lint/yaml/byrepo/voltha-lib-go/yamllint.helm
similarity index 92%
rename from makefiles/lint/yaml/yamllint.helm
rename to makefiles/lint/yaml/byrepo/voltha-lib-go/yamllint.helm
index 6c7787b..bf1d2b9 100644
--- a/makefiles/lint/yaml/yamllint.helm
+++ b/makefiles/lint/yaml/byrepo/voltha-lib-go/yamllint.helm
@@ -1,6 +1,6 @@
# -*- makefile -*-
# -----------------------------------------------------------------------
-# Copyright 2022 Open Networking Foundation (ONF) and the ONF Contributors
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
diff --git a/makefiles/lint/yaml/byrepo/voltha-lib-go/yamllint.mk b/makefiles/lint/yaml/byrepo/voltha-lib-go/yamllint.mk
new file mode 100644
index 0000000..fb56e3a
--- /dev/null
+++ b/makefiles/lint/yaml/byrepo/voltha-lib-go/yamllint.mk
@@ -0,0 +1,72 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# 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.
+#
+# SPDX-FileCopyrightText: 2022 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+--onf-mk-lint-yaml-- := true# # Inhibit loading downstream lint-yaml targets
+
+# yamllint := $(env-clean) yamllint
+# yamllint := $(activate) && yamllint
+
+YAMLLINT = $(activate) && yamllint
+
+## -------------------------------
+## Add requirement(s) for checking
+## -------------------------------
+yamllint-cfg := yamllint.helm
+yamllint-conf = $(wildcard $(yamllint-cfg) $(ONF_MAKEDIR)/lint/yaml/$(yamllint-cfg))
+yamllint-args += $(addprefix --config-file$(space),$(yamllint-conf))
+yamllint-args += --strict
+
+## -----------------------------------------------------------------------
+## Intent: Use the yaml command to perform syntax checking.
+## -----------------------------------------------------------------------
+ifndef NO-LINT-YAML
+ # lint-yaml-mode := $(if $(have-yaml-files),modified,all)
+ lint : lint-yaml
+ lint-yaml : lint-yaml-votlha-lib-go
+# lint-yaml : lint-yaml-all-votlha-lib-go-$(lint-yaml-mode)
+endif# NO-LINT-YAML
+
+## -----------------------------------------------------------------------
+## ----------------------------------------------------------------------
+lint-yaml-votlha-lib-go: lint-yaml-cmd-version
+
+ $(call banner-enter,Target $@)
+ $(HIDE)$(MAKE) --no-print-directory lint-yaml-install
+
+ $(HIDE)$(env-clean) $(call gen-yaml-find-cmd) \
+ | $(env-clean) $(xargs-cmd) -I'{}' \
+ bash -c "$(YAMLLINT) $(yamllint-args) {}"
+ $(call banner-leave,Target $@)
+
+## -----------------------------------------------------------------------
+## Intent: Display command usage
+## -----------------------------------------------------------------------
+help::
+ # lint-yaml help already displayed by lint/yaml/help.mk
+ ifdef VERBOSE
+ @echo ' $(MAKE) lint-yaml YAML_FILES=...'
+ @echo ' lint-yaml-votlha-lib-go lint-yaml for repo:voltha-lib-go'
+ endif
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/lint/yaml/find_utils.mk b/makefiles/lint/yaml/find_utils.mk
new file mode 100644
index 0000000..49d4cb0
--- /dev/null
+++ b/makefiles/lint/yaml/find_utils.mk
@@ -0,0 +1,32 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Intent:
+# o Construct a find command able to gather python files with filtering.
+# o Used by library makefiles flake8.mk and pylint.mk for iteration.
+# -----------------------------------------------------------------------
+
+## -----------------------------------------------------------------------
+## Intent: Construct a string for invoking find \( excl-pattern \) -prune
+# -----------------------------------------------------------------------
+gen-yaml-find-excl = \
+ $(strip \
+ -name '__ignored__' \
+ $(foreach dir,$($(1)),-o -name $(dir)) \
+ )
+
+## -----------------------------------------------------------------------
+## Intent: Construct a find command to gather a list of python files
+## with exclusions.
+## -----------------------------------------------------------------------
+## Usage:
+# $(activate) & $(call gen-python-find-cmd) | $(args-n1) pylint
+## -----------------------------------------------------------------------
+gen-yaml-find-cmd = \
+ $(strip \
+ find . \
+ \( $(call gen-yaml-find-excl,onf-excl-dirs) \) -prune \
+ -o \( -iname '*.yaml' -o -iname '*.yml' \) \
+ -print0 \
+ )
+
+# [EOF]
diff --git a/makefiles/lint/yaml/help.mk b/makefiles/lint/yaml/help.mk
new file mode 100644
index 0000000..ef8621e
--- /dev/null
+++ b/makefiles/lint/yaml/help.mk
@@ -0,0 +1,41 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2017-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# 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.
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+## ---------------------------------------------------------------------------
+## Intent: Display a help banner early so includes below that also define
+## help targets will be displayed beneath a high level banner.
+## ---------------------------------------------------------------------------
+help ::
+ ifndef VERBOSE
+ @echo ' lint-yaml Invoke all yaml linting targets'
+ else
+ $(HIDE)$(MAKE) --no-print-directory help-lint-yaml
+ endif
+
+## ---------------------------------------------------------------------------
+## Intent: Display extended target help
+## ---------------------------------------------------------------------------
+help-lint-yaml:
+ @echo
+ @echo '[LINT: yaml] (make lint-yaml VERBOSE=1)'
+ @echo ' lint-yaml Invoke all yaml linting targets'
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/lint/yaml/include.mk b/makefiles/lint/yaml/include.mk
new file mode 100644
index 0000000..26c4a7f
--- /dev/null
+++ b/makefiles/lint/yaml/include.mk
@@ -0,0 +1,42 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2017-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# 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.
+# -----------------------------------------------------------------------
+
+ifndef --onf-mk-lint-yaml--
+
+$(if $(DEBUG),$(warning ENTER))
+
+##--------------------##
+##---] INCLUDES [---##
+##--------------------##
+include $(ONF_MAKEDIR)/lint/yaml/help.mk
+include $(ONF_MAKEDIR)/lint/yaml/find_utils.mk
+include $(ONF_MAKEDIR)/lint/yaml/install.mk
+
+# [TODO] Consolidate and refactor to support a simpler answer
+# Special snowflake linting requirements
+-include $(ONF_MAKEDIR)/lint/yaml/byrepo/$(--repo-name--)/include.mk
+
+# Standard lint-yaml targets
+include $(ONF_MAKEDIR)/lint/yaml/yamllint.mk
+
+--onf-mk-lint-yaml-- := true# # Flag to inhibit re-including
+
+$(if $(DEBUG),$(warning LEAVE))
+
+endif # --onf-mk-lint-yaml--
+
+# [EOF]
diff --git a/makefiles/lint/yaml/install.mk b/makefiles/lint/yaml/install.mk
new file mode 100644
index 0000000..62b777d
--- /dev/null
+++ b/makefiles/lint/yaml/install.mk
@@ -0,0 +1,73 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# 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.
+#
+# SPDX-FileCopyrightText: 2022 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+## -----------------------------------------------------------------------
+## Intent: Install the yamllint tool
+## -----------------------------------------------------------------------
+.PHONY: lint-yaml-install
+
+# -----------------------------------------------------------------------
+# We can(/should?) define a command macro
+# wait a bit until use cases are better known.
+# Initial use required inserting xargs bash -c "$(YAMLLINT) {}"
+# -----------------------------------------------------------------------
+# YAMLLINT ?= $(venv-activate-bin)/yamllint
+# YAMLLINT ?= $(activate) && yamllint
+
+## -----------------------------------------------------------------------
+## Intent: Display yamllint command version string.
+## Note: As a side effect, install yamllint by dependency
+## -----------------------------------------------------------------------
+.PHONY: lint-yaml-cmd-version
+lint-yaml-cmd-version : $(venv-activate-bin)/yamllint
+
+ $(HIDE) echo
+ $< --version
+
+## -----------------------------------------------------------------------
+## Intent: On-demand instalation of the yamllint command
+## -----------------------------------------------------------------------
+lint-yaml-install := $(venv-activate-bin)/yamllint
+$(lint-yaml-install) : $(venv-activate-script)
+
+ $(call banner-enter,Target $@)
+ $(activate) && pip install yamllint
+ $(call banner-leave,Target $@)
+
+## -----------------------------------------------------------------------
+## Intent: Purge yamllint tool installation
+## -----------------------------------------------------------------------
+sterile ::
+ $(HIDE)$(RM) "$(venv-abs-bin)/yamllint"
+ $(HIDE)$(RM) -r .venv/lib/*/site-packages/yamllint
+
+ # Remove both file:command and dir:libraries
+ # find "$(venv-abs-path)" -iname 'yamllint' -print0 \
+ # | $(xargs-n1-clean) $(RM) -r {}
+
+## -----------------------------------------------------------------------
+## Intent: Display command usage
+## -----------------------------------------------------------------------
+help::
+ @echo ' lint-yaml-install Install the yamllint tool'
+
+# [EOF]
diff --git a/makefiles/lint/yaml/yamllint.mk b/makefiles/lint/yaml/yamllint.mk
index 9556a45..1563c7c 100644
--- a/makefiles/lint/yaml/yamllint.mk
+++ b/makefiles/lint/yaml/yamllint.mk
@@ -1,8 +1,8 @@
# -*- makefile -*-
# -----------------------------------------------------------------------
-# Copyright 2022 Open Networking Foundation (ONF) and the ONF Contributors
+# Copyright 2017-2023 Open Networking Foundation (ONF) and the ONF Contributors
#
-# Licensed under the Apache License, Version 2.0 (the "License");
+# 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
#
@@ -13,41 +13,66 @@
# 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.
-#
-# SPDX-FileCopyrightText: 2022 Open Networking Foundation (ONF) and the ONF Contributors
-# SPDX-License-Identifier: Apache-2.0
# -----------------------------------------------------------------------
$(if $(DEBUG),$(warning ENTER))
-yamllint := $(env-clean) yamllint
+##-------------------##
+##---] GLOBALS [---##
+##-------------------##
+.PHONY: lint-yaml lint-yaml-all lint-yaml-modified
-## -------------------------------
-## Add requirement(s) for checking
-## -------------------------------
-# yamllint-cfg := .yamllint
-yamllint-cfg := yamllint.helm
-yamllint-conf = $(wildcard $(yamllint-cfg) $(MAKEDIR)/lint/yaml/$(yamllint-cfg))
-yamllint-args += $(addprefix --config-file$(space),$(yamllint-conf))
+have-yaml-files := $(if $(strip $(YAML_FILES)),true)
+YAML_FILES ?= $(error YAML_FILES= is required)
-# yamllint-args := --no-warnings
-# yamllint-args := --strict
-
-yamllint-find := find . -name 'vendor' -prune
-yamllint-find += -o -name '*.yaml' -type f
-yamllint-find += -print0
+YAMLLINT = $(activate) && yamllint
+yamllint-args += --strict
## -----------------------------------------------------------------------
+## Intent: Use the yaml command to perform syntax checking.
## -----------------------------------------------------------------------
-lint lint-yaml:
- $(HIDE)$(env-clean) $(yamllint-find) \
- | xargs -0 --no-run-if-empty -t -n1 $(yamllint) $(yamllint-args)
+ifndef NO-LINT-YAML
+ lint-yaml-mode := $(if $(have-yaml-files),modified,all)
+ lint : lint-yaml
+ lint-yaml : lint-yaml-$(lint-yaml-mode)
+endif# NO-LINT-YAML
## -----------------------------------------------------------------------
+## Intent: exhaustive yaml syntax checking
+## -----------------------------------------------------------------------
+lint-yaml-all: lint-yaml-cmd-version
+
+ $(call banner-enter,Target $@)
+ $(HIDE)$(MAKE) --no-print-directory lint-yaml-install
+ $(HIDE)$(activate) && $(call gen-yaml-find-cmd) \
+ | $(env-clean) $(xargs-cmd) -I'{}' \
+ bash -c "$(YAMLLINT) $(yamllint-args) {}"
+ $(call banner-leave,Target $@)
+
+## -----------------------------------------------------------------------
+## Intent: check deps for format and python3 cleanliness
+## Note:
+## yaml --py3k option no longer supported
+## -----------------------------------------------------------------------
+lint-yaml-modified: lint-yaml-cmd-version
+
+ $(call banner-enter,Target $@)
+ $(HIDE)$(MAKE) --no-print-directory lint-yaml-install
+ $(YAMLLINT) $(yamllint-args) $(YAML_FILES)
+ $(call banner-leave,Target $@)
+
+## -----------------------------------------------------------------------
+## Intent: Display command usage
## -----------------------------------------------------------------------
help::
- @echo " lint-yaml Syntax check yaml sources"
+ @echo ' lint-yaml Syntax check python using the yaml command'
+ ifdef VERBOSE
+ @echo ' $(MAKE) lint-yaml YAML_FILES=...'
+ @echo ' lint-yaml-all yaml checking: exhaustive'
+ @echo ' lint-yaml-modified yaml checking: only locally modified'
+ @echo ' lint-yaml-install Install the pylint command'
+ endif
-$(if $(DEBUG),$(warning ENTER))
+$(if $(DEBUG),$(warning LEAVE))
# [EOF]
diff --git a/makefiles/python/include.mk b/makefiles/python/include.mk
index 24f3426..f46aea0 100644
--- a/makefiles/python/include.mk
+++ b/makefiles/python/include.mk
@@ -1,6 +1,6 @@
# -*- makefile -*-
# -----------------------------------------------------------------------
-# Copyright 2022 Open Networking Foundation (ONF) and the ONF Contributors
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -14,14 +14,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-# SPDX-FileCopyrightText: 2022 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-FileCopyrightText: 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
# SPDX-License-Identifier: Apache-2.0
# -----------------------------------------------------------------------
ifdef PYTHON_FILES
- include $(ONF_MAKE)/python/test/include.mk
+ include $(ONF_MAKEDIR)/python/test/include.mk
else
- include $(ONF_MAKE)/python/test/include.mk
+ include $(ONF_MAKEDIR)/python/test/include.mk
endif
# [EOF]
diff --git a/makefiles/python/test/include.mk b/makefiles/python/test/include.mk
index 12afc3e..026fe68 100644
--- a/makefiles/python/test/include.mk
+++ b/makefiles/python/test/include.mk
@@ -1,6 +1,6 @@
# -*- makefile -*-
# -----------------------------------------------------------------------
-# Copyright 2022 Open Networking Foundation (ONF) and the ONF Contributors
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-# SPDX-FileCopyrightText: 2022 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-FileCopyrightText: 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
# SPDX-License-Identifier: Apache-2.0
# -----------------------------------------------------------------------
diff --git a/makefiles/targets/check.mk b/makefiles/targets/check.mk
new file mode 100644
index 0000000..aa1b0d0
--- /dev/null
+++ b/makefiles/targets/check.mk
@@ -0,0 +1,38 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# 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.
+#
+# SPDX-FileCopyrightText: 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+.PHONY: check
+check : lint lint-yaml lint-jjb
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+help-verbose += help-check
+help-check ::
+ @echo
+ @echo '[MAKE: check]'
+ @echo ' check pre-commit checking, with extra targets (default:NO, jenkins:FAIL)'
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/targets/clean.mk b/makefiles/targets/clean.mk
new file mode 100644
index 0000000..f787e5c
--- /dev/null
+++ b/makefiles/targets/clean.mk
@@ -0,0 +1,40 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# 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.
+#
+# SPDX-FileCopyrightText: 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+## -----------------------------------------------------------------------
+## Intent: Remove makefile generated content
+## -----------------------------------------------------------------------
+.PHONY: clean
+clean ::
+ $(RM) -r $(JOBCONFIG_DIR)
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+help-verbose += help-clean
+help-clean ::
+ @echo
+ @echo '[MAKE: clean]'
+ @echo ' clean Remove makefile generated content'
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/targets/include.mk b/makefiles/targets/include.mk
new file mode 100644
index 0000000..20e1bf5
--- /dev/null
+++ b/makefiles/targets/include.mk
@@ -0,0 +1,36 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# 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.
+#
+# SPDX-FileCopyrightText: 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+# https://gerrit.opencord.org/plugins/gitiles/onf-make
+# ONF.makefile.version = 1.0
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+##-------------------##
+##---] TARGETS [---##
+##-------------------##
+include $(ONF_MAKEDIR)/targets/clean.mk
+include $(ONF_MAKEDIR)/targets/check.mk
+include $(ONF_MAKEDIR)/targets/sterile.mk
+include $(ONF_MAKEDIR)/targets/test/include.mk
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/targets/sterile.mk b/makefiles/targets/sterile.mk
new file mode 100644
index 0000000..c661f53
--- /dev/null
+++ b/makefiles/targets/sterile.mk
@@ -0,0 +1,45 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# 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.
+#
+# SPDX-FileCopyrightText: 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+## -----------------------------------------------------------------------
+## Intent: Revert sandbox into a pristine checkout stage
+## -----------------------------------------------------------------------
+## Note: Sterile target behavior differs from clean around handling of
+## persistent content. For ex removal of a python virtualenv adds
+## extra overhead to development iteration:
+## make clean - preserve a virtual env
+## make sterile - force reinstallation
+## -----------------------------------------------------------------------
+.PHONY: sterile
+sterile :: clean
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+help-verbose += help-sterile
+help-sterile ::
+ @echo
+ @echo '[MAKE: sterile]'
+ @echo ' sterile make clean, also remove persistent content (~venv)'
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/targets/test/ci-management.mk b/makefiles/targets/test/ci-management.mk
new file mode 100644
index 0000000..2f68086
--- /dev/null
+++ b/makefiles/targets/test/ci-management.mk
@@ -0,0 +1,41 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# 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.
+#
+# SPDX-FileCopyrightText: 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+.PHONY: test
+test: $(venv-activate-script) $(JOBCONFIG_DIR)
+ $(activate) \
+ && pipdeptree \
+ && jenkins-jobs -l DEBUG test --recursive --config-xml -o "$(JOBCONFIG_DIR)" jjb/ ;
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+help-verbose += help-test
+help-test ::
+ @echo
+ @echo '[MAKE: test]'
+ @echo ' test Perform testing that a jenkins job pull request will invoke'
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/targets/test/include.mk b/makefiles/targets/test/include.mk
new file mode 100644
index 0000000..a706bfd
--- /dev/null
+++ b/makefiles/targets/test/include.mk
@@ -0,0 +1,31 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# 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.
+#
+# SPDX-FileCopyrightText: 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+# https://gerrit.opencord.org/plugins/gitiles/onf-make
+# ONF.makefile.version = 1.0
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+# Special snowflake: repository-dependent test target
+-include $(ONF_MAKEDIR)/targets/test/$(--repo-name--).mk
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/todo.mk b/makefiles/todo.mk
new file mode 100644
index 0000000..ab7400d
--- /dev/null
+++ b/makefiles/todo.mk
@@ -0,0 +1,35 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# 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.
+#
+# SPDX-FileCopyrightText: 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+todo ::
+ @echo '[TODO]'
+ @echo ' o item 1'
+ @echo ' o item 2'
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+help ::
+ @echo ' todo Display future enhancement list.'
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/lint/yaml/yamllint.helm b/makefiles/utils/include.mk
similarity index 67%
copy from makefiles/lint/yaml/yamllint.helm
copy to makefiles/utils/include.mk
index 6c7787b..5a7678f 100644
--- a/makefiles/lint/yaml/yamllint.helm
+++ b/makefiles/utils/include.mk
@@ -1,6 +1,6 @@
# -*- makefile -*-
# -----------------------------------------------------------------------
-# Copyright 2022 Open Networking Foundation (ONF) and the ONF Contributors
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -14,19 +14,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-# SPDX-FileCopyrightText: 2022 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-FileCopyrightText: 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
# SPDX-License-Identifier: Apache-2.0
# -----------------------------------------------------------------------
----
-# yamllint.conf
-extends: default
+$(if $(DEBUG),$(warning ENTER))
-rules:
- empty-lines:
- max-end: 1
- line-length:
- max: 120
- braces:
- min-spaces-inside: 0
- max-spaces-inside: 1
+# usage: $(call if-not,false,5)
+if-not = $(info 1=$(1), 2=$(2), 3=$(3))\
+ $(if $(1),$(null),$(2))
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/utils/test/makefile b/makefiles/utils/test/makefile
new file mode 100644
index 0000000..a148cfa
--- /dev/null
+++ b/makefiles/utils/test/makefile
@@ -0,0 +1,9 @@
+# -*- makefile -*-
+
+include ../include.mk
+
+all:
+
+test ::
+ @echo "Testing if-not"
+ @echo $(call if-not,$(null),true,false)
diff --git a/makefiles/virtualenv.mk b/makefiles/virtualenv.mk
new file mode 100644
index 0000000..d4b11c6
--- /dev/null
+++ b/makefiles/virtualenv.mk
@@ -0,0 +1,84 @@
+# -*- makefile -*-
+## -----------------------------------------------------------------------
+# Copyright 2017-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# 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.
+# -----------------------------------------------------------------------
+# https://gerrit.opencord.org/plugins/gitiles/onf-make
+# ONF.makefile.version = 1.0
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+##-------------------##
+##---] GLOBALS [---##
+##-------------------##
+.PHONY: venv
+
+##------------------##
+##---] LOCALS [---##
+##------------------##
+venv-name ?= .venv# # default install directory
+venv-abs-path := $(PWD)/$(venv-name)
+venv-activate-bin := $(venv-name)/bin
+venv-activate-script := $(venv-activate-bin)/activate# # dependency
+
+# Intent: activate= is a macro for accessing the virtualenv activation script#
+# Usage: $(activate) && python
+activate ?= set +u && source $(venv-activate-script) && set -u
+
+## -----------------------------------------------------------------------
+## Intent: Activate script path dependency
+## Usage:
+## o place on the right side of colon as a target dependency
+## o When the script does not exist install the virtual env and display.
+## -----------------------------------------------------------------------
+$(venv-activate-script):
+ @echo
+ @echo "============================="
+ @echo "Installing python virtual env"
+ @echo "============================="
+ virtualenv -p python3 $(venv-name)
+ $(activate) && python -m pip install --upgrade pip
+ $(activate) && pip install --upgrade setuptools
+ $(activate) && [[ -r requirements.txt ]] \
+ && { python -m pip install -r requirements.txt; } \
+ || { /bin/true; }
+ $(activate) && python --version
+
+## -----------------------------------------------------------------------
+## Intent: Explicit named installer target w/o dependencies.
+## Makefile targets should depend on venv-activate-script.
+## -----------------------------------------------------------------------
+venv: $(venv-activate-script)
+
+## -----------------------------------------------------------------------
+## Intent: Revert installation to a clean checkout
+## -----------------------------------------------------------------------
+sterile :: clean
+ $(RM) -r "$(venv-abs-path)"
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+help ::
+ @echo
+ @echo '[VIRTUAL ENV]'
+ @echo ' venv Create a python virtual environment'
+ @echo ' venv-name= Subdir name for virtualenv install'
+ @echo ' venv-activate-script make macro name'
+ @echo ' $$(target) dependency install python virtualenv'
+ @echo ' source $$(macro) && cmd configure env and run cmd'
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/pkg/adapters/common/performance_metrics.go b/pkg/adapters/common/performance_metrics.go
index 524eeea..bb66679 100644
--- a/pkg/adapters/common/performance_metrics.go
+++ b/pkg/adapters/common/performance_metrics.go
@@ -1,5 +1,5 @@
/*
- * Copyright 2019-present Open Networking Foundation
+ * Copyright 2019-2023 Open Networking Foundation (ONF) and the ONF Contributors
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/pkg/adapters/common/performance_metrics_test.go b/pkg/adapters/common/performance_metrics_test.go
index e7e94f9..4a1353e 100644
--- a/pkg/adapters/common/performance_metrics_test.go
+++ b/pkg/adapters/common/performance_metrics_test.go
@@ -1,5 +1,5 @@
/*
- * Copyright 2019-present Open Networking Foundation
+ * Copyright 2019-2023 Open Networking Foundation (ONF) and the ONF Contributors
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/pkg/adapters/common/utils.go b/pkg/adapters/common/utils.go
index d3c562a..1cd247c 100644
--- a/pkg/adapters/common/utils.go
+++ b/pkg/adapters/common/utils.go
@@ -1,17 +1,17 @@
/*
- * Copyright 2018-present Open Networking Foundation
+* Copyright 2018-2023 Open Networking Foundation (ONF) and the ONF Contributors
- * 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
+* 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
+* 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.
+* 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 common
@@ -21,7 +21,7 @@
"time"
)
-//GetRandomSerialNumber returns a serial number formatted as "HOST:PORT"
+// GetRandomSerialNumber returns a serial number formatted as "HOST:PORT"
func GetRandomSerialNumber() string {
rand.Seed(time.Now().UnixNano())
return fmt.Sprintf("%d.%d.%d.%d:%d",
@@ -33,7 +33,7 @@
)
}
-//GetRandomMacAddress returns a random mac address
+// GetRandomMacAddress returns a random mac address
func GetRandomMacAddress() string {
rand.Seed(time.Now().UnixNano())
return fmt.Sprintf("%02x:%02x:%02x:%02x:%02x:%02x",
diff --git a/pkg/adapters/common/utils_test.go b/pkg/adapters/common/utils_test.go
index a8d7a3f..07a81d2 100644
--- a/pkg/adapters/common/utils_test.go
+++ b/pkg/adapters/common/utils_test.go
@@ -1,17 +1,17 @@
/*
- * Copyright 2018-present Open Networking Foundation
+* Copyright 2018-2023 Open Networking Foundation (ONF) and the ONF Contributors
- * 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
+* 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
+* 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.
+* 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 common
diff --git a/pkg/config/configmanager.go b/pkg/config/configmanager.go
index c489407..a3a333a 100644
--- a/pkg/config/configmanager.go
+++ b/pkg/config/configmanager.go
@@ -1,17 +1,17 @@
/*
- * Copyright 2018-present Open Networking Foundation
+* Copyright 2018-2023 Open Networking Foundation (ONF) and the ONF Contributors
- * 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
+* 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
+* 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.
+* 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 config
diff --git a/pkg/config/logcontroller.go b/pkg/config/logcontroller.go
index b58f999..ff1de4c 100644
--- a/pkg/config/logcontroller.go
+++ b/pkg/config/logcontroller.go
@@ -1,5 +1,5 @@
/*
- * Copyright 2018-present Open Networking Foundation
+ * Copyright 2018-2023 Open Networking Foundation (ONF) and the ONF Contributors
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/pkg/config/logfeaturescontroller.go b/pkg/config/logfeaturescontroller.go
index 579c1de..3f68ce2 100644
--- a/pkg/config/logfeaturescontroller.go
+++ b/pkg/config/logfeaturescontroller.go
@@ -1,5 +1,5 @@
/*
- * Copyright 2018-present Open Networking Foundation
+ * Copyright 2018-2023 Open Networking Foundation (ONF) and the ONF Contributors
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/pkg/db/backend_test.go b/pkg/db/backend_test.go
index 9cbef54..040318c 100644
--- a/pkg/db/backend_test.go
+++ b/pkg/db/backend_test.go
@@ -1,5 +1,5 @@
/*
- * Copyright 2019-present Open Networking Foundation
+ * Copyright 2019-2023 Open Networking Foundation (ONF) and the ONF Contributors
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/pkg/db/common.go b/pkg/db/common.go
index d8a0571..85e4f9c 100644
--- a/pkg/db/common.go
+++ b/pkg/db/common.go
@@ -1,5 +1,5 @@
/*
- * Copyright 2020-present Open Networking Foundation
+ * Copyright 2020-2023 Open Networking Foundation (ONF) and the ONF Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/pkg/db/kvstore/client.go b/pkg/db/kvstore/client.go
index e4b1fff..bddbadc 100644
--- a/pkg/db/kvstore/client.go
+++ b/pkg/db/kvstore/client.go
@@ -1,17 +1,17 @@
/*
- * Copyright 2018-present Open Networking Foundation
+* Copyright 2018-2023 Open Networking Foundation (ONF) and the ONF Contributors
- * 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
+* 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
+* 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.
+* 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 kvstore
diff --git a/pkg/db/kvstore/common.go b/pkg/db/kvstore/common.go
index 8ac2a4a..f3882ad 100644
--- a/pkg/db/kvstore/common.go
+++ b/pkg/db/kvstore/common.go
@@ -1,5 +1,5 @@
/*
- * Copyright 2020-present Open Networking Foundation
+ * Copyright 2020-2023 Open Networking Foundation (ONF) and the ONF Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/pkg/db/kvstore/etcdclient.go b/pkg/db/kvstore/etcdclient.go
index 6ca5329..438559e 100644
--- a/pkg/db/kvstore/etcdclient.go
+++ b/pkg/db/kvstore/etcdclient.go
@@ -1,17 +1,17 @@
/*
- * Copyright 2018-present Open Networking Foundation
+* Copyright 2018-2023 Open Networking Foundation (ONF) and the ONF Contributors
- * 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
+* 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
+* 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.
+* 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 kvstore
diff --git a/pkg/db/kvstore/etcdpool.go b/pkg/db/kvstore/etcdpool.go
index 4d33c27..f966efb 100644
--- a/pkg/db/kvstore/etcdpool.go
+++ b/pkg/db/kvstore/etcdpool.go
@@ -1,17 +1,17 @@
/*
- * Copyright 2021-present Open Networking Foundation
+* Copyright 2021-2023 Open Networking Foundation (ONF) and the ONF Contributors
- * 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
+* 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
+* 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.
+* 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 kvstore
diff --git a/pkg/db/kvstore/etcdpool_test.go b/pkg/db/kvstore/etcdpool_test.go
index 1ff6e19..8245e26 100644
--- a/pkg/db/kvstore/etcdpool_test.go
+++ b/pkg/db/kvstore/etcdpool_test.go
@@ -1,17 +1,17 @@
/*
- * Copyright 2021-present Open Networking Foundation
+* Copyright 2021-2023 Open Networking Foundation (ONF) and the ONF Contributors
- * 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
+* 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
+* 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.
+* 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 kvstore
diff --git a/pkg/db/kvstore/kvutils.go b/pkg/db/kvstore/kvutils.go
index ca57542..27dd50f 100644
--- a/pkg/db/kvstore/kvutils.go
+++ b/pkg/db/kvstore/kvutils.go
@@ -1,17 +1,17 @@
/*
- * Copyright 2018-present Open Networking Foundation
+* Copyright 2018-2023 Open Networking Foundation (ONF) and the ONF Contributors
- * 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
+* 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
+* 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.
+* 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 kvstore
diff --git a/pkg/db/kvstore/kvutils_test.go b/pkg/db/kvstore/kvutils_test.go
index 5c2ef8c..6aa3f8f 100644
--- a/pkg/db/kvstore/kvutils_test.go
+++ b/pkg/db/kvstore/kvutils_test.go
@@ -1,17 +1,17 @@
/*
- * Copyright 2018-present Open Networking Foundation
+* Copyright 2018-2023 Open Networking Foundation (ONF) and the ONF Contributors
- * 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
+* 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
+* 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.
+* 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 kvstore
diff --git a/pkg/db/kvstore/redisclient.go b/pkg/db/kvstore/redisclient.go
index decb0a4..b3273e1 100644
--- a/pkg/db/kvstore/redisclient.go
+++ b/pkg/db/kvstore/redisclient.go
@@ -1,17 +1,17 @@
/*
- * Copyright 2018-present Open Networking Foundation
+* Copyright 2018-2023 Open Networking Foundation (ONF) and the ONF Contributors
- * 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
+* 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
+* 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.
+* 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 kvstore
diff --git a/pkg/events/common.go b/pkg/events/common.go
index 25d9683..2cf44f5 100644
--- a/pkg/events/common.go
+++ b/pkg/events/common.go
@@ -1,5 +1,5 @@
/*
- * Copyright 2020-2022 Open Networking Foundation (ONF) and the ONF Contributors
+ * Copyright 2020-2023 Open Networking Foundation (ONF) and the ONF Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/pkg/events/eventif/events_proxy_if.go b/pkg/events/eventif/events_proxy_if.go
index 625cd0b..c0deed6 100644
--- a/pkg/events/eventif/events_proxy_if.go
+++ b/pkg/events/eventif/events_proxy_if.go
@@ -1,5 +1,5 @@
/*
- * Copyright 2020-present Open Networking Foundation
+ * Copyright 2020-2023 Open Networking Foundation (ONF) and the ONF Contributors
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/pkg/events/utils.go b/pkg/events/utils.go
index ae1d7f2..482da25 100644
--- a/pkg/events/utils.go
+++ b/pkg/events/utils.go
@@ -71,7 +71,7 @@
Clear EventAction = "CLEAR_EVENT"
)
-//CreateDeviceStateChangeEvent forms and returns a new DeviceStateChange Event
+// CreateDeviceStateChangeEvent forms and returns a new DeviceStateChange Event
func CreateDeviceStateChangeEvent(serialNumber string, deviceID string, parentID string,
prevOperStatus common.OperStatus_Types, prevConnStatus common.ConnectStatus_Types, prevAdminStatus common.AdminState_Types,
operStatus common.OperStatus_Types, connStatus common.ConnectStatus_Types, adminStatus common.AdminState_Types,
@@ -98,7 +98,7 @@
}
}
-//CreateDeviceDeletedEvent forms and returns a new DeviceState Event
+// CreateDeviceDeletedEvent forms and returns a new DeviceState Event
func CreateDeviceDeletedEvent(serialNumber string, deviceID string, parentID string,
onuId uint32, parentPonPort uint32, isRoot bool) *voltha.DeviceEvent {
diff --git a/pkg/flows/flow_utils.go b/pkg/flows/flow_utils.go
index 46375fa..1e44614 100755
--- a/pkg/flows/flow_utils.go
+++ b/pkg/flows/flow_utils.go
@@ -1,5 +1,5 @@
/*
- * Copyright 2018-present Open Networking Foundation
+ * Copyright 2018-2023 Open Networking Foundation (ONF) and the ONF Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -533,7 +533,7 @@
return 0
}
-//GetMetaData - legacy get method (only want lower 32 bits)
+// GetMetaData - legacy get method (only want lower 32 bits)
func GetMetaData(ctx context.Context, flow *ofp.OfpFlowStats) uint32 {
if flow == nil {
return 0
@@ -1118,7 +1118,7 @@
return group
}
-//SetVariadicModAttributes sets only uint64 or uint32 fields of the ofp_flow_mod message
+// SetVariadicModAttributes sets only uint64 or uint32 fields of the ofp_flow_mod message
func setVariadicModAttributes(mod *ofp.OfpFlowMod, args OfpFlowModArgs) *ofp.OfpFlowMod {
if args == nil {
return mod
@@ -1319,7 +1319,7 @@
}
}
-//AddFrom add flows and groups from the argument into this structure only if they do not already exist
+// AddFrom add flows and groups from the argument into this structure only if they do not already exist
func (fg *FlowsAndGroups) AddFrom(from *FlowsAndGroups) {
iter := from.Flows.IterFunc()
for kv, ok := iter(); ok; kv, ok = iter() {
@@ -1451,7 +1451,7 @@
* Common flow routines
*/
-//FindOverlappingFlows return a list of overlapping flow(s) where mod is the flow request
+// FindOverlappingFlows return a list of overlapping flow(s) where mod is the flow request
func FindOverlappingFlows(flows []*ofp.OfpFlowStats, mod *ofp.OfpFlowMod) []*ofp.OfpFlowStats {
return nil //TODO - complete implementation
}
@@ -1476,14 +1476,14 @@
return -1
}
-//FlowMatch returns true if two flows matches on the following flow attributes:
-//TableId, Priority, Flags, Cookie, Match
+// FlowMatch returns true if two flows matches on the following flow attributes:
+// TableId, Priority, Flags, Cookie, Match
func FlowMatch(f1 *ofp.OfpFlowStats, f2 *ofp.OfpFlowStats) bool {
return f1 != nil && f2 != nil && f1.Id == f2.Id
}
-//FlowMatchesMod returns True if given flow is "covered" by the wildcard flow_mod, taking into consideration of
-//both exact matches as well as masks-based match fields if any. Otherwise return False
+// FlowMatchesMod returns True if given flow is "covered" by the wildcard flow_mod, taking into consideration of
+// both exact matches as well as masks-based match fields if any. Otherwise return False
func FlowMatchesMod(flow *ofp.OfpFlowStats, mod *ofp.OfpFlowMod) bool {
if flow == nil || mod == nil {
return false
@@ -1520,7 +1520,7 @@
}
-//FlowHasOutPort returns True if flow has a output command with the given out_port
+// FlowHasOutPort returns True if flow has a output command with the given out_port
func FlowHasOutPort(flow *ofp.OfpFlowStats, outPort uint32) bool {
if flow == nil {
return false
@@ -1543,7 +1543,7 @@
return false
}
-//FlowHasOutGroup return True if flow has a output command with the given out_group
+// FlowHasOutGroup return True if flow has a output command with the given out_group
func FlowHasOutGroup(flow *ofp.OfpFlowStats, groupID uint32) bool {
if flow == nil {
return false
@@ -1566,7 +1566,7 @@
return false
}
-//FindGroup returns index of group if found, else returns -1
+// FindGroup returns index of group if found, else returns -1
func FindGroup(groups []*ofp.OfpGroupEntry, groupId uint32) int {
for idx, group := range groups {
if group.Desc.GroupId == groupId {
@@ -1595,13 +1595,13 @@
return matchFields
}
-//IsMulticastIp returns true if the ip starts with the byte sequence of 1110;
-//false otherwise.
+// IsMulticastIp returns true if the ip starts with the byte sequence of 1110;
+// false otherwise.
func IsMulticastIp(ip uint32) bool {
return ip>>28 == 14
}
-//ConvertToMulticastMacInt returns equivalent mac address of the given multicast ip address
+// ConvertToMulticastMacInt returns equivalent mac address of the given multicast ip address
func ConvertToMulticastMacInt(ip uint32) uint64 {
//get last 23 bits of ip address by ip & 00000000011111111111111111111111
theLast23BitsOfIp := ip & 8388607
@@ -1609,7 +1609,7 @@
return 1101088686080 | uint64(theLast23BitsOfIp)
}
-//ConvertToMulticastMacBytes returns equivalent mac address of the given multicast ip address
+// ConvertToMulticastMacBytes returns equivalent mac address of the given multicast ip address
func ConvertToMulticastMacBytes(ip uint32) []byte {
mac := ConvertToMulticastMacInt(ip)
var b bytes.Buffer
diff --git a/pkg/flows/flow_utils_test.go b/pkg/flows/flow_utils_test.go
index e1485cc..aa2ff89 100644
--- a/pkg/flows/flow_utils_test.go
+++ b/pkg/flows/flow_utils_test.go
@@ -1,5 +1,5 @@
/*
- * Copyright 2019-2022 Open Networking Foundation (ONF) and the ONF Contributors
+ * Copyright 2019-2023 Open Networking Foundation (ONF) and the ONF Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/pkg/grpc/client.go b/pkg/grpc/client.go
index d61a509..879142c 100644
--- a/pkg/grpc/client.go
+++ b/pkg/grpc/client.go
@@ -1,5 +1,5 @@
/*
- * Copyright 2021-2022 Open Networking Foundation (ONF) and the ONF Contributors
+ * Copyright 2021-2023 Open Networking Foundation (ONF) and the ONF Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/pkg/grpc/client_test.go b/pkg/grpc/client_test.go
index 2d69041..1e33ee3 100644
--- a/pkg/grpc/client_test.go
+++ b/pkg/grpc/client_test.go
@@ -1,17 +1,17 @@
/*
- * Copyright 2021-present Open Networking Foundation
+* Copyright 2021-2023 Open Networking Foundation (ONF) and the ONF Contributors
- * 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
+* 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
+* 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.
+* 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 grpc_test
diff --git a/pkg/grpc/common.go b/pkg/grpc/common.go
index 77aad4f..0096627 100644
--- a/pkg/grpc/common.go
+++ b/pkg/grpc/common.go
@@ -1,5 +1,5 @@
/*
- * Copyright 2020-present Open Networking Foundation
+ * Copyright 2020-2023 Open Networking Foundation (ONF) and the ONF Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/pkg/grpc/common_test.go b/pkg/grpc/common_test.go
index 14be04d..e0f00c8 100644
--- a/pkg/grpc/common_test.go
+++ b/pkg/grpc/common_test.go
@@ -1,5 +1,5 @@
/*
- * Copyright 2019-present Open Networking Foundation
+ * Copyright 2019-2023 Open Networking Foundation (ONF) and the ONF Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/pkg/grpc/mock_core_service.go b/pkg/grpc/mock_core_service.go
index 8365956..137e850 100644
--- a/pkg/grpc/mock_core_service.go
+++ b/pkg/grpc/mock_core_service.go
@@ -1,17 +1,17 @@
/*
- * Copyright 2021-present Open Networking Foundation
+* Copyright 2021-2023 Open Networking Foundation (ONF) and the ONF Contributors
- * 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
+* 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
+* 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.
+* 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 grpc
@@ -30,7 +30,7 @@
"github.com/opencord/voltha-protos/v5/go/voltha"
)
-//MockCoreServiceHandler implements the methods in the core service
+// MockCoreServiceHandler implements the methods in the core service
type MockCoreServiceHandler struct {
exitChannel chan struct{}
}
diff --git a/pkg/grpc/security.go b/pkg/grpc/security.go
index 930d2c8..5b080c9 100644
--- a/pkg/grpc/security.go
+++ b/pkg/grpc/security.go
@@ -1,17 +1,17 @@
/*
- * Copyright 2018-present Open Networking Foundation
+* Copyright 2018-2023 Open Networking Foundation (ONF) and the ONF Contributors
- * 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
+* 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
+* 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.
+* 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 grpc
diff --git a/pkg/grpc/server.go b/pkg/grpc/server.go
index bee418d..c0763a9 100644
--- a/pkg/grpc/server.go
+++ b/pkg/grpc/server.go
@@ -1,17 +1,17 @@
/*
- * Copyright 2018-present Open Networking Foundation
+* Copyright 2018-2023 Open Networking Foundation (ONF) and the ONF Contributors
- * 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
+* 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
+* 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.
+* 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 grpc
diff --git a/pkg/grpc/server_test.go b/pkg/grpc/server_test.go
index 4f376e2..0745cea 100644
--- a/pkg/grpc/server_test.go
+++ b/pkg/grpc/server_test.go
@@ -1,17 +1,17 @@
/*
- * Copyright 2018-present Open Networking Foundation
+* Copyright 2018-2023 Open Networking Foundation (ONF) and the ONF Contributors
- * 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
+* 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
+* 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.
+* 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 grpc
diff --git a/pkg/grpc/utils.go b/pkg/grpc/utils.go
index 85686de..ed0ced1 100644
--- a/pkg/grpc/utils.go
+++ b/pkg/grpc/utils.go
@@ -1,17 +1,17 @@
/*
- * Copyright 2021-present Open Networking Foundation
+* Copyright 2021-2023 Open Networking Foundation (ONF) and the ONF Contributors
- * 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
+* 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
+* 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.
+* 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 grpc
diff --git a/pkg/grpc/utils_test.go b/pkg/grpc/utils_test.go
index a9cf7ff..c807c2d 100644
--- a/pkg/grpc/utils_test.go
+++ b/pkg/grpc/utils_test.go
@@ -1,17 +1,17 @@
/*
- * Copyright 2021-present Open Networking Foundation
+* Copyright 2021-2023 Open Networking Foundation (ONF) and the ONF Contributors
- * 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
+* 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
+* 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.
+* 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 grpc_test
diff --git a/pkg/kafka/client.go b/pkg/kafka/client.go
index afc2955..c9d325e 100755
--- a/pkg/kafka/client.go
+++ b/pkg/kafka/client.go
@@ -1,22 +1,22 @@
/*
- * Copyright 2018-present Open Networking Foundation
+* Copyright 2018-2023 Open Networking Foundation (ONF) and the ONF Contributors
- * 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
+* 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
+* 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.
- *
- *
- * NOTE: The kafka client is used to publish events on Kafka in voltha
- * release 2.9. It is no longer used for inter voltha container
- * communication.
+* 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.
+*
+*
+* NOTE: The kafka client is used to publish events on Kafka in voltha
+* release 2.9. It is no longer used for inter voltha container
+* communication.
*/
package kafka
diff --git a/pkg/kafka/common.go b/pkg/kafka/common.go
index f319d66..c563408 100644
--- a/pkg/kafka/common.go
+++ b/pkg/kafka/common.go
@@ -1,5 +1,5 @@
/*
- * Copyright 2020-2022 Open Networking Foundation (ONF) and the ONF Contributors
+ * Copyright 2020-2023 Open Networking Foundation (ONF) and the ONF Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/pkg/kafka/sarama_client.go b/pkg/kafka/sarama_client.go
index 680aa67..3889175 100755
--- a/pkg/kafka/sarama_client.go
+++ b/pkg/kafka/sarama_client.go
@@ -1,17 +1,17 @@
/*
- * Copyright 2018-present Open Networking Foundation
+* Copyright 2018-2023 Open Networking Foundation (ONF) and the ONF Contributors
- * 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
+* 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
+* 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.
+* 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 kafka
@@ -33,7 +33,7 @@
// consumerChannels represents one or more consumers listening on a kafka topic. Once a message is received on that
// topic, the consumer(s) broadcasts the message to all the listening channels. The consumer can be a partition
-//consumer or a group consumer
+// consumer or a group consumer
type consumerChannels struct {
consumers []interface{}
channels []chan proto.Message
@@ -315,7 +315,7 @@
logger.Info(ctx, "sarama-client-stopped")
}
-//createTopic is an internal function to create a topic on the Kafka Broker. No locking is required as
+// createTopic is an internal function to create a topic on the Kafka Broker. No locking is required as
// the invoking function must hold the lock
func (sc *SaramaClient) createTopic(ctx context.Context, topic *Topic, numPartition int, repFactor int) error {
// Set the topic details
@@ -344,7 +344,7 @@
return nil
}
-//CreateTopic is a public API to create a topic on the Kafka Broker. It uses a lock on a specific topic to
+// CreateTopic is a public API to create a topic on the Kafka Broker. It uses a lock on a specific topic to
// ensure no two go routines are performing operations on the same topic
func (sc *SaramaClient) CreateTopic(ctx context.Context, topic *Topic, numPartition int, repFactor int) error {
sc.lockTopic(topic)
@@ -353,7 +353,7 @@
return sc.createTopic(ctx, topic, numPartition, repFactor)
}
-//DeleteTopic removes a topic from the kafka Broker
+// DeleteTopic removes a topic from the kafka Broker
func (sc *SaramaClient) DeleteTopic(ctx context.Context, topic *Topic) error {
sc.lockTopic(topic)
defer sc.unLockTopic(topic)
@@ -441,7 +441,7 @@
return consumerListeningChannel, nil
}
-//UnSubscribe unsubscribe a consumer from a given topic
+// UnSubscribe unsubscribe a consumer from a given topic
func (sc *SaramaClient) UnSubscribe(ctx context.Context, topic *Topic, ch <-chan proto.Message) error {
sc.lockTopic(topic)
defer sc.unLockTopic(topic)
@@ -760,7 +760,7 @@
logger.Warnw(ctx, "consumers-channel-not-exist", log.Fields{"topic": topic.Name})
}
-//closeConsumers closes a list of sarama consumers. The consumers can either be a partition consumers or a group consumers
+// closeConsumers closes a list of sarama consumers. The consumers can either be a partition consumers or a group consumers
func closeConsumers(ctx context.Context, consumers []interface{}) error {
var err error
for _, consumer := range consumers {
@@ -830,7 +830,7 @@
return nil
}
-//createPublisher creates the publisher which is used to send a message onto kafka
+// createPublisher creates the publisher which is used to send a message onto kafka
func (sc *SaramaClient) createPublisher(ctx context.Context) error {
// This Creates the publisher
config := sarama.NewConfig()
@@ -1028,8 +1028,8 @@
return nil
}
-//// setupConsumerChannel creates a consumerChannels object for that topic and add it to the consumerChannels map
-//// for that topic. It also starts the routine that listens for messages on that topic.
+// // setupConsumerChannel creates a consumerChannels object for that topic and add it to the consumerChannels map
+// // for that topic. It also starts the routine that listens for messages on that topic.
func (sc *SaramaClient) setupPartitionConsumerChannel(ctx context.Context, topic *Topic, initialOffset int64) (chan proto.Message, error) {
var pConsumers []sarama.PartitionConsumer
var err error
diff --git a/pkg/kafka/sarama_client_test.go b/pkg/kafka/sarama_client_test.go
index cbbfe7e..8bc2728 100644
--- a/pkg/kafka/sarama_client_test.go
+++ b/pkg/kafka/sarama_client_test.go
@@ -1,17 +1,17 @@
/*
- * Copyright 2018-present Open Networking Foundation
+* Copyright 2018-2023 Open Networking Foundation (ONF) and the ONF Contributors
- * 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
+* 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
+* 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.
+* 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 kafka
diff --git a/pkg/kafka/utils.go b/pkg/kafka/utils.go
index 608361b..02f4245 100644
--- a/pkg/kafka/utils.go
+++ b/pkg/kafka/utils.go
@@ -1,17 +1,17 @@
/*
- * Copyright 2018-present Open Networking Foundation
+* Copyright 2018-2023 Open Networking Foundation (ONF) and the ONF Contributors
- * 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
+* 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
+* 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.
+* 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 kafka
@@ -72,7 +72,8 @@
// TODO: Remove and provide better may to get the device id
// GetDeviceIdFromTopic extract the deviceId from the topic name. The topic name is formatted either as:
-// <any string> or <any string>_<deviceId>. The device Id is 24 characters long.
+//
+// <any string> or <any string>_<deviceId>. The device Id is 24 characters long.
func GetDeviceIdFromTopic(topic Topic) string {
pos := strings.LastIndex(topic.Name, TopicSeparator)
if pos == -1 {
@@ -113,7 +114,8 @@
return nil
}
-/**
+/*
+*
MonitorKafkaReadiness checks the liveliness and readiness of the kafka service
and update the status in the probe.
*/
diff --git a/pkg/log/common.go b/pkg/log/common.go
index b0ce81b..836d9ab 100644
--- a/pkg/log/common.go
+++ b/pkg/log/common.go
@@ -1,5 +1,5 @@
/*
- * Copyright 2020-present Open Networking Foundation
+ * Copyright 2020-2023 Open Networking Foundation (ONF) and the ONF Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/pkg/log/log.go b/pkg/log/log.go
index 6810fe1..87559df 100644
--- a/pkg/log/log.go
+++ b/pkg/log/log.go
@@ -1,5 +1,5 @@
/*
- * Copyright 2018-present Open Networking Foundation
+ * Copyright 2018-2023 Open Networking Foundation (ONF) and the ONF Contributors
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -272,7 +272,7 @@
// outputType is JSON, level is the lowest level log to output with this logger and defaultFields is a map of
// key-value pairs to always add to the output.
// Note: AddPackage also returns a reference to the actual logger. If a calling package uses this reference directly
-//instead of using the publicly available functions in this log package then a number of functionalities will not
+// instead of using the publicly available functions in this log package then a number of functionalities will not
// be available to it, notably log tracing with filename.functionname.linenumber annotation.
//
// pkgNames parameter should be used for testing only as this function detects the caller's package.
@@ -312,7 +312,7 @@
return loggers[pkgName], nil
}
-//UpdateAllLoggers create new loggers for all registered pacakges with the defaultFields.
+// UpdateAllLoggers create new loggers for all registered pacakges with the defaultFields.
func UpdateAllLoggers(defaultFields Fields) error {
for pkgName, cfg := range cfgs {
for k, v := range defaultFields {
@@ -392,7 +392,7 @@
}
}
-//SetPackageLogLevel dynamically sets the log level of a given package to level. This is typically invoked at an
+// SetPackageLogLevel dynamically sets the log level of a given package to level. This is typically invoked at an
// application level during debugging
func SetPackageLogLevel(packageName string, level LogLevel) {
// Get proper config
@@ -401,7 +401,7 @@
}
}
-//SetAllLogLevel sets the log level of all registered packages to level
+// SetAllLogLevel sets the log level of all registered packages to level
func SetAllLogLevel(level LogLevel) {
// Get proper config
for _, cfg := range cfgs {
@@ -409,7 +409,7 @@
}
}
-//GetPackageLogLevel returns the current log level of a package.
+// GetPackageLogLevel returns the current log level of a package.
func GetPackageLogLevel(packageName ...string) (LogLevel, error) {
var name string
if len(packageName) == 1 {
@@ -423,12 +423,12 @@
return 0, fmt.Errorf("unknown-package-%s", name)
}
-//GetDefaultLogLevel gets the log level used for packages that don't have specific loggers
+// GetDefaultLogLevel gets the log level used for packages that don't have specific loggers
func GetDefaultLogLevel() LogLevel {
return levelToLogLevel(cfg.Level.Level())
}
-//SetLogLevel sets the log level for the logger corresponding to the caller's package
+// SetLogLevel sets the log level for the logger corresponding to the caller's package
func SetLogLevel(level LogLevel) error {
pkgName, _, _, _ := getCallerInfo()
if _, exist := cfgs[pkgName]; !exist {
@@ -439,7 +439,7 @@
return nil
}
-//SetDefaultLogLevel sets the log level used for packages that don't have specific loggers
+// SetDefaultLogLevel sets the log level used for packages that don't have specific loggers
func SetDefaultLogLevel(level LogLevel) {
setLevel(cfg, level)
}
@@ -661,8 +661,8 @@
return levelToLogLevel(cfgs[l.packageName].Level.Level())
}
-//UpdateCallerSkipLevel create new loggers for specified registered pacakges with the default updated caller skipltFields.
-//This will enable to skip wrapper file caller in caller info and stacktrace
+// UpdateCallerSkipLevel create new loggers for specified registered pacakges with the default updated caller skipltFields.
+// This will enable to skip wrapper file caller in caller info and stacktrace
func UpdateCallerSkipLevel(skipLevel int) (CLogger, error) {
pkgName, _, _, _ := getCallerInfo()
if cfg, exist := cfgs[pkgName]; exist {
@@ -681,8 +681,8 @@
return loggers[pkgName], errors.New("Package Not Found")
}
-//UpdateAllCallerSkipLevel create new loggers for all registered pacakges with the default updated caller skipltFields.
-//This will enable to skip wrapper file caller in caller info and stacktrace
+// UpdateAllCallerSkipLevel create new loggers for all registered pacakges with the default updated caller skipltFields.
+// This will enable to skip wrapper file caller in caller info and stacktrace
func UpdateAllCallerSkipLevel(skipLevel int) error {
for pkgName, cfg := range cfgs {
l, err := cfg.Build(zp.AddCallerSkip(skipLevel))
diff --git a/pkg/log/log_test.go b/pkg/log/log_test.go
index bc78dfe..60069cf 100644
--- a/pkg/log/log_test.go
+++ b/pkg/log/log_test.go
@@ -1,17 +1,17 @@
/*
- * Copyright 2018-present Open Networking Foundation
+* Copyright 2018-2023 Open Networking Foundation (ONF) and the ONF Contributors
- * 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
+* 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
+* 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.
+* 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 log
diff --git a/pkg/log/utils.go b/pkg/log/utils.go
index 82c3d7d..7be7ecf 100644
--- a/pkg/log/utils.go
+++ b/pkg/log/utils.go
@@ -1,5 +1,5 @@
/*
- * Copyright 2018-present Open Networking Foundation
+ * Copyright 2018-2023 Open Networking Foundation (ONF) and the ONF Contributors
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/pkg/meters/common.go b/pkg/meters/common.go
index 3aef492..53674ec 100644
--- a/pkg/meters/common.go
+++ b/pkg/meters/common.go
@@ -1,5 +1,5 @@
/*
- * Copyright 2019-present Open Networking Foundation
+ * Copyright 2019-2023 Open Networking Foundation (ONF) and the ONF Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/pkg/meters/meter_utils.go b/pkg/meters/meter_utils.go
index ed3db8b..bd760d1 100644
--- a/pkg/meters/meter_utils.go
+++ b/pkg/meters/meter_utils.go
@@ -1,5 +1,5 @@
/*
- * Copyright 2019-present Open Networking Foundation
+ * Copyright 2019-2023 Open Networking Foundation (ONF) and the ONF Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/pkg/meters/meter_utils_test.go b/pkg/meters/meter_utils_test.go
index ffa545b..61730bd 100644
--- a/pkg/meters/meter_utils_test.go
+++ b/pkg/meters/meter_utils_test.go
@@ -1,5 +1,5 @@
/*
- * Copyright 2019-present Open Networking Foundation
+ * Copyright 2019-2023 Open Networking Foundation (ONF) and the ONF Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/pkg/mocks/etcd/common.go b/pkg/mocks/etcd/common.go
index c893312..bab6859 100644
--- a/pkg/mocks/etcd/common.go
+++ b/pkg/mocks/etcd/common.go
@@ -1,5 +1,5 @@
/*
- * Copyright 2019-present Open Networking Foundation
+ * Copyright 2019-2023 Open Networking Foundation (ONF) and the ONF Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/pkg/mocks/etcd/etcd_server.go b/pkg/mocks/etcd/etcd_server.go
index 951baa9..09d0447 100644
--- a/pkg/mocks/etcd/etcd_server.go
+++ b/pkg/mocks/etcd/etcd_server.go
@@ -1,17 +1,17 @@
/*
- * Copyright 2019-present Open Networking Foundation
+* Copyright 2019-2023 Open Networking Foundation (ONF) and the ONF Contributors
- * 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
+* 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
+* 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.
+* 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 etcd
@@ -31,7 +31,7 @@
defaultLocalPersistentStorage = "voltha.test.embed.etcd"
)
-//EtcdServer represents an embedded Etcd server. It is used for testing only.
+// EtcdServer represents an embedded Etcd server. It is used for testing only.
type EtcdServer struct {
server *embed.Etcd
}
@@ -87,7 +87,7 @@
return cfg
}
-//getDefaultCfg specifies the default config
+// getDefaultCfg specifies the default config
func getDefaultCfg() *embed.Config {
cfg := embed.NewConfig()
cfg.Debug = false
@@ -97,8 +97,8 @@
return cfg
}
-//StartEtcdServer creates and starts an embedded Etcd server. A local directory to store data is created for the
-//embedded server lifetime (for the duration of a unit test. The server runs at localhost:2379.
+// StartEtcdServer creates and starts an embedded Etcd server. A local directory to store data is created for the
+// embedded server lifetime (for the duration of a unit test. The server runs at localhost:2379.
func StartEtcdServer(ctx context.Context, cfg *embed.Config) *EtcdServer {
// If the server is already running, just return
if cfg == nil {
@@ -128,7 +128,7 @@
return &EtcdServer{server: e}
}
-//Stop closes the embedded Etcd server and removes the local data directory as well
+// Stop closes the embedded Etcd server and removes the local data directory as well
func (es *EtcdServer) Stop(ctx context.Context) {
if es != nil {
storage := es.server.Config().Dir
diff --git a/pkg/mocks/etcd/etcd_server_test.go b/pkg/mocks/etcd/etcd_server_test.go
index 2d39dd1..d5422a1 100644
--- a/pkg/mocks/etcd/etcd_server_test.go
+++ b/pkg/mocks/etcd/etcd_server_test.go
@@ -1,5 +1,5 @@
/*
- * Copyright 2019-present Open Networking Foundation
+ * Copyright 2019-2023 Open Networking Foundation (ONF) and the ONF Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/pkg/mocks/grpc/common.go b/pkg/mocks/grpc/common.go
index 1d0c2bc..9e98824 100644
--- a/pkg/mocks/grpc/common.go
+++ b/pkg/mocks/grpc/common.go
@@ -1,5 +1,5 @@
/*
- * Copyright 2021-present Open Networking Foundation
+ * Copyright 2021-2023 Open Networking Foundation (ONF) and the ONF Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/pkg/mocks/grpc/mock_grpc_server.go b/pkg/mocks/grpc/mock_grpc_server.go
index 63c7f95..1470de1 100644
--- a/pkg/mocks/grpc/mock_grpc_server.go
+++ b/pkg/mocks/grpc/mock_grpc_server.go
@@ -1,5 +1,5 @@
/*
- * Copyright 2021-present Open Networking Foundation
+ * Copyright 2021-2023 Open Networking Foundation (ONF) and the ONF Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/pkg/mocks/kafka/common.go b/pkg/mocks/kafka/common.go
index ff4aec9..de44b22 100644
--- a/pkg/mocks/kafka/common.go
+++ b/pkg/mocks/kafka/common.go
@@ -1,5 +1,5 @@
/*
- * Copyright 2019-present Open Networking Foundation
+ * Copyright 2019-2023 Open Networking Foundation (ONF) and the ONF Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/pkg/mocks/kafka/kafka_client.go b/pkg/mocks/kafka/kafka_client.go
index a9b434f..bf91d54 100644
--- a/pkg/mocks/kafka/kafka_client.go
+++ b/pkg/mocks/kafka/kafka_client.go
@@ -1,17 +1,17 @@
/*
- * Copyright 2019-present Open Networking Foundation
+* Copyright 2019-2023 Open Networking Foundation (ONF) and the ONF Contributors
- * 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
+* 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
+* 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.
+* 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 kafka
diff --git a/pkg/mocks/kafka/kafka_client_test.go b/pkg/mocks/kafka/kafka_client_test.go
index ad849c2..9a0e4ca 100644
--- a/pkg/mocks/kafka/kafka_client_test.go
+++ b/pkg/mocks/kafka/kafka_client_test.go
@@ -1,5 +1,5 @@
/*
- * Copyright 2019-present Open Networking Foundation
+ * Copyright 2019-2023 Open Networking Foundation (ONF) and the ONF Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/pkg/platform/common.go b/pkg/platform/common.go
index dbef567..ccddfc4 100644
--- a/pkg/platform/common.go
+++ b/pkg/platform/common.go
@@ -1,5 +1,5 @@
/*
- * Copyright 2020-present Open Networking Foundation
+ * Copyright 2020-2023 Open Networking Foundation (ONF) and the ONF Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/pkg/platform/platform.go b/pkg/platform/platform.go
index 0fe3956..0f35eba 100644
--- a/pkg/platform/platform.go
+++ b/pkg/platform/platform.go
@@ -1,5 +1,5 @@
/*
- * Copyright 2018-present Open Networking Foundation
+ * Copyright 2018-2023 Open Networking Foundation (ONF) and the ONF Contributors
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -100,7 +100,7 @@
TpRange = TpIDEnd - TpIDStart
)
-//MkUniPortNum returns new UNIportNum based on intfID, inuID and uniID
+// MkUniPortNum returns new UNIportNum based on intfID, inuID and uniID
func MkUniPortNum(ctx context.Context, intfID, onuID, uniID uint32) uint32 {
var limit = int(intfID)
if limit > MaxPonsPerOlt {
@@ -117,22 +117,22 @@
return (intfID << (bitsForUniID + bitsForONUID)) | (onuID << bitsForUniID) | uniID
}
-//OnuIDFromPortNum returns ONUID derived from portNumber
+// OnuIDFromPortNum returns ONUID derived from portNumber
func OnuIDFromPortNum(portNum uint32) uint32 {
return (portNum >> bitsForUniID) & (MaxOnusPerPon - 1)
}
-//IntfIDFromUniPortNum returns IntfID derived from portNum
+// IntfIDFromUniPortNum returns IntfID derived from portNum
func IntfIDFromUniPortNum(portNum uint32) uint32 {
return (portNum >> (bitsForUniID + bitsForONUID)) & (MaxPonsPerOlt - 1)
}
-//UniIDFromPortNum return UniID derived from portNum
+// UniIDFromPortNum return UniID derived from portNum
func UniIDFromPortNum(portNum uint32) uint32 {
return (portNum) & (MaxUnisPerOnu - 1)
}
-//IntfIDToPortNo returns portId derived from intftype, intfId and portType
+// IntfIDToPortNo returns portId derived from intftype, intfId and portType
func IntfIDToPortNo(intfID uint32, intfType voltha.Port_PortType) uint32 {
if (intfType) == voltha.Port_ETHERNET_NNI {
return (1 << nniUniDiffPos) | intfID
@@ -143,7 +143,7 @@
return 0
}
-//PortNoToIntfID returns portnumber derived from interfaceID
+// PortNoToIntfID returns portnumber derived from interfaceID
func PortNoToIntfID(portno uint32, intfType voltha.Port_PortType) uint32 {
if (intfType) == voltha.Port_ETHERNET_NNI {
return (1 << nniUniDiffPos) ^ portno
@@ -154,7 +154,7 @@
return 0
}
-//IntfIDFromNniPortNum returns Intf ID derived from portNum
+// IntfIDFromNniPortNum returns Intf ID derived from portNum
func IntfIDFromNniPortNum(ctx context.Context, portNum uint32) (uint32, error) {
if portNum < minNniPortNum || portNum > maxNniPortNum {
logger.Errorw(ctx, "nniportnumber-is-not-in-valid-range", log.Fields{"portnum": portNum})
@@ -163,7 +163,7 @@
return (portNum & (minNniPortNum - 1)), nil
}
-//IntfIDFromPonPortNum returns Intf ID derived from portNum
+// IntfIDFromPonPortNum returns Intf ID derived from portNum
func IntfIDFromPonPortNum(ctx context.Context, portNum uint32) (uint32, error) {
if portNum < minPonIntfPortNum || portNum > maxPonIntfPortNum {
logger.Errorw(ctx, "ponportnumber-is-not-in-valid-range", log.Fields{"portnum": portNum})
@@ -172,7 +172,7 @@
return (portNum & ((1 << ponIntfMarkerPos) - 1)), nil
}
-//IntfIDToPortTypeName returns port type derived from the intfId
+// IntfIDToPortTypeName returns port type derived from the intfId
func IntfIDToPortTypeName(intfID uint32) voltha.Port_PortType {
if ((ponIntfMarkerValue << ponIntfMarkerPos) ^ intfID) < MaxPonsPerOlt {
return voltha.Port_PON_OLT
@@ -183,7 +183,7 @@
return voltha.Port_ETHERNET_UNI
}
-//ExtractAccessFromFlow returns AccessDevice information
+// ExtractAccessFromFlow returns AccessDevice information
func ExtractAccessFromFlow(inPort, outPort uint32) (uint32, uint32, uint32, uint32) {
if IsUpstream(outPort) {
return inPort, IntfIDFromUniPortNum(inPort), OnuIDFromPortNum(inPort), UniIDFromPortNum(inPort)
@@ -191,7 +191,7 @@
return outPort, IntfIDFromUniPortNum(outPort), OnuIDFromPortNum(outPort), UniIDFromPortNum(outPort)
}
-//IsUpstream returns true for Upstream and false for downstream
+// IsUpstream returns true for Upstream and false for downstream
func IsUpstream(outPort uint32) bool {
if IsControllerBoundFlow(outPort) {
return true
@@ -199,17 +199,17 @@
return (outPort & (1 << nniUniDiffPos)) == (1 << nniUniDiffPos)
}
-//IsControllerBoundFlow returns true/false
+// IsControllerBoundFlow returns true/false
func IsControllerBoundFlow(outPort uint32) bool {
return outPort == uint32(ofp.OfpPortNo_OFPP_CONTROLLER)
}
-//OnuIDFromUniPortNum returns onuId from give portNum information.
+// OnuIDFromUniPortNum returns onuId from give portNum information.
func OnuIDFromUniPortNum(portNum uint32) uint32 {
return (portNum >> bitsForUniID) & (MaxOnusPerPon - 1)
}
-//FlowExtractInfo fetches uniport from the flow, based on which it gets and returns ponInf, onuID, uniID, inPort and ethType
+// FlowExtractInfo fetches uniport from the flow, based on which it gets and returns ponInf, onuID, uniID, inPort and ethType
func FlowExtractInfo(ctx context.Context, flow *ofp.OfpFlowStats, flowDirection string) (uint32, uint32, uint32, uint32, uint32, uint32, error) {
var uniPortNo uint32
var ponIntf uint32
diff --git a/pkg/platform/platform_test.go b/pkg/platform/platform_test.go
index f68df9a..9e0bbad 100644
--- a/pkg/platform/platform_test.go
+++ b/pkg/platform/platform_test.go
@@ -1,5 +1,5 @@
/*
- * Copyright 2018-2022 Open Networking Foundation (ONF) and the ONF Contributors
+ * Copyright 2018-2023 Open Networking Foundation (ONF) and the ONF Contributors
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-//Package core provides the utility for olt devices, flows and statistics
+// Package core provides the utility for olt devices, flows and statistics
package platform
import (
diff --git a/pkg/pmmetrics/performance_metrics.go b/pkg/pmmetrics/performance_metrics.go
index 1f44fed..3ac7cbb 100644
--- a/pkg/pmmetrics/performance_metrics.go
+++ b/pkg/pmmetrics/performance_metrics.go
@@ -1,5 +1,5 @@
/*
- * Copyright 2019-present Open Networking Foundation
+ * Copyright 2019-2023 Open Networking Foundation (ONF) and the ONF Contributors
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/pkg/ponresourcemanager/common.go b/pkg/ponresourcemanager/common.go
index b311bb3..9e03d8b 100644
--- a/pkg/ponresourcemanager/common.go
+++ b/pkg/ponresourcemanager/common.go
@@ -1,5 +1,5 @@
/*
- * Copyright 2020-present Open Networking Foundation
+ * Copyright 2020-2023 Open Networking Foundation (ONF) and the ONF Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/pkg/ponresourcemanager/ponresourcemanager.go b/pkg/ponresourcemanager/ponresourcemanager.go
index 807d4c8..326de27 100755
--- a/pkg/ponresourcemanager/ponresourcemanager.go
+++ b/pkg/ponresourcemanager/ponresourcemanager.go
@@ -1,5 +1,5 @@
/*
- * Copyright 2019-present Open Networking Foundation
+ * Copyright 2019-2023 Open Networking Foundation (ONF) and the ONF Contributors
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -1339,7 +1339,9 @@
return true
}
-/* Reserves a unique id in the specified resource pool.
+/*
+ Reserves a unique id in the specified resource pool.
+
:param Resource: resource used to reserve ID
:param Id: ID to be reserved
*/
diff --git a/pkg/ponresourcemanager/ponresourcemanager_test.go b/pkg/ponresourcemanager/ponresourcemanager_test.go
index 2e4b6e1..2549de8 100644
--- a/pkg/ponresourcemanager/ponresourcemanager_test.go
+++ b/pkg/ponresourcemanager/ponresourcemanager_test.go
@@ -1,5 +1,5 @@
/*
- * Copyright 2020-present Open Networking Foundation
+ * Copyright 2020-2023 Open Networking Foundation (ONF) and the ONF Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/pkg/probe/common.go b/pkg/probe/common.go
index 6508fd4..3d25406 100644
--- a/pkg/probe/common.go
+++ b/pkg/probe/common.go
@@ -1,5 +1,5 @@
/*
- * Copyright 2020-present Open Networking Foundation
+ * Copyright 2020-2023 Open Networking Foundation (ONF) and the ONF Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/pkg/probe/probe.go b/pkg/probe/probe.go
index 7ba1a57..8ea015c 100644
--- a/pkg/probe/probe.go
+++ b/pkg/probe/probe.go
@@ -1,5 +1,5 @@
/*
- * Copyright 2019-present Open Networking Foundation
+ * Copyright 2019-2023 Open Networking Foundation (ONF) and the ONF Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/pkg/probe/probe_test.go b/pkg/probe/probe_test.go
index cae17e5..4eb3ae3 100644
--- a/pkg/probe/probe_test.go
+++ b/pkg/probe/probe_test.go
@@ -1,5 +1,5 @@
/*
- * Copyright 2019-present Open Networking Foundation
+ * Copyright 2019-2023 Open Networking Foundation (ONF) and the ONF Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/pkg/stats/common.go b/pkg/stats/common.go
index 781c7b9..bd84c49 100644
--- a/pkg/stats/common.go
+++ b/pkg/stats/common.go
@@ -1,5 +1,5 @@
/*
- * Copyright 2020-present Open Networking Foundation
+ * Copyright 2020-2023 Open Networking Foundation (ONF) and the ONF Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/pkg/stats/manager.go b/pkg/stats/manager.go
index fdc8cc0..0f6bd4c 100644
--- a/pkg/stats/manager.go
+++ b/pkg/stats/manager.go
@@ -1,17 +1,17 @@
/*
- * Copyright 2018-present Open Networking Foundation
+* Copyright 2018-2023 Open Networking Foundation (ONF) and the ONF Contributors
- * 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
+* 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
+* 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.
+* 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 stats
diff --git a/pkg/stats/promserver.go b/pkg/stats/promserver.go
index 1fbfd38..dec2721 100644
--- a/pkg/stats/promserver.go
+++ b/pkg/stats/promserver.go
@@ -1,17 +1,17 @@
/*
- * Copyright 2018-present Open Networking Foundation
+* Copyright 2018-2023 Open Networking Foundation (ONF) and the ONF Contributors
- * 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
+* 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
+* 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.
+* 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 stats
@@ -129,21 +129,21 @@
prometheus.MustRegister(ps.otherDurations)
}
-//CountForDevice counts the number of times the counterName happens for device devId with serial number sn. Each call to Count increments it by one.
+// CountForDevice counts the number of times the counterName happens for device devId with serial number sn. Each call to Count increments it by one.
func (ps *PromStatsServer) CountForDevice(devId, sn string, counterName DeviceCounter) {
if ps.devCounters != nil {
ps.devCounters.WithLabelValues(devId, sn, counterName.String()).Inc()
}
}
-//AddForDevice adds val to counter.
+// AddForDevice adds val to counter.
func (ps *PromStatsServer) AddForDevice(devId, sn string, counter DeviceCounter, val float64) {
if ps.devCounters != nil {
ps.devCounters.WithLabelValues(devId, sn, counter.String()).Add(val)
}
}
-//CollectDurationForDevice calculates the duration from startTime to time.Now() for device devID with serial number sn.
+// CollectDurationForDevice calculates the duration from startTime to time.Now() for device devID with serial number sn.
func (ps *PromStatsServer) CollectDurationForDevice(devID, sn string, dName DeviceDuration, startTime time.Time) {
if ps.otherDurations != nil {
timeSpent := time.Since(startTime)
@@ -151,21 +151,21 @@
}
}
-//Count counts the number of times the counterName happens. Each call to Count increments it by one.
+// Count counts the number of times the counterName happens. Each call to Count increments it by one.
func (ps *PromStatsServer) Count(counter NonDeviceCounter) {
if ps.otherCounters != nil {
ps.otherCounters.WithLabelValues(counter.String()).Inc()
}
}
-//Add adds val to counter.
+// Add adds val to counter.
func (ps *PromStatsServer) Add(counter NonDeviceCounter, val float64) {
if ps.otherCounters != nil {
ps.otherCounters.WithLabelValues(counter.String()).Add(val)
}
}
-//CollectDuration calculates the duration from startTime to time.Now().
+// CollectDuration calculates the duration from startTime to time.Now().
func (ps *PromStatsServer) CollectDuration(dName NonDeviceDuration, startTime time.Time) {
if ps.otherDurations != nil {
timeSpent := time.Since(startTime)
diff --git a/pkg/stats/promserver_test.go b/pkg/stats/promserver_test.go
index 5c5da7d..cfe36cb 100644
--- a/pkg/stats/promserver_test.go
+++ b/pkg/stats/promserver_test.go
@@ -1,17 +1,17 @@
/*
- * Copyright 2018-present Open Networking Foundation
+* Copyright 2018-2023 Open Networking Foundation (ONF) and the ONF Contributors
- * 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
+* 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
+* 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.
+* 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 stats
diff --git a/pkg/stats/stats.go b/pkg/stats/stats.go
index c507e55..5e3271b 100644
--- a/pkg/stats/stats.go
+++ b/pkg/stats/stats.go
@@ -1,17 +1,17 @@
/*
- * Copyright 2018-present Open Networking Foundation
+* Copyright 2018-2023 Open Networking Foundation (ONF) and the ONF Contributors
- * 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
+* 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
+* 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.
+* 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 stats
diff --git a/pkg/techprofile/common.go b/pkg/techprofile/common.go
index df1b877..5df6abd 100644
--- a/pkg/techprofile/common.go
+++ b/pkg/techprofile/common.go
@@ -1,5 +1,5 @@
/*
- * Copyright 2020-present Open Networking Foundation
+ * Copyright 2020-2023 Open Networking Foundation (ONF) and the ONF Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/pkg/techprofile/config.go b/pkg/techprofile/config.go
index 17980fa..b7d3ef8 100644
--- a/pkg/techprofile/config.go
+++ b/pkg/techprofile/config.go
@@ -1,17 +1,17 @@
/*
- * Copyright 2019-present Open Networking Foundation
+* Copyright 2019-2023 Open Networking Foundation (ONF) and the ONF Contributors
- * 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
+* 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
+* 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.
+* 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 techprofile
@@ -48,7 +48,7 @@
)
-//Tech-Profile JSON String Keys
+// Tech-Profile JSON String Keys
// NOTE: Tech profile templeate JSON file should comply with below keys
const (
NAME = "name"
diff --git a/pkg/techprofile/tech_profile.go b/pkg/techprofile/tech_profile.go
index dce43ed..8ba4db7 100644
--- a/pkg/techprofile/tech_profile.go
+++ b/pkg/techprofile/tech_profile.go
@@ -1,5 +1,5 @@
/*
- * Copyright 2019-present Open Networking Foundation
+ * Copyright 2019-2023 Open Networking Foundation (ONF) and the ONF Contributors
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -1139,7 +1139,7 @@
DownstreamQueueAttributeList: dsQueueAttributeList}
}
-//isMulticastGem returns true if isMulticast attribute value of a GEM port is true; false otherwise
+// isMulticastGem returns true if isMulticast attribute value of a GEM port is true; false otherwise
func isMulticastGem(isMulticastAttrValue string) bool {
return isMulticastAttrValue != "" &&
(isMulticastAttrValue == "True" || isMulticastAttrValue == "true" || isMulticastAttrValue == "TRUE")
diff --git a/pkg/techprofile/tech_profile_if.go b/pkg/techprofile/tech_profile_if.go
index c936a56..4b44d5a 100644
--- a/pkg/techprofile/tech_profile_if.go
+++ b/pkg/techprofile/tech_profile_if.go
@@ -1,5 +1,5 @@
/*
- * Copyright 2019-present Open Networking Foundation
+ * Copyright 2019-2023 Open Networking Foundation (ONF) and the ONF Contributors
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/pkg/version/version.go b/pkg/version/version.go
index 49c0b10..be14daa 100644
--- a/pkg/version/version.go
+++ b/pkg/version/version.go
@@ -1,5 +1,5 @@
/*
- * Copyright 2019-present Open Networking Foundation
+ * Copyright 2019-2023 Open Networking Foundation (ONF) and the ONF Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.