diff options
19 files changed, 68 insertions, 504 deletions
diff --git a/boot/portal_install.sh b/boot/portal_install.sh index 9e7ef2b5..0d54565e 100644 --- a/boot/portal_install.sh +++ b/boot/portal_install.sh @@ -94,4 +94,5 @@ resolvconf -u mkdir -p /PROJECT/OpenSource/UbuntuEP/logs cd /opt git clone -b $GERRIT_BRANCH --single-branch $CODE_REPO + ./portal_vm_init.sh
\ No newline at end of file diff --git a/boot/portal_vm_init.sh b/boot/portal_vm_init.sh index e03fdedc..a6c1ba48 100755 --- a/boot/portal_vm_init.sh +++ b/boot/portal_vm_init.sh @@ -1,73 +1,40 @@ #!/bin/bash -# Starts docker containers for ONAP Portal +# Starts docker containers for ONAP Portal in Rackspace. +# Version for Amsterdam/R1 uses docker-compose. # be verbose set -x -# Refresh source area with start scripts -cd /opt/portal -git pull -cd /opt - # Establish environment variables NEXUS_USERNAME=$(cat /opt/config/nexus_username.txt) NEXUS_PASSWD=$(cat /opt/config/nexus_password.txt) NEXUS_DOCKER_REPO=$(cat /opt/config/nexus_docker_repo.txt) DOCKER_IMAGE_VERSION=$(cat /opt/config/docker_version.txt) -# Get container, image and tag names used below -source portal/deliveries/os_settings.sh +# Refresh configuration and scripts +cd /opt/portal +git pull +cd deliveries + +# Get image names used below from docker-compose environment file +source .env -# Unpack property files -unzip -o portal/deliveries/etc.zip -d /PROJECT/OpenSource/UbuntuEP/ -# Copy (ecomp-portal-BE-os) logback.xml for volume mapping -mv portal/deliveries/os_logback.xml /PROJECT/OpenSource/UbuntuEP/etc/ECOMPPORTALAPP/ +# Copy property files +ETC=/PROJECT/OpenSource/UbuntuEP/etc +mkdir -p $ETC +cp -r properties_rackspace/* $ETC # Refresh images docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO -docker pull $NEXUS_DOCKER_REPO/openecomp/${DB_TAG_NAME}:$DOCKER_IMAGE_VERSION -docker pull $NEXUS_DOCKER_REPO/openecomp/${EP_TAG_NAME}:$DOCKER_IMAGE_VERSION -docker pull $NEXUS_DOCKER_REPO/openecomp/${WMS_TAG_NAME}:$DOCKER_IMAGE_VERSION - -# Remove lingering containers; order matters. -docker rm -f $DB_CONT_NAME -docker rm -f $DB_VOL_NAME -docker rm -f $EP_CONT_NAME -docker rm -f $WMS_CONT_NAME - -docker create --name $DB_VOL_NAME -v /var/lib/mysql mariadb -docker tag $NEXUS_DOCKER_REPO/openecomp/${DB_TAG_NAME}:$DOCKER_IMAGE_VERSION $DB_IMG_NAME -docker tag $NEXUS_DOCKER_REPO/openecomp/${EP_TAG_NAME}:$DOCKER_IMAGE_VERSION $EP_IMG_NAME -# WMS image has no version in the registry -docker tag $NEXUS_DOCKER_REPO/openecomp/${WMS_TAG_NAME}:$DOCKER_IMAGE_VERSION ${WMS_IMG_NAME}:latest - -# Recreate the named containers -cd portal/deliveries -echo "Starting database" -./dbstart.sh -echo "Delaying for database" -sleep 10 -echo "Starting apps" -./new_start.sh -echo "Starting widget-ms" -./widget_ms_start.sh - -sleep 180 - -if [ ! -e /opt/config/boot.txt ] -then - if [ -e /opt/config/public_ip.txt ] - then - IP_ADDRESS=$(cat /opt/config/public_ip.txt) - else - IP_ADDRESS=$(ifconfig eth0 | grep "inet addr" | tr -s ' ' | cut -d' ' -f3 | cut -d':' -f2) - fi - # Wait until MySQL is running... - while [[ $(netstat -vulntp |grep -i mysql | awk '{print $4}') != ":::3306" ]] - do - sleep 1 - done - # no longer necessary; done at docker build time - # mysql -u root -p'Aa123456' -h $IP_ADDRESS < /opt/portal/deliveries/Apps_Users_OnBoarding_Script.sql - echo "yes" > /opt/config/boot.txt -fi +docker pull $NEXUS_DOCKER_REPO/openecomp/${DB_IMG_NAME}:$DOCKER_IMAGE_VERSION +docker pull $NEXUS_DOCKER_REPO/openecomp/${EP_IMG_NAME}:$DOCKER_IMAGE_VERSION +docker pull $NEXUS_DOCKER_REPO/openecomp/${WMS_IMG_NAME}:$DOCKER_IMAGE_VERSION + +# Tag them as expected by docker-compose file +docker tag $NEXUS_DOCKER_REPO/openecomp/${DB_IMG_NAME}:$DOCKER_IMAGE_VERSION $DB_IMG_NAME:$PORTAL_TAG +docker tag $NEXUS_DOCKER_REPO/openecomp/${EP_IMG_NAME}:$DOCKER_IMAGE_VERSION $EP_IMG_NAME:$PORTAL_TAG +docker tag $NEXUS_DOCKER_REPO/openecomp/${WMS_IMG_NAME}:$DOCKER_IMAGE_VERSION $WMS_IMG_NAME:$PORTAL_TAG + +# docker-compose is not in /usr/bin +/opt/docker/docker-compose down +/opt/docker/docker-compose up -d diff --git a/heat/vCPE/infra/base_vcpe_infra_rackspace.env b/heat/vCPE/infra/base_vcpe_infra_rackspace.env index 4de60903..790949bc 100644 --- a/heat/vCPE/infra/base_vcpe_infra_rackspace.env +++ b/heat/vCPE/infra/base_vcpe_infra_rackspace.env @@ -17,6 +17,7 @@ parameters: vdns_private_ip_1: 10.0.101.3 vweb_private_ip_0: 10.2.0.10 vweb_private_ip_1: 10.0.101.40 + mr_ip_addr: 10.0.11.1 vaaa_name_0: zdcpe1cpe01aaa01 vdns_name_0: zdcpe11cpe01dns01 vdhcp_name_0: zdcpe1cpe01dhcp01 diff --git a/heat/vCPE/infra/base_vcpe_infra_rackspace.yaml b/heat/vCPE/infra/base_vcpe_infra_rackspace.yaml index 6b9160bc..c0a18756 100644 --- a/heat/vCPE/infra/base_vcpe_infra_rackspace.yaml +++ b/heat/vCPE/infra/base_vcpe_infra_rackspace.yaml @@ -76,7 +76,7 @@ parameters: vaaa_private_ip_0: type: string label: vAAA private IP address towards the CPE_SIGNAL private network - description: Private IP address that is assigned to the vAAA to communicate with the vCPE components + description: Private IP address that is assigned to the vAAA to communicate with the vCPE components vaaa_private_ip_1: type: string label: vAAA private IP address towards the ONAP management network @@ -137,6 +137,10 @@ parameters: type: string label: DCAE collector port description: Port of the DCAE collector + mr_ip_addr: + type: string + label: Message Router IP address + description: IP address of the Message Router that for vDHCP configuration key_name: type: string label: Key pair name @@ -370,9 +374,10 @@ resources: str_replace: params: __oam_ipaddr__ : { get_param: vdhcp_private_ip_1 } - __cpe_signal_ipaddr__: { get_param: vdhcp_private_ip_0 } - __oam_cidr__: { get_param: onap_private_net_cidr } - __cpe_signal_net_cidr__: { get_param: cpe_signal_net_cidr } + __cpe_signal_ipaddr__ : { get_param: vdhcp_private_ip_0 } + __oam_cidr__ : { get_param: onap_private_net_cidr } + __cpe_signal_net_cidr__ : { get_param: cpe_signal_net_cidr } + __mr_ip_addr__ : { get_param: mr_ip_addr } __repo_url_blob__ : { get_param: repo_url_blob } __repo_url_artifacts__ : { get_param: repo_url_artifacts } __demo_artifacts_version__ : { get_param: demo_artifacts_version } @@ -387,6 +392,7 @@ resources: echo "__cpe_signal_ipaddr__" > /opt/config/cpe_signal_ipaddr.txt echo "__oam_cidr__" > /opt/config/oam_cidr.txt echo "__cpe_signal_net_cidr__" > /opt/config/cpe_signal_net_cidr.txt + echo "__mr_ip_addr__" > /opt/config/mr_ip_addr.txt echo "__repo_url_blob__" > /opt/config/repo_url_blob.txt echo "__repo_url_artifacts__" > /opt/config/repo_url_artifacts.txt echo "__demo_artifacts_version__" > /opt/config/demo_artifacts_version.txt diff --git a/heat/vFW/base_vfw_openstack.env b/heat/vFW/base_vfw.env index 7040f867..9790d0e8 100644 --- a/heat/vFW/base_vfw_openstack.env +++ b/heat/vFW/base_vfw.env @@ -29,4 +29,4 @@ parameters: install_script_version: 1.1.0-SNAPSHOT
key_name: vfw_key
pub_key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDQXYJYYi3/OUZXUiCYWdtc7K0m5C0dJKVxPG0eI8EWZrEHYdfYe6WoTSDJCww+1qlBSpA5ac/Ba4Wn9vh+lR1vtUKkyIC/nrYb90ReUd385Glkgzrfh5HdR5y5S2cL/Frh86lAn9r6b3iWTJD8wBwXFyoe1S2nMTOIuG4RPNvfmyCTYVh8XTCCE8HPvh3xv2r4egawG1P4Q4UDwk+hDBXThY2KS8M5/8EMyxHV0ImpLbpYCTBA6KYDIRtqmgS6iKyy8v2D1aSY5mc9J0T5t9S2Gv+VZQNWQDDKNFnxqYaAo1uEoq/i1q63XC5AD3ckXb2VT6dp23BQMdDfbHyUWfJN
- cloud_env: openstack
+ cloud_env: PUT openstack OR rackspace HERE
diff --git a/heat/vFW/base_vfw_openstack.yaml b/heat/vFW/base_vfw.yaml index 4900c55c..77b53a83 100644 --- a/heat/vFW/base_vfw_openstack.yaml +++ b/heat/vFW/base_vfw.yaml @@ -208,16 +208,13 @@ resources: vfw_private_0_port:
type: OS::Neutron::Port
properties:
- security_groups: []
- port_security_enabled: False
network: { get_resource: unprotected_private_network }
fixed_ips: [{"subnet": { get_resource: unprotected_private_subnet }, "ip_address": { get_param: vfw_private_ip_0 }}]
vfw_private_1_port:
type: OS::Neutron::Port
properties:
- security_groups: []
- port_security_enabled: False
+ allowed_address_pairs: [{ "ip_address": { get_param: vpg_private_ip_0 }}]
network: { get_resource: protected_private_network }
fixed_ips: [{"subnet": { get_resource: protected_private_subnet }, "ip_address": { get_param: vfw_private_ip_1 }}]
diff --git a/heat/vFW/base_vfw_rackspace.env b/heat/vFW/base_vfw_rackspace.env deleted file mode 100644 index 0f6175d1..00000000 --- a/heat/vFW/base_vfw_rackspace.env +++ /dev/null @@ -1,32 +0,0 @@ -parameters: - vfw_image_name: Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM) - vfw_flavor_name: 4 GB General Purpose v1 - public_net_id: 00000000-0000-0000-0000-000000000000 - unprotected_private_net_id: zdfw1fwl01_unprotected - protected_private_net_id: zdfw1fwl01_protected - onap_private_net_id: PUT THE ONAP PRIVATE NETWORK NAME HERE - onap_private_subnet_id: PUT THE ONAP PRIVATE NETWORK NAME HERE - unprotected_private_net_cidr: 192.168.10.0/24 - protected_private_net_cidr: 192.168.20.0/24 - onap_private_net_cidr: 10.0.0.0/16 - vfw_private_ip_0: 192.168.10.100 - vfw_private_ip_1: 192.168.20.100 - vfw_private_ip_2: 10.0.100.1 - vpg_private_ip_0: 192.168.10.200 - vpg_private_ip_1: 10.0.100.2 - vsn_private_ip_0: 192.168.20.250 - vsn_private_ip_1: 10.0.100.3 - vfw_name_0: zdfw1fwl01fwl01 - vpg_name_0: zdfw1fwl01pgn01 - vsn_name_0: zdfw1fwl01snk01 - vnf_id: vFirewall_demo_app - vf_module_id: vFirewall - dcae_collector_ip: 10.0.4.102 - dcae_collector_port: 8080 - repo_url_blob: https://nexus.onap.org/content/sites/raw - repo_url_artifacts: https://nexus.onap.org/content/groups/staging - demo_artifacts_version: 1.1.0 - install_script_version: 1.1.0-SNAPSHOT - key_name: vfw_key - pub_key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDQXYJYYi3/OUZXUiCYWdtc7K0m5C0dJKVxPG0eI8EWZrEHYdfYe6WoTSDJCww+1qlBSpA5ac/Ba4Wn9vh+lR1vtUKkyIC/nrYb90ReUd385Glkgzrfh5HdR5y5S2cL/Frh86lAn9r6b3iWTJD8wBwXFyoe1S2nMTOIuG4RPNvfmyCTYVh8XTCCE8HPvh3xv2r4egawG1P4Q4UDwk+hDBXThY2KS8M5/8EMyxHV0ImpLbpYCTBA6KYDIRtqmgS6iKyy8v2D1aSY5mc9J0T5t9S2Gv+VZQNWQDDKNFnxqYaAo1uEoq/i1q63XC5AD3ckXb2VT6dp23BQMdDfbHyUWfJN - cloud_env: rackspace diff --git a/heat/vFW/base_vfw_rackspace.yaml b/heat/vFW/base_vfw_rackspace.yaml deleted file mode 100644 index 51ac2861..00000000 --- a/heat/vFW/base_vfw_rackspace.yaml +++ /dev/null @@ -1,377 +0,0 @@ -########################################################################## -# -#==================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 that deploys vFirewall demo app for ONAP - -############## -# # -# PARAMETERS # -# # -############## - -parameters: - vfw_image_name: - type: string - label: Image name or ID - description: Image to be used for compute instance - vfw_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 - unprotected_private_net_id: - type: string - label: Unprotected private network name or ID - description: Private network that connects vPacketGenerator with vFirewall - protected_private_net_id: - type: string - label: Protected private network name or ID - description: Private network that connects vFirewall with vSink - onap_private_net_id: - type: string - label: ONAP management network name or ID - description: Private network that connects ONAP components and the VNF - onap_private_subnet_id: - type: string - label: ONAP management sub-network name or ID - description: Private sub-network that connects ONAP components and the VNF - unprotected_private_net_cidr: - type: string - label: Unprotected private network CIDR - description: The CIDR of the unprotected private network - protected_private_net_cidr: - type: string - label: Protected private network CIDR - description: The CIDR of the protected private network - onap_private_net_cidr: - type: string - label: ONAP private network CIDR - description: The CIDR of the protected private network - vfw_private_ip_0: - type: string - label: vFirewall private IP address towards the unprotected network - description: Private IP address that is assigned to the vFirewall to communicate with the vPacketGenerator - vfw_private_ip_1: - type: string - label: vFirewall private IP address towards the protected network - description: Private IP address that is assigned to the vFirewall to communicate with the vSink - vfw_private_ip_2: - type: string - label: vFirewall private IP address towards the ONAP management network - description: Private IP address that is assigned to the vFirewall to communicate with ONAP components - vpg_private_ip_0: - type: string - label: vPacketGenerator private IP address towards the unprotected network - description: Private IP address that is assigned to the vPacketGenerator to communicate with the vFirewall - vpg_private_ip_1: - type: string - label: vPacketGenerator private IP address towards the ONAP management network - description: Private IP address that is assigned to the vPacketGenerator to communicate with ONAP components - vsn_private_ip_0: - type: string - label: vSink private IP address towards the protected network - description: Private IP address that is assigned to the vSink to communicate with the vFirewall - vsn_private_ip_1: - type: string - label: vSink private IP address towards the ONAP management network - description: Private IP address that is assigned to the vSink to communicate with ONAP components - vfw_name_0: - type: string - label: vFirewall name - description: Name of the vFirewall - vpg_name_0: - type: string - label: vPacketGenerator name - description: Name of the vPacketGenerator - vsn_name_0: - type: string - label: vSink name - description: Name of the vSink - vnf_id: - type: string - label: VNF ID - description: The VNF ID is provided by ECOMP - vf_module_id: - type: string - label: vFirewall module ID - description: The vFirewall Module ID is provided by ECOMP - dcae_collector_ip: - type: string - label: DCAE collector IP address - description: IP address of the DCAE collector - dcae_collector_port: - type: string - label: DCAE collector port - description: Port of the DCAE collector - 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_blob: - type: string - label: Repository URL - description: URL of the repository that hosts the demo packages - repo_url_artifacts: - type: string - label: Repository URL - description: URL of the repository that hosts the demo packages - install_script_version: - type: string - label: Installation script version number - description: Version number of the scripts that install 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 - cloud_env: - type: string - label: Cloud environment - description: Cloud environment (e.g., openstack, rackspace) - -############# -# # -# 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 - - unprotected_private_network: - type: OS::Neutron::Net - properties: - name: { get_param: unprotected_private_net_id } - - protected_private_network: - type: OS::Neutron::Net - properties: - name: { get_param: protected_private_net_id } - - unprotected_private_subnet: - type: OS::Neutron::Subnet - properties: - network_id: { get_resource: unprotected_private_network } - cidr: { get_param: unprotected_private_net_cidr } - - protected_private_subnet: - type: OS::Neutron::Subnet - properties: - network_id: { get_resource: protected_private_network } - cidr: { get_param: protected_private_net_cidr } - - # Virtual Firewall instantiation - vfw_private_0_port: - type: OS::Neutron::Port - properties: - network: { get_resource: unprotected_private_network } - fixed_ips: [{"subnet": { get_resource: unprotected_private_subnet }, "ip_address": { get_param: vfw_private_ip_0 }}] - - vfw_private_1_port: - type: OS::Neutron::Port - properties: - network: { get_resource: protected_private_network } - fixed_ips: [{"subnet": { get_resource: protected_private_subnet }, "ip_address": { get_param: vfw_private_ip_1 }}] - - vfw_private_2_port: - type: OS::Neutron::Port - properties: - network: { get_param: onap_private_net_id } - fixed_ips: [{"subnet": { get_param: onap_private_subnet_id }, "ip_address": { get_param: vfw_private_ip_2 }}] - - vfw_0: - type: OS::Nova::Server - properties: - image: { get_param: vfw_image_name } - flavor: { get_param: vfw_flavor_name } - name: { get_param: vfw_name_0 } - key_name: { get_resource: my_keypair } - networks: - - network: { get_param: public_net_id } - - port: { get_resource: vfw_private_0_port } - - port: { get_resource: vfw_private_1_port } - - port: { get_resource: vfw_private_2_port } - metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }} - user_data_format: RAW - user_data: - str_replace: - params: - __dcae_collector_ip__ : { get_param: dcae_collector_ip } - __dcae_collector_port__ : { get_param: dcae_collector_port } - __repo_url_blob__ : { get_param: repo_url_blob } - __repo_url_artifacts__ : { get_param: repo_url_artifacts } - __demo_artifacts_version__ : { get_param: demo_artifacts_version } - __install_script_version__ : { get_param: install_script_version } - __cloud_env__ : { get_param: cloud_env } - template: | - #!/bin/bash - - # Create configuration files - mkdir /opt/config - echo "__dcae_collector_ip__" > /opt/config/dcae_collector_ip.txt - echo "__dcae_collector_port__" > /opt/config/dcae_collector_port.txt - echo "__repo_url_blob__" > /opt/config/repo_url_blob.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 "__cloud_env__" > /opt/config/cloud_env.txt - - # Download and run install script - curl -k __repo_url_blob__/org.onap.demo/vnfs/vfw/__install_script_version__/v_firewall_install.sh -o /opt/v_firewall_install.sh - cd /opt - chmod +x v_firewall_install.sh - ./v_firewall_install.sh - - - # Virtual Packet Generator instantiation - vpg_private_0_port: - type: OS::Neutron::Port - properties: - network: { get_resource: unprotected_private_network } - fixed_ips: [{"subnet": { get_resource: unprotected_private_subnet }, "ip_address": { get_param: vpg_private_ip_0 }}] - - vpg_private_1_port: - type: OS::Neutron::Port - properties: - network: { get_param: onap_private_net_id } - fixed_ips: [{"subnet": { get_param: onap_private_subnet_id }, "ip_address": { get_param: vpg_private_ip_1 }}] - - vpg_0: - type: OS::Nova::Server - properties: - image: { get_param: vfw_image_name } - flavor: { get_param: vfw_flavor_name } - name: { get_param: vpg_name_0 } - key_name: { get_resource: my_keypair } - networks: - - network: { get_param: public_net_id } - - port: { get_resource: vpg_private_0_port } - - port: { get_resource: vpg_private_1_port } - metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }} - user_data_format: RAW - user_data: - str_replace: - params: - __fw_ipaddr__: { get_param: vfw_private_ip_0 } - __protected_net_cidr__: { get_param: protected_private_net_cidr } - __sink_ipaddr__: { get_param: vsn_private_ip_0 } - __repo_url_blob__ : { get_param: repo_url_blob } - __repo_url_artifacts__ : { get_param: repo_url_artifacts } - __demo_artifacts_version__ : { get_param: demo_artifacts_version } - __install_script_version__ : { get_param: install_script_version } - __cloud_env__ : { get_param: cloud_env } - template: | - #!/bin/bash - - # Create configuration files - mkdir /opt/config - echo "__fw_ipaddr__" > /opt/config/fw_ipaddr.txt - echo "__protected_net_cidr__" > /opt/config/protected_net_cidr.txt - echo "__sink_ipaddr__" > /opt/config/sink_ipaddr.txt - echo "__repo_url_blob__" > /opt/config/repo_url_blob.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 "__cloud_env__" > /opt/config/cloud_env.txt - - # Download and run install script - curl -k __repo_url_blob__/org.onap.demo/vnfs/vfw/__install_script_version__/v_packetgen_install.sh -o /opt/v_packetgen_install.sh - cd /opt - chmod +x v_packetgen_install.sh - ./v_packetgen_install.sh - - - # Virtual Sink instantiation - vsn_private_0_port: - type: OS::Neutron::Port - properties: - network: { get_resource: protected_private_network } - fixed_ips: [{"subnet": { get_resource: protected_private_subnet }, "ip_address": { get_param: vsn_private_ip_0 }}] - - vsn_private_1_port: - type: OS::Neutron::Port - properties: - network: { get_param: onap_private_net_id } - fixed_ips: [{"subnet": { get_param: onap_private_subnet_id }, "ip_address": { get_param: vsn_private_ip_1 }}] - - vsn_0: - type: OS::Nova::Server - properties: - image: { get_param: vfw_image_name } - flavor: { get_param: vfw_flavor_name } - name: { get_param: vsn_name_0 } - key_name: { get_resource: my_keypair } - networks: - - network: { get_param: public_net_id } - - port: { get_resource: vsn_private_0_port } - - port: { get_resource: vsn_private_1_port } - metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }} - user_data_format: RAW - user_data: - str_replace: - params: - __protected_net_gw__: { get_param: vfw_private_ip_1 } - __unprotected_net__: { get_param: unprotected_private_net_cidr } - __repo_url_blob__ : { get_param: repo_url_blob } - __install_script_version__ : { get_param: install_script_version } - __cloud_env__ : { get_param: cloud_env } - template: | - #!/bin/bash - - # Create configuration files - mkdir /opt/config - echo "__protected_net_gw__" > /opt/config/protected_net_gw.txt - echo "__unprotected_net__" > /opt/config/unprotected_net.txt - echo "__repo_url_blob__" > /opt/config/repo_url_blob.txt - echo "__install_script_version__" > /opt/config/install_script_version.txt - echo "__cloud_env__" > /opt/config/cloud_env.txt - - # Download and run install script - curl -k __repo_url_blob__/org.onap.demo/vnfs/vfw/__install_script_version__/v_sink_install.sh -o /opt/v_sink_install.sh - cd /opt - chmod +x v_sink_install.sh - ./v_sink_install.sh
\ No newline at end of file diff --git a/vagrant/create_onap.sh b/vagrant/create_onap.sh index 9b4dfc06..0b4ed572 100755 --- a/vagrant/create_onap.sh +++ b/vagrant/create_onap.sh @@ -2,7 +2,7 @@ set -ex source /vagrant/openrc -cp /demo/heat/OpenECOMP/* . +cp /demo/heat/ONAP/* . # Parameters used across all ONAP components pub_net=$(openstack network list -f value|grep public | cut -f1 -d' ') diff --git a/vnfs/vCPE/kea-sdnc-notify-mod/etc/kea-sdnc-notify.conf b/vnfs/vCPE/kea-sdnc-notify-mod/etc/kea-sdnc-notify.conf index 1a8ee2e3..6fd09843 100644 --- a/vnfs/vCPE/kea-sdnc-notify-mod/etc/kea-sdnc-notify.conf +++ b/vnfs/vCPE/kea-sdnc-notify-mod/etc/kea-sdnc-notify.conf @@ -1,3 +1,4 @@ -{"url": "http://localhost/sdnc.php?macaddr=", +{ + "url": "http://DMAAP_IPADDR:3904/events/VCPE-DHCP-EVENT/", "siaddr": "siaddr" } diff --git a/vnfs/vCPE/kea-sdnc-notify-mod/etc/kea-sdnc-notify.conf.test b/vnfs/vCPE/kea-sdnc-notify-mod/etc/kea-sdnc-notify.conf.test new file mode 100644 index 00000000..beba0f15 --- /dev/null +++ b/vnfs/vCPE/kea-sdnc-notify-mod/etc/kea-sdnc-notify.conf.test @@ -0,0 +1,4 @@ +{ + "url": "http://localhost/sdnc.php", + "siaddr": "siaddr" +} diff --git a/vnfs/vCPE/kea-sdnc-notify-mod/src/pkt4_send.cc b/vnfs/vCPE/kea-sdnc-notify-mod/src/pkt4_send.cc index 231a0a8b..70d86289 100644 --- a/vnfs/vCPE/kea-sdnc-notify-mod/src/pkt4_send.cc +++ b/vnfs/vCPE/kea-sdnc-notify-mod/src/pkt4_send.cc @@ -84,10 +84,12 @@ int pkt4_send(CalloutHandle& handle) { hwaddr = hwaddr_ptr->toText(false); yiaddr = new_yiaddr.toText(); msg_name = response4_ptr->getName(); - post_data = "{ macaddr=" + hwaddr + "&yiaddr=" + yiaddr + "&msg=" + msg_name + "}"; - final_url = json_params[0] + hwaddr; + /* POST string for DMaaP */ + post_data = "{\n\"macaddr\":\"" + hwaddr + "\",\n\"yiaddr\":\"" + yiaddr + "\",\n\"msg_name\":\"" + msg_name + "\"\n}"; + final_url = json_params[0] ; LOG_DEBUG(logger, 0, "SNL_BASE").arg(final_url); LOG_DEBUG(logger, 0, "SNL_BASE").arg(yiaddr); + LOG_DEBUG(logger, 0, "SNL_BASE").arg(post_data); if ( msg_name == "DHCPACK") @@ -106,6 +108,7 @@ int pkt4_send(CalloutHandle& handle) { return(1); } + list = curl_slist_append(list, "Content-type: application/json"); list = curl_slist_append(list, "Accept: application/json"); if (list == NULL) { curl_easy_cleanup(curl); @@ -126,15 +129,11 @@ int pkt4_send(CalloutHandle& handle) { curl_opt_res += curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); curl_opt_res += curl_easy_setopt(curl, CURLOPT_HEADER, 1L); - // If we don't set a timeout, curl will try for 300 seconds by default. + // Default curl timeout is 300 seconds curl_opt_res += curl_easy_setopt(curl, CURLOPT_TIMEOUT, 1L); curl_opt_res += curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 1L); - // libcurl's docs say to cast as void, don't blame me. curl_opt_res += curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)response_memfile); - // CURLOPT_URL takes a char* curl_opt_res += curl_easy_setopt(curl, CURLOPT_URL, (final_url).c_str()); - - // let curl use strlen curl_opt_res += curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, -1L ); curl_opt_res += curl_easy_setopt(curl, CURLOPT_POSTFIELDS, post_data.c_str() ); curl_opt_res += curl_easy_setopt(curl, CURLOPT_HTTPHEADER, list); diff --git a/vnfs/vCPE/scripts/kea-sdnc-notify.conf b/vnfs/vCPE/scripts/kea-sdnc-notify.conf index 1a8ee2e3..6fd09843 100644 --- a/vnfs/vCPE/scripts/kea-sdnc-notify.conf +++ b/vnfs/vCPE/scripts/kea-sdnc-notify.conf @@ -1,3 +1,4 @@ -{"url": "http://localhost/sdnc.php?macaddr=", +{ + "url": "http://DMAAP_IPADDR:3904/events/VCPE-DHCP-EVENT/", "siaddr": "siaddr" } diff --git a/vnfs/vCPE/scripts/v_dhcp_install.sh b/vnfs/vCPE/scripts/v_dhcp_install.sh index d88ed509..f9ea25b7 100644 --- a/vnfs/vCPE/scripts/v_dhcp_install.sh +++ b/vnfs/vCPE/scripts/v_dhcp_install.sh @@ -5,6 +5,7 @@ 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) CLOUD_ENV=$(cat /opt/config/cloud_env.txt) +MR_IP_ADDR=$(cat /opt/config/mr_ip_addr.txt) # Convert Network CIDR to Netmask cdr2mask () { @@ -78,6 +79,7 @@ update-rc.d v_dhcp.sh defaults # Configure DHCP cp kea-dhcp4.conf /etc/kea-dhcp4-server.conf mv kea-dhcp4.conf /etc/kea/kea-dhcp4.conf +sed -i "s/DMAAP_IPADDR/"$MR_IP_ADDR"/g" kea-sdnc-notify.conf mv kea-sdnc-notify.conf /etc/kea/kea-sdnc-notify.conf sleep 1 diff --git a/vnfs/vLB/scripts/add_dns.sh b/vnfs/vLB/scripts/add_dns.sh index b6ec17c8..3574e085 100644 --- a/vnfs/vLB/scripts/add_dns.sh +++ b/vnfs/vLB/scripts/add_dns.sh @@ -13,7 +13,7 @@ GRE_IPADDR=$(cat /opt/config/gre_ipaddr.txt) vppctl lb as $IP_TO_PKTGEN_NET"/32" $DNS_IPADDR GRE=$(vppctl create gre tunnel src $IP_TO_DNS_NET dst $DNS_IPADDR) -vppctl set int ip address $GRE $GRE_IPADDR"/24" +vppctl set int ip address $GRE $GRE_IPADDR"/32" vppctl set int state $GRE up # Update the number of vDNSs currently active diff --git a/vnfs/vLB/scripts/run_streams_dns.sh b/vnfs/vLB/scripts/run_streams_dns.sh index 4d4e5432..cf95fa53 100755 --- a/vnfs/vLB/scripts/run_streams_dns.sh +++ b/vnfs/vLB/scripts/run_streams_dns.sh @@ -3,7 +3,7 @@ vppctl packet-gen disable vppctl packet-gen enable-stream dns1 vppctl packet-gen enable-stream dns2 -sleep 300 +sleep 100 vppctl packet-gen enable-stream dns3 vppctl packet-gen enable-stream dns4 vppctl packet-gen enable-stream dns5 diff --git a/vnfs/vLB/scripts/v_packetgen_init.sh b/vnfs/vLB/scripts/v_packetgen_init.sh index c38d2baf..3e0de3e6 100644 --- a/vnfs/vLB/scripts/v_packetgen_init.sh +++ b/vnfs/vLB/scripts/v_packetgen_init.sh @@ -94,13 +94,6 @@ vppctl exec /opt/dns_streams/stream_dns10 vppctl set int ip address pg0 $(cat /opt/config/pg_int.txt)"/"$IPADDR1_CIDR sleep 1 -# Start HoneyComb -VERSION=$(cat /opt/config/demo_artifacts_version.txt) -echo "" > /var/lib/honeycomb/persist/context/data.json -echo "" > /var/lib/honeycomb/persist/config/data.json -/opt/honeycomb/sample-distribution-$VERSION/honeycomb &>/dev/null &disown -sleep 20 - # Enable traffic flows cd /opt chmod +x run_streams_dns.sh diff --git a/vnfs/vLB/scripts/v_packetgen_install.sh b/vnfs/vLB/scripts/v_packetgen_install.sh index 74b84854..621385ca 100644 --- a/vnfs/vLB/scripts/v_packetgen_install.sh +++ b/vnfs/vLB/scripts/v_packetgen_install.sh @@ -51,19 +51,14 @@ apt-get install -y make wget openjdk-8-jdk gcc libcurl4-openssl-dev python-pip b pip install jsonschema # Download vFirewall demo code for packet generator -mkdir /opt/honeycomb cd /opt wget $REPO_URL_BLOB/org.onap.demo/vnfs/vlb/$INSTALL_SCRIPT_VERSION/v_packetgen_init.sh wget $REPO_URL_BLOB/org.onap.demo/vnfs/vlb/$INSTALL_SCRIPT_VERSION/vpacketgen.sh wget $REPO_URL_BLOB/org.onap.demo/vnfs/vlb/$INSTALL_SCRIPT_VERSION/run_streams_dns.sh wget $REPO_URL_BLOB/org.onap.demo/vnfs/vlb/$INSTALL_SCRIPT_VERSION/vdnspacketgen_change_streams_ports.sh -wget $REPO_URL_ARTIFACTS/org/onap/demo/vnf/sample-distribution/$DEMO_ARTIFACTS_VERSION/sample-distribution-$DEMO_ARTIFACTS_VERSION-hc.tar.gz wget $REPO_URL_ARTIFACTS/org/onap/demo/vnf/vlb/vlb_dns_streams/$DEMO_ARTIFACTS_VERSION/vlb_dns_streams-$DEMO_ARTIFACTS_VERSION-demo.tar.gz tar -zxvf vpp.tar.gz -tar -zxvf sample-distribution-$DEMO_ARTIFACTS_VERSION-hc.tar.gz -mv sample-distribution-$DEMO_ARTIFACTS_VERSION honeycomb -sed -i 's/"restconf-binding-address": "127.0.0.1",/"restconf-binding-address": "0.0.0.0",/g' honeycomb/sample-distribution-$DEMO_ARTIFACTS_VERSION/config/honeycomb.json tar -zxvf vlb_dns_streams-$DEMO_ARTIFACTS_VERSION-demo.tar.gz mv vlb_dns_streams-$DEMO_ARTIFACTS_VERSION dns_streams rm *.tar.gz @@ -98,4 +93,7 @@ then reboot fi +# Install a cron job that restart streams every minute. This allows to map streams to different vDNSs when we scale out the VNF +echo "* * * * * /opt/vdnspacketgen_change_streams_ports.sh" | crontab + ./v_packetgen_init.sh diff --git a/vnfs/vLB/scripts/vdnspacketgen_change_streams_ports.sh b/vnfs/vLB/scripts/vdnspacketgen_change_streams_ports.sh index 9bd77162..adfc1f1e 100644 --- a/vnfs/vLB/scripts/vdnspacketgen_change_streams_ports.sh +++ b/vnfs/vLB/scripts/vdnspacketgen_change_streams_ports.sh @@ -1,7 +1,7 @@ #!/bin/bash -#Disable all streams via Honeycomb (so that it will in consistent state) -curl -X PUT -H "Authorization: Basic YWRtaW46YWRtaW4=" -H "Content-Type: application/json" -H "Cache-Control: no-cache" -d '{"pg-streams":{"pg-stream": []}}' "http://localhost:8183/restconf/config/sample-plugin:sample-plugin/pg-streams" +#Disable all streams +killall -9 run_streams_dns.sh vppctl pac del dns1 vppctl pac del dns2 @@ -14,7 +14,6 @@ vppctl pac del dns8 vppctl pac del dns9 vppctl pac del dns10 - #Update destination (vLB) IP VLB_IPADDR=$(cat /opt/config/vlb_ipaddr.txt) IPADDR1=$(ifconfig br0 | grep "inet addr" | tr -s ' ' | cut -d' ' -f3 | cut -d':' -f2) @@ -50,4 +49,8 @@ vppctl exec /opt/dns_streams/stream_dns6 vppctl exec /opt/dns_streams/stream_dns7 vppctl exec /opt/dns_streams/stream_dns8 vppctl exec /opt/dns_streams/stream_dns9 -vppctl exec /opt/dns_streams/stream_dns10
\ No newline at end of file +vppctl exec /opt/dns_streams/stream_dns10 + +#Resume stream execution +cd /opt +./run_streams_dns.sh &>/dev/null &disown
\ No newline at end of file |