X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osm_openvim%2Fvim_schema.py;h=59225ac786f2cfe53b245a8d06fd7123ca1d6a64;hb=9cead2a0262deabadc900d580ef312fbc468efc0;hp=1925f05c566602cc981a5a201124b6b7bac2086f;hpb=caeb224da9840534e46ae0e8f5e194575521c668;p=osm%2Fopenvim.git diff --git a/osm_openvim/vim_schema.py b/osm_openvim/vim_schema.py index 1925f05..59225ac 100644 --- a/osm_openvim/vim_schema.py +++ b/osm_openvim/vim_schema.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- ## -# Copyright 2015 Telefónica Investigación y Desarrollo, S.A.U. +# Copyright 2015 Telefonica Investigacion y Desarrollo, S.A.U. # This file is part of openvim # All Rights Reserved. # @@ -32,27 +32,36 @@ __date__ ="$10-jul-2014 12:07:15$" # path_schema = {"type": "string", "maxLength": 255, "pattern": "^(\.){0,2}(/[^/\"':{}\(\)]+)+$"} -http_schema={"type":"string", "pattern":"^https?://[^'\"=]+$"} -port_schema={"type":"integer","minimum":1,"maximun":65534} -ip_schema={"type":"string","pattern":"^([0-9]{1,3}.){3}[0-9]{1,3}$"} -cidr_schema={"type":"string","pattern":"^([0-9]{1,3}.){3}[0-9]{1,3}/[0-9]{1,2}$"} -name_schema={"type" : "string", "minLength":1, "maxLength":255, "pattern" : "^[^,;()'\"]+$"} -nameshort_schema={"type" : "string", "minLength":1, "maxLength":64, "pattern" : "^[^,;()'\"]+$"} -nametiny_schema={"type" : "string", "minLength":1, "maxLength":12, "pattern" : "^[^,;()'\"]+$"} -xml_text_schema={"type" : "string", "minLength":1, "maxLength":1000, "pattern" : "^[^']+$"} -description_schema={"type" : ["string","null"], "maxLength":255, "pattern" : "^[^'\"]+$"} -id_schema_fake = {"type" : "string", "minLength":2, "maxLength":36 } #"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" -id_schema = {"type" : "string", "pattern": "^[a-fA-F0-9]{8}(-[a-fA-F0-9]{4}){3}-[a-fA-F0-9]{12}$"} -pci_schema={"type":"string", "pattern":"^[0-9a-fA-F]{4}(:[0-9a-fA-F]{2}){2}\.[0-9a-fA-F]$"} -bandwidth_schema={"type":"string", "pattern" : "^[0-9]+ *([MG]bps)?$"} -integer0_schema={"type":"integer","minimum":0} -integer1_schema={"type":"integer","minimum":1} -vlan_schema={"type":"integer","minimum":1,"maximun":4095} -vlan1000_schema={"type":"integer","minimum":1000,"maximun":4095} -mac_schema={"type":"string", "pattern":"^[0-9a-fA-F][02468aceACE](:[0-9a-fA-F]{2}){5}$"} #must be unicast LSB bit of MSB byte ==0 -net_bind_schema={"oneOf":[{"type":"null"},{"type":"string", "pattern":"^(default|((bridge|macvtap):[0-9a-zA-Z\.\-]{1,50})|openflow:[/0-9a-zA-Z\.\-]{1,50}(:vlan)?)$"}]} -yes_no_schema={"type":"string", "enum":["yes", "no"]} -log_level_schema={"type":"string", "enum":["DEBUG", "INFO", "WARNING","ERROR","CRITICAL"]} +http_schema = {"type": "string", "pattern": "^https?://[^'\"=]+$"} +port_schema = {"type": "integer","minimum": 1, "maximun": 65534} +ip_schema = {"type": "string", "pattern": "^([0-9]{1,3}.){3}[0-9]{1,3}$"} +cidr_schema = {"type": "string", "pattern": "^([0-9]{1,3}.){3}[0-9]{1,3}/[0-9]{1,2}$"} +name_schema = {"type": "string", "minLength": 1, "maxLength": 255, "pattern": "^[^,;()'\"]+$"} +nameshort_schema = {"type": "string", "minLength": 1, "maxLength": 64, "pattern": "^[^,;()'\"]+$"} +nametiny_schema = {"type": "string", "minLength": 1, "maxLength": 12, "pattern": "^[^,;()'\"]+$"} +xml_text_schema = {"type": "string", "minLength": 1, "maxLength": 1000, "pattern": "^[^']+$"} +description_schema = {"type": ["string", "null"], "maxLength": 255, "pattern": "^[^'\"]+$"} +id_schema_fake = {"type": "string", "minLength": 2, "maxLength": 36} + # "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" +id_schema = {"type": "string", "pattern": "^[a-fA-F0-9]{8}(-[a-fA-F0-9]{4}){3}-[a-fA-F0-9]{12}$"} +pci_schema = {"type": "string", "pattern": "^[0-9a-fA-F]{4}(:[0-9a-fA-F]{2}){2}\.[0-9a-fA-F]$"} +# used by VIO neutron-port-show -::.- +pci_extended_schema = {"type": "string", "pattern": "^([0-9a-fA-F]{4}-)?[0-9a-fA-F]{4}(:[0-9a-fA-F]{2}){2}" + "\.[0-9a-fA-F](-[0-9a-fA-F]{3})?$"} +bandwidth_schema = {"type": "string", "pattern": "^[0-9]+ *([MG]bps)?$"} +integer0_schema = {"type": "integer", "minimum": 0} +integer1_schema = {"type": "integer", "minimum": 1} +vlan_schema = {"type": "integer", "minimum": 1, "maximun": 4095} +vlan1000_schema = {"type": "integer", "minimum": 1000, "maximun": 4095} +mac_schema = {"type": "string", "pattern": "^[0-9a-fA-F][02468aceACE](:[0-9a-fA-F]{2}){5}$"} + # must be unicast LSB bit of MSB byte ==0 +net_bind_schema = {"oneOf": [ + {"type": "null"}, + {"type": "string", "pattern": + "^(default|((bridge|macvtap):[0-9a-zA-Z\.\-]{1,50})|openflow:[/0-9a-zA-Z\.\-]{1,50}(:vlan)?)$"} +]} +yes_no_schema = {"type": "string", "enum": ["yes", "no"]} +log_level_schema = {"type": "string", "enum":["DEBUG", "INFO", "WARNING","ERROR","CRITICAL"]} config_schema = { "title": "main configuration information schema", @@ -267,6 +276,7 @@ host_data_schema={ "features": description_schema, "ranking": integer0_schema, "autodiscover": {"type": "boolean"}, # try to discover host parameters instead of providing in this schema + "hypervisors": description_schema, #Unikernels extension "devices": { "type": "array", "items": { @@ -298,7 +308,9 @@ host_data_schema={ "properties": { "core_id": integer0_schema, "thread_id": integer0_schema, - "status": {"type": "string", "enum": ["noteligible"]} + "status": {"type": "string", "enum": ["noteligible"]}, + "instance_id": {"type": "string"}, # ignored, just for compatibility with host-list + "v_thread_id": {"type": "integer"} # ignored, just for compatibility with host-list }, "additionalProperties": False, "required": ["core_id", "thread_id"] @@ -344,7 +356,7 @@ host_data_schema={ } }, "additionalProperties": False, - "required": ["name", "ip_name"] + "required": ["name", "user", "ip_name"] } host_edit_schema={ @@ -509,6 +521,7 @@ networks_schema={ "vpci":pci_schema, "uuid":id_schema, "mac_address": mac_schema, + "ip_address": ip_schema, "model": {"type":"string", "enum":["virtio","e1000","ne2k_pci","pcnet","rtl8139"]}, "type": {"type":"string", "enum":["virtual","PF","VF","VFnotShared"]} }, @@ -532,6 +545,8 @@ server_new_schema = { "hostId":id_schema, "flavorRef":id_schema, "imageRef":id_schema, + "hypervisor":{"type":"string", "enum":["kvm","xen-unik","xenhvm"]}, #Unikernels extension + "osImageType":{"type":"string", "enum":["clickos","other"]}, #Unikernels extension "extended": extended_schema, "networks":networks_schema }, @@ -603,10 +618,26 @@ network_new_schema = { "enable_dhcp": {"type": "boolean"}, "dhcp_first_ip": ip_schema, "dhcp_last_ip": ip_schema, + "dns": {"type": "array", "items": [ip_schema]}, + "links": {"type": "array", "items": {"type": "object", "properties": { + "nat": cidr_schema, + "iface": name_schema, + "vlan": vlan_schema}, + "required": ["iface"], + "additionalProperties": False + }, + + }, + "routes": {"type": "object", "properties": {"default": ip_schema}, "patternProperties": { + "^([0-9]{1,3}.){3}[0-9]{1,3}/[0-9]{1,2}$": ip_schema, + }, + "additionalProperties": False + }, + "bind_net": name_schema, # can be name, or uuid "bind_type": {"oneOf": [{"type": "null"}, {"type": "string", "pattern": "^vlan:[0-9]{1,4}$"}]} }, - "required": ["name"] + "required": ["name"] } }, "required": ["network"], @@ -747,7 +778,7 @@ of_port_new_schema = { "ofc_id": id_schema, "region": nameshort_schema, "compute_node": nameshort_schema, - "pci": pci_schema, + "pci": pci_extended_schema, "switch_dpid": nameshort_schema, "switch_port": nameshort_schema, "switch_mac": mac_schema