From: garciadeblas Date: Tue, 26 Oct 2021 15:27:35 +0000 (+0200) Subject: Fix bug 1723 to support IPv6 schema for PDU IP address X-Git-Tag: v12.0.0rc1~32 X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FNBI.git;a=commitdiff_plain;h=1a01e1fbea5040cce855db2b584cf8ef7c13ecae Fix bug 1723 to support IPv6 schema for PDU IP address Change-Id: I3301e6d82408eceafae25f7219294310677a7bb5 Signed-off-by: garciadeblas --- diff --git a/osm_nbi/validation.py b/osm_nbi/validation.py index 6a6eeee..fc16f06 100644 --- a/osm_nbi/validation.py +++ b/osm_nbi/validation.py @@ -94,6 +94,10 @@ ip_schema = { "type": "string", "pattern": "^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$", } +ipv6_schema = { + "type": "string", + "pattern": "(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))", +} ip_prefix_schema = { "type": "string", "pattern": "^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}" @@ -801,7 +805,7 @@ pdu_interface = { "name": shortname_schema, "mgmt": bool_schema, "type": {"enum": ["overlay", "underlay"]}, - "ip-address": ip_schema, + "ip-address": {"oneOf": [ip_schema, ipv6_schema]}, # TODO, add user, password, ssh-key "mac-address": mac_schema, "vim-network-name": shortname_schema, # interface is connected to one vim network, or switch port