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
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
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
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']
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 = {}
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