[CORD-2270]
Support Ubuntu 16.04 (Xenial) for head node for mock/single scenarios
Change-Id: I906f45bdd5922056f7a8a18fcea06097223b0034
diff --git a/podconfig/rcord-controlpod.yml b/podconfig/rcord-controlpod.yml
new file mode 100644
index 0000000..a910f83
--- /dev/null
+++ b/podconfig/rcord-controlpod.yml
@@ -0,0 +1,21 @@
+---
+# Copyright 2017-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.
+
+# rcord-controlpod Pod Config
+# Creates a single-node controlpod with R-CORD services
+
+cord_scenario: controlpod
+cord_profile: rcord
+
diff --git a/scenarios/controlpod/Vagrantfile b/scenarios/controlpod/Vagrantfile
new file mode 100644
index 0000000..8af7476
--- /dev/null
+++ b/scenarios/controlpod/Vagrantfile
@@ -0,0 +1,38 @@
+# -*- mode: ruby -*-
+# vi: set ft=ruby :
+#
+# single Scenario Vagrantfile
+
+require 'yaml'
+settings = YAML.load_file('genconfig/config.yml')
+
+Vagrant.configure("2") do |config|
+
+ config.vm.box = settings["head_vagrant_box"]
+
+ # sync these folders with VM
+ config.vm.synced_folder "../../../", "/opt/cord/", create: true
+ config.vm.synced_folder "../../../../cord_profile/", "/opt/cord_profile/", create: true
+ config.vm.synced_folder "../../platform-install/credentials/", "/opt/credentials/", create: true
+
+ # set the headnode VM
+ config.vm.define "head1" do |d|
+ d.vm.hostname = "head1"
+ d.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: '*'
+ d.vm.network "private_network",
+ ip: settings['head_vm_ip']
+ d.vm.provider :virtualbox do |vb|
+ vb.memory = settings['head_vm_mem']
+ vb.cpus = settings['head_vm_cpu']
+ end
+ d.vm.provider :libvirt do |v, override|
+ v.memory = settings['head_vm_mem']
+ v.cpus = settings['head_vm_cpu']
+ override.vm.synced_folder "../../../", "/opt/cord/", type: "nfs", nfs_udp: false, nfs_version: 4
+ override.vm.synced_folder "../../../../cord_profile/", "/opt/cord_profile/", type: "nfs", nfs_udp: false, nfs_version: 4
+ override.vm.synced_folder "../../platform-install/credentials/", "/opt/credentials/", type: "nfs", nfs_udp: false, nfs_version: 4
+ end
+ end
+
+end
+
diff --git a/scenarios/controlpod/config.yml b/scenarios/controlpod/config.yml
new file mode 100644
index 0000000..d904149
--- /dev/null
+++ b/scenarios/controlpod/config.yml
@@ -0,0 +1,97 @@
+---
+# Copyright 2017-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.
+
+# controlpod scenario
+# Brings up XOS with synchronizers and ONOS
+
+# create a cord_profile dir next to the cord checkout
+config_cord_dir: "{{ ( playbook_dir ~ '/../..') | realpath }}"
+config_cord_profile_dir: "{{ ( playbook_dir ~ '/../../../cord_profile' ) | realpath }}"
+
+build_cord_dir: /opt/cord
+
+# Vagrant VM configuration
+head_vagrant_box: "generic/ubuntu1604"
+head_vm_mem: 4096
+head_vm_cpu: 8
+head_vm_ip: "192.168.46.100"
+
+physical_node_list:
+ - name: head1
+ ipv4_last_octet: 1
+ aliases:
+ - head
+
+# make targets
+build_targets:
+ - onboard-profile
+
+cord_config_prereqs:
+ - vagrant-ssh-install
+
+prep_headnode_prereqs:
+ - prep-buildnode
+
+docker_images_prereqs:
+ - prep-headnode
+
+start_xos_prereqs:
+ - deploy-onos
+
+# controlpod scenario configuration
+frontend_only: False
+use_maas: False
+use_apt_cache: False
+use_openstack: False
+create_configdirs_become: False
+xos_images: []
+
+# whitelist of images for imagebuilder to build/pull (tagged elsewhere)
+docker_image_whitelist:
+ - "xosproject/xos-base"
+ - "xosproject/xos"
+ - "xosproject/xos-client"
+ - "xosproject/xos-corebuilder"
+ - "xosproject/xos-gui"
+ - "xosproject/xos-gui-builder"
+ - "xosproject/xos-libraries"
+ - "xosproject/xos-postgres"
+ - "xosproject/xos-tosca"
+ - "xosproject/xos-ws"
+ - "xosproject/chameleon"
+ - "xosproject/xos-synchronizer-base"
+ - "gliderlabs/consul-server"
+ - "gliderlabs/registrator"
+ - "nginx"
+ - "onosproject/onos"
+ - "opencord/mavenrepo"
+ - "redis"
+ - "node"
+
+# Ansible Inventory
+inventory_groups:
+
+ config:
+ localhost:
+ ansible_connection: local
+
+ build:
+ head1:
+
+ head:
+ head1:
+
+ compute:
+
diff --git a/scripts/cord-bootstrap.sh b/scripts/cord-bootstrap.sh
index e6c0431..cbfcfc0 100755
--- a/scripts/cord-bootstrap.sh
+++ b/scripts/cord-bootstrap.sh
@@ -32,8 +32,6 @@
REPO_BRANCH="${REPO_BRANCH:-master}"
# Tool/OS versioning
-UBUNTU_VERSION="ubuntu/trusty64"
-
HOST_RELEASE=`lsb_release -c -s`
if [ ${HOST_RELEASE} = "trusty" ]; then
@@ -126,18 +124,27 @@
echo "Installing vagrant plugins if needed..."
vagrant plugin list | grep -q vagrant-libvirt || vagrant plugin install vagrant-libvirt --plugin-version ${VAGRANT_LIBVIRT_VERSION}
- vagrant plugin list | grep -q vagrant-mutate || vagrant plugin install vagrant-mutate
vagrant plugin list | grep -q vagrant-hosts || vagrant plugin install vagrant-hosts
- if ! vagrant box list | grep -q ${UBUNTU_VERSION}.*libvirt
- then
- add_box ${UBUNTU_VERSION}
+ echo "Obtaining libvirt image of Ubuntu"
+
+ if [[ $XENIAL -eq 1 ]]; then
+ add_xenial
+ else
+ add_trusty
fi
}
-function add_box() {
- vagrant box list | grep $1 | grep virtualbox || vagrant box add $1
- vagrant box list | grep $1 | grep libvirt || vagrant mutate $1 libvirt --input-provider virtualbox
+function add_trusty() {
+ UBUNTU_VERSION=${UBUNTU_VERSION:-ubuntu/trusty64}
+ vagrant plugin list | grep -q vagrant-mutate || vagrant plugin install vagrant-mutate
+ vagrant box list | grep ${UBUNTU_VERSION} | grep virtualbox || vagrant box add ${UBUNTU_VERSION}
+ vagrant box list | grep ${UBUNTU_VERSION} | grep libvirt || vagrant mutate ${UBUNTU_VERSION} libvirt --input-provider virtualbox
+}
+
+function add_xenial() {
+ UBUNTU_VERSION=${UBUNTU_VERSION:-generic/ubuntu1604}
+ vagrant box list | grep ${UBUNTU_VERSION} | grep libvirt || vagrant box add --provider libvirt ${UBUNTU_VERSION}
}
function cloudlab_setup() {
@@ -204,8 +211,9 @@
GROUP_LIST=()
DOCKER=0
VAGRANT=0
+XENIAL=0
-while getopts "dhp:t:v" opt; do
+while getopts "dhp:t:vx" opt; do
case ${opt} in
d ) DOCKER=1
GROUP_LIST+=("docker")
@@ -216,6 +224,7 @@
echo " -p <project:change/revision> Download a patch from gerrit. Can be repeated."
echo " -t <target> Run '$MAKECMD <target>' in cord/build/. Can be repeated."
echo " -v Install Vagrant for mock/virtual/physical scenarios."
+ echo " -x Use Xenial (16.04) in Vagrant VM's."
exit 0
;;
p ) GERRIT_PATCHES+=("$OPTARG")
@@ -225,6 +234,8 @@
v ) VAGRANT=1
GROUP_LIST+=("libvirtd")
;;
+ x ) XENIAL=1
+ ;;
\? ) echo "Invalid option: -$OPTARG"
exit 1
;;