Re: [dtn] BPv7 CDDL and CBOR tagging

"Burleigh, Scott C (312B)" <scott.c.burleigh@jpl.nasa.gov> Tue, 09 April 2019 01:24 UTC

Return-Path: <scott.c.burleigh@jpl.nasa.gov>
X-Original-To: dtn@ietfa.amsl.com
Delivered-To: dtn@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id C32DB1201A4 for <dtn@ietfa.amsl.com>; Mon, 8 Apr 2019 18:24:09 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.001
X-Spam-Level:
X-Spam-Status: No, score=-2.001 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=jpl.nasa.gov
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 PbV9qcUZm9JD for <dtn@ietfa.amsl.com>; Mon, 8 Apr 2019 18:24:07 -0700 (PDT)
Received: from ppa02.jpl.nasa.gov (ppa02.jpl.nasa.gov [128.149.137.113]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id A8165120127 for <dtn@ietf.org>; Mon, 8 Apr 2019 18:24:07 -0700 (PDT)
Received: from pps.filterd (ppa02.jpl.nasa.gov [127.0.0.1]) by ppa02.jpl.nasa.gov (8.16.0.27/8.16.0.27) with SMTP id x391O67B143487; Mon, 8 Apr 2019 18:24:06 -0700
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jpl.nasa.gov; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=JPL1810; bh=+0FsxpWjdjCTUgsH28r1I1tv8LICIffFH6GoY1dPr4E=; b=YGYVhDcFo8u7v/V9wKF1+dm5b8riCRCJqOxJdhxgOnOpMDC3Sxn2toxl2uZ9Uj2mRgaR wlgwDrdfXS41knEXuk9qnVE3IQB0qg5MnobLA+JRTjM2W30QFgFEG9NoAEMuGBdFFOK1 2qyeBY9r+eCbSbJYLK0NXxEej6ypDdiK6lY7jxiytXrsVLW5EVsMY+m5W/7evqxujrtc oPLjWHPTZsz4qhfjQ8b+Fdyx8HWm8580uZZV6K9Thj4XtzGCqTWZhPySspthh+ZHlqhG mOHZ9O1d11gVptVuqeP7kQcJ0etvQIkaMMubf5zPUtemJ9QAB8zy0yCp/pi7UB1XlR3S Fg==
Received: from mail.jpl.nasa.gov (altphysenclup02.jpl.nasa.gov [128.149.137.53]) by ppa02.jpl.nasa.gov with ESMTP id 2rrbbq1cxs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 08 Apr 2019 18:24:06 -0700
Received: from ap-embx16-sp30.RES.AD.JPL (ap-embx16-sp30.jpl.nasa.gov [128.149.137.85]) by smtp.jpl.nasa.gov (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id x391O5Ia007359 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128 bits) verified FAIL); Mon, 8 Apr 2019 18:24:05 -0700
Received: from ap-embx16-sp10.RES.AD.JPL (2002:8095:8953::8095:8953) by ap-embx16-sp30.RES.AD.JPL (2002:8095:8955::8095:8955) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10; Mon, 8 Apr 2019 18:24:05 -0700
Received: from ap-embx16-sp10.RES.AD.JPL ([fe80::4:f430:47b5:767b]) by ap-embx16-sp10.RES.AD.JPL ([fe80::4:f430:47b5:767b%17]) with mapi id 15.01.1591.008; Mon, 8 Apr 2019 18:24:04 -0700
From: "Burleigh, Scott C (312B)" <scott.c.burleigh@jpl.nasa.gov>
To: Brian Sipos <BSipos@rkf-eng.com>, Carsten Bormann <cabo@tzi.org>
CC: "dtn@ietf.org" <dtn@ietf.org>
Thread-Topic: [dtn] BPv7 CDDL and CBOR tagging
Thread-Index: AQHU7mgWSkg6bBAW40y+wBx08j2w+qYzBqew
Date: Tue, 09 Apr 2019 01:24:04 +0000
Message-ID: <670af7e65e8c4746947b0833690f4625@jpl.nasa.gov>
References: <CY4PR1301MB20399B0DD6B59D2D566257379F570@CY4PR1301MB2039.namprd13.prod.outlook.com> <B8DF4499-2EEC-4680-B1AD-9FEF00A907D7@tzi.org> <6773e0f0e03e6e4ddb935f0f02de7ade2bc606b8.camel@rkf-eng.com>
In-Reply-To: <6773e0f0e03e6e4ddb935f0f02de7ade2bc606b8.camel@rkf-eng.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
x-originating-ip: [207.151.104.72]
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: base64
MIME-Version: 1.0
X-Source-IP: ap-embx16-sp30.jpl.nasa.gov [128.149.137.85]
X-Source-Sender: scott.c.burleigh@jpl.nasa.gov
X-AUTH: Authorized
X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-04-09_01:, , signatures=0
X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1904090007
Archived-At: <https://mailarchive.ietf.org/arch/msg/dtn/k9rM_Vw1I0CwrXAlRFybNMaMIj0>
Subject: Re: [dtn] BPv7 CDDL and CBOR tagging
X-BeenThere: dtn@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Delay Tolerant Networking \(DTN\) discussion list at the IETF." <dtn.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/dtn>, <mailto:dtn-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/dtn/>
List-Post: <mailto:dtn@ietf.org>
List-Help: <mailto:dtn-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/dtn>, <mailto:dtn-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 09 Apr 2019 01:24:10 -0000

Guys, please feel free to send me an updated CDDL expression of Bundle Protocol version 7; I will gladly include it in the document.

My one comment is that the type dtn-time is correctly defined as uint; it should NOT be changed to int, as negative values are not allowed.  If you can spot an instance in the spec where dtn-time is characterized as a signed integer, please let me know and I will correct it.

Scott

-----Original Message-----
From: Brian Sipos <BSipos@rkf-eng.com> 
Sent: Monday, April 8, 2019 5:06 PM
To: Carsten Bormann <cabo@tzi.org>
Cc: dtn@ietf.org; Burleigh, Scott C (312B) <scott.c.burleigh@jpl.nasa.gov>
Subject: [EXTERNAL] Re: [dtn] BPv7 CDDL and CBOR tagging

On Sat, 2019-04-06 at 14:51 +0200, Carsten Bormann wrote:
> On Apr 3, 2019, at 21:14, Brian Sipos <BSipos@rkf-eng.com> wrote:
> > 
> > 		• A disconnect between the “canonical-block" definition and the 
> > "extension-block" and "payload-block" uses (which are just 
> > canonical-block type with value restrictions, probably using 
> > ".within").
> 
> Right, it would help to define payload-block and extension-block, and 
> .within could be used to reference canonical-block (which is currently 
> unused).
> 
> The text of 4.2.1 in -12 starts with a paragraph that ends in:
> 
>    The last item of
>    the array SHALL be a CBOR “break" stop code.
> 
> A break stop code is not a data item, but is the part of an 
> indefinite-length array encoding that ends it (the same change needs 
> to be made in the second paragraph of the start of section 4).  So the 
> text seems to be trying to say
> 
>    bundle = [primary-block, *canonical-block]
> 
> The CDDL in Appendix B is more specific:
> 
>    bundle = [primary-block, *extension-block, payload-block]
> 
> So there must be a payload-block as the last data item, and zero or 
> more extension-blocks preceding it, which according to the text in
> 4.2.1 all need to be of canonical-block structure.
> 
> Is there something from the text about extension-block and payload- 
> block that could be encoded in a CDDL definition of these two?
> 
> So far, I have found text that makes be believe
> 
> payload-block = ([block-type-code: 1, canonical-block-common, ?crc]) 
> .within canonical-block
> 
> and
> 
> extension-block = ([block-type-code: (uint .ne 1), canonical-block- 
> common, ?crc]) .within canonical-block
> 
I believe that this is correct, and there is one more constraint that the payload block itself always has block number zero [1]. Though I don't know how much value there is in adding that to the CDDL since it really doesn't seem to have any negative effects if the payload block happens to have some other block number...

> BTW, the CDDL for primary block ends in three optional components, two 
> of which are of the same type, so it is not clear whether you have a 
> primary-block with a fragment-offset but without a total- 
> application-data-length or a primary block with a total-application- 
> data-length but no fragment-offset.
> 
Those last three items are not determined via type introspection but by checking the bundle flags. So it's not something that seems like CDDL can encode or check (so violations may result in interesting or confusing errors from a generic validator).

Since the two optional uint values must come together, the existing CDDL of:
                 lifetime: uint,
                 ? fragment-offset: uint,
                 ? total-application-data-length: uint,
                 ? crc,
could more accurately be represented by the CDDL:
                 lifetime: uint,
                 ? (
                   fragment-offset: uint,
                   total-application-data-length: uint
                 ),
                 ? crc,


This also brings up the administrative record, which does not yet have a CDDL representation. The following seems like it should be a decent start to that. This uses the CDDL notion of an abstract "socket"
prefixed with a dollar sign.

  admin-record = $admin-record .within admin-record-structure
  admin-record-structure = [
    record-type-code: uint,
    record-content: any
  ]

  $admin-record /= [1, status-record-content]
  status-record-content = [
    bundle-status-information,
    status-report-reason-code: uint,
    source-node-eid: eid-generic,
    subject-creation-timestamp: creation-timestamp,
    ? (
      subject-payload-offset: uint,
      subject-payload-length: uint
    )
  ]
  bundle-status-information = [
    reporting-node-received-bundle: status-info-content,
    reporting-node-forwarded-bundle: status-info-content,
    reporting-node-delivered-bundle: status-info-content,
    reporting-node-deleted-bundle: status-info-content
  ]
  status-info-content = [
    status-indicator: bool,
    ? timestamp: dtn_time
  ]

[1]: https://tools.ietf.org/html/draft-ietf-dtn-bpbis-12#section-4.2.3