diff options
author | Marco Platania <platania@research.att.com> | 2018-08-08 17:30:27 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-08-08 17:30:27 +0000 |
commit | 766cd27f8aee35b6abf2f9eaf2ca4f04f0c6ce75 (patch) | |
tree | 929d792a4859cc9dada7a3b26f1e649b59f0ca4f | |
parent | 42776053a7a321742ae9070d07e880969ad2bfb8 (diff) | |
parent | 1bdfcff9b394e9cc40868c13d2aa6a5e8c7f4a98 (diff) |
Merge "Refactor vCPE vBRG and vBNG image creation process"
-rw-r--r-- | heat/vCPE/vbng/base_vcpe_vbng.env | 6 | ||||
-rw-r--r-- | heat/vCPE/vbng/base_vcpe_vbng.yaml | 38 | ||||
-rw-r--r-- | heat/vCPE/vbng/build_vcpe_vbng.env | 17 | ||||
-rw-r--r-- | heat/vCPE/vbng/build_vcpe_vbng.yaml | 176 | ||||
-rw-r--r-- | heat/vCPE/vbrgemu/base_vcpe_vbrgemu.env | 9 | ||||
-rw-r--r-- | heat/vCPE/vbrgemu/base_vcpe_vbrgemu.yaml | 51 | ||||
-rw-r--r-- | heat/vCPE/vbrgemu/build_vcpe_vbrgemu.env | 18 | ||||
-rw-r--r-- | heat/vCPE/vbrgemu/build_vcpe_vbrgemu.yaml | 189 | ||||
-rw-r--r-- | vnfs/vCPE/scripts/v_bng_build.sh | 70 | ||||
-rw-r--r-- | vnfs/vCPE/scripts/v_bng_install.sh | 88 | ||||
-rw-r--r-- | vnfs/vCPE/scripts/v_brgemu_build.sh | 178 | ||||
-rwxr-xr-x | vnfs/vCPE/scripts/v_brgemu_install.sh | 216 |
12 files changed, 690 insertions, 366 deletions
diff --git a/heat/vCPE/vbng/base_vcpe_vbng.env b/heat/vCPE/vbng/base_vcpe_vbng.env index be6e08dd..6d860adb 100644 --- a/heat/vCPE/vbng/base_vcpe_vbng.env +++ b/heat/vCPE/vbng/base_vcpe_vbng.env @@ -1,6 +1,7 @@ parameters: vcpe_image_name: PUT THE IMAGE NAME HERE (Ubuntu 1604 SUGGESTED) vcpe_flavor_name: PUT THE FLAVOR NAME HERE (MEDIUM FLAVOR SUGGESTED) + compile_state: done public_net_id: PUT THE PUBLIC NETWORK ID HERE brgemu_bng_private_net_id: zdfw1bngin01_private brgemu_bng_private_subnet_id: zdfw1bngin01_sub_private @@ -26,10 +27,7 @@ dcae_collector_port: 8081 repo_url_artifacts: https://nexus.onap.org/content/repositories/staging demo_artifacts_version: 1.3.0 - install_script_version: 1.3.0-SNAPSHOT + script_version: 1.3.0-SNAPSHOT key_name: vbng_key pub_key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDQXYJYYi3/OUZXUiCYWdtc7K0m5C0dJKVxPG0eI8EWZrEHYdfYe6WoTSDJCww+1qlBSpA5ac/Ba4Wn9vh+lR1vtUKkyIC/nrYb90ReUd385Glkgzrfh5HdR5y5S2cL/Frh86lAn9r6b3iWTJD8wBwXFyoe1S2nMTOIuG4RPNvfmyCTYVh8XTCCE8HPvh3xv2r4egawG1P4Q4UDwk+hDBXThY2KS8M5/8EMyxHV0ImpLbpYCTBA6KYDIRtqmgS6iKyy8v2D1aSY5mc9J0T5t9S2Gv+VZQNWQDDKNFnxqYaAo1uEoq/i1q63XC5AD3ckXb2VT6dp23BQMdDfbHyUWfJN cloud_env: PUT THE CLOUD PROVIDED HERE (openstack or rackspace) - vpp_source_repo_url: https://gerrit.fd.io/r/vpp - vpp_source_repo_release_tag: v17.04 - vpp_patch_url: https://git.onap.org/demo/plain/vnfs/vCPE/vpp-radius-client-for-vbng/src/patches/Vpp-Integrate-FreeRADIUS-Client-for-vBNG.patch diff --git a/heat/vCPE/vbng/base_vcpe_vbng.yaml b/heat/vCPE/vbng/base_vcpe_vbng.yaml index aebf13f2..997e4c23 100644 --- a/heat/vCPE/vbng/base_vcpe_vbng.yaml +++ b/heat/vCPE/vbng/base_vcpe_vbng.yaml @@ -141,7 +141,7 @@ parameters: type: string label: Repository URL description: URL of the repository that hosts the demo packages - install_script_version: + script_version: type: string label: Installation script version number description: Version number of the scripts that install the vFW demo app @@ -157,26 +157,14 @@ parameters: type: string label: Cloud environment description: Cloud environment (e.g., openstack, rackspace) - vpp_source_repo_url: - type: string - label: VPP Source Git Repo - description: URL for VPP source codes - vpp_source_repo_release_tag: - type: string - label: VPP Source Git Release Tag - description: Git Release Tag for the VPP source codes - vpp_patch_url: - type: string - label: VPP Patch URL - description: URL for VPP patch for vBNG sdnc_ip_addr: type: string label: SDNC IP address description: IP address of the SDNC - nexus_artifact_repo: + compile_state: type: string - description: Root URL for the Nexus repository for Maven artifacts. - default: "https://nexus.onap.org" + label: Compile State + description: State to compile code or not; included for backwards compatibility ############# # # @@ -259,12 +247,10 @@ resources: __dcae_collector_port__: { get_param: dcae_collector_port } __repo_url_artifacts__ : { get_param: repo_url_artifacts } __demo_artifacts_version__ : { get_param: demo_artifacts_version } - __install_script_version__ : { get_param: install_script_version } + __script_version__ : { get_param: script_version } __cloud_env__ : { get_param: cloud_env } - __vpp_source_repo_url__ : { get_param: vpp_source_repo_url } - __vpp_source_repo_release_tag__ : { get_param: vpp_source_repo_release_tag } - __vpp_patch_url__ : { get_param: vpp_patch_url } __sdnc_ip_addr__: { get_param: sdnc_ip_addr } + __compile_state__ : { get_param: compile_state } __nexus_artifact_repo__: { get_param: nexus_artifact_repo } template: | #!/bin/bash @@ -283,19 +269,17 @@ resources: echo "__dcae_collector_port__" > /opt/config/dcae_collector_port.txt echo "__repo_url_artifacts__" > /opt/config/repo_url_artifacts.txt echo "__demo_artifacts_version__" > /opt/config/demo_artifacts_version.txt - echo "__install_script_version__" > /opt/config/install_script_version.txt + echo "__script_version__" > /opt/config/script_version.txt echo "__cloud_env__" > /opt/config/cloud_env.txt - echo "__vpp_source_repo_url__" > /opt/config/vpp_source_repo_url.txt - echo "__vpp_source_repo_release_tag__" > /opt/config/vpp_source_repo_release_tag.txt - echo "__vpp_patch_url__" > /opt/config/vpp_patch_url.txt echo "__sdnc_ip_addr__" > /opt/config/sdnc_ip_addr.txt + echo "__compile_state__" > /opt/config/compile_state.txt echo "__nexus_artifact_repo__" > /opt/config/nexus_artifact_repo.txt # Download and run install script apt-get -y install unzip - if [[ "__install_script_version__" =~ "SNAPSHOT" ]]; then REPO=snapshots; else REPO=releases; fi - curl -k -L "__nexus_artifact_repo__/service/local/artifact/maven/redirect?r=${REPO}&g=org.onap.demo.vnf.vcpe&a=vcpe-scripts&e=zip&v=__install_script_version__" -o /opt/vcpe-scripts-__install_script_version__.zip - unzip -j /opt/vcpe-scripts-__install_script_version__.zip -d /opt v_bng_install.sh + if [[ "__script_version__" =~ "SNAPSHOT" ]]; then REPO=snapshots; else REPO=releases; fi + curl -k -L "__nexus_artifact_repo__/service/local/artifact/maven/redirect?r=${REPO}&g=org.onap.demo.vnf.vcpe&a=vcpe-scripts&e=zip&v=__script_version__" -o /opt/vcpe-scripts-__script_version__.zip + unzip -j /opt/vcpe-scripts-__script_version__.zip -d /opt v_bng_install.sh cd /opt chmod +x v_bng_install.sh ./v_bng_install.sh diff --git a/heat/vCPE/vbng/build_vcpe_vbng.env b/heat/vCPE/vbng/build_vcpe_vbng.env new file mode 100644 index 00000000..b7e2de05 --- /dev/null +++ b/heat/vCPE/vbng/build_vcpe_vbng.env @@ -0,0 +1,17 @@ + parameters: + vcpe_image_name: PUT THE IMAGE NAME HERE (Ubuntu 1604 SUGGESTED) + vcpe_flavor_name: PUT THE FLAVOR NAME HERE (MEDIUM FLAVOR SUGGESTED) + compile_state: build + public_net_id: PUT THE PUBLIC NETWORK ID HERE + vbng_name_0: zdcpe1cpe01bng01 + vnf_id: vCPE_Infrastructure_Metro_vBNG_demo_app + vf_module_id: vCPE_Intrastructure_Metro_vBNG + repo_url_artifacts: https://nexus.onap.org/content/repositories/staging + demo_artifacts_version: 1.3.0 + script_version: 1.3.0-SNAPSHOT + key_name: vbng_key + pub_key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDQXYJYYi3/OUZXUiCYWdtc7K0m5C0dJKVxPG0eI8EWZrEHYdfYe6WoTSDJCww+1qlBSpA5ac/Ba4Wn9vh+lR1vtUKkyIC/nrYb90ReUd385Glkgzrfh5HdR5y5S2cL/Frh86lAn9r6b3iWTJD8wBwXFyoe1S2nMTOIuG4RPNvfmyCTYVh8XTCCE8HPvh3xv2r4egawG1P4Q4UDwk+hDBXThY2KS8M5/8EMyxHV0ImpLbpYCTBA6KYDIRtqmgS6iKyy8v2D1aSY5mc9J0T5t9S2Gv+VZQNWQDDKNFnxqYaAo1uEoq/i1q63XC5AD3ckXb2VT6dp23BQMdDfbHyUWfJN + cloud_env: PUT THE CLOUD PROVIDED HERE (openstack or rackspace) + vpp_source_repo_url: https://gerrit.fd.io/r/vpp + vpp_source_repo_release_tag: v17.04 + vpp_patch_url: https://git.onap.org/demo/plain/vnfs/vCPE/vpp-radius-client-for-vbng/src/patches/Vpp-Integrate-FreeRADIUS-Client-for-vBNG.patch diff --git a/heat/vCPE/vbng/build_vcpe_vbng.yaml b/heat/vCPE/vbng/build_vcpe_vbng.yaml new file mode 100644 index 00000000..eb623f8a --- /dev/null +++ b/heat/vCPE/vbng/build_vcpe_vbng.yaml @@ -0,0 +1,176 @@ +########################################################################## +# +#==================LICENSE_START========================================== +# +# +# Copyright 2017 AT&T Intellectual Property. All rights reserved. +# +# 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. +# +#==================LICENSE_END============================================ +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +########################################################################## + +heat_template_version: 2013-05-23 + +description: Heat template to build vCPE virtual Broadband Network Gateway (vBNG) + +############## +# # +# PARAMETERS # +# # +############## + +parameters: + vcpe_image_name: + type: string + label: Image name or ID + description: Image to be used for compute instance + vcpe_flavor_name: + type: string + label: Flavor + description: Type of instance (flavor) to be used + public_net_id: + type: string + label: Public network name or ID + description: Public network that enables remote connection to VNF + vbng_name_0: + type: string + label: vBNG name + description: Name of the vBNG + vnf_id: + type: string + label: VNF ID + description: The VNF ID is provided by ONAP + vf_module_id: + type: string + label: vCPE module ID + description: The vCPE Module ID is provided by ONAP + key_name: + type: string + label: Key pair name + description: Public/Private key pair name + pub_key: + type: string + label: Public key + description: Public key to be installed on the compute instance + repo_url_artifacts: + type: string + label: Repository URL + description: URL of the repository that hosts the demo packages + script_version: + type: string + label: Build script version number + description: Version number of the scripts that build the vFW demo app + demo_artifacts_version: + type: string + label: Artifacts version used in demo vnfs + description: Artifacts (jar, tar.gz) version used in demo vnfs + nexus_artifact_repo: + type: string + description: Root URL for the Nexus repository for Maven artifacts. + default: "https://nexus.onap.org" + cloud_env: + type: string + label: Cloud environment + description: Cloud environment (e.g., openstack, rackspace) + vpp_source_repo_url: + type: string + label: VPP Source Git Repo + description: URL for VPP source codes + vpp_source_repo_release_tag: + type: string + label: VPP Source Git Release Tag + description: Git Release Tag for the VPP source codes + vpp_patch_url: + type: string + label: VPP Patch URL + description: URL for VPP patch for vBNG + compile_state: + type: string + label: Compile State + description: State to compile code or not; included for backwards compatibility + +############# +# # +# RESOURCES # +# # +############# + +resources: + + random-str: + type: OS::Heat::RandomString + properties: + length: 4 + + my_keypair: + type: OS::Nova::KeyPair + properties: + name: + str_replace: + template: base_rand + params: + base: { get_param: key_name } + rand: { get_resource: random-str } + public_key: { get_param: pub_key } + save_private_key: false + + + vbng_0: + type: OS::Nova::Server + properties: + image: { get_param: vcpe_image_name } + flavor: { get_param: vcpe_flavor_name } + name: { get_param: vbng_name_0 } + key_name: { get_resource: my_keypair } + networks: + - network: { get_param: public_net_id } + metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }} + user_data_format: RAW + user_data: + str_replace: + params: + __repo_url_artifacts__ : { get_param: repo_url_artifacts } + __demo_artifacts_version__ : { get_param: demo_artifacts_version } + __script_version__ : { get_param: script_version } + __cloud_env__ : { get_param: cloud_env } + __vpp_source_repo_url__ : { get_param: vpp_source_repo_url } + __vpp_source_repo_release_tag__ : { get_param: vpp_source_repo_release_tag } + __vpp_patch_url__ : { get_param: vpp_patch_url } + __compile_state__ : { get_param: compile_state } + __nexus_artifact_repo__: { get_param: nexus_artifact_repo } + template: | + #!/bin/bash + + # Create configuration files + mkdir /opt/config + echo "__repo_url_artifacts__" > /opt/config/repo_url_artifacts.txt + echo "__demo_artifacts_version__" > /opt/config/demo_artifacts_version.txt + echo "__script_version__" > /opt/config/script_version.txt + echo "__cloud_env__" > /opt/config/cloud_env.txt + echo "__vpp_source_repo_url__" > /opt/config/vpp_source_repo_url.txt + echo "__vpp_source_repo_release_tag__" > /opt/config/vpp_source_repo_release_tag.txt + echo "__vpp_patch_url__" > /opt/config/vpp_patch_url.txt + echo "__compile_state__" > /opt/config/compile_state.txt + echo "__nexus_artifact_repo__" > /opt/config/nexus_artifact_repo.txt + + # Download and run install script + apt-get -y install unzip + if [[ "__script_version__" =~ "SNAPSHOT" ]]; then REPO=snapshots; else REPO=releases; fi + curl -k -L "__nexus_artifact_repo__/service/local/artifact/maven/redirect?r=${REPO}&g=org.onap.demo.vnf.vcpe&a=vcpe-scripts&e=zip&v=__script_version__" -o /opt/vcpe-scripts-__script_version__.zip + unzip -j /opt/vcpe-scripts-__script_version__.zip -d /opt v_bng_build.sh + cd /opt + chmod +x v_bng_build.sh + ./v_bng_build.sh diff --git a/heat/vCPE/vbrgemu/base_vcpe_vbrgemu.env b/heat/vCPE/vbrgemu/base_vcpe_vbrgemu.env index 052d12e0..ce29647b 100644 --- a/heat/vCPE/vbrgemu/base_vcpe_vbrgemu.env +++ b/heat/vCPE/vbrgemu/base_vcpe_vbrgemu.env @@ -1,7 +1,7 @@ parameters: vcpe_image_name: PUT THE IMAGE NAME HERE (Ubuntu 1604 or vbrg-base-ubuntu-16-04 SUGGESTED) vcpe_flavor_name: PUT THE FLAVOR NAME HERE (MEDIUM FLAVOR SUGGESTED) - compile_state: PUT THE COMPILE STATE (done, auto or build) + compile_state: done public_net_id: PUT THE PUBLIC NETWORK ID HERE vbrgemu_bng_private_net_id: zdfw1bngin01_private vbrgemu_bng_private_subnet_id: zdfw1bngin01_sub_private @@ -16,12 +16,7 @@ vf_module_id: vCPE_Customer_BRGEMU repo_url_artifacts: https://nexus.onap.org/content/repositories/staging demo_artifacts_version: 1.3.0 - install_script_version: 1.3.0-SNAPSHOT + script_version: 1.3.0-SNAPSHOT key_name: vbrgemu_key pub_key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDKXDgoo3+WOqcUG8/5uUbk81+yczgwC4Y8ywTmuQqbNxlY1oQ0YxdMUqUnhitSXs5S/yRuAVOYHwGg2mCs20oAINrP+mxBI544AMIb9itPjCtgqtE2EWo6MmnFGbHB4Sx3XioE7F4VPsh7japsIwzOjbrQe+Mua1TGQ5d4nfEOQaaglXLLPFfuc7WbhbJbK6Q7rHqZfRcOwAMXgDoBqlyqKeiKwnumddo2RyNT8ljYmvB6buz7KnMinzo7qB0uktVT05FH9Rg0CTWH5norlG5qXgP2aukL0gk1ph8iAt7uYLf1ktp+LJI2gaF6L0/qli9EmVCSLr1uJ38Q8CBflhkh cloud_env: PUT THE CLOUD PROVIDED HERE (openstack or rackspace) - vpp_source_repo_url: https://gerrit.fd.io/r/vpp - vpp_source_repo_release_tag: v17.04 - hc2vpp_source_repo_url: https://gerrit.fd.io/r/hc2vpp - hc2vpp_source_repo_release_tag: v1.17.04 - vpp_patch_url: https://git.onap.org/demo/plain/vnfs/vCPE/vpp-option-82-for-vbrg/src/patches/VPP-Add-Option82-Nat-Filter-For-vBRG.patch diff --git a/heat/vCPE/vbrgemu/base_vcpe_vbrgemu.yaml b/heat/vCPE/vbrgemu/base_vcpe_vbrgemu.yaml index 0af21ef7..22970344 100644 --- a/heat/vCPE/vbrgemu/base_vcpe_vbrgemu.yaml +++ b/heat/vCPE/vbrgemu/base_vcpe_vbrgemu.yaml @@ -78,8 +78,8 @@ parameters: # description: Private IP address towards the BRGEMU private network vbrgemu_name_0: type: string - label: vGW name - description: Name of the vGW + label: vBRG name + description: Name of the vBRG vnf_id: type: string label: VNF ID @@ -100,7 +100,7 @@ parameters: type: string label: Repository URL description: URL of the repository that hosts the demo packages - install_script_version: + script_version: type: string label: Installation script version number description: Version number of the scripts that install the vFW demo app @@ -116,26 +116,6 @@ parameters: type: string label: Cloud environment description: Cloud environment (e.g., openstack, rackspace) - vpp_source_repo_url: - type: string - label: VPP Source Git Repo - description: URL for VPP source codes - vpp_source_repo_release_tag: - type: string - label: VPP Source Git Release Tag - description: Git Release Tag for the VPP source codes - hc2vpp_source_repo_url: - type: string - label: Honeycomb Source Git Repo - description: URL for Honeycomb source codes - hc2vpp_source_repo_release_tag: - type: string - label: Honeycomb Source Git Release Tag - description: Git Release Tag for the Honeycomb source codes - vpp_patch_url: - type: string - label: VPP Patch URL - description: URL for VPP patch for vBRG Emulator sdnc_ip: type: string label: SDNC ip address @@ -143,8 +123,7 @@ parameters: compile_state: type: string label: Compile State - description: State to compile code or not - + description: State to compile code or not; included for backwards compatibility ############# # # @@ -189,7 +168,7 @@ resources: type: OS::Neutron::Port properties: network: { get_param: vbrgemu_bng_private_net_id } - fixed_ips: [{"subnet": { get_param: vbrgemu_bng_private_subnet_id }}] + # fixed_ips: [{"subnet": { get_param: vbrgemu_bng_private_subnet_id }}] ## fixed_ips: [{"subnet": { get_param: vbrgemu_bng_private_subnet_id }, "ip_address": { get_param: vbrgemu_private_ip_0 }}] #vbrgemu_private_1_port: @@ -219,13 +198,8 @@ resources: __brgemu_bng_private_net_cidr__: { get_param: vbrgemu_bng_private_net_cidr } __repo_url_artifacts__ : { get_param: repo_url_artifacts } __demo_artifacts_version__ : { get_param: demo_artifacts_version } - __install_script_version__ : { get_param: install_script_version } + __script_version__ : { get_param: script_version } __cloud_env__ : { get_param: cloud_env } - __vpp_source_repo_url__ : { get_param: vpp_source_repo_url } - __vpp_source_repo_release_tag__ : { get_param: vpp_source_repo_release_tag } - __hc2vpp_source_repo_url__ : { get_param: hc2vpp_source_repo_url } - __hc2vpp_source_repo_release_tag__ : { get_param: hc2vpp_source_repo_release_tag } - __vpp_patch_url__ : { get_param: vpp_patch_url } __sdnc_ip__ : { get_param: sdnc_ip } __compile_state__ : { get_param: compile_state } __nexus_artifact_repo__: { get_param: nexus_artifact_repo } @@ -239,22 +213,17 @@ resources: echo "__brgemu_bng_private_net_cidr__" > /opt/config/brgemu_bng_private_net_cidr.txt echo "__repo_url_artifacts__" > /opt/config/repo_url_artifacts.txt echo "__demo_artifacts_version__" > /opt/config/demo_artifacts_version.txt - echo "__install_script_version__" > /opt/config/install_script_version.txt + echo "__script_version__" > /opt/config/script_version.txt echo "__cloud_env__" > /opt/config/cloud_env.txt - echo "__vpp_source_repo_url__" > /opt/config/vpp_source_repo_url.txt - echo "__vpp_source_repo_release_tag__" > /opt/config/vpp_source_repo_release_tag.txt - echo "__hc2vpp_source_repo_url__" > /opt/config/hc2vpp_source_repo_url.txt - echo "__hc2vpp_source_repo_release_tag__" > /opt/config/hc2vpp_source_repo_release_tag.txt - echo "__vpp_patch_url__" > /opt/config/vpp_patch_url.txt echo "__sdnc_ip__" > /opt/config/sdnc_ip.txt echo "__compile_state__" > /opt/config/compile_state.txt echo "__nexus_artifact_repo__" > /opt/config/nexus_artifact_repo.txt # Download and run install script apt-get -y install unzip - if [[ "__install_script_version__" =~ "SNAPSHOT" ]]; then REPO=snapshots; else REPO=releases; fi - curl -k -L "__nexus_artifact_repo__/service/local/artifact/maven/redirect?r=${REPO}&g=org.onap.demo.vnf.vcpe&a=vcpe-scripts&e=zip&v=__install_script_version__" -o /opt/vcpe-scripts-__install_script_version__.zip - unzip -j /opt/vcpe-scripts-__install_script_version__.zip -d /opt v_brgemu_install.sh + if [[ "__script_version__" =~ "SNAPSHOT" ]]; then REPO=snapshots; else REPO=releases; fi + curl -k -L "__nexus_artifact_repo__/service/local/artifact/maven/redirect?r=${REPO}&g=org.onap.demo.vnf.vcpe&a=vcpe-scripts&e=zip&v=__script_version__" -o /opt/vcpe-scripts-__script_version__.zip + unzip -j /opt/vcpe-scripts-__script_version__.zip -d /opt v_brgemu_install.sh cd /opt chmod +x v_brgemu_install.sh ./v_brgemu_install.sh diff --git a/heat/vCPE/vbrgemu/build_vcpe_vbrgemu.env b/heat/vCPE/vbrgemu/build_vcpe_vbrgemu.env new file mode 100644 index 00000000..4c9ae439 --- /dev/null +++ b/heat/vCPE/vbrgemu/build_vcpe_vbrgemu.env @@ -0,0 +1,18 @@ + parameters: + vcpe_image_name: PUT THE IMAGE NAME HERE (Ubuntu 1604 or vbrg-base-ubuntu-16-04 SUGGESTED) + vcpe_flavor_name: PUT THE FLAVOR NAME HERE (MEDIUM FLAVOR SUGGESTED) + compile_state: build + vbrgemu_name_0: zdcpe1cpe01brgemu01 + vnf_id: vCPE_Infrastructure_BGREMU_demo_app + vf_module_id: vCPE_Customer_BRGEMU + repo_url_artifacts: https://nexus.onap.org/content/repositories/staging + demo_artifacts_version: 1.3.0 + script_version: 1.3.0-SNAPSHOT + key_name: vbrgemu_key + pub_key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDKXDgoo3+WOqcUG8/5uUbk81+yczgwC4Y8ywTmuQqbNxlY1oQ0YxdMUqUnhitSXs5S/yRuAVOYHwGg2mCs20oAINrP+mxBI544AMIb9itPjCtgqtE2EWo6MmnFGbHB4Sx3XioE7F4VPsh7japsIwzOjbrQe+Mua1TGQ5d4nfEOQaaglXLLPFfuc7WbhbJbK6Q7rHqZfRcOwAMXgDoBqlyqKeiKwnumddo2RyNT8ljYmvB6buz7KnMinzo7qB0uktVT05FH9Rg0CTWH5norlG5qXgP2aukL0gk1ph8iAt7uYLf1ktp+LJI2gaF6L0/qli9EmVCSLr1uJ38Q8CBflhkh + cloud_env: PUT THE CLOUD PROVIDED HERE (openstack or rackspace) + vpp_source_repo_url: https://gerrit.fd.io/r/vpp + vpp_source_repo_release_tag: v17.04 + hc2vpp_source_repo_url: https://gerrit.fd.io/r/hc2vpp + hc2vpp_source_repo_release_tag: v1.17.04 + vpp_patch_url: https://git.onap.org/demo/plain/vnfs/vCPE/vpp-option-82-for-vbrg/src/patches/VPP-Add-Option82-Nat-Filter-For-vBRG.patch diff --git a/heat/vCPE/vbrgemu/build_vcpe_vbrgemu.yaml b/heat/vCPE/vbrgemu/build_vcpe_vbrgemu.yaml new file mode 100644 index 00000000..c5a3332e --- /dev/null +++ b/heat/vCPE/vbrgemu/build_vcpe_vbrgemu.yaml @@ -0,0 +1,189 @@ +########################################################################## +# +#==================LICENSE_START========================================== +# +# +# Copyright 2017 AT&T Intellectual Property. All rights reserved. +# +# 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. +# +#==================LICENSE_END============================================ +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +########################################################################## + +heat_template_version: 2013-05-23 + +description: Heat template to build vCPE vBRG Emulator (vBRGEMU) + +####################################################################### +# # +# PARAMETERS # +# # +# 0_port should get IP address from DHCP discover through vBNG # +# DCAE is not monitoring the BRGEMULATOR # +####################################################################### + +parameters: + vcpe_image_name: + type: string + label: Image name or ID + description: Image to be used for compute instance + vcpe_flavor_name: + type: string + label: Flavor + description: Type of instance (flavor) to be used + public_net_id: + type: string + label: Public network name or ID + description: Public network that enables remote connection to VNF + vbrgemu_name_0: + type: string + label: vBRG name + description: Name of the vBRG + vnf_id: + type: string + label: VNF ID + description: The VNF ID is provided by ONAP + vf_module_id: + type: string + label: vCPE module ID + description: The vCPE Module ID is provided by ONAP + key_name: + type: string + label: Key pair name + description: Public/Private key pair name + pub_key: + type: string + label: Public key + description: Public key to be installed on the compute instance + repo_url_artifacts: + type: string + label: Repository URL + description: URL of the repository that hosts the demo packages + script_version: + type: string + label: Build script version number + description: Version number of the scripts that builds the vFW demo app + demo_artifacts_version: + type: string + label: Artifacts version used in demo vnfs + description: Artifacts (jar, tar.gz) version used in demo vnfs + nexus_artifact_repo: + type: string + description: Root URL for the Nexus repository for Maven artifacts. + default: "https://nexus.onap.org" + cloud_env: + type: string + label: Cloud environment + description: Cloud environment (e.g., openstack, rackspace) + vpp_source_repo_url: + type: string + label: VPP Source Git Repo + description: URL for VPP source codes + vpp_source_repo_release_tag: + type: string + label: VPP Source Git Release Tag + description: Git Release Tag for the VPP source codes + hc2vpp_source_repo_url: + type: string + label: Honeycomb Source Git Repo + description: URL for Honeycomb source codes + hc2vpp_source_repo_release_tag: + type: string + label: Honeycomb Source Git Release Tag + description: Git Release Tag for the Honeycomb source codes + vpp_patch_url: + type: string + label: VPP Patch URL + description: URL for VPP patch for vBRG Emulator + compile_state: + type: string + label: Compile State + description: State to compile code or not; included for backwards compatibility + +############# +# # +# RESOURCES # +# # +############# + +resources: + + random-str: + type: OS::Heat::RandomString + properties: + length: 4 + + my_keypair: + type: OS::Nova::KeyPair + properties: + name: + str_replace: + template: base_rand + params: + base: { get_param: key_name } + rand: { get_resource: random-str } + public_key: { get_param: pub_key } + save_private_key: false + + vbrgemu_0: + type: OS::Nova::Server + properties: + image: { get_param: vcpe_image_name } + flavor: { get_param: vcpe_flavor_name } + name: { get_param: vbrgemu_name_0 } + key_name: { get_resource: my_keypair } + networks: + - network: { get_param: public_net_id } + metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }} + user_data_format: RAW + user_data: + str_replace: + params: + __repo_url_artifacts__ : { get_param: repo_url_artifacts } + __demo_artifacts_version__ : { get_param: demo_artifacts_version } + __script_version__ : { get_param: script_version } + __cloud_env__ : { get_param: cloud_env } + __vpp_source_repo_url__ : { get_param: vpp_source_repo_url } + __vpp_source_repo_release_tag__ : { get_param: vpp_source_repo_release_tag } + __hc2vpp_source_repo_url__ : { get_param: hc2vpp_source_repo_url } + __hc2vpp_source_repo_release_tag__ : { get_param: hc2vpp_source_repo_release_tag } + __vpp_patch_url__ : { get_param: vpp_patch_url } + __compile_state__ : { get_param: compile_state } + __nexus_artifact_repo__: { get_param: nexus_artifact_repo } + template: | + #!/bin/bash + + # Create configuration files + mkdir /opt/config + echo "__repo_url_artifacts__" > /opt/config/repo_url_artifacts.txt + echo "__demo_artifacts_version__" > /opt/config/demo_artifacts_version.txt + echo "__script_version__" > /opt/config/script_version.txt + echo "__cloud_env__" > /opt/config/cloud_env.txt + echo "__vpp_source_repo_url__" > /opt/config/vpp_source_repo_url.txt + echo "__vpp_source_repo_release_tag__" > /opt/config/vpp_source_repo_release_tag.txt + echo "__hc2vpp_source_repo_url__" > /opt/config/hc2vpp_source_repo_url.txt + echo "__hc2vpp_source_repo_release_tag__" > /opt/config/hc2vpp_source_repo_release_tag.txt + echo "__vpp_patch_url__" > /opt/config/vpp_patch_url.txt + echo "__compile_state__" > /opt/config/compile_state.txt + echo "__nexus_artifact_repo__" > /opt/config/nexus_artifact_repo.txt + + # Download and run install script + apt-get -y install unzip + if [[ "__script_version__" =~ "SNAPSHOT" ]]; then REPO=snapshots; else REPO=releases; fi + curl -k -L "__nexus_artifact_repo__/service/local/artifact/maven/redirect?r=${REPO}&g=org.onap.demo.vnf.vcpe&a=vcpe-scripts&e=zip&v=__script_version__" -o /opt/vcpe-scripts-__script_version__.zip + unzip -j /opt/vcpe-scripts-__script_version__.zip -d /opt v_brgemu_build.sh + cd /opt + chmod +x v_brgemu_build.sh + ./v_brgemu_build.sh diff --git a/vnfs/vCPE/scripts/v_bng_build.sh b/vnfs/vCPE/scripts/v_bng_build.sh new file mode 100644 index 00000000..5ad0eb97 --- /dev/null +++ b/vnfs/vCPE/scripts/v_bng_build.sh @@ -0,0 +1,70 @@ +#!/bin/bash +set -o xtrace # print commands during script execution +set -o errexit # exit on command errors + +VPP_SOURCE_REPO_URL=$(cat /opt/config/vpp_source_repo_url.txt) +VPP_SOURCE_REPO_RELEASE_TAG=$(cat /opt/config/vpp_source_repo_release_tag.txt) +VPP_PATCH_URL=$(cat /opt/config/vpp_patch_url.txt) +CLOUD_ENV=$(cat /opt/config/cloud_env.txt) + + +# Convert Network CIDR to Netmask +cdr2mask () { + # Number of args to shift, 255..255, first non-255 byte, zeroes + set -- $(( 5 - ($1 / 8) )) 255 255 255 255 $(( (255 << (8 - ($1 % 8))) & 255 )) 0 0 0 + [ $1 -gt 1 ] && shift $1 || shift + echo ${1-0}.${2-0}.${3-0}.${4-0} +} + + +# Enable IPV4 forwarding through kernel + sed -i 's/^.*\(net.ipv4.ip_forward\).*/\1=1/g' /etc/sysctl.conf + sysctl -p /etc/sysctl.conf + +# Download required dependencies + echo "deb http://ppa.launchpad.net/openjdk-r/ppa/ubuntu $(lsb_release -c -s) main" >> /etc/apt/sources.list.d/java.list + echo "deb-src http://ppa.launchpad.net/openjdk-r/ppa/ubuntu $(lsb_release -c -s) main" >> /etc/apt/sources.list.d/java.list + apt-get update + apt-get install --allow-unauthenticated -y wget openjdk-8-jdk apt-transport-https ca-certificates g++ libcurl4-gnutls-dev + sleep 1 + +# Install the tools required for download codes + apt-get install -y expect git patch make autoconf libtool linux-image-extra-`uname -r` + +# Download and build the VPP codes + cd /opt + git clone ${VPP_SOURCE_REPO_URL} -b ${VPP_SOURCE_REPO_RELEASE_TAG} vpp + wget -O Vpp-Integrate-FreeRADIUS-Client-for-vBNG.patch ${VPP_PATCH_URL} + cd vpp + # The patch will place a "dummy" version of dhcp.api.h so the build will succeed + mkdir -p build-root/build-vpp-native/vpp/vnet/dhcp/ + patch -p1 < ../Vpp-Integrate-FreeRADIUS-Client-for-vBNG.patch + UNATTENDED='y' make install-dep + +# Install the FreeRADIUS client since we need the lib + cd /opt + git clone https://github.com/FreeRADIUS/freeradius-client.git + cd freeradius-client + ./configure + make && make install + cd /usr/local/lib && ln -s -f libfreeradius-client.so.2.0.0 libfreeradiusclient.so + ldconfig + + cd /opt/vpp/build-root + ./bootstrap.sh + make V=0 PLATFORM=vpp TAG=vpp install-deb + +# Install additional dependencies for vpp + apt-get install -y python-cffi python-ply python-pycparser + +# Install the VPP package + cd /opt/vpp/build-root + dpkg -i *.deb + systemctl stop vpp + +# Disable automatic upgrades + if [[ $CLOUD_ENV != "rackspace" ]] + then + echo "APT::Periodic::Unattended-Upgrade \"0\";" >> /etc/apt/apt.conf.d/10periodic + sed -i 's/\(APT::Periodic::Unattended-Upgrade\) "1"/\1 "0"/' /etc/apt/apt.conf.d/20auto-upgrades + fi diff --git a/vnfs/vCPE/scripts/v_bng_install.sh b/vnfs/vCPE/scripts/v_bng_install.sh index 86779126..0ed020f2 100644 --- a/vnfs/vCPE/scripts/v_bng_install.sh +++ b/vnfs/vCPE/scripts/v_bng_install.sh @@ -2,12 +2,7 @@ set -o xtrace # print commands during script execution set -o errexit # exit on command errors -REPO_URL_ARTIFACTS=$(cat /opt/config/repo_url_artifacts.txt) -DEMO_ARTIFACTS_VERSION=$(cat /opt/config/demo_artifacts_version.txt) -INSTALL_SCRIPT_VERSION=$(cat /opt/config/install_script_version.txt) -VPP_SOURCE_REPO_URL=$(cat /opt/config/vpp_source_repo_url.txt) -VPP_SOURCE_REPO_RELEASE_TAG=$(cat /opt/config/vpp_source_repo_release_tag.txt) -VPP_PATCH_URL=$(cat /opt/config/vpp_patch_url.txt) +SCRIPT_VERSION=$(cat /opt/config/script_version.txt) CLOUD_ENV=$(cat /opt/config/cloud_env.txt) BNG_GMUX_NET_CIDR=$(cat /opt/config/bng_gmux_net_cidr.txt) BNG_GMUX_NET_IPADDR=$(cat /opt/config/bng_gmux_net_ipaddr.txt) @@ -17,15 +12,6 @@ CPE_SIGNAL_NET_CIDR=$(cat /opt/config/cpe_signal_net_cidr.txt) CPE_SIGNAL_NET_IPADDR=$(cat /opt/config/cpe_signal_net_ipaddr.txt) SDNC_IP_ADDR=$(cat /opt/config/sdnc_ip_addr.txt) -# Build states are: -# 'build' - just build the code -# 'done' - code is build, install and setup -# 'auto' - bulid, install and setup -BUILD_STATE="auto" -if [[ -f /opt/config/compile_state.txt ]] -then - BUILD_STATE=$(cat /opt/config/compile_state.txt) -fi # Convert Network CIDR to Netmask cdr2mask () { @@ -36,10 +22,8 @@ cdr2mask () { } # OpenStack network configuration -if [[ $BUILD_STATE != "build" ]] +if [[ $CLOUD_ENV == "openstack" ]] then - if [[ $CLOUD_ENV == "openstack" ]] - then echo 127.0.0.1 $(hostname) >> /etc/hosts # Allow remote login as root @@ -59,68 +43,10 @@ then # eth2 probably doesn't exist yet and we should reboot after this anyway # ifup eth2 - fi -fi # endif BUILD_STATE != "build" - -if [[ $BUILD_STATE != "done" ]] -then - # Enable IPV4 forwarding through kernel - sed -i 's/^.*\(net.ipv4.ip_forward\).*/\1=1/g' /etc/sysctl.conf - sysctl -p /etc/sysctl.conf - - # Download required dependencies - echo "deb http://ppa.launchpad.net/openjdk-r/ppa/ubuntu $(lsb_release -c -s) main" >> /etc/apt/sources.list.d/java.list - echo "deb-src http://ppa.launchpad.net/openjdk-r/ppa/ubuntu $(lsb_release -c -s) main" >> /etc/apt/sources.list.d/java.list - apt-get update - apt-get install --allow-unauthenticated -y wget openjdk-8-jdk apt-transport-https ca-certificates g++ libcurl4-gnutls-dev - sleep 1 - - # Install the tools required for download codes - apt-get install -y expect git patch make autoconf libtool linux-image-extra-`uname -r` - - #Download and build the VPP codes - cd /opt - git clone ${VPP_SOURCE_REPO_URL} -b ${VPP_SOURCE_REPO_RELEASE_TAG} vpp - wget -O Vpp-Integrate-FreeRADIUS-Client-for-vBNG.patch ${VPP_PATCH_URL} - cd vpp - # The patch will place a "dummy" version of dhcp.api.h so the build will succeed - mkdir -p build-root/build-vpp-native/vpp/vnet/dhcp/ - patch -p1 < ../Vpp-Integrate-FreeRADIUS-Client-for-vBNG.patch - UNATTENDED='y' make install-dep - - # Install the FreeRADIUS client since we need the lib - cd /opt - git clone https://github.com/FreeRADIUS/freeradius-client.git - cd freeradius-client - ./configure - make && make install - cd /usr/local/lib && ln -s -f libfreeradius-client.so.2.0.0 libfreeradiusclient.so - ldconfig - - cd /opt/vpp/build-root - ./bootstrap.sh - make V=0 PLATFORM=vpp TAG=vpp install-deb - - # install additional dependencies for vpp - apt-get install -y python-cffi python-ply python-pycparser - - # Install the VPP package - cd /opt/vpp/build-root - dpkg -i *.deb - systemctl stop vpp - - # Disable automatic upgrades - if [[ $CLOUD_ENV != "rackspace" ]] - then - echo "APT::Periodic::Unattended-Upgrade \"0\";" >> /etc/apt/apt.conf.d/10periodic - sed -i 's/\(APT::Periodic::Unattended-Upgrade\) "1"/\1 "0"/' /etc/apt/apt.conf.d/20auto-upgrades - fi +fi -fi # endif BUILD_STATE != "done" -if [[ $BUILD_STATE != "build" ]] -then - # Auto-start configuration for the VPP +# Auto-start configuration for the VPP cat > /etc/vpp/startup.conf << EOF unix { @@ -378,8 +304,8 @@ EOF # Download DHCP config files cd /opt - unzip -p -j /opt/vcpe-scripts-$INSTALL_SCRIPT_VERSION.zip v_bng_init.sh > /opt/v_bng_init.sh - unzip -p -j /opt/vcpe-scripts-$INSTALL_SCRIPT_VERSION.zip v_bng.sh > /opt/v_bng.sh + unzip -p -j /opt/vcpe-scripts-$SCRIPT_VERSION.zip v_bng_init.sh > /opt/v_bng_init.sh + unzip -p -j /opt/vcpe-scripts-$SCRIPT_VERSION.zip v_bng.sh > /opt/v_bng.sh chmod +x v_bng_init.sh chmod +x v_bng.sh sed -i 's/^\(# Provides:\).*/\1 v_bng/g' ./v_bng.sh @@ -399,5 +325,3 @@ EOF fi ./v_bng_init.sh -fi # endif BUILD_STATE != "build" - diff --git a/vnfs/vCPE/scripts/v_brgemu_build.sh b/vnfs/vCPE/scripts/v_brgemu_build.sh new file mode 100644 index 00000000..c936fae5 --- /dev/null +++ b/vnfs/vCPE/scripts/v_brgemu_build.sh @@ -0,0 +1,178 @@ +#!/bin/bash + +VPP_SOURCE_REPO_URL=$(cat /opt/config/vpp_source_repo_url.txt) +VPP_SOURCE_REPO_RELEASE_TAG=$(cat /opt/config/vpp_source_repo_release_tag.txt) +VPP_PATCH_URL=$(cat /opt/config/vpp_patch_url.txt) +HC2VPP_SOURCE_REPO_URL=$(cat /opt/config/hc2vpp_source_repo_url.txt) +HC2VPP_SOURCE_REPO_RELEASE_TAG=$(cat /opt/config/hc2vpp_source_repo_release_tag.txt) +CLOUD_ENV=$(cat /opt/config/cloud_env.txt) + +# Convert Network CIDR to Netmask +cdr2mask () { + # Number of args to shift, 255..255, first non-255 byte, zeroes + set -- $(( 5 - ($1 / 8) )) 255 255 255 255 $(( (255 << (8 - ($1 % 8))) & 255 )) 0 0 0 + [ $1 -gt 1 ] && shift $1 || shift + echo ${1-0}.${2-0}.${3-0}.${4-0} +} + +# Download required dependencies + echo "deb http://ppa.launchpad.net/openjdk-r/ppa/ubuntu $(lsb_release -c -s) main" >> /etc/apt/sources.list.d/java.list + echo "deb-src http://ppa.launchpad.net/openjdk-r/ppa/ubuntu $(lsb_release -c -s) main" >> /etc/apt/sources.list.d/java.list + apt-get update + apt-get install --allow-unauthenticated -y wget openjdk-8-jdk apt-transport-https ca-certificates g++ libcurl4-gnutls-dev + sleep 1 + +# Install the tools required for download codes + apt-get install -y expect git patch make linux-image-extra-`uname -r` +#Download and build the VPP codes + cd /opt + git clone ${VPP_SOURCE_REPO_URL} -b ${VPP_SOURCE_REPO_RELEASE_TAG} vpp + wget -O VPP-Add-Option82-Nat-Filter-For-vBRG.patch ${VPP_PATCH_URL} + + cd vpp + patch -p1 < ../VPP-Add-Option82-Nat-Filter-For-vBRG.patch + expect -c " + set timeout 60; + spawn make install-dep; + expect { + \"Do you want to continue?*\" {send \"Y\r\"; interact} + } + " + + cd build-root + ./bootstrap.sh + make V=0 PLATFORM=vpp TAG=vpp install-deb + + # Install the VPP package + dpkg -i *.deb + systemctl stop vpp + +# Download and install HC2VPP from source + cd /opt + git clone ${HC2VPP_SOURCE_REPO_URL} -b ${HC2VPP_SOURCE_REPO_RELEASE_TAG} hc2vpp + + apt-get -f -y install + apt-get install -y maven + mkdir -p /root/.m2 + cat > ~/.m2/settings.xml << EOF +<?xml version="1.0" encoding="UTF-8"?> +<!-- vi: set et smarttab sw=2 tabstop=2: --> +<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"> + + <profiles> + <profile> + <id>fd.io-release</id> + <repositories> + <repository> + <id>fd.io-mirror</id> + <name>fd.io-mirror</name> + <url>https://nexus.fd.io/content/groups/public/</url> + <releases> + <enabled>true</enabled> + <updatePolicy>never</updatePolicy> + </releases> + <snapshots> + <enabled>false</enabled> + </snapshots> + </repository> + </repositories> + <pluginRepositories> + <pluginRepository> + <id>fd.io-mirror</id> + <name>fd.io-mirror</name> + <url>https://nexus.fd.io/content/repositories/public/</url> + <releases> + <enabled>true</enabled> + <updatePolicy>never</updatePolicy> + </releases> + <snapshots> + <enabled>false</enabled> + </snapshots> + </pluginRepository> + </pluginRepositories> + </profile> + + <profile> + <id>fd.io-snapshots</id> + <repositories> + <repository> + <id>fd.io-snapshot</id> + <name>fd.io-snapshot</name> + <url>https://nexus.fd.io/content/repositories/fd.io.snapshot/</url> + <releases> + <enabled>false</enabled> + </releases> + <snapshots> + <enabled>true</enabled> + </snapshots> + </repository> + </repositories> + <pluginRepositories> + <pluginRepository> + <id>fd.io-snapshot</id> + <name>fd.io-snapshot</name> + <url>https://nexus.fd.io/content/repositories/fd.io.snapshot/</url> + <releases> + <enabled>false</enabled> + </releases> + <snapshots> + <enabled>true</enabled> + </snapshots> + </pluginRepository> + </pluginRepositories> + </profile> + <profile> + <id>opendaylight-snapshots</id> + <repositories> + <repository> + <id>opendaylight-snapshot</id> + <name>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>opendaylight-shapshot</id> + <name>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>fd.io-release</activeProfile> + <activeProfile>fd.io-snapshots</activeProfile> + <activeProfile>opendaylight-snapshots</activeProfile> + </activeProfiles> +</settings> +EOF + + cd hc2vpp + mvn clean install + l_version=$(cat pom.xml | grep "<version>" | head -1) + l_version=$(echo "${l_version%<*}") + l_version=$(echo "${l_version#*>}") + mv vpp-integration/minimal-distribution/target/vpp-integration-distribution-${l_version}-hc/vpp-integration-distribution-${l_version} /opt/honeycomb + sed -i 's/127.0.0.1/0.0.0.0/g' /opt/honeycomb/config/honeycomb.json + +# Disable automatic upgrades + if [[ $CLOUD_ENV != "rackspace" ]] + then + echo "APT::Periodic::Unattended-Upgrade \"0\";" >> /etc/apt/apt.conf.d/10periodic + sed -i 's/\(APT::Periodic::Unattended-Upgrade\) "1"/\1 "0"/' /etc/apt/apt.conf.d/20auto-upgrades + fi diff --git a/vnfs/vCPE/scripts/v_brgemu_install.sh b/vnfs/vCPE/scripts/v_brgemu_install.sh index c86e9711..e8be086e 100755 --- a/vnfs/vCPE/scripts/v_brgemu_install.sh +++ b/vnfs/vCPE/scripts/v_brgemu_install.sh @@ -1,25 +1,8 @@ #!/bin/bash -REPO_URL_ARTIFACTS=$(cat /opt/config/repo_url_artifacts.txt) -DEMO_ARTIFACTS_VERSION=$(cat /opt/config/demo_artifacts_version.txt) -INSTALL_SCRIPT_VERSION=$(cat /opt/config/install_script_version.txt) -VPP_SOURCE_REPO_URL=$(cat /opt/config/vpp_source_repo_url.txt) -VPP_SOURCE_REPO_RELEASE_TAG=$(cat /opt/config/vpp_source_repo_release_tag.txt) -VPP_PATCH_URL=$(cat /opt/config/vpp_patch_url.txt) -HC2VPP_SOURCE_REPO_URL=$(cat /opt/config/hc2vpp_source_repo_url.txt) -HC2VPP_SOURCE_REPO_RELEASE_TAG=$(cat /opt/config/hc2vpp_source_repo_release_tag.txt) +SCRIPT_VERSION=$(cat /opt/config/script_version.txt) CLOUD_ENV=$(cat /opt/config/cloud_env.txt) -# Build states are: -# 'build' - just build the code -# 'done' - code is build, install and setup -# 'auto' - bulid, install and setup -BUILD_STATE="auto" - -if [[ -f /opt/config/compile_state.txt ]] -then - BUILD_STATE=$(cat /opt/config/compile_state.txt) -fi # Convert Network CIDR to Netmask cdr2mask () { @@ -30,57 +13,18 @@ cdr2mask () { } # OpenStack network configuration -if [[ $BUILD_STATE != "build" ]] +if [[ $CLOUD_ENV == "openstack" ]] then - if [[ $CLOUD_ENV == "openstack" ]] - then - echo 127.0.0.1 $(hostname) >> /etc/hosts + echo 127.0.0.1 $(hostname) >> /etc/hosts - # Allow remote login as root - mv /root/.ssh/authorized_keys /root/.ssh/authorized_keys.bk - cp /home/ubuntu/.ssh/authorized_keys /root/.ssh - fi -fi # endif BUILD_STATE != "build" + # Allow remote login as root + mv /root/.ssh/authorized_keys /root/.ssh/authorized_keys.bk + cp /home/ubuntu/.ssh/authorized_keys /root/.ssh +fi -if [[ $BUILD_STATE != "done" ]] -then - # Download required dependencies - echo "deb http://ppa.launchpad.net/openjdk-r/ppa/ubuntu $(lsb_release -c -s) main" >> /etc/apt/sources.list.d/java.list - echo "deb-src http://ppa.launchpad.net/openjdk-r/ppa/ubuntu $(lsb_release -c -s) main" >> /etc/apt/sources.list.d/java.list - apt-get update - apt-get install --allow-unauthenticated -y wget openjdk-8-jdk apt-transport-https ca-certificates g++ libcurl4-gnutls-dev - sleep 1 - # Install the tools required for download codes - apt-get install -y expect git patch make linux-image-extra-`uname -r` - #Download and build the VPP codes - cd /opt - git clone ${VPP_SOURCE_REPO_URL} -b ${VPP_SOURCE_REPO_RELEASE_TAG} vpp - wget -O VPP-Add-Option82-Nat-Filter-For-vBRG.patch ${VPP_PATCH_URL} - - cd vpp - patch -p1 < ../VPP-Add-Option82-Nat-Filter-For-vBRG.patch - expect -c " - set timeout 60; - spawn make install-dep; - expect { - \"Do you want to continue?*\" {send \"Y\r\"; interact} - } - " - - cd build-root - ./bootstrap.sh - make V=0 PLATFORM=vpp TAG=vpp install-deb - - # Install the VPP package - dpkg -i *.deb - systemctl stop vpp -fi # endif BUILD_STATE != "done" - -if [[ $BUILD_STATE != "build" ]] -then - # Auto-start configuration for the VPP - cat > /etc/vpp/startup.conf << EOF +# Auto-start configuration for the VPP +cat > /etc/vpp/startup.conf << EOF unix { nodaemon @@ -339,144 +283,7 @@ sleep 15 EOF chmod +x /opt/nat_service.sh -fi # endif BUILD_STATE != "build" -if [[ $BUILD_STATE != "done" ]] -then - - # Download and install HC2VPP from source - cd /opt - git clone ${HC2VPP_SOURCE_REPO_URL} -b ${HC2VPP_SOURCE_REPO_RELEASE_TAG} hc2vpp - - apt-get -f -y install - apt-get install -y maven - mkdir -p /root/.m2 - cat > ~/.m2/settings.xml << EOF -<?xml version="1.0" encoding="UTF-8"?> -<!-- vi: set et smarttab sw=2 tabstop=2: --> -<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"> - - <profiles> - <profile> - <id>fd.io-release</id> - <repositories> - <repository> - <id>fd.io-mirror</id> - <name>fd.io-mirror</name> - <url>https://nexus.fd.io/content/groups/public/</url> - <releases> - <enabled>true</enabled> - <updatePolicy>never</updatePolicy> - </releases> - <snapshots> - <enabled>false</enabled> - </snapshots> - </repository> - </repositories> - <pluginRepositories> - <pluginRepository> - <id>fd.io-mirror</id> - <name>fd.io-mirror</name> - <url>https://nexus.fd.io/content/repositories/public/</url> - <releases> - <enabled>true</enabled> - <updatePolicy>never</updatePolicy> - </releases> - <snapshots> - <enabled>false</enabled> - </snapshots> - </pluginRepository> - </pluginRepositories> - </profile> - - <profile> - <id>fd.io-snapshots</id> - <repositories> - <repository> - <id>fd.io-snapshot</id> - <name>fd.io-snapshot</name> - <url>https://nexus.fd.io/content/repositories/fd.io.snapshot/</url> - <releases> - <enabled>false</enabled> - </releases> - <snapshots> - <enabled>true</enabled> - </snapshots> - </repository> - </repositories> - <pluginRepositories> - <pluginRepository> - <id>fd.io-snapshot</id> - <name>fd.io-snapshot</name> - <url>https://nexus.fd.io/content/repositories/fd.io.snapshot/</url> - <releases> - <enabled>false</enabled> - </releases> - <snapshots> - <enabled>true</enabled> - </snapshots> - </pluginRepository> - </pluginRepositories> - </profile> - <profile> - <id>opendaylight-snapshots</id> - <repositories> - <repository> - <id>opendaylight-snapshot</id> - <name>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>opendaylight-shapshot</id> - <name>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>fd.io-release</activeProfile> - <activeProfile>fd.io-snapshots</activeProfile> - <activeProfile>opendaylight-snapshots</activeProfile> - </activeProfiles> -</settings> -EOF - - cd hc2vpp - mvn clean install - l_version=$(cat pom.xml | grep "<version>" | head -1) - l_version=$(echo "${l_version%<*}") - l_version=$(echo "${l_version#*>}") - mv vpp-integration/minimal-distribution/target/vpp-integration-distribution-${l_version}-hc/vpp-integration-distribution-${l_version} /opt/honeycomb - sed -i 's/127.0.0.1/0.0.0.0/g' /opt/honeycomb/config/honeycomb.json - - # Disable automatic upgrades - if [[ $CLOUD_ENV != "rackspace" ]] - then - echo "APT::Periodic::Unattended-Upgrade \"0\";" >> /etc/apt/apt.conf.d/10periodic - sed -i 's/\(APT::Periodic::Unattended-Upgrade\) "1"/\1 "0"/' /etc/apt/apt.conf.d/20auto-upgrades - fi -fi # endif BUILD_STATE != "done" - -if [[ $BUILD_STATE != "build" ]] -then # Create systemctl service for Honeycomb cat > /etc/systemd/system/honeycomb.service << EOF [Unit] @@ -515,8 +322,8 @@ EOF # Download DHCP config files cd /opt - unzip -p -j /opt/vcpe-scripts-$INSTALL_SCRIPT_VERSION.zip v_brgemu_init.sh > /opt/v_brgemu_init.sh - unzip -p -j /opt/vcpe-scripts-$INSTALL_SCRIPT_VERSION.zip v_brgemu.sh > /opt/v_brgemu.sh + unzip -p -j /opt/vcpe-scripts-$SCRIPT_VERSION.zip v_brgemu_init.sh > /opt/v_brgemu_init.sh + unzip -p -j /opt/vcpe-scripts-$SCRIPT_VERSION.zip v_brgemu.sh > /opt/v_brgemu.sh sed -i '/# Provides:/c\# Provides: vbrg ' /opt/v_brgemu.sh chmod +x v_brgemu_init.sh chmod +x v_brgemu.sh @@ -535,4 +342,3 @@ EOF fi ./v_brgemu_init.sh -fi # endif BUILD_STATE != "build" |