Re: [alto] Discussion on how to encode element values of a cost map
Gao Kai <gaok12@mails.tsinghua.edu.cn> Tue, 19 July 2016 02:05 UTC
Return-Path: <gaok12@mails.tsinghua.edu.cn>
X-Original-To: alto@ietfa.amsl.com
Delivered-To: alto@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 5007812D0AA for <alto@ietfa.amsl.com>; Mon, 18 Jul 2016 19:05:14 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -0.271
X-Spam-Level:
X-Spam-Status: No, score=-0.271 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, HTML_MESSAGE=0.001, HTML_OBFUSCATE_05_10=0.26, RCVD_IN_BL_SPAMCOP_NET=1.347, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_RP_RNBL=1.31, RP_MATCHES_RCVD=-1.287, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001] autolearn=no autolearn_force=no
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 foiauIIvz2_J for <alto@ietfa.amsl.com>; Mon, 18 Jul 2016 19:05:11 -0700 (PDT)
Received: from tsinghua.edu.cn (smtp09.tsinghua.edu.cn [166.111.204.33]) by ietfa.amsl.com (Postfix) with ESMTP id C1B2112B061 for <alto@ietf.org>; Mon, 18 Jul 2016 19:05:10 -0700 (PDT)
Received: from [192.168.1.10] (unknown [171.217.145.99]) by app1 (Coremail) with SMTP id CsxvpgDX3SXNio1XOmsqAQ--.121S3; Tue, 19 Jul 2016 10:05:02 +0800 (CST)
To: Jensen Zhang <jingxuan.n.zhang@gmail.com>, "Y. Richard Yang" <yry@cs.yale.edu>
References: <CANUuoLrAXmDuLb7-p7Zfv+6WhM_kDazyc5jUvrCmiAA41S5r8w@mail.gmail.com> <CAAbpuyqCZDbeYtXJmKDJMns=ebOtctuUZaKE-xNGkHxNrBht1w@mail.gmail.com>
From: Gao Kai <gaok12@mails.tsinghua.edu.cn>
X-Enigmail-Draft-Status: N1110
Message-ID: <578D8ACD.7080604@mails.tsinghua.edu.cn>
Date: Tue, 19 Jul 2016 10:05:01 +0800
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0
MIME-Version: 1.0
In-Reply-To: <CAAbpuyqCZDbeYtXJmKDJMns=ebOtctuUZaKE-xNGkHxNrBht1w@mail.gmail.com>
Content-Type: multipart/alternative; boundary="------------020807060803050908000108"
X-CM-TRANSID: CsxvpgDX3SXNio1XOmsqAQ--.121S3
X-Coremail-Antispam: 1UD129KBjvJXoW3GFyrZr1fGF45Aw4kZFWDurg_yoWxKw48pF W0ga43Kr1kX3yxZ3s7Zr1jgayfC39xC3y7Jr90qryYyayUGFykKF1DKa1rZFy7A3s5Ja42 qw4q9rWUJwn8Za7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUgEb7Iv0xC_tr1lb4IE77IF4wAFF20E14v26r4j6ryUM7CY07I2 0VC2zVCF04k26cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rw A2z4x0Y4vE2Ix0cI8IcVAFwI0_tr0E3s1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Cr1j 6rxdM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I0E14v26rxl6s 0DM2vYz4IE04k24VAvwVAKI4IrM2AIxVAIcxkEcVAq07x20xvEncxIr21lYx0E2Ix0cI8I cVAFwI0_Jr0_Jr4lYx0Ex4A2jsIE14v26r1j6r4UMcvjeVCFs4IE7xkEbVWUJVW8JwACjc xG0xvEwIxGrwCjr7xvwVCIw2I0I7xG6c02F41lc7I2V7IY0VAS07AlzVAYIcxG8wCF04k2 0xvY0x0EwIxGrwC20s026c02F40E14v26r106r1rMI8I3I0E7480Y4vE14v26r106r1rMI 8E67AF67kF1VAFwI0_JF0_Jw1lIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWU CwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Jr0_Gr1lIxAIcVCF04k26cxKx2IYs7xG6rW3Jr 0E3s1lIxAIcVC2z280aVAFwI0_Jr0_Gr1lIxAIcVC2z280aVCY1x0267AKxVWUJVW8JbIY CTnIWIevJa73UjIFyTuYvj7UU6GPUUUUU
X-CM-SenderInfo: 5jdryi2s6ptxtovo32xlqjx3vdohv3gofq/
Archived-At: <https://mailarchive.ietf.org/arch/msg/alto/1rtGaxw7o60u9EanOszdzHsPycQ>
Cc: IETF ALTO <alto@ietf.org>, Nico Schwan <nico.schwan@thalesgroup.com>
Subject: Re: [alto] Discussion on how to encode element values of a cost map
X-BeenThere: alto@ietf.org
X-Mailman-Version: 2.1.17
Precedence: list
List-Id: "Application-Layer Traffic Optimization \(alto\) WG mailing list" <alto.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/alto>, <mailto:alto-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/alto/>
List-Post: <mailto:alto@ietf.org>
List-Help: <mailto:alto-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/alto>, <mailto:alto-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 19 Jul 2016 02:05:15 -0000
Jensen, Richard and all, I'd like to propose some other issues beside Jensen's: 1) How to represent the current data schema 2) How to declare the data schema precisely in the capabilities Most JSON libraries would have no problem "parsing" the result, since a JSONValue can always be converted to an array, an object or a primitive type (scalar value). The question is how the application/client and the server have the same understanding of the data. For example, some extensions have already taken into consideration the compatibility with multi-cost, but if such extensions are to be combined together, what is the correct processing order? One solution, as Jensen proposes, is to usea data schema. The client can pre-compile its schema tree used in a request so that the ALTO library can correctly understand the structure of the cost value. However, instead of using the cost-schema, Ithink maybe it is possible to extend the cost types directly, and all the options can be embedded in the query. For example, { "cost-metric": "multicost", "cost-mode": "compound", // or "vector", makes no difference now "multi-cost-types": [ {"cost-metric": "calendar", "cost-mode": "compound", "calendar-type": [ {"cost-metric": "routingcost", "cost-mode": "numerical"} ], "calendar-attributes": {...}} ] } However, it can still be very painful for the server to declare the capabilities precisely. Haven't got a good solution for that now. Regards, Kai On 19/07/16 03:08, Jensen Zhang wrote: > Personally speaking, I think there are two issues about cost-type > definition: > > 1) How to make the compound type compatible with RFC7285; > 2) How to extend single cost-type easily. (Maybe we want to support > generic types) > > A simple design I think is to introduce a special cost-mode called > "compound". When cost-mode value is "compound", "multi-cost-types" > field will be required. If the cost-mode value is not equal to > "compound", we need to suppose the cost-type is always a single type. > > I don't think about the benefit from supporting generic types very > clearly. We can introduce another some basic cost-mode like identity, > vector and map. > > The recommended usage can look like: > > if meta.cost-type.cost-mode == "compound" > ElemType is array && "multi-cost-types" field is required > else if meta.cost-type.cost-mode == "numerical" > ElemType is number > else if meta.cost-type.mode == "ordinal" > ElemType is non-negative int > else if meta.cost-type.mode == "identity" > ElemType is string > else if meta.cost-type.mode == "vector" > ElemType is array > else if meta.cost-type.mode == "map" > ElemType is object > > I think it is general enough to express arbitrary JSONValue. But I am > not sure making the cost-mode cover generic types is helpful. > Actually, "vector" and "map" are not single types. They are compound > types indeed. If we want to express the cost-type accurately, one > solution I think is to introduce a new field called "cost-schema" in > cost-type: > > object { > CostMetric cost-metric; > CostMode cost-mode; > [CostSchema cost-schema;] > [JSONString description;] > } CostType; > > The cost-schema field for cost-type is just like DTD for xml. And we > can design complex compound types by using cost-schema. > > But I don't plan to deprecate "multi-cost-types" field. Because I > think multi-cost is not a compound type but a class of compound types. > For example, cost-maps with multi-cost [bw, hopcount] and with > [hopcount, delay] can have the same capability [bw, hopcount, delay]. > > The above is my current thought. > > Best, > Jensen > > On Mon, Jul 18, 2016 at 8:11 AM, Y. Richard Yang <yry@cs.yale.edu > <mailto:yry@cs.yale.edu>> wrote: > > Hi all, > > Several of us are reviewing the documents in the WG. Here is one > common issue: We see that quite a few documents depend on encoding > the types of the elements in a cost map. This is a complexity that > the based protocol RFC7285 identifies and hence decided to make > the type the generic type JSONValue. But in the spirit of being > strong typed, a specific cost map needs an indication of the type. > For those who need some review, please see: > > - Cost Map > response: https://tools.ietf.org/html/rfc7285#section-11.2.3.6 > Requirements: > > media-type: application/alto-costmap+json > > meta: MUST include cost-type and dependent-tag of the network map > > data: "An implementation of the protocol in this document > SHOULD assume that the cost is a JSONNumber and fail to parse > if it > is not, unless the implementation is using an extension to this > document that indicates when and how costs of other data types are > signaled." > > - Filtered Cost Map > response: https://tools.ietf.org/html/rfc7285#section-11.3.2 > > Defined as the same as Cost Map. > > - Endpoint Cost > Service: https://tools.ietf.org/html/rfc7285#section-11.5.1 > > media-type: application/alto-endpointcost+json > meta: "The "meta" field of an endpoint cost response MUST > include the "cost- > type" field, to indicate the cost type used." > > The current definition of cost-type has two components: cost-mode > and cost-metric, > and cost-mode has two values defined: numerical and ordinal, both > indicate a single > number. At the same time, multiple active drafts > (https://datatracker.ietf.org/wg/alto/documents/) > need compound types for the elements of a cost map: > > - [multi-cost] > This draft is probably the one which we need to resolve the issue > the most urgent. Assume that > it uses the current alto-costmap+json media type, then it cannot > satisfy the requirement of "meta" > including cost-type. > > - [cost-calendar] > Cost calendar requires a compound data type as well. > > - [fcs] > fcs depends on multi-cost and hence can have an issue as well. > > - [path-vector] > The current definition of path-vector needs a vector of network > elements. > > - [te-metrics] > It appears that this document is fine, but may need to watch on > related consistency issues. > > The preceding is not a minor syntax/encoding issue. How to handle > types is a basic problem. > Conceptually, a cost map, as in the base protocol is param'ed type: > Map< String, Map< String, ElemType > > > > (Note: Some may argue that String above should be typed identifier.) > > So far, we have defined ElemType to be JSONValue, and used the > cost-type to indicate more specifics: > if meta.cost-type.cost-mode == "numerical" > ElemType is float > else if meta.cost-type.mode == "ordinal" > ElemType is non-negative int > > My personal feeling is that we may need to start to introduce new > cost-mode values to allow generic types. For those who are PL > experts, it is a good chance to chime in. It is an important issue > that the WG may want to work together to achieve a consistent, > extensible design. > > Cheers, > Richard > > References: > - > [multi-cost] https://datatracker.ietf.org/doc/draft-ietf-alto-multi-cost/ > - [cost-calendar] > https://datatracker.ietf.org/doc/draft-randriamasy-alto-cost-calendar/ > - [fcs] https://datatracker.ietf.org/doc/draft-gao-alto-fcs/ > - > [path-vector] https://datatracker.ietf.org/doc/draft-yang-alto-path-vector/ > - > [te-metrics] https://datatracker.ietf.org/doc/draft-wu-alto-te-metrics/ > > _______________________________________________ > alto mailing list > alto@ietf.org <mailto:alto@ietf.org> > https://www.ietf.org/mailman/listinfo/alto > >
- Re: [alto] Discussion on how to encode element va… Gao Kai
- Re: [alto] Discussion on how to encode element va… Y. Richard Yang
- Re: [alto] Discussion on how to encode element va… Wendy Roome
- Re: [alto] Discussion on how to encode element va… Randriamasy, Sabine (Nokia - FR)
- Re: [alto] Discussion on how to encode element va… Gao Kai
- Re: [alto] Discussion on how to encode element va… Jensen Zhang
- [alto] Discussion on how to encode element values… Y. Richard Yang