Merge "Fix the esr-gui docker start issue."
authorMarco Platania <platania@research.att.com>
Fri, 13 Oct 2017 13:42:12 +0000 (13:42 +0000)
committerGerrit Code Review <gerrit@onap.org>
Fri, 13 Oct 2017 13:42:12 +0000 (13:42 +0000)
16 files changed:
boot/bind_zones
boot/bind_zones_onap
boot/cli_install.sh
boot/dcae2_install.sh
boot/portal_vm_init.sh
docker_upgrade_scripts/README.md [new file with mode: 0644]
docker_upgrade_scripts/fabfile.py [new file with mode: 0755]
docker_upgrade_scripts/onap_docker_upgrade.conf [new file with mode: 0644]
docker_upgrade_scripts/onap_docker_upgrade.py [new file with mode: 0755]
vagrant/Vagrantfile
vagrant/create_onap.sh [changed mode: 0755->0644]
vagrant/run_demo.sh
vagrant/setup_control.sh
vagrant/setup_proxy.sh
vnfs/VESreporting_vFW5.0/README.md
vnfs/VESreporting_vLB5.0/README.md

index 83b66e2..3823aa6 100644 (file)
@@ -141,3 +141,4 @@ mvim.api.simpledemo.openecomp.org.  IN      CNAME   vm1.openo.simpledemo.openecomp.or
 vnfsdk.api.simpledemo.openecomp.org.   IN      CNAME   vm1.openo.simpledemo.openecomp.org.
 vfc.api.simpledemo.openecomp.org.      IN      CNAME   vm1.openo.simpledemo.openecomp.org.
 uui.api.simpledemo.openecomp.org.      IN      CNAME   vm1.openo.simpledemo.openecomp.org.
+esr.api.simpledemo.openecomp.org.      IN      CNAME   vm1.openo.simpledemo.openecomp.org.
index 30bc38a..2989164 100644 (file)
@@ -141,3 +141,4 @@ mvim.api.simpledemo.onap.org.       IN      CNAME   vm1.openo.simpledemo.onap.org.
 vnfsdk.api.simpledemo.onap.org.        IN      CNAME   vm1.openo.simpledemo.onap.org.
 vfc.api.simpledemo.onap.org.   IN      CNAME   vm1.openo.simpledemo.onap.org.
 uui.api.simpledemo.onap.org.   IN      CNAME   vm1.openo.simpledemo.onap.org.
+esr.api.simpledemo.onap.org.   IN      CNAME   vm1.openo.simpledemo.onap.org.
\ No newline at end of file
index d167a1a..c5ec421 100644 (file)
@@ -21,6 +21,7 @@ CLI_INSTALL_DIR=/opt/onap/cli
 CLI_ZIP=cli.zip
 CLI_BIN=/usr/bin/onap
 export ONAP_CLI_HOME=$CLI_INSTALL_DIR
+export CLI_PRODUCT_VERSION=onap-1.1
 
 #create install dir
 if [ -d $CLI_INSTALL_DIR ]
index df1d513..f604172 100644 (file)
@@ -24,25 +24,26 @@ fi
 # Some VM images don't add the private interface automatically, we have to do it during the component installation
 if [[ $CLOUD_ENV == "openstack_nofloat" ]]
 then
-       CIDR=$(cat /opt/config/oam_network_cidr.txt)
-       BITMASK=$(echo $CIDR | cut -d"/" -f2)
+       #CIDR=$(cat /opt/config/oam_network_cidr.txt)
+       #BITMASK=$(echo $CIDR | cut -d"/" -f2)
 
        # Compute the netmask based on the network cidr
-       if [[ $BITMASK == "8" ]]
-       then
-               NETMASK=255.0.0.0
-       elif [[ $BITMASK == "16" ]]
-       then
-               NETMASK=255.255.0.0
-       elif [[ $BITMASK == "24" ]]
-       then
-               NETMASK=255.255.255.0
-       fi
+       #if [[ $BITMASK == "8" ]]
+       #then
+       #       NETMASK=255.0.0.0
+       #elif [[ $BITMASK == "16" ]]
+       #then
+       #       NETMASK=255.255.0.0
+       #elif [[ $BITMASK == "24" ]]
+       #then
+       #       NETMASK=255.255.255.0
+       #fi
 
        echo "auto eth1" >> /etc/network/interfaces
-       echo "iface eth1 inet static" >> /etc/network/interfaces
-       echo "    address $DCAE_IP_ADDR" >> /etc/network/interfaces
-       echo "    netmask $NETMASK" >> /etc/network/interfaces
+       #echo "iface eth1 inet static" >> /etc/network/interfaces
+       #echo "    address $DCAE_IP_ADDR" >> /etc/network/interfaces
+       #echo "    netmask $NETMASK" >> /etc/network/interfaces
+       echo "iface eth1 inet dhcp" >> /etc/network/interfaces
        echo "    mtu $MTU" >> /etc/network/interfaces
        ifup eth1
 fi
@@ -59,7 +60,7 @@ curl -k $NEXUS_REPO/org.onap.demo/boot/$ARTIFACTS_VERSION/dcae2_serv.sh -o /opt/
 chmod +x /opt/dcae2_vm_init.sh
 chmod +x /opt/dcae2_serv.sh
 mv /opt/dcae2_serv.sh /etc/init.d
-update-rc.d dcae_serv.sh defaults
+update-rc.d dcae2_serv.sh defaults
 
 # Download and install docker-engine and docker-compose
 echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" | sudo tee /etc/apt/sources.list.d/docker.list
@@ -125,7 +126,7 @@ openstack:
 keypair: '$OPENSTACK_KEYNAME'
 key_filename: '/opt/dcae/key'
 location_prefix: '$ZONE'
-location_domain: 'onapdevlab.onap.org'
+location_domain: 'dcae.onapdevlab.onap.org'
 codesource_url: 'https://nexus.onap.org/service/local/repositories/raw/content'
 codesource_version: 'org.onap.dcaegen2.deployments/releases/scripts'
 EOF_CONFIG
index d4fd88a..7d1c535 100755 (executable)
@@ -40,9 +40,9 @@ docker tag $NEXUS_DOCKER_REPO/$CLI_IMG_NAME:$CLI_DOCKER_VERSION $CLI_IMG_NAME:$P
 export LOGS_DIR=./logs
 mkdir -p $LOGS_DIR
 
-# Export variable for subdirectory with host-specific property files
+# Export variable for subdirectory with appropriate property files
 # The leading "./" is required for docker-compose
-export PROPS_DIR=./properties_rackspace
+export PROPS_DIR=./properties_simpledemo
 
 # docker-compose is not in /usr/bin
 /opt/docker/docker-compose down
diff --git a/docker_upgrade_scripts/README.md b/docker_upgrade_scripts/README.md
new file mode 100644 (file)
index 0000000..5d98158
--- /dev/null
@@ -0,0 +1,40 @@
+#Docker Upgrade Scripts
+
+##Description
+These scripts will upgrade docker images in all ONAP components 
+
+##Setting UP
+
+apt-get install python-pip
+
+pip install Fabric
+
+Download all the files and modify onap_docker_upgrade.conf with correct configuration based on infrastructure endpoints
+
+[keystone_auth]
+user = <user_name>
+password = <password>
+tenant = <tenant>
+url = <keystone_url>
+
+user: User name to access the tenant
+Password: Password for the user authentication
+tenant: Tenant information
+url: keystone endpoint URL. Currently v2.0 is only supported
+
+[onap]
+instance_prefix = <name>
+
+instance_prefix: ONAP instance prefix configured in heat template or VM name
+
+Deployment type: 1-nic-nofloat, 1-nic-float, 2-nic
+deployment_type = <type>
+
+deployment_type: Based on infrastructure network setup for VMs
+
+dcae_key_path = <key_for_dcae_component>
+onap_key_path = <key_for_onap_component>
+
+Run python onap_docker_upgrade.py
+
+To run daily basis, add the script to cron job and redirect output to a log file
diff --git a/docker_upgrade_scripts/fabfile.py b/docker_upgrade_scripts/fabfile.py
new file mode 100755 (executable)
index 0000000..72e3e61
--- /dev/null
@@ -0,0 +1,32 @@
+from fabric.api import *
+from fabric.context_managers import *
+
+def uptime():
+    res = run('cat /proc/uptime')
+    print res
+
+def host_type():
+       run('uname -s')
+
+def upgrade_docker(server_name, my_env):
+       server_name=server_name.split("-")[1]
+       if server_name in "message-router":
+               execute_file = "/opt/mr_vm_init.sh"
+       elif server_name in "dcae-controller":
+               execute_file = "/opt/dcae2_vm_init.sh"
+       elif server_name in "openo-server":
+               execute_file = "/opt/openo_all_serv.sh" 
+       elif server_name in "dns":
+               execute_file = None
+       else:
+               execute_file = "/opt/" + server_name + "_vm_init.sh"
+       print "Executing file %s" % execute_file
+       if execute_file:
+               with settings( warn_only=True, key_filename=my_env['key_filename'], user=my_env['user']):
+                       sudo(execute_file)
+
+def health_checks_robot(my_env):
+       with settings( warn_only=True, key_filename=my_env['key_filename'], user=my_env['user']):
+               with cd('/opt'):
+                       sudo('./ete.sh health')
+                       
diff --git a/docker_upgrade_scripts/onap_docker_upgrade.conf b/docker_upgrade_scripts/onap_docker_upgrade.conf
new file mode 100644 (file)
index 0000000..9b6e527
--- /dev/null
@@ -0,0 +1,21 @@
+[keystone_auth]
+user = <user_name>
+password = <password>
+tenant = <tenant>
+url = <keystone_url>
+
+[onap]
+instance_prefix = vm1
+
+###Deployment type: 1-nic-nofloat, 1-nic-float, 2-nic
+deployment_type = 1-nic-nofloat
+
+###onap_net_name is required for 1-nic-float and 2-nic environments
+#onap_net_name =
+
+dcae_key_path = <key_for_dcae_component>
+onap_key_path = <key_for_onap_component>
+
+###Nova url is optional and useful when the cloud provider endpoints are internal
+[nova]
+url = <nova_url>
diff --git a/docker_upgrade_scripts/onap_docker_upgrade.py b/docker_upgrade_scripts/onap_docker_upgrade.py
new file mode 100755 (executable)
index 0000000..c11163a
--- /dev/null
@@ -0,0 +1,180 @@
+#!/usr/bin/python
+
+import argparse
+#import getopt
+import json
+import sys
+import urllib2
+import ConfigParser
+import time
+from fabric.context_managers import settings
+from fabric.api import *
+from fabfile import *
+
+
+class ReadConfFile:
+
+    config = None
+
+    def __init__(self, file="onap_docker_upgrade.conf"):
+
+        """
+        Method to read from conf file specific options
+
+        :param file:
+        """
+        self.config = ConfigParser.SafeConfigParser()
+        self.config.readfp(open(file))
+
+    def read_option(self, group, name):
+        """
+        :return:
+        """
+        value = self.config.get(group, name)
+        return value
+
+
+def getToken(url, osuser, ostenant, ospassword):
+
+    """ 
+    Returns a token to the user given a tenant, 
+    user name, password, and OpenStack API URL. 
+    """
+    url = url + '/tokens'
+    tokenRequest = urllib2.Request(url)
+    tokenRequest.add_header("Content-type", "application/json")
+    jsonPayload = json.dumps({'auth' : {'tenantName' : ostenant, 'passwordCredentials' : {'username' : osuser, 'password' : ospassword}}})
+    
+    request = urllib2.urlopen(tokenRequest, jsonPayload)
+    json_data = json.loads(request.read())
+    
+    request.close()
+    return json.dumps(json_data)
+
+def getServers(url, token):
+    """
+    Returns a list of server in a given tenant
+    """
+    url = url + '/servers'
+    #handler=urllib2.HTTPHandler(debuglevel=1)
+    #opener = urllib2.build_opener(handler)
+    #urllib2.install_opener(opener)
+    nova_server_request = urllib2.Request(url)
+    nova_server_request.add_header("Content-type", "application/json")
+    nova_server_request.add_header("X-Auth-Token", token)
+    request = urllib2.urlopen(nova_server_request)
+    json_data = json.loads(request.read())
+    
+    request.close()
+    return json.dumps(json_data)
+
+def getServerInfo(url, token, server):
+    """
+    Returns the server information in a given tenant
+    """
+    url = url + '/servers/' + server
+    #handler=urllib2.HTTPHandler(debuglevel=1)
+    #opener = urllib2.build_opener(handler)
+    #urllib2.install_opener(opener)
+    nova_server_request = urllib2.Request(url)
+    nova_server_request.add_header("Content-type", "application/json")
+    nova_server_request.add_header("X-Auth-Token", token)
+    request = urllib2.urlopen(nova_server_request)
+    json_data = json.loads(request.read())
+
+    request.close()
+    return json.dumps(json_data)
+
+conf_file = ReadConfFile()
+
+#Reading keystone_auth
+url=conf_file.read_option('keystone_auth', 'url')
+user=conf_file.read_option('keystone_auth', 'user')
+password=conf_file.read_option('keystone_auth', 'password')
+tenant=conf_file.read_option('keystone_auth', 'tenant')
+
+#Reading onap
+instance_prefix=conf_file.read_option('onap', 'instance_prefix')
+deployment_type=conf_file.read_option('onap', 'deployment_type')
+if deployment_type in ("1-nic-float" or "2-nic"):
+       onap_net_name=conf_file.read_option('onap', 'onap_net_name')
+dcae_key_path=conf_file.read_option('onap', 'dcae_key_path')
+onap_key_path=conf_file.read_option('onap', 'onap_key_path')
+
+#Reading nova
+nova_url=conf_file.read_option('nova', 'url')
+    
+# Since we return a raw JSON payload from getToken,
+# we need to load it into a readable object.
+adminToken = json.loads(getToken(url, user, tenant, password))
+
+# Access the token portion of the JSON payload and grab the token and tenant ID
+adminTokenID = adminToken['access']['token']['id']
+adminTokenTenantID = adminToken['access']['token']['tenant']['id']
+
+for item in adminToken['access']['serviceCatalog']:
+    """ 
+    The "name" of each OpenStack service catalog item from
+    the item list changed between versions.  Things like 
+    "glance" became "volume" and "keystone" became "identity".  
+    You will need to update this based on your installation.
+    """
+    if nova_url:
+       adminNovaURL = nova_url + "/" + adminTokenTenantID
+    elif item['name'] == "nova": 
+        adminNovaURL = item['endpoints'][0]['adminURL']
+
+print "------ Admin information ------"
+print "Token ID = ", adminTokenID
+print "Tenant ID = ", adminTokenTenantID
+print "Nova URL = ", adminNovaURL
+print "------ End Admin info ---------"
+
+get_nova_servers = json.loads(getServers(adminNovaURL, adminTokenID))
+#print get_nova_servers
+#print get_nova_servers['servers'][0]['id']
+execute_aai1 = False
+for item in get_nova_servers['servers']:
+       #print item['id'], item['name']
+       if instance_prefix in item['name']:
+               print "Found matching server name: %s with id %s" % (item['name'], item['id'])
+               get_server_info = json.loads(getServerInfo(adminNovaURL, adminTokenID, item['id']))
+               for net_info in get_server_info['server']['addresses']:
+                       if deployment_type in ("1-nic-float" or "2-nic"):
+                               if onap_net_name not in net_info:
+                                       server_ip = get_server_info['server']['addresses'][net_info][0]['addr']
+                       elif deployment_type in "1-nic-nofloat":
+                               server_ip = get_server_info['server']['addresses'][net_info][1]['addr']
+                       server_name = item['name']
+                       if "robot" in server_name:
+                               robot_ip = server_ip
+                       elif "aai-inst1" in server_name:
+                               aai1_ip = server_ip
+                               is_aai2_executed = False
+                               if not is_aai2_executed:
+                                       execute_aai1 = False
+                                       aai1_server_name = server_name
+                               else:
+                                       execute_aai1 = True                     
+                       elif "aai-inst2" in server_name:
+                               aai2_ip = server_ip
+                               is_aai2_executed = True
+                       print "IP address of vm %s is %s" % (item['name'], server_ip)
+
+                       with settings(warnings=True, skip_bad_hosts=True):
+                               if "dcae-controller" in server_name:
+                                       execute(upgrade_docker, server_name, hosts=server_ip, my_env={'key_filename':dcae_key_path, 'user':'ubuntu'})
+                               else:
+                                       if "aai-inst1" not in server_name:
+                                               execute(upgrade_docker, server_name, hosts=server_ip, my_env={'key_filename':onap_key_path, 'user':'ubuntu'})
+                                       elif execute_aai1:
+                                               execute(upgrade_docker, server_name, hosts=server_ip, my_env={'key_filename':onap_key_path, 'user':'ubuntu'})
+                                       else:
+                                               print "Skipping %s upgrade until aai2 finishes upgrade" % server_name
+                       
+with settings(warnings=True):
+       if not execute_aai1:
+               print "Starting %s upgrade" % aai1_ip
+               execute(upgrade_docker, aai1_server_name, hosts=aai1_ip, my_env={'key_filename':onap_key_path, 'user':'ubuntu'})
+       time.sleep(300)
+       execute(health_checks_robot, hosts=robot_ip, my_env={'key_filename':onap_key_path, 'user':'ubuntu'})
index 46e1fc2..3a100c6 100644 (file)
@@ -1,12 +1,10 @@
-$num_compute_nodes = 1
+$num_compute_nodes = 2
 
 Vagrant.configure("2") do |config|
 
   config.vm.box = "bento/ubuntu-16.04"
 
   config.vm.provider :virtualbox do |vb|
-    vb.customize ["modifyvm", :id, "--memory", 8192]
-    vb.customize ["modifyvm", :id, "--cpus", 8]
     vb.customize ['modifyvm', :id, '--natnet1', '192.168.240.0/24']
     vb.customize ["modifyvm", :id, "--nicpromisc3", "allow-all"]
     vb.customize "post-boot",["controlvm", :id, "setlinkstate1", "on"]
@@ -20,6 +18,10 @@ Vagrant.configure("2") do |config|
     config.vm.network "private_network", ip: "192.168.0.10"
     config.vm.network "private_network", ip: "192.168.1.10"
     config.vm.provision "shell", path: "setup_control.sh", privileged: false
+    config.vm.provider :virtualbox do |vb|
+      vb.customize ["modifyvm", :id, "--memory", 8192]
+      vb.customize ["modifyvm", :id, "--cpus", 8]
+    end
   end
 
   (1 .. $num_compute_nodes).each do |n|
@@ -29,7 +31,7 @@ Vagrant.configure("2") do |config|
       config.vm.network "private_network", ip: "192.168.1.#{n+20}"
       config.vm.provision "shell", path: "setup_compute.sh", privileged: false
       config.vm.provider :virtualbox do |v|
-        v.customize ["modifyvm", :id, "--memory", 81920]
+        v.customize ["modifyvm", :id, "--memory", 40960 ]
         v.customize ["modifyvm", :id, "--cpus", 8]
         file_to_disk1 = "large_disk_file.#{n}.vdi1"
         v.customize ['createhd', '--filename', file_to_disk1, '--size', 1000 * 1024]
@@ -40,4 +42,15 @@ Vagrant.configure("2") do |config|
       end
     end
   end
+
+  config.vm.define "onap" do |config|
+    config.vm.hostname = "onap"
+    config.vm.network "private_network", ip: "192.168.0.2"
+    config.vm.network "private_network", ip: "192.168.1.2"
+    config.vm.provision "shell", path: "create_onap.sh", privileged: false
+    config.vm.provider :virtualbox do |vb|
+      vb.customize ["modifyvm", :id, "--memory", 4096]
+      vb.customize ["modifyvm", :id, "--cpus", 4]
+    end
+  end
 end
old mode 100755 (executable)
new mode 100644 (file)
index 0b4ed57..55679ab
@@ -1,6 +1,8 @@
 #!/usr/bin/env bash
 set -ex
 
+sudo apt-get install -y python-openstackclient python-heatclient
+
 source /vagrant/openrc
 cp /demo/heat/ONAP/* .
 
@@ -29,13 +31,15 @@ sed -i  "s,keystone_url:.*,keystone_url: http://192.168.0.10/identity/,"  onap_o
 sed -i  "s/dns_list:.*/dns_list: 8.8.8.8/" onap_openstack.env
 sed -i  "s/external_dns:.*/external_dns: 8.8.8.8/" onap_openstack.env
 
+openstack stack delete --yes --wait ONAP || true
 openstack stack create -t onap_openstack.yaml -e onap_openstack.env ONAP
 
-sleep 180
+sleep 300
+sudo sed -i "/.*simpledemo.openecomp.org.*/d" /etc/hosts
 vms=$(grep "_vm:" onap_openstack.yaml | cut -f1 -d"_")
-sudo rm -rf /vagrant/hosts
 for vm in $vms
 do
     ip=$(openstack server list --name $vm -f yaml | grep Networks | cut -f2 -d",")
-    echo "$ip $vm.api.simpledemo.openecomp.org" >> /vagrant/hosts
+    echo "$ip $vm.api.simpledemo.openecomp.org" | sudo tee -a /etc/hosts
 done
+ssh -o StrictHostKeyChecking=no ubuntu@portal.api.simpledemo.openecomp.org -i onap "curl sina.com.cn"
index e99b28d..eaccfad 100755 (executable)
@@ -10,8 +10,3 @@ fi
 
 vagrant destroy -f
 vagrant up
-vagrant ssh control -c "/vagrant/create_onap.sh"
-sudo sed -i "/.*simpledemo.openecomp.org.*/d" /etc/hosts
-cat hosts | sudo tee -a /etc/hosts
-sleep 300
-ssh -o StrictHostKeyChecking=no ubuntu@portal.api.simpledemo.openecomp.org -i onap "curl sina.com.cn"
index 6ff364f..f6bfc7a 100644 (file)
@@ -16,9 +16,9 @@ wget https://cloud-images.ubuntu.com/releases/16.04/release/ubuntu-16.04-server-
 openstack image create ubuntu1404 --file ubuntu-14.04-server-cloudimg-amd64-disk1.img --disk-format qcow2
 openstack image create ubuntu1604 --file ubuntu-16.04-server-cloudimg-amd64-disk1.img --disk-format qcow2
 
-openstack quota set admin --instances 30
-openstack quota set admin --cores 45
-openstack quota set admin --ram 61440
+openstack quota set admin --instances 32
+openstack quota set admin --cores 128
+openstack quota set admin --ram 102400
 
 openstack flavor delete m1.large
 openstack flavor create --public m1.large --id auto --ram 6144 --vcpus 3 --disk 80
index da7452e..d9ee597 100755 (executable)
@@ -3,7 +3,7 @@ set -ex
 
 SOCKS5_IP=${SOCKS5_IP:-127.0.0.1}
 SOCKS5_PORT=${SOCKS5:-1080}
-DNS_SERVER=${DNS_SERVER:-10.248.2.5}
+DNS_SERVER=${DNS_SERVER:-10.248.2.1}
 
 sudo apt-get install -y redsocks iptables
 
index ff6ba25..598b207 100644 (file)
@@ -1,8 +1,6 @@
 
 PROJECT DESCRIPTION
 
-“The content of this directory is currently under development and, at this stage, is not intended for demonstration and/or testing.”
-
 ---
 This project contains the source code and scripts for the periodic generation of network measurement reports. The folder contains:
 
index ff6ba25..598b207 100644 (file)
@@ -1,8 +1,6 @@
 
 PROJECT DESCRIPTION
 
-“The content of this directory is currently under development and, at this stage, is not intended for demonstration and/or testing.”
-
 ---
 This project contains the source code and scripts for the periodic generation of network measurement reports. The folder contains: