我有YANG模型和JSON对象,将通过ODL进行验证(请参见下面的内容)。
我需要从JSON中排除模块名称以进行验证。
当我从identityref(“ type”:“ center-car-sale-type:sedan”)中排除模块名称并仅发送identityref name(“ type”:“ sedan”)ODL引发异常时,找不到此identityref
我想发送不带模块名称的对象,因为“模块名称” +“ identityref名称”会导致混合元数据和实例。
如何设置ODL验证,以避免为Identityref的叶子值添加模块名称?
我由 org.opendaylight.yangtools.yang.data.codec.gson 的 JsonParserStream.parse(JsonReader) 解析JSON > 模块。
提前谢谢!
YANG模型:
identity car-type {
description
"Car type.";
}
identity sedan {
base car-type;
}
identity minivan {
base car-type;
}
grouping car {
uses main-properties;
leaf type {
type identityref {
base car-type;
}
}
leaf max-speed {
type string;
}
}
grouping main-properties {
leaf id {
type string;
}
leaf name {
type string;
}
}
list car {
uses car;
key "id";
}
JSON:
{
"car": [
{
"id": "1",
"name": "Toyota",
"description": "Toyota car",
"type": "center-car-sale-type:sedan",
"max-speed": "300"
},
{
"id": "2",
"name": "Honda",
"description": "Honda car",
"type": "center-car-sale-type:minivan",
"max-speed": "250"
}
]
}