summaryrefslogtreecommitdiffstats
path: root/bootstrap/vagrant-onap
diff options
context:
space:
mode:
Diffstat (limited to 'bootstrap/vagrant-onap')
-rw-r--r--bootstrap/vagrant-onap/.gitignore4
-rw-r--r--bootstrap/vagrant-onap/CONTRIBUTING.md25
-rw-r--r--bootstrap/vagrant-onap/LICENSE201
-rw-r--r--bootstrap/vagrant-onap/README.md90
-rw-r--r--bootstrap/vagrant-onap/Vagrantfile163
-rw-r--r--bootstrap/vagrant-onap/doc/source/features/features.rst13
-rw-r--r--bootstrap/vagrant-onap/doc/source/features/openstack.rst89
-rw-r--r--bootstrap/vagrant-onap/doc/source/index.rst21
-rwxr-xr-xbootstrap/vagrant-onap/lib/_composed_functions46
-rwxr-xr-xbootstrap/vagrant-onap/lib/_onap_functions87
-rwxr-xr-xbootstrap/vagrant-onap/lib/aai46
-rwxr-xr-xbootstrap/vagrant-onap/lib/appc31
-rwxr-xr-xbootstrap/vagrant-onap/lib/asserts36
-rwxr-xr-xbootstrap/vagrant-onap/lib/commons17
-rwxr-xr-xbootstrap/vagrant-onap/lib/dcae40
-rw-r--r--bootstrap/vagrant-onap/lib/files/settings.template281
-rwxr-xr-xbootstrap/vagrant-onap/lib/functions204
-rwxr-xr-xbootstrap/vagrant-onap/lib/mr15
-rwxr-xr-xbootstrap/vagrant-onap/lib/mso51
-rwxr-xr-xbootstrap/vagrant-onap/lib/policy49
-rwxr-xr-xbootstrap/vagrant-onap/lib/portal46
-rwxr-xr-xbootstrap/vagrant-onap/lib/robot2
-rwxr-xr-xbootstrap/vagrant-onap/lib/sdc40
-rwxr-xr-xbootstrap/vagrant-onap/lib/sdnc74
-rwxr-xr-xbootstrap/vagrant-onap/lib/vfc58
-rwxr-xr-xbootstrap/vagrant-onap/lib/vid41
-rwxr-xr-xbootstrap/vagrant-onap/postinstall.sh1
-rw-r--r--bootstrap/vagrant-onap/tests/_test_base24
-rw-r--r--bootstrap/vagrant-onap/tests/test_functions174
-rw-r--r--bootstrap/vagrant-onap/tests/test_mr24
-rw-r--r--bootstrap/vagrant-onap/tests/test_mso48
-rw-r--r--bootstrap/vagrant-onap/tests/test_sdnc45
-rw-r--r--bootstrap/vagrant-onap/tests/test_vfc20
-rwxr-xr-xbootstrap/vagrant-onap/tools/get_repos.sh41
-rwxr-xr-xbootstrap/vagrant-onap/tools/run.sh17
-rwxr-xr-xbootstrap/vagrant-onap/tools/setup_openstack.sh23
-rw-r--r--bootstrap/vagrant-onap/tox.ini7
-rwxr-xr-xbootstrap/vagrant-onap/unit_testing.sh15
38 files changed, 2007 insertions, 202 deletions
diff --git a/bootstrap/vagrant-onap/.gitignore b/bootstrap/vagrant-onap/.gitignore
index 130fcae06..3d0c81cec 100644
--- a/bootstrap/vagrant-onap/.gitignore
+++ b/bootstrap/vagrant-onap/.gitignore
@@ -2,3 +2,7 @@
*.swp
.tox/
opt/
+*.vdi
+lib/files/proxyrc
+lib/files/sources.list
+openrc
diff --git a/bootstrap/vagrant-onap/CONTRIBUTING.md b/bootstrap/vagrant-onap/CONTRIBUTING.md
new file mode 100644
index 000000000..e473927e4
--- /dev/null
+++ b/bootstrap/vagrant-onap/CONTRIBUTING.md
@@ -0,0 +1,25 @@
+First off, thank you for considering contributing to ONAP on Vagrant project.
+It's people like you that make it such a great tool.
+
+ONAP on Vagrant is an open source project and we love to receive contributions
+from our community — you! There are many ways to contribute, from writing
+tutorials or blog posts, improving the documentation, submitting bug reports and
+feature requests or writing code which can be incorporated into ONAP on Vagrant
+itself.
+
+Unit Testing
+============
+
+The **_tests_** folder contains ~~scripts~~ _test suites_ that ensure the proper
+implementation of the _functions_ created on **_lib_** folder. In order to
+execute the Unit Tests defined for this project, you must run the following
+command:
+
+ $ ./tools/run.sh testing [test_suite] [function]
+
+Examples
+--------
+
+ $ ./tools/run.sh testing # Executes all the Unit Tests
+ $ ./tools/run.sh testing functions # Executes all the Unit Tests of Functions Test Suite
+ $ ./tools/run.sh testing functions install_maven # Executes the install_maven Unit Test of Functions Test Suite
diff --git a/bootstrap/vagrant-onap/LICENSE b/bootstrap/vagrant-onap/LICENSE
new file mode 100644
index 000000000..8dada3eda
--- /dev/null
+++ b/bootstrap/vagrant-onap/LICENSE
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "{}"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright {yyyy} {name of copyright owner}
+
+ 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.
diff --git a/bootstrap/vagrant-onap/README.md b/bootstrap/vagrant-onap/README.md
index 86a5abd90..e25fa35f8 100644
--- a/bootstrap/vagrant-onap/README.md
+++ b/bootstrap/vagrant-onap/README.md
@@ -1,20 +1,88 @@
-# Vagrant ONAP
+# ONAP on Vagrant
[![Build Status](https://api.travis-ci.org/electrocucaracha/vagrant-onap.svg?branch=master)](https://api.travis-ci.org/electrocucaracha/vagrant-onap)
-This vagrant project pretends to collect information about a way to deploy [ONAP project](https://www.onap.org/) into a development environment. It was created only for didactic purposes.
+This vagrant project pretends to collect information about a way to deploy
+and build [ONAP project](https://www.onap.org/) into a development environment.
-## Requirements:
+### Problem Being Solved
-* Vagrant
-* VirtualBox or Libvirt
+* Reduce the barrier of entry to allow new ONAP developers to ramp up on to
+active development quickly
+* Reduce the cost to the community in responding to simple environment setup
+questions faced by new developers
-## Steps for execution:
+---
- git clone https://github.com/electrocucaracha/vagrant-onap.git
- cd vagrant-onap
- vagrant up
+| Component | Requirement |
+|------------------|---------------------------------------|
+| Vagrant | >= 1.8.6 |
+| Hypervisor | VirtualBox or Libvirt |
+| Operating System | Linux, Mac OS or Windows(In Progress) |
+| Hard Disk | > 8 GB of free disk |
+| Memory | > 12 GB |
-## Destroy:
+---
- vagrant destroy
+## Execution:
+
+#### deploying a single application
+
+* Windows
+
+ C:\> vagrant up <app_name>
+
+* Linux or Mac OS
+
+ $ ./tools/run.sh <app_name>
+
+current options include:
+
+| app_name | description |
+|:---------:|-------------------------------------|
+| aai | Active and Available Inventory |
+| appc | Application Controller |
+| dcae | Data Collection Analytics & Events |
+| mr | Message Router |
+| mso | Master Service Orchestrator |
+| policy | Policy |
+| portal | Portal |
+| robot | Robot |
+| sdc | Service Design & Creation |
+| sdnc | Software Defined Network Controller |
+| vid | Virtual Infrastructure Development |
+| vfc | Virtual Function Controller (WIP) |
+
+#### setting up proxy in case you are behind a firewall
+
+add http_proxy and https_proxy to your environment variables
+
+Linux or Mac
+
+ $ export http_proxy=<proxy>
+ $ export https_proxy=<proxy>
+ $ export no_proxy=<no_proxy_urls>
+
+Windows
+
+ C:\> setx http_proxy <proxy>
+ C:\> setx https_proxy <proxy>
+ C:\> setx no_proxy <no_proxy_urls>
+
+##### choosing vagrant provider
+force VirtualBox provider
+
+ C:\> vagrant up --provider=virtualbox
+
+setup the default provider on Windows
+
+ C:\> setx VAGRANT_DEFAULT_PROVIDER=virtualbox
+
+## Contributing
+
+Bug reports and patches are most welcome.
+See the [contribution guidelines](CONTRIBUTING.md).
+
+## License
+
+Apache-2.0
diff --git a/bootstrap/vagrant-onap/Vagrantfile b/bootstrap/vagrant-onap/Vagrantfile
index 19c63cfe8..a46afd5fe 100644
--- a/bootstrap/vagrant-onap/Vagrantfile
+++ b/bootstrap/vagrant-onap/Vagrantfile
@@ -24,9 +24,40 @@ conf = {
'nexus_repo_root' => 'https://nexus.onap.org',
'nexus_url_snapshot' => 'https://nexus.onap.org/content/repositories/snapshots',
'gitlab_branch' => 'master',
- 'build_image' => 'True'
+ 'build_image' => 'True',
+ 'odl_version' => '0.5.3-Boron-SR3',
+ 'compile_repo' => 'False'
}
+Vagrant.require_version ">= 1.8.6"
+
+# Determine the OS for the host computer
+module OS
+ def OS.windows?
+ (/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil
+ end
+
+ def OS.mac?
+ (/darwin/ =~ RUBY_PLATFORM) != nil
+ end
+
+ def OS.unix?
+ !OS.windows?
+ end
+
+ def OS.linux?
+ OS.unix? and not OS.mac?
+ end
+end
+
+if OS.windows?
+ puts "Vagrant launched from windows. This configuration has not fully tested."
+end
+
+# Determine the provider used
+provider = (ENV['VAGRANT_DEFAULT_PROVIDER'] || :virtualbox).to_sym
+puts "Using #{provider} provider"
+
vd_conf = ENV.fetch('VD_CONF', 'etc/settings.yaml')
if File.exist?(vd_conf)
require 'yaml'
@@ -49,20 +80,48 @@ Vagrant.configure("2") do |config|
config.proxy.no_proxy = ENV['no_proxy']
end
- #config.vm.box = 'sputnik13/trusty64'
config.vm.box = 'ubuntu/trusty64'
+ if provider == :libvirt
+ config.vm.box = 'sputnik13/trusty64'
+ end
+ if provider == :openstack
+ config.vm.box = nil
+ config.ssh.username = 'ubuntu'
+ if not Vagrant.has_plugin?('vagrant-openstack-provider')
+ system 'vagrant plugin install vagrant-openstack-provider'
+ raise 'vagrant-openstack-provider was installed but it requires to execute again'
+ end
+ end
#config.vm.provision "docker"
config.vm.synced_folder './opt', '/opt/', create: true
config.vm.synced_folder './lib', '/var/onap/', create: true
config.vm.synced_folder '~/.m2', '/root/.m2/', create: true
- config.vm.provider "virtualbox" do |v|
+ config.vm.provider :virtualbox do |v|
v.customize ["modifyvm", :id, "--memory", 4 * 1024]
end
- config.vm.provider "libvirt" do |v|
+ config.vm.provider :libvirt do |v|
v.memory = 4 * 1024
v.nested = true
end
+ config.vm.provider :openstack do |v|
+
+ v.openstack_auth_url = ENV.fetch('OS_AUTH_URL', '')
+ v.tenant_name = ENV.fetch('OS_TENANT_NAME', '')
+ v.username = ENV.fetch('OS_USERNAME', '')
+ v.password = ENV.fetch('OS_PASSWORD', '')
+ v.region = ENV.fetch('OS_REGION_NAME', '')
+ v.identity_api_version = ENV.fetch('OS_IDENTITY_API_VERSION', '')
+ v.domain_name = ENV.fetch('OS_PROJECT_DOMAIN_ID', '')
+ v.project_name = ENV.fetch('OS_PROJECT_NAME', '')
+
+ v.floating_ip_pool = ENV.fetch('OS_FLOATING_IP_POOL', '')
+ v.floating_ip_pool_always_allocate = (ENV['OS_FLOATING_IP_ALWAYS_ALLOCATE'] == 'true')
+ v.image = ENV.fetch('OS_IMAGE', '')
+ v.security_groups = [ENV.fetch('OS_SEC_GROUP', '')]
+ v.flavor = 'm1.medium'
+ v.networks = ENV.fetch('OS_NETWORK', '')
+ end
case deploy_mode
@@ -83,9 +142,13 @@ Vagrant.configure("2") do |config|
v.nested = true
v.storage :file, path: sdc_volume, bus: 'sata', device: 'vdb', size: '2G'
end
+ all_in_one.vm.provider "openstack" do |v|
+ v.server_name = 'all-in-one'
+ v.flavor = 'm1.xlarge'
+ end
all_in_one.vm.provision 'shell' do |s|
s.path = 'postinstall.sh'
- s.args = ['mr', 'sdc', 'aai', 'mso', 'robot', 'vid', 'sdnc', 'portal', 'dcae', 'policy', 'appc']
+ s.args = ['mr', 'sdc', 'aai', 'mso', 'robot', 'vid', 'sdnc', 'portal', 'dcae', 'policy', 'appc', 'vfc']
s.env = conf
end
end
@@ -102,16 +165,23 @@ Vagrant.configure("2") do |config|
v.memory = 1 * 1024
v.nested = true
end
+ dns.vm.provider "openstack" do |v|
+ v.server_name = 'dns'
+ v.flavor = 'm1.small'
+ end
dns.vm.provision 'shell' do |s|
s.path = 'postinstall.sh'
s.env = conf
end
end
- config.vm.define :message_router do |message_router|
- message_router.vm.hostname = 'message-router'
- message_router.vm.network :private_network, ip: '192.168.50.4'
- message_router.vm.provision 'shell' do |s|
+ config.vm.define :mr do |mr|
+ mr.vm.hostname = 'message-router'
+ mr.vm.network :private_network, ip: '192.168.50.4'
+ mr.vm.provider "openstack" do |v|
+ v.server_name = 'message-router'
+ end
+ mr.vm.provision 'shell' do |s|
s.path = 'postinstall.sh'
s.args = ['mr']
s.env = conf
@@ -122,17 +192,17 @@ Vagrant.configure("2") do |config|
sdc.vm.hostname = 'sdc'
sdc.vm.network :private_network, ip: '192.168.50.5'
sdc.vm.provider "virtualbox" do |v|
- v.customize ["modifyvm", :id, "--memory", 4 * 1024]
unless File.exist?(sdc_volume)
v.customize ['createhd', '--filename', sdc_volume, '--size', 20 * 1024]
end
v.customize ['storageattach', :id, '--storagectl', 'SATAController', '--port', 1, '--device', 0, '--type', 'hdd', '--medium', sdc_volume]
end
sdc.vm.provider "libvirt" do |v|
- v.memory = 4 * 1024
- v.nested = true
v.storage :file, path: sdc_volume, bus: 'sata', device: 'vdb', size: '2G'
end
+ sdc.vm.provider "openstack" do |v|
+ v.server_name = 'sdc'
+ end
sdc.vm.provision 'shell' do |s|
s.path = 'postinstall.sh'
s.args = ['sdc']
@@ -143,6 +213,9 @@ Vagrant.configure("2") do |config|
config.vm.define :aai do |aai|
aai.vm.hostname = 'aai'
aai.vm.network :private_network, ip: '192.168.50.6'
+ aai.vm.provider "openstack" do |v|
+ v.server_name = 'aai'
+ end
aai.vm.provision 'shell' do |s|
s.path = 'postinstall.sh'
s.args = ['aai']
@@ -151,8 +224,11 @@ Vagrant.configure("2") do |config|
end
config.vm.define :mso do |mso|
- mso.vm.hostname = 'mso-server'
+ mso.vm.hostname = 'mso'
mso.vm.network :private_network, ip: '192.168.50.7'
+ mso.vm.provider "openstack" do |v|
+ v.server_name = 'mso'
+ end
mso.vm.provision 'shell' do |s|
s.path = 'postinstall.sh'
s.args = ['mso']
@@ -163,6 +239,9 @@ Vagrant.configure("2") do |config|
config.vm.define :robot do |robot|
robot.vm.hostname = 'robot'
robot.vm.network :private_network, ip: '192.168.50.8'
+ robot.vm.provider "openstack" do |v|
+ v.server_name = 'robot'
+ end
robot.vm.provision 'shell' do |s|
s.path = 'postinstall.sh'
s.args = ['robot']
@@ -173,6 +252,9 @@ Vagrant.configure("2") do |config|
config.vm.define :vid do |vid|
vid.vm.hostname = 'vid'
vid.vm.network :private_network, ip: '192.168.50.9'
+ vid.vm.provider "openstack" do |v|
+ v.server_name = 'vid'
+ end
vid.vm.provision 'shell' do |s|
s.path = 'postinstall.sh'
s.args = ['vid']
@@ -183,6 +265,9 @@ Vagrant.configure("2") do |config|
config.vm.define :sdnc do |sdnc|
sdnc.vm.hostname = 'sdnc'
sdnc.vm.network :private_network, ip: '192.168.50.10'
+ sdnc.vm.provider "openstack" do |v|
+ v.server_name = 'sdnc'
+ end
sdnc.vm.provision 'shell' do |s|
s.path = 'postinstall.sh'
s.args = ['sdnc']
@@ -193,6 +278,9 @@ Vagrant.configure("2") do |config|
config.vm.define :portal do |portal|
portal.vm.hostname = 'portal'
portal.vm.network :private_network, ip: '192.168.50.11'
+ portal.vm.provider "openstack" do |v|
+ v.server_name = 'portal'
+ end
portal.vm.provision 'shell' do |s|
s.path = 'postinstall.sh'
s.args = ['portal']
@@ -203,6 +291,9 @@ Vagrant.configure("2") do |config|
config.vm.define :dcae do |dcae|
dcae.vm.hostname = 'dcae'
dcae.vm.network :private_network, ip: '192.168.50.12'
+ dcae.vm.provider "openstack" do |v|
+ v.server_name = 'dcae'
+ end
dcae.vm.provision 'shell' do |s|
s.path = 'postinstall.sh'
s.args = ['dcae']
@@ -213,6 +304,9 @@ Vagrant.configure("2") do |config|
config.vm.define :policy do |policy|
policy.vm.hostname = 'policy'
policy.vm.network :private_network, ip: '192.168.50.13'
+ policy.vm.provider "openstack" do |v|
+ v.server_name = 'policy'
+ end
policy.vm.provision 'shell' do |s|
s.path = 'postinstall.sh'
s.args = ['policy']
@@ -223,6 +317,9 @@ Vagrant.configure("2") do |config|
config.vm.define :appc do |appc|
appc.vm.hostname = 'appc'
appc.vm.network :private_network, ip: '192.168.50.14'
+ appc.vm.provider "openstack" do |v|
+ v.server_name = 'appc'
+ end
appc.vm.provision 'shell' do |s|
s.path = 'postinstall.sh'
s.args = ['appc']
@@ -230,5 +327,45 @@ Vagrant.configure("2") do |config|
end
end
+ config.vm.define :vfc do |vfc|
+ vfc.vm.hostname = 'vfc'
+ vfc.vm.network :private_network, ip: '192.168.50.15'
+ vfc.vm.provider "openstack" do |v|
+ v.server_name = 'vfc'
+ end
+ vfc.vm.provision 'shell' do |s|
+ s.path = 'postinstall.sh'
+ s.args = ['vfc']
+ s.env = conf
+ end
+ end
+
+ when 'testing'
+
+ config.vm.define :testing do |testing|
+ test_suite = ENV.fetch('TEST_SUITE', '*')
+ test_case = ENV.fetch('TEST_CASE', '*')
+
+ testing.vm.hostname = 'testing'
+ testing.vm.network :private_network, ip: '192.168.50.3'
+ testing.vm.synced_folder './tests', '/var/onap_tests/', create: true
+ testing.vm.provider "virtualbox" do |v|
+ v.customize ["modifyvm", :id, "--memory", 2 * 1024]
+ end
+ testing.vm.provider "libvirt" do |v|
+ v.memory = 2 * 1024
+ v.nested = true
+ end
+ testing.vm.provider "openstack" do |v|
+ v.server_name = 'testing'
+ v.flavor = 'm1.small'
+ end
+ testing.vm.provision 'shell' do |s|
+ s.path = 'unit_testing.sh'
+ s.args = [test_suite, test_case]
+ s.env = conf
+ end
+ end
+
end
end
diff --git a/bootstrap/vagrant-onap/doc/source/features/features.rst b/bootstrap/vagrant-onap/doc/source/features/features.rst
new file mode 100644
index 000000000..0b06ba04c
--- /dev/null
+++ b/bootstrap/vagrant-onap/doc/source/features/features.rst
@@ -0,0 +1,13 @@
+.. _features:
+
+=================
+Advanced features
+=================
+
+.. toctree::
+ :maxdepth: 1
+
+ openstack.rst
+
+This chapter explains how to use ONAP on Vagrant Advanced features
+like different providers.
diff --git a/bootstrap/vagrant-onap/doc/source/features/openstack.rst b/bootstrap/vagrant-onap/doc/source/features/openstack.rst
new file mode 100644
index 000000000..f44bc62f9
--- /dev/null
+++ b/bootstrap/vagrant-onap/doc/source/features/openstack.rst
@@ -0,0 +1,89 @@
+==================
+OpenStack Provider
+==================
+
+It's possible to use Vagrant to provision VMs on OpenStack using the
+`Vagrant OpenStack Cloud Provider <https://github.com/ggiamarchi/vagrant-openstack-provider/>`.
+The only requirement for the Cloud provider is to have an Ubuntu Cloud
+image accesible to your tenant and a Security Rule that allows to do
+SSH into the instance.
+
+Environment variables
+---------------------
+
+The usage of environment variables in OpenStack command-line clients
+is to avoid repeating some values. These variables have *OS_* as
+prefix. This provider will use them for authentication to Keystone
+service.
+
+.. code-block:: console
+
+ export OS_AUTH_URL=http://<keystone_ip>:5000/v3
+ export OS_TENANT_NAME=<project_or_tenant_name>
+ export OS_PROJECT_NAME=<project_or_tenant_name>
+ export OS_USERNAME=<openstack_username>
+ export OS_PASSWORD=<openstack_password>
+ export OS_REGION_NAME=<openstack_region_name>
+ export OS_IDENTITY_API_VERSION=<keystone_version_number>
+ export OS_PROJECT_DOMAIN_ID=<openstack_domain_name>
+
+.. end
+
+OpenStack Vagrant provider needs additional information about the
+name of the image to be used and the networking where the instance
+will be provisioned. That information can be passed using the
+following variables
+
+.. code-block:: console
+
+ export OS_IMAGE=<ubuntu_cloud_image_name>
+ export OS_NETWORK=<neutron_private_network>
+ export OS_FLOATING_IP_POOL=<neutron_floating_ip_pool>
+ export OS_SEC_GROUP=<onap-ssh-secgroup>
+
+.. end
+
+Tenant setup
+------------
+
+The *tools/setup_openstack.sh* script can be useful to get an idea
+of the process to setup the OpenStack environment with the necessary
+requirements. This script depends on the Environment Variables
+explained previously.
+
+----
+
+Devstack
+--------
+
+It's possible to use this plugin to provision instances on
+`Devstack <https://docs.openstack.org/devstack/latest/>`. This is
+an example of the *local.conf* file that can be used as input
+for Devstack
+
+.. path local.conf
+.. code-block:: ini
+
+ [[local|localrc]]
+ ADMIN_PASSWORD=<password>
+ DATABASE_PASSWORD=<password>
+ RABBIT_PASSWORD=<password>
+ SERVICE_PASSWORD=<password>
+ SERVICE_TOKEN=<token>
+
+ # Used to only upload the Ubuntu Cloud Image
+ DOWNLOAD_DEFAULT_IMAGES=False
+ IMAGE_URLS+="http://cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-amd64-disk1.img"
+
+ # (Optional) These values helps to improve the experience deploying and using Devstack
+ GIT_BASE=https://git.openstack.org
+ FORCE_CONFIG_DRIVE="True"
+ disable_service tempest
+
+.. end
+
+.. note::
+
+ There is a validation that checks if the
+ *vagrant-openstack-provider* plugin is installed raising an error
+ for those cases when it isn't.
diff --git a/bootstrap/vagrant-onap/doc/source/index.rst b/bootstrap/vagrant-onap/doc/source/index.rst
new file mode 100644
index 000000000..88950a205
--- /dev/null
+++ b/bootstrap/vagrant-onap/doc/source/index.rst
@@ -0,0 +1,21 @@
+ONAP on Vagrant tool
+====================
+
+This project collects instructions to setup a development environment
+using different providers like VirtualBox, Libvirt or OpenStack.
+
+.. seealso::
+
+ You may want to read the `Bootstrap documentation`__ to get an idea of the
+ concepts.
+
+ __ https://wiki.onap.org/display/DW/ONAP+on+Vagrant
+
+Advanced features
+-----------------
+
+.. toctree::
+ :maxdepth: 2
+
+ Advanced Features <features/index>
+
diff --git a/bootstrap/vagrant-onap/lib/_composed_functions b/bootstrap/vagrant-onap/lib/_composed_functions
new file mode 100755
index 000000000..f46499766
--- /dev/null
+++ b/bootstrap/vagrant-onap/lib/_composed_functions
@@ -0,0 +1,46 @@
+#!/bin/bash
+
+# compile_src() - Function that compiles the java source code thru maven
+function compile_src {
+ local src_folder=$1
+ pushd $src_folder
+ if [ -f pom.xml ]; then
+ install_maven
+ mvn clean install -U -DskipTests=true -Dmaven.test.skip=true -Dmaven.javadoc.skip=true -Dadditionalparam=-Xdoclint:none
+ fi
+ popd
+}
+
+# build_docker_image() - Build Docker container image from source code
+function build_docker_image {
+ local src_folder=$1
+ local profile=$2
+ install_maven
+ install_docker
+ pushd $src_folder
+
+ # Cleanup external repo
+ sed -i 's|${docker.push.registry}/||g' pom.xml
+ local mvn_docker="mvn clean package docker:build"
+ if [ $profile ]; then
+ mvn_docker+=" -P $profile"
+ fi
+ if [ $http_proxy ]; then
+ if ! grep -ql "docker.buildArg.http_proxy" pom.xml ; then
+ mvn_docker+=" -Ddocker.buildArg.http_proxy=$http_proxy"
+ fi
+ if ! grep -ql "docker.buildArg.HTTP_PROXY" pom.xml ; then
+ mvn_docker+=" -Ddocker.buildArg.HTTP_PROXY=$http_proxy"
+ fi
+ fi
+ if [ $https_proxy ]; then
+ if ! grep -ql "docker.buildArg.https_proxy" pom.xml ; then
+ mvn_docker+=" -Ddocker.buildArg.https_proxy=$https_proxy"
+ fi
+ if ! grep -ql "docker.buildArg.HTTPS_PROXY" pom.xml ; then
+ mvn_docker+=" -Ddocker.buildArg.HTTPS_PROXY=$https_proxy"
+ fi
+ fi
+ eval $mvn_docker
+ popd
+}
diff --git a/bootstrap/vagrant-onap/lib/_onap_functions b/bootstrap/vagrant-onap/lib/_onap_functions
new file mode 100755
index 000000000..0d421552f
--- /dev/null
+++ b/bootstrap/vagrant-onap/lib/_onap_functions
@@ -0,0 +1,87 @@
+#!/bin/bash
+
+# create_configuration_files() - Store credentials in files
+function create_configuration_files {
+ mkdir -p /opt/config
+ echo $nexus_docker_repo > /opt/config/nexus_docker_repo.txt
+ echo $nexus_username > /opt/config/nexus_username.txt
+ echo $nexus_password > /opt/config/nexus_password.txt
+ echo $openstack_username > /opt/config/openstack_username.txt
+ echo $openstack_tenant_id > /opt/config/tenant_id.txt
+ echo $dmaap_topic > /opt/config/dmaap_topic.txt
+ echo $docker_version > /opt/config/docker_version.txt
+}
+
+# TODO(electrocucaracha): Determine how to use this behind a proxy
+# docker_openecomp_login() - Login to OpenECOMP Docker Hub
+function docker_openecomp_login {
+ install_docker
+ docker login -u $nexus_username -p $nexus_password $nexus_docker_repo
+}
+
+# pull_openecomp_image() - Pull Docker container image from a Docker Registry Hub
+function pull_openecomp_image {
+ local image=$1
+ local tag=$2
+ docker_openecomp_login
+ pull_docker_image $nexus_docker_repo/openecomp/${image}:$docker_version $tag
+ docker logout
+}
+
+# configure_bind()- Configure bind utils
+function configure_bind {
+ _install_bind
+ mkdir /etc/bind/zones
+
+ curl -k $nexus_repo/org.openecomp.demo/boot/$artifacts_version/db_simpledemo_openecomp_org -o /etc/bind/zones/db.simpledemo.openecomp.org
+ curl -k $nexus_repo/org.openecomp.demo/boot/$artifacts_version/named.conf.options -o /etc/bind/named.conf.options
+ curl -k $nexus_repo/org.openecomp.demo/boot/$artifacts_version/named.conf.local -o /etc/bind/named.conf.local
+
+ modprobe ip_gre
+ sed -i "s/OPTIONS=.*/OPTIONS=\"-4 -u bind\"/g" /etc/default/bind9
+ service bind9 restart
+}
+
+# _configure_maven() - This function creates a maven configuration file in case that doesn't exist
+function _configure_maven {
+ local proxies_start=" <!--"
+ local proxies=" \|"
+ local proxies_end=" \|-->"
+ local mvn_http=""
+ local mvn_https=""
+
+ if [ $http_proxy ] | [ $https_proxy ]; then
+ proxies_start=" "
+ proxies=" "
+ proxies_end=" "
+ if [ $http_proxy ]; then
+ proxy_domain=`echo $http_proxy | awk -F/ '{print $3}' | awk -F: '{print $1}'`
+ proxy_port=`echo $http_proxy | awk -F/ '{print $3}' | awk -F: '{print $2}'`
+ mvn_http="<proxy>\n <id>http</id>\n <active>true</active>\n <protocol>http</protocol>\n <host>$proxy_domain</host>\n <port>$proxy_port</port>\n <nonProxyHosts>${no_proxy}</nonProxyHosts>\n </proxy>"
+ fi
+ if [ $https_proxy ]; then
+ proxy_domain=`echo $https_proxy | awk -F/ '{print $3}' | awk -F: '{print $1}'`
+ proxy_port=`echo $https_proxy | awk -F/ '{print $3}' | awk -F: '{print $2}'`
+ mvn_https="<proxy>\n <id>https</id>\n <active>true</active>\n <protocol>https</protocol>\n <host>$proxy_domain</host>\n <port>$proxy_port</port>\n <nonProxyHosts>${no_proxy}</nonProxyHosts>\n </proxy>"
+ fi
+ fi
+
+ if [ ! -f $mvn_conf_file ]; then
+ cp /var/onap/files/settings.template $mvn_conf_file
+ sed -e "
+ s|%PROXIES_START%|$proxies_start|g;
+ s|%PROXIES%|$proxies|g;
+ s|%HTTP_PROXY%|$mvn_http|g;
+ s|%HTTPS_PROXY%|$mvn_https|g;
+ s|%PROXIES_END%|$proxies_end|g
+ " -i $mvn_conf_file
+ fi
+}
+
+# configure_service() - Download and configure a specific service in upstart
+function configure_service {
+ local service_script=$1
+ curl -k $nexus_repo/org.openecomp.demo/boot/$artifacts_version/$service_script -o /etc/init.d/$service_script
+ chmod +x /etc/init.d/$service_script
+ update-rc.d $service_script defaults
+}
diff --git a/bootstrap/vagrant-onap/lib/aai b/bootstrap/vagrant-onap/lib/aai
index 1cb9e37e9..d048c2b8c 100755
--- a/bootstrap/vagrant-onap/lib/aai
+++ b/bootstrap/vagrant-onap/lib/aai
@@ -3,13 +3,31 @@
set -o xtrace
source /var/onap/functions
+source /var/onap/asserts
hbase_version=1.2.3
+# clone_all_aai_repos() - Function that clones AAI source repo.
+function clone_all_aai_repos {
+ local src_folder=/opt/aai
+
+ for dirc in aai-common aai-config aai-data aai-service data-router logging-service model-loader resources rest-client router-core search-data-service sparky-be sparky-fe test-config traversal; do
+ clone_repo aai/$dirc $src_folder/$dirc
+ done
+}
+
+# compile_all_aai_repos() - Function that compiles AAI source repo.
+function compile_all_aai_repos {
+ local src_folder=/opt/aai
+
+ for dirc in aai-common aai-config aai-data aai-service data-router logging-service model-loader resources rest-client router-core search-data-service sparky-be sparky-fe test-config traversal; do
+ compile_src $src_folder/$dirc
+ done
+}
+
# pull_hbase_image() - Pull HBase container image from a Docker Registry Hub
function pull_hbase_image {
- is_package_installed docker-ce || install_docker
- docker login -u $nexus_username -p $nexus_password $nexus_docker_repo
+ docker_openecomp_login
docker pull $nexus_docker_repo/aaidocker/aai-hbase-${hbase_version}
}
@@ -22,6 +40,7 @@ function install_hbase {
# install_ajsc() - Install ASJC Java service container
function install_ajsc_aai {
+ local src_folder=/opt/aai/aai-service
cat <<EOL > /etc/ajsc-aai.conf
AAI_REPO_PATH=r/aai
AAI_CHEF_ENV=simpledemo
@@ -29,7 +48,15 @@ AAI_CHEF_LOC=/var/chef/aai-data/environments
docker_gitbranch=master
EOL
docker rm -f aai-service
- pull_openecomp_image ajsc-aai
+ if [[ "$build_image" == "True" ]]; then
+ clone_repo aai/aai-service $src_folder
+ build_docker_image $src_folder/ajsc-aai
+ else
+ pull_openecomp_image ajsc-aai
+ fi
+
+ asserts_image openecomp/ajsc-aai
+
docker run --env-file /etc/ajsc-aai.conf --name=aai-service --net=host -v /etc/ssl/certs/ca-certificates.crt:/etc/ssl/certs/ca-certificates.crt -it -d $nexus_docker_repo/openecomp/ajsc-aai:$docker_version
}
@@ -50,15 +77,19 @@ APP_SERVER_KEYSTORE_PASSWORD=OBF:1i9a1u2a1unz1lr61wn51wn11lss1unz1u301i6o
APP_SERVER_AUTH_PASSWORD=${APP_PASSWORD:-OBF:1qvu1v2h1sov1sar1wfw1j7j1wg21saj1sov1v1x1qxw}
EOL
+ ARGS=""
+
docker rm -f model-loader-service
if [[ "$build_image" == "True" ]]; then
clone_repo aai/model-loader $src_folder
build_docker_image $src_folder
- docker run --env-file /etc/model-loader.conf model-loader
+ ARGS+="--env-file /etc/model-loader.conf model-loader"
else
pull_openecomp_image model-loader
- docker run --name=model-loader-service -it -d --env-file /etc/model-loader.conf $nexus_docker_repo/openecomp/model-loader:$docker_version
+ ARGS+="--name=model-loader-service -it -d --env-file /etc/model-loader.conf $nexus_docker_repo/openecomp/model-loader:$docker_version"
fi
+ asserts_image openecomp/model-loader
+ docker run ${ARGS}
}
# wait_for_sdc() - Function that determines if SDC is up and running
@@ -81,6 +112,11 @@ function init_aai {
mkdir -p /opt/openecomp/aai/logs
mkdir -p /opt/openecomp/aai/data
+ clone_all_aai_repos
+ if [[ "$compile_repo" == "True" ]]; then
+ compile_all_aai_repos
+ fi
+
install_hbase
# Wait 3 minutes before instantiating the A&AI container
diff --git a/bootstrap/vagrant-onap/lib/appc b/bootstrap/vagrant-onap/lib/appc
index ffec841f4..8ad73561f 100755
--- a/bootstrap/vagrant-onap/lib/appc
+++ b/bootstrap/vagrant-onap/lib/appc
@@ -3,19 +3,44 @@
set -o xtrace
source /var/onap/sdnc
+source /var/onap/asserts
+
+# clone_all_appc_repos() - Function that clones APPC source repo.
+function clone_all_appc_repos {
+ local src_folder=/opt/appc
+
+ clone_repo appc $src_folder
+ clone_repo appc/deployment $src_folder/deployment
+}
+
+# compile_all_appc_repos() - Function that compiles APPC source repo.
+function compile_all_appc_repos {
+ local src_folder=/opt/appc
+
+ compile_src $src_folder
+ compile_src $src_folder/deployment
+}
# install_appc() - Function that clones and installs the APPC services from source code
function install_appc {
+ install_package unzip
local src_folder=/opt/appc
- clone_repo appc/deployment $src_folder
+
+ clone_all_appc_repos
+ if [[ "$compile_repo" == "True" ]]; then
+ compile_all_appc_repos
+ fi
+
if [[ "$build_image" == "True" ]]; then
- build_sdnc_images
+ clone_repo sdnc/oam /opt/sdnc/oam
+ build_sdnc_images /opt/sdnc/oam
build_docker_image $src_folder/deployment/installation/appc docker
+ asserts_image openecomp/appc-image
else
pull_openecomp_image appc-image openecomp/appc-image:latest
pull_openecomp_image dgbuilder-sdnc-image openecomp/dgbuilder-sdnc-image:latest
fi
- pushd $src_folder
+ pushd $src_folder/deployment
install_docker_compose
/opt/docker/docker-compose up -d
popd
diff --git a/bootstrap/vagrant-onap/lib/asserts b/bootstrap/vagrant-onap/lib/asserts
index 0e455382a..d02cb5da8 100755
--- a/bootstrap/vagrant-onap/lib/asserts
+++ b/bootstrap/vagrant-onap/lib/asserts
@@ -2,10 +2,40 @@
set -o xtrace
+source /var/onap/commons
+
# asserts_image() - Function that verifies if a specific image was created
function asserts_image {
- if [[ "$(docker images -q $1 2> /dev/null)" == "" ]]; then
- echo "There is no $1 image"
- exit 1
+ local image=$1
+ local error_msg=${2:-"There is no $image image"}
+
+ if [[ "$(docker images -q $image 2> /dev/null)" == "" ]]; then
+ raise_error $error_msg
+ fi
+}
+
+# asserts_installed_package() - Function that verifies if a specific package was installed.
+function asserts_installed_package {
+ local package=$1
+ local error_msg=${2:-"$package wasn't installed"}
+
+ if ! is_package_installed $package; then
+ raise_error $error_msg
fi
}
+
+# asserts_file_exist() - Function that verifies if a specific file exists
+function asserts_file_exist {
+ local file=$1
+ local error_msg=${2:-"$file doesn't exist"}
+
+ if [ ! -f $file ]; then
+ raise_error $error_msg
+ fi
+}
+
+# raise_error() - Function that prints and exits the execution
+function raise_error {
+ echo $@
+ exit 1
+}
diff --git a/bootstrap/vagrant-onap/lib/commons b/bootstrap/vagrant-onap/lib/commons
index 783dc0b36..019eeb5c2 100755
--- a/bootstrap/vagrant-onap/lib/commons
+++ b/bootstrap/vagrant-onap/lib/commons
@@ -7,7 +7,20 @@ function update_repos {
if [ -f /var/onap/files/sources.list ]; then
cp /var/onap/files/sources.list /etc/apt/sources.list
fi
- apt-get update -y
+ if [ -f /var/onap/files/proxyrc ]; then
+ source /var/onap/files/proxyrc
+ cp /var/onap/files/proxyrc /etc/profile.d/proxy.sh
+
+ if [ -f /etc/apt/apt.conf ]; then
+ echo "Acquire::http::Proxy \"${http_proxy}\";" >> /etc/apt/apt.conf
+ echo "Acquire::https::Proxy \"${https_proxy}\";" >> /etc/apt/apt.conf
+ fi
+ if [ -d /etc/apt/apt.conf.d ] & [ ! -f /etc/apt/apt.conf.d/70proxy.conf ]; then
+ echo "Acquire::http::Proxy \"${http_proxy}\";" >> /etc/apt/apt.conf.d/70proxy.conf
+ echo "Acquire::https::Proxy \"${https_proxy}\";" >> /etc/apt/apt.conf.d/70proxy.conf
+ fi
+ fi
+ apt-get update -qq -y
}
# is_package_installed() - Function to tell if a package is installed
@@ -23,6 +36,6 @@ function install_package {
local package=$1
if ! is_package_installed $package; then
update_repos
- apt-get install -y $package
+ apt-get install -y -qq $package
fi
}
diff --git a/bootstrap/vagrant-onap/lib/dcae b/bootstrap/vagrant-onap/lib/dcae
index 0f6e27507..05527bc1d 100755
--- a/bootstrap/vagrant-onap/lib/dcae
+++ b/bootstrap/vagrant-onap/lib/dcae
@@ -57,16 +57,40 @@ function compile_docker_image {
popd
}
+# clone_all_dcae_repos() - Function that clones DCAE source repo.
+function clone_all_dcae_repos {
+ local src_folder=/opt/dcae
+ clone_repo dcae $src_folder
+
+ for dirc in apod apod/analytics apod/buildtools apod/buildtools collectors collectors/ves controller controller/analytics dcae-inventory \
+ demo demo/startup demo/startup/aaf demo/startup/controller demo/startup/message-router dmaapbc operation operation/utils pgaas utils utils/buildtools; do
+ clone_repo dcae/$dirc $src_folder/$dirc
+ done
+}
+
+# compile_all_dcae_repos() - Function that compiles DCAE source repo.
+function compile_all_dcae_repos {
+ local src_folder=/opt/dcae
+
+ for dirc in apod apod/analytics apod/buildtools apod/buildtools collectors collectors/ves controller controller/analytics dcae-inventory \
+ demo demo/startup demo/startup/aaf demo/startup/controller demo/startup/message-router dmaapbc operation operation/utils pgaas utils utils/buildtools; do
+ compile_src $src_folder/$dirc
+ done
+}
+
+
# install_dcae() - Function that clones and installs the DCAE controller services from source code
function install_dcae {
- export MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1)
- local src_folder=/opt/dcae-startup-vm-controller
- clone_repo dcae/demo/startup/controller $src_folder
- pushd $src_folder
install_docker_compose
+
+ clone_all_dcae_repos
+ if [[ "$compile_repo" == "True" ]]; then
+ compile_all_dcae_repos
+ fi
+
if [[ "$build_image" == "True" ]]; then
install_docker
- src_folder=/opt/dcae
+ local src_folder=/opt/dcae
compile_docker_image dcae/dmaapb $src_folder/dmaapbc openecomp/dcae-dmaapbc
compile_docker_image dcae/orch-dispatcher $src_folder/orch-dispatcher dcae/orch-dispatcher
@@ -84,16 +108,18 @@ function install_dcae {
asserts_image dcae-inventory
dcae_image=`docker images | grep dcae-controller | awk '{print $1 ":" $2}'`
+ pushd $src_folder/demo/startup/controller
sed -i "s|DOCKER-REGISTRY/openecomp/dcae-controller:DCAE-VERSION|$dcae_image|g" docker-compose.yml
sed -i "s|MTU|$MTU|g" docker-compose.yml
/opt/docker/docker-compose up -d
+ popd
else
+ pushd /opt/dcae/demo/startup/controller
bash init.sh
install_package make
make up
+ popd
fi
-
- popd
}
# init_dcae() - Function that initialize DCAE Controller services
diff --git a/bootstrap/vagrant-onap/lib/files/settings.template b/bootstrap/vagrant-onap/lib/files/settings.template
new file mode 100644
index 000000000..3b974c949
--- /dev/null
+++ b/bootstrap/vagrant-onap/lib/files/settings.template
@@ -0,0 +1,281 @@
+<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
+
+ <!-- offline
+ | Determines whether maven should attempt to connect to the network when executing a build.
+ | This will have an effect on artifact downloads, artifact deployment, and others.
+ |
+ | Default: false
+ <offline>false</offline>
+ -->
+ <!-- proxies
+ | This is a list of proxies which can be used on this machine to connect to the network.
+ | Unless otherwise specified (by system property or command-line switch), the first proxy
+ | specification in this list marked as active will be used.
+ |-->
+%PROXIES_START% <proxies>
+%PROXIES% %HTTP_PROXY%
+%PROXIES% %HTTPS_PROXY%
+%PROXIES_END% </proxies>
+ <!-- mirrors
+ | This is a list of mirrors to be used in downloading artifacts from remote repositories.
+ |
+ | It works like this: a POM may declare a repository to use in resolving certain artifacts.
+ | However, this repository may have problems with heavy traffic at times, so people have mirrored
+ | it to several places.
+ |
+ | That repository definition will have a unique id, so we can create a mirror reference for that
+ | repository, to be used as an alternate download site. The mirror site will be the preferred
+ | server for that repository.
+ |-->
+
+ <!-- profiles
+ | This is a list of profiles which can be activated in a variety of ways, and which can modify
+ | the build process. Profiles provided in the settings.xml are intended to provide local machine-
+ | specific paths and repository locations which allow the build to work in the local environment.
+ |
+ | For example, if you have an integration testing plugin - like cactus - that needs to know where
+ | your Tomcat instance is installed, you can provide a variable here such that the variable is
+ | dereferenced during the build process to configure the cactus plugin.
+ |
+ | As noted above, profiles can be activated in a variety of ways. One way - the activeProfiles
+ | section of this document (settings.xml) - will be discussed later. Another way essentially
+ | relies on the detection of a system property, either matching a particular value for the property,
+ | or merely testing its existence. Profiles can also be activated by JDK version prefix, where a
+ | value of '1.4' might activate a profile when the build is executed on a JDK version of '1.4.2_07'.
+ | Finally, the list of active profiles can be specified directly from the command line.
+ |
+ | NOTE: For profiles defined in the settings.xml, you are restricted to specifying only artifact
+ | repositories, plugin repositories, and free-form properties to be used as configuration
+ | variables for plugins in the POM.
+ |
+ |-->
+
+
+
+
+
+ <profiles>
+ <profile>
+
+ <id>10_nexus</id>
+ <!--Enable snapshots for the built in central repo to direct -->
+ <!--all requests to nexus via the mirror -->
+ <repositories>
+ <repository>
+ <id>10_nexus</id>
+ <url>http://repo.maven.apache.org/maven2/</url>
+ <releases><enabled>true</enabled></releases>
+ <snapshots><enabled>true</enabled></snapshots>
+ </repository>
+ </repositories>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <id>10_nexus</id>
+ <url>http://repo.maven.apache.org/maven2/</url>
+ <releases><enabled>true</enabled></releases>
+ <snapshots><enabled>true</enabled></snapshots>
+ </pluginRepository>
+ </pluginRepositories>
+
+ </profile>
+ <profile>
+ <id>20_openecomp-public</id>
+ <repositories>
+ <repository>
+ <id>20_openecomp-public</id>
+ <name>20_openecomp-public</name>
+ <url>https://nexus.onap.org/content/repositories/public/</url>
+ <releases>
+ <enabled>true</enabled>
+ <updatePolicy>daily</updatePolicy>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>20_openecomp-public</id>
+ <name>20_openecomp-public</name>
+ <url>https://nexus.onap.org/content/repositories/public/</url>
+ <releases>
+ <enabled>true</enabled>
+ <updatePolicy>daily</updatePolicy>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </pluginRepository>
+ </pluginRepositories>
+ </profile>
+ <profile>
+ <id>30_openecomp-staging</id>
+ <repositories>
+ <repository>
+ <id>30_openecomp-staging</id>
+ <name>30_openecomp-staging</name>
+ <url>https://nexus.onap.org/content/repositories/staging/</url>
+ <releases>
+ <enabled>true</enabled>
+ <updatePolicy>daily</updatePolicy>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>30_openecomp-staging</id>
+ <name>30_openecomp-staging</name>
+ <url>https://nexus.onap.org/content/repositories/staging/</url>
+ <releases>
+ <enabled>true</enabled>
+ <updatePolicy>daily</updatePolicy>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </pluginRepository>
+ </pluginRepositories>
+ </profile>
+ <profile>
+ <id>40_openecomp-release</id>
+ <repositories>
+ <repository>
+ <id>40_openecomp-release</id>
+ <name>40_openecomp-release</name>
+ <url>https://nexus.onap.org/content/repositories/releases/</url>
+ <releases>
+ <enabled>true</enabled>
+ <updatePolicy>daily</updatePolicy>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>40_openecomp-release</id>
+ <name>40_openecomp-release</name>
+ <url>https://nexus.onap.org/content/repositories/releases/</url>
+ <releases>
+ <enabled>true</enabled>
+ <updatePolicy>daily</updatePolicy>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </pluginRepository>
+ </pluginRepositories>
+ </profile>
+
+ <profile>
+ <id>50_openecomp-snapshots</id>
+ <repositories>
+ <repository>
+ <id>50_openecomp-snapshot</id>
+ <name>50_openecomp-snapshot</name>
+ <url>https://nexus.onap.org/content/repositories/snapshots/</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>50_openecomp-snapshot</id>
+ <name>50_openecomp-snapshot</name>
+ <url>https://nexus.onap.org/content/repositories/snapshots/</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </pluginRepository>
+ </pluginRepositories>
+ </profile>
+ <profile>
+ <id>60_opendaylight-release</id>
+ <repositories>
+ <repository>
+ <id>60_opendaylight-mirror</id>
+ <name>60_opendaylight-mirror</name>
+ <url>https://nexus.opendaylight.org/content/repositories/public/</url>
+ <releases>
+ <enabled>true</enabled>
+ <updatePolicy>daily</updatePolicy>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>60_opendaylight-mirror</id>
+ <name>60_opendaylight-mirror</name>
+ <url>https://nexus.opendaylight.org/content/repositories/public/</url>
+ <releases>
+ <enabled>true</enabled>
+ <updatePolicy>daily</updatePolicy>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </pluginRepository>
+ </pluginRepositories>
+ </profile>
+
+ <profile>
+ <id>70_opendaylight-snapshots</id>
+ <repositories>
+ <repository>
+ <id>70_opendaylight-snapshot</id>
+ <name>70_opendaylight-snapshot</name>
+ <url>https://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>70_opendaylight-snapshot</id>
+ <name>70_opendaylight-snapshot</name>
+ <url>https://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </pluginRepository>
+ </pluginRepositories>
+ </profile>
+ </profiles>
+
+ <activeProfiles>
+ <activeProfile>10_nexus</activeProfile>
+ <activeProfile>20_openecomp-public</activeProfile>
+ <activeProfile>30_openecomp-staging</activeProfile>
+ <activeProfile>40_openecomp-release</activeProfile>
+ <activeProfile>50_openecomp-snapshots</activeProfile>
+ <activeProfile>60_opendaylight-release</activeProfile>
+ <activeProfile>70_opendaylight-snapshots</activeProfile>
+
+ </activeProfiles>
+
+</settings>
diff --git a/bootstrap/vagrant-onap/lib/functions b/bootstrap/vagrant-onap/lib/functions
index fddd49a2a..b0c6e978d 100755
--- a/bootstrap/vagrant-onap/lib/functions
+++ b/bootstrap/vagrant-onap/lib/functions
@@ -3,6 +3,16 @@
set -o xtrace
source /var/onap/commons
+source /var/onap/_composed_functions
+source /var/onap/_onap_functions
+
+mvn_conf_file=/root/.m2/settings.xml
+git_src_folder=/opt
+
+# export_env_vars() - Export environment variables
+function export_env_vars {
+ export MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' |sort -n | head -1)
+}
# configure_dns() - DNS/GW IP address configuration
function configure_dns {
@@ -10,35 +20,11 @@ function configure_dns {
resolvconf -u
}
-# create_configuration_files() - Store credentials in files
-function create_configuration_files {
- mkdir -p /opt/config
- echo $nexus_docker_repo > /opt/config/nexus_docker_repo.txt
- echo $nexus_username > /opt/config/nexus_username.txt
- echo $nexus_password > /opt/config/nexus_password.txt
- echo $openstack_username > /opt/config/openstack_username.txt
- echo $openstack_tenant_id > /opt/config/tenant_id.txt
- echo $dmaap_topic > /opt/config/dmaap_topic.txt
- echo $docker_version > /opt/config/docker_version.txt
-}
-
-# pull_openecomp_image() - Pull Docker container image from a Docker Registry Hub
-function pull_openecomp_image {
- install_docker
- local image=$1
- local tag=$2
- docker login -u $nexus_username -p $nexus_password $nexus_docker_repo
- docker pull $nexus_docker_repo/openecomp/${image}:$docker_version
- if [ ${tag} ]; then
- docker tag $nexus_docker_repo/openecomp/${image}:$docker_version $tag
- fi
-}
-
-# git_timed() - git can sometimes get itself infinitely stuck with transient network
+# _git_timed() - git can sometimes get itself infinitely stuck with transient network
# errors or other issues with the remote end. This wraps git in a
# timeout/retry loop and is intended to watch over non-local git
# processes that might hang.
-function git_timed {
+function _git_timed {
local count=0
local timeout=0
@@ -62,12 +48,12 @@ function git_timed {
function clone_repo {
local repo_url=https://git.onap.org/
local repo=$1
- local dest_folder=$2
- if [ ! -d $2 ]; then
- git_timed clone -b $gerrit_branch --single-branch ${repo_url}${repo} $dest_folder
+ local dest_folder=${2:-$git_src_folder/$repo}
+ if [ ! -d $dest_folder ]; then
+ _git_timed clone -b $gerrit_branch --single-branch ${repo_url}${repo} $dest_folder
else
pushd $dest_folder
- git_timed pull
+ _git_timed pull
popd
fi
}
@@ -79,26 +65,12 @@ function install_dev_tools {
install_package curl
}
-# install_bind() - Install bind utils
-function install_bind {
+# _install_bind() - Install bind utils
+function _install_bind {
install_package bind9
install_package bind9utils
}
-# configure_bind()- Configure bind utils
-function configure_bind {
- install_bind
- mkdir /etc/bind/zones
-
- curl -k $nexus_repo/org.openecomp.demo/boot/$artifacts_version/db_simpledemo_openecomp_org -o /etc/bind/zones/db.simpledemo.openecomp.org
- curl -k $nexus_repo/org.openecomp.demo/boot/$artifacts_version/named.conf.options -o /etc/bind/named.conf.options
- curl -k $nexus_repo/org.openecomp.demo/boot/$artifacts_version/named.conf.local -o /etc/bind/named.conf.local
-
- modprobe ip_gre
- sed -i "s/OPTIONS=.*/OPTIONS=\"-4 -u bind\"/g" /etc/default/bind9
- service bind9 restart
-}
-
# install_java() - Install java binaries
function install_java {
install_package software-properties-common
@@ -108,7 +80,7 @@ function install_java {
# install_maven() - Install maven binaries
function install_maven {
- if is_package_installed maven; then
+ if is_package_installed maven3; then
return
fi
if ! is_package_installed openjdk-8-jdk; then
@@ -120,10 +92,12 @@ function install_maven {
# Force Maven3 to use jdk8
apt-get purge openjdk-7-jdk -y
+
+ _configure_maven
}
-# configure_docker_proxy() - Configures proxy in Docker from ENV
-function configure_docker_proxy {
+# _configure_docker_proxy() - Configures proxy in Docker from ENV
+function _configure_docker_proxy {
if [ $http_proxy ]; then
echo "export http_proxy=$http_proxy" >> /etc/default/docker
fi
@@ -132,41 +106,24 @@ function configure_docker_proxy {
fi
}
-# build_docker_image() - Build Docker container image from source code
-function build_docker_image {
- local src_folder=$1
- local profile=$2
- install_maven
- install_docker
- pushd $src_folder
-
- # Cleanup external repo
- sed -i 's|${docker.push.registry}/||g' pom.xml
- local mvn_docker="mvn clean package docker:build"
- if [ $profile ]; then
- mvn_docker+=" -P $profile"
- fi
- if [ $http_proxy ]; then
- mvn_docker+=" -Ddocker.buildArg.http_proxy=$http_proxy"
- mvn_docker+=" -Ddocker.buildArg.HTTP_PROXY=$http_proxy"
- fi
- if [ $https_proxy ]; then
- mvn_docker+=" -Ddocker.buildArg.https_proxy=$https_proxy"
- mvn_docker+=" -Ddocker.buildArg.HTTPS_PROXY=$https_proxy"
+# install_nodejs() - Download and install NodeJS
+function install_nodejs {
+ if is_package_installed nodejs; then
+ return
fi
- eval $mvn_docker
- popd
+ curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
+ install_package nodejs
+
+ # Update NPM to latest version
+ npm install npm -g
}
-# compile_src() - Function that compiles the java source code thru maven
-function compile_src {
- local src_folder=$1
- pushd $src_folder
- if [ -f pom.xml ]; then
- install_maven
- mvn clean install -DskipTests=true -Dmaven.test.skip=true -Dadditionalparam=-Xdoclint:none
- fi
- popd
+# install_python() - Install Python 2.7 and other tools necessary for development.
+function install_python {
+ install_package python2.7
+ install_package python-dev
+ curl -sL https://bootstrap.pypa.io/get-pip.py | python
+ pip install tox
}
# install_docker() - Download and install docker-engine
@@ -181,8 +138,20 @@ function install_docker {
$(lsb_release -cs) \
stable"
install_package docker-ce
- configure_docker_proxy
+ _configure_docker_proxy
service docker restart
+ sleep 10
+}
+
+# pull_docker_image() - Pull Docker container image from the Public Docker Registry Hub
+function pull_docker_image {
+ install_docker
+ local image=$1
+ local tag=$2
+ docker pull ${image}
+ if [ ${tag} ]; then
+ docker tag ${image} $tag
+ fi
}
# install_docker_compose() - Download and install docker-engine
@@ -195,10 +164,69 @@ function install_docker_compose {
fi
}
-# configure_service() - Download and configure a specific service in upstart
-function configure_service {
- local service_script=$1
- curl -k $nexus_repo/org.openecomp.demo/boot/$artifacts_version/$service_script -o /etc/init.d/$service_script
- chmod +x /etc/init.d/$service_script
- update-rc.d $service_script defaults
+# _install_ODL() - Download and Install OpenDayLight SDN controller
+function _install_ODL {
+ if [ ! -d /opt/opendaylight/current ]; then
+ mkdir -p /opt/opendaylight/
+ wget "https://nexus.opendaylight.org/content/repositories/public/org/opendaylight/integration/distribution-karaf/"$odl_version"/distribution-karaf-"$odl_version".tar.gz" -P /opt/
+ tar xvf "/opt/distribution-karaf-"$odl_version".tar.gz" -C /opt/
+ mv "/opt/distribution-karaf-"$odl_version /opt/opendaylight/current
+ rm -rf "/opt/distribution-karaf-"$odl_version".tar.gz"
+ fi
+}
+
+# start_ODL() - Start OpenDayLight SDN controller
+function start_ODL {
+ _install_ODL
+ if [ -d /opt/opendaylight ]; then
+ export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/jre
+ /opt/opendaylight/current/bin/start
+ sleep 180
+ /opt/opendaylight/current/bin/client feature:install odl-dlux-all
+ fi
+}
+
+# compile_src() - Function that compiles the java source code thru maven
+function compile_src {
+ local src_folder=$1
+ pushd $src_folder
+ if [ -f pom.xml ]; then
+ install_maven
+ mvn clean install -U -DskipTests=true -Dmaven.test.skip=true -Dmaven.javadoc.skip=true -Dadditionalparam=-Xdoclint:none
+ fi
+ popd
+}
+
+# build_docker_image() - Build Docker container image from source code
+function build_docker_image {
+ local src_folder=$1
+ local profile=$2
+ install_maven
+ install_docker
+ pushd $src_folder
+
+ # Cleanup external repo
+ sed -i 's|${docker.push.registry}/||g' pom.xml
+ local mvn_docker="mvn clean package docker:build"
+ if [ $profile ]; then
+ mvn_docker+=" -P $profile"
+ fi
+ if [ $http_proxy ]; then
+ if ! grep -ql "docker.buildArg.http_proxy" pom.xml ; then
+ mvn_docker+=" -Ddocker.buildArg.http_proxy=$http_proxy"
+ fi
+ if ! grep -ql "docker.buildArg.HTTP_PROXY" pom.xml ; then
+ mvn_docker+=" -Ddocker.buildArg.HTTP_PROXY=$http_proxy"
+ fi
+ fi
+ if [ $https_proxy ]; then
+ if ! grep -ql "docker.buildArg.https_proxy" pom.xml ; then
+ mvn_docker+=" -Ddocker.buildArg.https_proxy=$https_proxy"
+ fi
+ if ! grep -ql "docker.buildArg.HTTPS_PROXY" pom.xml ; then
+ mvn_docker+=" -Ddocker.buildArg.HTTPS_PROXY=$https_proxy"
+ fi
+ fi
+ eval $mvn_docker
+ popd
}
diff --git a/bootstrap/vagrant-onap/lib/mr b/bootstrap/vagrant-onap/lib/mr
index 8b92bc9c8..869994d2d 100755
--- a/bootstrap/vagrant-onap/lib/mr
+++ b/bootstrap/vagrant-onap/lib/mr
@@ -2,17 +2,24 @@
set -o xtrace
+source /var/onap/functions
+source /var/onap/asserts
+
+src_folder=$git_src_folder/dcae/message-router
+
# install_message_router() - Downloads and configure message router source code
-function install_message_router {
- local src_folder=/opt/dcae/message-router
+function _install_message_router {
clone_repo dcae/demo/startup/message-router $src_folder
pushd $src_folder
- is_package_installed docker-ce || install_docker
+ pull_docker_image attos/dmaap
+ pull_docker_image wurstmeister/zookeeper
+ install_docker_compose
bash deploy.sh
+ asserts_image dockerfiles_kafka
popd
}
# init_mr() - Function that initialize Message Router services
function init_mr {
- install_message_router
+ _install_message_router
}
diff --git a/bootstrap/vagrant-onap/lib/mso b/bootstrap/vagrant-onap/lib/mso
index 0cffbf0d4..b8d432622 100755
--- a/bootstrap/vagrant-onap/lib/mso
+++ b/bootstrap/vagrant-onap/lib/mso
@@ -3,21 +3,43 @@
set -o xtrace
source /var/onap/functions
+source /var/onap/asserts
+
+src_folder=$git_src_folder/mso
+mso_repos=("chef-repo" "docker-config" "libs" "mso-config")
+
+# clone_all_mso_repos() - Function that clones MSO source repo.
+function clone_all_mso_repos {
+ clone_repo mso $src_folder
+
+ for dirc in ${mso_repos[@]}; do
+ clone_repo mso/$dirc $src_folder/$dirc
+ done
+}
+
+# compile_all_mso_repos() - Function that compiles MSO source repo.
+function compile_all_mso_repos {
+ compile_src $src_folder
+
+ for dirc in ${mso_repos[@]}; do
+ compile_src $src_folder/$dirc
+ done
+}
# install_mso() - Installation of mso images
function install_mso {
- local src_folder=/opt/mso
if [[ "$build_image" == "True" ]]; then
- clone_repo mso $src_folder
export GIT_NO_PROJECT=/opt/
- build_docker_image $src_folder/packages/docker
+ compile_src $src_folder
+ build_docker_image $src_folder/packages/docker docker
+ for image in mso mso-arquillian wildfly ubuntu-update jacoco; do
+ asserts_image openecomp/$image
+ done
fi
}
# install_mso_docker_config() - Download and install MSO Docker configuration project
function install_mso_docker_config {
- local src_folder=/opt/mso/docker-config
- clone_repo mso/docker-config $src_folder
MSO_ENCRYPTION_KEY=$(cat /opt/mso/docker-config/encryption.key)
echo -n "$openstack_api_key" | openssl aes-128-ecb -e -K $MSO_ENCRYPTION_KEY -nosalt | xxd -c 256 -p > /opt/config/api_key.txt
@@ -67,18 +89,27 @@ EOF
export MSO_CONFIG_UPDATES
export MSO_DOCKER_IMAGE_VERSION=$docker_version
- # Deploy the environment
- pushd $src_folder
- chmod +x deploy.sh
is_package_installed docker-ce || install_docker
install_docker_compose
- # This script takes in input 2 nexus repos (the first one for the MSO image, the second one for mariadb)
- ./deploy.sh $nexus_docker_repo $nexus_username $nexus_password $nexus_docker_repo $nexus_username $nexus_password
+ # Deploy the environment
+ pushd $src_folder/docker-config
+ chmod +x deploy.sh
+ if [[ "$build_image" == "True" ]]; then
+ bash deploy.sh
+ else
+ # This script takes in input 2 nexus repos (the first one for the MSO image, the second one for mariadb)
+ bash deploy.sh $nexus_docker_repo $nexus_username $nexus_password $nexus_docker_repo $nexus_username $nexus_password
+ fi
popd
}
# init_mso() - Function that initialize MSO services
function init_mso {
+ clone_all_mso_repos
+ if [[ "$compile_repo" == "True" ]]; then
+ compile_all_mso_repos
+ fi
+
install_mso
install_mso_docker_config
}
diff --git a/bootstrap/vagrant-onap/lib/policy b/bootstrap/vagrant-onap/lib/policy
index 270022d94..71854048e 100755
--- a/bootstrap/vagrant-onap/lib/policy
+++ b/bootstrap/vagrant-onap/lib/policy
@@ -2,11 +2,52 @@
set -o xtrace
+source /var/onap/functions
+source /var/onap/asserts
+
+# clone_all_policy_repos() - Function that clones Policy source repo.
+function clone_all_policy_repos {
+ local src_folder=/opt/policy
+
+ for dirc in api common docker drools-applications drools-pdp engine gui pap pdp; do
+ clone_repo policy/$dirc $src_folder/$dirc
+ done
+}
+
+# # compile_all_policy_repos() - Function that compiles Policy source repo.
+function compile_all_policy_repos {
+ local src_folder=/opt/policy
+
+ for dirc in api common docker drools-applications drools-pdp engine gui pap pdp; do
+ compile_src $src_folder/$dirc
+ done
+}
+
# install_policy() - Function that clones and installs the Policy services from source code
function install_policy {
local src_folder=/opt/policy
- clone_repo policy/docker $src_folder
- pushd $src_folder
+
+ clone_all_policy_repos
+ if [[ "$compile_repo" == "True" ]]; then
+ compile_all_policy_repos
+ fi
+
+ if [[ "$build_image" == "True" ]]; then
+ compile_src $src_folder/docker
+ install_docker
+ pushd $src_folder/docker
+ bash docker_verify.sh
+ for image in os nexus db base drools pe; do
+ asserts_image onap/policy/policy-$image
+ done
+ popd
+ else
+ pull_onap_image policy/policy-db onap/policy/policy-db:latest
+ pull_onap_image policy/policy-pe onap/policy/policy-pe:latest
+ pull_onap_image policy/policy-drools onap/policy/policy-drools:latest
+ pull_onap_image policy/policy-nexus onap/policy/policy-nexus:latest
+ fi
+ pushd $src_folder/docker
chmod +x config/drools/drools-tweaks.sh
IP_ADDRESS=$(ifconfig eth0 | grep "inet addr" | tr -s ' ' | cut -d' ' -f3 | cut -d':' -f2)
echo $IP_ADDRESS > config/pe/ip_addr.txt
@@ -17,9 +58,5 @@ function install_policy {
# init_policy() - Function that initialize Policy services
function init_policy {
- pull_onap_image policy/policy-db onap/policy/policy-db:latest
- pull_onap_image policy/policy-pe onap/policy/policy-pe:latest
- pull_onap_image policy/policy-drools onap/policy/policy-drools:latest
- pull_onap_image policy/policy-nexus onap/policy/policy-nexus:latest
install_policy
}
diff --git a/bootstrap/vagrant-onap/lib/portal b/bootstrap/vagrant-onap/lib/portal
index bd9559313..6c8e7d0a9 100755
--- a/bootstrap/vagrant-onap/lib/portal
+++ b/bootstrap/vagrant-onap/lib/portal
@@ -3,6 +3,7 @@
set -o xtrace
source /var/onap/functions
+source /var/onap/asserts
# install_mariadb() - Pull and create a MariaDB container
function install_mariadb {
@@ -15,42 +16,51 @@ function install_mariadb {
function install_portal {
local src_folder=/opt/portal
clone_repo portal $src_folder
+ clone_repo portal/sdk $src_folder/sdk
install_docker
docker rm -f ecompdb_portal
docker rm -f 1610-1
+ pushd $src_folder/deliveries
if [[ "$build_image" == "True" ]]; then
- # Build locally
install_maven
clone_repo ecompsdkos $src_folder/ecompsdkos
clone_repo "ui/dmaapbc" $src_folder/dmaapbc
- pushd $src_folder/deliveries
chmod +x *.sh
+ export MVN=$(which mvn)
+ export GLOBAL_SETTINGS_FILE=/usr/share/maven3/conf/settings.xml
+ export SETTINGS_FILE=$HOME/.m2/settings.xml
bash run.sh
- popd
+ compile_src $src_folder/ecomp-portal-widget-ms
+ build_docker_image $src_folder/ecomp-portal-widget-ms
else
pull_openecomp_image portaldb ecompdb:portal
pull_openecomp_image portalapps ep:1610-1
- chmod +x $src_folder/deliveries/new_start.sh
- chmod +x $src_folder/deliveries/new_stop.sh
- chmod +x $src_folder/deliveries/dbstart.sh
- mkdir -p /PROJECT/OpenSource/UbuntuEP/logs
- install_package unzip
- unzip -o $src_folder/deliveries/etc.zip -d /PROJECT/OpenSource/UbuntuEP/
+ fi
+ for image in ecompdb:portal ep:1610-1; do
+ asserts_image $image
+ done
+
+ chmod +x new_start.sh
+ chmod +x new_stop.sh
+ chmod +x dbstart.sh
+ mkdir -p /PROJECT/OpenSource/UbuntuEP/logs
+ install_package unzip
+ unzip -o etc.zip -d /PROJECT/OpenSource/UbuntuEP/
- bash $src_folder/deliveries/dbstart.sh
- bash $src_folder/deliveries/new_start.sh
+ bash dbstart.sh
+ bash new_start.sh
- sleep 180
+ sleep 180
- if [ ! -e /opt/config/boot.txt ]; then
- IP_ADDRESS=$(ifconfig eth0 | grep "inet addr" | tr -s ' ' | cut -d' ' -f3 | cut -d':' -f2)
- install_package mysql-client
- mysql -u root -p'Aa123456' -h $IP_ADDRESS < $src_folder/deliveries/Apps_Users_OnBoarding_Script.sql
- echo "yes" > /opt/config/boot.txt
- fi
+ if [ ! -e /opt/config/boot.txt ]; then
+ IP_ADDRESS=$(ifconfig eth0 | grep "inet addr" | tr -s ' ' | cut -d' ' -f3 | cut -d':' -f2)
+ install_package mysql-client
+ mysql -u root -p'Aa123456' -h $IP_ADDRESS < Apps_Users_OnBoarding_Script.sql
+ echo "yes" > /opt/config/boot.txt
fi
+ popd
}
# init_portal() - Function that initialize Portal services
diff --git a/bootstrap/vagrant-onap/lib/robot b/bootstrap/vagrant-onap/lib/robot
index 75a361f4d..4102680ef 100755
--- a/bootstrap/vagrant-onap/lib/robot
+++ b/bootstrap/vagrant-onap/lib/robot
@@ -6,7 +6,7 @@ set -o xtrace
function install_testsuite_properties {
mkdir -p /opt/eteshare/config
- local $src_folder=/opt/testsuite/properties
+ local src_folder=/opt/testsuite/properties
clone_repo testsuite/properties $src_folder
cp $src_folder/integration_* /opt/eteshare/config
cp $src_folder/vm_config2robot.sh /opt/eteshare/config
diff --git a/bootstrap/vagrant-onap/lib/sdc b/bootstrap/vagrant-onap/lib/sdc
index 15787b064..626d9d731 100755
--- a/bootstrap/vagrant-onap/lib/sdc
+++ b/bootstrap/vagrant-onap/lib/sdc
@@ -2,6 +2,11 @@
set -o xtrace
+source /var/onap/functions
+source /var/onap/asserts
+
+src_folder=$git_src_folder/sdc
+
# mount_external_partition() - Create partition and mount the external volume
function mount_external_partition {
cat <<EOL > /tmp/asdc_ext_volume_partitions.txt
@@ -41,6 +46,25 @@ alias health='/data/scripts/docker_health.sh'
EOL
}
+# clone_all_sdc_repos() - Function that clones SDC source repo.
+function clone_all_sdc_repos {
+ clone_repo sdc $src_folder
+
+ for dirc in sdc-os-chef jtosca sdc-distribution-client sdc-titan-cassandra sdc-tosca sdc_common ; do
+ clone_repo sdc/$dirc $src_folder/$dirc
+ done
+}
+
+# compile_all_sdc_repos() - Function that compiles SDC source repo.
+function compile_all_sdc_repos {
+ local src_folder=/opt/sdc
+ clone_repo sdc $src_folder
+
+ for dirc in jtosca sdc-distribution-client sdc-titan-cassandra sdc-tosca sdc_common ; do
+ compile_src $src_folder/$dirc
+ done
+}
+
# install_sdc() - Function that pull templates and executes
function install_sdc {
IP_ADDRESS=$(ifconfig eth0 | grep "inet addr" | tr -s ' ' | cut -d' ' -f3 | cut -d':' -f2)
@@ -48,11 +72,18 @@ function install_sdc {
local MR_IP_ADDR='10.0.11.1'
local RELEASE=$docker_version
NEXUS_DOCKER_PORT=$(echo $nexus_docker_repo | cut -d':' -f2)
- local src_folder=/opt/sdc
- clone_repo sdc $src_folder
+
+ clone_all_sdc_repos
+ if [[ "$compile_repo" == "True" ]]; then
+ compile_all_sdc_repos
+ fi
+
if [[ "$build_image" == "True" ]]; then
compile_src $src_folder
- build_docker_image $src_folder/sdc-os-chef
+ build_docker_image $src_folder/sdc-os-chef docker
+ for image in backend frontend elasticsearch kibana cassandra sanity; do
+ asserts_image openecomp/sdc-$image
+ done
fi
cp $src_folder/sdc-os-chef/environments/Template.json /data/environments
cp $src_folder/sdc-os-chef/scripts/docker_run.sh /data/scripts
@@ -65,8 +96,7 @@ function install_sdc {
sed -i "s/\"ueb_url_list\":.*/\"ueb_url_list\": \""$MR_IP_ADDR","$MR_IP_ADDR"\",/g" /data/environments/$ENV_NAME.json
sed -i "s/\"fqdn\":.*/\"fqdn\": [\""$MR_IP_ADDR"\", \""$MR_IP_ADDR"\"]/g" /data/environments/$ENV_NAME.json
- is_package_installed docker-ce || install_docker
- docker login -u $nexus_username -p $nexus_password $nexus_docker_repo
+ docker_openecomp_login
bash /data/scripts/docker_run.sh -e $ENV_NAME -r $RELEASE -p $NEXUS_DOCKER_PORT
}
diff --git a/bootstrap/vagrant-onap/lib/sdnc b/bootstrap/vagrant-onap/lib/sdnc
index b3c64f90e..6765f1444 100755
--- a/bootstrap/vagrant-onap/lib/sdnc
+++ b/bootstrap/vagrant-onap/lib/sdnc
@@ -2,31 +2,67 @@
set -o xtrace
-# build_sdnc_images() - Builds SDNC images from source code
-function build_sdnc_images {
- local src_folder=/opt/sdnc/oam
- clone_repo sdnc/oam $src_folder
- build_docker_image $src_folder/installation/ubuntu
+source /var/onap/functions
+source /var/onap/asserts
+
+src_folder=$git_src_folder/openecomp/sdnc
+sdnc_repos=("core" "adaptors" "northbound" "plugins" "oam")
+
+# clone_all_sdnc_repos() - Function that clones SDNC source repo.
+function clone_all_sdnc_repos {
+ for dirc in ${sdnc_repos[@]}; do
+ clone_repo sdnc/$dirc $src_folder/$dirc
+ done
+}
+
+# compile_all_sdnc_repos() - Function that compiles SDNC source repo.
+function compile_all_sdnc_repos {
+ for dirc in ${sdnc_repos[@]}; do
+ if [[ "$dirc" == "core" ]]; then
+ compile_src $src_folder/core/rootpom
+ fi
+ compile_src $src_folder/$dirc
+ done
+}
+
+# _build_sdnc_images() - Builds SDNC images from source code
+function _build_sdnc_images {
+ local folder=$1
+
+ build_docker_image $folder/installation/ubuntu
+ asserts_image openecomp/ubuntu-sdnc-image
+
/var/lib/dpkg/info/ca-certificates-java.postinst configure
- build_docker_image $src_folder/installation/sdnc
- build_docker_image $src_folder/installation/admportal
- build_docker_image $src_folder/installation/dgbuilder
+ build_docker_image $folder/installation/sdnc
+ asserts_image openecomp/sdnc-image
+
+ build_docker_image $folder/installation/admportal
+ asserts_image openecomp/admportal-sdnc-image
+
+ build_docker_image $folder/installation/dgbuilder
+ asserts_image openecomp/dgbuilder-sdnc-image
}
-# install_sdnc() - Download and install SDNC services from source code
-function install_sdnc {
- install_package unzip
- local src_folder=/opt/sdnc/oam
- export MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1)
- clone_repo sdnc/oam $src_folder
+# get_sdnc_images() - Build or retrieve necessary images
+function get_sdnc_images {
if [[ "$build_image" == "True" ]]; then
- build_sdnc_images
+ # The OAM code depends on all the SDNC repos which should be downloaded and compiled first
+ if [[ "$compile_repo" == "False" ]]; then
+ compile_all_sdnc_repos
+ fi
+ _build_sdnc_images $src_folder/oam
else
pull_openecomp_image sdnc-image openecomp/sdnc-image:latest
pull_openecomp_image admportal-sdnc-image openecomp/admportal-sdnc-image:latest
pull_openecomp_image dgbuilder-sdnc-image openecomp/dgbuilder-sdnc-image:latest
fi
- pushd $src_folder/installation/src/main/yaml
+}
+
+# install_sdnc() - Download and install SDNC services from source code
+function install_sdnc {
+ install_package unzip
+ clone_repo sdnc/oam $src_folder/oam
+ pushd $src_folder/oam/installation/src/main/yaml
install_docker_compose
/opt/docker/docker-compose up -d
popd
@@ -34,5 +70,11 @@ function install_sdnc {
# init_sdnc() - Function that initialize SDNC services
function init_sdnc {
+ start_ODL
+ clone_all_sdnc_repos
+ if [[ "$compile_repo" == "True" ]]; then
+ compile_all_sdnc_repos
+ fi
+ get_sdnc_images
install_sdnc
}
diff --git a/bootstrap/vagrant-onap/lib/vfc b/bootstrap/vagrant-onap/lib/vfc
new file mode 100755
index 000000000..44e433d35
--- /dev/null
+++ b/bootstrap/vagrant-onap/lib/vfc
@@ -0,0 +1,58 @@
+#!/bin/bash
+
+set -o xtrace
+
+source /var/onap/functions
+rc_folder=$git_src_folder/vfc
+
+vfc_repos=("gvnfm/vnflcm" "gvnfm/vnfmgr" "gvnfm/vnfres" "nfvo/catalog" "nfvo/driver/ems" "nfvo/driver/sfc" \
+ "nfvo/driver/vnfm/gvnfm" "nfvo/driver/vnfm/svnfm" "nfvo/lcm" "nfvo/resmanagement" "nfvo/wfengine")
+
+# clone_all_vfc_repos() - Function that clones VF-C source repo.
+function clone_all_vfc_repos {
+ for dirc in ${vfc_repos[@]}; do
+ clone_repo vfc/$dirc $src_folder/$dirc
+ done
+}
+
+# compile_all_vfc_repos() - Function that compiles VF-C source repo.
+function compile_all_vfc_repos {
+ pushd $src_folder/gvnfm/vnflcm/lcm
+ tox -e py27
+ popd
+
+ # TODO(sshank): Add compile for other vfc_repos. (Both Java and Python based.)
+ # Python based:
+ # gvnfm/vnflcm/lcm
+ # gvnfm/vnfmgr/mgr
+ # gvnfm/vnfres/res
+ # nfvo/driver/vnfm/gvnfm/gvnfmadapter
+ # nfvo/driver/vnfm/svnfm/zte/vmanager
+ # nfvo/lcm
+
+ # Java based:
+ # nfvo/catalog
+ # nfvo/driver/ems/ems/sems/boco/ems-driver
+ # nfvo/driver/sfc/zte/sfc-driver
+ # nfvo/driver/vnfm/gvnfm/juju/juju-vnfmadapter
+ # nfvo/driver/vnfm/svnfm/huawei/vnfmadapter
+ # nfvo/resmanagement
+ # nfvo/wfengine
+}
+
+# install_vfc() - Download and install vfc service from source code
+function install_vfc {
+ clone_all_vfc_repos
+ if [[ "$compile_repo" == "False" ]]; then
+ compile_all_vfc_repos
+ fi
+
+ # TODO(sshank): Add further installation steps if necessary.
+}
+
+# init_vfc() - Function that initialize VF-C services
+function init_vfc {
+ install_python
+ install_package libmysqlclient-dev
+ install_vfc
+}
diff --git a/bootstrap/vagrant-onap/lib/vid b/bootstrap/vagrant-onap/lib/vid
index 25d2c68f6..902c45540 100755
--- a/bootstrap/vagrant-onap/lib/vid
+++ b/bootstrap/vagrant-onap/lib/vid
@@ -2,25 +2,54 @@
set -o xtrace
+source /var/onap/functions
+source /var/onap/asserts
+
+src_folder=/opt/vid
+
# pull_mariadb_image() - Pull MariaDB container image from a Docker Registry Hub
function pull_mariadb_image {
- is_package_installed docker-ce || install_docker
- docker login -u $nexus_username -p $nexus_password $nexus_docker_repo
+ docker_openecomp_login
docker pull $nexus_docker_repo/library/mariadb:10
}
+# clone_all_vid_repos() - Function that clones VID source code.
+function clone_all_vid_repos {
+ clone_repo vid $src_folder
+ clone_repo vid/asdcclient $src_folder/asdcclient
+}
+
+# compile_all_vid_repos() - Function that compiles VID source repo.
+function compile_all_vid_repos {
+ compile_src $src_folder
+ compile_src $src_folder/asdcclient
+}
+
# install_vid() - Download and configure Vid source code
function install_vid {
- local src_folder=/opt/vid
- clone_repo vid $src_folder
- pull_openecomp_image vid
+ local vid_image=openecomp/vid
+
+ clone_all_vid_repos
+ if [[ "$compile_repo" == "True" ]]; then
+ compile_all_vid_repos
+ fi
+
+ if [[ "$build_image" == "True" ]]; then
+ compile_src $src_folder
+ build_docker_image $src_folder/deliveries
+ asserts_image $vid_image
+ vid_image=`docker images | grep vid | grep latest| awk '{print $1 ":" $2}'`
+ else
+ pull_openecomp_image vid
+ vid_image=$nexus_docker_repo/$vid_image:$docker_version
+ fi
pull_mariadb_image
docker rm -f vid-mariadb
docker rm -f vid-server
docker run --name vid-mariadb -e MYSQL_DATABASE=vid_openecomp -e MYSQL_USER=vidadmin -e MYSQL_PASSWORD=Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U -e MYSQL_ROOT_PASSWORD=LF+tp_1WqgSY -v /opt/vid/lf_config/vid-my.cnf:/etc/mysql/my.cnf -v /opt/vid/lf_config/vid-pre-init.sql:/docker-entrypoint-initdb.d/vid-pre-init.sql -v /var/lib/mysql -d mariadb:10
- docker run -e VID_MYSQL_DBNAME=vid_openecomp -e VID_MYSQL_PASS=Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U --name vid-server -p 8080:8080 --link vid-mariadb:vid-mariadb-docker-instance -d $nexus_docker_repo/openecomp/vid:$docker_version
+ docker run -e VID_MYSQL_DBNAME=vid_openecomp -e VID_MYSQL_PASS=Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U --name vid-server -p 8080:8080 --link vid-mariadb:vid-mariadb-docker-instance -d $vid_image
}
# init_vid() - Function that initialize Vid services
diff --git a/bootstrap/vagrant-onap/postinstall.sh b/bootstrap/vagrant-onap/postinstall.sh
index b0e64ad32..f5a7ac684 100755
--- a/bootstrap/vagrant-onap/postinstall.sh
+++ b/bootstrap/vagrant-onap/postinstall.sh
@@ -4,6 +4,7 @@ set -o xtrace
source /var/onap/functions
+export_env_vars
create_configuration_files
install_dev_tools
install_java
diff --git a/bootstrap/vagrant-onap/tests/_test_base b/bootstrap/vagrant-onap/tests/_test_base
new file mode 100644
index 000000000..19cc8ef11
--- /dev/null
+++ b/bootstrap/vagrant-onap/tests/_test_base
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+source /var/onap/asserts
+
+# main() - Starting point for Unit Tests
+function main {
+ local covered_functions=("$@")
+
+ len=${#covered_functions[@]}
+ echo "1..$len"
+ for i in ${!covered_functions[@]}; do
+ dpkg --get-selections > installed-software
+ sort -o installed-software installed-software
+ test_${covered_functions[$i]}
+ echo "ok $((i+1)) - test_${covered_functions[$i]}"
+
+ # Teardown process
+ dpkg --get-selections > installed-software_new
+ sort -o installed-software_new installed-software_new
+ apt-get purge -y -qq $(comm -3 installed-software installed-software_new | awk '{print $1}')
+ #rm -rf $git_src_folder
+ #rm -rf ~/.m2/
+ done
+}
diff --git a/bootstrap/vagrant-onap/tests/test_functions b/bootstrap/vagrant-onap/tests/test_functions
new file mode 100644
index 000000000..ea268923b
--- /dev/null
+++ b/bootstrap/vagrant-onap/tests/test_functions
@@ -0,0 +1,174 @@
+#!/bin/bash
+
+source /var/onap_tests/_test_base
+source /var/onap/functions
+
+covered_functions=(
+"create_configuration_files" "clone_repo" "install_dev_tools"
+"configure_bind" "install_java" "install_maven" "install_nodejs" "install_python"
+"install_docker" "pull_docker_image" "install_docker_compose" "configure_service"
+"start_ODL" "compile_src" "build_docker_image"
+)
+
+# TODO(electrocucaracha): Remove/Modify functions that doesn't support proxy settings
+if [ -z $http_proxy ] & [ -z $https_proxy ]; then
+ covered_functions=(${covered_functions[@]} "docker_openecomp_login" "pull_openecomp_image")
+fi
+
+# test_create_configuration_files() - Verify the creation of a configuration files
+function test_create_configuration_files {
+ create_configuration_files
+
+ asserts_file_exist /opt/config/nexus_docker_repo.txt
+ asserts_file_exist /opt/config/nexus_username.txt
+ asserts_file_exist /opt/config/nexus_password.txt
+ asserts_file_exist /opt/config/openstack_username.txt
+ asserts_file_exist /opt/config/tenant_id.txt
+ asserts_file_exist /opt/config/dmaap_topic.txt
+ asserts_file_exist /opt/config/docker_version.txt
+}
+
+# test_docker_openecomp_login() - Verify the proper login to OpenECOMP Docker Hub
+function test_docker_openecomp_login {
+ docker_openecomp_login
+}
+
+# test_pull_openecomp_image() - Verify the addition of a OpenECOMP container image
+function test_pull_openecomp_image {
+ pull_openecomp_image portalapps ep:1610-1
+
+ asserts_installed_package docker-ce
+ asserts_image ep:1610-1
+
+ docker rmi -f ep:1610-1
+}
+
+# test_clone_repo() - Verify cloning and pulling source code from repositories
+function test_clone_repo {
+ clone_repo demo
+
+ asserts_installed_package git
+ asserts_file_exist $git_src_folder/demo/LICENSE.TXT
+}
+
+# test_install_dev_tools() - Verify the correct installation of developer tools
+function test_install_dev_tools {
+ install_dev_tools
+
+ asserts_installed_package apt-transport-https
+ asserts_installed_package ca-certificates
+ asserts_installed_package curl
+}
+
+# test_configure_bind() - Verify the correct installation and configuration of bind
+function test_configure_bind {
+ configure_bind
+
+ asserts_installed_package bind9
+ asserts_installed_package bind9utils
+ asserts_file_exist /etc/bind/zones/db.simpledemo.openecomp.org
+ asserts_file_exist /etc/bind/named.conf.options
+ asserts_file_exist /etc/bind/named.conf.local
+
+ rm -rf /etc/bind/
+}
+
+# test_install_java() - Verify the correct installation of java
+function test_install_java {
+ install_java
+
+ asserts_installed_package openjdk-8-jdk
+}
+
+# test_install_maven() - Verify the correct installation and configuration of maven
+function test_install_maven {
+ install_maven
+
+ asserts_installed_package maven3
+ asserts_installed_package openjdk-8-jdk
+ asserts_file_exist $mvn_conf_file
+}
+
+# test_install_nodejs() - Verify the correct installation of NodeJS tools
+function test_install_nodejs {
+ install_nodejs
+
+ asserts_installed_package nodejs
+ asserts_file_exist /usr/bin/npm
+}
+
+# test_install_python() - Verify the correct installation of Python
+function test_install_python {
+ install_python
+ asserts_installed_package python2.7
+ asserts_installed_package python-dev
+ asserts_file_exist /usr/local/bin/tox
+}
+
+# test_install_docker() - Verify the correct installation of Docker
+function test_install_docker {
+ install_docker
+
+ asserts_installed_package docker-ce
+}
+
+# test_pull_docker_image() - Verify the correct retrieve of a specific docker image
+function test_pull_docker_image {
+ local image=attos/dmaap
+ pull_docker_image $image
+
+ asserts_image $image
+
+ docker rmi -f $image
+}
+
+# test_install_docker_compose() - Verify the correct installation of Docker Compose tool
+function test_install_docker_compose {
+ install_docker_compose
+
+ asserts_file_exist /opt/docker/docker-compose
+}
+
+# test_configure_service() - Verify the correct configuration of a specific init service
+function test_configure_service {
+ local service=mso
+
+ configure_service $service
+
+ asserts_file_exist /etc/init.d/$service
+
+ rm -rf /etc/init.d/$service
+}
+
+# test_start_ODL() - Verify the installation and configuration of OpenDayLight controller
+function test_start_ODL {
+ start_ODL
+
+ asserts_file_exist /opt/opendaylight/current/bin/start
+}
+
+# test_compile_src() - Verify the compilation of java code using maven tools
+function test_compile_src {
+ local repo=vid/asdcclient
+ clone_repo $repo
+ compile_src $git_src_folder/$repo
+
+ asserts_file_exist $git_src_folder/$repo/target/asdcclient-1.0.2-SNAPSHOT.jar
+}
+
+# test_build_docker_image() - Verify that a docker image is created from source code
+function test_build_docker_image {
+ clone_repo portal
+ compile_src $git_src_folder/portal/ecomp-portal-widget-ms
+ build_docker_image $git_src_folder/portal/ecomp-portal-widget-ms
+
+ asserts_image widget-ms
+
+ docker rmi -f widget-ms
+}
+
+if [ "$1" != '*' ]; then
+ unset covered_functions
+ covered_functions=$1
+fi
+main "${covered_functions[@]}"
diff --git a/bootstrap/vagrant-onap/tests/test_mr b/bootstrap/vagrant-onap/tests/test_mr
new file mode 100644
index 000000000..6fad08311
--- /dev/null
+++ b/bootstrap/vagrant-onap/tests/test_mr
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+source /var/onap_tests/_test_base
+source /var/onap/mr
+
+covered_functions=(
+"init_mr"
+)
+
+# test_init_mr() - Verify the built and start of Message Router services
+function test_init_mr {
+ init_mr
+
+ asserts_image dockerfiles_kafka
+ asserts_image anapsix/alpine-java
+ asserts_image attos/dmaap
+ asserts_image wurstmeister/zookeeper
+}
+
+if [ "$1" != '*' ]; then
+ unset covered_functions
+ covered_functions=$1
+fi
+main "${covered_functions[@]}"
diff --git a/bootstrap/vagrant-onap/tests/test_mso b/bootstrap/vagrant-onap/tests/test_mso
new file mode 100644
index 000000000..632f6ea02
--- /dev/null
+++ b/bootstrap/vagrant-onap/tests/test_mso
@@ -0,0 +1,48 @@
+#!/bin/bash
+
+source /var/onap_tests/_test_base
+source /var/onap/mso
+
+covered_functions=(
+"clone_all_mso_repos" "compile_all_mso_repos"
+)
+
+# test_clone_all_mso_repos() - Verify the source code retrieve of MSO project
+function test_clone_all_mso_repos {
+ clone_all_mso_repos
+
+ asserts_file_exist $src_folder/pom.xml
+ asserts_file_exist $src_folder/chef-repo/LICENSE.txt
+ asserts_file_exist $src_folder/docker-config/LICENSE.txt
+ asserts_file_exist $src_folder/libs/pom.xml
+ asserts_file_exist $src_folder/mso-config/LICENSE.txt
+}
+
+# test_compile_all_mso_repos() - Verify the correct compilation of MSO projects
+function test_compile_all_mso_repos {
+ clone_all_mso_repos
+ compile_all_mso_repos
+
+ asserts_file_exist $src_folder/libs/ceilometer-client/target/ceilometer-client-1.1.0-SNAPSHOT.jar
+ asserts_file_exist $src_folder/libs/ceilometer-model/target/ceilometer-model-1.1.0-SNAPSHOT.jar
+ asserts_file_exist $src_folder/libs/glance-client/target/glance-client-1.1.0-SNAPSHOT.jar
+ asserts_file_exist $src_folder/libs/glance-model/target/glance-model-1.1.0-SNAPSHOT.jar
+ asserts_file_exist $src_folder/libs/heat-client/target/heat-client-1.1.0-SNAPSHOT.jar
+ asserts_file_exist $src_folder/libs/heat-model/target/heat-model-1.1.0-SNAPSHOT.jar
+ asserts_file_exist $src_folder/libs/keystone-client/target/keystone-client-1.1.0-SNAPSHOT.jar
+ asserts_file_exist $src_folder/libs/keystone-model/target/keystone-model-1.1.0-SNAPSHOT.jar
+ asserts_file_exist $src_folder/libs/nova-client/target/nova-client-1.1.0-SNAPSHOT.jar
+ asserts_file_exist $src_folder/libs/nova-model/target/nova-model-1.1.0-SNAPSHOT.jar
+ asserts_file_exist $src_folder/libs/openstack-client/target/openstack-client-1.1.0-SNAPSHOT.jar
+ asserts_file_exist $src_folder/libs/quantum-client/target/quantum-client-1.1.0-SNAPSHOT.jar
+ asserts_file_exist $src_folder/libs/quantum-model/target/quantum-model-1.1.0-SNAPSHOT.jar
+ asserts_file_exist $src_folder/libs/swift-client/target/swift-client-1.1.0-SNAPSHOT.jar
+ asserts_file_exist $src_folder/libs/swift-model/target/swift-model-1.1.0-SNAPSHOT.jar
+}
+
+
+if [ "$1" != '*' ]; then
+ unset covered_functions
+ covered_functions=$1
+fi
+main "${covered_functions[@]}"
diff --git a/bootstrap/vagrant-onap/tests/test_sdnc b/bootstrap/vagrant-onap/tests/test_sdnc
new file mode 100644
index 000000000..be900d3d8
--- /dev/null
+++ b/bootstrap/vagrant-onap/tests/test_sdnc
@@ -0,0 +1,45 @@
+#!/bin/bash
+
+source /var/onap_tests/_test_base
+source /var/onap/sdnc
+
+covered_functions=(
+"clone_all_sdnc_repos" "compile_all_sdnc_repos" "get_sdnc_images"
+)
+
+# test_clone_all_sdnc_repos() - Verify the source code retrieve of SDNC project
+function test_clone_all_sdnc_repos {
+ clone_all_sdnc_repos
+
+ asserts_file_exist $src_folder/core/pom.xml
+ asserts_file_exist $src_folder/adaptors/pom.xml
+ asserts_file_exist $src_folder/northbound/pom.xml
+ asserts_file_exist $src_folder/plugins/pom.xml
+ asserts_file_exist $src_folder/oam/pom.xml
+}
+
+# test_compile_all_sdnc_repos() - Verify the correct compilation of SDNC projects
+function test_compile_all_sdnc_repos {
+ clone_all_sdnc_repos
+ compile_all_sdnc_repos
+
+ asserts_file_exist $src_folder/core/rootpom/boron-sr1/target/classes/LICENSE
+ asserts_file_exist $src_folder/core/rootpom/boron-sr3/target/classes/LICENSE
+ asserts_file_exist $src_folder/core/rootpom/target/rootpom-1.1.0-site_en.xml
+}
+
+# test_get_sdnc_images() - Verify that the SDNC images are created or retrieved
+function test_get_sdnc_images {
+ clone_all_sdnc_repos
+ get_sdnc_images
+
+ asserts_image openecomp/sdnc-image
+ asserts_image openecomp/admportal-sdnc-image
+ asserts_image openecomp/dgbuilder-sdnc-image
+}
+
+if [ "$1" != '*' ]; then
+ unset covered_functions
+ covered_functions=$1
+fi
+main "${covered_functions[@]}"
diff --git a/bootstrap/vagrant-onap/tests/test_vfc b/bootstrap/vagrant-onap/tests/test_vfc
new file mode 100644
index 000000000..2f71cf1b0
--- /dev/null
+++ b/bootstrap/vagrant-onap/tests/test_vfc
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+source /var/onap_tests/_test_base
+source /var/onap/vfc
+
+covered_functions=(
+"clone_all_vfc_repos"
+)
+
+# test_clone_all_vfc_repos() - Verify cloning and pulling source code from repositories
+function test_clone_all_vfc_repos {
+ # TODO(sshank)
+ echo ""
+}
+
+if [ "$1" != '*' ]; then
+ unset covered_functions
+ covered_functions=$1
+fi
+main "${covered_functions[@]}"
diff --git a/bootstrap/vagrant-onap/tools/get_repos.sh b/bootstrap/vagrant-onap/tools/get_repos.sh
new file mode 100755
index 000000000..7e531bd95
--- /dev/null
+++ b/bootstrap/vagrant-onap/tools/get_repos.sh
@@ -0,0 +1,41 @@
+#!/bin/bash
+
+repos=(
+"aai/aai-data" "aai/aai-config" "aai/aai-service" "aai/data-router" "aai/logging-service" "aai/model-loader" "aai/resources" "aai/rest-client" "aai/router-core" "aai/search-data-service" "aai/sparky-be" "aai/sparky-fe" "aai/test-config" "aai/traversal"
+"appc" "appc/deployment"
+"ci-management"
+"dcae" "dcae/apod" "dcae/apod/analytics" "dcae/apod/buildtools" "dcae/apod/cdap" "dcae/collectors" "dcae/collectors/ves" "dcae/controller" "dcae/controller/analytics" "dcae/dcae-inventory" "dcae/demo" "dcae/demo/startup" "dcae/demo/startup/aaf" "dcae/demo/startup/controller" "dcae/demo/startup/message-router" "dcae/dmaapbc" "dcae/operation" "dcae/operation/utils" "dcae/orch-dispatcher" "dcae/pgaas" "dcae/utils" "dcae/utils/buildtools"
+"demo"
+"ecompsdkos"
+"mso" "mso/chef-repo" "mso/docker-config" "mso/libs" "mso/mso-config"
+"ncomp" "ncomp/cdap" "ncomp/core" "ncomp/docker" "ncomp/maven" "ncomp/openstack" "ncomp/sirius" "ncomp/sirius/manager" "ncomp/utils"
+"policy/common" "policy/docker" "policy/drools-applications" "policy/drools-pdp" "policy/engine"
+"portal"
+"sdc" "sdc/sdc-distribution-client" "sdc/sdc-titan-cassandra" "sdc/sdc_common"
+"sdnc/adaptors" "sdnc/core" "sdnc/northbound" "sdnc/oam" "sdnc/plugins"
+"testsuite" "testsuite/heatbridge" "testsuite/properties" "testsuite/python-testing-utils"
+"ui" "ui/dmaapbc"
+"vid" "vid/asdcclient")
+
+function git_clone_or_pull {
+ local repo=$1
+ local folder="../opt/$1"
+ local mvn_build=$2
+ if [ ! -d $folder ]; then
+ git clone https://git.onap.org/$repo $folder
+ fi
+ pushd $folder > /dev/null
+ git pull -q
+ if [ -f .gitreview ]; then
+ git review -s
+ fi
+ #if [ -f pom.xml ] && [ -n ${mvn_build+x} ]; then
+ #mvn clean -q install -U -DskipTests=true -Dmaven.test.skip=true -Dadditionalparam=-Xdoclint:none
+ #fi
+ popd > /dev/null
+}
+
+for repo in ${repos[@]}; do
+ echo "Working on $repo repository..."
+ git_clone_or_pull $repo
+done
diff --git a/bootstrap/vagrant-onap/tools/run.sh b/bootstrap/vagrant-onap/tools/run.sh
new file mode 100755
index 000000000..e192ba171
--- /dev/null
+++ b/bootstrap/vagrant-onap/tools/run.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+case $1 in
+ "all_in_one" )
+ export DEPLOY_MODE='all-in-one' ;;
+ "dns" | "mr" | "sdc" | "aai" | "mso" | "robot" | "vid" | "sdnc" | "portal" | "dcae" | "policy" | "appc" )
+ export DEPLOY_MODE='individual' ;;
+ "testing" )
+ export DEPLOY_MODE='testing'
+ export TEST_SUITE=${2:-*}
+ export TEST_CASE=${3:-*}
+
+ rm -rf ../opt/
+ rm -rf ~/.m2/;;
+esac
+vagrant destroy -f $1
+vagrant up $1
diff --git a/bootstrap/vagrant-onap/tools/setup_openstack.sh b/bootstrap/vagrant-onap/tools/setup_openstack.sh
new file mode 100755
index 000000000..765ad9446
--- /dev/null
+++ b/bootstrap/vagrant-onap/tools/setup_openstack.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+ubuntu_name=${OS_IMAGE:-"trusty-server-cloudimg-amd64-disk1"}
+export OS_IMAGE=$ubuntu_name
+ubuntu_glance=`openstack image list -c Name -f value | grep "$ubuntu_name"`
+ubuntu_file=/tmp/ubuntu.img
+
+sec_group_name=${OS_SEC_GROUP:-"onap-ssh-secgroup"}
+export OS_SEC_GROUP=$sec_group_name
+sec_group_list=`openstack security group list -c Name -f value | grep "$sec_group_name"`
+
+if [[ -z $ubuntu_glance ]]; then
+ if [ ! -f $ubuntu_file ]; then
+ curl http://cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-amd64-disk1.img -o "$ubuntu_file"
+ fi
+
+ openstack image create --disk-format raw --container-format bare --public --file $ubuntu_file "$ubuntu_name"
+fi
+
+if [[ -z $sec_group_list ]]; then
+ openstack security group create "$sec_group_name"
+ openstack security group rule create --protocol tcp --remote-ip 0.0.0.0/0 --dst-port 22:22 "$sec_group_name"
+fi
diff --git a/bootstrap/vagrant-onap/tox.ini b/bootstrap/vagrant-onap/tox.ini
index 141c151ee..d4b9a207b 100644
--- a/bootstrap/vagrant-onap/tox.ini
+++ b/bootstrap/vagrant-onap/tox.ini
@@ -15,10 +15,9 @@ install_command = pip install {opts} {packages}
deps =
{env:BASHATE_INSTALL_PATH:bashate==0.5.1}
whitelist_externals = bash
-commands = bash -c "find {toxinidir}/{scripts,lib} \
- -not \( -type f -name *.swp -prune \) \
- -not \( -type f -name *.xml -prune \) \
- -type f \
+commands = bash -c "find {toxinidir}/{tests,lib,tools} \
+ -not \( -type f -name *.template -prune \) \
+ -type f \
# E005 file does not begin with #! or have a .sh prefix
# E006 check for lines longer than 79 columns
# E042 local declaration hides errors
diff --git a/bootstrap/vagrant-onap/unit_testing.sh b/bootstrap/vagrant-onap/unit_testing.sh
new file mode 100755
index 000000000..360d28bc7
--- /dev/null
+++ b/bootstrap/vagrant-onap/unit_testing.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+set -o xtrace
+
+rm -rf /opt/
+rm -rf /root/.m2/
+
+set -o errexit
+
+TEST_SUITE=${1:-*}
+TEST_CASE=${2:-*}
+
+for file in $( ls /var/onap_tests/test_$TEST_SUITE); do
+ bash ${file} $TEST_CASE
+done