consolidate rackspace and openstack pktgen for vLB 43/4443/1
authorMarco Platania <platania@research.att.com>
Tue, 23 May 2017 17:59:22 +0000 (13:59 -0400)
committerMarco Platania <platania@research.att.com>
Tue, 23 May 2017 17:59:22 +0000 (13:59 -0400)
Change-Id: Ic8ff995cc4c5ff71e2e2f0ee14661a40b84dbafc
Signed-off-by: Marco Platania <platania@research.att.com>
heat/vLB/packet_gen_vlb.env [moved from heat/vLB/packet_gen_vlb_rackspace.env with 92% similarity]
heat/vLB/packet_gen_vlb.yaml [moved from heat/vLB/packet_gen_vlb_rackspace.yaml with 94% similarity]
heat/vLB/packet_gen_vlb_openstack.env [deleted file]
heat/vLB/packet_gen_vlb_openstack.yaml [deleted file]
vnfs/vLB/scripts/v_packetgen_install.sh

similarity index 92%
rename from heat/vLB/packet_gen_vlb_rackspace.env
rename to heat/vLB/packet_gen_vlb.env
index 91002fe..362b8a9 100644 (file)
@@ -10,3 +10,4 @@ parameters:
   install_script_version: 1.1.0-SNAPSHOT
   key_name: dns_packetgen_key
   pub_key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDQXYJYYi3/OUZXUiCYWdtc7K0m5C0dJKVxPG0eI8EWZrEHYdfYe6WoTSDJCww+1qlBSpA5ac/Ba4Wn9vh+lR1vtUKkyIC/nrYb90ReUd385Glkgzrfh5HdR5y5S2cL/Frh86lAn9r6b3iWTJD8wBwXFyoe1S2nMTOIuG4RPNvfmyCTYVh8XTCCE8HPvh3xv2r4egawG1P4Q4UDwk+hDBXThY2KS8M5/8EMyxHV0ImpLbpYCTBA6KYDIRtqmgS6iKyy8v2D1aSY5mc9J0T5t9S2Gv+VZQNWQDDKNFnxqYaAo1uEoq/i1q63XC5AD3ckXb2VT6dp23BQMdDfbHyUWfJN
+  cloud_env: PUT THE CLOUD ENVIRONMENT HERE (rackspace or openstack)
similarity index 94%
rename from heat/vLB/packet_gen_vlb_rackspace.yaml
rename to heat/vLB/packet_gen_vlb.yaml
index fea9a77..7a63ef3 100644 (file)
@@ -77,6 +77,10 @@ parameters:
     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)
 
 #############
 #           #
@@ -122,6 +126,7 @@ resources:
             __vlb_ipaddr__: { get_param: vlb_ipaddr }
             __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
 
@@ -132,6 +137,7 @@ resources:
             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.openecomp.demo/vnfs/vlb/__install_script_version__/v_packetgen_install.sh -o /opt/v_packetgen_install.sh
diff --git a/heat/vLB/packet_gen_vlb_openstack.env b/heat/vLB/packet_gen_vlb_openstack.env
deleted file mode 100644 (file)
index 724b0ee..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-parameters:
-  vpg_image_name: PUT THE IMAGE NAME HERE
-  vpg_flavor_name: PUT THE FLAVOR NAME HERE
-  public_net_id: PUT THE NETWORK ID HERE
-  vlb_ipaddr: 135.207.129.131
-  vpg_name_0: ziad1vdnspg01pg01
-  onap_private_net_id: PUT THE ONAP PRIVATE NETWORK NAME HERE
-  onap_private_subnet_id: PUT THE ONAP PRIVATE NETWORK NAME HERE
-  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: pgforvdnsdemo_key
-  pub_key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDQXYJYYi3/OUZXUiCYWdtc7K0m5C0dJKVxPG0eI8EWZrEHYdfYe6WoTSDJCww+1qlBSpA5ac/Ba4Wn9vh+lR1vtUKkyIC/nrYb90ReUd385Glkgzrfh5HdR5y5S2cL/Frh86lAn9r6b3iWTJD8wBwXFyoe1S2nMTOIuG4RPNvfmyCTYVh8XTCCE8HPvh3xv2r4egawG1P4Q4UDwk+hDBXThY2KS8M5/8EMyxHV0ImpLbpYCTBA6KYDIRtqmgS6iKyy8v2D1aSY5mc9J0T5t9S2Gv+VZQNWQDDKNFnxqYaAo1uEoq/i1q63XC5AD3ckXb2VT6dp23BQMdDfbHyUWfJN
diff --git a/heat/vLB/packet_gen_vlb_openstack.yaml b/heat/vLB/packet_gen_vlb_openstack.yaml
deleted file mode 100644 (file)
index d968807..0000000
+++ /dev/null
@@ -1,146 +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 to deploy a packet generator for the vLoadBalancer/vDNS demo app for ONAP
-
-##############
-#            #
-# PARAMETERS #
-#            #
-##############
-
-parameters:
-  public_net_id:
-    type: string
-    label: Public network name or ID
-    description: Public network that enables remote connection to VNF
-  vpg_image_name:
-    type: string
-    label: Image name or ID
-    description: Image to be used for compute instance
-  vpg_flavor_name:
-    type: string
-    label: Flavor
-    description: Type of instance (flavor) to be used
-  vpg_name_0:
-    type: string
-    label: vPacketGenerator name
-    description: Name of the vPacketGenerator
-  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
-  vlb_ipaddr:
-    type: string
-    label: Public IP of the vLoadBalancer to which we want to send traffic
-    description: Public IP of the vLoadBalancer to which we want to send traffic
-  demo_artifacts_version:
-    type: string
-    label: Artifacts version used in demo vnfs
-    description: Artifacts (jar, tar.gz) version used in demo vnfs
-  install_script_version:
-    type: string
-    label: Installation script version number
-    description: Version number of the scripts that install the vFW demo app
-  onap_private_net_id:
-    type: string
-    label: ONAP management network name or ID
-    description: Private network that connects ONAP component and the VNF
-  onap_private_subnet_id:
-    type: string
-    label: ONAP management sub-network name or ID
-    description: Private sub-network that connects ONAP component and the VNF
-
-#############
-#           #
-# 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
-
-  vpg_0:
-    type: OS::Nova::Server
-    properties:
-      image: { get_param: vpg_image_name }
-      flavor: { get_param: vpg_flavor_name }
-      name: { get_param: vpg_name_0 }
-      key_name: { get_resource: my_keypair }
-      networks:
-        - network: { get_param: public_net_id }
-      user_data_format: RAW
-      user_data:
-        str_replace:
-          params:
-            __repo_url_blob__ : { get_param: repo_url_blob }
-            __repo_url_artifacts__ : { get_param: repo_url_artifacts }
-            __vlb_ipaddr__: { get_param: vlb_ipaddr }
-            __demo_artifacts_version__ : { get_param: demo_artifacts_version }
-            __install_script_version__ : { get_param: install_script_version }
-          template: |
-            #!/bin/bash
-
-            # Create configuration files
-            mkdir /opt/config
-            echo "__vlb_ipaddr__" > /opt/config/vlb_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
-
-            # Download and run install script
-            curl -k __repo_url_blob__/org.openecomp.demo/vnfs/vlb/__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
\ No newline at end of file
index 3450349..e48e9be 100644 (file)
@@ -4,6 +4,17 @@ REPO_URL_BLOB=$(cat /opt/config/repo_url_blob.txt)
 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)
+
+# OpenStack network configuration
+if [[ $CLOUD_ENV == "openstack" ]]
+then
+       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
 
 # Download required dependencies
 add-apt-repository -y ppa:openjdk-r/ppa