Merge remote-tracking branch 'upstream/master' into gerrit-submission 66/6966/2
authorAnderson Bravalheri <a.bravalheri@bristol.ac.uk>
Wed, 28 Nov 2018 17:21:26 +0000 (17:21 +0000)
committerAnderson Bravalheri <a.bravalheri@bristol.ac.uk>
Wed, 28 Nov 2018 17:21:26 +0000 (17:21 +0000)
Sync with master branch

Change-Id: Ic26d043a84f50f48eeebffb512ccea2eedc053a4
Signed-off-by: Anderson Bravalheri <a.bravalheri@bristol.ac.uk>
19 files changed:
1  2 
.gitignore-common
database_utils/migrate_mano_db.sh
docker/Dockerfile-local
openmano
openmanod
osm_ro/db_base.py
osm_ro/httpserver.py
osm_ro/nfvo.py
osm_ro/nfvo_db.py
osm_ro/openmano_schemas.py
osm_ro/openmanoclient.py
osm_ro/openmanod.cfg
osm_ro/utils.py
osm_ro/vim_thread.py
osm_ro/vimconn_openstack.py
scripts/install-openmano.sh
setup.py
test/test_RO.py
test/test_openmanoclient.py

Simple merge
@@@ -201,7 -200,7 +201,8 @@@ f
  #[ $OPENMANO_VER_NUM -ge 5060 ] && DB_VERSION=30  #0.5.60 =>  30
  #[ $OPENMANO_VER_NUM -ge 5061 ] && DB_VERSION=31  #0.5.61 =>  31
  #[ $OPENMANO_VER_NUM -ge 5070 ] && DB_VERSION=32  #0.5.70 =>  32
+ #[ $OPENMANO_VER_NUM -ge 5082 ] && DB_VERSION=33  #0.5.82 =>  33
 +#[ $OPENMANO_VER_NUM -ge 6000 ] && DB_VERSION=34  #0.6.00 =>  34
  #TODO ... put next versions here
  
  function upgrade_to_1(){
@@@ -8,34 -6,27 +6,28 @@@ RUN apt-get update && 
      DEBIAN_FRONTEND=noninteractive apt-get -y install software-properties-common && \
      DEBIAN_FRONTEND=noninteractive add-apt-repository -y cloud-archive:queens && \
      apt-get update && \
-     DEBIAN_FRONTEND=noninteractive apt-get -y install git make python python-pip debhelper python3 python3-all python3-pip python3-setuptools && \
+     DEBIAN_FRONTEND=noninteractive apt-get -y install git python python-pip && \
      DEBIAN_FRONTEND=noninteractive apt-get -y install wget tox && \
-     DEBIAN_FRONTEND=noninteractive pip install pip==9.0.3 && \
-     DEBIAN_FRONTEND=noninteractive pip3 install pip==9.0.3 && \
-     DEBIAN_FRONTEND=noninteractive pip install -U setuptools setuptools-version-command stdeb && \
-     DEBIAN_FRONTEND=noninteractive pip install -U pyang pyangbind && \
-     DEBIAN_FRONTEND=noninteractive pip3 install -U pyang pyangbind && \
-     DEBIAN_FRONTEND=noninteractive apt-get -y install python-yaml python-netaddr python-boto python-networkx && \
-     DEBIAN_FRONTEND=noninteractive apt-get -y install software-properties-common && \
+     DEBIAN_FRONTEND=noninteractive pip2 install pip==9.0.3 && \
+     DEBIAN_FRONTEND=noninteractive pip2 install -U progressbar pyvmomi pyvcloud==19.1.1 && \
      DEBIAN_FRONTEND=noninteractive apt-get -y install python-novaclient python-keystoneclient python-glanceclient python-cinderclient python-neutronclient && \
-     DEBIAN_FRONTEND=noninteractive pip install -U progressbar pyvmomi pyvcloud==19.1.1 && \
-     DEBIAN_FRONTEND=noninteractive apt-get -y install python-argcomplete python-bottle python-cffi python-packaging python-paramiko python-pkgconfig libmysqlclient-dev libssl-dev libffi-dev python-mysqldb && \
-     DEBIAN_FRONTEND=noninteractive apt-get -y install python-logutils python-openstackclient python-openstacksdk && \
-     DEBIAN_FRONTEND=noninteractive pip install untangle && \
-     DEBIAN_FRONTEND=noninteractive pip install -e git+https://github.com/python-oca/python-oca#egg=oca && \
-     DEBIAN_FRONTEND=noninteractive apt-get -y install python-bitarray && \
-     DEBIAN_FRONTEND=noninteractive apt-get -y install mysql-client && \
-     mkdir -p /root/RO && \
-     make -C /root/RO clean all BRANCH=master && \
-     dpkg -i /root/RO/IM/deb_dist/python-pyang_*.deb && \
-     dpkg -i /root/RO/IM/deb_dist/python-pyangbind_*.deb && \
-     dpkg -i /root/RO/IM/deb_dist/python-osm-im*.deb && \
-     dpkg -i /root/RO/openvim/.build/python-lib-osm-openvim*.deb && \
-     dpkg -i /root/RO/.build/python-osm-ro*.deb && \
+     DEBIAN_FRONTEND=noninteractive apt-get -y install python-cffi libmysqlclient-dev libssl-dev libffi-dev python-mysqldb && \
+     DEBIAN_FRONTEND=noninteractive apt-get -y install python-openstacksdk python-openstackclient && \
++    DEBIAN_FRONTEND=noninteractive apt-get -y install python-networkx && \
+     DEBIAN_FRONTEND=noninteractive pip2 install untangle && \
+     DEBIAN_FRONTEND=noninteractive pip2 install -e git+https://github.com/python-oca/python-oca#egg=oca && \
+     DEBIAN_FRONTEND=noninteractive apt-get -y install mysql-client
+ COPY . /root/RO
+ RUN /root/RO/scripts/install-osm-im.sh --develop && \
+     /root/RO/scripts/install-lib-osm-openvim.sh --develop && \
+     make -C /root/RO prepare && \
+     mkdir -p /var/log/osm && \
+     pip2 install -e /root/RO/build && \
      rm -rf /root/.cache && \
      apt-get clean && \
-     rm -rf /var/lib/apt/lists/* && \
-     rm -rf /root/RO
+     rm -rf /var/lib/apt/lists/*
  
  VOLUME /var/log/osm
  
diff --cc openmano
Simple merge
diff --cc openmanod
+++ b/openmanod
@@@ -50,11 -48,11 +50,10 @@@ import osm_r
  
  __author__ = "Alfonso Tierno, Gerardo Garcia, Pablo Montes"
  __date__ = "$26-aug-2014 11:09:29$"
 -__version__ = "0.5.84-r594"
 +__version__ = "0.6.00"
- version_date = "Sep 2018"
+ version_date = "Nov 2018"
 -database_version = 33      # expected database schema version
 -
 +database_version = 34      # expected database schema version
  
  global global_config
  global logger
  
Simple merge
Simple merge
diff --cc osm_ro/nfvo.py
@@@ -1285,11 -1240,12 +1286,12 @@@ def new_vnfd_v3(mydb, tenant_id, vnf_de
                          raise NfvoException("Error. Invalid VNF descriptor at 'vnfd[{vnf}]':'placement-groups[{pg}]':"
                                              "'member-vdus':'{vdu}'. Reference to a non-existing vdu".format(
                                                  vnf=vnfd_id, pg=pg_name, vdu=vdu_id),
 -                                            HTTP_Bad_Request)
 +                                            httperrors.Bad_Request)
-                     db_vms[vdu_id2db_table_index[vdu_id]]["availability_zone"] = pg_name
+                     if vdu_id2db_table_index[vdu_id]:
+                         db_vms[vdu_id2db_table_index[vdu_id]]["availability_zone"] = pg_name
                      # TODO consider the case of isolation and not colocation
                      # if pg.get("strategy") == "ISOLATION":
 -                    
 +
              # VNF mgmt configuration
              mgmt_access = {}
              if vnfd["mgmt-interface"].get("vdu-id"):
                  mgmt_access["ip-address"] = str(vnfd["mgmt-interface"].get("ip-address"))
              if vnfd["mgmt-interface"].get("cp"):
                  if vnfd["mgmt-interface"]["cp"] not in cp_name2iface_uuid:
-                     raise NfvoException("Error. Invalid VNF descriptor at 'vnfd[{vnf}]':'mgmt-interface':'cp':'{cp}'. "
+                     raise NfvoException("Error. Invalid VNF descriptor at 'vnfd[{vnf}]':'mgmt-interface':'cp'['{cp}']. "
                                          "Reference to a non-existing connection-point".format(
                                              vnf=vnfd_id, cp=vnfd["mgmt-interface"]["cp"]),
 -                                        HTTP_Bad_Request)
 +                                        httperrors.Bad_Request)
                  mgmt_access["vm_id"] = cp_name2vm_uuid[vnfd["mgmt-interface"]["cp"]]
                  mgmt_access["interface_id"] = cp_name2iface_uuid[vnfd["mgmt-interface"]["cp"]]
                  # mark this interface as of type mgmt
@@@ -1646,15 -1604,15 +1650,15 @@@ def get_vnf_id(mydb, tenant_id, vnf_id)
              SELECT=('vms.uuid as uuid', 'vms.osm_id as osm_id', 'vms.name as name', 'vms.description as description',
                      'boot_data'),
              WHERE={'vnfs.uuid': vnf_id} )
-     if len(content)==0:
-         raise NfvoException("vnf '{}' not found".format(vnf_id), httperrors.Not_Found)
+     if len(content) != 0:
 -        #raise NfvoException("vnf '{}' not found".format(vnf_id), HTTP_Not_Found)
++        #raise NfvoException("vnf '{}' not found".format(vnf_id), httperrors.Not_Found)
      # change boot_data into boot-data
-     for vm in content:
-         if vm.get("boot_data"):
-             vm["boot-data"] = yaml.safe_load(vm["boot_data"])
-             del vm["boot_data"]
+         for vm in content:
+             if vm.get("boot_data"):
+                 vm["boot-data"] = yaml.safe_load(vm["boot_data"])
+                 del vm["boot_data"]
  
-     data['vnf']['VNFC'] = content
+         data['vnf']['VNFC'] = content
      #TODO: GET all the information from a VNFC and include it in the output.
  
      #GET NET
@@@ -3750,10 -3718,13 +3775,13 @@@ def instantiate_vnf(mydb, sce_vnf, para
                      sce_vnf['name'], vm['name'], iface['internal_name'])
                  if flavor_dict.get('extended') == None:
                      raise NfvoException(e_text + "After database migration some information is not available. \
 -                            Try to delete and create the scenarios and VNFs again", HTTP_Conflict)
 +                            Try to delete and create the scenarios and VNFs again", httperrors.Conflict)
                  else:
 -                    raise NfvoException(e_text, HTTP_Internal_Server_Error)
 +                    raise NfvoException(e_text, httperrors.Internal_Server_Error)
-             if netDict["use"] == "mgmt" or netDict["use"] == "bridge":
+             if netDict["use"] == "mgmt":
+                 is_management_vm = True
+                 netDict["type"] = "virtual"
+             if netDict["use"] == "bridge":
                  netDict["type"] = "virtual"
              if iface.get("vpci"):
                  netDict['vpci'] = iface['vpci']
@@@ -4404,51 -4380,55 +4453,55 @@@ def instance_action(mydb,nfvo_tenant,in
                      WHERE={"vms.uuid": vdu_id},
                      ORDER_BY="vms.created_at"
                  )
-                 if not target_vm:
+                 if not target_vms:
 -                    raise NfvoException("Cannot find the vdu with id {}".format(vdu_id), HTTP_Not_Found)
 +                    raise NfvoException("Cannot find the vdu with id {}".format(vdu_id), httperrors.Not_Found)
              else:
                  if not osm_vdu_id and not member_vnf_index:
-                     raise NfvoException("Invalid imput vdu parameters. Must supply either 'vdu-id' of 'osm_vdu_id','member-vnf-index'")
-                 target_vm = mydb.get_rows(
+                     raise NfvoException("Invalid input vdu parameters. Must supply either 'vdu-id' of 'osm_vdu_id','member-vnf-index'")
+                 target_vms = mydb.get_rows(
                      # SELECT=("ivms.uuid", "ivnfs.datacenter_id", "ivnfs.datacenter_tenant_id"),
                      FROM="instance_vms as ivms join instance_vnfs as ivnfs on ivms.instance_vnf_id=ivnfs.uuid"\
                           " join sce_vnfs as svnfs on ivnfs.sce_vnf_id=svnfs.uuid"\
                           " join vms on ivms.vm_id=vms.uuid",
-                     WHERE={"vms.osm_id": osm_vdu_id, "svnfs.member_vnf_index": member_vnf_index},
+                     WHERE={"vms.osm_id": osm_vdu_id, "svnfs.member_vnf_index": member_vnf_index,
+                            "ivnfs.instance_scenario_id": instance_id},
                      ORDER_BY="ivms.created_at"
                  )
-                 if not target_vm:
+                 if not target_vms:
 -                    raise NfvoException("Cannot find the vdu with osm_vdu_id {} and member-vnf-index {}".format(osm_vdu_id, member_vnf_index), HTTP_Not_Found)
 +                    raise NfvoException("Cannot find the vdu with osm_vdu_id {} and member-vnf-index {}".format(osm_vdu_id, member_vnf_index), httperrors.Not_Found)
-                 vdu_id = target_vm[-1]["uuid"]
-             vm_result[vdu_id] = {"created": [], "deleted": [], "description": "scheduled"}
-             target_vm = target_vm[-1]
+                 vdu_id = target_vms[-1]["uuid"]
+             target_vm = target_vms[-1]
              datacenter = target_vm["datacenter_id"]
              myvim_threads_id[datacenter], _ = get_vim_thread(mydb, nfvo_tenant, datacenter)
              if vdu["type"] == "delete":
-                 # look for nm
-                 vm_interfaces = None
-                 for sce_vnf in instanceDict['vnfs']:
-                     for vm in sce_vnf['vms']:
-                         if vm["uuid"] == vdu_id:
-                             vm_interfaces = vm["interfaces"]
-                             break
+                 for index in range(0, vdu_count):
+                     target_vm = target_vms[-1-index]
+                     vdu_id = target_vm["uuid"]
+                     # look for nm
+                     vm_interfaces = None
+                     for sce_vnf in instanceDict['vnfs']:
+                         for vm in sce_vnf['vms']:
+                             if vm["uuid"] == vdu_id:
+                                 vm_interfaces = vm["interfaces"]
+                                 break
  
-                 db_vim_action = {
-                     "instance_action_id": instance_action_id,
-                     "task_index": task_index,
-                     "datacenter_vim_id": target_vm["datacenter_tenant_id"],
-                     "action": "DELETE",
-                     "status": "SCHEDULED",
-                     "item": "instance_vms",
-                     "item_id": target_vm["uuid"],
-                     "extra": yaml.safe_dump({"params": vm_interfaces},
-                                             default_flow_style=True, width=256)
-                 }
-                 task_index += 1
-                 db_vim_actions.append(db_vim_action)
-                 vm_result[vdu_id]["deleted"].append(vdu_id)
-                 # delete from database
-                 db_instance_vms.append({"TO-DELETE": vdu_id})
+                     db_vim_action = {
+                         "instance_action_id": instance_action_id,
+                         "task_index": task_index,
+                         "datacenter_vim_id": target_vm["datacenter_tenant_id"],
+                         "action": "DELETE",
+                         "status": "SCHEDULED",
+                         "item": "instance_vms",
+                         "item_id": vdu_id,
+                         "extra": yaml.safe_dump({"params": vm_interfaces},
+                                                 default_flow_style=True, width=256)
+                     }
+                     task_index += 1
+                     db_vim_actions.append(db_vim_action)
+                     vm_result["deleted"].append(vdu_id)
+                     # delete from database
+                     db_instance_vms.append({"TO-DELETE": vdu_id})
  
              else:  # vdu["type"] == "create":
                  iface2iface = {}
@@@ -4787,7 -4767,7 +4840,7 @@@ def edit_datacenter(mydb, datacenter_id
              try:
                  datacenter_sdn_port_mapping_delete(mydb, None, datacenter_id)
              except ovimException as e:
--                raise NfvoException("Error deleting datacenter-port-mapping " + str(e), HTTP_Conflict)
++                raise NfvoException("Error deleting datacenter-port-mapping " + str(e), httperrors.Conflict)
  
      mydb.update_rows('datacenters', datacenter_descriptor, where)
      if new_sdn_port_mapping:
          except ovimException as e:
              # Rollback
              mydb.update_rows('datacenters', datacenter, where)
--            raise NfvoException("Error adding datacenter-port-mapping " + str(e), HTTP_Conflict)
++            raise NfvoException("Error adding datacenter-port-mapping " + str(e), httperrors.Conflict)
      return datacenter_id
  
  
Simple merge
Simple merge
Simple merge
Simple merge
diff --cc osm_ro/utils.py
Simple merge
Simple merge
Simple merge
Simple merge
diff --cc setup.py
Simple merge
diff --cc test/test_RO.py
Simple merge
Simple merge