Define Redfish interface "/Registries/Bios" and enable Attributes property

1. Define Redfish interface "/Registries/Bios" for BIOS Attribute Registry
   RBC Daemon provide method to get BIOS attribute registry.
2. Enable Attributes property for BIOS resource
3. Define Redfish interface "/Systems/system/Bios/Settings" for BIOS
settings
4. RBC daemon is at
https://gerrit.openbmc-project.xyz/#/c/openbmc/bios-settings-mgr/+/35563/
5. IPMI command implementation is at
https://gerrit.openbmc-project.xyz/#/c/openbmc/intel-ipmi-oem/+/30827/
6. Property design is at
https://github.com/openbmc/phosphor-dbus-interfaces/tree/master/xyz/openbmc_project/BIOSConfig
7. Design doc is at
https://github.com/openbmc/docs/blob/master/designs/remote-bios-configuration.md
8. There will be 95 test cases for this feature in the validation team.

Tested:
1. Use postman could get all the attributes in bios
resouce, get bios settings, get bios attribute
registry.
https://IP_ADDR/redfish/v1/Systems/system/Bios
{
    "@Redfish.Settings": {
        "@odata.type": "#Settings.v1_3_0.Settings",
        "SettingsObject": {
            "@odata.id": "/redfish/v1/Systems/system/Bios/Settings"
        }
    },
    "@odata.id": "/redfish/v1/Systems/system/Bios",
    "@odata.type": "#Bios.v1_1_0.Bios",
    "Actions": {
        "#Bios.ChangePassword": {
            "target": "/redfish/v1/Systems/system/Bios/Actions/Bios.ChangePassword"
        },
        "#Bios.ResetBios": {
            "target": "/redfish/v1/Systems/system/Bios/Actions/Bios.ResetBios"
        }
    },
    "AttributeRegistry": "BiosAttributeRegistry",
    "Attributes": {
        "attr0": "current value"
    },
    "Description": "BIOS Configuration Service",
    "Id": "BIOS",
    "Links": {
        "ActiveSoftwareImage": {
            "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/bios_active"
        },
        "SoftwareImages": [
            {
                "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/bios_active"
            }
        ],
        "SoftwareImages@odata.count": 1
    },
    "Name": "BIOS Configuration"
}

Redfish interface: https://BMCIP/redfish/v1/Registries/BiosAttributeRegistry
{
    "@odata.id": "/redfish/v1/Registries/BiosAttributeRegistry",
    "@odata.type": "#MessageRegistryFile.v1_1_0.MessageRegistryFile",
    "Description": "BiosAttributeRegistry Message Registry File Location",
    "Id": "BiosAttributeRegistry",
    "Languages": [
        "en"
    ],
    "Languages@odata.count": 1,
    "Location": [
        {
            "Language": "en",
            "Uri": "/redfish/v1/Registries/BiosAttributeRegistry/BiosAttributeRegistry"
        }
    ],
    "Location@odata.count": 1,
    "Name": "BiosAttributeRegistry Message Registry File",
    "Registry": "BiosAttributeRegistry.1.0.0"
}

Redfish interface: https://BMCIP/redfish/v1/Registries/BiosAttributeRegistry/BiosAttributeRegistry
{
    "@odata.id": "/redfish/v1/Registries/BiosAttributeRegistry/BiosAttributeRegistry",
    "@odata.type": "#AttributeRegistry.v1_3_2.AttributeRegistry",
    "Id": "BiosAttributeRegistry",
    "Language": "en",
    "Name": "Bios Attribute Registry",
    "OwningEntity": "OpenBMC",
    "RegistryEntries": {
        "Attributes": [
            {
                "AttributeName": "attr0",
                "CurrentValue": "current value",
                "DefaultValue": "default value",
                "DisplayName": "display name for attr0",
                "HelpText": "description for attr0",
                "MenuPath": "./menu/path/for/attr0",
                "ReadOnly": false,
                "Type": "String",
                "Value": [
                  {
                      "ValueName": "..."
                  },
                  .
                  .
                ]
            },
            .
            .
        ]
    },
    "RegistryVersion": "1.0.0"
}

https://BMC_IPADDR/redfish/v1/Systems/system/Bios/Settings
{
    "@odata.id": "/redfish/v1/Systems/system/Bios/Settings",
    "@odata.type": "#Bios.v1_1_0.Bios",
    "AttributeRegistry": "BiosAttributeRegistry",
    "Attributes": {
        "QuietBoot": "0x0"
    },
    "Id": "BiosSettingsV1",
    "Name": "Bios Settings Version 1"
}

2. Passed Validator check for bios resource and bios attribute registry
*** /redfish/v1/Systems/system/Bios
INFO -   Type (#Bios.v1_1_0.Bios), GET SUCCESS (time: 1.57377)
INFO -   PASS
*** /redfish/v1/Registries/BiosAttributeRegistry
INFO -   Type (#MessageRegistryFile.v1_1_0.MessageRegistryFile), GET SUCCESS (time: 0.075438)
INFO -   PASS
INFO -
*** /redfish/v1/Registries/BiosAttributeRegistry/BiosAttributeRegistry
INFO -   Type (#AttributeRegistry.v1_3_2.AttributeRegistry), GET SUCCESS (time: 0.075751)
INFO -   PASS

@odata.id	/redfish/v1/Systems/system/Bios	odata	Exists	PASS
@odata.type	#Settings.v1_3_0.Settings	odata	Exists	PASS
Links	[JSON Object]	Bios.v1_1_0.Links	Yes	complex
Links.ActiveSoftwareImage	Link: /redfish/v1/UpdateService/FirmwareInventory/bios_active	link to: SoftwareInventory	Yes	PASS
Links.SoftwareImages	Array (size: 1)	array of: SoftwareInventory	Yes	...
Links.SoftwareImages[0]	Link: /redfish/v1/UpdateService/FirmwareInventory/bios_active	SoftwareInventory	Yes	PASS
Links.Oem	-	Resource.Oem	No	Optional
SoftwareImages@odata.count	1	odata	Exists	PASS
AttributeRegistry	BiosAttributeRegistry	string	Yes	PASS
Actions	[JSON Object]	Bios.v1_0_0.Actions	Yes	complex
Actions.#Bios.ResetBios	Action	-	Yes	PASS
Actions.#Bios.ChangePassword	Action	-	Yes	PASS
Attributes	[JSON Object]	Bios.v1_0_0.Attributes	Yes	complex
Attributes.attr0	current value	primitive	Yes	PASS
Id	BIOS	string	Yes	PASS
Description	BIOS Configuration Service	string	Yes	PASS
Name	BIOS Configuration	string	Yes	PASS
Oem	-	Resource.Oem	No	Optional
@Redfish.Settings	[JSON Object]	Settings.Settings	Yes	complex
@Redfish.Settings.MaintenanceWindowResource	-	link to: ItemOrCollection	No	Optional
@Redfish.Settings.SupportedApplyTimes	-	string (enum)	No	Optional
@Redfish.Settings.Time	-	date	No	Optional
@Redfish.Settings.ETag	-	string	No	Optional
@Redfish.Settings.SettingsObject	Link: /redfish/v1/Systems/system/Bios/Settings	link to: Item	Yes	PASS
@Redfish.Settings.Messages	-	Message	No	Optional

@odata.id	/redfish/v1/Registries/BiosAttributeRegistry	odata	Exists	PASS
@odata.type	#MessageRegistryFile.v1_1_0.MessageRegistryFile	odata	Exists	PASS
Languages@odata.count	1	odata	Exists	PASS
Location@odata.count	1	odata	Exists	PASS
Actions	-	MessageRegistryFile.v1_1_0.Actions	No	Optional
Languages	Array (size: 1)	string	Yes	...
Languages[0]	en	string	Yes	PASS
Registry	BiosAttributeRegistry.1.0.0	string	Yes	PASS
Location	Array (size: 1)	array of: Location	Yes	...
Location[0]	[JSON Object]	Location	Yes	complex
Location[0].Language	en	string	Yes	PASS
Location[0].Uri	/redfish/v1/Registries/BiosAttributeRegistry/BiosAttributeRegistry	string	Yes	PASS
Location[0].ArchiveUri	-	string	No	Optional
Location[0].PublicationUri	-	string	No	Optional
Location[0].ArchiveFile	-	string	No	Optional
Id	BiosAttributeRegistry	string	Yes	PASS
Description	BiosAttributeRegistry Message Registry File Location	string	Yes	PASS
Name	BiosAttributeRegistry Message Registry File	string	Yes	PASS
Oem	-	Resource.Oem	No	Optional

@odata.id	/redfish/v1/Registries/BiosAttributeRegistry/BiosAttributeRegistry	odata	Exists	PASS
@odata.type	#AttributeRegistry.v1_3_2.AttributeRegistry	odata	Exists	PASS
Actions	-	AttributeRegistry.v1_1_0.Actions	No	Optional
Language	en	string	Yes	PASS
RegistryVersion	1.0.0	string	Yes	PASS
OwningEntity	OpenBMC	string	Yes	PASS
SupportedSystems	-	SupportedSystems	No	Optional
RegistryEntries	[JSON Object]	AttributeRegistry.v1_0_0.RegistryEntries	Yes	complex
RegistryEntries.Attributes	Array (size: 1)	array of: Attributes	Yes	...
RegistryEntries.Attributes[0]	[JSON Object]	Attributes	Yes	complex
RegistryEntries.Attributes[0].Oem	-	Resource.Oem	No	Optional
RegistryEntries.Attributes[0].ResetRequired	-	boolean	No	Optional
RegistryEntries.Attributes[0].UefiDevicePath	-	string	No	Optional
RegistryEntries.Attributes[0].UefiKeywordName	-	string	No	Optional
RegistryEntries.Attributes[0].UefiNamespaceId	-	string	No	Optional
RegistryEntries.Attributes[0].AttributeName	attr0	string	Yes	PASS
RegistryEntries.Attributes[0].Type	String	string (enum)	Yes	PASS
RegistryEntries.Attributes[0].Value	Array (size: 0)	array of: AttributeValue	Yes	...
RegistryEntries.Attributes[0].DisplayName	display name for attr0	string	Yes	PASS
RegistryEntries.Attributes[0].HelpText	description for attr0	string	Yes	PASS
RegistryEntries.Attributes[0].WarningText	-	string	No	Optional
RegistryEntries.Attributes[0].CurrentValue	current value	primitive	Yes	PASS
RegistryEntries.Attributes[0].DefaultValue	default value	primitive	Yes	PASS
RegistryEntries.Attributes[0].DisplayOrder	-	number	No	Optional
RegistryEntries.Attributes[0].MenuPath	./menu/path/for/attr0	string	Yes	PASS
RegistryEntries.Attributes[0].ReadOnly	False	boolean	Yes	PASS
RegistryEntries.Attributes[0].WriteOnly	-	boolean	No	Optional
RegistryEntries.Attributes[0].GrayOut	-	boolean	No	Optional
RegistryEntries.Attributes[0].Hidden	-	boolean	No	Optional
RegistryEntries.Attributes[0].Immutable	-	boolean	No	Optional
RegistryEntries.Attributes[0].IsSystemUniqueProperty	-	boolean	No	Optional
RegistryEntries.Attributes[0].MaxLength	-	number	No	Optional
RegistryEntries.Attributes[0].MinLength	-	number	No	Optional
RegistryEntries.Attributes[0].ScalarIncrement	-	number	No	Optional
RegistryEntries.Attributes[0].UpperBound	-	number	No	Optional
RegistryEntries.Attributes[0].LowerBound	-	number	No	Optional
RegistryEntries.Attributes[0].ValueExpression	-	string	No	Optional
RegistryEntries.Menus	-	Menus	No	Optional
RegistryEntries.Dependencies	-	Dependencies	No	Optional
Id	BiosAttributeRegistry	string	Yes	PASS
Description	-	string	No	Optional
Name	Bios Attribute Registry	string	Yes	PASS
Oem	-	Resource.Oem	No	Optional

Change-Id: Iecc61018c350f0b8c89df59b2864b941508b1916
Signed-off-by: Kuiying Wang <kuiying.wang@intel.com>
4 files changed
tree: 941f07ff9dfd1356b022624b207b7ab55b30a534
  1. .github/
  2. http/
  3. include/
  4. redfish-core/
  5. scripts/
  6. src/
  7. static/
  8. subprojects/
  9. .clang-format
  10. .clang-ignore
  11. .clang-tidy
  12. .dockerignore
  13. .gitignore
  14. .shellcheck
  15. bmcweb.service.in
  16. bmcweb.socket
  17. bmcweb_config.h.in
  18. build_x86.sh
  19. build_x86_docker.sh
  20. COMMON_ERRORS.md
  21. DEVELOPING.md
  22. Dockerfile
  23. Dockerfile.base
  24. LICENCE
  25. MAINTAINERS
  26. meson.build
  27. meson_options.txt
  28. OEM_SCHEMAS.md
  29. OWNERS
  30. pam-webserver
  31. README.md
  32. Redfish.md
README.md

OpenBMC webserver

This component attempts to be a "do everything" embedded webserver for openbmc.

Capabilities

At this time, the webserver implements a few interfaces:

  • Authentication middleware that supports cookie and token based authentication, as well as CSRF prevention backed by linux PAM authentication credentials.
  • An (incomplete) attempt at replicating phosphor-dbus-rest interfaces in C++. Right now, a few of the endpoint definitions work as expected, but there is still a lot of work to be done. The portions of the interface that are functional are designed to work correctly for phosphor-webui, but may not yet be complete.
  • Replication of the rest-dbus backend interfaces to allow bmc debug to logged in users.
  • An initial attempt at a read-only redfish interface. Currently the redfish interface targets ServiceRoot, SessionService, AccountService, Roles, and ManagersService. Some functionality here has been shimmed to make development possible. For example, there exists only a single user role.
  • SSL key generation at runtime. See the configuration section for details.
  • Static file hosting. Currently, static files are hosted from the fixed location at /usr/share/www. This is intended to allow loose coupling with yocto projects, and allow overriding static files at build time.
  • Dbus-monitor over websocket. A generic endpoint that allows UIs to open a websocket and register for notification of events to avoid polling in single page applications. (this interface may be modified in the future due to security concerns.

Configuration

BMCWeb is configured by setting -D flags that correspond to options in bmcweb/meson_options.txt and then compiling. For example, meson <builddir> -Dkvm=disabled ... followed by ninja in build directory. The option names become C++ preprocessor symbols that control which code is compiled into the program.

Compile bmcweb with default options:

meson builddir
ninja -C builddir

Compile bmcweb with yocto defaults:

meson builddir -Dbuildtype=minsize -Db_lto=true -Dtests=disabled
ninja -C buildir

If any of the dependencies are not found on the host system during configuration, meson automatically gets them via its wrap dependencies mentioned in bmcweb/subprojects.

Enable/Disable meson wrap feature

meson builddir -Dwrap_mode=nofallback
ninja -C builddir

Generate test coverage report:

meson builddir -Db_coverage=true -Dtests=enabled
ninja coverage -C builddir test

When BMCWeb starts running, it reads persistent configuration data (such as UUID and session data) from a local file. If this is not usable, it generates a new configuration.

When BMCWeb SSL support is enabled and a usable certificate is not found, it will generate a self-sign a certificate before launching the server. The keys are generated by the secp384r1 algorithm. The certificate

  • is issued by C=US, O=OpenBMC, CN=testhost,
  • is valid for 10 years,
  • has a random serial number, and
  • is signed using the SHA-256 algorithm.