From: tierno Date: Fri, 22 Sep 2017 11:31:35 +0000 (+0200) Subject: Changes to adopt Release Three OSM IM X-Git-Tag: v3.0.0~13 X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FRO.git;a=commitdiff_plain;h=a955020f8c8a74df3a4a97a4e2e2af5d44b46733 Changes to adopt Release Three OSM IM Feature 1456 Explicit Port Ordering Support Change-Id: If0916a15ab39cad29ed5a6be6a10856298e88f33 Signed-off-by: tierno --- diff --git a/openmanod b/openmanod index 21180751..d3efe223 100755 --- a/openmanod +++ b/openmanod @@ -48,8 +48,8 @@ import osm_ro __author__ = "Alfonso Tierno, Gerardo Garcia, Pablo Montes" __date__ = "$26-aug-2014 11:09:29$" -__version__ = "0.5.22-r532" -version_date = "Aug 2017" +__version__ = "0.5.23-r533" +version_date = "Sep 2017" database_version = 25 # expected database schema version global global_config diff --git a/osm_ro/nfvo.py b/osm_ro/nfvo.py index af84204f..2c6a5a3d 100644 --- a/osm_ro/nfvo.py +++ b/osm_ro/nfvo.py @@ -777,7 +777,10 @@ def new_vnfd_v3(mydb, tenant_id, vnf_descriptor): """ try: myvnfd = vnfd_catalog.vnfd() - pybindJSONDecoder.load_ietf_json(vnf_descriptor, None, None, obj=myvnfd) + try: + pybindJSONDecoder.load_ietf_json(vnf_descriptor, None, None, obj=myvnfd) + except Exception as e: + raise NfvoException("Invalid yang descriptor format " + str(e), HTTP_Bad_Request) db_vnfs = [] db_nets = [] db_vms = [] @@ -972,7 +975,8 @@ def new_vnfd_v3(mydb, tenant_id, vnf_descriptor): # table interfaces (internal/external interfaces) cp_name2iface_uuid = {} cp_name2vm_uuid = {} - for iface in chain(vdu.get("internal-interface").itervalues(), vdu.get("external-interface").itervalues()): + # for iface in chain(vdu.get("internal-interface").itervalues(), vdu.get("external-interface").itervalues()): + for iface in vdu.get("interface").itervalues(): iface_uuid = str(uuid4()) uuid_list.append(iface_uuid) db_interface = { @@ -998,9 +1002,9 @@ def new_vnfd_v3(mydb, tenant_id, vnf_descriptor): else: raise ValueError("Interface type {} not supported".format(iface.get("virtual-interface").get("type"))) - if iface.get("vnfd-connection-point-ref"): + if iface.get("external-connection-point-ref"): try: - cp = vnfd.get("connection-point")[iface.get("vnfd-connection-point-ref")] + cp = vnfd.get("connection-point")[iface.get("external-connection-point-ref")] db_interface["external_name"] = get_str(cp, "name", 255) cp_name2iface_uuid[db_interface["external_name"]] = iface_uuid cp_name2vm_uuid[db_interface["external_name"]] = vm_uuid @@ -1014,11 +1018,11 @@ def new_vnfd_v3(mydb, tenant_id, vnf_descriptor): vnf=vnfd["id"], vdu=vdu["id"], iface=iface["name"], cp=iface.get("vnfd-connection-point-ref")) ) - elif iface.get("vdu-internal-connection-point-ref"): + elif iface.get("internal-connection-point-ref"): try: for vld in vnfd.get("internal-vld").itervalues(): for cp in vld.get("internal-connection-point").itervalues(): - if cp.get("id-ref") == iface.get("vdu-internal-connection-point-ref"): + if cp.get("id-ref") == iface.get("internal-connection-point-ref"): db_interface["net_id"] = net_id2uuid[vld.get("id")] break except KeyError: @@ -1028,7 +1032,8 @@ def new_vnfd_v3(mydb, tenant_id, vnf_descriptor): vnf=vnfd["id"], vdu=vdu["id"], iface=iface["name"], cp=iface.get("vdu-internal-connection-point-ref")) ) - + if iface.get("position") is not None: + db_interface["created_at"] = int(iface.get("position")) - 1000 db_interfaces.append(db_interface) # VNF affinity and antiaffinity @@ -1061,7 +1066,7 @@ def new_vnfd_v3(mydb, tenant_id, vnf_descriptor): format(vnf=vnfd["id"], cp=vnfd["mgmt-interface"]["cp"])) mgmt_access["vm_id"] = cp_name2vm_uuid[vnfd["mgmt-interface"]["cp"]] mgmt_access["interface_id"] = cp_name2iface_uuid[vnfd["mgmt-interface"]["cp"]] - default_user = get_str(vnfd.get("vnf-configuration").get("config-access", {}).get("ssh-access", {}), + default_user = get_str(vnfd.get("vnf-configuration", {}).get("config-access", {}).get("ssh-access", {}), "default-user", 64) if default_user: mgmt_access["default_user"] = default_user @@ -1986,7 +1991,10 @@ def new_nsd_v3(mydb, tenant_id, nsd_descriptor): """ try: mynsd = nsd_catalog.nsd() - pybindJSONDecoder.load_ietf_json(nsd_descriptor, None, None, obj=mynsd) + try: + pybindJSONDecoder.load_ietf_json(nsd_descriptor, None, None, obj=mynsd) + except Exception as e: + raise NfvoException("Invalid yang descriptor format " + str(e), HTTP_Bad_Request) db_scenarios = [] db_sce_nets = [] db_sce_vnfs = [] diff --git a/osm_ro/nfvo_db.py b/osm_ro/nfvo_db.py index 9d1a83cc..ccba5a31 100644 --- a/osm_ro/nfvo_db.py +++ b/osm_ro/nfvo_db.py @@ -736,6 +736,9 @@ class nfvo_db(db_base.db_base): {"table2": [ {"column1": value, "column2: value, ... }, {"column1": value, "column2: value, ... }, ...], {"table3": {"column1": value, "column2: value, ... } } + If tables does not contain the 'created_at', it is generated incrementally with the order of tables. You can + provide a integer value, that it is an index multiply by 0.00001 to add to the created time to manually set + up and order :param uuid_list: list of created uuids, first one is the root (#TODO to store at uuid table) :return: None if success, raise exception otherwise """ @@ -752,12 +755,15 @@ class nfvo_db(db_base.db_base): row_list = (row_list, ) #create a list with the single value for row in row_list: if table_name in self.tables_with_created_field: - created_time_param = created_time + index*0.00001 + if "created_at" in row: + created_time_param = created_time + row.pop("created_at")*0.00001 + else: + created_time_param = created_time + index*0.00001 + index += 1 else: - created_time_param=0 + created_time_param = 0 self._new_row_internal(table_name, row, add_uuid=False, root_uuid=None, created_time=created_time_param) - index += 1 return except (mdb.Error, AttributeError) as e: self._format_error(e, tries) diff --git a/vnfs/examples/v3_3vdu_vnfd.yaml b/vnfs/examples/v3_3vdu_vnfd.yaml index 184bdcef..2b3470d6 100644 --- a/vnfs/examples/v3_3vdu_vnfd.yaml +++ b/vnfs/examples/v3_3vdu_vnfd.yaml @@ -32,14 +32,17 @@ vnfd:vnfd-catalog: image: 'cirros034' #checksum: - external-interface: + interface: # Specify the external interfaces # There can be multiple interfaces defined - name: eth0 + type: EXTERNAL + position: 0 virtual-interface: type: OM-MGMT bandwidth: '0' - vnfd-connection-point-ref: eth0 + # vnfd-connection-point-ref: eth0 + external-connection-point-ref: eth0 connection-point: - name: eth0