Re: [dhcwg] draft-ietf-dhc-dhcpv6-yang-04 - DUID representation in the model

hezihao <hezihao9512@gmail.com> Sat, 16 December 2017 07:28 UTC

Return-Path: <hezihao9512@gmail.com>
X-Original-To: dhcwg@ietfa.amsl.com
Delivered-To: dhcwg@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 2A86912426E; Fri, 15 Dec 2017 23:28:37 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.025
X-Spam-Level:
X-Spam-Status: No, score=-1.025 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, MIME_HTML_ONLY=0.723, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=no autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id MBY9ijzZMqRz; Fri, 15 Dec 2017 23:28:36 -0800 (PST)
Received: from mail-pg0-x22a.google.com (mail-pg0-x22a.google.com [IPv6:2607:f8b0:400e:c05::22a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 2A2461241F5; Fri, 15 Dec 2017 23:28:36 -0800 (PST)
Received: by mail-pg0-x22a.google.com with SMTP id e14so7182525pgr.9; Fri, 15 Dec 2017 23:28:36 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:message-id:in-reply-to:references:subject :mime-version:content-transfer-encoding; bh=rGNVhNIJWEgPYV/70+1Z+F1ab3abjMbm/sbETAu9jII=; b=mRtBS1cis17ZMXlBC6l6z5nx4z0n1VJH7bB2EBkB6l113OC7WN3S45H8d/nq5tzEuN QrnMiLDdg+H79iqBk815WTYmHFx1jgvcrRdHHiToaTP7rsQcEzrzVBri38jMGp0EC7o7 WrvjNMYuBtl6CbvRDft9maaukBhkxhsp2nRT/7hL8+IUmG1rfT/tvYc0zis/xGgTeHVr PB8RFOJkJqgoXzujSpjCnUGZHgF/Mr0ftyub6oMaDZjRULT9h9UndhspDe7uIkhRy3Dc nre7HNAknh8n2toaqzO+qpzmEJkEmZegF1aBJ3Vhty34/KaxcHJsPxJNHKOm3RhXEt0l 8VGQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:message-id:in-reply-to :references:subject:mime-version:content-transfer-encoding; bh=rGNVhNIJWEgPYV/70+1Z+F1ab3abjMbm/sbETAu9jII=; b=npoxEBXxe9YUJfcXCDEn698IMjYJUM2Fp+f8aEyqFP6buonlWkQBRwhJt5P0Bhb/fP 2xbEro7im7YhmIWW29Ntpl399QM67bw0wUI8dA1tg528EbWgBNj1kgsjb1nql5ZJ4b6Y 1LMVRwNEMxNPmWl6iNRqYTcMa2R2plZlrUm0sLIjLw2YSd5227CI78ZccwJs3/zXQ5gc 29p7UiC40kUTqP7SW929OQxD7pdxhvE/sjD36yqvJVeBV9mwjxdBmoiRHg+2ofd/U6rb LOagWalqQ7MOakdnoTyqwykxTKxHoLWG0lFe2CZPWdxR4d2nVaUMqFvJIxxbbCgVMrHg 07eA==
X-Gm-Message-State: AKGB3mL3IWspgc4t6xbR297ay09yKCtJQh9rWzikAaWL6coDEUNmCByw u+eWHGfIrnDXoRtRKzfApcsDkjeZ
X-Google-Smtp-Source: ACJfBouZo6BeuJ7CxVG5kUe8llB4PGGks+LzTR9XGx97ywmni4JjWbknQoeEC3TLejVY+4WnKTvEjg==
X-Received: by 10.98.211.153 with SMTP id z25mr15856314pfk.61.1513409315741; Fri, 15 Dec 2017 23:28:35 -0800 (PST)
Received: from DESKTOP-7HBCU2Q ([103.211.228.150]) by smtp.gmail.com with ESMTPSA id p87sm15883783pfi.95.2017.12.15.23.28.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 Dec 2017 23:28:34 -0800 (PST)
Date: Sat, 16 Dec 2017 15:29:05 +0800
From: hezihao <hezihao9512@gmail.com>
To: Ted Lemon <mellon@fugue.com>
Cc: Simon Hobson <dhcp1@thehobsons.co.uk>, "dhcwg@ietf.org" <dhcwg@ietf.org>, "draft-ietf-dhc-dhcpv6-yang@ietf.org" <draft-ietf-dhc-dhcpv6-yang@ietf.org>
Message-ID: <1CE63371-2F92-4167-9AF8-93A444A13E87@gmail.com>
In-Reply-To: <195BDEED-2A66-4AE8-BC97-BB1FCE02092C@fugue.com>
References: <0cab196d775e45668ef2fec69f317ce1@XCH-ALN-003.cisco.com> <7E297315-1B5B-437D-A447-221E8DAA5388@gmx.com> <A670F3DD-DEBC-40D5-8890-A5D43233362F@cisco.com> <0D8F77A1-3B91-4D6E-A7F2-5720EF0AFA51@gmx.com> <A60591D3-7598-4BFB-9F30-A69257D65E01@thehobsons.co.uk> <D97294FF-5684-43B2-AD85-DB0C47D1A204@cisco.com> <B40E98BF-FAAF-4E48-9E10-CA69BD291D04@thehobsons.co.uk> <76ABAA0E-31D1-4AEC-B8A9-3E9C1098C279@gmail.com> <195BDEED-2A66-4AE8-BC97-BB1FCE02092C@fugue.com>
X-Mailer: MailMasterPC/4.2.2.1004 (Windows 10 RS3)
X-CUSTOM-MAIL-MASTER-SENT-ID: E69A70C7-D6D7-4070-B66C-B3DF7DC4F818
MIME-Version: 1.0
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: base64
Archived-At: <https://mailarchive.ietf.org/arch/msg/dhcwg/o0SrhV7LC6cnfzmxe_3Mbu_edUI>
Subject: Re: [dhcwg] draft-ietf-dhc-dhcpv6-yang-04 - DUID representation in the model
X-BeenThere: dhcwg@ietf.org
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: <dhcwg.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/dhcwg>, <mailto:dhcwg-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/dhcwg/>
List-Post: <mailto:dhcwg@ietf.org>
List-Help: <mailto:dhcwg-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/dhcwg>, <mailto:dhcwg-request@ietf.org?subject=subscribe>
X-List-Received-Date: Sat, 16 Dec 2017 07:28:37 -0000

On 12/16/2017 11:53Ted Lemon<mellon@fugue.com> wrote:
I would suggest that you just have an "invalid type" for unknown types and malformed DUIDs, and have it have the type code in it:

|     +--:(duid-invalid)
|        +--rw type-code?                   uint16
|        +--rw data?                        yang:bytes

This would be used for any DUID that either has an unrecognized type, or doesn't contain enough bytes to satisfy the format corresponding to the type code that was received.

I used yang:bytes because I don't actually know how to represent raw bytes in a yang data model; hopefully it's something like that.


Zihao -
Hi Ted, thanks for your suggestion and I re-modeled DUID accordingly, which is shown in the tree diagram below. 
I think the built-in type 'binary'  is a good choice to represent raw bytes in a yang model.
     +--rw duid
         |  +--rw type-code?                   uint16                         ---- default:0xffff
         |  +--rw (duid-type)?                                                     ---- default: duid-invalid
         |     +--:(duid-llt)
         |     |  +--rw duid-llt-hardware-type?      uint16
         |     |  +--rw duid-llt-time?               yang:timeticks
         |     |  +--rw duid-llt-link-layer-addr?    yang:mac-address
         |     +--:(duid-en)
         |     |  +--rw duid-en-enterprise-number?   uint32
         |     |  +--rw duid-en-identifier?          string
         |     +--:(duid-ll)
         |     |  +--rw duid-ll-hardware-type?       uint16
         |     |  +--rw duid-ll-link-layer-addr?     yang:mac-address
         |     +--:(duid-uuid)
         |     |  +--rw uuid?                        yang:uuid
         |     +--:(duid-invalid)
         |        +--rw data?                binary
(Since the identifiers of all child nodes must be unique within all cases in a choice, I moved 'type-code' out of 'duid-type'.)

Besides, I set the default value for 'type-code' as 0xffff and the default case of 'duid-type' as 'duid-invalid', thus reducing the possibility of a malformed DUID to be treated as a known type.