Redfish 验证工具: Redfish Service Validator (OData CSDL)

本文介绍了Redfish Service Validator的用途和下载方式,它是一个用于检查Redfish服务与DMTF定义的Schema一致性的工具。文章详细讲解了OData CSDL的概念,包括其格式、元素和命名规则,并提供了资源类型与版本的对应示例。同时,列举了在使用过程中可能遇到的错误类型及解决方法。内容深入浅出,适合对Redfish和OData有一定了解的读者。

这篇文章我去年就很想写了,因为当时身边有蛮多人对这个tool有些误解,对用来验证Redfish Schema来说它是个很好用的tool,快速又方便,现在社群也很活耀的持续开发,只是对第一次接触OData的人来说,可能会有点不知道怎么上手,但理解之后会发现其实它原理很简单的,然后如果还不认识OData的话可以先看 DMTF Redfish 介绍 ,里面有将官网连结都附上

Redfish Services validator 在 GitHub - DMTF/Redfish-Service-Validator的Readme中介绍是

Redfish Service Validator 是一个开源框架,用于检查启用了Redfish interface 的任何通用设备与DMTF 定义的Redfish schema 和specifications的一致性。该工具设计为与设备无关,并且完全基于旨在由设备支持的Redfish 规范驱动。

它是个检查Redfish Service 的Resource 是否符合DMTF定义的Schema 的工具,所以其实应该先了解CSDL Schema 怎么描述,所以这篇文章的目录如下

目录

OData CSDL(Common Schema Definition Language, 通用模式定义语言)

概述

CSDL format

Elements of CSDL namespaces

Qualified names

Entity type and complex type elements

Redfish Services validator

下载

不用安装,直接执行

常见被验出的问题

ERROR - Attributes: Property is null but is not Nullable

ERROR - XXX: Expected int, got type class 'str' (Type Error)

ERROR - Namespace of type xxx appears missing from SchemaXML xxx.xml, attempting highest type: #xxx.xxx.xxxERROR - New namespace: xxx.v1_0_2


*本篇文章使用到的Redfish Service 是用Redfish Mockup Server模拟的

*如果对Redfish schema 和specifications 的概念不太清楚的话,可参考如何描述Redfish 版本

OData CSDL(Common Schema Definition Language, 通用模式定义语言)

概述

OData CSDL 是定义在OData Version 4.0 Part 3: Common Schema Definition Language (CSDL) (oasis-open.org)中,Redfish 用它来描述resources 和resource collections的Schema

在service root URL(/redfish/v1) 后面加上$metadata可以看到Redfish Service的实体模型(entity model),如下

[GET] /redfish/v1/$metadata
<?xml version="1.0" encoding="UTF-8"?>
<edmx:Edmx xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx" Version="4.0">
    <edmx:Reference Uri="/redfish/v1/schema/AccountService_v1.xml">
        <edmx:Include Namespace="AccountService"/>
        <edmx:Include Namespace="AccountService.v1_0_0"/>
        <edmx:Include Namespace="AccountService.v1_0_2"/>
        <edmx:Include Namespace="AccountService.v1_0_3"/>
        <edmx:Include Namespace="AccountService.v1_0_4"/>
        <edmx:Include Namespace="AccountService.v1_0_5"/>
        <edmx:Include Namespace="AccountService.v1_0_6"/>
        <edmx:Include Namespace="AccountService.v1_0_7"/>
        <edmx:Include Namespace="AccountService.v1_0_8"/>
        <edmx:Include Namespace="AccountService.v1_0_9"/>

*metadata: a set of data that describes and gives information about other data.

metadata 原意是指描述数据的数据,在Redfish中就是用来描述Resource 的数据的数据,所以内容会包含该Resource 有哪些property,他们的type是int还是string,是不是required等

目前最新版的Redfish Services validator 是可以指定想要验证的schema folder,没有指定的话,就会从官网All Published Versions of DSP8010 | DMTF 抓最新版本 

 下载后就能在csdl folder中看到schema 文件了

评论 8
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值