[AETHER-255] First version of the tost-onos image and build scripts

Change-Id: I14a22158c2ad51779497bc5435af7b28b410beff
diff --git a/.gitignore b/.gitignore
index e9b0423..773bd4c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,3 @@
 *.log
-local_imports
 patch.txt
+onos/
\ No newline at end of file
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
new file mode 100644
index 0000000..e57dd2e
--- /dev/null
+++ b/CODE_OF_CONDUCT.md
@@ -0,0 +1,3 @@
+We expect all ONF employees, member companies, and participants to abide by our [Code of Conduct](https://www.opennetworking.org/wp-content/themes/onf/img/onf-code-of-conduct.pdf).
+
+If you are being harassed, notice that someone else is being harassed, or have any other concerns involving someone’s welfare, please notify a member of the ONF team or email [conduct@opennetworking.org](conduct@opennetworking.org).
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..c7b5406
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,108 @@
+#
+# Copyright 2020-present 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.
+#
+
+# set default shell
+SHELL                    := /bin/bash -e -o pipefail
+
+# Variables
+VERSION                  ?= $(shell cat ./VERSION)
+
+# Docker related
+DOCKER_REGISTRY          ?=
+DOCKER_REPOSITORY        ?=
+DOCKER_BUILD_ARGS        ?=
+DOCKER_TAG               ?= ${VERSION}
+
+# Docker labels. Only set ref and commit date if committed
+DOCKER_LABEL_VCS_URL     ?= $(shell git remote get-url $(shell git remote))
+DOCKER_LABEL_BUILD_DATE  ?= $(shell date -u "+%Y-%m-%dT%H:%M:%SZ")
+DOCKER_LABEL_COMMIT_DATE  = $(shell git show -s --format=%cd --date=iso-strict HEAD)
+
+ifeq ($(shell git ls-files --others --modified --exclude-standard 2>/dev/null | wc -l | sed -e 's/ //g'),0)
+  DOCKER_LABEL_VCS_REF = $(shell git rev-parse HEAD)
+else
+  DOCKER_LABEL_VCS_REF = $(shell git rev-parse HEAD)+dirty
+endif
+
+# TOST related
+ONOS_IMAGENAME    := ${DOCKER_REGISTRY}${DOCKER_REPOSITORY}tost-onos:${DOCKER_TAG}
+ONOS_BRANCH       ?=
+ONOS_REVIEW       ?=
+ONOS_ROOT         := $(shell pwd)/onos
+ONOS_PROFILE      := "tost"
+
+.PHONY: docker-build
+
+# This should to be the first and default target in this Makefile
+help: ## : Print this help
+	@echo "Usage: make [<target>]"
+	@echo "where available targets are:"
+	@echo
+	@grep '^[[:alnum:]_-]*:.* ##' $(MAKEFILE_LIST) \
+	| sort | awk 'BEGIN {FS=":.* ## "}; {printf "%-25s %s\n", $$1, $$2};'
+	@echo
+	@echo "Environment variables:"
+	@echo "ONOS_BRANCH		  : Use the following branch to build the image"
+	@echo "ONOS_REVIEW		  : Use the following review to build the image"
+	@echo ""
+	@echo "'onos' clones onos if does not exist in the workspace."
+	@echo "Uses current workspace unless above vars are defined."
+	@echo ""
+
+## Make targets
+
+onos: ## : Checkout onos code
+	# Clone onos if it does not exist
+	if [ ! -d "onos" ]; then \
+		git clone https://gerrit.onosproject.org/onos; \
+	fi
+# Both are not supported
+ifdef ONOS_BRANCH
+ifdef ONOS_REVIEW
+	@echo "Too many parameters. You cannot specify branch and review."
+	exit 1
+else
+	cd ${ONOS_ROOT} && git checkout ${ONOS_BRANCH}
+endif
+else
+ifdef ONOS_REVIEW
+	cd ${ONOS_ROOT} && git review -d ${ONOS_REVIEW}
+endif
+endif
+
+onos-build: onos ## : Build the tost-onos docker image
+	# Set some env variables
+	cd ${ONOS_ROOT} && \
+	. tools/build/envDefaults && \
+	docker build . -t ${ONOS_IMAGENAME} \
+	--build-arg PROFILE=${ONOS_PROFILE}
+
+onos-push: ## : Push the tost-onos docker image to an external repository
+	docker push ${ONOS_IMAGENAME}
+
+tost-build: ## : Build the tost docker image
+	# TBD
+
+tost-push: ## : Push the tost-onos docker image to an external repository
+	# TBD
+
+# Used for jenkins verification
+docker-build: onos-build tost-build ## : Builds the tost-onos and tost images
+
+clean: ## : Delete any locally copied files or artificats
+	rm -rf onos
+
+# end file
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..2fbd3d8
--- /dev/null
+++ b/README.md
@@ -0,0 +1,44 @@
+# TOST ONOS Development Build Environment
+
+Docker build environment capable of producing a version of **ONOS** and needed apps that can run with **TOST**. Typically the **ONOS** restful api would be used to include apps after **ONOS** is started.
+
+## Build
+
+We provide multiple targets for the Makefile
+
+`onos` is used to setup the workspace for the build. It is possible to build the image using a specific branch (export `ONOS_BRANCH` variable) or a specific review (export `ONOS_REVIEW` variable). It clones `onos` if does not exist in the workspace and uses current workspace unless above vars are defined.
+
+`onos-build` is used to build a specialized **Docker** image of **ONOS** that will contain only the apps needed by **TOST**. It depends on `onos-checkout` target
+
+```sh
+# Build a Docker image from the current workspace.
+make onos-build
+```
+
+```sh
+# Build a Docker image from the onos-2.2 branch.
+export ONOS_BRANCH=onos-2.2 && make onos-build
+```
+
+```sh
+# Build a Docker image from the review 123456.
+export ONOS_REVIEW=12345 && make onos-build
+```
+
+## Clean
+
+Use target `clean` to remove the local artificats generated by the tool.
+
+```sh
+make clean
+```
+
+## Push
+
+We provide multiple push-target for the Makefile. You need to first login by `docker login` command to push the image on a repository.
+
+`onos-push` will push the produced `ONOS_IMAGENAME` on the defined `DOCKER_REGISTRY` and `DOCKER_REPOSITORY`.
+
+```sh
+export DOCKER_REPOSITORY=onosproject/ make onos-push
+```
diff --git a/VERSION b/VERSION
new file mode 100644
index 0000000..f755149
--- /dev/null
+++ b/VERSION
@@ -0,0 +1 @@
+1.0.0-SNAPSHOT