Date   

[PATCH] StandaloneMmPkg/FvLib: Correct FV section data size

Marvin Häuser
 

The size of a FV section includes the size of its header. Subtract
latter to yield the correct size of the contained data.

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
Cc: Vitaly Cheptsov <vit9696@protonmail.com>
Signed-off-by: Marvin Häuser <mhaeuser@posteo.de>
---
StandaloneMmPkg/Library/FvLib/FvLib.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/StandaloneMmPkg/Library/FvLib/FvLib.c b/StandaloneMmPkg/Library/FvLib/FvLib.c
index 94139ae3898b..5d5ad8f73fe0 100644
--- a/StandaloneMmPkg/Library/FvLib/FvLib.c
+++ b/StandaloneMmPkg/Library/FvLib/FvLib.c
@@ -359,16 +359,22 @@ FfsFindSectionData (
ParsedLength = 0;
while (ParsedLength < FileSize) {
if (Section->Type == SectionType) {
+ //
+ // Size is 24 bits wide so mask upper 8 bits.
+ //
+ SectionLength = SECTION_SIZE (Section);
+
+ if (SectionLength < sizeof (*Section)) {
+ return EFI_VOLUME_CORRUPTED;
+ }
*SectionData = (VOID *) (Section + 1);
- *SectionDataSize = SECTION_SIZE(Section);
+ *SectionDataSize = SectionLength - sizeof (*Section);
return EFI_SUCCESS;
}
//
- // Size is 24 bits wide so mask upper 8 bits.
// SectionLength is adjusted it is 4 byte aligned.
// Go to the next section
//
- SectionLength = SECTION_SIZE(Section);
SectionLength = GET_OCCUPIED_SIZE (SectionLength, 4);

ParsedLength += SectionLength;
--
2.31.1


[PATCH] SecurityPkg/DxeImageVerificationLib: Fix certificate lookup algorithm

Marvin Häuser
 

The current certificate lookup code does not check the bounds of the
authentication data before accessing it. Abort if the header cannot
fit. Also, the lookup code aborts once the authetication data is
smaller than an algorithm's OID size. As OIDs are variably-sized,
this may cause unexpected authentication failure due to the early
error-exit.

Additionally move the two-byte encoding check out of the loop as the
data is invariant.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Min Xu <min.m.xu@intel.com>
Cc: Vitaly Cheptsov <vit9696@protonmail.com>
Signed-off-by: Marvin Häuser <mhaeuser@posteo.de>
---
SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.c | 43 +++++++++++---------
1 file changed, 23 insertions(+), 20 deletions(-)

diff --git a/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.c b/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.c
index c48861cd6496..6615099baafb 100644
--- a/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.c
+++ b/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.c
@@ -624,30 +624,33 @@ HashPeImageByType (
{
UINT8 Index;

+ if (AuthDataSize < 32) {
+ return EFI_UNSUPPORTED;
+ }
+ //
+ // Check the Hash algorithm in PE/COFF Authenticode.
+ // According to PKCS#7 Definition:
+ // SignedData ::= SEQUENCE {
+ // version Version,
+ // digestAlgorithms DigestAlgorithmIdentifiers,
+ // contentInfo ContentInfo,
+ // .... }
+ // The DigestAlgorithmIdentifiers can be used to determine the hash algorithm in PE/COFF hashing
+ // This field has the fixed offset (+32) in final Authenticode ASN.1 data.
+ // Fixed offset (+32) is calculated based on two bytes of length encoding.
+ //
+ if ((*(AuthData + 1) & TWO_BYTE_ENCODE) != TWO_BYTE_ENCODE) {
+ //
+ // Only support two bytes of Long Form of Length Encoding.
+ //
+ return EFI_UNSUPPORTED;
+ }
+
for (Index = 0; Index < HASHALG_MAX; Index++) {
- //
- // Check the Hash algorithm in PE/COFF Authenticode.
- // According to PKCS#7 Definition:
- // SignedData ::= SEQUENCE {
- // version Version,
- // digestAlgorithms DigestAlgorithmIdentifiers,
- // contentInfo ContentInfo,
- // .... }
- // The DigestAlgorithmIdentifiers can be used to determine the hash algorithm in PE/COFF hashing
- // This field has the fixed offset (+32) in final Authenticode ASN.1 data.
- // Fixed offset (+32) is calculated based on two bytes of length encoding.
- //
- if ((*(AuthData + 1) & TWO_BYTE_ENCODE) != TWO_BYTE_ENCODE) {
- //
- // Only support two bytes of Long Form of Length Encoding.
- //
+ if (AuthDataSize - 32 < mHash[Index].OidLength) {
continue;
}

- if (AuthDataSize < 32 + mHash[Index].OidLength) {
- return EFI_UNSUPPORTED;
- }
-
if (CompareMem (AuthData + 32, mHash[Index].OidValue, mHash[Index].OidLength) == 0) {
break;
}
--
2.31.1


[PATCH] SecurityPkg/DxeImageVerificationLib: Always lookup SHA-256 hash in dbx

Marvin Häuser
 

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3461

The UEFI specification prohibits loading any UEFI image of which a
matching SHA-256 hash is contained in "dbx" (UEFI 2.9, 32.5.3.3
"Authorization Process", 3.A). Currently, this is only explicitly
checked when the image is unsigned and otherwise the hash algorithms
of the certificates are used.

Align with the UEFI specification by specifically looking up the
SHA-256 hash of the image in "dbx".

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Min Xu <min.m.xu@intel.com>
Cc: Vitaly Cheptsov <vit9696@protonmail.com>
Signed-off-by: Marvin Häuser <mhaeuser@posteo.de>
---
SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.c | 60 ++++++++------------
1 file changed, 24 insertions(+), 36 deletions(-)

diff --git a/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.c b/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.c
index c48861cd6496..1f9bb33e86c3 100644
--- a/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.c
+++ b/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.c
@@ -1803,34 +1803,36 @@ DxeImageVerificationHandler (
}
}

+ //
+ // The SHA256 hash value of the image must not be reflected in the security data base "dbx".
+ //
+ if (!HashPeImage (HASHALG_SHA256)) {
+ DEBUG ((DEBUG_INFO, "DxeImageVerificationLib: Failed to hash this image using %s.\n", mHashTypeStr));
+ goto Failed;
+ }
+
+ DbStatus = IsSignatureFoundInDatabase (
+ EFI_IMAGE_SECURITY_DATABASE1,
+ mImageDigest,
+ &mCertType,
+ mImageDigestSize,
+ &IsFound
+ );
+ if (EFI_ERROR (DbStatus) || IsFound) {
+ //
+ // Image Hash is in forbidden database (DBX).
+ //
+ DEBUG ((DEBUG_INFO, "DxeImageVerificationLib: Image is not signed and %s hash of image is forbidden by DBX.\n", mHashTypeStr));
+ goto Failed;
+ }
+
//
// Start Image Validation.
//
if (SecDataDir == NULL || SecDataDir->Size == 0) {
//
- // This image is not signed. The SHA256 hash value of the image must match a record in the security database "db",
- // and not be reflected in the security data base "dbx".
+ // This image is not signed. The SHA256 hash value of the image must match a record in the security database "db".
//
- if (!HashPeImage (HASHALG_SHA256)) {
- DEBUG ((DEBUG_INFO, "DxeImageVerificationLib: Failed to hash this image using %s.\n", mHashTypeStr));
- goto Failed;
- }
-
- DbStatus = IsSignatureFoundInDatabase (
- EFI_IMAGE_SECURITY_DATABASE1,
- mImageDigest,
- &mCertType,
- mImageDigestSize,
- &IsFound
- );
- if (EFI_ERROR (DbStatus) || IsFound) {
- //
- // Image Hash is in forbidden database (DBX).
- //
- DEBUG ((DEBUG_INFO, "DxeImageVerificationLib: Image is not signed and %s hash of image is forbidden by DBX.\n", mHashTypeStr));
- goto Failed;
- }
-
DbStatus = IsSignatureFoundInDatabase (
EFI_IMAGE_SECURITY_DATABASE,
mImageDigest,
@@ -1932,20 +1934,6 @@ DxeImageVerificationHandler (
//
// Check the image's hash value.
//
- DbStatus = IsSignatureFoundInDatabase (
- EFI_IMAGE_SECURITY_DATABASE1,
- mImageDigest,
- &mCertType,
- mImageDigestSize,
- &IsFound
- );
- if (EFI_ERROR (DbStatus) || IsFound) {
- Action = EFI_IMAGE_EXECUTION_AUTH_SIG_FOUND;
- DEBUG ((DEBUG_INFO, "DxeImageVerificationLib: Image is signed but %s hash of image is found in DBX.\n", mHashTypeStr));
- IsVerified = FALSE;
- break;
- }
-
if (!IsVerified) {
DbStatus = IsSignatureFoundInDatabase (
EFI_IMAGE_SECURITY_DATABASE,
--
2.31.1


[PATCH] MdePkg/BaseLib: Fix unaligned API prototypes

Marvin Häuser
 

C prohibits not only dereferencing but also casting to unaligned
pointers. Thus, the current set of unaligned APIs cannot be called
safely. Update their prototypes to take VOID * pointers, which must
be able to represent any valid pointer.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Vitaly Cheptsov <vit9696@protonmail.com>
Signed-off-by: Marvin Häuser <mhaeuser@posteo.de>
---
MdePkg/Library/BaseLib/Arm/Unaligned.c | 14 ++++-----
MdePkg/Library/BaseLib/Unaligned.c | 32 ++++++++++----------
MdePkg/Include/Library/BaseLib.h | 16 +++++-----
3 files changed, 31 insertions(+), 31 deletions(-)

diff --git a/MdePkg/Library/BaseLib/Arm/Unaligned.c b/MdePkg/Library/BaseLib/Arm/Unaligned.c
index e9934e7003cb..57f19fc44e0b 100644
--- a/MdePkg/Library/BaseLib/Arm/Unaligned.c
+++ b/MdePkg/Library/BaseLib/Arm/Unaligned.c
@@ -59,7 +59,7 @@ ReadUnaligned16 (
UINT16
EFIAPI
WriteUnaligned16 (
- OUT UINT16 *Buffer,
+ OUT VOID *Buffer,
IN UINT16 Value
)
{
@@ -87,7 +87,7 @@ WriteUnaligned16 (
UINT32
EFIAPI
ReadUnaligned24 (
- IN CONST UINT32 *Buffer
+ IN CONST VOID *Buffer
)
{
ASSERT (Buffer != NULL);
@@ -116,7 +116,7 @@ ReadUnaligned24 (
UINT32
EFIAPI
WriteUnaligned24 (
- OUT UINT32 *Buffer,
+ OUT VOID *Buffer,
IN UINT32 Value
)
{
@@ -143,7 +143,7 @@ WriteUnaligned24 (
UINT32
EFIAPI
ReadUnaligned32 (
- IN CONST UINT32 *Buffer
+ IN CONST VOID *Buffer
)
{
UINT16 LowerBytes;
@@ -175,7 +175,7 @@ ReadUnaligned32 (
UINT32
EFIAPI
WriteUnaligned32 (
- OUT UINT32 *Buffer,
+ OUT VOID *Buffer,
IN UINT32 Value
)
{
@@ -202,7 +202,7 @@ WriteUnaligned32 (
UINT64
EFIAPI
ReadUnaligned64 (
- IN CONST UINT64 *Buffer
+ IN CONST VOID *Buffer
)
{
UINT32 LowerBytes;
@@ -234,7 +234,7 @@ ReadUnaligned64 (
UINT64
EFIAPI
WriteUnaligned64 (
- OUT UINT64 *Buffer,
+ OUT VOID *Buffer,
IN UINT64 Value
)
{
diff --git a/MdePkg/Library/BaseLib/Unaligned.c b/MdePkg/Library/BaseLib/Unaligned.c
index a419cb85e53c..3041adcde606 100644
--- a/MdePkg/Library/BaseLib/Unaligned.c
+++ b/MdePkg/Library/BaseLib/Unaligned.c
@@ -26,12 +26,12 @@
UINT16
EFIAPI
ReadUnaligned16 (
- IN CONST UINT16 *Buffer
+ IN CONST VOID *Buffer
)
{
ASSERT (Buffer != NULL);

- return *Buffer;
+ return *(CONST UINT16 *) Buffer;
}

/**
@@ -52,13 +52,13 @@ ReadUnaligned16 (
UINT16
EFIAPI
WriteUnaligned16 (
- OUT UINT16 *Buffer,
+ OUT VOID *Buffer,
IN UINT16 Value
)
{
ASSERT (Buffer != NULL);

- return *Buffer = Value;
+ return *(UINT16 *) Buffer = Value;
}

/**
@@ -77,12 +77,12 @@ WriteUnaligned16 (
UINT32
EFIAPI
ReadUnaligned24 (
- IN CONST UINT32 *Buffer
+ IN CONST VOID *Buffer
)
{
ASSERT (Buffer != NULL);

- return *Buffer & 0xffffff;
+ return *(CONST UINT32 *) Buffer & 0xffffff;
}

/**
@@ -103,13 +103,13 @@ ReadUnaligned24 (
UINT32
EFIAPI
WriteUnaligned24 (
- OUT UINT32 *Buffer,
+ OUT VOID *Buffer,
IN UINT32 Value
)
{
ASSERT (Buffer != NULL);

- *Buffer = BitFieldWrite32 (*Buffer, 0, 23, Value);
+ *(UINT32 *) Buffer = BitFieldWrite32 (*(CONST UINT32 *) Buffer, 0, 23, Value);
return Value;
}

@@ -129,12 +129,12 @@ WriteUnaligned24 (
UINT32
EFIAPI
ReadUnaligned32 (
- IN CONST UINT32 *Buffer
+ IN CONST VOID *Buffer
)
{
ASSERT (Buffer != NULL);

- return *Buffer;
+ return *(CONST UINT32 *) Buffer;
}

/**
@@ -155,13 +155,13 @@ ReadUnaligned32 (
UINT32
EFIAPI
WriteUnaligned32 (
- OUT UINT32 *Buffer,
+ OUT VOID *Buffer,
IN UINT32 Value
)
{
ASSERT (Buffer != NULL);

- return *Buffer = Value;
+ return *(UINT32 *) Buffer = Value;
}

/**
@@ -180,12 +180,12 @@ WriteUnaligned32 (
UINT64
EFIAPI
ReadUnaligned64 (
- IN CONST UINT64 *Buffer
+ IN CONST VOID *Buffer
)
{
ASSERT (Buffer != NULL);

- return *Buffer;
+ return *(CONST UINT64 *) Buffer;
}

/**
@@ -206,11 +206,11 @@ ReadUnaligned64 (
UINT64
EFIAPI
WriteUnaligned64 (
- OUT UINT64 *Buffer,
+ OUT VOID *Buffer,
IN UINT64 Value
)
{
ASSERT (Buffer != NULL);

- return *Buffer = Value;
+ return *(UINT64 *) Buffer = Value;
}
diff --git a/MdePkg/Include/Library/BaseLib.h b/MdePkg/Include/Library/BaseLib.h
index 2452c1d92e51..4d30f0539c6b 100644
--- a/MdePkg/Include/Library/BaseLib.h
+++ b/MdePkg/Include/Library/BaseLib.h
@@ -3420,7 +3420,7 @@ DivS64x64Remainder (
UINT16
EFIAPI
ReadUnaligned16 (
- IN CONST UINT16 *Buffer
+ IN CONST VOID *Buffer
);


@@ -3442,7 +3442,7 @@ ReadUnaligned16 (
UINT16
EFIAPI
WriteUnaligned16 (
- OUT UINT16 *Buffer,
+ OUT VOID *Buffer,
IN UINT16 Value
);

@@ -3463,7 +3463,7 @@ WriteUnaligned16 (
UINT32
EFIAPI
ReadUnaligned24 (
- IN CONST UINT32 *Buffer
+ IN CONST VOID *Buffer
);


@@ -3485,7 +3485,7 @@ ReadUnaligned24 (
UINT32
EFIAPI
WriteUnaligned24 (
- OUT UINT32 *Buffer,
+ OUT VOID *Buffer,
IN UINT32 Value
);

@@ -3506,7 +3506,7 @@ WriteUnaligned24 (
UINT32
EFIAPI
ReadUnaligned32 (
- IN CONST UINT32 *Buffer
+ IN CONST VOID *Buffer
);


@@ -3528,7 +3528,7 @@ ReadUnaligned32 (
UINT32
EFIAPI
WriteUnaligned32 (
- OUT UINT32 *Buffer,
+ OUT VOID *Buffer,
IN UINT32 Value
);

@@ -3549,7 +3549,7 @@ WriteUnaligned32 (
UINT64
EFIAPI
ReadUnaligned64 (
- IN CONST UINT64 *Buffer
+ IN CONST VOID *Buffer
);


@@ -3571,7 +3571,7 @@ ReadUnaligned64 (
UINT64
EFIAPI
WriteUnaligned64 (
- OUT UINT64 *Buffer,
+ OUT VOID *Buffer,
IN UINT64 Value
);

--
2.31.1


[PATCH] MdePkg/Base.h: Introduce various alignment-related macros

Marvin Häuser
 

ALIGNOF: Determining the alignment requirement of data types is
crucial to ensure safe memory accesses when parsing untrusted data.

IS_POW2: Determining whether a value is a power of two is important
to verify whether untrusted values are valid alignment values.

IS_ALIGNED: In combination with ALIGNOF data offsets can be verified.
A more general version of IS_ALIGNED defined by several modules.

ADDRESS_IS_ALIGNED: Variant of IS_ALIGNED for pointers and addresses.
Replaces module-specific definitions throughout the codebase.

ALIGN_VALUE_ADDEND: The added to align up can be used to directly
determine the required offset for data alignment.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Vitaly Cheptsov <vit9696@protonmail.com>
Signed-off-by: Marvin Häuser <mhaeuser@posteo.de>
---
MdeModulePkg/Bus/Ata/AhciPei/AhciMode.c | 2 +-
MdeModulePkg/Bus/Ata/AhciPei/AhciPeiPassThru.c | 6 +-
MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c | 12 +--
MdeModulePkg/Bus/Ata/AtaBusDxe/AtaPassThruExecute.c | 2 +-
MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c | 4 +-
MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c | 6 +-
MdeModulePkg/Universal/EbcDxe/EbcExecute.c | 36 ++++----
MdeModulePkg/Bus/Ata/AhciPei/AhciPei.h | 1 -
MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.h | 2 -
MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBus.h | 1 -
MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h | 4 +-
MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.h | 2 -
MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h | 2 -
MdeModulePkg/Universal/EbcDxe/EbcExecute.h | 3 +-
MdePkg/Include/Base.h | 90 +++++++++++++++++++-
15 files changed, 125 insertions(+), 48 deletions(-)

diff --git a/MdeModulePkg/Bus/Ata/AhciPei/AhciMode.c b/MdeModulePkg/Bus/Ata/AhciPei/AhciMode.c
index 7636ad27c86c..520197aee752 100644
--- a/MdeModulePkg/Bus/Ata/AhciPei/AhciMode.c
+++ b/MdeModulePkg/Bus/Ata/AhciPei/AhciMode.c
@@ -2099,7 +2099,7 @@ TrustTransferAtaDevice (
// ATA PassThru PPI.
//
if ((AtaPassThru->Mode->IoAlign > 1) &&
- !IS_ALIGNED (Buffer, AtaPassThru->Mode->IoAlign)) {
+ !ADDRESS_IS_ALIGNED (Buffer, AtaPassThru->Mode->IoAlign)) {
NewBuffer = AllocateAlignedPages (
EFI_SIZE_TO_PAGES (TransferLength),
AtaPassThru->Mode->IoAlign
diff --git a/MdeModulePkg/Bus/Ata/AhciPei/AhciPeiPassThru.c b/MdeModulePkg/Bus/Ata/AhciPei/AhciPeiPassThru.c
index 191b78c88541..057ad42d596b 100644
--- a/MdeModulePkg/Bus/Ata/AhciPei/AhciPeiPassThru.c
+++ b/MdeModulePkg/Bus/Ata/AhciPei/AhciPeiPassThru.c
@@ -193,15 +193,15 @@ AhciAtaPassThruPassThru (
}

IoAlign = This->Mode->IoAlign;
- if ((IoAlign > 1) && !IS_ALIGNED (Packet->InDataBuffer, IoAlign)) {
+ if ((IoAlign > 1) && !ADDRESS_IS_ALIGNED (Packet->InDataBuffer, IoAlign)) {
return EFI_INVALID_PARAMETER;
}

- if ((IoAlign > 1) && !IS_ALIGNED (Packet->OutDataBuffer, IoAlign)) {
+ if ((IoAlign > 1) && !ADDRESS_IS_ALIGNED (Packet->OutDataBuffer, IoAlign)) {
return EFI_INVALID_PARAMETER;
}

- if ((IoAlign > 1) && !IS_ALIGNED (Packet->Asb, IoAlign)) {
+ if ((IoAlign > 1) && !ADDRESS_IS_ALIGNED (Packet->Asb, IoAlign)) {
return EFI_INVALID_PARAMETER;
}

diff --git a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c
index 86fe9d954fdb..c7b3cfce1340 100644
--- a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c
+++ b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c
@@ -1281,15 +1281,15 @@ AtaPassThruPassThru (

Instance = ATA_PASS_THRU_PRIVATE_DATA_FROM_THIS (This);

- if ((This->Mode->IoAlign > 1) && !IS_ALIGNED(Packet->InDataBuffer, This->Mode->IoAlign)) {
+ if ((This->Mode->IoAlign > 1) && !ADDRESS_IS_ALIGNED(Packet->InDataBuffer, This->Mode->IoAlign)) {
return EFI_INVALID_PARAMETER;
}

- if ((This->Mode->IoAlign > 1) && !IS_ALIGNED(Packet->OutDataBuffer, This->Mode->IoAlign)) {
+ if ((This->Mode->IoAlign > 1) && !ADDRESS_IS_ALIGNED(Packet->OutDataBuffer, This->Mode->IoAlign)) {
return EFI_INVALID_PARAMETER;
}

- if ((This->Mode->IoAlign > 1) && !IS_ALIGNED(Packet->Asb, This->Mode->IoAlign)) {
+ if ((This->Mode->IoAlign > 1) && !ADDRESS_IS_ALIGNED(Packet->Asb, This->Mode->IoAlign)) {
return EFI_INVALID_PARAMETER;
}

@@ -2012,15 +2012,15 @@ ExtScsiPassThruPassThru (
return EFI_INVALID_PARAMETER;
}

- if ((This->Mode->IoAlign > 1) && !IS_ALIGNED(Packet->InDataBuffer, This->Mode->IoAlign)) {
+ if ((This->Mode->IoAlign > 1) && !ADDRESS_IS_ALIGNED(Packet->InDataBuffer, This->Mode->IoAlign)) {
return EFI_INVALID_PARAMETER;
}

- if ((This->Mode->IoAlign > 1) && !IS_ALIGNED(Packet->OutDataBuffer, This->Mode->IoAlign)) {
+ if ((This->Mode->IoAlign > 1) && !ADDRESS_IS_ALIGNED(Packet->OutDataBuffer, This->Mode->IoAlign)) {
return EFI_INVALID_PARAMETER;
}

- if ((This->Mode->IoAlign > 1) && !IS_ALIGNED(Packet->SenseData, This->Mode->IoAlign)) {
+ if ((This->Mode->IoAlign > 1) && !ADDRESS_IS_ALIGNED(Packet->SenseData, This->Mode->IoAlign)) {
return EFI_INVALID_PARAMETER;
}

diff --git a/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaPassThruExecute.c b/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaPassThruExecute.c
index 79026a4a957d..eabab8ac5bc5 100644
--- a/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaPassThruExecute.c
+++ b/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaPassThruExecute.c
@@ -1036,7 +1036,7 @@ TrustTransferAtaDevice (
// Check the alignment of the incoming buffer prior to invoking underlying ATA PassThru
//
AtaPassThru = AtaDevice->AtaBusDriverData->AtaPassThru;
- if ((AtaPassThru->Mode->IoAlign > 1) && !IS_ALIGNED (Buffer, AtaPassThru->Mode->IoAlign)) {
+ if ((AtaPassThru->Mode->IoAlign > 1) && !ADDRESS_IS_ALIGNED (Buffer, AtaPassThru->Mode->IoAlign)) {
NewBuffer = AllocateAlignedBuffer (AtaDevice, TransferLength);
if (NewBuffer == NULL) {
return EFI_OUT_OF_RESOURCES;
diff --git a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c
index c80e78fa8a6b..81db2efd0599 100644
--- a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c
+++ b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c
@@ -1956,7 +1956,7 @@ ScsiDiskReceiveData (
goto Done;
}

- if ((ScsiDiskDevice->ScsiIo->IoAlign > 1) && !IS_ALIGNED (PayloadBuffer, ScsiDiskDevice->ScsiIo->IoAlign)) {
+ if ((ScsiDiskDevice->ScsiIo->IoAlign > 1) && !ADDRESS_IS_ALIGNED (PayloadBuffer, ScsiDiskDevice->ScsiIo->IoAlign)) {
AlignedBuffer = AllocateAlignedBuffer (ScsiDiskDevice, PayloadBufferSize);
if (AlignedBuffer == NULL) {
Status = EFI_OUT_OF_RESOURCES;
@@ -2171,7 +2171,7 @@ ScsiDiskSendData (
goto Done;
}

- if ((ScsiDiskDevice->ScsiIo->IoAlign > 1) && !IS_ALIGNED (PayloadBuffer, ScsiDiskDevice->ScsiIo->IoAlign)) {
+ if ((ScsiDiskDevice->ScsiIo->IoAlign > 1) && !ADDRESS_IS_ALIGNED (PayloadBuffer, ScsiDiskDevice->ScsiIo->IoAlign)) {
AlignedBuffer = AllocateAlignedBuffer (ScsiDiskDevice, PayloadBufferSize);
if (AlignedBuffer == NULL) {
Status = EFI_OUT_OF_RESOURCES;
diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c
index 92ff958f161e..c4d01a20fcbe 100644
--- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c
+++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c
@@ -170,15 +170,15 @@ UfsPassThruPassThru (
return EFI_INVALID_PARAMETER;
}

- if ((This->Mode->IoAlign > 1) && !IS_ALIGNED(Packet->InDataBuffer, This->Mode->IoAlign)) {
+ if ((This->Mode->IoAlign > 1) && !ADDRESS_IS_ALIGNED(Packet->InDataBuffer, This->Mode->IoAlign)) {
return EFI_INVALID_PARAMETER;
}

- if ((This->Mode->IoAlign > 1) && !IS_ALIGNED(Packet->OutDataBuffer, This->Mode->IoAlign)) {
+ if ((This->Mode->IoAlign > 1) && !ADDRESS_IS_ALIGNED(Packet->OutDataBuffer, This->Mode->IoAlign)) {
return EFI_INVALID_PARAMETER;
}

- if ((This->Mode->IoAlign > 1) && !IS_ALIGNED(Packet->SenseData, This->Mode->IoAlign)) {
+ if ((This->Mode->IoAlign > 1) && !ADDRESS_IS_ALIGNED(Packet->SenseData, This->Mode->IoAlign)) {
return EFI_INVALID_PARAMETER;
}

diff --git a/MdeModulePkg/Universal/EbcDxe/EbcExecute.c b/MdeModulePkg/Universal/EbcDxe/EbcExecute.c
index 1c4a4f5155c9..ba66f441bcea 100644
--- a/MdeModulePkg/Universal/EbcDxe/EbcExecute.c
+++ b/MdeModulePkg/Universal/EbcDxe/EbcExecute.c
@@ -2004,7 +2004,7 @@ ExecuteJMP (
// check for alignment, and jump absolute.
//
Data64 = (UINT64) VmReadImmed64 (VmPtr, 2);
- if (!IS_ALIGNED ((UINTN) Data64, sizeof (UINT16))) {
+ if (!ADDRESS_IS_ALIGNED ((UINTN) Data64, sizeof (UINT16))) {
EbcDebugSignalException (
EXCEPT_EBC_ALIGNMENT_CHECK,
EXCEPTION_FLAG_FATAL,
@@ -2059,7 +2059,7 @@ ExecuteJMP (
// Form: JMP32 @Rx {Index32}
//
Addr = VmReadMemN (VmPtr, (UINTN) Data64 + Index32);
- if (!IS_ALIGNED ((UINTN) Addr, sizeof (UINT16))) {
+ if (!ADDRESS_IS_ALIGNED ((UINTN) Addr, sizeof (UINT16))) {
EbcDebugSignalException (
EXCEPT_EBC_ALIGNMENT_CHECK,
EXCEPTION_FLAG_FATAL,
@@ -2082,7 +2082,7 @@ ExecuteJMP (
// Form: JMP32 Rx {Immed32}
//
Addr = (UINTN) (Data64 + Index32);
- if (!IS_ALIGNED ((UINTN) Addr, sizeof (UINT16))) {
+ if (!ADDRESS_IS_ALIGNED ((UINTN) Addr, sizeof (UINT16))) {
EbcDebugSignalException (
EXCEPT_EBC_ALIGNMENT_CHECK,
EXCEPTION_FLAG_FATAL,
@@ -3128,7 +3128,7 @@ ExecuteRET (
// Pull the return address off the VM app's stack and set the IP
// to it
//
- if (!IS_ALIGNED ((UINTN) VmPtr->Gpr[0], sizeof (UINT16))) {
+ if (!ADDRESS_IS_ALIGNED ((UINTN) VmPtr->Gpr[0], sizeof (UINT16))) {
EbcDebugSignalException (
EXCEPT_EBC_ALIGNMENT_CHECK,
EXCEPTION_FLAG_FATAL,
@@ -4693,7 +4693,7 @@ VmWriteMem16 (
//
// Do a simple write if aligned
//
- if (IS_ALIGNED (Addr, sizeof (UINT16))) {
+ if (ADDRESS_IS_ALIGNED (Addr, sizeof (UINT16))) {
*(UINT16 *) Addr = Data;
} else {
//
@@ -4756,7 +4756,7 @@ VmWriteMem32 (
//
// Do a simple write if aligned
//
- if (IS_ALIGNED (Addr, sizeof (UINT32))) {
+ if (ADDRESS_IS_ALIGNED (Addr, sizeof (UINT32))) {
*(UINT32 *) Addr = Data;
} else {
//
@@ -4819,7 +4819,7 @@ VmWriteMem64 (
//
// Do a simple write if aligned
//
- if (IS_ALIGNED (Addr, sizeof (UINT64))) {
+ if (ADDRESS_IS_ALIGNED (Addr, sizeof (UINT64))) {
*(UINT64 *) Addr = Data;
} else {
//
@@ -4885,7 +4885,7 @@ VmWriteMemN (
//
// Do a simple write if aligned
//
- if (IS_ALIGNED (Addr, sizeof (UINTN))) {
+ if (ADDRESS_IS_ALIGNED (Addr, sizeof (UINTN))) {
*(UINTN *) Addr = Data;
} else {
for (Index = 0; Index < sizeof (UINTN) / sizeof (UINT32); Index++) {
@@ -4949,7 +4949,7 @@ VmReadImmed16 (
//
// Read direct if aligned
//
- if (IS_ALIGNED ((UINTN) VmPtr->Ip + Offset, sizeof (INT16))) {
+ if (ADDRESS_IS_ALIGNED ((UINTN) VmPtr->Ip + Offset, sizeof (INT16))) {
return * (INT16 *) (VmPtr->Ip + Offset);
} else {
//
@@ -4993,7 +4993,7 @@ VmReadImmed32 (
//
// Read direct if aligned
//
- if (IS_ALIGNED ((UINTN) VmPtr->Ip + Offset, sizeof (UINT32))) {
+ if (ADDRESS_IS_ALIGNED ((UINTN) VmPtr->Ip + Offset, sizeof (UINT32))) {
return * (INT32 *) (VmPtr->Ip + Offset);
}
//
@@ -5032,7 +5032,7 @@ VmReadImmed64 (
//
// Read direct if aligned
//
- if (IS_ALIGNED ((UINTN) VmPtr->Ip + Offset, sizeof (UINT64))) {
+ if (ADDRESS_IS_ALIGNED ((UINTN) VmPtr->Ip + Offset, sizeof (UINT64))) {
return * (UINT64 *) (VmPtr->Ip + Offset);
}
//
@@ -5069,7 +5069,7 @@ VmReadCode16 (
//
// Read direct if aligned
//
- if (IS_ALIGNED ((UINTN) VmPtr->Ip + Offset, sizeof (UINT16))) {
+ if (ADDRESS_IS_ALIGNED ((UINTN) VmPtr->Ip + Offset, sizeof (UINT16))) {
return * (UINT16 *) (VmPtr->Ip + Offset);
} else {
//
@@ -5110,7 +5110,7 @@ VmReadCode32 (
//
// Read direct if aligned
//
- if (IS_ALIGNED ((UINTN) VmPtr->Ip + Offset, sizeof (UINT32))) {
+ if (ADDRESS_IS_ALIGNED ((UINTN) VmPtr->Ip + Offset, sizeof (UINT32))) {
return * (UINT32 *) (VmPtr->Ip + Offset);
}
//
@@ -5147,7 +5147,7 @@ VmReadCode64 (
//
// Read direct if aligned
//
- if (IS_ALIGNED ((UINTN) VmPtr->Ip + Offset, sizeof (UINT64))) {
+ if (ADDRESS_IS_ALIGNED ((UINTN) VmPtr->Ip + Offset, sizeof (UINT64))) {
return * (UINT64 *) (VmPtr->Ip + Offset);
}
//
@@ -5210,7 +5210,7 @@ VmReadMem16 (
//
// Read direct if aligned
//
- if (IS_ALIGNED (Addr, sizeof (UINT16))) {
+ if (ADDRESS_IS_ALIGNED (Addr, sizeof (UINT16))) {
return * (UINT16 *) Addr;
}
//
@@ -5243,7 +5243,7 @@ VmReadMem32 (
//
// Read direct if aligned
//
- if (IS_ALIGNED (Addr, sizeof (UINT32))) {
+ if (ADDRESS_IS_ALIGNED (Addr, sizeof (UINT32))) {
return * (UINT32 *) Addr;
}
//
@@ -5280,7 +5280,7 @@ VmReadMem64 (
//
// Read direct if aligned
//
- if (IS_ALIGNED (Addr, sizeof (UINT64))) {
+ if (ADDRESS_IS_ALIGNED (Addr, sizeof (UINT64))) {
return * (UINT64 *) Addr;
}
//
@@ -5349,7 +5349,7 @@ VmReadMemN (
//
// Read direct if aligned
//
- if (IS_ALIGNED (Addr, sizeof (UINTN))) {
+ if (ADDRESS_IS_ALIGNED (Addr, sizeof (UINTN))) {
return * (UINTN *) Addr;
}
//
diff --git a/MdeModulePkg/Bus/Ata/AhciPei/AhciPei.h b/MdeModulePkg/Bus/Ata/AhciPei/AhciPei.h
index 2be78076bee7..59bb9e5d0bca 100644
--- a/MdeModulePkg/Bus/Ata/AhciPei/AhciPei.h
+++ b/MdeModulePkg/Bus/Ata/AhciPei/AhciPei.h
@@ -145,7 +145,6 @@ typedef union {
#define AHCI_PORT_SERR 0x0030
#define AHCI_PORT_CI 0x0038

-#define IS_ALIGNED(addr, size) (((UINTN) (addr) & (size - 1)) == 0)
#define TIMER_PERIOD_SECONDS(Seconds) MultU64x32((UINT64)(Seconds), 10000000)

#pragma pack(1)
diff --git a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.h b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.h
index 5f582b9b3e76..99bbf7d14a17 100644
--- a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.h
+++ b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.h
@@ -147,8 +147,6 @@ struct _ATA_NONBLOCK_TASK {
#define ATA_ATAPI_TIMEOUT EFI_TIMER_PERIOD_SECONDS(3)
#define ATA_SPINUP_TIMEOUT EFI_TIMER_PERIOD_SECONDS(10)

-#define IS_ALIGNED(addr, size) (((UINTN) (addr) & (size - 1)) == 0)
-
#define ATA_PASS_THRU_PRIVATE_DATA_FROM_THIS(a) \
CR (a, \
ATA_ATAPI_PASS_THRU_INSTANCE, \
diff --git a/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBus.h b/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBus.h
index a5a865209942..172d2d61ea6c 100644
--- a/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBus.h
+++ b/MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBus.h
@@ -76,7 +76,6 @@
#define ATA_TASK_SIGNATURE SIGNATURE_32 ('A', 'T', 'S', 'K')
#define ATA_DEVICE_SIGNATURE SIGNATURE_32 ('A', 'B', 'I', 'D')
#define ATA_SUB_TASK_SIGNATURE SIGNATURE_32 ('A', 'S', 'T', 'S')
-#define IS_ALIGNED(addr, size) (((UINTN) (addr) & (size - 1)) == 0)

//
// ATA bus data structure for ATA controller
diff --git a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h
index ed9bbd6f8ba8..86ad27b3292f 100644
--- a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h
+++ b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h
@@ -37,9 +37,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <IndustryStandard/Scsi.h>
#include <IndustryStandard/Atapi.h>

-#define IS_DEVICE_FIXED(a) (a)->FixedDevice ? 1 : 0
-
-#define IS_ALIGNED(addr, size) (((UINTN) (addr) & (size - 1)) == 0)
+#define IS_DEVICE_FIXED(a) (a)->FixedDevice ? 1 : 0

#define UFS_WLUN_RPMB 0xC4

diff --git a/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.h b/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.h
index 6e2305aa2bc2..7306106a4454 100644
--- a/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.h
+++ b/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.h
@@ -133,8 +133,6 @@ typedef struct _UFS_PEIM_HC_PRIVATE_DATA {

#define ROUNDUP8(x) (((x) % 8 == 0) ? (x) : ((x) / 8 + 1) * 8)

-#define IS_ALIGNED(addr, size) (((UINTN) (addr) & (size - 1)) == 0)
-
#define GET_UFS_PEIM_HC_PRIVATE_DATA_FROM_THIS(a) CR (a, UFS_PEIM_HC_PRIVATE_DATA, BlkIoPpi, UFS_PEIM_HC_SIG)
#define GET_UFS_PEIM_HC_PRIVATE_DATA_FROM_THIS2(a) CR (a, UFS_PEIM_HC_PRIVATE_DATA, BlkIo2Ppi, UFS_PEIM_HC_SIG)
#define GET_UFS_PEIM_HC_PRIVATE_DATA_FROM_THIS_NOTIFY(a) CR (a, UFS_PEIM_HC_PRIVATE_DATA, EndOfPeiNotifyList, UFS_PEIM_HC_SIG)
diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h
index 79b86f7e6b3d..11b5b197b67a 100644
--- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h
+++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h
@@ -105,8 +105,6 @@ typedef struct {

#define ROUNDUP8(x) (((x) % 8 == 0) ? (x) : ((x) / 8 + 1) * 8)

-#define IS_ALIGNED(addr, size) (((UINTN) (addr) & (size - 1)) == 0)
-
#define UFS_PASS_THRU_PRIVATE_DATA_FROM_THIS(a) \
CR (a, \
UFS_PASS_THRU_PRIVATE_DATA, \
diff --git a/MdeModulePkg/Universal/EbcDxe/EbcExecute.h b/MdeModulePkg/Universal/EbcDxe/EbcExecute.h
index 1cb68bc5385a..858ca7fc86ae 100644
--- a/MdeModulePkg/Universal/EbcDxe/EbcExecute.h
+++ b/MdeModulePkg/Universal/EbcDxe/EbcExecute.h
@@ -14,8 +14,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
//
// Macros to check and set alignment
//
-#define ASSERT_ALIGNED(addr, size) ASSERT (!((UINT32) (addr) & (size - 1)))
-#define IS_ALIGNED(addr, size) !((UINT32) (addr) & (size - 1))
+#define ASSERT_ALIGNED(addr, size) ASSERT (IS_ALIGNED (addr, size))

//
// Debug macro
diff --git a/MdePkg/Include/Base.h b/MdePkg/Include/Base.h
index 2da08b0c787f..32d0e512e05f 100644
--- a/MdePkg/Include/Base.h
+++ b/MdePkg/Include/Base.h
@@ -789,6 +789,35 @@ typedef UINTN *BASE_LIST;
#define OFFSET_OF(TYPE, Field) ((UINTN) &(((TYPE *)0)->Field))
#endif

+/**
+ Returns the alignment requirement of a type.
+
+ @param TYPE The name of the type to retrieve the alignment requirement of.
+
+ @return Alignment requirement, in Bytes, of TYPE.
+**/
+#if defined(__GNUC__) || defined(__clang__) || (defined(_MSC_VER) && _MSC_VER >= 1900)
+ //
+ // All supported versions of GCC and Clang, as well as MSVC 2015 and later,
+ // support the standard operator _Alignof.
+ //
+ #define ALIGNOF(TYPE) _Alignof (TYPE)
+#elif defined(_MSC_VER)
+ //
+ // Earlier versions of MSVC, at least MSVC 2008 and later, support the
+ // vendor-extension __alignof.
+ //
+ #define ALIGNOF(TYPE) __alignof (TYPE)
+#else
+ //
+ // For compilers that do not support inbuilt alignof operators, use OFFSET_OF.
+ // CHAR8 is known to have both a size and an alignment requirement of 1 Byte.
+ // As such, A must be located exactly at the offset equal to its alignment
+ // requirement.
+ //
+ #define ALIGNOF(TYPE) OFFSET_OF (struct { CHAR8 C; TYPE A; }, A)
+#endif
+
/**
Portable definition for compile time assertions.
Equivalent to C11 static_assert macro from assert.h.
@@ -824,6 +853,21 @@ STATIC_ASSERT (sizeof (CHAR16) == 2, "sizeof (CHAR16) does not meet UEFI Specif
STATIC_ASSERT (sizeof (L'A') == 2, "sizeof (L'A') does not meet UEFI Specification Data Type requirements");
STATIC_ASSERT (sizeof (L"A") == 4, "sizeof (L\"A\") does not meet UEFI Specification Data Type requirements");

+STATIC_ASSERT (ALIGNOF (BOOLEAN) == sizeof (BOOLEAN), "Alignment of BOOLEAN does not meet UEFI Specification Data Type requirements");
+STATIC_ASSERT (ALIGNOF (INT8) == sizeof (INT8), "Alignment of INT8 does not meet UEFI Specification Data Type requirements");
+STATIC_ASSERT (ALIGNOF (UINT8) == sizeof (UINT8), "Alignment of INT16 does not meet UEFI Specification Data Type requirements");
+STATIC_ASSERT (ALIGNOF (INT16) == sizeof (INT16), "Alignment of INT16 does not meet UEFI Specification Data Type requirements");
+STATIC_ASSERT (ALIGNOF (UINT16) == sizeof (UINT16), "Alignment of UINT16 does not meet UEFI Specification Data Type requirements");
+STATIC_ASSERT (ALIGNOF (INT32) == sizeof (INT32), "Alignment of INT32 does not meet UEFI Specification Data Type requirements");
+STATIC_ASSERT (ALIGNOF (UINT32) == sizeof (UINT32), "Alignment of UINT32 does not meet UEFI Specification Data Type requirements");
+STATIC_ASSERT (ALIGNOF (INT64) == sizeof (INT64), "Alignment of INT64 does not meet UEFI Specification Data Type requirements");
+STATIC_ASSERT (ALIGNOF (UINT64) == sizeof (UINT64), "Alignment of UINT64 does not meet UEFI Specification Data Type requirements");
+STATIC_ASSERT (ALIGNOF (CHAR8) == sizeof (CHAR8), "Alignment of CHAR8 does not meet UEFI Specification Data Type requirements");
+STATIC_ASSERT (ALIGNOF (CHAR16) == sizeof (CHAR16), "Alignment of CHAR16 does not meet UEFI Specification Data Type requirements");
+STATIC_ASSERT (ALIGNOF (INTN) == sizeof (INTN), "Alignment of INTN does not meet UEFI Specification Data Type requirements");
+STATIC_ASSERT (ALIGNOF (UINTN) == sizeof (UINTN), "Alignment of UINTN does not meet UEFI Specification Data Type requirements");
+STATIC_ASSERT (ALIGNOF (VOID *) == sizeof (VOID *), "Alignment of VOID * does not meet UEFI Specification Data Type requirements");
+
//
// The following three enum types are used to verify that the compiler
// configuration for enum types is compliant with Section 2.3.1 of the
@@ -847,6 +891,10 @@ STATIC_ASSERT (sizeof (__VERIFY_UINT8_ENUM_SIZE) == 4, "Size of enum does not me
STATIC_ASSERT (sizeof (__VERIFY_UINT16_ENUM_SIZE) == 4, "Size of enum does not meet UEFI Specification Data Type requirements");
STATIC_ASSERT (sizeof (__VERIFY_UINT32_ENUM_SIZE) == 4, "Size of enum does not meet UEFI Specification Data Type requirements");

+STATIC_ASSERT (ALIGNOF (__VERIFY_UINT8_ENUM_SIZE) == sizeof (__VERIFY_UINT8_ENUM_SIZE), "Alignment of enum does not meet UEFI Specification Data Type requirements");
+STATIC_ASSERT (ALIGNOF (__VERIFY_UINT16_ENUM_SIZE) == sizeof (__VERIFY_UINT16_ENUM_SIZE), "Alignment of enum does not meet UEFI Specification Data Type requirements");
+STATIC_ASSERT (ALIGNOF (__VERIFY_UINT32_ENUM_SIZE) == sizeof (__VERIFY_UINT32_ENUM_SIZE), "Alignment of enum does not meet UEFI Specification Data Type requirements");
+
/**
Macro that returns a pointer to the data structure that contains a specified field of
that data structure. This is a lightweight method to hide information by placing a
@@ -868,6 +916,46 @@ STATIC_ASSERT (sizeof (__VERIFY_UINT32_ENUM_SIZE) == 4, "Size of enum does not m
**/
#define BASE_CR(Record, TYPE, Field) ((TYPE *) ((CHAR8 *) (Record) - OFFSET_OF (TYPE, Field)))

+/**
+ Checks whether a value is a power of two.
+
+ @param Value The value to check.
+
+ @return Whether Value is a power of two.
+**/
+#define IS_POW2(Value) ((Value) != 0U && ((Value) & ((Value) - 1U)) == 0U)
+
+/**
+ Checks whether a value is aligned by a specified alignment.
+
+ @param Value The value to check.
+ @param Alignment The alignment boundary used to check against.
+
+ @return Whether Value is aligned by Alignment.
+**/
+#define IS_ALIGNED(Value, Alignment) (((Value) & ((Alignment) - 1U)) == 0U)
+
+/**
+ Checks whether a pointer or address is aligned by a specified alignment.
+
+ @param Address The pointer or address to check.
+ @param Alignment The alignment boundary used to check against.
+
+ @return Whether Address is aligned by Alignment.
+**/
+#define ADDRESS_IS_ALIGNED(Address, Alignment) IS_ALIGNED ((UINTN) (Address), Alignment)
+
+/**
+ Determines the addend to add to a value to round it up to the next boundary of
+ a specified alignment.
+
+ @param Value The value to round up.
+ @param Alignment The alignment boundary used to return the addend.
+
+ @return Addend to round Value up to alignment boundary Alignment.
+**/
+#define ALIGN_VALUE_ADDEND(Value, Alignment) (((Alignment) - (Value)) & ((Alignment) - 1U))
+
/**
Rounds a value up to the next boundary using a specified alignment.

@@ -880,7 +968,7 @@ STATIC_ASSERT (sizeof (__VERIFY_UINT32_ENUM_SIZE) == 4, "Size of enum does not m
@return A value up to the next boundary.

**/
-#define ALIGN_VALUE(Value, Alignment) ((Value) + (((Alignment) - (Value)) & ((Alignment) - 1)))
+#define ALIGN_VALUE(Value, Alignment) ((Value) + ALIGN_VALUE_ADDEND (Value, Alignment))

/**
Adjust a pointer by adding the minimum offset required for it to be aligned on
--
2.31.1


[PATCH] MdeModulePkg/PiSmmIpl: Correct fixed load address bounds check

Marvin Häuser
 

The current code only checks whether PiSmmCore's fixed loading
address, but not its entire memory range, is in bounds of the
reserved area. Furthermore, it does not consider the module's fixed
loading address, which is relative to the reserved area, could
wraparound when added to the base address.

Fix both issues by performing sufficient bounds checks in a way that
is free from wraparounds.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Vitaly Cheptsov <vit9696@protonmail.com>
Signed-off-by: Marvin Häuser <mhaeuser@posteo.de>
---
MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c b/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c
index 599a0cd01d80..259cd0bb8924 100644
--- a/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c
+++ b/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c
@@ -979,7 +979,8 @@ GetPeCoffImageFixLoadingAssignedAddress(
//
FixLoadingAddress = (EFI_PHYSICAL_ADDRESS)(SmramBase + (INT64)ValueInSectionHeader);

- if (SmramBase + SmmCodeSize > FixLoadingAddress && SmramBase <= FixLoadingAddress) {
+ if (ValueInSectionHeader < SmmCodeSize
+ && (UINTN)(ImageContext->ImageSize + ImageContext->SectionAlignment) <= SmmCodeSize - ValueInSectionHeader) {
//
// The assigned address is valid. Return the specified loading address
//
--
2.31.1


[PATCH] MdeModulePkg/PiSmmCore: Drop deprecated image profiling commands

Marvin Häuser
 

The legacy codebase allowed SMM images to be registered for profiling
from DXE. Support for this has been dropped entirely, so remove the
remaining handlers.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Vitaly Cheptsov <vit9696@protonmail.com>
Signed-off-by: Marvin Häuser <mhaeuser@posteo.de>
---
MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c | 80 --------------------
MdeModulePkg/Include/Guid/MemoryProfile.h | 5 --
2 files changed, 85 deletions(-)

diff --git a/MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c b/MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c
index 1b302c810cc9..7316df7531fd 100644
--- a/MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c
+++ b/MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c
@@ -2232,64 +2232,6 @@ Done:
mSmramProfileGettingStatus = SmramProfileGettingStatus;
}

-/**
- SMRAM profile handler to register SMM image.
-
- @param SmramProfileParameterRegisterImage The parameter of SMM profile register image.
-
-**/
-VOID
-SmramProfileHandlerRegisterImage (
- IN SMRAM_PROFILE_PARAMETER_REGISTER_IMAGE *SmramProfileParameterRegisterImage
- )
-{
- EFI_STATUS Status;
- EFI_SMM_DRIVER_ENTRY DriverEntry;
- VOID *EntryPointInImage;
-
- ZeroMem (&DriverEntry, sizeof (DriverEntry));
- CopyMem (&DriverEntry.FileName, &SmramProfileParameterRegisterImage->FileName, sizeof(EFI_GUID));
- DriverEntry.ImageBuffer = SmramProfileParameterRegisterImage->ImageBuffer;
- DriverEntry.NumberOfPage = (UINTN) SmramProfileParameterRegisterImage->NumberOfPage;
- Status = InternalPeCoffGetEntryPoint ((VOID *) (UINTN) DriverEntry.ImageBuffer, &EntryPointInImage);
- ASSERT_EFI_ERROR (Status);
- DriverEntry.ImageEntryPoint = (PHYSICAL_ADDRESS) (UINTN) EntryPointInImage;
-
- Status = RegisterSmramProfileImage (&DriverEntry, FALSE);
- if (!EFI_ERROR (Status)) {
- SmramProfileParameterRegisterImage->Header.ReturnStatus = 0;
- }
-}
-
-/**
- SMRAM profile handler to unregister SMM image.
-
- @param SmramProfileParameterUnregisterImage The parameter of SMM profile unregister image.
-
-**/
-VOID
-SmramProfileHandlerUnregisterImage (
- IN SMRAM_PROFILE_PARAMETER_UNREGISTER_IMAGE *SmramProfileParameterUnregisterImage
- )
-{
- EFI_STATUS Status;
- EFI_SMM_DRIVER_ENTRY DriverEntry;
- VOID *EntryPointInImage;
-
- ZeroMem (&DriverEntry, sizeof (DriverEntry));
- CopyMem (&DriverEntry.FileName, &SmramProfileParameterUnregisterImage->FileName, sizeof (EFI_GUID));
- DriverEntry.ImageBuffer = SmramProfileParameterUnregisterImage->ImageBuffer;
- DriverEntry.NumberOfPage = (UINTN) SmramProfileParameterUnregisterImage->NumberOfPage;
- Status = InternalPeCoffGetEntryPoint ((VOID *) (UINTN) DriverEntry.ImageBuffer, &EntryPointInImage);
- ASSERT_EFI_ERROR (Status);
- DriverEntry.ImageEntryPoint = (PHYSICAL_ADDRESS) (UINTN) EntryPointInImage;
-
- Status = UnregisterSmramProfileImage (&DriverEntry, FALSE);
- if (!EFI_ERROR (Status)) {
- SmramProfileParameterUnregisterImage->Header.ReturnStatus = 0;
- }
-}
-
/**
Dispatch function for a Software SMI handler.

@@ -2374,28 +2316,6 @@ SmramProfileHandler (
}
SmramProfileHandlerGetDataByOffset ((SMRAM_PROFILE_PARAMETER_GET_PROFILE_DATA_BY_OFFSET *) (UINTN) CommBuffer);
break;
- case SMRAM_PROFILE_COMMAND_REGISTER_IMAGE:
- DEBUG ((EFI_D_ERROR, "SmramProfileHandlerRegisterImage\n"));
- if (TempCommBufferSize != sizeof (SMRAM_PROFILE_PARAMETER_REGISTER_IMAGE)) {
- DEBUG ((EFI_D_ERROR, "SmramProfileHandler: SMM communication buffer size invalid!\n"));
- return EFI_SUCCESS;
- }
- if (mSmramReadyToLock) {
- return EFI_SUCCESS;
- }
- SmramProfileHandlerRegisterImage ((SMRAM_PROFILE_PARAMETER_REGISTER_IMAGE *) (UINTN) CommBuffer);
- break;
- case SMRAM_PROFILE_COMMAND_UNREGISTER_IMAGE:
- DEBUG ((EFI_D_ERROR, "SmramProfileHandlerUnregisterImage\n"));
- if (TempCommBufferSize != sizeof (SMRAM_PROFILE_PARAMETER_UNREGISTER_IMAGE)) {
- DEBUG ((EFI_D_ERROR, "SmramProfileHandler: SMM communication buffer size invalid!\n"));
- return EFI_SUCCESS;
- }
- if (mSmramReadyToLock) {
- return EFI_SUCCESS;
- }
- SmramProfileHandlerUnregisterImage ((SMRAM_PROFILE_PARAMETER_UNREGISTER_IMAGE *) (UINTN) CommBuffer);
- break;
case SMRAM_PROFILE_COMMAND_GET_RECORDING_STATE:
DEBUG ((EFI_D_ERROR, "SmramProfileHandlerGetRecordingState\n"));
if (TempCommBufferSize != sizeof (SMRAM_PROFILE_PARAMETER_RECORDING_STATE)) {
diff --git a/MdeModulePkg/Include/Guid/MemoryProfile.h b/MdeModulePkg/Include/Guid/MemoryProfile.h
index eee3b9125240..92cd1e7cf493 100644
--- a/MdeModulePkg/Include/Guid/MemoryProfile.h
+++ b/MdeModulePkg/Include/Guid/MemoryProfile.h
@@ -388,11 +388,6 @@ struct _EDKII_MEMORY_PROFILE_PROTOCOL {
//
#define SMRAM_PROFILE_COMMAND_GET_PROFILE_INFO 0x1
#define SMRAM_PROFILE_COMMAND_GET_PROFILE_DATA 0x2
-//
-// Below 2 commands are now used by ECP only and only valid before SmmReadyToLock
-//
-#define SMRAM_PROFILE_COMMAND_REGISTER_IMAGE 0x3
-#define SMRAM_PROFILE_COMMAND_UNREGISTER_IMAGE 0x4

#define SMRAM_PROFILE_COMMAND_GET_PROFILE_DATA_BY_OFFSET 0x5
#define SMRAM_PROFILE_COMMAND_GET_RECORDING_STATE 0x6
--
2.31.1


[PATCH] MdeModulePkg/DxeCore: Use the correct source for fixed load address

Marvin Häuser
 

The build tools write the fixed load address into the section header
of the first non-code section. While PeiCore and PiSmmCore correctly
load it from there, DxeCore uses ImageBase from the PE/COFF Optional
Header instead.

Align the behaviour of DxeCore with the other dispatchers.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Vitaly Cheptsov <vit9696@protonmail.com>
Signed-off-by: Marvin Häuser <mhaeuser@posteo.de>
---
MdeModulePkg/Core/Dxe/Image/Image.c | 30 ++++++++++++++------
1 file changed, 21 insertions(+), 9 deletions(-)

diff --git a/MdeModulePkg/Core/Dxe/Image/Image.c b/MdeModulePkg/Core/Dxe/Image/Image.c
index 641a5715b112..9455c2fa45ad 100644
--- a/MdeModulePkg/Core/Dxe/Image/Image.c
+++ b/MdeModulePkg/Core/Dxe/Image/Image.c
@@ -416,6 +416,7 @@ GetPeCoffImageFixLoadingAssignedAddress(
EFI_STATUS Status;
EFI_IMAGE_SECTION_HEADER SectionHeader;
EFI_IMAGE_OPTIONAL_HEADER_UNION *ImgHdr;
+ EFI_PHYSICAL_ADDRESS FixLoadingAddress;
UINT16 Index;
UINTN Size;
UINT16 NumberOfSections;
@@ -468,24 +469,35 @@ GetPeCoffImageFixLoadingAssignedAddress(
//
ValueInSectionHeader = ReadUnaligned64((UINT64*)&SectionHeader.PointerToRelocations);
if (ValueInSectionHeader != 0) {
- //
- // When the feature is configured as load module at fixed absolute address, the ImageAddress field of ImageContext
- // hold the specified address. If the feature is configured as load module at fixed offset, ImageAddress hold an offset
- // relative to top address
- //
- if ((INT64)PcdGet64(PcdLoadModuleAtFixAddressEnable) < 0) {
- ImageContext->ImageAddress = gLoadModuleAtFixAddressConfigurationTable.DxeCodeTopAddress + (INT64)(INTN)ImageContext->ImageAddress;
+ if ((INT64)PcdGet64(PcdLoadModuleAtFixAddressEnable) > 0) {
+ //
+ // When LMFA feature is configured as Load Module at Fixed Absolute Address mode, PointerToRelocations & PointerToLineNumbers field
+ // hold the absolute address of image base running in memory
+ //
+ FixLoadingAddress = ValueInSectionHeader;
+ } else {
+ //
+ // When LMFA feature is configured as Load Module at Fixed offset mode, PointerToRelocations & PointerToLineNumbers field
+ // hold the offset relative to a platform-specific top address.
+ //
+ FixLoadingAddress = gLoadModuleAtFixAddressConfigurationTable.DxeCodeTopAddress + ValueInSectionHeader;
}
//
// Check if the memory range is available.
//
- Status = CheckAndMarkFixLoadingMemoryUsageBitMap (ImageContext->ImageAddress, (UINTN)(ImageContext->ImageSize + ImageContext->SectionAlignment));
+ Status = CheckAndMarkFixLoadingMemoryUsageBitMap (FixLoadingAddress, (UINTN)(ImageContext->ImageSize + ImageContext->SectionAlignment));
+ if (!EFI_ERROR(Status)) {
+ //
+ // The assigned address is valid. Return the specified loading address
+ //
+ ImageContext->ImageAddress = FixLoadingAddress;
+ }
}
break;
}
SectionHeaderOffset += sizeof (EFI_IMAGE_SECTION_HEADER);
}
- DEBUG ((EFI_D_INFO|EFI_D_LOAD, "LOADING MODULE FIXED INFO: Loading module at fixed address 0x%11p. Status = %r \n", (VOID *)(UINTN)(ImageContext->ImageAddress), Status));
+ DEBUG ((EFI_D_INFO|EFI_D_LOAD, "LOADING MODULE FIXED INFO: Loading module at fixed address 0x%11p. Status = %r \n", (VOID *)(UINTN)FixLoadingAddress, Status));
return Status;
}

--
2.31.1


[PATCH] MdeModulePkg/DxeCore: Drop unnecessary pointer indirection

Marvin Häuser
 

CoreInitializeGcdServices() takes a pointer-to-pointer for the first
HOB. However, it is dereferenced in every operation inside. To
mitigate confusion whether or not it can be re-allocated by the
callee, remove the unnecessary indirection.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Vitaly Cheptsov <vit9696@protonmail.com>
Signed-off-by: Marvin Häuser <mhaeuser@posteo.de>
---
MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c | 2 +-
MdeModulePkg/Core/Dxe/Gcd/Gcd.c | 10 +++++-----
MdeModulePkg/Core/Dxe/DxeMain.h | 2 +-
3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c
index db21311f9352..1a8f6b57f356 100644
--- a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c
+++ b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c
@@ -263,7 +263,7 @@ DxeMain (
//
// Initialize Memory Services
//
- CoreInitializeMemoryServices (&HobStart, &MemoryBaseAddress, &MemoryLength);
+ CoreInitializeMemoryServices (HobStart, &MemoryBaseAddress, &MemoryLength);

MemoryProfileInit (HobStart);

diff --git a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
index 51b082b7e7eb..af9e9e315819 100644
--- a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
+++ b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
@@ -2168,7 +2168,7 @@ FindLargestFreeRegion (
**/
EFI_STATUS
CoreInitializeMemoryServices (
- IN VOID **HobStart,
+ IN VOID *HobStart,
OUT EFI_PHYSICAL_ADDRESS *MemoryBaseAddress,
OUT UINT64 *MemoryLength
)
@@ -2194,7 +2194,7 @@ CoreInitializeMemoryServices (
//
// Point at the first HOB. This must be the PHIT HOB.
//
- Hob.Raw = *HobStart;
+ Hob.Raw = HobStart;
ASSERT (GET_HOB_TYPE (Hob) == EFI_HOB_TYPE_HANDOFF);

//
@@ -2248,7 +2248,7 @@ CoreInitializeMemoryServices (
// Find the Resource Descriptor HOB that contains PHIT range EfiFreeMemoryBottom..EfiFreeMemoryTop
//
Found = FALSE;
- for (Hob.Raw = *HobStart; !END_OF_HOB_LIST(Hob); Hob.Raw = GET_NEXT_HOB(Hob)) {
+ for (Hob.Raw = HobStart; !END_OF_HOB_LIST(Hob); Hob.Raw = GET_NEXT_HOB(Hob)) {
//
// Skip all HOBs except Resource Descriptor HOBs
//
@@ -2304,7 +2304,7 @@ CoreInitializeMemoryServices (
// Compute range between the start of the Resource Descriptor HOB and the start of the HOB List
//
BaseAddress = PageAlignAddress (ResourceHob->PhysicalStart);
- Length = PageAlignLength ((UINT64)((UINTN)*HobStart - BaseAddress));
+ Length = PageAlignLength ((UINT64)((UINTN)HobStart - BaseAddress));
FindLargestFreeRegion (&BaseAddress, &Length, (EFI_HOB_MEMORY_ALLOCATION *)GetFirstHob (EFI_HOB_TYPE_MEMORY_ALLOCATION));
}
}
@@ -2329,7 +2329,7 @@ CoreInitializeMemoryServices (
// The max address must be within the physically addressible range for the processor.
//
HighAddress = MAX_ALLOC_ADDRESS;
- for (Hob.Raw = *HobStart; !END_OF_HOB_LIST(Hob); Hob.Raw = GET_NEXT_HOB(Hob)) {
+ for (Hob.Raw = HobStart; !END_OF_HOB_LIST(Hob); Hob.Raw = GET_NEXT_HOB(Hob)) {
//
// Skip the Resource Descriptor HOB that contains the PHIT
//
diff --git a/MdeModulePkg/Core/Dxe/DxeMain.h b/MdeModulePkg/Core/Dxe/DxeMain.h
index 9bd3c0d08411..8f268dd2854a 100644
--- a/MdeModulePkg/Core/Dxe/DxeMain.h
+++ b/MdeModulePkg/Core/Dxe/DxeMain.h
@@ -366,7 +366,7 @@ CoreAcquireGcdMemoryLock (
**/
EFI_STATUS
CoreInitializeMemoryServices (
- IN VOID **HobStart,
+ IN VOID *HobStart,
OUT EFI_PHYSICAL_ADDRESS *MemoryBaseAddress,
OUT UINT64 *MemoryLength
);
--
2.31.1


[PATCH] MdeModulePkg/DxeCore: Consistent DebugImageInfoTable updates

Marvin Häuser
 

In theory, modifications to the DebugImageInfoTable may cause
exceptions. If the exception handler parses the table, this can lead
to subsequent exceptions if the table state is inconsistent.

Ensure the DebugImageInfoTable remains consistent during
modifications. This includes:
1) Free the old table only only after the new table has been
published. Mitigates use-after-free of the old table.
2) Do not insert an image entry till it is fully initialised. Entries
may be inserted in the live range if an entry was deleted previously.
Mitigaes the usage of inconsistent entries.
3) Free the old image entry only after the table has been updated
with the NULL value. Mitigates use-after-free of the old entry.
4) Set the MODIFIED state before performing any modifications.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Vitaly Cheptsov <vit9696@protonmail.com>
Signed-off-by: Marvin Häuser <mhaeuser@posteo.de>
---
MdeModulePkg/Core/Dxe/Misc/DebugImageInfo.c | 60 +++++++++++---------
1 file changed, 34 insertions(+), 26 deletions(-)

diff --git a/MdeModulePkg/Core/Dxe/Misc/DebugImageInfo.c b/MdeModulePkg/Core/Dxe/Misc/DebugImageInfo.c
index a75d4158280b..7bd970115111 100644
--- a/MdeModulePkg/Core/Dxe/Misc/DebugImageInfo.c
+++ b/MdeModulePkg/Core/Dxe/Misc/DebugImageInfo.c
@@ -165,10 +165,11 @@ CoreNewDebugImageInfoEntry (
IN EFI_HANDLE ImageHandle
)
{
- EFI_DEBUG_IMAGE_INFO *Table;
- EFI_DEBUG_IMAGE_INFO *NewTable;
- UINTN Index;
- UINTN TableSize;
+ EFI_DEBUG_IMAGE_INFO *Table;
+ EFI_DEBUG_IMAGE_INFO *NewTable;
+ UINTN Index;
+ UINTN TableSize;
+ EFI_DEBUG_IMAGE_INFO_NORMAL *NormalImage;

//
// Set the flag indicating that we're in the process of updating the table.
@@ -203,14 +204,6 @@ CoreNewDebugImageInfoEntry (
// Copy the old table into the new one
//
CopyMem (NewTable, Table, TableSize);
- //
- // Free the old table
- //
- CoreFreePool (Table);
- //
- // Update the table header
- //
- Table = NewTable;
mDebugInfoTableHeader.EfiDebugImageInfoTable = NewTable;
//
// Enlarge the max table entries and set the first empty entry index to
@@ -218,24 +211,34 @@ CoreNewDebugImageInfoEntry (
//
Index = mMaxTableEntries;
mMaxTableEntries += EFI_PAGE_SIZE / EFI_DEBUG_TABLE_ENTRY_SIZE;
+ //
+ // Free the old table
+ //
+ CoreFreePool (Table);
+ //
+ // Update the table header
+ //
+ Table = NewTable;
}

//
// Allocate data for new entry
//
- Table[Index].NormalImage = AllocateZeroPool (sizeof (EFI_DEBUG_IMAGE_INFO_NORMAL));
- if (Table[Index].NormalImage != NULL) {
+ NormalImage = AllocateZeroPool (sizeof (EFI_DEBUG_IMAGE_INFO_NORMAL));
+ if (NormalImage != NULL) {
//
// Update the entry
//
- Table[Index].NormalImage->ImageInfoType = (UINT32) ImageInfoType;
- Table[Index].NormalImage->LoadedImageProtocolInstance = LoadedImage;
- Table[Index].NormalImage->ImageHandle = ImageHandle;
+ NormalImage->ImageInfoType = (UINT32) ImageInfoType;
+ NormalImage->LoadedImageProtocolInstance = LoadedImage;
+ NormalImage->ImageHandle = ImageHandle;
//
- // Increase the number of EFI_DEBUG_IMAGE_INFO elements and set the mDebugInfoTable in modified status.
+ // Set the mDebugInfoTable in modified status, insert the entry, and
+ // increase the number of EFI_DEBUG_IMAGE_INFO elements.
//
- mDebugInfoTableHeader.TableSize++;
mDebugInfoTableHeader.UpdateStatus |= EFI_DEBUG_IMAGE_INFO_TABLE_MODIFIED;
+ Table[Index].NormalImage = NormalImage;
+ mDebugInfoTableHeader.TableSize++;
}
mDebugInfoTableHeader.UpdateStatus &= ~EFI_DEBUG_IMAGE_INFO_UPDATE_IN_PROGRESS;
}
@@ -253,8 +256,9 @@ CoreRemoveDebugImageInfoEntry (
EFI_HANDLE ImageHandle
)
{
- EFI_DEBUG_IMAGE_INFO *Table;
- UINTN Index;
+ EFI_DEBUG_IMAGE_INFO *Table;
+ UINTN Index;
+ EFI_DEBUG_IMAGE_INFO_NORMAL *NormalImage;

mDebugInfoTableHeader.UpdateStatus |= EFI_DEBUG_IMAGE_INFO_UPDATE_IN_PROGRESS;

@@ -263,16 +267,20 @@ CoreRemoveDebugImageInfoEntry (
for (Index = 0; Index < mMaxTableEntries; Index++) {
if (Table[Index].NormalImage != NULL && Table[Index].NormalImage->ImageHandle == ImageHandle) {
//
- // Found a match. Free up the record, then NULL the pointer to indicate the slot
- // is free.
+ // Found a match. Set the mDebugInfoTable in modified status and NULL the
+ // pointer to indicate the slot is free and.
//
- CoreFreePool (Table[Index].NormalImage);
+ NormalImage = Table[Index].NormalImage;
+ mDebugInfoTableHeader.UpdateStatus |= EFI_DEBUG_IMAGE_INFO_TABLE_MODIFIED;
Table[Index].NormalImage = NULL;
//
- // Decrease the number of EFI_DEBUG_IMAGE_INFO elements and set the mDebugInfoTable in modified status.
+ // Decrease the number of EFI_DEBUG_IMAGE_INFO elements.
//
mDebugInfoTableHeader.TableSize--;
- mDebugInfoTableHeader.UpdateStatus |= EFI_DEBUG_IMAGE_INFO_TABLE_MODIFIED;
+ //
+ // Free up the record.
+ //
+ CoreFreePool (NormalImage);
break;
}
}
--
2.31.1


[PATCH] EmulatorPkg/Host/Unix: Remove unused declarations

Marvin Häuser
 

Remove declarations of functions that are not implemented at all,
or are implemented elsewhere.

Cc: Andrew Fish <afish@apple.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Vitaly Cheptsov <vit9696@protonmail.com>
Signed-off-by: Marvin Häuser <mhaeuser@posteo.de>
---
EmulatorPkg/Unix/Host/Host.h | 87 --------------------
1 file changed, 87 deletions(-)

diff --git a/EmulatorPkg/Unix/Host/Host.h b/EmulatorPkg/Unix/Host/Host.h
index 9791cf8c370e..b2e5eafb6323 100644
--- a/EmulatorPkg/Unix/Host/Host.h
+++ b/EmulatorPkg/Unix/Host/Host.h
@@ -145,15 +145,6 @@ typedef struct {
} IMAGE_CONTEXT_TO_MOD_HANDLE;


-EFI_STATUS
-EFIAPI
-SecUnixPeiLoadFile (
- VOID *Pe32Data,
- EFI_PHYSICAL_ADDRESS *ImageAddress,
- UINT64 *ImageSize,
- EFI_PHYSICAL_ADDRESS *EntryPoint
- );
-
int
main (
IN int Argc,
@@ -169,48 +160,6 @@ SecLoadFromCore (
IN VOID *PeiCoreFile
);

-EFI_STATUS
-SecLoadFile (
- IN VOID *Pe32Data,
- IN EFI_PHYSICAL_ADDRESS *ImageAddress,
- IN UINT64 *ImageSize,
- IN EFI_PHYSICAL_ADDRESS *EntryPoint
- );
-
-EFI_STATUS
-SecFfsFindPeiCore (
- IN EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader,
- OUT VOID **Pe32Data
- );
-
-EFI_STATUS
-SecFfsFindNextFile (
- IN EFI_FV_FILETYPE SearchType,
- IN EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader,
- IN OUT EFI_FFS_FILE_HEADER **FileHeader
- );
-
-EFI_STATUS
-SecFfsFindSectionData (
- IN EFI_SECTION_TYPE SectionType,
- IN EFI_FFS_FILE_HEADER *FfsFileHeader,
- IN OUT VOID **SectionData
- );
-
-EFI_STATUS
-EFIAPI
-SecUnixPeCoffLoaderLoadAsDll (
- IN CHAR8 *PdbFileName,
- IN VOID **ImageEntryPoint,
- OUT VOID **ModHandle
- );
-
-EFI_STATUS
-EFIAPI
-SecUnixPeCoffLoaderFreeLibrary (
- OUT VOID *ModHandle
- );
-
EFI_STATUS
SecUnixFdAddress (
IN UINTN Index,
@@ -231,12 +180,6 @@ GasketSecUnixFdAddress (
;


-EFI_STATUS
-GetImageReadFunction (
- IN PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext,
- IN EFI_PHYSICAL_ADDRESS *TopOfMemory
- );
-
EFI_STATUS
EFIAPI
SecImageRead (
@@ -246,36 +189,12 @@ SecImageRead (
OUT VOID *Buffer
);

-CHAR16 *
-AsciiToUnicode (
- IN CHAR8 *Ascii,
- IN UINTN *StrLen OPTIONAL
- );
-
UINTN
CountSeparatorsInString (
IN const CHAR16 *String,
IN CHAR16 Separator
);

-EFI_STATUS
-EFIAPI
-SecTemporaryRamSupport (
- IN CONST EFI_PEI_SERVICES **PeiServices,
- IN EFI_PHYSICAL_ADDRESS TemporaryMemoryBase,
- IN EFI_PHYSICAL_ADDRESS PermanentMemoryBase,
- IN UINTN CopySize
- );
-
-EFI_STATUS
-EFIAPI
-GasketSecTemporaryRamSupport (
- IN CONST EFI_PEI_SERVICES **PeiServices,
- IN EFI_PHYSICAL_ADDRESS TemporaryMemoryBase,
- IN EFI_PHYSICAL_ADDRESS PermanentMemoryBase,
- IN UINTN CopySize
- );
-

RETURN_STATUS
EFIAPI
@@ -290,12 +209,6 @@ SecPeCoffRelocateImageExtraAction (
IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
);

-VOID
-EFIAPI
-SecPeCoffLoaderUnloadImageExtraAction (
- IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
- );
-

VOID
PeiSwitchStacks (
--
2.31.1


[PATCH] MdeModulePkg/CoreDxe: Drop caller-allocated image buffers

Marvin Häuser
 

The current image loading code supports using an caller-allocated
buffer to load an UEFI image into. This concept is inherently flawed
as a caller would need to parse the image itself first to retrieve
the appropriate destination size.

As the only caller does not use this functionality, remove it.
Further drop the EntryPoint parameter, as it is unused as well.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Vitaly Cheptsov <vit9696@protonmail.com>
Signed-off-by: Marvin Häuser <mhaeuser@posteo.de>
---
MdeModulePkg/Core/Dxe/Image/Image.c | 199 ++++++--------------
1 file changed, 62 insertions(+), 137 deletions(-)

diff --git a/MdeModulePkg/Core/Dxe/Image/Image.c b/MdeModulePkg/Core/Dxe/Image/Image.c
index 641a5715b112..1de83f96e5ed 100644
--- a/MdeModulePkg/Core/Dxe/Image/Image.c
+++ b/MdeModulePkg/Core/Dxe/Image/Image.c
@@ -540,8 +540,6 @@ CoreIsImageTypeSupported (
boot selection.
@param Pe32Handle The handle of PE32 image
@param Image PE image to be loaded
- @param DstBuffer The buffer to store the image
- @param EntryPoint A pointer to the entry point
@param Attribute The bit mask of attributes to set for the load
PE image

@@ -557,13 +555,10 @@ CoreLoadPeImage (
IN BOOLEAN BootPolicy,
IN VOID *Pe32Handle,
IN LOADED_IMAGE_PRIVATE_DATA *Image,
- IN EFI_PHYSICAL_ADDRESS DstBuffer OPTIONAL,
- OUT EFI_PHYSICAL_ADDRESS *EntryPoint OPTIONAL,
IN UINT32 Attribute
)
{
EFI_STATUS Status;
- BOOLEAN DstBufAlocated;
UINTN Size;

ZeroMem (&Image->ImageContext, sizeof (Image->ImageContext));
@@ -615,93 +610,63 @@ CoreLoadPeImage (
//
// Allocate memory of the correct memory type aligned on the required image boundary
//
- DstBufAlocated = FALSE;
- if (DstBuffer == 0) {
- //
- // Allocate Destination Buffer as caller did not pass it in
- //

- if (Image->ImageContext.SectionAlignment > EFI_PAGE_SIZE) {
- Size = (UINTN)Image->ImageContext.ImageSize + Image->ImageContext.SectionAlignment;
- } else {
- Size = (UINTN)Image->ImageContext.ImageSize;
- }
-
- Image->NumberOfPages = EFI_SIZE_TO_PAGES (Size);
-
- //
- // If the image relocations have not been stripped, then load at any address.
- // Otherwise load at the address at which it was linked.
- //
- // Memory below 1MB should be treated reserved for CSM and there should be
- // no modules whose preferred load addresses are below 1MB.
- //
- Status = EFI_OUT_OF_RESOURCES;
- //
- // If Loading Module At Fixed Address feature is enabled, the module should be loaded to
- // a specified address.
- //
- if (PcdGet64(PcdLoadModuleAtFixAddressEnable) != 0 ) {
- Status = GetPeCoffImageFixLoadingAssignedAddress (&(Image->ImageContext));
-
- if (EFI_ERROR (Status)) {
- //
- // If the code memory is not ready, invoke CoreAllocatePage with AllocateAnyPages to load the driver.
- //
- DEBUG ((EFI_D_INFO|EFI_D_LOAD, "LOADING MODULE FIXED ERROR: Loading module at fixed address failed since specified memory is not available.\n"));
-
- Status = CoreAllocatePages (
- AllocateAnyPages,
- (EFI_MEMORY_TYPE) (Image->ImageContext.ImageCodeMemoryType),
- Image->NumberOfPages,
- &Image->ImageContext.ImageAddress
- );
- }
- } else {
- if (Image->ImageContext.ImageAddress >= 0x100000 || Image->ImageContext.RelocationsStripped) {
- Status = CoreAllocatePages (
- AllocateAddress,
- (EFI_MEMORY_TYPE) (Image->ImageContext.ImageCodeMemoryType),
- Image->NumberOfPages,
- &Image->ImageContext.ImageAddress
- );
- }
- if (EFI_ERROR (Status) && !Image->ImageContext.RelocationsStripped) {
- Status = CoreAllocatePages (
- AllocateAnyPages,
- (EFI_MEMORY_TYPE) (Image->ImageContext.ImageCodeMemoryType),
- Image->NumberOfPages,
- &Image->ImageContext.ImageAddress
- );
- }
- }
- if (EFI_ERROR (Status)) {
- return Status;
- }
- DstBufAlocated = TRUE;
+ if (Image->ImageContext.SectionAlignment > EFI_PAGE_SIZE) {
+ Size = (UINTN)Image->ImageContext.ImageSize + Image->ImageContext.SectionAlignment;
} else {
- //
- // Caller provided the destination buffer
- //
-
- if (Image->ImageContext.RelocationsStripped && (Image->ImageContext.ImageAddress != DstBuffer)) {
+ Size = (UINTN)Image->ImageContext.ImageSize;
+ }
+
+ Image->NumberOfPages = EFI_SIZE_TO_PAGES (Size);
+
+ //
+ // If the image relocations have not been stripped, then load at any address.
+ // Otherwise load at the address at which it was linked.
+ //
+ // Memory below 1MB should be treated reserved for CSM and there should be
+ // no modules whose preferred load addresses are below 1MB.
+ //
+ Status = EFI_OUT_OF_RESOURCES;
+ //
+ // If Loading Module At Fixed Address feature is enabled, the module should be loaded to
+ // a specified address.
+ //
+ if (PcdGet64(PcdLoadModuleAtFixAddressEnable) != 0 ) {
+ Status = GetPeCoffImageFixLoadingAssignedAddress (&(Image->ImageContext));
+
+ if (EFI_ERROR (Status)) {
//
- // If the image relocations were stripped, and the caller provided a
- // destination buffer address that does not match the address that the
- // image is linked at, then the image cannot be loaded.
+ // If the code memory is not ready, invoke CoreAllocatePage with AllocateAnyPages to load the driver.
//
- return EFI_INVALID_PARAMETER;
+ DEBUG ((EFI_D_INFO|EFI_D_LOAD, "LOADING MODULE FIXED ERROR: Loading module at fixed address failed since specified memory is not available.\n"));
+
+ Status = CoreAllocatePages (
+ AllocateAnyPages,
+ (EFI_MEMORY_TYPE) (Image->ImageContext.ImageCodeMemoryType),
+ Image->NumberOfPages,
+ &Image->ImageContext.ImageAddress
+ );
}
-
- if (Image->NumberOfPages != 0 &&
- Image->NumberOfPages <
- (EFI_SIZE_TO_PAGES ((UINTN)Image->ImageContext.ImageSize + Image->ImageContext.SectionAlignment))) {
- Image->NumberOfPages = EFI_SIZE_TO_PAGES ((UINTN)Image->ImageContext.ImageSize + Image->ImageContext.SectionAlignment);
- return EFI_BUFFER_TOO_SMALL;
+ } else {
+ if (Image->ImageContext.ImageAddress >= 0x100000 || Image->ImageContext.RelocationsStripped) {
+ Status = CoreAllocatePages (
+ AllocateAddress,
+ (EFI_MEMORY_TYPE) (Image->ImageContext.ImageCodeMemoryType),
+ Image->NumberOfPages,
+ &Image->ImageContext.ImageAddress
+ );
}
-
- Image->NumberOfPages = EFI_SIZE_TO_PAGES ((UINTN)Image->ImageContext.ImageSize + Image->ImageContext.SectionAlignment);
- Image->ImageContext.ImageAddress = DstBuffer;
+ if (EFI_ERROR (Status) && !Image->ImageContext.RelocationsStripped) {
+ Status = CoreAllocatePages (
+ AllocateAnyPages,
+ (EFI_MEMORY_TYPE) (Image->ImageContext.ImageCodeMemoryType),
+ Image->NumberOfPages,
+ &Image->ImageContext.ImageAddress
+ );
+ }
+ }
+ if (EFI_ERROR (Status)) {
+ return Status;
}

Image->ImageBasePage = Image->ImageContext.ImageAddress;
@@ -783,13 +748,6 @@ CoreLoadPeImage (
}
}

- //
- // Fill in the entry point of the image if it is available
- //
- if (EntryPoint != NULL) {
- *EntryPoint = Image->ImageContext.EntryPoint;
- }
-
//
// Print the load address and the PDB file name if it is available
//
@@ -854,11 +812,9 @@ Done:
// Free memory.
//

- if (DstBufAlocated) {
- CoreFreePages (Image->ImageContext.ImageAddress, Image->NumberOfPages);
- Image->ImageContext.ImageAddress = 0;
- Image->ImageBasePage = 0;
- }
+ CoreFreePages (Image->ImageContext.ImageAddress, Image->NumberOfPages);
+ Image->ImageContext.ImageAddress = 0;
+ Image->ImageBasePage = 0;

if (Image->ImageContext.FixupData != NULL) {
CoreFreePool (Image->ImageContext.FixupData);
@@ -906,13 +862,11 @@ CoreLoadedImageInfo (
Unloads EFI image from memory.

@param Image EFI image
- @param FreePage Free allocated pages

**/
VOID
CoreUnloadAndCloseImage (
- IN LOADED_IMAGE_PRIVATE_DATA *Image,
- IN BOOLEAN FreePage
+ IN LOADED_IMAGE_PRIVATE_DATA *Image
)
{
EFI_STATUS Status;
@@ -1038,7 +992,7 @@ CoreUnloadAndCloseImage (
//
// Free the Image from memory
//
- if ((Image->ImageBasePage != 0) && FreePage) {
+ if (Image->ImageBasePage != 0) {
CoreFreePages (Image->ImageBasePage, Image->NumberOfPages);
}

@@ -1074,15 +1028,8 @@ CoreUnloadAndCloseImage (
@param SourceBuffer If not NULL, a pointer to the memory location
containing a copy of the image to be loaded.
@param SourceSize The size in bytes of SourceBuffer.
- @param DstBuffer The buffer to store the image
- @param NumberOfPages If not NULL, it inputs a pointer to the page
- number of DstBuffer and outputs a pointer to
- the page number of the image. If this number is
- not enough, return EFI_BUFFER_TOO_SMALL and
- this parameter contains the required number.
@param ImageHandle Pointer to the returned image handle that is
created when the image is successfully loaded.
- @param EntryPoint A pointer to the entry point
@param Attribute The bit mask of attributes to set for the load
PE image

@@ -1112,10 +1059,7 @@ CoreLoadImageCommon (
IN EFI_DEVICE_PATH_PROTOCOL *FilePath,
IN VOID *SourceBuffer OPTIONAL,
IN UINTN SourceSize,
- IN EFI_PHYSICAL_ADDRESS DstBuffer OPTIONAL,
- IN OUT UINTN *NumberOfPages OPTIONAL,
OUT EFI_HANDLE *ImageHandle,
- OUT EFI_PHYSICAL_ADDRESS *EntryPoint OPTIONAL,
IN UINT32 Attribute
)
{
@@ -1320,13 +1264,6 @@ CoreLoadImageCommon (
Image->Info.FilePath = DuplicateDevicePath (FilePath);
Image->Info.ParentHandle = ParentImageHandle;

-
- if (NumberOfPages != NULL) {
- Image->NumberOfPages = *NumberOfPages ;
- } else {
- Image->NumberOfPages = 0 ;
- }
-
//
// Install the protocol interfaces for this image
// don't fire notifications yet
@@ -1343,22 +1280,13 @@ CoreLoadImageCommon (
}

//
- // Load the image. If EntryPoint is Null, it will not be set.
+ // Load the image.
//
- Status = CoreLoadPeImage (BootPolicy, &FHand, Image, DstBuffer, EntryPoint, Attribute);
+ Status = CoreLoadPeImage (BootPolicy, &FHand, Image, Attribute);
if (EFI_ERROR (Status)) {
- if ((Status == EFI_BUFFER_TOO_SMALL) || (Status == EFI_OUT_OF_RESOURCES)) {
- if (NumberOfPages != NULL) {
- *NumberOfPages = Image->NumberOfPages;
- }
- }
goto Done;
}

- if (NumberOfPages != NULL) {
- *NumberOfPages = Image->NumberOfPages;
- }
-
//
// Register the image in the Debug Image Info Table if the attribute is set
//
@@ -1438,7 +1366,7 @@ Done:
//
if (EFI_ERROR (Status)) {
if (Image != NULL) {
- CoreUnloadAndCloseImage (Image, (BOOLEAN)(DstBuffer == 0));
+ CoreUnloadAndCloseImage (Image);
Image = NULL;
}
} else if (EFI_ERROR (SecurityStatus)) {
@@ -1514,10 +1442,7 @@ CoreLoadImage (
FilePath,
SourceBuffer,
SourceSize,
- (EFI_PHYSICAL_ADDRESS) (UINTN) NULL,
- NULL,
ImageHandle,
- NULL,
EFI_LOAD_PE_IMAGE_ATTRIBUTE_RUNTIME_REGISTRATION | EFI_LOAD_PE_IMAGE_ATTRIBUTE_DEBUG_IMAGE_INFO_TABLE_REGISTRATION
);

@@ -1734,7 +1659,7 @@ CoreStartImage (
// unload it
//
if (EFI_ERROR (Image->Status) || Image->Type == EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION) {
- CoreUnloadAndCloseImage (Image, TRUE);
+ CoreUnloadAndCloseImage (Image);
//
// ImageHandle may be invalid after the image is unloaded, so use NULL handle to record perf log.
//
@@ -1799,7 +1724,7 @@ CoreExit (
//
// The image has not been started so just free its resources
//
- CoreUnloadAndCloseImage (Image, TRUE);
+ CoreUnloadAndCloseImage (Image);
Status = EFI_SUCCESS;
goto Done;
}
@@ -1901,7 +1826,7 @@ CoreUnloadImage (
//
// if the Image was not started or Unloaded O.K. then clean up
//
- CoreUnloadAndCloseImage (Image, TRUE);
+ CoreUnloadAndCloseImage (Image);
}

Done:
--
2.31.1


[PATCH] BaseTools/tools_def: Fix CLANGPDB X64 RCPATH

Marvin Häuser
 

Use the correct X64 path for CLANGPDB RCPATH.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>
Cc: Vitaly Cheptsov <vit9696@protonmail.com>
Signed-off-by: Marvin Häuser <mhaeuser@posteo.de>
---
BaseTools/Conf/tools_def.template | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template
index 2e6b382ab623..de13fb0732db 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -2806,7 +2806,7 @@ NOOPT_CLANGPDB_IA32_DLINK2_FLAGS =
*_CLANGPDB_X64_VFRPP_PATH = DEF(CLANGPDB_X64_PREFIX)clang
*_CLANGPDB_X64_ASLCC_PATH = DEF(CLANGPDB_X64_PREFIX)clang
*_CLANGPDB_X64_ASLPP_PATH = DEF(CLANGPDB_X64_PREFIX)clang
-*_CLANGPDB_X64_RC_PATH = DEF(CLANGPDB_IA32_PREFIX)llvm-rc
+*_CLANGPDB_X64_RC_PATH = DEF(CLANGPDB_X64_PREFIX)llvm-rc

*_CLANGPDB_X64_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m64 -fno-lto DEF(CLANGPDB_X64_TARGET)
*_CLANGPDB_X64_ASM_FLAGS = DEF(GCC_ASM_FLAGS) -m64 DEF(CLANGPDB_X64_TARGET)
--
2.31.1


[PATCH] BaseTools: Define the read-only data section name per toolchain

Marvin Häuser
 

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3318

Different toolchains of the EDK II build system may generate ELF or
Mach-O files, which use the ".rodata" naming convention, or PE/COFF
files, which use the ".rdata" naming convention. Section permissions
are chosen based on this name per file format by NASM. To harden
image permission security, and to save space by avoiding both
".rdata" and ".rodata" sections being emitted, expose the appropriate
name as a preprocessor constant.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>
Cc: Vitaly Cheptsov <vit9696@protonmail.com>
Signed-off-by: Marvin Häuser <mhaeuser@posteo.de>
---
BaseTools/Conf/tools_def.template | 172 ++++++++++----------
1 file changed, 86 insertions(+), 86 deletions(-)

diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template
index 2e6b382ab623..84d464916c4d 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -463,9 +463,9 @@ NOOPT_VS2008_IA32_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE
RELEASE_VS2008_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd
NOOPT_VS2008_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd /Zi

- DEBUG_VS2008_IA32_NASM_FLAGS = -Ox -f win32 -g
-RELEASE_VS2008_IA32_NASM_FLAGS = -Ox -f win32
-NOOPT_VS2008_IA32_NASM_FLAGS = -O0 -f win32 -g
+ DEBUG_VS2008_IA32_NASM_FLAGS = -Ox -f win32 -g -DRODATA_SECTION_NAME=.rdata
+RELEASE_VS2008_IA32_NASM_FLAGS = -Ox -f win32 -DRODATA_SECTION_NAME=.rdata
+NOOPT_VS2008_IA32_NASM_FLAGS = -O0 -f win32 -g -DRODATA_SECTION_NAME=.rdata

DEBUG_VS2008_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
RELEASE_VS2008_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data
@@ -495,9 +495,9 @@ NOOPT_VS2008_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /G
RELEASE_VS2008_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd
NOOPT_VS2008_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd /Zi

- DEBUG_VS2008_X64_NASM_FLAGS = -Ox -f win64 -g
-RELEASE_VS2008_X64_NASM_FLAGS = -Ox -f win64
-NOOPT_VS2008_X64_NASM_FLAGS = -O0 -f win64 -g
+ DEBUG_VS2008_X64_NASM_FLAGS = -Ox -f win64 -g -DRODATA_SECTION_NAME=.rdata
+RELEASE_VS2008_X64_NASM_FLAGS = -Ox -f win64 -DRODATA_SECTION_NAME=.rdata
+NOOPT_VS2008_X64_NASM_FLAGS = -O0 -f win64 -g -DRODATA_SECTION_NAME=.rdata

DEBUG_VS2008_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
RELEASE_VS2008_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data
@@ -574,9 +574,9 @@ NOOPT_VS2008x86_IA32_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE
RELEASE_VS2008x86_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd
NOOPT_VS2008x86_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd /Zi

- DEBUG_VS2008x86_IA32_NASM_FLAGS = -Ox -f win32 -g
-RELEASE_VS2008x86_IA32_NASM_FLAGS = -Ox -f win32
-NOOPT_VS2008x86_IA32_NASM_FLAGS = -O0 -f win32 -g
+ DEBUG_VS2008x86_IA32_NASM_FLAGS = -Ox -f win32 -g -DRODATA_SECTION_NAME=.rdata
+RELEASE_VS2008x86_IA32_NASM_FLAGS = -Ox -f win32 -DRODATA_SECTION_NAME=.rdata
+NOOPT_VS2008x86_IA32_NASM_FLAGS = -O0 -f win32 -g -DRODATA_SECTION_NAME=.rdata

DEBUG_VS2008x86_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
RELEASE_VS2008x86_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data
@@ -605,9 +605,9 @@ NOOPT_VS2008x86_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE
RELEASE_VS2008x86_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd
NOOPT_VS2008x86_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd /Zi

- DEBUG_VS2008x86_X64_NASM_FLAGS = -Ox -f win64 -g
-RELEASE_VS2008x86_X64_NASM_FLAGS = -Ox -f win64
-NOOPT_VS2008x86_X64_NASM_FLAGS = -O0 -f win64 -g
+ DEBUG_VS2008x86_X64_NASM_FLAGS = -Ox -f win64 -g -DRODATA_SECTION_NAME=.rdata
+RELEASE_VS2008x86_X64_NASM_FLAGS = -Ox -f win64 -DRODATA_SECTION_NAME=.rdata
+NOOPT_VS2008x86_X64_NASM_FLAGS = -O0 -f win64 -g -DRODATA_SECTION_NAME=.rdata

DEBUG_VS2008x86_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
RELEASE_VS2008x86_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data
@@ -688,9 +688,9 @@ NOOPT_VS2010_IA32_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE
RELEASE_VS2010_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd
NOOPT_VS2010_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd /Zi

- DEBUG_VS2010_IA32_NASM_FLAGS = -Ox -f win32 -g
-RELEASE_VS2010_IA32_NASM_FLAGS = -Ox -f win32
-NOOPT_VS2010_IA32_NASM_FLAGS = -O0 -f win32 -g
+ DEBUG_VS2010_IA32_NASM_FLAGS = -Ox -f win32 -g -DRODATA_SECTION_NAME=.rdata
+RELEASE_VS2010_IA32_NASM_FLAGS = -Ox -f win32 -DRODATA_SECTION_NAME=.rdata
+NOOPT_VS2010_IA32_NASM_FLAGS = -O0 -f win32 -g -DRODATA_SECTION_NAME=.rdata

DEBUG_VS2010_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
RELEASE_VS2010_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data
@@ -720,9 +720,9 @@ NOOPT_VS2010_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /G
RELEASE_VS2010_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd
NOOPT_VS2010_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd /Zi

- DEBUG_VS2010_X64_NASM_FLAGS = -Ox -f win64 -g
-RELEASE_VS2010_X64_NASM_FLAGS = -Ox -f win64
-NOOPT_VS2010_X64_NASM_FLAGS = -O0 -f win64 -g
+ DEBUG_VS2010_X64_NASM_FLAGS = -Ox -f win64 -g -DRODATA_SECTION_NAME=.rdata
+RELEASE_VS2010_X64_NASM_FLAGS = -Ox -f win64 -DRODATA_SECTION_NAME=.rdata
+NOOPT_VS2010_X64_NASM_FLAGS = -O0 -f win64 -g -DRODATA_SECTION_NAME=.rdata

DEBUG_VS2010_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
RELEASE_VS2010_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data
@@ -799,9 +799,9 @@ NOOPT_VS2010x86_IA32_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE
RELEASE_VS2010x86_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd
NOOPT_VS2010x86_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd /Zi

- DEBUG_VS2010x86_IA32_NASM_FLAGS = -Ox -f win32 -g
-RELEASE_VS2010x86_IA32_NASM_FLAGS = -Ox -f win32
-NOOPT_VS2010x86_IA32_NASM_FLAGS = -O0 -f win32 -g
+ DEBUG_VS2010x86_IA32_NASM_FLAGS = -Ox -f win32 -g -DRODATA_SECTION_NAME=.rdata
+RELEASE_VS2010x86_IA32_NASM_FLAGS = -Ox -f win32 -DRODATA_SECTION_NAME=.rdata
+NOOPT_VS2010x86_IA32_NASM_FLAGS = -O0 -f win32 -g -DRODATA_SECTION_NAME=.rdata

DEBUG_VS2010x86_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
RELEASE_VS2010x86_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data
@@ -831,9 +831,9 @@ NOOPT_VS2010x86_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE
RELEASE_VS2010x86_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd
NOOPT_VS2010x86_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd /Zi

- DEBUG_VS2010x86_X64_NASM_FLAGS = -Ox -f win64 -g
-RELEASE_VS2010x86_X64_NASM_FLAGS = -Ox -f win64
-NOOPT_VS2010x86_X64_NASM_FLAGS = -O0 -f win64 -g
+ DEBUG_VS2010x86_X64_NASM_FLAGS = -Ox -f win64 -g -DRODATA_SECTION_NAME=.rdata
+RELEASE_VS2010x86_X64_NASM_FLAGS = -Ox -f win64 -DRODATA_SECTION_NAME=.rdata
+NOOPT_VS2010x86_X64_NASM_FLAGS = -O0 -f win64 -g -DRODATA_SECTION_NAME=.rdata

DEBUG_VS2010x86_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
RELEASE_VS2010x86_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data
@@ -913,9 +913,9 @@ NOOPT_VS2012_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS- /W4 /Gs32768
RELEASE_VS2012_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd
NOOPT_VS2012_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd /Zi

- DEBUG_VS2012_IA32_NASM_FLAGS = -Ox -f win32 -g
-RELEASE_VS2012_IA32_NASM_FLAGS = -Ox -f win32
-NOOPT_VS2012_IA32_NASM_FLAGS = -O0 -f win32 -g
+ DEBUG_VS2012_IA32_NASM_FLAGS = -Ox -f win32 -g -DRODATA_SECTION_NAME=.rdata
+RELEASE_VS2012_IA32_NASM_FLAGS = -Ox -f win32 -DRODATA_SECTION_NAME=.rdata
+NOOPT_VS2012_IA32_NASM_FLAGS = -O0 -f win32 -g -DRODATA_SECTION_NAME=.rdata

DEBUG_VS2012_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
RELEASE_VS2012_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data
@@ -945,9 +945,9 @@ NOOPT_VS2012_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /G
RELEASE_VS2012_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd
NOOPT_VS2012_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd /Zi

- DEBUG_VS2012_X64_NASM_FLAGS = -Ox -f win64 -g
-RELEASE_VS2012_X64_NASM_FLAGS = -Ox -f win64
-NOOPT_VS2012_X64_NASM_FLAGS = -O0 -f win64 -g
+ DEBUG_VS2012_X64_NASM_FLAGS = -Ox -f win64 -g -DRODATA_SECTION_NAME=.rdata
+RELEASE_VS2012_X64_NASM_FLAGS = -Ox -f win64 -DRODATA_SECTION_NAME=.rdata
+NOOPT_VS2012_X64_NASM_FLAGS = -O0 -f win64 -g -DRODATA_SECTION_NAME=.rdata

DEBUG_VS2012_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
RELEASE_VS2012_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data
@@ -1024,9 +1024,9 @@ NOOPT_VS2012x86_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS- /W4 /Gs32768
RELEASE_VS2012x86_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd
NOOPT_VS2012x86_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd /Zi

- DEBUG_VS2012x86_IA32_NASM_FLAGS = -Ox -f win32 -g
-RELEASE_VS2012x86_IA32_NASM_FLAGS = -Ox -f win32
-NOOPT_VS2012x86_IA32_NASM_FLAGS = -O0 -f win32 -g
+ DEBUG_VS2012x86_IA32_NASM_FLAGS = -Ox -f win32 -g -DRODATA_SECTION_NAME=.rdata
+RELEASE_VS2012x86_IA32_NASM_FLAGS = -Ox -f win32 -DRODATA_SECTION_NAME=.rdata
+NOOPT_VS2012x86_IA32_NASM_FLAGS = -O0 -f win32 -g -DRODATA_SECTION_NAME=.rdata

DEBUG_VS2012x86_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
RELEASE_VS2012x86_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data
@@ -1056,9 +1056,9 @@ NOOPT_VS2012x86_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE
RELEASE_VS2012x86_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd
NOOPT_VS2012x86_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd /Zi

- DEBUG_VS2012x86_X64_NASM_FLAGS = -Ox -f win64 -g
-RELEASE_VS2012x86_X64_NASM_FLAGS = -Ox -f win64
-NOOPT_VS2012x86_X64_NASM_FLAGS = -O0 -f win64 -g
+ DEBUG_VS2012x86_X64_NASM_FLAGS = -Ox -f win64 -g -DRODATA_SECTION_NAME=.rdata
+RELEASE_VS2012x86_X64_NASM_FLAGS = -Ox -f win64 -DRODATA_SECTION_NAME=.rdata
+NOOPT_VS2012x86_X64_NASM_FLAGS = -O0 -f win64 -g -DRODATA_SECTION_NAME=.rdata

DEBUG_VS2012x86_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
RELEASE_VS2012x86_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data
@@ -1138,9 +1138,9 @@ NOOPT_VS2013_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS- /W4 /Gs32768
RELEASE_VS2013_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd
NOOPT_VS2013_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd /Zi

- DEBUG_VS2013_IA32_NASM_FLAGS = -Ox -f win32 -g
-RELEASE_VS2013_IA32_NASM_FLAGS = -Ox -f win32
-NOOPT_VS2013_IA32_NASM_FLAGS = -O0 -f win32 -g
+ DEBUG_VS2013_IA32_NASM_FLAGS = -Ox -f win32 -g -DRODATA_SECTION_NAME=.rdata
+RELEASE_VS2013_IA32_NASM_FLAGS = -Ox -f win32 -DRODATA_SECTION_NAME=.rdata
+NOOPT_VS2013_IA32_NASM_FLAGS = -O0 -f win32 -g -DRODATA_SECTION_NAME=.rdata

DEBUG_VS2013_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
RELEASE_VS2013_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data
@@ -1170,9 +1170,9 @@ NOOPT_VS2013_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /G
RELEASE_VS2013_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd
NOOPT_VS2013_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd /Zi

- DEBUG_VS2013_X64_NASM_FLAGS = -Ox -f win64 -g
-RELEASE_VS2013_X64_NASM_FLAGS = -Ox -f win64
-NOOPT_VS2013_X64_NASM_FLAGS = -O0 -f win64 -g
+ DEBUG_VS2013_X64_NASM_FLAGS = -Ox -f win64 -g -DRODATA_SECTION_NAME=.rdata
+RELEASE_VS2013_X64_NASM_FLAGS = -Ox -f win64 -DRODATA_SECTION_NAME=.rdata
+NOOPT_VS2013_X64_NASM_FLAGS = -O0 -f win64 -g -DRODATA_SECTION_NAME=.rdata

DEBUG_VS2013_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
RELEASE_VS2013_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data
@@ -1249,9 +1249,9 @@ NOOPT_VS2013x86_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS- /W4 /Gs32768
RELEASE_VS2013x86_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd
NOOPT_VS2013x86_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd /Zi

- DEBUG_VS2013x86_IA32_NASM_FLAGS = -Ox -f win32 -g
-RELEASE_VS2013x86_IA32_NASM_FLAGS = -Ox -f win32
-NOOPT_VS2013x86_IA32_NASM_FLAGS = -O0 -f win32 -g
+ DEBUG_VS2013x86_IA32_NASM_FLAGS = -Ox -f win32 -g -DRODATA_SECTION_NAME=.rdata
+RELEASE_VS2013x86_IA32_NASM_FLAGS = -Ox -f win32 -DRODATA_SECTION_NAME=.rdata
+NOOPT_VS2013x86_IA32_NASM_FLAGS = -O0 -f win32 -g -DRODATA_SECTION_NAME=.rdata

DEBUG_VS2013x86_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
RELEASE_VS2013x86_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data
@@ -1281,9 +1281,9 @@ NOOPT_VS2013x86_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE
RELEASE_VS2013x86_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd
NOOPT_VS2013x86_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd /Zi

- DEBUG_VS2013x86_X64_NASM_FLAGS = -Ox -f win64 -g
-RELEASE_VS2013x86_X64_NASM_FLAGS = -Ox -f win64
-NOOPT_VS2013x86_X64_NASM_FLAGS = -O0 -f win64 -g
+ DEBUG_VS2013x86_X64_NASM_FLAGS = -Ox -f win64 -g -DRODATA_SECTION_NAME=.rdata
+RELEASE_VS2013x86_X64_NASM_FLAGS = -Ox -f win64 -DRODATA_SECTION_NAME=.rdata
+NOOPT_VS2013x86_X64_NASM_FLAGS = -O0 -f win64 -g -DRODATA_SECTION_NAME=.rdata

DEBUG_VS2013x86_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
RELEASE_VS2013x86_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data
@@ -1364,9 +1364,9 @@ NOOPT_VS2015_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS- /W4 /Gs32768
RELEASE_VS2015_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd
NOOPT_VS2015_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd /Zi

- DEBUG_VS2015_IA32_NASM_FLAGS = -Ox -f win32 -g
-RELEASE_VS2015_IA32_NASM_FLAGS = -Ox -f win32
-NOOPT_VS2015_IA32_NASM_FLAGS = -O0 -f win32 -g
+ DEBUG_VS2015_IA32_NASM_FLAGS = -Ox -f win32 -g -DRODATA_SECTION_NAME=.rdata
+RELEASE_VS2015_IA32_NASM_FLAGS = -Ox -f win32 -DRODATA_SECTION_NAME=.rdata
+NOOPT_VS2015_IA32_NASM_FLAGS = -O0 -f win32 -g -DRODATA_SECTION_NAME=.rdata

DEBUG_VS2015_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
RELEASE_VS2015_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data
@@ -1396,9 +1396,9 @@ NOOPT_VS2015_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /G
RELEASE_VS2015_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd
NOOPT_VS2015_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd /Zi

- DEBUG_VS2015_X64_NASM_FLAGS = -Ox -f win64 -g
-RELEASE_VS2015_X64_NASM_FLAGS = -Ox -f win64
-NOOPT_VS2015_X64_NASM_FLAGS = -O0 -f win64 -g
+ DEBUG_VS2015_X64_NASM_FLAGS = -Ox -f win64 -g -DRODATA_SECTION_NAME=.rdata
+RELEASE_VS2015_X64_NASM_FLAGS = -Ox -f win64 -DRODATA_SECTION_NAME=.rdata
+NOOPT_VS2015_X64_NASM_FLAGS = -O0 -f win64 -g -DRODATA_SECTION_NAME=.rdata

DEBUG_VS2015_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
RELEASE_VS2015_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data
@@ -1476,9 +1476,9 @@ NOOPT_VS2015x86_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS- /W4 /Gs32768
RELEASE_VS2015x86_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd
NOOPT_VS2015x86_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd /Zi

- DEBUG_VS2015x86_IA32_NASM_FLAGS = -Ox -f win32 -g
-RELEASE_VS2015x86_IA32_NASM_FLAGS = -Ox -f win32
-NOOPT_VS2015x86_IA32_NASM_FLAGS = -O0 -f win32 -g
+ DEBUG_VS2015x86_IA32_NASM_FLAGS = -Ox -f win32 -g -DRODATA_SECTION_NAME=.rdata
+RELEASE_VS2015x86_IA32_NASM_FLAGS = -Ox -f win32 -DRODATA_SECTION_NAME=.rdata
+NOOPT_VS2015x86_IA32_NASM_FLAGS = -O0 -f win32 -g -DRODATA_SECTION_NAME=.rdata

DEBUG_VS2015x86_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
RELEASE_VS2015x86_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data
@@ -1508,9 +1508,9 @@ NOOPT_VS2015x86_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE
RELEASE_VS2015x86_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd
NOOPT_VS2015x86_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd /Zi

- DEBUG_VS2015x86_X64_NASM_FLAGS = -Ox -f win64 -g
-RELEASE_VS2015x86_X64_NASM_FLAGS = -Ox -f win64
-NOOPT_VS2015x86_X64_NASM_FLAGS = -O0 -f win64 -g
+ DEBUG_VS2015x86_X64_NASM_FLAGS = -Ox -f win64 -g -DRODATA_SECTION_NAME=.rdata
+RELEASE_VS2015x86_X64_NASM_FLAGS = -Ox -f win64 -DRODATA_SECTION_NAME=.rdata
+NOOPT_VS2015x86_X64_NASM_FLAGS = -O0 -f win64 -g -DRODATA_SECTION_NAME=.rdata

DEBUG_VS2015x86_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
RELEASE_VS2015x86_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data
@@ -1586,9 +1586,9 @@ NOOPT_VS2017_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS- /W4 /Gs32768 /D
RELEASE_VS2017_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd
NOOPT_VS2017_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd /Zi

- DEBUG_VS2017_IA32_NASM_FLAGS = -Ox -f win32 -g
-RELEASE_VS2017_IA32_NASM_FLAGS = -Ox -f win32
-NOOPT_VS2017_IA32_NASM_FLAGS = -O0 -f win32 -g
+ DEBUG_VS2017_IA32_NASM_FLAGS = -Ox -f win32 -g -DRODATA_SECTION_NAME=.rdata
+RELEASE_VS2017_IA32_NASM_FLAGS = -Ox -f win32 -DRODATA_SECTION_NAME=.rdata
+NOOPT_VS2017_IA32_NASM_FLAGS = -O0 -f win32 -g -DRODATA_SECTION_NAME=.rdata

DEBUG_VS2017_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
RELEASE_VS2017_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data
@@ -1616,9 +1616,9 @@ NOOPT_VS2017_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /G
RELEASE_VS2017_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd
NOOPT_VS2017_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd /Zi

- DEBUG_VS2017_X64_NASM_FLAGS = -Ox -f win64 -g
-RELEASE_VS2017_X64_NASM_FLAGS = -Ox -f win64
-NOOPT_VS2017_X64_NASM_FLAGS = -O0 -f win64 -g
+ DEBUG_VS2017_X64_NASM_FLAGS = -Ox -f win64 -g -DRODATA_SECTION_NAME=.rdata
+RELEASE_VS2017_X64_NASM_FLAGS = -Ox -f win64 -DRODATA_SECTION_NAME=.rdata
+NOOPT_VS2017_X64_NASM_FLAGS = -O0 -f win64 -g -DRODATA_SECTION_NAME=.rdata

DEBUG_VS2017_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4281 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
RELEASE_VS2017_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4281 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data
@@ -1744,9 +1744,9 @@ NOOPT_VS2019_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS- /W4 /Gs32768 /D
RELEASE_VS2019_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd
NOOPT_VS2019_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd /Zi

- DEBUG_VS2019_IA32_NASM_FLAGS = -Ox -f win32 -g
-RELEASE_VS2019_IA32_NASM_FLAGS = -Ox -f win32
-NOOPT_VS2019_IA32_NASM_FLAGS = -O0 -f win32 -g
+ DEBUG_VS2019_IA32_NASM_FLAGS = -Ox -f win32 -g -DRODATA_SECTION_NAME=.rdata
+RELEASE_VS2019_IA32_NASM_FLAGS = -Ox -f win32 -DRODATA_SECTION_NAME=.rdata
+NOOPT_VS2019_IA32_NASM_FLAGS = -O0 -f win32 -g -DRODATA_SECTION_NAME=.rdata

DEBUG_VS2019_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
RELEASE_VS2019_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data
@@ -1774,9 +1774,9 @@ NOOPT_VS2019_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D UNICODE /G
RELEASE_VS2019_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd
NOOPT_VS2019_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd /Zi

- DEBUG_VS2019_X64_NASM_FLAGS = -Ox -f win64 -g
-RELEASE_VS2019_X64_NASM_FLAGS = -Ox -f win64
-NOOPT_VS2019_X64_NASM_FLAGS = -O0 -f win64 -g
+ DEBUG_VS2019_X64_NASM_FLAGS = -Ox -f win64 -g -DRODATA_SECTION_NAME=.rdata
+RELEASE_VS2019_X64_NASM_FLAGS = -Ox -f win64 -DRODATA_SECTION_NAME=.rdata
+NOOPT_VS2019_X64_NASM_FLAGS = -O0 -f win64 -g -DRODATA_SECTION_NAME=.rdata

DEBUG_VS2019_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4281 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
RELEASE_VS2019_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4281 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data
@@ -2030,7 +2030,7 @@ DEFINE GCC_PP_FLAGS = -E -x assembler-with-cpp -include A
*_GCC48_IA32_DLINK2_FLAGS = DEF(GCC48_IA32_DLINK2_FLAGS)
*_GCC48_IA32_RC_FLAGS = DEF(GCC_IA32_RC_FLAGS)
*_GCC48_IA32_OBJCOPY_FLAGS =
-*_GCC48_IA32_NASM_FLAGS = -f elf32
+*_GCC48_IA32_NASM_FLAGS = -f elf32 -DRODATA_SECTION_NAME=.rodata

DEBUG_GCC48_IA32_CC_FLAGS = DEF(GCC48_IA32_CC_FLAGS) -Os
RELEASE_GCC48_IA32_CC_FLAGS = DEF(GCC48_IA32_CC_FLAGS) -Os -Wno-unused-but-set-variable
@@ -2058,7 +2058,7 @@ RELEASE_GCC48_IA32_CC_FLAGS = DEF(GCC48_IA32_CC_FLAGS) -Os -Wno-unused-but
*_GCC48_X64_DLINK2_FLAGS = DEF(GCC48_X64_DLINK2_FLAGS)
*_GCC48_X64_RC_FLAGS = DEF(GCC_X64_RC_FLAGS)
*_GCC48_X64_OBJCOPY_FLAGS =
-*_GCC48_X64_NASM_FLAGS = -f elf64
+*_GCC48_X64_NASM_FLAGS = -f elf64 -DRODATA_SECTION_NAME=.rodata

DEBUG_GCC48_X64_CC_FLAGS = DEF(GCC48_X64_CC_FLAGS) -Os
RELEASE_GCC48_X64_CC_FLAGS = DEF(GCC48_X64_CC_FLAGS) -Os -Wno-unused-but-set-variable
@@ -2170,7 +2170,7 @@ RELEASE_GCC48_AARCH64_CC_FLAGS = DEF(GCC48_AARCH64_CC_FLAGS) -Wno-unused-but-s
*_GCC49_IA32_DLINK2_FLAGS = DEF(GCC49_IA32_DLINK2_FLAGS)
*_GCC49_IA32_RC_FLAGS = DEF(GCC_IA32_RC_FLAGS)
*_GCC49_IA32_OBJCOPY_FLAGS =
-*_GCC49_IA32_NASM_FLAGS = -f elf32
+*_GCC49_IA32_NASM_FLAGS = -f elf32 -DRODATA_SECTION_NAME=.rodata

DEBUG_GCC49_IA32_CC_FLAGS = DEF(GCC49_IA32_CC_FLAGS) -Os
RELEASE_GCC49_IA32_CC_FLAGS = DEF(GCC49_IA32_CC_FLAGS) -Os -Wno-unused-but-set-variable -Wno-unused-const-variable
@@ -2198,7 +2198,7 @@ RELEASE_GCC49_IA32_CC_FLAGS = DEF(GCC49_IA32_CC_FLAGS) -Os -Wno-unused-but
*_GCC49_X64_DLINK2_FLAGS = DEF(GCC49_X64_DLINK2_FLAGS)
*_GCC49_X64_RC_FLAGS = DEF(GCC_X64_RC_FLAGS)
*_GCC49_X64_OBJCOPY_FLAGS =
-*_GCC49_X64_NASM_FLAGS = -f elf64
+*_GCC49_X64_NASM_FLAGS = -f elf64 -DRODATA_SECTION_NAME=.rodata

DEBUG_GCC49_X64_CC_FLAGS = DEF(GCC49_X64_CC_FLAGS) -Os
RELEASE_GCC49_X64_CC_FLAGS = DEF(GCC49_X64_CC_FLAGS) -Os -Wno-unused-but-set-variable -Wno-unused-const-variable
@@ -2316,7 +2316,7 @@ RELEASE_GCC49_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20
*_GCC5_IA32_DLINK2_FLAGS = DEF(GCC5_IA32_DLINK2_FLAGS) -no-pie
*_GCC5_IA32_RC_FLAGS = DEF(GCC_IA32_RC_FLAGS)
*_GCC5_IA32_OBJCOPY_FLAGS =
-*_GCC5_IA32_NASM_FLAGS = -f elf32
+*_GCC5_IA32_NASM_FLAGS = -f elf32 -DRODATA_SECTION_NAME=.rodata

DEBUG_GCC5_IA32_CC_FLAGS = DEF(GCC5_IA32_CC_FLAGS) -flto -Os
DEBUG_GCC5_IA32_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -flto -Os -Wl,-m,elf_i386,--oformat=elf32-i386
@@ -2348,7 +2348,7 @@ RELEASE_GCC5_IA32_DLINK_FLAGS = DEF(GCC5_IA32_X64_DLINK_FLAGS) -flto -Os -Wl,
*_GCC5_X64_DLINK2_FLAGS = DEF(GCC5_X64_DLINK2_FLAGS)
*_GCC5_X64_RC_FLAGS = DEF(GCC_X64_RC_FLAGS)
*_GCC5_X64_OBJCOPY_FLAGS =
-*_GCC5_X64_NASM_FLAGS = -f elf64
+*_GCC5_X64_NASM_FLAGS = -f elf64 -DRODATA_SECTION_NAME=.rodata

DEBUG_GCC5_X64_CC_FLAGS = DEF(GCC5_X64_CC_FLAGS) -flto -DUSING_LTO -Os
DEBUG_GCC5_X64_DLINK_FLAGS = DEF(GCC5_X64_DLINK_FLAGS) -flto -Os
@@ -2589,7 +2589,7 @@ DEFINE CLANG38_ALL_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS) DEF(CLANG38_WARNIN
*_CLANG38_IA32_ASM_FLAGS = DEF(GCC5_ASM_FLAGS) -m32 -march=i386 DEF(CLANG38_IA32_TARGET)
*_CLANG38_IA32_RC_FLAGS = DEF(GCC_IA32_RC_FLAGS)
*_CLANG38_IA32_OBJCOPY_FLAGS =
-*_CLANG38_IA32_NASM_FLAGS = -f elf32
+*_CLANG38_IA32_NASM_FLAGS = -f elf32 -DRODATA_SECTION_NAME=.rodata
*_CLANG38_IA32_PP_FLAGS = DEF(GCC_PP_FLAGS) DEF(CLANG38_IA32_TARGET)
*_CLANG38_IA32_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS) DEF(CLANG38_IA32_TARGET)
*_CLANG38_IA32_VFRPP_FLAGS = DEF(GCC_VFRPP_FLAGS) DEF(CLANG38_IA32_TARGET)
@@ -2626,7 +2626,7 @@ NOOPT_CLANG38_IA32_DLINK2_FLAGS = DEF(GCC5_IA32_DLINK2_FLAGS) -O0
*_CLANG38_X64_ASM_FLAGS = DEF(GCC5_ASM_FLAGS) -m64 DEF(CLANG38_X64_TARGET)
*_CLANG38_X64_RC_FLAGS = DEF(GCC_X64_RC_FLAGS)
*_CLANG38_X64_OBJCOPY_FLAGS =
-*_CLANG38_X64_NASM_FLAGS = -f elf64
+*_CLANG38_X64_NASM_FLAGS = -f elf64 -DRODATA_SECTION_NAME=.rodata
*_CLANG38_X64_PP_FLAGS = DEF(GCC_PP_FLAGS) DEF(CLANG38_X64_TARGET)
*_CLANG38_X64_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS) DEF(CLANG38_X64_TARGET)
*_CLANG38_X64_VFRPP_FLAGS = DEF(GCC_VFRPP_FLAGS) DEF(CLANG38_X64_TARGET)
@@ -2777,7 +2777,7 @@ DEFINE CLANGPDB_ALL_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS) DEF(CLANGPDB_WARN
*_CLANGPDB_IA32_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m32 -fno-lto DEF(CLANGPDB_IA32_TARGET)
*_CLANGPDB_IA32_ASM_FLAGS = DEF(GCC_ASM_FLAGS) -m32 -march=i386 DEF(CLANGPDB_IA32_TARGET)
*_CLANGPDB_IA32_OBJCOPY_FLAGS =
-*_CLANGPDB_IA32_NASM_FLAGS = -f win32
+*_CLANGPDB_IA32_NASM_FLAGS = -f win32 -DRODATA_SECTION_NAME=.rdata
*_CLANGPDB_IA32_PP_FLAGS = DEF(GCC_PP_FLAGS) DEF(CLANGPDB_IA32_TARGET)
*_CLANGPDB_IA32_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS) DEF(CLANGPDB_IA32_TARGET)
*_CLANGPDB_IA32_VFRPP_FLAGS = DEF(GCC_VFRPP_FLAGS) DEF(CLANGPDB_IA32_TARGET)
@@ -2811,7 +2811,7 @@ NOOPT_CLANGPDB_IA32_DLINK2_FLAGS =
*_CLANGPDB_X64_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m64 -fno-lto DEF(CLANGPDB_X64_TARGET)
*_CLANGPDB_X64_ASM_FLAGS = DEF(GCC_ASM_FLAGS) -m64 DEF(CLANGPDB_X64_TARGET)
*_CLANGPDB_X64_OBJCOPY_FLAGS =
-*_CLANGPDB_X64_NASM_FLAGS = -f win64
+*_CLANGPDB_X64_NASM_FLAGS = -f win64 -DRODATA_SECTION_NAME=.rdata
*_CLANGPDB_X64_PP_FLAGS = DEF(GCC_PP_FLAGS) DEF(CLANGPDB_X64_TARGET)
*_CLANGPDB_X64_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS) DEF(CLANGPDB_X64_TARGET)
*_CLANGPDB_X64_VFRPP_FLAGS = DEF(GCC_VFRPP_FLAGS) DEF(CLANGPDB_X64_TARGET)
@@ -2878,7 +2878,7 @@ DEFINE CLANGDWARF_X64_DLINK2_FLAGS = -Wl,--defsym=PECOFF_HEADER_SIZE=0x22
*_CLANGDWARF_IA32_ASM_FLAGS = DEF(GCC5_ASM_FLAGS) -m32 -march=i386 DEF(CLANG38_IA32_TARGET)
*_CLANGDWARF_IA32_RC_FLAGS = DEF(GCC_IA32_RC_FLAGS)
*_CLANGDWARF_IA32_OBJCOPY_FLAGS =
-*_CLANGDWARF_IA32_NASM_FLAGS = -f elf32
+*_CLANGDWARF_IA32_NASM_FLAGS = -f elf32 -DRODATA_SECTION_NAME=.rodata
*_CLANGDWARF_IA32_PP_FLAGS = DEF(GCC_PP_FLAGS) DEF(CLANG38_IA32_TARGET)
*_CLANGDWARF_IA32_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS) DEF(CLANG38_IA32_TARGET)
*_CLANGDWARF_IA32_VFRPP_FLAGS = DEF(GCC_VFRPP_FLAGS) DEF(CLANG38_IA32_TARGET)
@@ -2914,7 +2914,7 @@ NOOPT_CLANGDWARF_IA32_DLINK2_FLAGS = DEF(CLANGDWARF_IA32_DLINK2_FLAGS) -O0 -
*_CLANGDWARF_X64_ASM_FLAGS = DEF(GCC5_ASM_FLAGS) -m64 DEF(CLANG38_X64_TARGET)
*_CLANGDWARF_X64_RC_FLAGS = DEF(GCC_X64_RC_FLAGS)
*_CLANGDWARF_X64_OBJCOPY_FLAGS =
-*_CLANGDWARF_X64_NASM_FLAGS = -f elf64
+*_CLANGDWARF_X64_NASM_FLAGS = -f elf64 -DRODATA_SECTION_NAME=.rodata
*_CLANGDWARF_X64_PP_FLAGS = DEF(GCC_PP_FLAGS) DEF(CLANG38_X64_TARGET)
*_CLANGDWARF_X64_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS) DEF(CLANG38_X64_TARGET)
*_CLANGDWARF_X64_VFRPP_FLAGS = DEF(GCC_VFRPP_FLAGS) DEF(CLANG38_X64_TARGET)
@@ -2985,7 +2985,7 @@ RELEASE_XCODE5_IA32_DLINK_FLAGS = -arch i386 -u _$(IMAGE_ENTRY_POINT) -e _$
DEBUG_XCODE5_IA32_ASM_FLAGS = -arch i386 -g
NOOPT_XCODE5_IA32_ASM_FLAGS = -arch i386 -g
RELEASE_XCODE5_IA32_ASM_FLAGS = -arch i386
- *_XCODE5_IA32_NASM_FLAGS = -f macho32
+ *_XCODE5_IA32_NASM_FLAGS = -f macho32 -DRODATA_SECTION_NAME=.rodata


DEBUG_XCODE5_IA32_CC_FLAGS = -arch i386 -c -g -Os -Wall -Werror -include AutoGen.h -funsigned-char -fno-stack-protector -fno-builtin -fshort-wchar -fasm-blocks -mdynamic-no-pic -mno-implicit-float -mms-bitfields -msoft-float -Wno-unused-parameter -Wno-missing-braces -Wno-missing-field-initializers -Wno-tautological-compare -Wno-sign-compare -Wno-varargs -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang $(PLATFORM_FLAGS)
@@ -3003,7 +3003,7 @@ RELEASE_XCODE5_X64_DLINK_FLAGS = -arch x86_64 -u _$(IMAGE_ENTRY_POINT) -e _
DEBUG_XCODE5_X64_ASM_FLAGS = -arch x86_64 -g
NOOPT_XCODE5_X64_ASM_FLAGS = -arch x86_64 -g
RELEASE_XCODE5_X64_ASM_FLAGS = -arch x86_64
- *_XCODE5_X64_NASM_FLAGS = -f macho64
+ *_XCODE5_X64_NASM_FLAGS = -f macho64 -DRODATA_SECTION_NAME=.rodata
*_XCODE5_*_PP_FLAGS = -E -x assembler-with-cpp -include AutoGen.h
*_XCODE5_*_VFRPP_FLAGS = -x c -E -P -DVFRCOMPILE -include $(MODULE_NAME)StrDefs.h

--
2.31.1


[PATCH] EmulatorPkg/Host/Unix: Drop dlopen() usage

Marvin Häuser
 

To assist debugging, i.e. to have the OS load the image debug
symbols, EmulatorPkg/Unix used to load most UEFI executables with OS
APIs, namely dlopen() and dlclose(). After support was added for GDB
and LLDB debugging of images loaded by the EDK II code, this route
became orphaned. Namely, it does not work for a variety of reasons:

1) Support is explicitly disabled for Xcode builds.
2) The dlopen() route is only attempted if the PDB path name ends
with ".pdb", which has not been the case with recent GCC toolchains.
3) By default, the images are not 4K-aligned, which causes some OSes
to deny the image executioon.
4) With recent GCC toolchains, UEFI images are built as ELF
executables, which cannot be dynamically loaded via dlopen().

Drop support for the dlopen() path as realistically it has not been
used or functioning in a long time.

Cc: Andrew Fish <afish@apple.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Vitaly Cheptsov <vit9696@protonmail.com>
Signed-off-by: Marvin Häuser <mhaeuser@posteo.de>
---
EmulatorPkg/Unix/Host/Host.c | 194 +-------------------
1 file changed, 2 insertions(+), 192 deletions(-)

diff --git a/EmulatorPkg/Unix/Host/Host.c b/EmulatorPkg/Unix/Host/Host.c
index b4e5510613c8..e19e20ed2902 100644
--- a/EmulatorPkg/Unix/Host/Host.c
+++ b/EmulatorPkg/Unix/Host/Host.c
@@ -48,9 +48,6 @@ EMU_SYSTEM_MEMORY *gSystemMemory;



-UINTN mImageContextModHandleArraySize = 0;
-IMAGE_CONTEXT_TO_MOD_HANDLE *mImageContextModHandleArray = NULL;
-
EFI_PEI_PPI_DESCRIPTOR *gPpiList;


@@ -118,8 +115,7 @@ main (
SecGdbConfigBreak ();

//
- // If dlopen doesn't work, then we build a gdb script to allow the
- // symbols to be loaded.
+ // We build a gdb script to allow the symbols to be loaded.
//
Index = strlen (*Argv);
gGdbWorkingFileName = AllocatePool (Index + strlen(".gdb") + 1);
@@ -762,7 +758,6 @@ SecPeCoffGetEntryPoint (
ImageContext.EntryPoint = (UINTN)*EntryPoint;
}

- // On Unix a dlopen is done that will change the entry point
SecPeCoffRelocateImageExtraAction (&ImageContext);
*EntryPoint = (VOID *)(UINTN)ImageContext.EntryPoint;

@@ -891,115 +886,6 @@ Returns:
}


-/*++
-
-Routine Description:
- Store the ModHandle in an array indexed by the Pdb File name.
- The ModHandle is needed to unload the image.
-
-Arguments:
- ImageContext - Input data returned from PE Loader Library. Used to find the
- .PDB file name of the PE Image.
- ModHandle - Returned from LoadLibraryEx() and stored for call to
- FreeLibrary().
-
-Returns:
- EFI_SUCCESS - ModHandle was stored.
-
-**/
-EFI_STATUS
-AddHandle (
- IN PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext,
- IN VOID *ModHandle
- )
-{
- UINTN Index;
- IMAGE_CONTEXT_TO_MOD_HANDLE *Array;
- UINTN PreviousSize;
-
-
- Array = mImageContextModHandleArray;
- for (Index = 0; Index < mImageContextModHandleArraySize; Index++, Array++) {
- if (Array->ImageContext == NULL) {
- //
- // Make a copy of the string and store the ModHandle
- //
- Array->ImageContext = ImageContext;
- Array->ModHandle = ModHandle;
- return EFI_SUCCESS;
- }
- }
-
- //
- // No free space in mImageContextModHandleArray so grow it by
- // IMAGE_CONTEXT_TO_MOD_HANDLE entires. realloc will
- // copy the old values to the new location. But it does
- // not zero the new memory area.
- //
- PreviousSize = mImageContextModHandleArraySize * sizeof (IMAGE_CONTEXT_TO_MOD_HANDLE);
- mImageContextModHandleArraySize += MAX_IMAGE_CONTEXT_TO_MOD_HANDLE_ARRAY_SIZE;
-
- mImageContextModHandleArray = ReallocatePool (
- (mImageContextModHandleArraySize - 1) * sizeof (IMAGE_CONTEXT_TO_MOD_HANDLE),
- mImageContextModHandleArraySize * sizeof (IMAGE_CONTEXT_TO_MOD_HANDLE),
- mImageContextModHandleArray
- );
- if (mImageContextModHandleArray == NULL) {
- ASSERT (FALSE);
- return EFI_OUT_OF_RESOURCES;
- }
-
- memset (mImageContextModHandleArray + PreviousSize, 0, MAX_IMAGE_CONTEXT_TO_MOD_HANDLE_ARRAY_SIZE * sizeof (IMAGE_CONTEXT_TO_MOD_HANDLE));
-
- return AddHandle (ImageContext, ModHandle);
-}
-
-
-/*++
-
-Routine Description:
- Return the ModHandle and delete the entry in the array.
-
-Arguments:
- ImageContext - Input data returned from PE Loader Library. Used to find the
- .PDB file name of the PE Image.
-
-Returns:
- ModHandle - ModHandle associated with ImageContext is returned
- NULL - No ModHandle associated with ImageContext
-
-**/
-VOID *
-RemoveHandle (
- IN PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
- )
-{
- UINTN Index;
- IMAGE_CONTEXT_TO_MOD_HANDLE *Array;
-
- if (ImageContext->PdbPointer == NULL) {
- //
- // If no PDB pointer there is no ModHandle so return NULL
- //
- return NULL;
- }
-
- Array = mImageContextModHandleArray;
- for (Index = 0; Index < mImageContextModHandleArraySize; Index++, Array++) {
- if (Array->ImageContext == ImageContext) {
- //
- // If you find a match return it and delete the entry
- //
- Array->ImageContext = NULL;
- return Array->ModHandle;
- }
- }
-
- return NULL;
-}
-
-
-
BOOLEAN
IsPdbFile (
IN CHAR8 *PdbFileName
@@ -1052,67 +938,6 @@ PrintLoadAddress (
}


-/**
- Loads the image using dlopen so symbols will be automatically
- loaded by gdb.
-
- @param ImageContext The PE/COFF image context
-
- @retval TRUE - The image was successfully loaded
- @retval FALSE - The image was successfully loaded
-
-**/
-BOOLEAN
-DlLoadImage (
- IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
- )
-{
-
-#ifdef __APPLE__
-
- return FALSE;
-
-#else
-
- void *Handle = NULL;
- void *Entry = NULL;
-
- if (ImageContext->PdbPointer == NULL) {
- return FALSE;
- }
-
- if (!IsPdbFile (ImageContext->PdbPointer)) {
- return FALSE;
- }
-
- fprintf (
- stderr,
- "Loading %s 0x%08lx - entry point 0x%08lx\n",
- ImageContext->PdbPointer,
- (unsigned long)ImageContext->ImageAddress,
- (unsigned long)ImageContext->EntryPoint
- );
-
- Handle = dlopen (ImageContext->PdbPointer, RTLD_NOW);
- if (Handle != NULL) {
- Entry = dlsym (Handle, "_ModuleEntryPoint");
- AddHandle (ImageContext, Handle);
- } else {
- printf("%s\n", dlerror());
- }
-
- if (Entry != NULL) {
- ImageContext->EntryPoint = (UINTN)Entry;
- printf ("Change %s Entrypoint to :0x%08lx\n", ImageContext->PdbPointer, (unsigned long)Entry);
- return TRUE;
- } else {
- return FALSE;
- }
-
-#endif
-}
-
-
#ifdef __APPLE__
__attribute__((noinline))
#endif
@@ -1195,9 +1020,7 @@ SecPeCoffRelocateImageExtraAction (
IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
)
{
- if (!DlLoadImage (ImageContext)) {
- GdbScriptAddImage (ImageContext);
- }
+ GdbScriptAddImage (ImageContext);
}


@@ -1264,19 +1087,6 @@ SecPeCoffUnloadImageExtraAction (
IN PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
)
{
- VOID *Handle;
-
- //
- // Check to see if the image symbols were loaded with gdb script, or dlopen
- //
- Handle = RemoveHandle (ImageContext);
- if (Handle != NULL) {
-#ifndef __APPLE__
- dlclose (Handle);
-#endif
- return;
- }
-
GdbScriptRemoveImage (ImageContext);
}

--
2.31.1


[PATCH] ArmPkg/DefaultExceptionHandlerLib: Fix DebugImageInfoTable lookup

Marvin Häuser
 

The sum of ImageBase + ImageSize yields the address of the first byte
outside of the range of the image. Adjust the address comparison
accordingly.

Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Vitaly Cheptsov <vit9696@protonmail.com>
Signed-off-by: Marvin Häuser <mhaeuser@posteo.de>
---
ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerUefi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerUefi.c b/ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerUefi.c
index e9fea4038252..a9b97cf7caf4 100644
--- a/ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerUefi.c
+++ b/ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerUefi.c
@@ -55,7 +55,7 @@ GetImageName (
if ((DebugTable->NormalImage->ImageInfoType == EFI_DEBUG_IMAGE_INFO_TYPE_NORMAL) &&
(DebugTable->NormalImage->LoadedImageProtocolInstance != NULL)) {
if ((Address >= (CHAR8 *)DebugTable->NormalImage->LoadedImageProtocolInstance->ImageBase) &&
- (Address <= ((CHAR8 *)DebugTable->NormalImage->LoadedImageProtocolInstance->ImageBase + DebugTable->NormalImage->LoadedImageProtocolInstance->ImageSize))) {
+ (Address < ((CHAR8 *)DebugTable->NormalImage->LoadedImageProtocolInstance->ImageBase + DebugTable->NormalImage->LoadedImageProtocolInstance->ImageSize))) {
*ImageBase = (UINTN)DebugTable->NormalImage->LoadedImageProtocolInstance->ImageBase;
*PeCoffSizeOfHeaders = PeCoffGetSizeOfHeaders ((VOID *)(UINTN)*ImageBase);
return PeCoffLoaderGetPdbPointer (DebugTable->NormalImage->LoadedImageProtocolInstance->ImageBase);
--
2.31.1


Re: [staging/edk2-redfish-client RedfishFeatureCore PATCH 0/3] RedfishFeatureCoreDxe

Nickle Wang
 

Reviewed-by: Nickle Wang <nickle.wang@hpe.com>

Thanks,
Nickle

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Chang, Abner (HPS SW/FW Technologist)
Sent: Tuesday, July 27, 2021 10:55 PM
To: devel@edk2.groups.io
Cc: Wang, Nickle (HPS SW) <nickle.wang@hpe.com>; Liming Gao <gaoliming@byosoft.com.cn>
Subject: [edk2-devel] [staging/edk2-redfish-client RedfishFeatureCore PATCH 0/3] RedfishFeatureCoreDxe

Patch of EDKII Redfish Feature Core DXE driver.

EDKII Redfish Feature Core DXE driver provides the protocol interface to the auto-generated Redfish feature driver to register itself for the Redfish resource URI it manages.

You can skip 0003 patch which is the diagrams.

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Nickle Wang <nickle.wang@hpe.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>

Abner Chang (3):
RedfishClientPkg: Initial commit of meta files
RedfishClientPkg/RedfishFeatureCoreDxe: Redfish Feature Core DXE
driver
RedfishClientPkg/Document: Update diagrams

RedfishClientPkg/RedfishClientPkg.dec | 35 ++
RedfishClientPkg/RedfishClient.dsc.inc | 21 +
.../RedfishClientComponents.dsc.inc | 18 +
RedfishClientPkg/RedfishClientDefines.dsc.inc | 27 ++
RedfishClientPkg/RedfishClientLibs.dsc.inc | 13 +
RedfishClientPkg/RedfishClientPkg.dsc | 46 +++
RedfishClientPkg/RedfishClient.fdf.inc | 15 +
.../RedfishFeatureCoreDxe.inf | 49 +++
.../Include/Protocol/EdkIIRedfishFeature.h | 116 ++++++
.../RedfishFeatureCoreDxe.h | 43 ++
.../RedfishFeatureCoreDxe.c | 382 ++++++++++++++++++
RedfishClientPkg/Readme.md | 36 ++
.../Media/RedfishClientDriverStack.svg | 197 ++++++---
13 files changed, 936 insertions(+), 62 deletions(-) create mode 100644 RedfishClientPkg/RedfishClientPkg.dec
create mode 100644 RedfishClientPkg/RedfishClient.dsc.inc
create mode 100644 RedfishClientPkg/RedfishClientComponents.dsc.inc
create mode 100644 RedfishClientPkg/RedfishClientDefines.dsc.inc
create mode 100644 RedfishClientPkg/RedfishClientLibs.dsc.inc
create mode 100644 RedfishClientPkg/RedfishClientPkg.dsc
create mode 100644 RedfishClientPkg/RedfishClient.fdf.inc
create mode 100644 RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.inf
create mode 100644 RedfishClientPkg/Include/Protocol/EdkIIRedfishFeature.h
create mode 100644 RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.h
create mode 100644 RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c

--
2.17.1


Re: [staging/edk2-redfish-client Tools PATCH 3/6] RedfishClientPkg/Redfish-Profile-Simulator: Add more features

Nickle Wang
 

Reviewed-by: Nickle Wang <nickle.wang@hpe.com>

Thanks,
Nickle

-----Original Message-----
From: Chang, Abner (HPS SW/FW Technologist) <abner.chang@hpe.com>
Sent: Thursday, July 22, 2021 2:08 PM
To: devel@edk2.groups.io
Cc: Wang, Nickle (HPS SW) <nickle.wang@hpe.com>; Liming Gao <gaoliming@byosoft.com.cn>
Subject: [staging/edk2-redfish-client Tools PATCH 3/6] RedfishClientPkg/Redfish-Profile-Simulator: Add more features

- Add HTTPs support
- Add ETAG support
- Change default credential to admin/pwd123456
- Add HTTP methods on BIOS managed resource.

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Nickle Wang <nickle.wang@hpe.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
---
.../redfishProfileSimulator.py | 92 ++++++++--
.../v1sim/redfishURIs.py | 161 ++++++++++++------
.../v1sim/registry.py | 14 ++
.../v1sim/resource.py | 27 ++-
.../v1sim/systems.py | 85 ++++++++-
5 files changed, 311 insertions(+), 68 deletions(-) create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/registry.py

diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/redfishProfileSimulator.py b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/redfishProfileSimulator.py
index 24be52bafc..91c792a2b7 100644
--- a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/redfishProfileSimulator.py
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/redfishProfileSim
+++ ulator.py
@@ -1,4 +1,9 @@
# Copyright Notice:
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> #
+SPDX-License-Identifier: BSD-2-Clause-Patent # # Copyright Notice:
# Copyright 2016 Distributed Management Task Force, Inc. All rights reserved.
# License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/Redfish-Profile-Simulator/blob/master/LICENSE.md

@@ -9,13 +14,16 @@
import sys
import getopt
import os
+import functools
+import flask
+import werkzeug

rfVersion = "0.9.6"
rfProgram1 = "redfishProfileSimulator"
rfProgram2 = " "
rfUsage1 = "[-Vh] [--Version][--help]"
-rfUsage2 = "[-H<hostIP>] [-P<port>] [-p<profile_path>]"
-rfUsage3 = "[--Host=<hostIP>] [--Port=<port>] [--profile_path=<profile_path>]"
+rfUsage2 = "[-H<hostIP>] [-P<port>] [-C<cert>] [-K<key>] [-p<profile_path>]"
+rfUsage3 = "[--Host=<hostIP>] [--Port=<port>] [--Cert=<cert>] [--Key=<key>] [--profile_path=<profile_path>]"


def rf_usage():
@@ -27,18 +35,19 @@ def rf_usage():

def rf_help():
print(rfProgram1,"implements a simulation of a redfish service for the \"Simple OCP Server V1\" Mockup.")
- print(" The simulation includes an http server, RestEngine, and dynamic Redfish datamodel.")
+ print(" The simulation includes an http/https server,
+ RestEngine, and dynamic Redfish datamodel.")
print(" You can GET, PATHCH,... to the service just like a real Redfish service.")
print(" Both Basic and Redfish Session/Token authentication is supported (for a single user/passwd and token")
print(" the user/passwd is: root/password123456. The authToken is: 123456SESSIONauthcode")
print(" these can be changed by editing the redfishURIs.py file. will make dynamic later.")
- print(" The http service and Rest engine is built on Flask, and all code is Python 3.4+")
+ print(" The http/https service and Rest engine is built on
+ Flask, and all code is Python 3.4+")
print(" The data model resources are \"initialized\" from the SPMF \"SimpleOcpServerV1\" Mockup.")
print(" and stored as python dictionaries--then the dictionaries are updated with patches, posts, deletes.")
print(" The program can be extended to support other mockup \"profiles\".")
print("")
- print(" By default, the simulation runs on localhost (127.0.0.1), on port 5000.")
- print(" These can be changed with CLI options: -P<port> -H <hostIP> | --port=<port> --host=<hostIp>")
+ print(" By default, the simulation runs over http, on localhost (127.0.0.1), on port 5000.")
+ print(" These can be changed with CLI options: -P<port> -C<cert> -K<key> -H <hostIP> | --port=<port> --Cert=<cert> --Key=<key> --host=<hostIp>")
+ print(" -C<cert> -K<key> | --Cert=<cert> --Key=<key> options
+ must be used together with port 443 to enable https session.")
print("")
print("Version: ", rfVersion)
rf_usage()
@@ -47,19 +56,69 @@ def rf_help():
print(" -h, --help, --- help")
print(" -H<hostIP>, --Host=<hostIp> --- host IP address. dflt=127.0.0.1")
print(" -P<port>, --Port=<port> --- the port to use. dflt=5000")
+ print(" -C<cert>, --Cert=<cert> --- Server certificate.")
+ print(" -K<key>, --Key=<key> --- Server key.")
print(" -p<profile_path>, --profile=<profile_path> --- the path to the Redfish profile to use. "
"dflt=\"./MockupData/SimpleOcpServerV1\" ")

+# Conditional Requests with ETags
+# http://flask.pocoo.org/snippets/95/
+def conditional(func):
+ '''Start conditional method execution for this resource'''
+ @functools.wraps(func)
+ def wrapper(*args, **kwargs):
+ flask.g.condtnl_etags_start = True
+ return func(*args, **kwargs)
+ return wrapper
+
+class NotModified(werkzeug.exceptions.HTTPException):
+ code = 304
+ def get_response(self, environment):
+ return flask.Response(status=304)
+
+class PreconditionRequired(werkzeug.exceptions.HTTPException):
+ code = 428
+ description = ('<p>This request is required to be '
+ 'conditional; try using "If-Match".')
+ name = 'Precondition Required'
+ def get_response(self, environment):
+ resp = super(PreconditionRequired,
+ self).get_response(environment)
+ resp.status = str(self.code) + ' ' + self.name.upper()
+ return resp

def main(argv):
+ #Monkey patch the set_etag() method for conditional request.
+ _old_set_etag = werkzeug.ETagResponseMixin.set_etag
+ @functools.wraps(werkzeug.ETagResponseMixin.set_etag)
+ def _new_set_etag(self, etag, weak=False):
+ # only check the first time through; when called twice
+ # we're modifying
+ if (hasattr(flask.g, 'condtnl_etags_start') and
+ flask.g.condtnl_etags_start):
+ if flask.request.method in ('PUT', 'DELETE', 'PATCH'):
+ if not flask.request.if_match:
+ raise PreconditionRequired
+ if etag not in flask.request.if_match:
+ flask.abort(412)
+ elif (flask.request.method == 'GET' and
+ flask.request.if_none_match and
+ etag in flask.request.if_none_match):
+ raise NotModified
+ flask.g.condtnl_etags_start = False
+ _old_set_etag(self, etag, weak)
+ werkzeug.ETagResponseMixin.set_etag = _new_set_etag
+
# set default option args
rf_profile_path = os.path.abspath("./MockupData/SimpleOcpServerV1")
- rf_host = "127.0.0.1"
+ rf_host = "0.0.0.0"
rf_port = 5000
+ rf_cert =""
+ rf_key=""

try:
- opts, args = getopt.getopt(argv[1:], "VhH:P:p:",
- ["Version", "help", "Host=", "Port=", "profile="])
+ opts, args = getopt.getopt(argv[1:], "VhH:P:C:K:p:",
+ ["Version", "help", "Host=",
+ "Port=", "Cert=", "Key=", "profile="])
except getopt.GetoptError:
print(rfProgram1, ": Error parsing options")
rf_usage()
@@ -77,11 +136,24 @@ def main(argv):
rf_host = arg
elif opt in "--Port=":
rf_port=int(arg)
+ elif opt in "--Cert=":
+ rf_cert=arg
+ elif opt in "--Key=":
+ rf_key=arg
else:
print(" ", rfProgram1, ": Error: unsupported option")
rf_usage()
sys.exit(2)

+ if rf_port == 443:
+ if rf_cert == "" or rf_key == "":
+ print(" ", rfProgram1, ": Error: port 443 must be used together with -C<cert> and -K<key> to enable https session")
+ sys.exit(2)
+ else:
+ if rf_cert != "" or rf_key != "":
+ print(" ", rfProgram1, ": Error: -C<cert> and -K<key> options must be used together with port 443 to enable https session")
+ sys.exit(2)
+
print("{} Version: {}".format(rfProgram1,rfVersion))
print(" Starting redfishProfileSimulator at: hostIP={}, port={}".format(rf_host, rf_port))
print(" Using Profile at {}".format(rf_profile_path))
@@ -102,7 +174,7 @@ def main(argv):
root = RfServiceRoot(rf_profile_path, root_path)

# start the flask REST API service
- rfApi_SimpleServer(root, versions, host=rf_host, port=rf_port)
+ rfApi_SimpleServer(root, versions, host=rf_host, port=rf_port,
+ cert=rf_cert, key=rf_key)
else:
print("invalid profile path")

diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/redfishURIs.py b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/redfishURIs.py
index 2380a4058a..3c912f7ce1 100644
--- a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/redfishURIs.py
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/redfishURIs
+++ .py
@@ -1,17 +1,23 @@
+#
+# Copyright Notice:
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> #
+SPDX-License-Identifier: BSD-2-Clause-Patent #
# Copyright Notice:
# Copyright 2016 Distributed Management Task Force, Inc. All rights reserved.
# License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/Redfish-Profile-Simulator/blob/master/LICENSE.md

import json
+from collections import OrderedDict

from flask import Flask
from flask import request

from .flask_redfish_auth import RfHTTPBasicOrTokenAuth -from .resource import RfResource, RfResourceRaw, RfCollection

+from werkzeug.serving import WSGIRequestHandler

-def rfApi_SimpleServer(root, versions, host="127.0.0.1", port=5000):
+def rfApi_SimpleServer(root, versions, host="127.0.0.1", port=5000, cert="", key=""):
app = Flask(__name__)

# create auth class that does basic or redifish session auth @@ -21,8 +27,8 @@ def rfApi_SimpleServer(root, versions, host="127.0.0.1", port=5000):
# for basic auth, we only support user=catfish, passwd=hunter
@auth.verify_basic_password
def verify_rf_passwd(user, passwd):
- if user == "root":
- if passwd == "password123456":
+ if user == "admin":
+ if passwd == "pwd123456":
return True
return False

@@ -43,13 +49,13 @@ def rfApi_SimpleServer(root, versions, host="127.0.0.1", port=5000):

# GET /redfish
@app.route("/redfish", methods=['GET'])
- @app.route("/redfish/", methods=['GET'])
+ #@app.route("/redfish/", methods=['GET'])
def rf_versions():
return versions.get_resource()

# GET /redfish/v1
@app.route("/redfish/v1", methods=['GET'])
- @app.route("/redfish/v1/", methods=['GET'])
+ #@app.route("/redfish/v1/", methods=['GET'])
def rf_service_root():
return root.get_resource()

@@ -65,8 +71,9 @@ def rfApi_SimpleServer(root, versions, host="127.0.0.1", port=5000):
return resolve_path(root, rf_path)

@app.route("/redfish/v1/<path:rf_path>", methods=['GET'])
- @app.route("/redfish/v1/<path:rf_path>/", methods=['GET'])
+ #@app.route("/redfish/v1/<path:rf_path>/", methods=['GET'])
@auth.rfAuthRequired
+ @conditional
def rf_subsystems(rf_path):
return resolve_path(root, rf_path)

@@ -78,135 +85,189 @@ def rfApi_SimpleServer(root, versions, host="127.0.0.1", port=5000):
return root.get_resource()

@app.route("/redfish/v1/Systems/<path:sys_path>", methods=['PATCH'])
- @app.route("/redfish/v1/Systems/<path:sys_path>/", methods=['PATCH'])
+ #@app.route("/redfish/v1/Systems/<path:sys_path>/",
+ methods=['PATCH'])
@auth.rfAuthRequired
def rf_computer_systempatch(sys_path):
- rdata = request.get_json(cache=True)
+ rdata = json.loads(request.data,object_pairs_hook=OrderedDict)
print("rdata:{}".format(rdata))
- obj = patch_path(root.systems, sys_path)
+ obj = patch_path(root.components['Systems'], sys_path)
rc, status_code, err_string, resp = obj.patch_resource(rdata)
if rc == 0:
- return "", status_code
+ return resp, status_code
+ else:
+ return err_string, status_code
+
+ @app.route("/redfish/v1/Systems/<string:system_id>/BootOptions/<string:bootOptIdx>", methods=['GET'])
+ @auth.rfAuthRequired
+ def rf_computer_bootoptions_get(system_id, bootOptIdx):
+ return
+ root.components['Systems'].get_element(system_id).components['BootOpti
+ ons'].get_bootOpt(bootOptIdx)
+
+ @app.route("/redfish/v1/Systems/<string:system_id>/BootOptions/<string:bootOptIdx>", methods=['DELETE'])
+ @auth.rfAuthRequired
+ def rf_computer_bootoptions_del(system_id, bootOptIdx):
+ print("in rf_computer_bootoptions_del")
+ rc, status_code, err_string, resp = root.components['Systems'].get_element(system_id).components['BootOptions'].delete_bootOpt(bootOptIdx)
+ if rc == 0:
+ return resp, status_code
+ else:
+ return err_string, status_code
+
+ @app.route("/redfish/v1/Systems/<string:system_id>/BootOptions/<string:bootOptIdx>", methods=['PATCH'])
+ @auth.rfAuthRequired
+ def rf_computer_bootoption_patch(system_id, bootOptIdx):
+ print ("in POST boot options")
+ rdata = json.loads(request.data,object_pairs_hook=OrderedDict)
+ print("rdata:{}".format(rdata))
+ rc, status_code, err_string, resp = root.components['Systems'].get_element(system_id).components['BootOptions'].patch_bootOpt(bootOptIdx, rdata)
+ if rc == 0:
+ return resp, status_code
+ else:
+ return err_string, status_code
+
+ @app.route("/redfish/v1/Systems/<string:system_id>/BootOptions", methods=['POST'])
+ @auth.rfAuthRequired
+ def rf_computer_bootoptions_post(system_id):
+ print ("in POST boot options")
+ rdata = json.loads(request.data,object_pairs_hook=OrderedDict)
+ print("rdata:{}".format(rdata))
+ rc, status_code, err_string, resp = root.components['Systems'].get_element(system_id).components['BootOptions'].post_resource(rdata)
+ if rc == 0:
+ return resp, status_code
else:
return err_string, status_code

@app.route("/redfish/v1/Systems/<string:system_id>/Actions/ComputerSystem.Reset", methods=['POST'])
- @app.route("/redfish/v1/Systems/<string:system_id>/Actions/ComputerSystem.Reset/", methods=['POST'])
+
+ #@app.route("/redfish/v1/Systems/<string:system_id>/Actions/ComputerSy
+ stem.Reset/", methods=['POST'])
@auth.rfAuthRequired
def rf_computer_systemreset(system_id):
# print("in reset")
- rdata = request.get_json(cache=True)
+ rdata = json.loads(request.data,object_pairs_hook=OrderedDict)
# print("rdata:{}".format(rdata))
rc, status_code, err_string, resp = root.components['Systems'].get_element(system_id).reset_resource(rdata)
if rc == 0:
- return "", status_code
+ return resp, status_code
else:
return err_string, status_code

- @app.route("/redfish/v1/Systems/<string:system_id>/bios/Actions/Bios.ResetBios", methods=['POST'])
- @app.route("/redfish/v1/Systems/<string:system_id>/bios/Actions/Bios.ResetBios/", methods=['POST'])
+ @app.route("/redfish/v1/Systems/<string:system_id>/Bios/Actions/Bios.ResetBios", methods=['POST'])
+
+ #@app.route("/redfish/v1/Systems/<string:system_id>/Bios/Actions/Bios.
+ ResetBios/", methods=['POST'])
@auth.rfAuthRequired
def rf_computer_biosreset(system_id):
# print("in reset")
- rdata = request.get_json(cache=True)
+ rdata = json.loads(request.data,object_pairs_hook=OrderedDict)
# print("rdata:{}".format(rdata))
system = root.systems.get_element(system_id)
- bios = system.get_component("bios")
+ bios = system.get_component("Bios")
rc, status_code, err_string, resp = bios.reset_resource(rdata)
if rc == 0:
- return "", status_code
+ return resp, status_code
else:
return err_string, status_code

- @app.route("/redfish/v1/Systems/<string:system_id>/bios/Actions/Bios.ChangePassword", methods=['PATCH'])
- @app.route("/redfish/v1/Systems/<string:system_id>/bios/Actions/Bios.ChangePassword/", methods=['PATCH'])
+ @app.route("/redfish/v1/Systems/<string:system_id>/Bios/Actions/Bios.ChangePassword", methods=['PATCH'])
+
+ #@app.route("/redfish/v1/Systems/<string:system_id>/Bios/Actions/Bios.
+ ChangePassword/", methods=['PATCH'])
@auth.rfAuthRequired
def rf_computer_change_pswd(system_id):
# print("in reset")
- rdata = request.get_json(cache=True)
+ rdata = json.loads(request.data,object_pairs_hook=OrderedDict)
# print("rdata:{}".format(rdata))
system = root.systems.get_element(system_id)
- bios = system.get_component("bios")
+ bios = system.get_component("Bios")
rc, status_code, err_string, resp = bios.change_password(rdata)
if rc == 0:
- return "", status_code
+ return resp, status_code
else:
return err_string, status_code

@app.route("/redfish/v1/Chassis/<string:chassis_id>/Actions/Chassis.Reset", methods=['POST'])
- @app.route("/redfish/v1/Chassis/<string:chassis_id>/Actions/Chassis.Reset/", methods=['POST'])
+
+ #@app.route("/redfish/v1/Chassis/<string:chassis_id>/Actions/Chassis.R
+ eset/", methods=['POST'])
@auth.rfAuthRequired
def rf_computer_chassisreset(chassis_id):
# print("in reset")
- rdata = request.get_json(cache=True)
+ rdata = json.loads(request.data,object_pairs_hook=OrderedDict)
# print("rdata:{}".format(rdata))
rc, status_code, err_string, resp = root.chassis.get_element(chassis_id).reset_resource(rdata)
if rc == 0:
- return "", status_code
+ return resp, status_code
else:
return err_string, status_code

@app.route("/redfish/v1/Chassis/<string:chassis_id>/Power", methods=['PATCH'])
- @app.route("/redfish/v1/Chassis/<string:chassis_id>/Power/", methods=['PATCH'])
+ #@app.route("/redfish/v1/Chassis/<string:chassis_id>/Power/",
+ methods=['PATCH'])
@auth.rfAuthRequired
def rf_chassis_powerpatch(chassis_id):
# rawdata=request.data
- rdata = request.get_json(cache=True)
+ rdata = json.loads(request.data,object_pairs_hook=OrderedDict)
# print("RRrdata:{}".format(rdata))
rc, status_code, err_string, resp = root.chassis.get_element(chassis_id).power.patch_resource(rdata)
+ if rc == 0:
+ return resp, status_code
+ else:
+ return err_string, status_code
+
+ @app.route("/redfish/v1/Registries/<path:sys_path>", methods=['PATCH'])
+ @auth.rfAuthRequired
+ def rf_registries_patch(sys_path):
+ rdata = json.loads(request.data,object_pairs_hook=OrderedDict)
+ print("rdata:{}".format(rdata))
+ obj = patch_path(root.components['Registries'], sys_path)
+ rc, status_code, err_string, resp = obj.patch_resource(rdata)
if rc == 0:
return "", status_code
else:
return err_string, status_code

@app.route("/redfish/v1/Managers/<string:manager_id>", methods=['PATCH'])
- @app.route("/redfish/v1/Managers/<string:manager_id>/", methods=['PATCH'])
+ #@app.route("/redfish/v1/Managers/<string:manager_id>/",
+ methods=['PATCH'])
@auth.rfAuthRequired
def rf_patch_manager_entity(manager_id):
- rdata = request.get_json(cache=True)
+ rdata = json.loads(request.data,object_pairs_hook=OrderedDict)
# print("RRrdata:{}".format(rdata))
rc, status_code, err_string, resp = root.managers.get_element(manager_id).patch_resource(rdata)
if rc == 0:
- return "", status_code
+ return resp, status_code
else:
return err_string, status_code

# rest/v1/Managers/1
@app.route("/redfish/v1/Managers/<string:manager_id>/Actions/Manager.Reset", methods=['POST'])
- @app.route("/redfish/v1/Managers/<string:manager_id>/Actions/Manager.Reset/", methods=['POST'])
+
+ #@app.route("/redfish/v1/Managers/<string:manager_id>/Actions/Manager.
+ Reset/", methods=['POST'])
@auth.rfAuthRequired
def rf_reset_manager(manager_id):
- rdata = request.get_json(cache=True)
+ rdata = json.loads(request.data,object_pairs_hook=OrderedDict)
# print("rdata:{}".format(rdata))
rc, status_code, err_string, resp = root.managers.get_element(manager_id).reset_resource(rdata)
if rc == 0:
- return "", status_code
+ return resp, status_code
else:
return err_string, status_code

@app.route("/redfish/v1/Managers/<string:manager_id>/EthernetInterfaces/<string:eth_id>", methods=['PATCH'])
- @app.route("/redfish/v1/Managers/<string:manager_id>/EthernetInterfaces/<string:eth_id>/", methods=['PATCH'])
+
+ #@app.route("/redfish/v1/Managers/<string:manager_id>/EthernetInterfac
+ es/<string:eth_id>/", methods=['PATCH'])
@auth.rfAuthRequired
def rf_patch_manager_nic_entity(manager_id, eth_id):
resp = root.managers.get_element(manager_id).ethernetColl.get_interface(eth_id).get_resource()
- rdata = request.get_json(cache=True)
+ rdata = json.loads(request.data,object_pairs_hook=OrderedDict)
# print("RRrdata:{}".format(rdata))
ethernet_coll = root.managers.get_element(manager_id).ethernetColl
rc, status_code, err_string, resp = ethernet_coll.get_interface(eth_id).patch_resource(rdata)
if rc == 0:
- return "", status_code
+ return resp, status_code
else:
return err_string, status_code

+ @app.route("/redfish/v1/SessionService", methods=['GET'])
+ def rf_get_session_service():
+ return root.components['SessionService'].get_resource()
+
@app.route("/redfish/v1/SessionService", methods=['PATCH'])
- @app.route("/redfish/v1/SessionService/", methods=['PATCH'])
- @auth.rfAuthRequired
+ #@app.route("/redfish/v1/SessionService/", methods=['PATCH'])
def rf_patch_session_service():
- rdata = request.get_json(cache=True)
+ rdata = json.loads(request.data,object_pairs_hook=OrderedDict)
# print("RRrdata:{}".format(rdata))
rc, status_code, err_string, resp = root.sessionService.patch_resource(rdata)
if rc == 0:
- return "", status_code
+ return resp, status_code
else:
return err_string, status_code

@@ -215,7 +276,7 @@ def rfApi_SimpleServer(root, versions, host="127.0.0.1", port=5000):
@app.route("/redfish/v1/SessionService/Sessions", methods=['POST'])
def rf_login():
print("login")
- rdata = request.get_json(cache=True)
+ rdata = json.loads(request.data,object_pairs_hook=OrderedDict)
print("rdata:{}".format(rdata))
if rdata["UserName"] == "root" and rdata["Password"] == "password123456":
x = {"Id": "SESSION123456"} @@ -233,17 +294,17 @@ def rfApi_SimpleServer(root, versions, host="127.0.0.1", port=5000):
@auth.rfAuthRequired
def rf_session_logout(session_id):
print("session logout %s" % session_id)
- # rdata=request.get_json(cache=True)
+ # rdata =
+ json.loads(request.data,object_pairs_hook=OrderedDict)
# print("rdata:{}".format(rdata))
return "", 204

@app.route("/redfish/v1/AccountService", methods=['PATCH'])
@auth.rfAuthRequired
def rf_patch_account_service():
- rdata = request.get_json(cache=True)
+ rdata = json.loads(request.data,object_pairs_hook=OrderedDict)
rc, status_code, err_string, resp = root.accountService.patch_resource(rdata)
if rc == 0:
- return "", status_code
+ return resp, status_code
else:
return err_string, status_code

@@ -293,12 +354,14 @@ def rfApi_SimpleServer(root, versions, host="127.0.0.1", port=5000):
'''

# END file redfishURIs
-
# start Flask REST engine running
- app.run(host=host, port=port)

- # never returns
+ if key != "" and cert != "":
+ app.run(host=host, port=port, ssl_context=(cert, key))
+ else:
+ app.run(host=host, port=port)

+ # never returns

'''
reference source links:
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/registry.py b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/registry.py
new file mode 100644
index 0000000000..9cfbb30cde
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/registry.py
@@ -0,0 +1,14 @@
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> #
+SPDX-License-Identifier: BSD-2-Clause-Patent #
+
+from .resource import RfResource, RfCollection
+
+class RfRegistryCollection(RfCollection):
+ def element_type(self):
+ return RfRegistry
+
+#subclass Bios
+class RfRegistry(RfResource):
+ pass
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/resource.py b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/resource.py
index 6fee348064..ca7541f172 100644
--- a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/resource.py
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/resource.py
@@ -1,6 +1,13 @@
+#
+# Copyright Notice:
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> #
+SPDX-License-Identifier: BSD-2-Clause-Patent #
# Copyright Notice:
# Copyright 2016 Distributed Management Task Force, Inc. All rights reserved.
# License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/Redfish-Profile-Simulator/blob/master/LICENSE.md
+#

import json
import os
@@ -23,7 +30,7 @@ class RfResource:
if os.path.exists(indx_file_path):
res_file = open(indx_file_path, "r")
res_rawdata = res_file.read()
- self.res_data = json.loads(res_rawdata)
+ self.res_data =
+ json.loads(res_rawdata,object_pairs_hook=OrderedDict)
self.create_sub_objects(base_path, rel_path)
self.final_init_processing(base_path, rel_path)
else:
@@ -36,7 +43,15 @@ class RfResource:
pass

def get_resource(self):
- return flask.jsonify(self.res_data)
+ self.response=json.dumps(self.res_data,indent=4)
+ try:
+ # SHA1 should generate well-behaved etags
+ response = flask.make_response(self.response)
+ etag = hashlib.sha1(self.response.encode('utf-8')).hexdigest()
+ response.set_etag(etag)
+ return response
+ except KeyError:
+ flask.abort(404)

def get_attribute(self, attribute):
return flask.jsonify(self.res_data[attribute])
@@ -54,6 +69,14 @@ class RfResource:
else:
raise Exception("attribute %s not found" % key)

+ resp = flask.Response(json.dumps(self.res_data,indent=4))
+ return 0, 200, None, resp
+
+ def post_resource(self, post_data):
+ pass
+
+ def delete_resource(self):
+ pass

class RfResourceRaw:
def __init__(self, base_path, rel_path, parent=None):
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/systems.py b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/systems.py
index b107f035db..b8b3788054 100644
--- a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/systems.py
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/systems.py
@@ -1,6 +1,13 @@
+#
+# Copyright Notice:
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> #
+SPDX-License-Identifier: BSD-2-Clause-Patent #
# Copyright Notice:
# Copyright 2016 Distributed Management Task Force, Inc. All rights reserved.
# License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/Redfish-Profile-Simulator/blob/master/LICENSE.md
+#

import os

@@ -8,7 +15,9 @@ from .common_services import RfLogServiceCollection from .network import RfEthernetCollection, RfNetworkInterfaceCollection from .resource import RfResource, RfCollection from .storage import RfSimpleStorageCollection, RfSmartStorage
-
+import flask
+import json
+from collections import OrderedDict

class RfSystemsCollection(RfCollection):
def element_type(self):
@@ -48,15 +57,17 @@ class RfSystemObj(RfResource):
self.components[item] = RfUSBDeviceCollection(base_path, os.path.join(rel_path, item), parent=self)
elif item == "USBPorts":
self.components[item] = RfUSBPortCollection(base_path, os.path.join(rel_path, item), parent=self)
+ elif item == "BootOptions":
+ self.components[item] =
+ RfBootOptionCollection(base_path, os.path.join(rel_path, item),
+ parent=self)

def patch_resource(self, patch_data):
# first verify client didn't send us a property we cant patch
for key in patch_data.keys():
- if key != "AssetTag" and key != "IndicatorLED" and key != "Boot":
+ if key != "AssetTag" and key != "IndicatorLED" and key != "Boot" and key != "BiosVersion":
return 4, 400, "Invalid Patch Property Sent", ""
elif key == "Boot":
for prop2 in patch_data["Boot"].keys():
- if prop2 != "BootSourceOverrideEnabled" and prop2 != "BootSourceOverrideTarget":
+ if prop2 != "BootSourceOverrideEnabled" and prop2 != "BootSourceOverrideTarget" and prop2 != "BootNext" and prop2 != "BootOrder":
return 4, 400, "Invalid Patch Property Sent", ""
# now patch the valid properties sent
if "AssetTag" in patch_data:
@@ -64,6 +75,8 @@ class RfSystemObj(RfResource):
self.res_data['AssetTag'] = patch_data['AssetTag']
if "IndicatorLED" in patch_data:
self.res_data['IndicatorLED'] = patch_data['IndicatorLED']
+ if "BiosVersion" in patch_data:
+ self.res_data['BiosVersion'] = patch_data['BiosVersion']
if "Boot" in patch_data:
boot_data = patch_data["Boot"]
if "BootSourceOverrideEnabled" in boot_data:
@@ -80,7 +93,13 @@ class RfSystemObj(RfResource):
self.res_data['Boot']['BootSourceOverrideTarget'] = value
else:
return 4, 400, "Invalid_Value_Specified: BootSourceOverrideTarget", ""
- return 0, 204, None, None
+ if "BootNext" in boot_data:
+ self.res_data['Boot']['BootNext'] = boot_data['BootNext']
+ if "BootOrder" in boot_data:
+ self.res_data['Boot']['BootOrder'] =
+ boot_data['BootOrder']
+
+ resp = flask.Response(json.dumps(self.res_data,indent=4))
+ return 0, 200, None, resp

def reset_resource(self, reset_data):
if "ResetType" in reset_data:
@@ -145,13 +164,17 @@ class RfBiosSettings(RfResource):
def patch_resource(self, patch_data):
if "Attributes" not in patch_data:
return 4, 400, "Invalid Payload. No Attributes found", ""
+ self.res_data["Attributes"] = OrderedDict()
for key in patch_data["Attributes"].keys():
+ print("Check key in patch_data:{}".format(key))
# verify client didn't send us a property we cant patch
- if key not in self.res_data["Attributes"]:
+ if key not in self.parent.res_data["Attributes"]:
+ print("Invalid Patch Property Sent")
return 4, 400, "Invalid Patch Property Sent", ""
else:
- self.parent.res_data["Attributes"][key] = patch_data["Attributes"][key]
- return 0, 204, None, None
+ self.res_data["Attributes"][key] = patch_data["Attributes"][key]
+ resp = flask.Response(json.dumps(self.res_data,indent=4))
+ return 0, 200, None, resp


class RfPCIeDeviceCollection(RfCollection):
@@ -196,3 +219,51 @@ class RfUSBPortCollection(RfCollection):

class RfUSBPort(RfResource):
pass
+
+class RfBootOptionCollection(RfCollection):
+ def final_init_processing(self, base_path, rel_path):
+ self.maxIdx = 0
+ self.bootOptions = {}
+
+ def element_type(self):
+ return RfBootOption
+
+ def post_resource(self, post_data):
+ print("Members@odata.count:{}".format(self.res_data["Members@odata.count"]))
+ print("Members:{}".format(self.res_data["Members"]))
+ print("post_data:{}".format(post_data))
+
+ self.res_data["Members@odata.count"] = self.res_data["Members@odata.count"] + 1
+ self.maxIdx = self.maxIdx + 1
+ newBootOptIdx = self.maxIdx
+ newBootOptUrl = self.res_data["@odata.id"] + "/" + str(newBootOptIdx)
+ self.res_data["Members"].append({"@odata.id":newBootOptUrl})
+
+ post_data["@odata.id"] = newBootOptUrl
+ self.bootOptions[str(newBootOptIdx)] = post_data
+
+ resp = flask.Response(json.dumps(post_data,indent=4))
+ resp.headers["Location"] = newBootOptUrl
+ return 0, 200, None, resp
+
+ def patch_bootOpt(self, Idx, patch_data):
+ self.bootOptions[str(Idx)] = {**self.bootOptions[str(Idx)], **patch_data}
+ resp = flask.Response(json.dumps(self.bootOptions[str(Idx)],indent=4))
+ return 0, 200, None, resp
+
+ def get_bootOpt(self, Idx):
+ return json.dumps(self.bootOptions[Idx],indent=4)
+
+ def delete_bootOpt(self, Idx):
+ print("in delete_bootOpt")
+
+ resp =
+ flask.Response(json.dumps(self.bootOptions[Idx],indent=4))
+
+ self.bootOptions.pop(Idx)
+ self.res_data["Members@odata.count"] =
+ self.res_data["Members@odata.count"] - 1
+
+ bootOptUrl = self.res_data["@odata.id"] + "/" + str(Idx)
+ self.res_data["Members"].remove({"@odata.id":bootOptUrl})
+ return 0, 200, None, resp
+
+class RfBootOption(RfResource):
--
2.17.1


Re: [staging/edk2-redfish-client Tools PATCH 2/6] RedfishClientPkg/Tools: Add more Redfish resource

Nickle Wang
 

Reviewed-by: Nickle Wang <nickle.wang@hpe.com>

Thanks,
Nickle

-----Original Message-----
From: Chang, Abner (HPS SW/FW Technologist) <abner.chang@hpe.com>
Sent: Thursday, July 22, 2021 2:08 PM
To: devel@edk2.groups.io
Cc: Wang, Nickle (HPS SW) <nickle.wang@hpe.com>; Liming Gao <gaoliming@byosoft.com.cn>
Subject: [staging/edk2-redfish-client Tools PATCH 2/6] RedfishClientPkg/Tools: Add more Redfish resource

Add more Redfish resource for EDK2 Redfish development.
- Add two more systems to profile.
- Add BIOS, Memory and Log service to profile.

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Nickle Wang <nickle.wang@hpe.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
---
.../redfish/v1/$metadata/index.xml | 6 +-
.../index.json | 16 ++
.../redfish/v1/Registries/index.json | 14 ++
.../2M220100SL/Bios/Settings/index.json | 31 +++
.../v1/Systems/2M220100SL/Bios/index.json | 202 ++++++++++++++++++
.../v1/Systems/2M220100SL/Memory/1/index.json | 56 +++++
.../v1/Systems/2M220100SL/Memory/2/index.json | 46 ++++
.../v1/Systems/2M220100SL/Memory/3/index.json | 46 ++++
.../v1/Systems/2M220100SL/Memory/4/index.json | 46 ++++
.../v1/Systems/2M220100SL/Memory/index.json | 22 ++
.../redfish/v1/Systems/2M220100SL/index.json | 10 +-
.../2M220101SL/Bios/Settings/index.json | 13 ++
.../v1/Systems/2M220101SL/Bios/index.json | 17 ++
.../Systems/2M220101SL/BootOptions/index.json | 10 +
.../LogServices/SEL/Entries/1/index.json | 28 +++
.../LogServices/SEL/Entries/2/index.json | 28 +++
.../LogServices/SEL/Entries/index.json | 64 ++++++
.../2M220101SL/LogServices/SEL/index.json | 27 +++
.../Systems/2M220101SL/LogServices/index.json | 15 ++
.../2M220101SL/Memory/_backup/1/index.json | 56 +++++
.../2M220101SL/Memory/_backup/2/index.json | 46 ++++
.../2M220101SL/Memory/_backup/3/index.json | 46 ++++
.../2M220101SL/Memory/_backup/4/index.json | 46 ++++
.../2M220101SL/Memory/_backup/index.json | 22 ++
.../v1/Systems/2M220101SL/Memory/index.json | 10 +
.../redfish/v1/Systems/2M220101SL/index.json | 82 +++++++
.../2M220102SL/Bios/Settings/index.json | 31 +++
.../v1/Systems/2M220102SL/Bios/index.json | 202 ++++++++++++++++++
.../LogServices/SEL/Entries/1/index.json | 28 +++
.../LogServices/SEL/Entries/2/index.json | 28 +++
.../LogServices/SEL/Entries/index.json | 64 ++++++
.../2M220102SL/LogServices/SEL/index.json | 27 +++
.../Systems/2M220102SL/LogServices/index.json | 15 ++
.../v1/Systems/2M220102SL/Memory/1/index.json | 56 +++++
.../v1/Systems/2M220102SL/Memory/2/index.json | 46 ++++
.../v1/Systems/2M220102SL/Memory/3/index.json | 46 ++++
.../v1/Systems/2M220102SL/Memory/4/index.json | 46 ++++
.../v1/Systems/2M220102SL/Memory/index.json | 22 ++
.../redfish/v1/Systems/2M220102SL/index.json | 76 +++++++
.../redfish/v1/Systems/index.json | 10 +-
.../SimpleOcpServerV1/redfish/v1/index.json | 7 +-
41 files changed, 1702 insertions(+), 7 deletions(-)
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Registries/BiosAttributeRegistryUefiKeyword.v1_0_0/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Registries/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/Bios/Settings/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/Bios/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/Memory/1/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/Memory/2/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/Memory/3/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/Memory/4/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/Memory/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/Bios/Settings/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/Bios/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/BootOptions/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/LogServices/SEL/Entries/1/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/LogServices/SEL/Entries/2/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/LogServices/SEL/Entries/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/LogServices/SEL/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/LogServices/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/Memory/_backup/1/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/Memory/_backup/2/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/Memory/_backup/3/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/Memory/_backup/4/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/Memory/_backup/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/Memory/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102SL/Bios/Settings/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102SL/Bios/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102SL/LogServices/SEL/Entries/1/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102SL/LogServices/SEL/Entries/2/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102SL/LogServices/SEL/Entries/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102SL/LogServices/SEL/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102SL/LogServices/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102SL/Memory/1/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102SL/Memory/2/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102SL/Memory/3/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102SL/Memory/4/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102SL/Memory/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102SL/index.json

diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/$metadata/index.xml b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/$metadata/index.xml
index 37d9529b10..ff5628a214 100644
--- a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/$metadata/index.xml
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/$metadata/index.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright.-->
+<!-- Copyright (c) 2019, Intel Corporation. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent. <BR> Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright.-->
<edmx:Edmx xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx" Version="4.0">

<edmx:Reference Uri="http://redfish.dmtf.org/schemas/v1/ServiceRoot_v1.xml">
@@ -21,6 +21,10 @@
<edmx:Include Namespace="ComputerSystem"/>
<edmx:Include Namespace="ComputerSystem.v1_1_0"/>
</edmx:Reference>
+ <edmx:Reference Uri="http://redfish.dmtf.org/schemas/v1/Bios_v1.xml">
+ <edmx:Include Namespace="Bios"/>
+ <edmx:Include Namespace="Bios.v1_0_2"/>
+ </edmx:Reference>
<edmx:Reference Uri="http://redfish.dmtf.org/schemas/v1/ComputerSystemCollection_v1.xml">
<edmx:Include Namespace="ComputerSystemCollection"/>
</edmx:Reference>
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Registries/BiosAttributeRegistryUefiKeyword.v1_0_0/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Registries/BiosAttributeRegistryUefiKeyword.v1_0_0/index.json
new file mode 100644
index 0000000000..7e36897004
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Registries/BiosAttributeRegistryUefiKeyword.v1_0_0/index.json
@@ -0,0 +1,16 @@
+{
+ "@Redfish.Copyright": "Copyright (c) 2019, Intel Corporation. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent.",
+ "@odata.type": "#AttributeRegistry.v1_0_0.AttributeRegistry",
+ "@odata.id": "/redfish/v1/Registries/BiosAttributeRegistryUefiKeyword.v1_0_0",
+ "Description": "This registry defines a representation of BIOS Attribute instances (UEFI configuration keyword).",
+ "Id": "BiosAttributeRegistryUefiKeyword.v1_0_0",
+ "Language": "en",
+ "Name": "BIOS Attribute Registry",
+ "OwningEntity": "Intel",
+ "RegistryVersion": "1.0.0",
+ "RegistryEntries": {
+ "Attributes": [],
+ "Menus": [],
+ "Dependencies": []
+ }
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Registries/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Registries/index.json
new file mode 100644
index 0000000000..cc651e1b5b
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Registries/index.json
@@ -0,0 +1,14 @@
+{
+ "@Redfish.Copyright": "Copyright (c) 2019, Intel Corporation. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent.",
+ "@odata.context": "/redfish/v1/$metadata#MessageRegistryFileCollection.MessageRegistryFileCollection",
+ "@odata.id": "/redfish/v1/Registries",
+ "@odata.type": "#MessageRegistryFileCollection.MessageRegistryFileCollection",
+ "Name": "Registry File Collection",
+ "Description": "Registry Repository",
+ "Members@odata.count": 1,
+ "Members": [
+ {
+ "@odata.id": "/redfish/v1/Registries/BiosAttributeRegistryUefiKeyword.v1_0_0"
+ }
+ ]
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/Bios/Settings/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/Bios/Settings/index.json
new file mode 100644
index 0000000000..a7a5542447
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/Bios/Settings/index.json
@@ -0,0 +1,31 @@
+{
+ "@odata.type": "#Bios.v1_0_2.Bios",
+ "Id": "SD",
+ "Name": "BIOS Configuration Pending Settings",
+ "Description": "BIOS Configuration Pending Settings. These settings will be applied on next system reboot.",
+ "AttributeRegistry": "/redfish/v1/Registries/BiosAttributeRegistryUefiKeyword.v1_0_0",
+ "Attributes": {
+ "ns_Dev9_iSCSIInitiatorName": "iqn.test.init",
+ "ns_Dev9_iSCSIMacAddr": "8C:DC:D4:26:C9:74",
+ "ns_Dev9_iSCSIAddAttempts": "attempt:2",
+ "ns_Dev9_iSCSIAttemptName2": "Attempt 2",
+ "ns_Dev9_iSCSIBootEnable2": 1,
+ "ns_Dev9_iSCSIIpAddressType2": 0,
+ "ns_Dev9_iSCSIConnectRetry2": 5,
+ "ns_Dev9_iSCSIConnectTimeout2": 300,
+ "ns_Dev9_iSCSIISID2": "0CDCD4654321",
+ "ns_Dev9_iSCSIInitiatorIpAddress2": "192.168.111.101",
+ "ns_Dev9_iSCSIInitiatorNetmask2": "255.255.255.0",
+ "ns_Dev9_iSCSIInitiatorGateway2": "192.168.111.1",
+ "ns_Dev9_iSCSITargetTcpPort2": 3260,
+ "ns_Dev9_iSCSITargetName2": "iqn.2016-06:067",
+ "ns_Dev9_iSCSITargetIpAddress2": "192.168.111.1",
+ "ns_Dev9_iSCSILUN2": "0",
+ "ns_Dev9_iSCSIInitiatorInfoViaDHCP2": 0,
+ "ns_Dev9_iSCSIAuthenticationMethod2": 0,
+ "ns_Dev9_iSCSIChapType2": 0
+ },
+ "@odata.context": "/redfish/v1/$metadata#Bios.Bios",
+ "@odata.id": "/redfish/v1/Systems/2M220100SL/Bios/Settings",
+ "@Redfish.Copyright": "Copyright (c) 2019, Intel Corporation. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent. <BR> Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright."
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/Bios/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/Bios/index.json
new file mode 100644
index 0000000000..540dcd309f
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/Bios/index.json
@@ -0,0 +1,202 @@
+{
+ "@odata.type": "#Bios.v1_0_2.Bios",
+ "Id": "Bios",
+ "Name": "BIOS Configuration Current Settings",
+ "Description": "BIOS Configuration Current Settings",
+ "AttributeRegistry": "/redfish/v1/Registries/BiosAttributeRegistryUefiKeyword.v1_0_0",
+ "Attributes": {
+ "ns_Dev9_iSCSIInitiatorName": "iqn.test.init",
+ "ns_Dev9_iSCSIMacAddr": "8C:DC:D4:26:C9:74",
+ "ns_Dev9_iSCSIAttemptOrder": "",
+ "ns_Dev9_iSCSIAddAttempts": "",
+ "ns_Dev9_iSCSIDeleteAttempts": "",
+ "ns_Dev9_iSCSIDisplayAttemptList": "Attempt:2 ",
+ "ns_Dev9_iSCSIAttemptName1": "",
+ "ns_Dev9_iSCSIBootEnable1": 0,
+ "ns_Dev9_iSCSIIpAddressType1": 0,
+ "ns_Dev9_iSCSIConnectRetry1": 0,
+ "ns_Dev9_iSCSIConnectTimeout1": 0,
+ "ns_Dev9_iSCSIISID1": "",
+ "ns_Dev9_iSCSIInitiatorInfoViaDHCP1": 0,
+ "ns_Dev9_iSCSIInitiatorIpAddress1": "",
+ "ns_Dev9_iSCSIInitiatorNetmask1": "",
+ "ns_Dev9_iSCSIInitiatorGateway1": "",
+ "ns_Dev9_iSCSITargetInfoViaDHCP1": 0,
+ "ns_Dev9_iSCSITargetTcpPort1": 0,
+ "ns_Dev9_iSCSITargetName1": "",
+ "ns_Dev9_iSCSITargetIpAddress1": "",
+ "ns_Dev9_iSCSILUN1": "",
+ "ns_Dev9_iSCSIAuthenticationMethod1": 0,
+ "ns_Dev9_iSCSIChapType1": 0,
+ "ns_Dev9_iSCSIChapUsername1": "",
+ "ns_Dev9_iSCSIChapSecret1": "",
+ "ns_Dev9_iSCSIReverseChapUsername1": "",
+ "ns_Dev9_iSCSIReverseChapSecret1": "",
+ "ns_Dev9_iSCSIAttemptName2": "Attempt 2",
+ "ns_Dev9_iSCSIBootEnable2": 0,
+ "ns_Dev9_iSCSIIpAddressType2": 0,
+ "ns_Dev9_iSCSIConnectRetry2": 5,
+ "ns_Dev9_iSCSIConnectTimeout2": 300,
+ "ns_Dev9_iSCSIISID2": "0CDCD4654321",
+ "ns_Dev9_iSCSIInitiatorInfoViaDHCP2": 0,
+ "ns_Dev9_iSCSIInitiatorIpAddress2": "192.168.1.188",
+ "ns_Dev9_iSCSIInitiatorNetmask2": "255.255.255.0",
+ "ns_Dev9_iSCSIInitiatorGateway2": "192.168.1.177",
+ "ns_Dev9_iSCSITargetInfoViaDHCP2": 0,
+ "ns_Dev9_iSCSITargetTcpPort2": 3260,
+ "ns_Dev9_iSCSITargetName2": "iqn.test.target",
+ "ns_Dev9_iSCSITargetIpAddress2": "192.168.1.155",
+ "ns_Dev9_iSCSILUN2": "1",
+ "ns_Dev9_iSCSIAuthenticationMethod2": 0,
+ "ns_Dev9_iSCSIChapType2": 0,
+ "ns_Dev9_iSCSIChapUsername2": "",
+ "ns_Dev9_iSCSIChapSecret2": "",
+ "ns_Dev9_iSCSIReverseChapUsername2": "",
+ "ns_Dev9_iSCSIReverseChapSecret2": "",
+ "ns_Dev9_iSCSIAttemptName3": "",
+ "ns_Dev9_iSCSIBootEnable3": 0,
+ "ns_Dev9_iSCSIIpAddressType3": 0,
+ "ns_Dev9_iSCSIConnectRetry3": 0,
+ "ns_Dev9_iSCSIConnectTimeout3": 0,
+ "ns_Dev9_iSCSIISID3": "",
+ "ns_Dev9_iSCSIInitiatorInfoViaDHCP3": 0,
+ "ns_Dev9_iSCSIInitiatorIpAddress3": "",
+ "ns_Dev9_iSCSIInitiatorNetmask3": "",
+ "ns_Dev9_iSCSIInitiatorGateway3": "",
+ "ns_Dev9_iSCSITargetInfoViaDHCP3": 0,
+ "ns_Dev9_iSCSITargetTcpPort3": 0,
+ "ns_Dev9_iSCSITargetName3": "",
+ "ns_Dev9_iSCSITargetIpAddress3": "",
+ "ns_Dev9_iSCSILUN3": "",
+ "ns_Dev9_iSCSIAuthenticationMethod3": 0,
+ "ns_Dev9_iSCSIChapType3": 0,
+ "ns_Dev9_iSCSIChapUsername3": "",
+ "ns_Dev9_iSCSIChapSecret3": "",
+ "ns_Dev9_iSCSIReverseChapUsername3": "",
+ "ns_Dev9_iSCSIReverseChapSecret3": "",
+ "ns_Dev9_iSCSIAttemptName4": "",
+ "ns_Dev9_iSCSIBootEnable4": 0,
+ "ns_Dev9_iSCSIIpAddressType4": 0,
+ "ns_Dev9_iSCSIConnectRetry4": 0,
+ "ns_Dev9_iSCSIConnectTimeout4": 0,
+ "ns_Dev9_iSCSIISID4": "",
+ "ns_Dev9_iSCSIInitiatorInfoViaDHCP4": 0,
+ "ns_Dev9_iSCSIInitiatorIpAddress4": "",
+ "ns_Dev9_iSCSIInitiatorNetmask4": "",
+ "ns_Dev9_iSCSIInitiatorGateway4": "",
+ "ns_Dev9_iSCSITargetInfoViaDHCP4": 0,
+ "ns_Dev9_iSCSITargetTcpPort4": 0,
+ "ns_Dev9_iSCSITargetName4": "",
+ "ns_Dev9_iSCSITargetIpAddress4": "",
+ "ns_Dev9_iSCSILUN4": "",
+ "ns_Dev9_iSCSIAuthenticationMethod4": 0,
+ "ns_Dev9_iSCSIChapType4": 0,
+ "ns_Dev9_iSCSIChapUsername4": "",
+ "ns_Dev9_iSCSIChapSecret4": "",
+ "ns_Dev9_iSCSIReverseChapUsername4": "",
+ "ns_Dev9_iSCSIReverseChapSecret4": "",
+ "ns_Dev9_iSCSIAttemptName5": "",
+ "ns_Dev9_iSCSIBootEnable5": 0,
+ "ns_Dev9_iSCSIIpAddressType5": 0,
+ "ns_Dev9_iSCSIConnectRetry5": 0,
+ "ns_Dev9_iSCSIConnectTimeout5": 0,
+ "ns_Dev9_iSCSIISID5": "",
+ "ns_Dev9_iSCSIInitiatorInfoViaDHCP5": 0,
+ "ns_Dev9_iSCSIInitiatorIpAddress5": "",
+ "ns_Dev9_iSCSIInitiatorNetmask5": "",
+ "ns_Dev9_iSCSIInitiatorGateway5": "",
+ "ns_Dev9_iSCSITargetInfoViaDHCP5": 0,
+ "ns_Dev9_iSCSITargetTcpPort5": 0,
+ "ns_Dev9_iSCSITargetName5": "",
+ "ns_Dev9_iSCSITargetIpAddress5": "",
+ "ns_Dev9_iSCSILUN5": "",
+ "ns_Dev9_iSCSIAuthenticationMethod5": 0,
+ "ns_Dev9_iSCSIChapType5": 0,
+ "ns_Dev9_iSCSIChapUsername5": "",
+ "ns_Dev9_iSCSIChapSecret5": "",
+ "ns_Dev9_iSCSIReverseChapUsername5": "",
+ "ns_Dev9_iSCSIReverseChapSecret5": "",
+ "ns_Dev9_iSCSIAttemptName6": "",
+ "ns_Dev9_iSCSIBootEnable6": 0,
+ "ns_Dev9_iSCSIIpAddressType6": 0,
+ "ns_Dev9_iSCSIConnectRetry6": 0,
+ "ns_Dev9_iSCSIConnectTimeout6": 0,
+ "ns_Dev9_iSCSIISID6": "",
+ "ns_Dev9_iSCSIInitiatorInfoViaDHCP6": 0,
+ "ns_Dev9_iSCSIInitiatorIpAddress6": "",
+ "ns_Dev9_iSCSIInitiatorNetmask6": "",
+ "ns_Dev9_iSCSIInitiatorGateway6": "",
+ "ns_Dev9_iSCSITargetInfoViaDHCP6": 0,
+ "ns_Dev9_iSCSITargetTcpPort6": 0,
+ "ns_Dev9_iSCSITargetName6": "",
+ "ns_Dev9_iSCSITargetIpAddress6": "",
+ "ns_Dev9_iSCSILUN6": "",
+ "ns_Dev9_iSCSIAuthenticationMethod6": 0,
+ "ns_Dev9_iSCSIChapType6": 0,
+ "ns_Dev9_iSCSIChapUsername6": "",
+ "ns_Dev9_iSCSIChapSecret6": "",
+ "ns_Dev9_iSCSIReverseChapUsername6": "",
+ "ns_Dev9_iSCSIReverseChapSecret6": "",
+ "ns_Dev9_iSCSIAttemptName7": "",
+ "ns_Dev9_iSCSIBootEnable7": 0,
+ "ns_Dev9_iSCSIIpAddressType7": 0,
+ "ns_Dev9_iSCSIConnectRetry7": 0,
+ "ns_Dev9_iSCSIConnectTimeout7": 0,
+ "ns_Dev9_iSCSIISID7": "",
+ "ns_Dev9_iSCSIInitiatorInfoViaDHCP7": 0,
+ "ns_Dev9_iSCSIInitiatorIpAddress7": "",
+ "ns_Dev9_iSCSIInitiatorNetmask7": "",
+ "ns_Dev9_iSCSIInitiatorGateway7": "",
+ "ns_Dev9_iSCSITargetInfoViaDHCP7": 0,
+ "ns_Dev9_iSCSITargetTcpPort7": 0,
+ "ns_Dev9_iSCSITargetName7": "",
+ "ns_Dev9_iSCSITargetIpAddress7": "",
+ "ns_Dev9_iSCSILUN7": "",
+ "ns_Dev9_iSCSIAuthenticationMethod7": 0,
+ "ns_Dev9_iSCSIChapType7": 0,
+ "ns_Dev9_iSCSIChapUsername7": "",
+ "ns_Dev9_iSCSIChapSecret7": "",
+ "ns_Dev9_iSCSIReverseChapUsername7": "",
+ "ns_Dev9_iSCSIReverseChapSecret7": "",
+ "ns_Dev9_iSCSIAttemptName8": "",
+ "ns_Dev9_iSCSIBootEnable8": 0,
+ "ns_Dev9_iSCSIIpAddressType8": 0,
+ "ns_Dev9_iSCSIConnectRetry8": 0,
+ "ns_Dev9_iSCSIConnectTimeout8": 0,
+ "ns_Dev9_iSCSIISID8": "",
+ "ns_Dev9_iSCSIInitiatorInfoViaDHCP8": 0,
+ "ns_Dev9_iSCSIInitiatorIpAddress8": "",
+ "ns_Dev9_iSCSIInitiatorNetmask8": "",
+ "ns_Dev9_iSCSIInitiatorGateway8": "",
+ "ns_Dev9_iSCSITargetInfoViaDHCP8": 0,
+ "ns_Dev9_iSCSITargetTcpPort8": 0,
+ "ns_Dev9_iSCSITargetName8": "",
+ "ns_Dev9_iSCSITargetIpAddress8": "",
+ "ns_Dev9_iSCSILUN8": "",
+ "ns_Dev9_iSCSIAuthenticationMethod8": 0,
+ "ns_Dev9_iSCSIChapType8": 0,
+ "ns_Dev9_iSCSIChapUsername8": "",
+ "ns_Dev9_iSCSIChapSecret8": "",
+ "ns_Dev9_iSCSIReverseChapUsername8": "",
+ "ns_Dev9_iSCSIReverseChapSecret8": ""
+ },
+ "@Redfish.Settings": {
+ "@odata.type": "#Settings.v1_0_4.Settings",
+ "ETag": "someetag",
+ "Messages": [
+ {
+ "MessageId": "Base.1.0.SettingsFailed",
+ "RelatedProperties": [
+ "#/Attributes/BootMode"
+ ]
+ }
+ ],
+ "SettingsObject": {
+ "@odata.id": "/redfish/v1/Systems/2M220100SL/Bios/Settings"
+ },
+ "Time": "2012-03-07T14:44.30-05:00"
+ },
+ "@odata.context": "/redfish/v1/$metadata#Bios.Bios",
+ "@odata.id": "/redfish/v1/Systems/2M220100SL/Bios",
+ "@Redfish.Copyright": "Copyright (c) 2019, Intel Corporation. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent. <BR> Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright."
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/Memory/1/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/Memory/1/index.json
new file mode 100644
index 0000000000..084b3543fa
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/Memory/1/index.json
@@ -0,0 +1,56 @@
+{
+ "@odata.context": "/redfish/v1/$metadata#Memory.Memory",
+ "@odata.id": "/redfish/v1/Systems/2M220100SL/Memory/1/",
+ "@odata.type": "#Memory.v1_7_1.Memory",
+ "Id": "1",
+ "BaseModuleType": "RDIMM",
+ "BusWidthBits": 72,
+ "CacheSizeMiB": 0,
+ "CapacityMiB": 8192,
+ "DataWidthBits": 64,
+ "DeviceLocator": "PROC 1 DIMM 1",
+ "ErrorCorrection": "MultiBitECC",
+ "LogicalSizeMiB": 0,
+ "Manufacturer": "Micron",
+ "MemoryDeviceType": "DDR4",
+ "MemoryLocation": {
+ "Channel": 6,
+ "MemoryController": 3,
+ "Slot": 1,
+ "Socket": 1
+ },
+ "MemoryMedia": [
+ "DRAM"
+ ],
+ "MemoryType": "DRAM",
+ "Name": "proc1dimm1",
+ "NonVolatileSizeMiB": 0,
+ "Oem": {
+ "Hpe": {
+ "@odata.context": "/redfish/v1/$metadata#HpeMemoryExt.HpeMemoryExt",
+ "@odata.type": "#HpeMemoryExt.v2_5_0.HpeMemoryExt",
+ "BaseModuleType": "RDIMM",
+ "DIMMStatus": "GoodInUse",
+ "MaxOperatingSpeedMTs": 3200,
+ "MinimumVoltageVoltsX10": 12,
+ "VendorName": "Micron"
+ }
+ },
+ "OperatingMemoryModes": [
+ "Volatile"
+ ],
+ "OperatingSpeedMhz": 2666,
+ "PartNumber": "9ASF1G72PZ-3G2E1",
+ "PersistentRegionSizeLimitMiB": 0,
+ "RankCount": 1,
+ "SecurityCapabilities": {},
+ "SerialNumber": "218BCAC5",
+ "Status": {
+ "Health": "OK",
+ "State": "Enabled"
+ },
+ "VendorID": "11264",
+ "VolatileRegionSizeLimitMiB": 8192,
+ "VolatileSizeMiB": 8192
+}
+
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/Memory/2/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/Memory/2/index.json
new file mode 100644
index 0000000000..87dbc82cc1
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/Memory/2/index.json
@@ -0,0 +1,46 @@
+{
+ "@odata.context": "/redfish/v1/$metadata#Memory.Memory",
+ "@odata.id": "/redfish/v1/Systems/2M220100SL/Memory/2/",
+ "@odata.type": "#Memory.v1_7_1.Memory",
+ "Id": "2",
+ "BusWidthBits": 72,
+ "CacheSizeMiB": 0,
+ "CapacityMiB": 0,
+ "DataWidthBits": 64,
+ "DeviceLocator": "PROC 1 DIMM 2",
+ "ErrorCorrection": "MultiBitECC",
+ "LogicalSizeMiB": 0,
+ "MemoryLocation": {
+ "Channel": 6,
+ "MemoryController": 3,
+ "Slot": 2,
+ "Socket": 1
+ },
+ "MemoryMedia": [
+ "DRAM"
+ ],
+ "MemoryType": "DRAM",
+ "Name": "proc1dimm2",
+ "NonVolatileSizeMiB": 0,
+ "Oem": {
+ "Hpe": {
+ "@odata.context": "/redfish/v1/$metadata#HpeMemoryExt.HpeMemoryExt",
+ "@odata.type": "#HpeMemoryExt.v2_5_0.HpeMemoryExt",
+ "DIMMStatus": "NotPresent",
+ "MinimumVoltageVoltsX10": 0
+ }
+ },
+ "OperatingMemoryModes": [
+ "Volatile"
+ ],
+ "PersistentRegionSizeLimitMiB": 0,
+ "RankCount": null,
+ "SecurityCapabilities": {},
+ "Status": {
+ "Health": "OK",
+ "State": "Absent"
+ },
+ "VendorID": "0",
+ "VolatileRegionSizeLimitMiB": 0,
+ "VolatileSizeMiB": 0
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/Memory/3/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/Memory/3/index.json
new file mode 100644
index 0000000000..1f5b6ef206
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/Memory/3/index.json
@@ -0,0 +1,46 @@
+{
+ "@odata.context": "/redfish/v1/$metadata#Memory.Memory",
+ "@odata.id": "/redfish/v1/Systems/2M220100SL/Memory/3/",
+ "@odata.type": "#Memory.v1_7_1.Memory",
+ "Id": "3",
+ "BusWidthBits": 72,
+ "CacheSizeMiB": 0,
+ "CapacityMiB": 0,
+ "DataWidthBits": 64,
+ "DeviceLocator": "PROC 1 DIMM 3",
+ "ErrorCorrection": "MultiBitECC",
+ "LogicalSizeMiB": 0,
+ "MemoryLocation": {
+ "Channel": 5,
+ "MemoryController": 3,
+ "Slot": 3,
+ "Socket": 1
+ },
+ "MemoryMedia": [
+ "DRAM"
+ ],
+ "MemoryType": "DRAM",
+ "Name": "proc1dimm3",
+ "NonVolatileSizeMiB": 0,
+ "Oem": {
+ "Hpe": {
+ "@odata.context": "/redfish/v1/$metadata#HpeMemoryExt.HpeMemoryExt",
+ "@odata.type": "#HpeMemoryExt.v2_5_0.HpeMemoryExt",
+ "DIMMStatus": "NotPresent",
+ "MinimumVoltageVoltsX10": 0
+ }
+ },
+ "OperatingMemoryModes": [
+ "Volatile"
+ ],
+ "PersistentRegionSizeLimitMiB": 0,
+ "RankCount": null,
+ "SecurityCapabilities": {},
+ "Status": {
+ "Health": "OK",
+ "State": "Absent"
+ },
+ "VendorID": "0",
+ "VolatileRegionSizeLimitMiB": 0,
+ "VolatileSizeMiB": 0
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/Memory/4/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/Memory/4/index.json
new file mode 100644
index 0000000000..d97fe2ed5a
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/Memory/4/index.json
@@ -0,0 +1,46 @@
+{
+ "@odata.context": "/redfish/v1/$metadata#Memory.Memory",
+ "@odata.id": "/redfish/v1/Systems/2M220100SL/Memory/4/",
+ "@odata.type": "#Memory.v1_7_1.Memory",
+ "Id": "4",
+ "BusWidthBits": 72,
+ "CacheSizeMiB": 0,
+ "CapacityMiB": 0,
+ "DataWidthBits": 64,
+ "DeviceLocator": "PROC 1 DIMM 4",
+ "ErrorCorrection": "MultiBitECC",
+ "LogicalSizeMiB": 0,
+ "MemoryLocation": {
+ "Channel": 5,
+ "MemoryController": 3,
+ "Slot": 4,
+ "Socket": 1
+ },
+ "MemoryMedia": [
+ "DRAM"
+ ],
+ "MemoryType": "DRAM",
+ "Name": "proc1dimm4",
+ "NonVolatileSizeMiB": 0,
+ "Oem": {
+ "Hpe": {
+ "@odata.context": "/redfish/v1/$metadata#HpeMemoryExt.HpeMemoryExt",
+ "@odata.type": "#HpeMemoryExt.v2_5_0.HpeMemoryExt",
+ "DIMMStatus": "NotPresent",
+ "MinimumVoltageVoltsX10": 0
+ }
+ },
+ "OperatingMemoryModes": [
+ "Volatile"
+ ],
+ "PersistentRegionSizeLimitMiB": 0,
+ "RankCount": null,
+ "SecurityCapabilities": {},
+ "Status": {
+ "Health": "OK",
+ "State": "Absent"
+ },
+ "VendorID": "0",
+ "VolatileRegionSizeLimitMiB": 0,
+ "VolatileSizeMiB": 0
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/Memory/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/Memory/index.json
new file mode 100644
index 0000000000..cebddce076
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/Memory/index.json
@@ -0,0 +1,22 @@
+{
+ "@odata.context": "/redfish/v1/$metadata#MemoryCollection.MemoryCollection",
+ "@odata.id": "/redfish/v1/Systems/2M220100SL/Memory",
+ "@odata.type": "#MemoryCollection.MemoryCollection",
+ "Description": "Memory DIMM Collection",
+ "Name": "Memory DIMM Collection",
+ "Members": [
+ {
+ "@odata.id": "/redfish/v1/Systems/2M220100SL/Memory/1"
+ },
+ {
+ "@odata.id": "/redfish/v1/Systems/2M220100SL/Memory/2"
+ },
+ {
+ "@odata.id": "/redfish/v1/Systems/2M220100SL/Memory/3"
+ },
+ {
+ "@odata.id": "/redfish/v1/Systems/2M220100SL/Memory/4"
+ }
+ ],
+ "Members@odata.count": 4
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/index.json
index 814f5f6373..dbba691302 100644
--- a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/index.json
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/index.json
@@ -10,7 +10,7 @@
"SKU": "867530",
"PartNumber": "224071-J23",
"Description": "Catfish Implementation Recipe of simple scale-out monolithic server",
- "UUID": "00000000-0000-0000-0000-000000000000",
+ "UUID": "badfaced-aaaa-beef-1313-131313131313",
"HostName": "catfishHostname",
"PowerState": "On",
"BiosVersion": "X00.1.2.3.4(build-23)",
@@ -34,9 +34,15 @@
"UefiHttp"
]
},
+ "Bios": {
+ "@odata.id": "/redfish/v1/Systems/2M220100SL/Bios"
+ },
"LogServices": {
"@odata.id": "/redfish/v1/Systems/2M220100SL/LogServices"
},
+ "Memory": {
+ "@odata.id": "/redfish/v1/Systems/2M220100SL/Memory"
+ },
"Links": {
"Chassis": [
{
@@ -66,5 +72,5 @@
},
"@odata.context": "/redfish/v1/$metadata#ComputerSystem.ComputerSystem",
"@odata.id": "/redfish/v1/Systems/2M220100SL",
- "@Redfish.Copyright": "Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright."
+ "@Redfish.Copyright": "Copyright (c) 2019, Intel Corporation. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent. <BR> Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright."
}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/Bios/Settings/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/Bios/Settings/index.json
new file mode 100644
index 0000000000..fa2786d6f5
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/Bios/Settings/index.json
@@ -0,0 +1,13 @@
+{
+ "@odata.type": "#Bios.v1_0_2.Bios",
+ "Id": "SD",
+ "Name": "BIOS Configuration Pending Settings",
+ "Description": "BIOS Configuration Pending Settings. These settings will be applied on next system reboot.",
+ "AttributeRegistry": "/redfish/v1/Registries/BiosAttributeRegistryUefiKeyword.v1_0_0",
+ "Attributes": {
+ "xUEFIns_Dev0006_iSCSIInitiatorName": "iqn.test.init"
+ },
+ "@odata.context": "/redfish/v1/$metadata#Bios.Bios",
+ "@odata.id": "/redfish/v1/Systems/2M220101SL/Bios/Settings",
+ "@Redfish.Copyright": "Copyright (c) 2019, Intel Corporation. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent. <BR> Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright."
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/Bios/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/Bios/index.json
new file mode 100644
index 0000000000..db56911d7f
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/Bios/index.json
@@ -0,0 +1,17 @@
+{
+ "@odata.type": "#Bios.v1_0_2.Bios",
+ "Id": "Bios",
+ "Name": "BIOS Configuration Current Settings",
+ "Description": "BIOS Configuration Current Settings.",
+ "AttributeRegistry": "/redfish/v1/Registries/BiosAttributeRegistryUefiKeyword.v1_0_0",
+ "Attributes": {},
+ "@Redfish.Settings": {
+ "@odata.type": "#Settings.v1_0_4.Settings",
+ "SettingsObject": {
+ "@odata.id": "/redfish/v1/Systems/2M220101SL/Bios/Settings"
+ }
+ },
+ "@odata.context": "/redfish/v1/$metadata#Bios.Bios",
+ "@odata.id": "/redfish/v1/Systems/2M220101SL/Bios",
+ "@Redfish.Copyright": "Copyright (c) 2019, Intel Corporation. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent."
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/BootOptions/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/BootOptions/index.json
new file mode 100644
index 0000000000..06940176bb
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/BootOptions/index.json
@@ -0,0 +1,10 @@
+{
+ "@Redfish.Copyright": "Copyright (c) 2019, Intel Corporation. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent.",
+ "@odata.context": "/redfish/v1/$metadata#BootOptionCollection.BootOptionCollection",
+ "@odata.id": "/redfish/v1/Systems/2M220101SL/BootOptions",
+ "@odata.type": "#BootOptionCollection.BootOptionCollection",
+ "Name": "UEFI Boot Options Collection",
+ "Members@odata.count": 0,
+ "Members": [
+ ]
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/LogServices/SEL/Entries/1/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/LogServices/SEL/Entries/1/index.json
new file mode 100644
index 0000000000..bbd86ec2b9
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/LogServices/SEL/Entries/1/index.json
@@ -0,0 +1,28 @@
+{
+ "@odata.type": "#LogEntry.v1_0_2.LogEntry",
+ "Id": "1",
+ "Name": "Log Entry 1",
+ "EntryType": "SEL",
+ "OemRecordFormat": "CompanyX",
+ "RecordId": 1,
+ "Severity": "Critical",
+ "Created": "2012-03-07T14:44",
+ "EntryCode": "Assert",
+ "SensorType": "Temperature",
+ "SensorNumber": 1,
+ "Message": "Message for Event, Description for SEL, OEM depends",
+ "MessageId": "Event.1.0.TempAssert",
+ "MessageArgs": [
+ "ArrayOfMessageArgs"
+ ],
+ "Links": {
+ "OriginOfCondition": {
+ "@odata.id": "/redfish/v1/Chassis/1/Thermal"
+ },
+ "Oem": {}
+ },
+ "Oem": {},
+ "@odata.context": "/redfish/v1/$metadata#LogEntry.LogEntry",
+ "@odata.id": "/redfish/v1/Systems/2M220101SL/LogServices/SEL/Entries/1",
+ "@Redfish.Copyright":"Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright."
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/LogServices/SEL/Entries/2/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/LogServices/SEL/Entries/2/index.json
new file mode 100644
index 0000000000..b5d54973b7
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/LogServices/SEL/Entries/2/index.json
@@ -0,0 +1,28 @@
+{
+ "@odata.type": "#LogEntry.v1_0_2.LogEntry",
+ "Id": "2",
+ "Name": "Log Entry 2",
+ "EntryType": "SEL",
+ "OEMRecordFormat": "CompanyX",
+ "RecordId": 2,
+ "Severity": "Critical",
+ "Created": "2012-03-07T14:45",
+ "EntryCode": "Assert",
+ "SensorType": "Temperature",
+ "SensorNumber": 2,
+ "Message": "Message for Event, Description for SEL, OEM depends",
+ "MessageId": "Event.1.0.TempAssert",
+ "MessageArgs": [
+ "ArrayOfMessageArgs"
+ ],
+ "Links": {
+ "OriginOfCondition": {
+ "@odata.id": "/redfish/v1/Chassis/1/Thermal"
+ },
+ "Oem": {}
+ },
+ "Oem": {},
+ "@odata.context": "/redfish/v1/$metadata#LogEntry.LogEntry",
+ "@odata.id": "/redfish/v1/Systems/2M220101SL/LogServices/SEL/Entries/2",
+ "@Redfish.Copyright":"Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright."
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/LogServices/SEL/Entries/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/LogServices/SEL/Entries/index.json
new file mode 100644
index 0000000000..85477cdc7f
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/LogServices/SEL/Entries/index.json
@@ -0,0 +1,64 @@
+{
+ "@odata.type": "#LogEntryCollection.LogEntryCollection",
+ "Name": "Log Service Collection",
+ "Description": "Collection of Logs for this System",
+ "Members@odata.count": 2,
+ "Members": [
+ {
+ "@odata.type": "#LogEntry.v1_0_2.LogEntry",
+ "Id": "1",
+ "Name": "Log Entry 1",
+ "EntryType": "SEL",
+ "OemRecordFormat": "CompanyX",
+ "RecordId": 1,
+ "Severity": "Critical",
+ "Created": "2012-03-07T14:44",
+ "EntryCode": "Assert",
+ "SensorType": "Temperature",
+ "Number": 1,
+ "Message": "Message for Event, Description for SEL, OEM depends",
+ "MessageId": "Event.1.0.TempAssert",
+ "MessageArgs": [
+ "ArrayOfMessageArgs"
+ ],
+ "Links": {
+ "OriginOfCondition": {
+ "@odata.id": "/redfish/v1/Chassis/1/Thermal"
+ },
+ "Oem": {}
+ },
+ "Oem": {},
+ "@odata.id": "/redfish/v1/Systems/2M220101SL/LogServices/SEL/Entries/1"
+ },
+ {
+ "@odata.type": "#LogEntry.v1_0_2.LogEntry",
+ "Id": "2",
+ "Name": "Log Entry 2",
+ "EntryType": "SEL",
+ "OEMRecordFormat": "CompanyX",
+ "RecordId": 2,
+ "Severity": "Critical",
+ "Created": "2012-03-07T14:45",
+ "EntryCode": "Assert",
+ "SensorType": "Temperature",
+ "Number": 2,
+ "Message": "Message for Event, Description for SEL, OEM depends",
+ "MessageId": "Event.1.0.TempAssert",
+ "MessageArgs": [
+ "ArrayOfMessageArgs"
+ ],
+ "Links": {
+ "OriginOfCondition": {
+ "@odata.id": "/redfish/v1/Chassis/1/Thermal"
+ },
+ "Oem": {}
+ },
+ "Oem": {},
+ "@odata.id": "/redfish/v1/Systems/2M220101SL/LogServices/SEL/Entries/2"
+ }
+ ],
+ "@odata.nextLink": "/redfish/v1/Systems/2M220101SL/LogServices/SEL/Entries?$skiptoken=2",
+ "@odata.context": "/redfish/v1/$metadata#LogEntryCollection.LogEntryCollection",
+ "@odata.id": "/redfish/v1/Systems/2M220101SL/LogServices/SEL/Entries",
+ "@Redfish.Copyright":"Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright."
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/LogServices/SEL/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/LogServices/SEL/index.json
new file mode 100644
index 0000000000..8a72dd3aca
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/LogServices/SEL/index.json
@@ -0,0 +1,27 @@
+{
+ "@odata.type": "#LogService.v1_0_2.LogService",
+ "Id": "SEL",
+ "Name": "System Log Service",
+ "MaxNumberOfRecords": 1000,
+ "OverWritePolicy": "WrapsWhenFull",
+ "DateTime": "2015-03-13T04:14:33+06:00",
+ "DateTimeLocalOffset": "+06:00",
+ "ServiceEnabled": true,
+ "Status": {
+ "State": "Enabled",
+ "Health": "OK"
+ },
+ "Oem": {},
+ "Actions": {
+ "#LogService.ClearLog": {
+ "target": "/redfish/v1/Systems/2M220101SL/LogServices/SEL/Actions/LogService.Reset"
+ },
+ "Oem": {}
+ },
+ "Entries": {
+ "@odata.id": "/redfish/v1/Systems/2M220101SL/LogServices/SEL/Entries"
+ },
+ "@odata.context": "/redfish/v1/$metadata#LogService.LogService",
+ "@odata.id": "/redfish/v1/Systems/2M220101SL/LogServices/SEL",
+ "@Redfish.Copyright": "Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright."
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/LogServices/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/LogServices/index.json
new file mode 100644
index 0000000000..db754eded0
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/LogServices/index.json
@@ -0,0 +1,15 @@
+{
+ "@odata.type": "#LogServiceCollection.LogServiceCollection",
+ "Name": "Log Service Collection",
+ "Description": "Collection of Logs for this System",
+ "Members@odata.count": 1,
+ "Members": [
+ {
+ "@odata.id": "/redfish/v1/Systems/2M220101SL/LogServices/SEL"
+ }
+ ],
+ "Oem": {},
+ "@odata.context": "/redfish/v1/$metadata#LogServiceCollection.LogServiceCollection",
+ "@odata.id": "/redfish/v1/Systems/2M220101SL/LogServices",
+ "@Redfish.Copyright": "Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright."
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/Memory/_backup/1/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/Memory/_backup/1/index.json
new file mode 100644
index 0000000000..3504d7b1d0
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/Memory/_backup/1/index.json
@@ -0,0 +1,56 @@
+{
+ "@odata.context": "/redfish/v1/$metadata#Memory.Memory",
+ "@odata.id": "/redfish/v1/Systems/2M220101SL/Memory/1/",
+ "@odata.type": "#Memory.v1_7_1.Memory",
+ "Id": "1",
+ "BaseModuleType": "RDIMM",
+ "BusWidthBits": 72,
+ "CacheSizeMiB": 0,
+ "CapacityMiB": 8192,
+ "DataWidthBits": 64,
+ "DeviceLocator": "PROC 1 DIMM 1",
+ "ErrorCorrection": "MultiBitECC",
+ "LogicalSizeMiB": 0,
+ "Manufacturer": "Micron",
+ "MemoryDeviceType": "DDR4",
+ "MemoryLocation": {
+ "Channel": 6,
+ "MemoryController": 3,
+ "Slot": 1,
+ "Socket": 1
+ },
+ "MemoryMedia": [
+ "DRAM"
+ ],
+ "MemoryType": "DRAM",
+ "Name": "proc1dimm1",
+ "NonVolatileSizeMiB": 0,
+ "Oem": {
+ "Hpe": {
+ "@odata.context": "/redfish/v1/$metadata#HpeMemoryExt.HpeMemoryExt",
+ "@odata.type": "#HpeMemoryExt.v2_5_0.HpeMemoryExt",
+ "BaseModuleType": "RDIMM",
+ "DIMMStatus": "GoodInUse",
+ "MaxOperatingSpeedMTs": 3200,
+ "MinimumVoltageVoltsX10": 12,
+ "VendorName": "Micron"
+ }
+ },
+ "OperatingMemoryModes": [
+ "Volatile"
+ ],
+ "OperatingSpeedMhz": 2666,
+ "PartNumber": "9ASF1G72PZ-3G2E1",
+ "PersistentRegionSizeLimitMiB": 0,
+ "RankCount": 1,
+ "SecurityCapabilities": {},
+ "SerialNumber": "218BCAC5",
+ "Status": {
+ "Health": "OK",
+ "State": "Enabled"
+ },
+ "VendorID": "11264",
+ "VolatileRegionSizeLimitMiB": 8192,
+ "VolatileSizeMiB": 8192
+}
+
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/Memory/_backup/2/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/Memory/_backup/2/index.json
new file mode 100644
index 0000000000..979a9e22f2
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/Memory/_backup/2/index.json
@@ -0,0 +1,46 @@
+{
+ "@odata.context": "/redfish/v1/$metadata#Memory.Memory",
+ "@odata.id": "/redfish/v1/Systems/2M220101SL/Memory/2/",
+ "@odata.type": "#Memory.v1_7_1.Memory",
+ "Id": "2",
+ "BusWidthBits": 72,
+ "CacheSizeMiB": 0,
+ "CapacityMiB": 0,
+ "DataWidthBits": 64,
+ "DeviceLocator": "PROC 1 DIMM 2",
+ "ErrorCorrection": "MultiBitECC",
+ "LogicalSizeMiB": 0,
+ "MemoryLocation": {
+ "Channel": 6,
+ "MemoryController": 3,
+ "Slot": 2,
+ "Socket": 1
+ },
+ "MemoryMedia": [
+ "DRAM"
+ ],
+ "MemoryType": "DRAM",
+ "Name": "proc1dimm2",
+ "NonVolatileSizeMiB": 0,
+ "Oem": {
+ "Hpe": {
+ "@odata.context": "/redfish/v1/$metadata#HpeMemoryExt.HpeMemoryExt",
+ "@odata.type": "#HpeMemoryExt.v2_5_0.HpeMemoryExt",
+ "DIMMStatus": "NotPresent",
+ "MinimumVoltageVoltsX10": 0
+ }
+ },
+ "OperatingMemoryModes": [
+ "Volatile"
+ ],
+ "PersistentRegionSizeLimitMiB": 0,
+ "RankCount": null,
+ "SecurityCapabilities": {},
+ "Status": {
+ "Health": "OK",
+ "State": "Absent"
+ },
+ "VendorID": "0",
+ "VolatileRegionSizeLimitMiB": 0,
+ "VolatileSizeMiB": 0
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/Memory/_backup/3/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/Memory/_backup/3/index.json
new file mode 100644
index 0000000000..504640a0cc
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/Memory/_backup/3/index.json
@@ -0,0 +1,46 @@
+{
+ "@odata.context": "/redfish/v1/$metadata#Memory.Memory",
+ "@odata.id": "/redfish/v1/Systems/2M220101SL/Memory/3/",
+ "@odata.type": "#Memory.v1_7_1.Memory",
+ "Id": "3",
+ "BusWidthBits": 72,
+ "CacheSizeMiB": 0,
+ "CapacityMiB": 0,
+ "DataWidthBits": 64,
+ "DeviceLocator": "PROC 1 DIMM 3",
+ "ErrorCorrection": "MultiBitECC",
+ "LogicalSizeMiB": 0,
+ "MemoryLocation": {
+ "Channel": 5,
+ "MemoryController": 3,
+ "Slot": 3,
+ "Socket": 1
+ },
+ "MemoryMedia": [
+ "DRAM"
+ ],
+ "MemoryType": "DRAM",
+ "Name": "proc1dimm3",
+ "NonVolatileSizeMiB": 0,
+ "Oem": {
+ "Hpe": {
+ "@odata.context": "/redfish/v1/$metadata#HpeMemoryExt.HpeMemoryExt",
+ "@odata.type": "#HpeMemoryExt.v2_5_0.HpeMemoryExt",
+ "DIMMStatus": "NotPresent",
+ "MinimumVoltageVoltsX10": 0
+ }
+ },
+ "OperatingMemoryModes": [
+ "Volatile"
+ ],
+ "PersistentRegionSizeLimitMiB": 0,
+ "RankCount": null,
+ "SecurityCapabilities": {},
+ "Status": {
+ "Health": "OK",
+ "State": "Absent"
+ },
+ "VendorID": "0",
+ "VolatileRegionSizeLimitMiB": 0,
+ "VolatileSizeMiB": 0
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/Memory/_backup/4/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/Memory/_backup/4/index.json
new file mode 100644
index 0000000000..fda1d59da5
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/Memory/_backup/4/index.json
@@ -0,0 +1,46 @@
+{
+ "@odata.context": "/redfish/v1/$metadata#Memory.Memory",
+ "@odata.id": "/redfish/v1/Systems/2M220101SL/Memory/4/",
+ "@odata.type": "#Memory.v1_7_1.Memory",
+ "Id": "4",
+ "BusWidthBits": 72,
+ "CacheSizeMiB": 0,
+ "CapacityMiB": 0,
+ "DataWidthBits": 64,
+ "DeviceLocator": "PROC 1 DIMM 4",
+ "ErrorCorrection": "MultiBitECC",
+ "LogicalSizeMiB": 0,
+ "MemoryLocation": {
+ "Channel": 5,
+ "MemoryController": 3,
+ "Slot": 4,
+ "Socket": 1
+ },
+ "MemoryMedia": [
+ "DRAM"
+ ],
+ "MemoryType": "DRAM",
+ "Name": "proc1dimm4",
+ "NonVolatileSizeMiB": 0,
+ "Oem": {
+ "Hpe": {
+ "@odata.context": "/redfish/v1/$metadata#HpeMemoryExt.HpeMemoryExt",
+ "@odata.type": "#HpeMemoryExt.v2_5_0.HpeMemoryExt",
+ "DIMMStatus": "NotPresent",
+ "MinimumVoltageVoltsX10": 0
+ }
+ },
+ "OperatingMemoryModes": [
+ "Volatile"
+ ],
+ "PersistentRegionSizeLimitMiB": 0,
+ "RankCount": null,
+ "SecurityCapabilities": {},
+ "Status": {
+ "Health": "OK",
+ "State": "Absent"
+ },
+ "VendorID": "0",
+ "VolatileRegionSizeLimitMiB": 0,
+ "VolatileSizeMiB": 0
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/Memory/_backup/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/Memory/_backup/index.json
new file mode 100644
index 0000000000..250773f6ad
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/Memory/_backup/index.json
@@ -0,0 +1,22 @@
+{
+ "@odata.context": "/redfish/v1/$metadata#MemoryCollection.MemoryCollection",
+ "@odata.id": "/redfish/v1/Systems/2M220101SL/Memory",
+ "@odata.type": "#MemoryCollection.MemoryCollection",
+ "Description": "Memory DIMM Collection",
+ "Name": "Memory DIMM Collection",
+ "Members": [
+ {
+ "@odata.id": "/redfish/v1/Systems/2M220101SL/Memory/1"
+ },
+ {
+ "@odata.id": "/redfish/v1/Systems/2M220101SL/Memory/2"
+ },
+ {
+ "@odata.id": "/redfish/v1/Systems/2M220101SL/Memory/3"
+ },
+ {
+ "@odata.id": "/redfish/v1/Systems/2M220101SL/Memory/4"
+ }
+ ],
+ "Members@odata.count": 4
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/Memory/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/Memory/index.json
new file mode 100644
index 0000000000..4f76c9a965
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/Memory/index.json
@@ -0,0 +1,10 @@
+{
+ "@odata.context": "/redfish/v1/$metadata#MemoryCollection.MemoryCollection",
+ "@odata.id": "/redfish/v1/Systems/2M220101SL/Memory",
+ "@odata.type": "#MemoryCollection.MemoryCollection",
+ "Description": "Memory DIMM Collection",
+ "Name": "Memory DIMM Collection",
+ "Members": [
+ ],
+ "Members@odata.count": 0
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/index.json
new file mode 100644
index 0000000000..3147cb8827
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/index.json
@@ -0,0 +1,82 @@
+{
+ "@odata.type": "#ComputerSystem.v1_1_0.ComputerSystem",
+ "Id": "2M220101SL",
+ "Name": "Catfish System",
+ "SystemType": "Physical",
+ "AssetTag": "CATFISHASSETTAG",
+ "Manufacturer": "CatfishManufacturer",
+ "Model": "YellowCat1000",
+ "SerialNumber": "2M220101SL",
+ "SKU": "",
+ "PartNumber": "",
+ "Description": "Catfish Implementation Recipe of simple scale-out monolithic server",
+ "UUID": "BADFACED-DEAD-BEEF-1313-131313131313",
+ "HostName": "catfishHostname",
+ "PowerState": "On",
+ "BiosVersion": "X00.1.2.3.4(build-23)",
+ "Status": {
+ "State": "Enabled",
+ "Health": "OK"
+ },
+ "IndicatorLED": "Off",
+ "Boot": {
+ "BootSourceOverrideEnabled": "Once",
+ "BootSourceOverrideMode": "UEFI",
+ "BootOptions": {
+ "@odata.id": "/redfish/v1/Systems/2M220101SL/BootOptions"
+ },
+ "BootSourceOverrideTarget": "UefiBootNext",
+ "BootNext": "",
+ "BootOrder": [
+ ],
+ "BootSourceOverrideTarget@Redfish.AllowableValues": [
+ "None",
+ "Pxe",
+ "Usb",
+ "Hdd",
+ "BiosSetup",
+ "UefiTarget",
+ "UefiHttp",
+ "UefiBootNext"
+ ]
+ },
+ "Bios": {
+ "@odata.id": "/redfish/v1/Systems/2M220101SL/Bios"
+ },
+ "LogServices": {
+ "@odata.id": "/redfish/v1/Systems/2M220101SL/LogServices"
+ },
+ "Memory": {
+ "@odata.id": "/redfish/v1/Systems/2M220101SL/Memory"
+ },
+ "Links": {
+ "Chassis": [
+ {
+ "@odata.id": "/redfish/v1/Chassis/A33"
+ }
+ ],
+ "ManagedBy": [
+ {
+ "@odata.id": "/redfish/v1/Managers/bmc"
+ }
+ ],
+ "Oem": {}
+ },
+ "Actions": {
+ "#ComputerSystem.Reset": {
+ "target": "/redfish/v1/Systems/2M220101SL/Actions/ComputerSystem.Reset",
+ "ResetType@Redfish.AllowableValues": [
+ "On",
+ "ForceOff",
+ "GracefulShutdown",
+ "ForceRestart",
+ "Nmi",
+ "GracefulRestart",
+ "ForceOn"
+ ]
+ }
+ },
+ "@odata.context": "/redfish/v1/$metadata#ComputerSystem.ComputerSystem",
+ "@odata.id": "/redfish/v1/Systems/2M220101SL",
+ "@Redfish.Copyright": "Copyright (c) 2019, Intel Corporation. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent. <BR> Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright."
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102SL/Bios/Settings/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102SL/Bios/Settings/index.json
new file mode 100644
index 0000000000..086f534c60
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102SL/Bios/Settings/index.json
@@ -0,0 +1,31 @@
+{
+ "@odata.type": "#Bios.v1_0_2.Bios",
+ "Id": "SD",
+ "Name": "BIOS Configuration Pending Settings",
+ "Description": "BIOS Configuration Pending Settings. These settings will be applied on next system reboot.",
+ "AttributeRegistry": "/redfish/v1/Registries/BiosAttributeRegistryUefiKeyword.v1_0_0",
+ "Attributes": {
+ "ns_Dev9_iSCSIInitiatorName": "iqn.test.init",
+ "ns_Dev9_iSCSIMacAddr": "8C:DC:D4:26:C9:74",
+ "ns_Dev9_iSCSIAddAttempts": "attempt:2",
+ "ns_Dev9_iSCSIAttemptName2": "Attempt 2",
+ "ns_Dev9_iSCSIBootEnable2": 1,
+ "ns_Dev9_iSCSIIpAddressType2": 0,
+ "ns_Dev9_iSCSIConnectRetry2": 5,
+ "ns_Dev9_iSCSIConnectTimeout2": 300,
+ "ns_Dev9_iSCSIISID2": "0CDCD4654321",
+ "ns_Dev9_iSCSIInitiatorIpAddress2": "192.168.111.101",
+ "ns_Dev9_iSCSIInitiatorNetmask2": "255.255.255.0",
+ "ns_Dev9_iSCSIInitiatorGateway2": "192.168.111.1",
+ "ns_Dev9_iSCSITargetTcpPort2": 3260,
+ "ns_Dev9_iSCSITargetName2": "iqn.2016-06:067",
+ "ns_Dev9_iSCSITargetIpAddress2": "192.168.111.1",
+ "ns_Dev9_iSCSILUN2": "0",
+ "ns_Dev9_iSCSIInitiatorInfoViaDHCP2": 0,
+ "ns_Dev9_iSCSIAuthenticationMethod2": 0,
+ "ns_Dev9_iSCSIChapType2": 0
+ },
+ "@odata.context": "/redfish/v1/$metadata#Bios.Bios",
+ "@odata.id": "/redfish/v1/Systems/2M220102SL/Bios/SD",
+ "@Redfish.Copyright": "Copyright (c) 2019, Intel Corporation. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent. <BR> Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright."
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102SL/Bios/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102SL/Bios/index.json
new file mode 100644
index 0000000000..b758584470
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102SL/Bios/index.json
@@ -0,0 +1,202 @@
+{
+ "@odata.type": "#Bios.v1_0_2.Bios",
+ "Id": "Bios",
+ "Name": "BIOS Configuration Current Settings",
+ "Description": "BIOS Configuration Current Settings",
+ "AttributeRegistry": "/redfish/v1/Registries/BiosAttributeRegistryUefiKeyword.v1_0_0",
+ "Attributes": {
+ "ns_Dev9_iSCSIInitiatorName": "iqn.test.init",
+ "ns_Dev9_iSCSIMacAddr": "8C:DC:D4:26:C9:74",
+ "ns_Dev9_iSCSIAttemptOrder": "",
+ "ns_Dev9_iSCSIAddAttempts": "",
+ "ns_Dev9_iSCSIDeleteAttempts": "",
+ "ns_Dev9_iSCSIDisplayAttemptList": "Attempt:2 ",
+ "ns_Dev9_iSCSIAttemptName1": "",
+ "ns_Dev9_iSCSIBootEnable1": 0,
+ "ns_Dev9_iSCSIIpAddressType1": 0,
+ "ns_Dev9_iSCSIConnectRetry1": 0,
+ "ns_Dev9_iSCSIConnectTimeout1": 0,
+ "ns_Dev9_iSCSIISID1": "",
+ "ns_Dev9_iSCSIInitiatorInfoViaDHCP1": 0,
+ "ns_Dev9_iSCSIInitiatorIpAddress1": "",
+ "ns_Dev9_iSCSIInitiatorNetmask1": "",
+ "ns_Dev9_iSCSIInitiatorGateway1": "",
+ "ns_Dev9_iSCSITargetInfoViaDHCP1": 0,
+ "ns_Dev9_iSCSITargetTcpPort1": 0,
+ "ns_Dev9_iSCSITargetName1": "",
+ "ns_Dev9_iSCSITargetIpAddress1": "",
+ "ns_Dev9_iSCSILUN1": "",
+ "ns_Dev9_iSCSIAuthenticationMethod1": 0,
+ "ns_Dev9_iSCSIChapType1": 0,
+ "ns_Dev9_iSCSIChapUsername1": "",
+ "ns_Dev9_iSCSIChapSecret1": "",
+ "ns_Dev9_iSCSIReverseChapUsername1": "",
+ "ns_Dev9_iSCSIReverseChapSecret1": "",
+ "ns_Dev9_iSCSIAttemptName2": "Attempt 2",
+ "ns_Dev9_iSCSIBootEnable2": 0,
+ "ns_Dev9_iSCSIIpAddressType2": 0,
+ "ns_Dev9_iSCSIConnectRetry2": 5,
+ "ns_Dev9_iSCSIConnectTimeout2": 300,
+ "ns_Dev9_iSCSIISID2": "0CDCD4654321",
+ "ns_Dev9_iSCSIInitiatorInfoViaDHCP2": 0,
+ "ns_Dev9_iSCSIInitiatorIpAddress2": "192.168.1.188",
+ "ns_Dev9_iSCSIInitiatorNetmask2": "255.255.255.0",
+ "ns_Dev9_iSCSIInitiatorGateway2": "192.168.1.177",
+ "ns_Dev9_iSCSITargetInfoViaDHCP2": 0,
+ "ns_Dev9_iSCSITargetTcpPort2": 3260,
+ "ns_Dev9_iSCSITargetName2": "iqn.test.target",
+ "ns_Dev9_iSCSITargetIpAddress2": "192.168.1.155",
+ "ns_Dev9_iSCSILUN2": "1",
+ "ns_Dev9_iSCSIAuthenticationMethod2": 0,
+ "ns_Dev9_iSCSIChapType2": 0,
+ "ns_Dev9_iSCSIChapUsername2": "",
+ "ns_Dev9_iSCSIChapSecret2": "",
+ "ns_Dev9_iSCSIReverseChapUsername2": "",
+ "ns_Dev9_iSCSIReverseChapSecret2": "",
+ "ns_Dev9_iSCSIAttemptName3": "",
+ "ns_Dev9_iSCSIBootEnable3": 0,
+ "ns_Dev9_iSCSIIpAddressType3": 0,
+ "ns_Dev9_iSCSIConnectRetry3": 0,
+ "ns_Dev9_iSCSIConnectTimeout3": 0,
+ "ns_Dev9_iSCSIISID3": "",
+ "ns_Dev9_iSCSIInitiatorInfoViaDHCP3": 0,
+ "ns_Dev9_iSCSIInitiatorIpAddress3": "",
+ "ns_Dev9_iSCSIInitiatorNetmask3": "",
+ "ns_Dev9_iSCSIInitiatorGateway3": "",
+ "ns_Dev9_iSCSITargetInfoViaDHCP3": 0,
+ "ns_Dev9_iSCSITargetTcpPort3": 0,
+ "ns_Dev9_iSCSITargetName3": "",
+ "ns_Dev9_iSCSITargetIpAddress3": "",
+ "ns_Dev9_iSCSILUN3": "",
+ "ns_Dev9_iSCSIAuthenticationMethod3": 0,
+ "ns_Dev9_iSCSIChapType3": 0,
+ "ns_Dev9_iSCSIChapUsername3": "",
+ "ns_Dev9_iSCSIChapSecret3": "",
+ "ns_Dev9_iSCSIReverseChapUsername3": "",
+ "ns_Dev9_iSCSIReverseChapSecret3": "",
+ "ns_Dev9_iSCSIAttemptName4": "",
+ "ns_Dev9_iSCSIBootEnable4": 0,
+ "ns_Dev9_iSCSIIpAddressType4": 0,
+ "ns_Dev9_iSCSIConnectRetry4": 0,
+ "ns_Dev9_iSCSIConnectTimeout4": 0,
+ "ns_Dev9_iSCSIISID4": "",
+ "ns_Dev9_iSCSIInitiatorInfoViaDHCP4": 0,
+ "ns_Dev9_iSCSIInitiatorIpAddress4": "",
+ "ns_Dev9_iSCSIInitiatorNetmask4": "",
+ "ns_Dev9_iSCSIInitiatorGateway4": "",
+ "ns_Dev9_iSCSITargetInfoViaDHCP4": 0,
+ "ns_Dev9_iSCSITargetTcpPort4": 0,
+ "ns_Dev9_iSCSITargetName4": "",
+ "ns_Dev9_iSCSITargetIpAddress4": "",
+ "ns_Dev9_iSCSILUN4": "",
+ "ns_Dev9_iSCSIAuthenticationMethod4": 0,
+ "ns_Dev9_iSCSIChapType4": 0,
+ "ns_Dev9_iSCSIChapUsername4": "",
+ "ns_Dev9_iSCSIChapSecret4": "",
+ "ns_Dev9_iSCSIReverseChapUsername4": "",
+ "ns_Dev9_iSCSIReverseChapSecret4": "",
+ "ns_Dev9_iSCSIAttemptName5": "",
+ "ns_Dev9_iSCSIBootEnable5": 0,
+ "ns_Dev9_iSCSIIpAddressType5": 0,
+ "ns_Dev9_iSCSIConnectRetry5": 0,
+ "ns_Dev9_iSCSIConnectTimeout5": 0,
+ "ns_Dev9_iSCSIISID5": "",
+ "ns_Dev9_iSCSIInitiatorInfoViaDHCP5": 0,
+ "ns_Dev9_iSCSIInitiatorIpAddress5": "",
+ "ns_Dev9_iSCSIInitiatorNetmask5": "",
+ "ns_Dev9_iSCSIInitiatorGateway5": "",
+ "ns_Dev9_iSCSITargetInfoViaDHCP5": 0,
+ "ns_Dev9_iSCSITargetTcpPort5": 0,
+ "ns_Dev9_iSCSITargetName5": "",
+ "ns_Dev9_iSCSITargetIpAddress5": "",
+ "ns_Dev9_iSCSILUN5": "",
+ "ns_Dev9_iSCSIAuthenticationMethod5": 0,
+ "ns_Dev9_iSCSIChapType5": 0,
+ "ns_Dev9_iSCSIChapUsername5": "",
+ "ns_Dev9_iSCSIChapSecret5": "",
+ "ns_Dev9_iSCSIReverseChapUsername5": "",
+ "ns_Dev9_iSCSIReverseChapSecret5": "",
+ "ns_Dev9_iSCSIAttemptName6": "",
+ "ns_Dev9_iSCSIBootEnable6": 0,
+ "ns_Dev9_iSCSIIpAddressType6": 0,
+ "ns_Dev9_iSCSIConnectRetry6": 0,
+ "ns_Dev9_iSCSIConnectTimeout6": 0,
+ "ns_Dev9_iSCSIISID6": "",
+ "ns_Dev9_iSCSIInitiatorInfoViaDHCP6": 0,
+ "ns_Dev9_iSCSIInitiatorIpAddress6": "",
+ "ns_Dev9_iSCSIInitiatorNetmask6": "",
+ "ns_Dev9_iSCSIInitiatorGateway6": "",
+ "ns_Dev9_iSCSITargetInfoViaDHCP6": 0,
+ "ns_Dev9_iSCSITargetTcpPort6": 0,
+ "ns_Dev9_iSCSITargetName6": "",
+ "ns_Dev9_iSCSITargetIpAddress6": "",
+ "ns_Dev9_iSCSILUN6": "",
+ "ns_Dev9_iSCSIAuthenticationMethod6": 0,
+ "ns_Dev9_iSCSIChapType6": 0,
+ "ns_Dev9_iSCSIChapUsername6": "",
+ "ns_Dev9_iSCSIChapSecret6": "",
+ "ns_Dev9_iSCSIReverseChapUsername6": "",
+ "ns_Dev9_iSCSIReverseChapSecret6": "",
+ "ns_Dev9_iSCSIAttemptName7": "",
+ "ns_Dev9_iSCSIBootEnable7": 0,
+ "ns_Dev9_iSCSIIpAddressType7": 0,
+ "ns_Dev9_iSCSIConnectRetry7": 0,
+ "ns_Dev9_iSCSIConnectTimeout7": 0,
+ "ns_Dev9_iSCSIISID7": "",
+ "ns_Dev9_iSCSIInitiatorInfoViaDHCP7": 0,
+ "ns_Dev9_iSCSIInitiatorIpAddress7": "",
+ "ns_Dev9_iSCSIInitiatorNetmask7": "",
+ "ns_Dev9_iSCSIInitiatorGateway7": "",
+ "ns_Dev9_iSCSITargetInfoViaDHCP7": 0,
+ "ns_Dev9_iSCSITargetTcpPort7": 0,
+ "ns_Dev9_iSCSITargetName7": "",
+ "ns_Dev9_iSCSITargetIpAddress7": "",
+ "ns_Dev9_iSCSILUN7": "",
+ "ns_Dev9_iSCSIAuthenticationMethod7": 0,
+ "ns_Dev9_iSCSIChapType7": 0,
+ "ns_Dev9_iSCSIChapUsername7": "",
+ "ns_Dev9_iSCSIChapSecret7": "",
+ "ns_Dev9_iSCSIReverseChapUsername7": "",
+ "ns_Dev9_iSCSIReverseChapSecret7": "",
+ "ns_Dev9_iSCSIAttemptName8": "",
+ "ns_Dev9_iSCSIBootEnable8": 0,
+ "ns_Dev9_iSCSIIpAddressType8": 0,
+ "ns_Dev9_iSCSIConnectRetry8": 0,
+ "ns_Dev9_iSCSIConnectTimeout8": 0,
+ "ns_Dev9_iSCSIISID8": "",
+ "ns_Dev9_iSCSIInitiatorInfoViaDHCP8": 0,
+ "ns_Dev9_iSCSIInitiatorIpAddress8": "",
+ "ns_Dev9_iSCSIInitiatorNetmask8": "",
+ "ns_Dev9_iSCSIInitiatorGateway8": "",
+ "ns_Dev9_iSCSITargetInfoViaDHCP8": 0,
+ "ns_Dev9_iSCSITargetTcpPort8": 0,
+ "ns_Dev9_iSCSITargetName8": "",
+ "ns_Dev9_iSCSITargetIpAddress8": "",
+ "ns_Dev9_iSCSILUN8": "",
+ "ns_Dev9_iSCSIAuthenticationMethod8": 0,
+ "ns_Dev9_iSCSIChapType8": 0,
+ "ns_Dev9_iSCSIChapUsername8": "",
+ "ns_Dev9_iSCSIChapSecret8": "",
+ "ns_Dev9_iSCSIReverseChapUsername8": "",
+ "ns_Dev9_iSCSIReverseChapSecret8": ""
+ },
+ "@Redfish.Settings": {
+ "@odata.type": "#Settings.v1_0_4.Settings",
+ "ETag": "someetag",
+ "Messages": [
+ {
+ "MessageId": "Base.1.0.SettingsFailed",
+ "RelatedProperties": [
+ "#/Attributes/BootMode"
+ ]
+ }
+ ],
+ "SettingsObject": {
+ "@odata.id": "/redfish/v1/Systems/2M220102SL/Bios/Settings"
+ },
+ "Time": "2012-03-07T14:44.30-05:00"
+ },
+ "@odata.context": "/redfish/v1/$metadata#Bios.Bios",
+ "@odata.id": "/redfish/v1/Systems/2M220102SL/Bios",
+ "@Redfish.Copyright": "Copyright (c) 2019, Intel Corporation. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent. <BR> Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright."
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102SL/LogServices/SEL/Entries/1/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102SL/LogServices/SEL/Entries/1/index.json
new file mode 100644
index 0000000000..bc04581973
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102SL/LogServices/SEL/Entries/1/index.json
@@ -0,0 +1,28 @@
+{
+ "@odata.type": "#LogEntry.v1_0_2.LogEntry",
+ "Id": "1",
+ "Name": "Log Entry 1",
+ "EntryType": "SEL",
+ "OemRecordFormat": "CompanyX",
+ "RecordId": 1,
+ "Severity": "Critical",
+ "Created": "2012-03-07T14:44",
+ "EntryCode": "Assert",
+ "SensorType": "Temperature",
+ "SensorNumber": 1,
+ "Message": "Message for Event, Description for SEL, OEM depends",
+ "MessageId": "Event.1.0.TempAssert",
+ "MessageArgs": [
+ "ArrayOfMessageArgs"
+ ],
+ "Links": {
+ "OriginOfCondition": {
+ "@odata.id": "/redfish/v1/Chassis/1/Thermal"
+ },
+ "Oem": {}
+ },
+ "Oem": {},
+ "@odata.context": "/redfish/v1/$metadata#LogEntry.LogEntry",
+ "@odata.id": "/redfish/v1/Systems/2M220102SL/LogServices/SEL/Entries/1",
+ "@Redfish.Copyright":"Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright."
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102SL/LogServices/SEL/Entries/2/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102SL/LogServices/SEL/Entries/2/index.json
new file mode 100644
index 0000000000..f4d8e1dbbe
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102SL/LogServices/SEL/Entries/2/index.json
@@ -0,0 +1,28 @@
+{
+ "@odata.type": "#LogEntry.v1_0_2.LogEntry",
+ "Id": "2",
+ "Name": "Log Entry 2",
+ "EntryType": "SEL",
+ "OEMRecordFormat": "CompanyX",
+ "RecordId": 2,
+ "Severity": "Critical",
+ "Created": "2012-03-07T14:45",
+ "EntryCode": "Assert",
+ "SensorType": "Temperature",
+ "SensorNumber": 2,
+ "Message": "Message for Event, Description for SEL, OEM depends",
+ "MessageId": "Event.1.0.TempAssert",
+ "MessageArgs": [
+ "ArrayOfMessageArgs"
+ ],
+ "Links": {
+ "OriginOfCondition": {
+ "@odata.id": "/redfish/v1/Chassis/1/Thermal"
+ },
+ "Oem": {}
+ },
+ "Oem": {},
+ "@odata.context": "/redfish/v1/$metadata#LogEntry.LogEntry",
+ "@odata.id": "/redfish/v1/Systems/2M220102SL/LogServices/SEL/Entries/2",
+ "@Redfish.Copyright":"Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright."
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102SL/LogServices/SEL/Entries/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102SL/LogServices/SEL/Entries/index.json
new file mode 100644
index 0000000000..5ecd92a9d3
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102SL/LogServices/SEL/Entries/index.json
@@ -0,0 +1,64 @@
+{
+ "@odata.type": "#LogEntryCollection.LogEntryCollection",
+ "Name": "Log Service Collection",
+ "Description": "Collection of Logs for this System",
+ "Members@odata.count": 2,
+ "Members": [
+ {
+ "@odata.type": "#LogEntry.v1_0_2.LogEntry",
+ "Id": "1",
+ "Name": "Log Entry 1",
+ "EntryType": "SEL",
+ "OemRecordFormat": "CompanyX",
+ "RecordId": 1,
+ "Severity": "Critical",
+ "Created": "2012-03-07T14:44",
+ "EntryCode": "Assert",
+ "SensorType": "Temperature",
+ "Number": 1,
+ "Message": "Message for Event, Description for SEL, OEM depends",
+ "MessageId": "Event.1.0.TempAssert",
+ "MessageArgs": [
+ "ArrayOfMessageArgs"
+ ],
+ "Links": {
+ "OriginOfCondition": {
+ "@odata.id": "/redfish/v1/Chassis/1/Thermal"
+ },
+ "Oem": {}
+ },
+ "Oem": {},
+ "@odata.id": "/redfish/v1/Systems/2M220102SL/LogServices/SEL/Entries/1"
+ },
+ {
+ "@odata.type": "#LogEntry.v1_0_2.LogEntry",
+ "Id": "2",
+ "Name": "Log Entry 2",
+ "EntryType": "SEL",
+ "OEMRecordFormat": "CompanyX",
+ "RecordId": 2,
+ "Severity": "Critical",
+ "Created": "2012-03-07T14:45",
+ "EntryCode": "Assert",
+ "SensorType": "Temperature",
+ "Number": 2,
+ "Message": "Message for Event, Description for SEL, OEM depends",
+ "MessageId": "Event.1.0.TempAssert",
+ "MessageArgs": [
+ "ArrayOfMessageArgs"
+ ],
+ "Links": {
+ "OriginOfCondition": {
+ "@odata.id": "/redfish/v1/Chassis/1/Thermal"
+ },
+ "Oem": {}
+ },
+ "Oem": {},
+ "@odata.id": "/redfish/v1/Systems/2M220102SL/LogServices/SEL/Entries/2"
+ }
+ ],
+ "@odata.nextLink": "/redfish/v1/Systems/2M220102SL/LogServices/SEL/Entries?$skiptoken=2",
+ "@odata.context": "/redfish/v1/$metadata#LogEntryCollection.LogEntryCollection",
+ "@odata.id": "/redfish/v1/Systems/2M220102SL/LogServices/SEL/Entries",
+ "@Redfish.Copyright":"Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright."
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102SL/LogServices/SEL/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102SL/LogServices/SEL/index.json
new file mode 100644
index 0000000000..f0444e82b8
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102SL/LogServices/SEL/index.json
@@ -0,0 +1,27 @@
+{
+ "@odata.type": "#LogService.v1_0_2.LogService",
+ "Id": "SEL",
+ "Name": "System Log Service",
+ "MaxNumberOfRecords": 1000,
+ "OverWritePolicy": "WrapsWhenFull",
+ "DateTime": "2015-03-13T04:14:33+06:00",
+ "DateTimeLocalOffset": "+06:00",
+ "ServiceEnabled": true,
+ "Status": {
+ "State": "Enabled",
+ "Health": "OK"
+ },
+ "Oem": {},
+ "Actions": {
+ "#LogService.ClearLog": {
+ "target": "/redfish/v1/Systems/2M220102SL/LogServices/SEL/Actions/LogService.Reset"
+ },
+ "Oem": {}
+ },
+ "Entries": {
+ "@odata.id": "/redfish/v1/Systems/2M220102SL/LogServices/SEL/Entries"
+ },
+ "@odata.context": "/redfish/v1/$metadata#LogService.LogService",
+ "@odata.id": "/redfish/v1/Systems/2M220102SL/LogServices/SEL",
+ "@Redfish.Copyright": "Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright."
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102SL/LogServices/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102SL/LogServices/index.json
new file mode 100644
index 0000000000..7c57266193
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102SL/LogServices/index.json
@@ -0,0 +1,15 @@
+{
+ "@odata.type": "#LogServiceCollection.LogServiceCollection",
+ "Name": "Log Service Collection",
+ "Description": "Collection of Logs for this System",
+ "Members@odata.count": 1,
+ "Members": [
+ {
+ "@odata.id": "/redfish/v1/Systems/2M220102SL/LogServices/SEL"
+ }
+ ],
+ "Oem": {},
+ "@odata.context": "/redfish/v1/$metadata#LogServiceCollection.LogServiceCollection",
+ "@odata.id": "/redfish/v1/Systems/2M220102SL/LogServices",
+ "@Redfish.Copyright": "Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright."
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102SL/Memory/1/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102SL/Memory/1/index.json
new file mode 100644
index 0000000000..3f4909f47f
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102SL/Memory/1/index.json
@@ -0,0 +1,56 @@
+{
+ "@odata.context": "/redfish/v1/$metadata#Memory.Memory",
+ "@odata.id": "/redfish/v1/Systems/2M220102SL/Memory/1/",
+ "@odata.type": "#Memory.v1_7_1.Memory",
+ "Id": "1",
+ "BaseModuleType": "RDIMM",
+ "BusWidthBits": 72,
+ "CacheSizeMiB": 0,
+ "CapacityMiB": 8192,
+ "DataWidthBits": 64,
+ "DeviceLocator": "PROC 1 DIMM 1",
+ "ErrorCorrection": "MultiBitECC",
+ "LogicalSizeMiB": 0,
+ "Manufacturer": "Micron",
+ "MemoryDeviceType": "DDR4",
+ "MemoryLocation": {
+ "Channel": 6,
+ "MemoryController": 3,
+ "Slot": 1,
+ "Socket": 1
+ },
+ "MemoryMedia": [
+ "DRAM"
+ ],
+ "MemoryType": "DRAM",
+ "Name": "proc1dimm1",
+ "NonVolatileSizeMiB": 0,
+ "Oem": {
+ "Hpe": {
+ "@odata.context": "/redfish/v1/$metadata#HpeMemoryExt.HpeMemoryExt",
+ "@odata.type": "#HpeMemoryExt.v2_5_0.HpeMemoryExt",
+ "BaseModuleType": "RDIMM",
+ "DIMMStatus": "GoodInUse",
+ "MaxOperatingSpeedMTs": 3200,
+ "MinimumVoltageVoltsX10": 12,
+ "VendorName": "Micron"
+ }
+ },
+ "OperatingMemoryModes": [
+ "Volatile"
+ ],
+ "OperatingSpeedMhz": 2666,
+ "PartNumber": "9ASF1G72PZ-3G2E1",
+ "PersistentRegionSizeLimitMiB": 0,
+ "RankCount": 1,
+ "SecurityCapabilities": {},
+ "SerialNumber": "218BCAC5",
+ "Status": {
+ "Health": "OK",
+ "State": "Enabled"
+ },
+ "VendorID": "11264",
+ "VolatileRegionSizeLimitMiB": 8192,
+ "VolatileSizeMiB": 8192
+}
+
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102SL/Memory/2/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102SL/Memory/2/index.json
new file mode 100644
index 0000000000..8318079a06
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102SL/Memory/2/index.json
@@ -0,0 +1,46 @@
+{
+ "@odata.context": "/redfish/v1/$metadata#Memory.Memory",
+ "@odata.id": "/redfish/v1/Systems/2M220102SL/Memory/2/",
+ "@odata.type": "#Memory.v1_7_1.Memory",
+ "Id": "2",
+ "BusWidthBits": 72,
+ "CacheSizeMiB": 0,
+ "CapacityMiB": 0,
+ "DataWidthBits": 64,
+ "DeviceLocator": "PROC 1 DIMM 2",
+ "ErrorCorrection": "MultiBitECC",
+ "LogicalSizeMiB": 0,
+ "MemoryLocation": {
+ "Channel": 6,
+ "MemoryController": 3,
+ "Slot": 2,
+ "Socket": 1
+ },
+ "MemoryMedia": [
+ "DRAM"
+ ],
+ "MemoryType": "DRAM",
+ "Name": "proc1dimm2",
+ "NonVolatileSizeMiB": 0,
+ "Oem": {
+ "Hpe": {
+ "@odata.context": "/redfish/v1/$metadata#HpeMemoryExt.HpeMemoryExt",
+ "@odata.type": "#HpeMemoryExt.v2_5_0.HpeMemoryExt",
+ "DIMMStatus": "NotPresent",
+ "MinimumVoltageVoltsX10": 0
+ }
+ },
+ "OperatingMemoryModes": [
+ "Volatile"
+ ],
+ "PersistentRegionSizeLimitMiB": 0,
+ "RankCount": null,
+ "SecurityCapabilities": {},
+ "Status": {
+ "Health": "OK",
+ "State": "Absent"
+ },
+ "VendorID": "0",
+ "VolatileRegionSizeLimitMiB": 0,
+ "VolatileSizeMiB": 0
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102SL/Memory/3/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102SL/Memory/3/index.json
new file mode 100644
index 0000000000..e9387ceb8e
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102SL/Memory/3/index.json
@@ -0,0 +1,46 @@
+{
+ "@odata.context": "/redfish/v1/$metadata#Memory.Memory",
+ "@odata.id": "/redfish/v1/Systems/2M220102SL/Memory/3/",
+ "@odata.type": "#Memory.v1_7_1.Memory",
+ "Id": "3",
+ "BusWidthBits": 72,
+ "CacheSizeMiB": 0,
+ "CapacityMiB": 0,
+ "DataWidthBits": 64,
+ "DeviceLocator": "PROC 1 DIMM 3",
+ "ErrorCorrection": "MultiBitECC",
+ "LogicalSizeMiB": 0,
+ "MemoryLocation": {
+ "Channel": 5,
+ "MemoryController": 3,
+ "Slot": 3,
+ "Socket": 1
+ },
+ "MemoryMedia": [
+ "DRAM"
+ ],
+ "MemoryType": "DRAM",
+ "Name": "proc1dimm3",
+ "NonVolatileSizeMiB": 0,
+ "Oem": {
+ "Hpe": {
+ "@odata.context": "/redfish/v1/$metadata#HpeMemoryExt.HpeMemoryExt",
+ "@odata.type": "#HpeMemoryExt.v2_5_0.HpeMemoryExt",
+ "DIMMStatus": "NotPresent",
+ "MinimumVoltageVoltsX10": 0
+ }
+ },
+ "OperatingMemoryModes": [
+ "Volatile"
+ ],
+ "PersistentRegionSizeLimitMiB": 0,
+ "RankCount": null,
+ "SecurityCapabilities": {},
+ "Status": {
+ "Health": "OK",
+ "State": "Absent"
+ },
+ "VendorID": "0",
+ "VolatileRegionSizeLimitMiB": 0,
+ "VolatileSizeMiB": 0
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102SL/Memory/4/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102SL/Memory/4/index.json
new file mode 100644
index 0000000000..d4af4cf50e
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102SL/Memory/4/index.json
@@ -0,0 +1,46 @@
+{
+ "@odata.context": "/redfish/v1/$metadata#Memory.Memory",
+ "@odata.id": "/redfish/v1/Systems/2M220102SL/Memory/4/",
+ "@odata.type": "#Memory.v1_7_1.Memory",
+ "Id": "4",
+ "BusWidthBits": 72,
+ "CacheSizeMiB": 0,
+ "CapacityMiB": 0,
+ "DataWidthBits": 64,
+ "DeviceLocator": "PROC 1 DIMM 4",
+ "ErrorCorrection": "MultiBitECC",
+ "LogicalSizeMiB": 0,
+ "MemoryLocation": {
+ "Channel": 5,
+ "MemoryController": 3,
+ "Slot": 4,
+ "Socket": 1
+ },
+ "MemoryMedia": [
+ "DRAM"
+ ],
+ "MemoryType": "DRAM",
+ "Name": "proc1dimm4",
+ "NonVolatileSizeMiB": 0,
+ "Oem": {
+ "Hpe": {
+ "@odata.context": "/redfish/v1/$metadata#HpeMemoryExt.HpeMemoryExt",
+ "@odata.type": "#HpeMemoryExt.v2_5_0.HpeMemoryExt",
+ "DIMMStatus": "NotPresent",
+ "MinimumVoltageVoltsX10": 0
+ }
+ },
+ "OperatingMemoryModes": [
+ "Volatile"
+ ],
+ "PersistentRegionSizeLimitMiB": 0,
+ "RankCount": null,
+ "SecurityCapabilities": {},
+ "Status": {
+ "Health": "OK",
+ "State": "Absent"
+ },
+ "VendorID": "0",
+ "VolatileRegionSizeLimitMiB": 0,
+ "VolatileSizeMiB": 0
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102SL/Memory/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102SL/Memory/index.json
new file mode 100644
index 0000000000..0bf30eed44
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102SL/Memory/index.json
@@ -0,0 +1,22 @@
+{
+ "@odata.context": "/redfish/v1/$metadata#MemoryCollection.MemoryCollection",
+ "@odata.id": "/redfish/v1/Systems/2M220102SL/Memory",
+ "@odata.type": "#MemoryCollection.MemoryCollection",
+ "Description": "Memory DIMM Collection",
+ "Name": "Memory DIMM Collection",
+ "Members": [
+ {
+ "@odata.id": "/redfish/v1/Systems/2M220102SL/Memory/1"
+ },
+ {
+ "@odata.id": "/redfish/v1/Systems/2M220102SL/Memory/2"
+ },
+ {
+ "@odata.id": "/redfish/v1/Systems/2M220102SL/Memory/3"
+ },
+ {
+ "@odata.id": "/redfish/v1/Systems/2M220102SL/Memory/4"
+ }
+ ],
+ "Members@odata.count": 4
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102SL/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102SL/index.json
new file mode 100644
index 0000000000..49b2d25f53
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102SL/index.json
@@ -0,0 +1,76 @@
+{
+ "@odata.type": "#ComputerSystem.v1_1_0.ComputerSystem",
+ "Id": "2M220102SL",
+ "Name": "Catfish System",
+ "SystemType": "Physical",
+ "AssetTag": "CATFISHASSETTAG",
+ "Manufacturer": "CatfishManufacturer",
+ "Model": "YellowCat1000",
+ "SerialNumber": "2M220102SL",
+ "SKU": "",
+ "PartNumber": "",
+ "Description": "Catfish Implementation Recipe of simple scale-out monolithic server",
+ "UUID": "badfaced-5555-beef-1313-131313131313",
+ "HostName": "catfishHostname",
+ "PowerState": "On",
+ "BiosVersion": "X00.1.2.3.4(build-23)",
+ "Status": {
+ "State": "Enabled",
+ "Health": "OK"
+ },
+ "IndicatorLED": "Off",
+ "Boot": {
+ "BootSourceOverrideEnabled": "Once",
+ "BootSourceOverrideMode": "UEFI",
+ "UefiTargetBootSourceOverride": "uefiDevicePath",
+ "BootSourceOverrideTarget": "Pxe",
+ "BootSourceOverrideTarget@Redfish.AllowableValues": [
+ "None",
+ "Pxe",
+ "Usb",
+ "Hdd",
+ "BiosSetup",
+ "UefiTarget",
+ "UefiHttp"
+ ]
+ },
+ "Bios": {
+ "@odata.id": "/redfish/v1/Systems/2M220102SL/Bios"
+ },
+ "LogServices": {
+ "@odata.id": "/redfish/v1/Systems/2M220102SL/LogServices"
+ },
+ "Memory": {
+ "@odata.id": "/redfish/v1/Systems/2M220102SL/Memory"
+ },
+ "Links": {
+ "Chassis": [
+ {
+ "@odata.id": "/redfish/v1/Chassis/A33"
+ }
+ ],
+ "ManagedBy": [
+ {
+ "@odata.id": "/redfish/v1/Managers/bmc"
+ }
+ ],
+ "Oem": {}
+ },
+ "Actions": {
+ "#ComputerSystem.Reset": {
+ "target": "/redfish/v1/Systems/2M220102SL/Actions/ComputerSystem.Reset",
+ "ResetType@Redfish.AllowableValues": [
+ "On",
+ "ForceOff",
+ "GracefulShutdown",
+ "ForceRestart",
+ "Nmi",
+ "GracefulRestart",
+ "ForceOn"
+ ]
+ }
+ },
+ "@odata.context": "/redfish/v1/$metadata#ComputerSystem.ComputerSystem",
+ "@odata.id": "/redfish/v1/Systems/2M220102SL",
+ "@Redfish.Copyright": "Copyright (c) 2019, Intel Corporation. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent. <BR> Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright."
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/index.json
index 091849e1a6..e5aaea38bf 100644
--- a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/index.json
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/index.json
@@ -1,13 +1,19 @@
{
"@odata.type": "#ComputerSystemCollection.ComputerSystemCollection",
"Name": "Computer System Collection",
- "Members@odata.count": 1,
+ "Members@odata.count": 3,
"Members": [
{
"@odata.id": "/redfish/v1/Systems/2M220100SL"
+ },
+ {
+ "@odata.id": "/redfish/v1/Systems/2M220101SL"
+ },
+ {
+ "@odata.id": "/redfish/v1/Systems/2M220102SL"
}
],
"@odata.context": "/redfish/v1/$metadata#ComputerSystemCollection.ComputerSystemCollection",
"@odata.id": "/redfish/v1/Systems",
- "@Redfish.Copyright": "Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright."
+ "@Redfish.Copyright": "Copyright (c) 2019, Intel Corporation. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent. <BR> Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright."
}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/index.json
index 89312bcec1..b2d3dda6ca 100644
--- a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/index.json
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/index.json
@@ -3,7 +3,7 @@
"Id": "RootService",
"Name": "Root Service",
"RedfishVersion": "1.0.2",
- "UUID": "92384634-2938-2342-8820-489239905423",
+ "UUID": "3FB208AC-2185-498C-BF46-DC23DA587B55",
"Systems": {
"@odata.id": "/redfish/v1/Systems"
},
@@ -19,6 +19,9 @@
"AccountService": {
"@odata.id": "/redfish/v1/AccountService"
},
+ "Registries": {
+ "@odata.id": "/redfish/v1/Registries"
+ },
"Links": {
"Sessions": {
"@odata.id": "/redfish/v1/SessionService/Sessions"
@@ -27,5 +30,5 @@
"Oem": {},
"@odata.context": "/redfish/v1/$metadata#ServiceRoot.ServiceRoot",
"@odata.id": "/redfish/v1/",
- "@Redfish.Copyright": "Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright."
+ "@Redfish.Copyright": "Copyright (c) 2019, Intel Corporation. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent. <BR> Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright."
}
--
2.17.1


Re: [staging/edk2-redfish-client Tools PATCH 1/6] RedfishClientPkg/Tools: Initial commit of Redfish Profile Simulator

Nickle Wang
 

Reviewed-by: Nickle Wang <nickle.wang@hpe.com>

What git SHA version that we forked here? Do we keep git version information in our README? I think it would be useful to know which version that we forked from DMTF repository later.

Thanks,
Nickle

-----Original Message-----
From: Chang, Abner (HPS SW/FW Technologist) <abner.chang@hpe.com>
Sent: Thursday, July 22, 2021 2:08 PM
To: devel@edk2.groups.io
Cc: Wang, Nickle (HPS SW) <nickle.wang@hpe.com>; Liming Gao <gaoliming@byosoft.com.cn>
Subject: [staging/edk2-redfish-client Tools PATCH 1/6] RedfishClientPkg/Tools: Initial commit of Redfish Profile Simulator

This is an open source project on DMTF GitHub.
(https://github.com/DMTF/Redfish-Profile-Simulator)
This tool simulates the HTTP request methods (POST, PATCH, PUT, GET) on
Redfish resource maintained by Redfish Profile Simulator.
EDK2 open source uses this simulator for the use case when Redfish service
has not been set up on the platform, or for the quick Redfish firmware
feature development.

We clone this project under RedfishClientPkg and maintain it by edk2
because this project has currently been using and updating rarely.
That is easier for edk2 to add features to the simulator or modify the
simulator to align with edk2 requirement on Redfish service.

The license of this tool is on the term of BSD 3-Clause License.
Refer to LICENSE.md.

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Nickle Wang <nickle.wang@hpe.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
---
.../Redfish-Profile-Simulator/AUTHORS.md | 2 +
.../Redfish-Profile-Simulator/CHANGELOG.md | 15 +
.../Redfish-Profile-Simulator/LICENSE.md | 57 ++++
.../Tools/Redfish-Profile-Simulator/README.md | 96 ++++++
.../SimpleOcpServerV1/redfish/index.json | 3 +
.../redfish/v1/$metadata/index.xml | 147 +++++++++
.../v1/AccountService/Accounts/index.json | 19 ++
.../AccountService/Accounts/jane/index.json | 19 ++
.../AccountService/Accounts/john/index.json | 19 ++
.../AccountService/Accounts/root/index.json | 19 ++
.../v1/AccountService/Roles/Admin/index.json | 17 +
.../AccountService/Roles/Operator/index.json | 15 +
.../Roles/ReadOnlyUser/index.json | 13 +
.../v1/AccountService/Roles/index.json | 19 ++
.../redfish/v1/AccountService/index.json | 25 ++
.../redfish/v1/Chassis/A33/Power/index.json | 28 ++
.../redfish/v1/Chassis/A33/Thermal/index.json | 150 +++++++++
.../redfish/v1/Chassis/A33/index.json | 46 +++
.../redfish/v1/Chassis/index.json | 13 +
.../bmc/EthernetInterfaces/eth0/index.json | 60 ++++
.../bmc/EthernetInterfaces/index.json | 15 +
.../Managers/bmc/NetworkProtocol/index.json | 47 +++
.../redfish/v1/Managers/bmc/index.json | 53 +++
.../redfish/v1/Managers/index.json | 13 +
.../Sessions/SESSION123456/index.json | 10 +
.../v1/SessionService/Sessions/index.json | 12 +
.../redfish/v1/SessionService/index.json | 17 +
.../LogServices/SEL/Entries/1/index.json | 27 ++
.../LogServices/SEL/Entries/2/index.json | 27 ++
.../LogServices/SEL/Entries/index.json | 62 ++++
.../2M220100SL/LogServices/SEL/index.json | 27 ++
.../Systems/2M220100SL/LogServices/index.json | 15 +
.../redfish/v1/Systems/2M220100SL/index.json | 70 ++++
.../redfish/v1/Systems/index.json | 13 +
.../SimpleOcpServerV1/redfish/v1/index.json | 31 ++
.../redfish/v1/odata/index.json | 56 ++++
.../redfishProfileSimulator.py | 125 +++++++
.../v1sim/__init__.py | 4 +
.../v1sim/accountService.py | 76 +++++
.../v1sim/chassis.py | 115 +++++++
.../v1sim/common_services.py | 28 ++
.../v1sim/flask_redfish_auth.py | 278 ++++++++++++++++
.../v1sim/managers.py | 211 ++++++++++++
.../v1sim/network.py | 48 +++
.../v1sim/redfishURIs.py | 309 ++++++++++++++++++
.../v1sim/resource.py | 100 ++++++
.../v1sim/security.py | 35 ++
.../v1sim/serviceRoot.py | 87 +++++
.../v1sim/serviceVersions.py | 9 +
.../v1sim/sessionService.py | 41 +++
.../v1sim/storage.py | 116 +++++++
.../v1sim/systems.py | 198 +++++++++++
.../v1sim/updateService.py | 84 +++++
53 files changed, 3141 insertions(+)
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/AUTHORS.md
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/CHANGELOG.md
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/LICENSE.md
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/README.md
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/$metadata/index.xml
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/AccountService/Accounts/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/AccountService/Accounts/jane/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/AccountService/Accounts/john/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/AccountService/Accounts/root/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/AccountService/Roles/Admin/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/AccountService/Roles/Operator/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/AccountService/Roles/ReadOnlyUser/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/AccountService/Roles/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/AccountService/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Chassis/A33/Power/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Chassis/A33/Thermal/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Chassis/A33/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Chassis/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Managers/bmc/EthernetInterfaces/eth0/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Managers/bmc/EthernetInterfaces/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Managers/bmc/NetworkProtocol/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Managers/bmc/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Managers/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/SessionService/Sessions/SESSION123456/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/SessionService/Sessions/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/SessionService/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/LogServices/SEL/Entries/1/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/LogServices/SEL/Entries/2/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/LogServices/SEL/Entries/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/LogServices/SEL/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/LogServices/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/odata/index.json
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/redfishProfileSimulator.py
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/__init__.py
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/accountService.py
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/chassis.py
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/common_services.py
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/flask_redfish_auth.py
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/managers.py
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/network.py
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/redfishURIs.py
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/resource.py
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/security.py
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/serviceRoot.py
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/serviceVersions.py
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/sessionService.py
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/storage.py
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/systems.py
create mode 100644 RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/updateService.py

diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/AUTHORS.md b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/AUTHORS.md
new file mode 100644
index 0000000000..536f67e918
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/AUTHORS.md
@@ -0,0 +1,2 @@
+# Original Contribution:
+* Paul Vancil - Dell Inc. -- Dell Extreme Scale Infrastructure (ESI) Architecture Team
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/CHANGELOG.md b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/CHANGELOG.md
new file mode 100644
index 0000000000..38bb8685d1
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/CHANGELOG.md
@@ -0,0 +1,15 @@
+# Change Log
+
+## [0.9.6] - 2018-05-25
+- Fixed setuptools config to install all necessary Python modules
+- Enabled OpenBMC Static OBmcMonolythicPower8
+- Made simulator more generic to support other mockups
+- Fixed several properties in the Computer System resource
+- Fixed Content-Type header when returning XML
+
+## [0.9.2] - 2016-12-08
+- Fixex code to work with late change in mockup data. It was failing to load
+- Fixed incomplete code in systems.py modeling logs
+
+## [0.9.1] - 2016-09-06
+- Initial Public Release
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/LICENSE.md b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/LICENSE.md
new file mode 100644
index 0000000000..18e3361b0d
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/LICENSE.md
@@ -0,0 +1,57 @@
+The Distributed Management Task Force (DMTF) grants rights under copyright in
+this software on the terms of the BSD 3-Clause License as set forth below; no
+other rights are granted by DMTF. This software might be subject to other rights
+(such as patent rights) of other parties.
+
+
+### Copyrights.
+
+Copyright (c) 2016, Contributing Member(s) of Distributed Management Task Force,
+Inc.. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, this
+list of conditions and the following disclaimer in the documentation and/or
+other materials provided with the distribution.
+* Neither the name of the Distributed Management Task Force (DMTF) nor the names
+of its contributors may be used to endorse or promote products derived from this
+software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+### Patents.
+
+This software may be subject to third party patent rights, including provisional
+patent rights ("patent rights"). DMTF makes no representations to users of the
+standard as to the existence of such rights, and is not responsible to
+recognize, disclose, or identify any or all such third party patent right,
+owners or claimants, nor for any incomplete or inaccurate identification or
+disclosure of such rights, owners or claimants. DMTF shall have no liability to
+any party, in any manner or circumstance, under any legal theory whatsoever, for
+failure to recognize, disclose, or identify any such third party patent rights,
+or for such party's reliance on the software or incorporation thereof in its
+product, protocols or testing procedures. DMTF shall have no liability to any
+party using such software, whether such use is foreseeable or not, nor to any
+patent owner or claimant, and shall have no liability or responsibility for
+costs or losses incurred if software is withdrawn or modified after publication,
+and shall be indemnified and held harmless by any party using the software from
+any and all claims of infringement by a patent owner for such use.
+
+DMTF Members that contributed to this software source code might have made
+patent licensing commitments in connection with their participation in the DMTF.
+For details, see http://dmtf.org/sites/default/files/patent-10-18-01.pdf and
+http://www.dmtf.org/about/policies/disclosures.
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/README.md b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/README.md
new file mode 100644
index 0000000000..660938f880
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/README.md
@@ -0,0 +1,96 @@
+Copyright 2016-2018 Distributed Management Task Force, Inc. All rights reserved.
+
+# Redfish Profile Simulator
+
+## About
+
+***Redfish Profile Simulator*** is a Python34 real simulator of the "simple monolithic server" feature profile.
+
+* A simple, minimal Redfish Service
+* For a monolithic Server
+* Aligned with: OCP Remote Machine Management Spec feature set
+
+### Description
+
+* Based on flask
+* Initial resources are loaded from a catfish mockup into python dictionary structures
+ * After that, data is read/patched... to the dictionaries
+* Supports BasicAuth, as well as Redfish Session Auth (for one session, one user)
+* Uses:
+ * easy to add new URIs for testing a client
+ * easy to tweak behavior or add bad responses to test a client
+ * allows testing of authentication -- which current mockup servers dont do
+ * easy to insert print statements in service to see if data coming across good..etc
+
+### Current Limitation:
+
+* supports a single user/passwd and token
+* the user/passwd is: root/password123456
+* The authToken for Session Auth is: 123456SESSIONauthcode
+* Supports only HTTP (not HTTPS)
+* with redfishtool, use options: redfishtool.py -r127.0.0.1:5000 -u root -p password123456 -S Never <subcmd>
+
+## Usage
+
+* ` python redfishProfileSimulatorMain.py [options]`
+* `[Options]`:
+
+ -V, --Version,--- the program version
+ -h, --help, --- help
+ -H<hostIP>, --Host=<hostIp> --- host IP address. dflt=127.0.0.1
+ -P<port>,--Port=<port> --- the port to use. dflt=5000
+ -p<profile_path>, --profile=<profile_path> --- the path to the Redfish profile to use. dflt="SimpleOcpServerV1"
+
+## Implementation
+
+* The simulation includes an http server, RestEngine, and dynamic Redfish datamodel.
+* You can GET, PATCH,... to the service just like a real Redfish service.
+* Both Basic and Redfish Session/Token authentication are supported
+ * for a single user/passwd and token
+ * the user/passwd is: root/password123456
+ * The authToken for Session Auth is: 123456SESSIONauthcode
+ * these can be changed by editing the redfishURSs.py file---will make dynamic later.
+* The http service and Rest engine is built on Flask, and all code is Python 3.4+
+* The data model resources are "initialized" from the SPMF "SimpleOcpServerV1" Mockup.
+ * and stored as python dictionaries
+ * then the dictionaries are updated with patches, posts, deletes.
+* The program can be extended to support other mockup \"profiles\".
+* By default, the simulation runs on localhost (127.0.0.1), on port 5000.
+ * These can be changed with CLI options: -P<port> -H <hostIP> | --port=<port> --host=<hostIp>
+
+## Simple OCP Server V1 Mockup Description
+
+* A Monolithic server:
+ * One ComputerSystem
+ * One Chassis
+ * One Manager
+
+* Provides basic management features aligned with OCP Remote Machine Management Spec 1.01:
+ * Power-on/off/reset
+ * Boot to PXE, HDD, BIOS setup (boot override)
+ * 4 temp sensors per DCMI (CPU1, CPU2, Board, Inlet)
+ * Simple Power Reading, and DCMI Power Limiting
+ * Fan Monitoring w/ redundancy
+ * Set asset tag and Indicator LED
+ * Basic inventory (serial#, model, SKU, Vendor, BIOS ver…)
+ * User Management
+ * BMC management: get/set IP, version, enable/disable protocol
+
+* What it does NOT have -- that the Redfish 1.0 model supports
+ * No PSUs in model (RMM spec did not include PSUs)
+ * No ProcessorInfo, MemoryInfo, StorageInfo, System-EthernetInterfaceInfo
+ * No Tasks
+ * JsonSchema and Registries collections left out (since that is optional)
+ * No EventService--Remote Machine Management spec used basic PET alerts
+ * Uses only the pre-defined privileges and roles
+
+## TO DO
+
+Some limitations to be extended in current implementation
+
+* Auth supports a single hard-coded username, password, and AuthToken, although the protocol is 100% compliant with respect to testing clients trying to authenticate
+ * ex with basic auth, you have to use the hard coded user/password
+ * ex with Session Auth, you just use the hard coded AuthToken
+* adding and deleting users not implemented--has 3 or 4 users predefined
+* accountService properties can be written, but failed logins, lockouts, etc is not implemented
+* system log not implemented yet
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/index.json
new file mode 100644
index 0000000000..759e3e6fdb
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/index.json
@@ -0,0 +1,3 @@
+{
+ "v1": "/redfish/v1/"
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/$metadata/index.xml b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/$metadata/index.xml
new file mode 100644
index 0000000000..37d9529b10
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/$metadata/index.xml
@@ -0,0 +1,147 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright.-->
+<edmx:Edmx xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx" Version="4.0">
+
+ <edmx:Reference Uri="http://redfish.dmtf.org/schemas/v1/ServiceRoot_v1.xml">
+ <edmx:Include Namespace="ServiceRoot"/>
+ <edmx:Include Namespace="ServiceRoot.v1_0_2"/>
+ </edmx:Reference>
+ <edmx:Reference Uri="http://redfish.dmtf.org/schemas/v1/AccountService_v1.xml">
+ <edmx:Include Namespace="AccountService"/>
+ <edmx:Include Namespace="AccountService.v1_0_2"/>
+ </edmx:Reference>
+ <edmx:Reference Uri="http://redfish.dmtf.org/schemas/v1/Chassis_v1.xml">
+ <edmx:Include Namespace="Chassis"/>
+ <edmx:Include Namespace="Chassis.v1_2_0"/>
+ </edmx:Reference>
+ <edmx:Reference Uri="http://redfish.dmtf.org/schemas/v1/ChassisCollection_v1.xml">
+ <edmx:Include Namespace="ChassisCollection"/>
+ </edmx:Reference>
+ <edmx:Reference Uri="http://redfish.dmtf.org/schemas/v1/ComputerSystem_v1.xml">
+ <edmx:Include Namespace="ComputerSystem"/>
+ <edmx:Include Namespace="ComputerSystem.v1_1_0"/>
+ </edmx:Reference>
+ <edmx:Reference Uri="http://redfish.dmtf.org/schemas/v1/ComputerSystemCollection_v1.xml">
+ <edmx:Include Namespace="ComputerSystemCollection"/>
+ </edmx:Reference>
+ <edmx:Reference Uri="http://redfish.dmtf.org/schemas/v1/EthernetInterface_v1.xml">
+ <edmx:Include Namespace="EthernetInterface"/>
+ <edmx:Include Namespace="EthernetInterface.v1_0_2"/>
+ </edmx:Reference>
+ <edmx:Reference Uri="http://redfish.dmtf.org/schemas/v1/EthernetInterfaceCollection_v1.xml">
+ <edmx:Include Namespace="EthernetInterfaceCollection"/>
+ </edmx:Reference>
+ <edmx:Reference Uri="http://redfish.dmtf.org/schemas/v1/IPAddresses_v1.xml">
+ <edmx:Include Namespace="IPAddresses"/>
+ <edmx:Include Namespace="IPAddresses.v1_0_2"/>
+ </edmx:Reference>
+ <edmx:Reference Uri="http://redfish.dmtf.org/schemas/v1/JsonSchemaFile_v1.xml">
+ <edmx:Include Namespace="JsonSchemaFile"/>
+ <edmx:Include Namespace="JsonSchemaFile.v1_0_2"/>
+ </edmx:Reference>
+ <edmx:Reference Uri="http://redfish.dmtf.org/schemas/v1/JsonSchemaFileCollection_v1.xml">
+ <edmx:Include Namespace="JsonSchemaFileCollection"/>
+ </edmx:Reference>
+ <edmx:Reference Uri="http://redfish.dmtf.org/schemas/v1/EventDestination_v1.xml">
+ <edmx:Include Namespace="EventDestination"/>
+ <edmx:Include Namespace="EventDestination.v1_0_2"/>
+ </edmx:Reference>
+ <edmx:Reference Uri="http://redfish.dmtf.org/schemas/v1/EventDestinationCollection_v1.xml">
+ <edmx:Include Namespace="EventDestinationCollection"/>
+ </edmx:Reference>
+ <edmx:Reference Uri="http://redfish.dmtf.org/schemas/v1/LogEntry_v1.xml">
+ <edmx:Include Namespace="LogEntry"/>
+ <edmx:Include Namespace="LogEntry.v1_0_2"/>
+ </edmx:Reference>
+ <edmx:Reference Uri="http://redfish.dmtf.org/schemas/v1/LogEntryCollection_v1.xml">
+ <edmx:Include Namespace="LogEntryCollection"/>
+ </edmx:Reference>
+ <edmx:Reference Uri="http://redfish.dmtf.org/schemas/v1/Role_v1.xml">
+ <edmx:Include Namespace="Role"/>
+ <edmx:Include Namespace="Role.v1_0_2"/>
+ </edmx:Reference>
+ <edmx:Reference Uri="http://redfish.dmtf.org/schemas/v1/RoleCollection_v1.xml">
+ <edmx:Include Namespace="RoleCollection"/>
+ </edmx:Reference>
+ <edmx:Reference Uri="http://redfish.dmtf.org/schemas/v1/LogService_v1.xml">
+ <edmx:Include Namespace="LogService"/>
+ <edmx:Include Namespace="LogService.v1_0_2"/>
+ </edmx:Reference>
+ <edmx:Reference Uri="http://redfish.dmtf.org/schemas/v1/LogServiceCollection_v1.xml">
+ <edmx:Include Namespace="LogServiceCollection"/>
+ </edmx:Reference>
+ <edmx:Reference Uri="http://redfish.dmtf.org/schemas/v1/Manager_v1.xml">
+ <edmx:Include Namespace="Manager"/>
+ <edmx:Include Namespace="Manager.v1_1_0"/>
+ </edmx:Reference>
+ <edmx:Reference Uri="http://redfish.dmtf.org/schemas/v1/ManagerCollection_v1.xml">
+ <edmx:Include Namespace="ManagerCollection"/>
+ </edmx:Reference>
+ <edmx:Reference Uri="http://redfish.dmtf.org/schemas/v1/ManagerAccount_v1.xml">
+ <edmx:Include Namespace="ManagerAccount"/>
+ <edmx:Include Namespace="ManagerAccount.v1_0_2"/>
+ </edmx:Reference>
+ <edmx:Reference Uri="http://redfish.dmtf.org/schemas/v1/ManagerAccountCollection_v1.xml">
+ <edmx:Include Namespace="ManagerAccountCollection"/>
+ </edmx:Reference>
+ <edmx:Reference Uri="http://redfish.dmtf.org/schemas/v1/ManagerNetworkProtocol_v1.xml">
+ <edmx:Include Namespace="ManagerNetworkProtocol"/>
+ <edmx:Include Namespace="ManagerNetworkProtocol.v1_0_2"/>
+ </edmx:Reference>
+ <edmx:Reference Uri="http://redfish.dmtf.org/schemas/v1/Message_v1.xml">
+ <edmx:Include Namespace="Message"/>
+ <edmx:Include Namespace="Message.v1_0_2"/>
+ </edmx:Reference>
+ <edmx:Reference Uri="http://redfish.dmtf.org/schemas/v1/MessageRegistry_v1.xml">
+ <edmx:Include Namespace="MessageRegistry"/>
+ <edmx:Include Namespace="MessageRegistry.v1_0_2"/>
+ </edmx:Reference>
+ <edmx:Reference Uri="http://redfish.dmtf.org/schemas/v1/MessageRegistryCollection_v1.xml">
+ <edmx:Include Namespace="MessageRegistryCollection"/>
+ </edmx:Reference>
+ <edmx:Reference Uri="http://redfish.dmtf.org/schemas/v1/MessageRegistryFile_v1.xml">
+ <edmx:Include Namespace="MessageRegistryFile"/>
+ <edmx:Include Namespace="MessageRegistryFile.v1_0_2"/>
+ </edmx:Reference>
+ <edmx:Reference Uri="http://redfish.dmtf.org/schemas/v1/MessageRegistryFileCollection_v1.xml">
+ <edmx:Include Namespace="MessageRegistryFileCollection"/>
+ </edmx:Reference>
+ <edmx:Reference Uri="http://redfish.dmtf.org/schemas/v1/PhysicalContext_v1.xml">
+ <edmx:Include Namespace="PhysicalContext"/>
+ <edmx:Include Namespace="PhysicalContext.v1_0_2"/>
+ </edmx:Reference>
+ <edmx:Reference Uri="http://redfish.dmtf.org/schemas/v1/Power_v1.xml">
+ <edmx:Include Namespace="Power"/>
+ <edmx:Include Namespace="Power.v1_1_0"/>
+ </edmx:Reference>
+ <edmx:Reference Uri="http://redfish.dmtf.org/schemas/v1/Privileges_v1.xml">
+ <edmx:Include Namespace="Privileges"/>
+ <edmx:Include Namespace="Privileges.v1_0_2"/>
+ </edmx:Reference>
+ <edmx:Reference Uri="http://redfish.dmtf.org/schemas/v1/Session_v1.xml">
+ <edmx:Include Namespace="Session"/>
+ <edmx:Include Namespace="Session.v1_0_2"/>
+ </edmx:Reference>
+ <edmx:Reference Uri="http://redfish.dmtf.org/schemas/v1/SessionCollection_v1.xml">
+ <edmx:Include Namespace="SessionCollection"/>
+ </edmx:Reference>
+ <edmx:Reference Uri="http://redfish.dmtf.org/schemas/v1/SessionService_v1.xml">
+ <edmx:Include Namespace="SessionService"/>
+ <edmx:Include Namespace="SessionService.v1_0_2"/>
+ </edmx:Reference>
+ <edmx:Reference Uri="http://redfish.dmtf.org/schemas/v1/Thermal_v1.xml">
+ <edmx:Include Namespace="Thermal"/>
+ <edmx:Include Namespace="Thermal.v1_1_0"/>
+ </edmx:Reference>
+ <edmx:Reference Uri="http://redfish.dmtf.org/schemas/v1/RedfishExtensions_v1.xml">
+ <edmx:Include Namespace="RedfishExtensions.v1_0_0" Alias="Redfish"/>
+ </edmx:Reference>
+
+ <edmx:DataServices>
+
+ <Schema xmlns="http://docs.oasis-open.org/odata/ns/edm" Namespace="Service">
+ <EntityContainer Name="Service" Extends="ServiceRoot.v1_0_0.ServiceContainer"/>
+ </Schema>
+
+ </edmx:DataServices>
+</edmx:Edmx>
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/AccountService/Accounts/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/AccountService/Accounts/index.json
new file mode 100644
index 0000000000..80f0cf34e6
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/AccountService/Accounts/index.json
@@ -0,0 +1,19 @@
+{
+ "@odata.type": "#ManagerAccountCollection.ManagerAccountCollection",
+ "Name": "Accounts Collection",
+ "Members@odata.count": 3,
+ "Members": [
+ {
+ "@odata.id": "/redfish/v1/AccountService/Accounts/root"
+ },
+ {
+ "@odata.id": "/redfish/v1/AccountService/Accounts/jane"
+ },
+ {
+ "@odata.id": "/redfish/v1/AccountService/Accounts/john"
+ }
+ ],
+ "@odata.context": "/redfish/v1/$metadata#ManagerAccountCollection.ManagerAccountCollection",
+ "@odata.id": "/redfish/v1/AccountService/Accounts",
+ "@Redfish.Copyright": "Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright."
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/AccountService/Accounts/jane/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/AccountService/Accounts/jane/index.json
new file mode 100644
index 0000000000..51e2ce59a9
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/AccountService/Accounts/jane/index.json
@@ -0,0 +1,19 @@
+{
+ "@odata.type": "#ManagerAccount.v1_0_2.ManagerAccount",
+ "Id": "jane",
+ "Name": "UserAccount",
+ "Description": "User Account",
+ "Enabled": true,
+ "Password": null,
+ "UserName": "jane",
+ "RoleId": "Operator",
+ "Locked": false,
+ "Links": {
+ "Role": {
+ "@odata.id": "/redfish/v1/AccountService/Roles/Operator"
+ }
+ },
+ "@odata.context": "/redfish/v1/$metadata#ManagerAccount.ManagerAccount",
+ "@odata.id": "/redfish/v1/AccountService/Accounts/jane",
+ "@Redfish.Copyright":"Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright."
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/AccountService/Accounts/john/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/AccountService/Accounts/john/index.json
new file mode 100644
index 0000000000..a8106d6e88
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/AccountService/Accounts/john/index.json
@@ -0,0 +1,19 @@
+{
+ "@odata.type": "#ManagerAccount.v1_0_2.ManagerAccount",
+ "Id": "john",
+ "Name": "UserAccount",
+ "Description": "User Account",
+ "Enabled": true,
+ "Password": null,
+ "UserName": "john",
+ "RoleId": "ReadOnlyUser",
+ "Locked": false,
+ "Links": {
+ "Role": {
+ "@odata.id": "/redfish/v1/AccountService/Roles/ReadOnlyUser"
+ }
+ },
+ "@odata.context": "/redfish/v1/$metadata#ManagerAccount.ManagerAccount",
+ "@odata.id": "/redfish/v1/AccountService/Accounts/john",
+ "@Redfish.Copyright":"Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright."
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/AccountService/Accounts/root/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/AccountService/Accounts/root/index.json
new file mode 100644
index 0000000000..c966e7c771
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/AccountService/Accounts/root/index.json
@@ -0,0 +1,19 @@
+{
+ "@odata.type": "#ManagerAccount.v1_0_2.ManagerAccount",
+ "Id": "root",
+ "Name": "UserAccount",
+ "Description": "User Account",
+ "Enabled": true,
+ "Password": null,
+ "UserName": "root",
+ "RoleId": "Admin",
+ "Locked": false,
+ "Links": {
+ "Role": {
+ "@odata.id": "/redfish/v1/AccountService/Roles/Admin"
+ }
+ },
+ "@odata.context": "/redfish/v1/$metadata#ManagerAccount.ManagerAccount",
+ "@odata.id": "/redfish/v1/AccountService/Accounts/root",
+ "@Redfish.Copyright":"Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright."
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/AccountService/Roles/Admin/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/AccountService/Roles/Admin/index.json
new file mode 100644
index 0000000000..4debc374de
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/AccountService/Roles/Admin/index.json
@@ -0,0 +1,17 @@
+{
+ "@odata.type": "#Role.v1_0_2.Role",
+ "Id": "Admin",
+ "Name": "User Role",
+ "Description": "Admin User Role",
+ "IsPredefined": true,
+ "AssignedPrivileges": [
+ "Login",
+ "ConfigureManager",
+ "ConfigureUsers",
+ "ConfigureSelf",
+ "ConfigureComponents"
+ ],
+ "@odata.context": "/redfish/v1/$metadata#Role.Role",
+ "@odata.id": "/redfish/v1/AccountService/Roles/Admin",
+ "@Redfish.Copyright":"Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright."
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/AccountService/Roles/Operator/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/AccountService/Roles/Operator/index.json
new file mode 100644
index 0000000000..f30e747c16
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/AccountService/Roles/Operator/index.json
@@ -0,0 +1,15 @@
+{
+ "@odata.type": "#Role.v1_0_2.Role",
+ "Id": "Operator",
+ "Name": "User Role",
+ "Description": "Operator User Role",
+ "IsPredefined": true,
+ "AssignedPrivileges": [
+ "Login",
+ "ConfigureSelf",
+ "ConfigureComponents"
+ ],
+ "@odata.context": "/redfish/v1/$metadata#Role.Role",
+ "@odata.id": "/redfish/v1/AccountService/Roles/Operator",
+ "@Redfish.Copyright":"Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright."
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/AccountService/Roles/ReadOnlyUser/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/AccountService/Roles/ReadOnlyUser/index.json
new file mode 100644
index 0000000000..09a8cc3961
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/AccountService/Roles/ReadOnlyUser/index.json
@@ -0,0 +1,13 @@
+{
+ "@odata.type": "#Role.v1_0_2.Role",
+ "Id": "ReadOnlyUser",
+ "Name": "User Role",
+ "Description": "ReadOnlyUser User Role",
+ "IsPredefined": true,
+ "AssignedPrivileges": [
+ "Login"
+ ],
+ "@odata.context": "/redfish/v1/$metadata#Role.Role",
+ "@odata.id": "/redfish/v1/AccountService/Roles/ReadOnlyUser",
+ "@Redfish.Copyright":"Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright."
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/AccountService/Roles/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/AccountService/Roles/index.json
new file mode 100644
index 0000000000..f295d07d1f
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/AccountService/Roles/index.json
@@ -0,0 +1,19 @@
+{
+ "@odata.type": "#RoleCollection.RoleCollection",
+ "Name": "Roles Collection",
+ "Members@odata.count": 3,
+ "Members": [
+ {
+ "@odata.id": "/redfish/v1/AccountService/Roles/Admin"
+ },
+ {
+ "@odata.id": "/redfish/v1/AccountService/Roles/Operator"
+ },
+ {
+ "@odata.id": "/redfish/v1/AccountService/Roles/ReadOnlyUser"
+ }
+ ],
+ "@odata.context": "/redfish/v1/$metadata#RoleCollection.RoleCollection",
+ "@odata.id": "/redfish/v1/AccountService/Roles",
+ "@Redfish.Copyright": "Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright."
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/AccountService/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/AccountService/index.json
new file mode 100644
index 0000000000..f0e3659588
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/AccountService/index.json
@@ -0,0 +1,25 @@
+{
+ "@odata.type": "#AccountService.v1_0_2.AccountService",
+ "Id": "AccountService",
+ "Name": "Account Service",
+ "Description": "Account Service",
+ "Status": {
+ "State": "Enabled",
+ "Health": "OK"
+ },
+ "ServiceEnabled": true,
+ "AuthFailureLoggingThreshold": 3,
+ "MinPasswordLength": 8,
+ "AccountLockoutThreshold": 5,
+ "AccountLockoutDuration": 30,
+ "AccountLockoutCounterResetAfter": 30,
+ "Accounts": {
+ "@odata.id": "/redfish/v1/AccountService/Accounts"
+ },
+ "Roles": {
+ "@odata.id": "/redfish/v1/AccountService/Roles"
+ },
+ "@odata.context": "/redfish/v1/$metadata#AccountService.AccountService",
+ "@odata.id": "/redfish/v1/AccountService",
+ "@Redfish.Copyright": "Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright."
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Chassis/A33/Power/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Chassis/A33/Power/index.json
new file mode 100644
index 0000000000..04094bf678
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Chassis/A33/Power/index.json
@@ -0,0 +1,28 @@
+{
+ "@odata.type": "#Power.v1_1_0.Power",
+ "Id": "Power",
+ "Name": "Power",
+ "PowerControl": [
+ {
+ "@odata.id": "/redfish/v1/Chassis/A33/Power#/PowerControl/0",
+ "MemberId": "0",
+ "Name": "System Power Control",
+ "PowerConsumedWatts": 224,
+ "PowerCapacityWatts": 600,
+ "PowerLimit": {
+ "LimitInWatts": 450,
+ "LimitException": "LogEventOnly",
+ "CorrectionInMs": 1000
+ },
+ "Status": {
+ "State": "Enabled",
+ "Health": "OK"
+ },
+ "Oem": {}
+ }
+ ],
+ "Oem": {},
+ "@odata.context": "/redfish/v1/$metadata#Power.Power",
+ "@odata.id": "/redfish/v1/Chassis/A33/Power",
+ "@Redfish.Copyright": "Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright."
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Chassis/A33/Thermal/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Chassis/A33/Thermal/index.json
new file mode 100644
index 0000000000..e7b92a34e1
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Chassis/A33/Thermal/index.json
@@ -0,0 +1,150 @@
+{
+ "@odata.type": "#Thermal.v1_1_0.Thermal",
+ "Id": "Thermal",
+ "Name": "Thermal",
+ "Temperatures": [
+ {
+ "@odata.id": "/redfish/v1/Chassis/A33/Thermal#/Temperatures/0",
+ "MemberId": "0",
+ "Name": "Inlet Temp",
+ "SensorNumber": 42,
+ "Status": {
+ "State": "Enabled",
+ "Health": "OK"
+ },
+ "ReadingCelsius": 25,
+ "UpperThresholdNonCritical": 35,
+ "UpperThresholdCritical": 40,
+ "UpperThresholdFatal": 50,
+ "MinReadingRangeTemp": 0,
+ "MaxReadingRangeTemp": 200,
+ "PhysicalContext": "Intake"
+ },
+ {
+ "@odata.id": "/redfish/v1/Chassis/A33/Thermal#/Temperatures/1",
+ "MemberId": "1",
+ "Name": "Board Temp",
+ "SensorNumber": 43,
+ "Status": {
+ "State": "Enabled",
+ "Health": "OK"
+ },
+ "ReadingCelsius": 35,
+ "UpperThresholdNonCritical": 30,
+ "UpperThresholdCritical": 40,
+ "UpperThresholdFatal": 50,
+ "MinReadingRangeTemp": 0,
+ "MaxReadingRangeTemp": 200,
+ "PhysicalContext": "SystemBoard"
+ },
+ {
+ "@odata.id": "/redfish/v1/Chassis/A33/Thermal#/Temperatures/2",
+ "MemberId": "2",
+ "Name": "CPU1 Temp",
+ "SensorNumber": 44,
+ "Status": {
+ "State": "Enabled",
+ "Health": "OK"
+ },
+ "ReadingCelsius": 45,
+ "UpperThresholdNonCritical": 60,
+ "UpperThresholdCritical": 82,
+ "MinReadingRangeTemp": 0,
+ "MaxReadingRangeTemp": 200,
+ "PhysicalContext": "CPU"
+ },
+ {
+ "@odata.id": "/redfish/v1/Chassis/A33/Thermal#/Temperatures/3",
+ "MemberId": "3",
+ "Name": "CPU2 Temp",
+ "SensorNumber": 45,
+ "Status": {
+ "State": "Enabled",
+ "Health": "OK"
+ },
+ "ReadingCelsius": 46,
+ "UpperThresholdNonCritical": 60,
+ "UpperThresholdCritical": 82,
+ "MinReadingRangeTemp": 0,
+ "MaxReadingRangeTemp": 200,
+ "PhysicalContext": "CPU"
+ }
+ ],
+ "Fans": [
+ {
+ "@odata.id": "/redfish/v1/Chassis/A33/Thermal#/Fans/0",
+ "MemberId": "0",
+ "Name": "BaseBoard System Fan 1",
+ "PhysicalContext": "Backplane",
+ "Status": {
+ "State": "Enabled",
+ "Health": "OK"
+ },
+ "Reading": 2100,
+ "ReadingUnits": "RPM",
+ "UpperThresholdNonCritical": 42,
+ "UpperThresholdCritical": 4200,
+ "UpperThresholdFatal": 42,
+ "LowerThresholdNonCritical": 42,
+ "LowerThresholdCritical": 5,
+ "LowerThresholdFatal": 42,
+ "MinReadingRange": 0,
+ "MaxReadingRange": 5000,
+ "Redundancy": [
+ {
+ "@odata.id": "/redfish/v1/Chassis/A33/Thermal#/Redundancy/0"
+ }
+ ]
+ },
+ {
+ "@odata.id": "/redfish/v1/Chassis/A33/Thermal#/Fans/1",
+ "MemberId": "1",
+ "Name": "BaseBoard System Fan 2",
+ "PhysicalContext": "Backplane",
+ "Status": {
+ "State": "Enabled",
+ "Health": "OK"
+ },
+ "Reading": 2100,
+ "ReadingUnits": "RPM",
+ "UpperThresholdNonCritical": 42,
+ "UpperThresholdCritical": 4200,
+ "UpperThresholdFatal": 42,
+ "LowerThresholdNonCritical": 42,
+ "LowerThresholdCritical": 5,
+ "LowerThresholdFatal": 42,
+ "MinReadingRange": 0,
+ "MaxReadingRange": 5000,
+ "Redundancy": [
+ {
+ "@odata.id": "/redfish/v1/Chassis/A33/Thermal#/Redundancy/0"
+ }
+ ]
+ }
+ ],
+ "Redundancy": [
+ {
+ "@odata.id": "/redfish/v1/Chassis/A33/Thermal#/Redundancy/0",
+ "MemberId": "0",
+ "Name": "BaseBoard System Fans",
+ "RedundancySet": [
+ {
+ "@odata.id": "/redfish/v1/Chassis/A33/Thermal#/Fans/0"
+ },
+ {
+ "@odata.id": "/redfish/v1/Chassis/A33/Thermal#/Fans/1"
+ }
+ ],
+ "Mode": "N+m",
+ "Status": {
+ "State": "Enabled",
+ "Health": "OK"
+ },
+ "MinNumNeeded": 1,
+ "MaxNumSupported": 2
+ }
+ ],
+ "@odata.context": "/redfish/v1/$metadata#Thermal.Thermal",
+ "@odata.id": "/redfish/v1/Chassis/A33/Thermal",
+ "@Redfish.Copyright": "Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright."
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Chassis/A33/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Chassis/A33/index.json
new file mode 100644
index 0000000000..74e2de8d7a
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Chassis/A33/index.json
@@ -0,0 +1,46 @@
+{
+ "@odata.type": "#Chassis.v1_2_0.Chassis",
+ "Id": "A33",
+ "Name": "Catfish System Chassis",
+ "ChassisType": "RackMount",
+ "Manufacturer": "CatfishManufacturer",
+ "Model": "YellowCat1000",
+ "SerialNumber": "2M220100SL",
+ "SKU": "8675309",
+ "PartNumber": "224071-J23",
+ "AssetTag": "CATFISHASSETTAG",
+ "IndicatorLED": "Lit",
+ "PowerState": "On",
+ "Status": {
+ "State": "Enabled",
+ "Health": "OK"
+ },
+ "Thermal": {
+ "@odata.id": "/redfish/v1/Chassis/A33/Thermal"
+ },
+ "Power": {
+ "@odata.id": "/redfish/v1/Chassis/A33/Power"
+ },
+ "Links": {
+ "ComputerSystems": [
+ {
+ "@odata.id": "/redfish/v1/Systems/2M220100SL"
+ }
+ ],
+ "ManagedBy": [
+ {
+ "@odata.id": "/redfish/v1/Managers/bmc"
+ }
+ ],
+ "ManagersInChassis": [
+ {
+ "@odata.id": "/redfish/v1/Managers/bmc"
+ }
+ ],
+ "Oem": {}
+ },
+ "Oem": {},
+ "@odata.context": "/redfish/v1/$metadata#Chassis.Chassis",
+ "@odata.id": "/redfish/v1/Chassis/A33",
+ "@Redfish.Copyright": "Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright."
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Chassis/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Chassis/index.json
new file mode 100644
index 0000000000..fb90ededfd
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Chassis/index.json
@@ -0,0 +1,13 @@
+{
+ "@odata.type": "#ChassisCollection.ChassisCollection",
+ "Name": "Chassis Collection",
+ "Members@odata.count": 1,
+ "Members": [
+ {
+ "@odata.id": "/redfish/v1/Chassis/A33"
+ }
+ ],
+ "@odata.context": "/redfish/v1/$metadata#ChassisCollection.ChassisCollection",
+ "@odata.id": "/redfish/v1/Chassis",
+ "@Redfish.Copyright": "Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright."
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Managers/bmc/EthernetInterfaces/eth0/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Managers/bmc/EthernetInterfaces/eth0/index.json
new file mode 100644
index 0000000000..f3e8528dc4
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Managers/bmc/EthernetInterfaces/eth0/index.json
@@ -0,0 +1,60 @@
+{
+ "@odata.type": "#EthernetInterface.v1_0_2.EthernetInterface",
+ "Id": "eth0",
+ "Name": "Manager Ethernet Interface",
+ "Description": "Management Network Interface",
+ "Status": {
+ "State": "Enabled",
+ "Health": "OK"
+ },
+ "InterfaceEnabled": true,
+ "PermanentMACAddress": "AA:BB:CC:DD:EE:FF",
+ "MACAddress": "AA:BB:CC:DD:EE:FF",
+ "SpeedMbps": 100,
+ "AutoNeg": true,
+ "FullDuplex": true,
+ "MTUSize": 1500,
+ "HostName": "MyHostName",
+ "FQDN": "MyHostName.MyDomainName.com",
+ "MaxIPv6StaticAddresses": 1,
+ "VLAN": {
+ "VLANEnable": true,
+ "VLANId": 101
+ },
+ "IPv4Addresses": [
+ {
+ "Address": "192.168.0.10",
+ "SubnetMask": "255.255.252.0",
+ "AddressOrigin": "DHCP",
+ "Gateway": "192.168.0.1",
+ "Oem": {}
+ }
+ ],
+ "IPv6AddressPolicyTable": [
+ {
+ "Prefix": "::1/128",
+ "Precedence": 50,
+ "Label": 0
+ }
+ ],
+ "IPv6StaticAddresses": [
+ {
+ "Address": "fe80::1ec1:deff:fe6f:1e24",
+ "PrefixLength": 16
+ }
+ ],
+ "IPv6DefaultGateway": "fe80::1ec1:deff:fe6f:1e24",
+ "IPv6Addresses": [
+ {
+ "Address": "fe80::1ec1:deff:fe6f:1e24",
+ "PrefixLength": 64,
+ "AddressOrigin": "SLAAC",
+ "AddressState": "Preferred",
+ "Oem": {}
+ }
+ ],
+ "Oem": {},
+ "@odata.context": "/redfish/v1/$metadata#EthernetInterface.EthernetInterface",
+ "@odata.id": "/redfish/v1/Managers/bmc/EthernetInterfaces/eth0",
+ "@Redfish.Copyright":"Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright."
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Managers/bmc/EthernetInterfaces/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Managers/bmc/EthernetInterfaces/index.json
new file mode 100644
index 0000000000..77b85973e4
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Managers/bmc/EthernetInterfaces/index.json
@@ -0,0 +1,15 @@
+{
+ "@odata.type": "#EthernetInterfaceCollection.EthernetInterfaceCollection",
+ "Name": "Ethernet Network Interface Collection",
+ "Description": "Collection of EthernetInterfaces for this Manager",
+ "Members@odata.count": 1,
+ "Members": [
+ {
+ "@odata.id": "/redfish/v1/Managers/bmc/EthernetInterfaces/eth0"
+ }
+ ],
+ "Oem": {},
+ "@odata.context": "/redfish/v1/$metadata#EthernetInterfaceCollection.EthernetInterfaceCollection",
+ "@odata.id": "/redfish/v1/Managers/bmc/EthernetInterfaces",
+ "@Redfish.Copyright": "Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright."
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Managers/bmc/NetworkProtocol/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Managers/bmc/NetworkProtocol/index.json
new file mode 100644
index 0000000000..192fca543e
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Managers/bmc/NetworkProtocol/index.json
@@ -0,0 +1,47 @@
+{
+ "@odata.type": "#ManagerNetworkProtocol.v1_0_2.ManagerNetworkProtocol",
+ "Id": "NetworkProtocol",
+ "Name": "Manager Network Protocol",
+ "Description": "Manager Network Service Status",
+ "Status": {
+ "State": "Enabled",
+ "Health": "OK"
+ },
+ "HostName": "myBmcHostname",
+ "FQDN": "mymanager.mydomain.com",
+ "HTTP": {
+ "ProtocolEnabled": true,
+ "Port": 80
+ },
+ "HTTPS": {
+ "ProtocolEnabled": true,
+ "Port": 443
+ },
+ "IPMI": {
+ "ProtocolEnabled": true,
+ "Port": 623
+ },
+ "SSH": {
+ "ProtocolEnabled": true,
+ "Port": 22
+ },
+ "SNMP": {
+ "ProtocolEnabled": true,
+ "Port": 161
+ },
+ "SSDP": {
+ "ProtocolEnabled": true,
+ "Port": 1900,
+ "NotifyMulticastIntervalSeconds": 600,
+ "NotifyTTL": 5,
+ "NotifyIPv6Scope": "Site"
+ },
+ "Telnet": {
+ "ProtocolEnabled": true,
+ "Port": 23
+ },
+ "Oem": {},
+ "@odata.context": "/redfish/v1/$metadata#ManagerNetworkProtocol.ManagerNetworkProtocol",
+ "@odata.id": "/redfish/v1/Managers/bmc/NetworkProtocol",
+ "@Redfish.Copyright":"Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright."
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Managers/bmc/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Managers/bmc/index.json
new file mode 100644
index 0000000000..8e270e8b02
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Managers/bmc/index.json
@@ -0,0 +1,53 @@
+{
+ "@odata.type": "#Manager.v1_1_0.Manager",
+ "Id": "bmc",
+ "Name": "Manager",
+ "ManagerType": "BMC",
+ "Description": "BMC",
+ "ServiceEntryPointUUID": "92384634-2938-2342-8820-489239905423",
+ "UUID": "00000000-0000-0000-0000-000000000000",
+ "Model": "CatfishBMC",
+ "DateTime": "2015-03-13T04:14:33+06:00",
+ "DateTimeLocalOffset": "+06:00",
+ "Status": {
+ "State": "Enabled",
+ "Health": "OK"
+ },
+ "FirmwareVersion": "1.00",
+ "NetworkProtocol": {
+ "@odata.id": "/redfish/v1/Managers/bmc/NetworkProtocol"
+ },
+ "EthernetInterfaces": {
+ "@odata.id": "/redfish/v1/Managers/bmc/EthernetInterfaces"
+ },
+ "Links": {
+ "ManagerForServers": [
+ {
+ "@odata.id": "/redfish/v1/Systems/2M220100SL"
+ }
+ ],
+ "ManagerForChassis": [
+ {
+ "@odata.id": "/redfish/v1/Chassis/A33"
+ }
+ ],
+ "ManagerInChassis": {
+ "@odata.id": "/redfish/v1/Chassis/A33"
+ },
+ "Oem": {}
+ },
+ "Actions": {
+ "#Manager.Reset": {
+ "target": "/redfish/v1/Managers/bmc/Actions/Manager.Reset",
+ "ResetType@Redfish.AllowableValues": [
+ "ForceRestart",
+ "GracefulRestart"
+ ]
+ },
+ "Oem": {}
+ },
+ "Oem": {},
+ "@odata.context": "/redfish/v1/$metadata#Manager.Manager",
+ "@odata.id": "/redfish/v1/Managers/bmc",
+ "@Redfish.Copyright": "Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright."
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Managers/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Managers/index.json
new file mode 100644
index 0000000000..8e5f5e0349
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Managers/index.json
@@ -0,0 +1,13 @@
+{
+ "@odata.type": "#ManagerCollection.ManagerCollection",
+ "Name": "Manager Collection",
+ "Members@odata.count": 1,
+ "Members": [
+ {
+ "@odata.id": "/redfish/v1/Managers/bmc"
+ }
+ ],
+ "@odata.context": "/redfish/v1/$metadata#ManagerCollection.ManagerCollection",
+ "@odata.id": "/redfish/v1/Managers",
+ "@Redfish.Copyright": "Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright."
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/SessionService/Sessions/SESSION123456/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/SessionService/Sessions/SESSION123456/index.json
new file mode 100644
index 0000000000..dce8d48925
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/SessionService/Sessions/SESSION123456/index.json
@@ -0,0 +1,10 @@
+{
+ "@odata.type": "#Session.v1_0_2.Session",
+ "Id": "SESSION123456",
+ "Name": "User Session",
+ "Description": "Manager User Session",
+ "UserName": "root",
+ "Oem": {},
+ "@odata.context": "/redfish/v1/$metadata#Session.Session",
+ "@odata.id": "/redfish/v1/SessionService/Sessions/SESSION123456"
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/SessionService/Sessions/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/SessionService/Sessions/index.json
new file mode 100644
index 0000000000..d009bf9d19
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/SessionService/Sessions/index.json
@@ -0,0 +1,12 @@
+{
+ "@odata.type": "#SessionCollection.SessionCollection",
+ "Name": "Session Collection",
+ "Members@odata.count": 1,
+ "Members": [
+ {
+ "@odata.id": "/redfish/v1/SessionService/Sessions/SESSION123456"
+ }
+ ],
+ "@odata.context": "/redfish/v1/$metadata#SessionCollection.SessionCollection",
+ "@odata.id": "/redfish/v1/SessionService/Sessions"
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/SessionService/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/SessionService/index.json
new file mode 100644
index 0000000000..ed1764ebaf
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/SessionService/index.json
@@ -0,0 +1,17 @@
+{
+ "@odata.type": "#SessionService.v1_0_2.SessionService",
+ "Id": "SessionService",
+ "Name": "Session Service",
+ "Description": "Session Service",
+ "Status": {
+ "State": "Enabled",
+ "Health": "OK"
+ },
+ "ServiceEnabled": true,
+ "SessionTimeout": 30,
+ "Sessions": {
+ "@odata.id": "/redfish/v1/SessionService/Sessions"
+ },
+ "@odata.context": "/redfish/v1/$metadata#SessionService.SessionService",
+ "@odata.id": "/redfish/v1/SessionService"
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/LogServices/SEL/Entries/1/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/LogServices/SEL/Entries/1/index.json
new file mode 100644
index 0000000000..5156ff13d5
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/LogServices/SEL/Entries/1/index.json
@@ -0,0 +1,27 @@
+{
+ "@odata.type": "#LogEntry.v1_0_2.LogEntry",
+ "Id": "1",
+ "Name": "Log Entry 1",
+ "EntryType": "SEL",
+ "OemRecordFormat": "CompanyX",
+ "Severity": "Critical",
+ "Created": "2012-03-07T14:44:00Z",
+ "EntryCode": "Assert",
+ "SensorType": "Temperature",
+ "SensorNumber": 1,
+ "Message": "Message for Event, Description for SEL, OEM depends",
+ "MessageId": "Event.1.0.TempAssert",
+ "MessageArgs": [
+ "ArrayOfMessageArgs"
+ ],
+ "Links": {
+ "OriginOfCondition": {
+ "@odata.id": "/redfish/v1/Chassis/1/Thermal"
+ },
+ "Oem": {}
+ },
+ "Oem": {},
+ "@odata.context": "/redfish/v1/$metadata#LogEntry.LogEntry",
+ "@odata.id": "/redfish/v1/Systems/2M220100SL/LogServices/SEL/Entries/1",
+ "@Redfish.Copyright":"Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright."
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/LogServices/SEL/Entries/2/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/LogServices/SEL/Entries/2/index.json
new file mode 100644
index 0000000000..308d224055
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/LogServices/SEL/Entries/2/index.json
@@ -0,0 +1,27 @@
+{
+ "@odata.type": "#LogEntry.v1_0_2.LogEntry",
+ "Id": "2",
+ "Name": "Log Entry 2",
+ "EntryType": "SEL",
+ "OemRecordFormat": "CompanyX",
+ "Severity": "Critical",
+ "Created": "2012-03-07T14:45:00Z",
+ "EntryCode": "Assert",
+ "SensorType": "Temperature",
+ "SensorNumber": 2,
+ "Message": "Message for Event, Description for SEL, OEM depends",
+ "MessageId": "Event.1.0.TempAssert",
+ "MessageArgs": [
+ "ArrayOfMessageArgs"
+ ],
+ "Links": {
+ "OriginOfCondition": {
+ "@odata.id": "/redfish/v1/Chassis/1/Thermal"
+ },
+ "Oem": {}
+ },
+ "Oem": {},
+ "@odata.context": "/redfish/v1/$metadata#LogEntry.LogEntry",
+ "@odata.id": "/redfish/v1/Systems/2M220100SL/LogServices/SEL/Entries/2",
+ "@Redfish.Copyright":"Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright."
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/LogServices/SEL/Entries/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/LogServices/SEL/Entries/index.json
new file mode 100644
index 0000000000..2102e5da43
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/LogServices/SEL/Entries/index.json
@@ -0,0 +1,62 @@
+{
+ "@odata.type": "#LogEntryCollection.LogEntryCollection",
+ "Name": "Log Service Collection",
+ "Description": "Collection of Logs for this System",
+ "Members@odata.count": 2,
+ "Members": [
+ {
+ "@odata.type": "#LogEntry.v1_0_2.LogEntry",
+ "Id": "1",
+ "Name": "Log Entry 1",
+ "EntryType": "SEL",
+ "OemRecordFormat": "CompanyX",
+ "Severity": "Critical",
+ "Created": "2012-03-07T14:44:00Z",
+ "EntryCode": "Assert",
+ "SensorType": "Temperature",
+ "SensorNumber": 1,
+ "Message": "Message for Event, Description for SEL, OEM depends",
+ "MessageId": "Event.1.0.TempAssert",
+ "MessageArgs": [
+ "ArrayOfMessageArgs"
+ ],
+ "Links": {
+ "OriginOfCondition": {
+ "@odata.id": "/redfish/v1/Chassis/1/Thermal"
+ },
+ "Oem": {}
+ },
+ "Oem": {},
+ "@odata.id": "/redfish/v1/Systems/2M220100SL/LogServices/SEL/Entries/1"
+ },
+ {
+ "@odata.type": "#LogEntry.v1_0_2.LogEntry",
+ "Id": "2",
+ "Name": "Log Entry 2",
+ "EntryType": "SEL",
+ "OemRecordFormat": "CompanyX",
+ "Severity": "Critical",
+ "Created": "2012-03-07T14:45:00Z",
+ "EntryCode": "Assert",
+ "SensorType": "Temperature",
+ "SensorNumber": 2,
+ "Message": "Message for Event, Description for SEL, OEM depends",
+ "MessageId": "Event.1.0.TempAssert",
+ "MessageArgs": [
+ "ArrayOfMessageArgs"
+ ],
+ "Links": {
+ "OriginOfCondition": {
+ "@odata.id": "/redfish/v1/Chassis/1/Thermal"
+ },
+ "Oem": {}
+ },
+ "Oem": {},
+ "@odata.id": "/redfish/v1/Systems/2M220100SL/LogServices/SEL/Entries/2"
+ }
+ ],
+ "@odata.nextLink": "/redfish/v1/Systems/2M220100SL/LogServices/SEL/Entries?$skiptoken=2",
+ "@odata.context": "/redfish/v1/$metadata#LogEntryCollection.LogEntryCollection",
+ "@odata.id": "/redfish/v1/Systems/2M220100SL/LogServices/SEL/Entries",
+ "@Redfish.Copyright":"Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright."
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/LogServices/SEL/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/LogServices/SEL/index.json
new file mode 100644
index 0000000000..74c748e95e
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/LogServices/SEL/index.json
@@ -0,0 +1,27 @@
+{
+ "@odata.type": "#LogService.v1_0_2.LogService",
+ "Id": "SEL",
+ "Name": "System Log Service",
+ "MaxNumberOfRecords": 1000,
+ "OverWritePolicy": "WrapsWhenFull",
+ "DateTime": "2015-03-13T04:14:33+06:00",
+ "DateTimeLocalOffset": "+06:00",
+ "ServiceEnabled": true,
+ "Status": {
+ "State": "Enabled",
+ "Health": "OK"
+ },
+ "Oem": {},
+ "Actions": {
+ "#LogService.ClearLog": {
+ "target": "/redfish/v1/Systems/2M220100SL/LogServices/SEL/Actions/LogService.Reset"
+ },
+ "Oem": {}
+ },
+ "Entries": {
+ "@odata.id": "/redfish/v1/Systems/2M220100SL/LogServices/SEL/Entries"
+ },
+ "@odata.context": "/redfish/v1/$metadata#LogService.LogService",
+ "@odata.id": "/redfish/v1/Systems/2M220100SL/LogServices/SEL",
+ "@Redfish.Copyright": "Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright."
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/LogServices/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/LogServices/index.json
new file mode 100644
index 0000000000..2dc5bf57c4
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/LogServices/index.json
@@ -0,0 +1,15 @@
+{
+ "@odata.type": "#LogServiceCollection.LogServiceCollection",
+ "Name": "Log Service Collection",
+ "Description": "Collection of Logs for this System",
+ "Members@odata.count": 1,
+ "Members": [
+ {
+ "@odata.id": "/redfish/v1/Systems/2M220100SL/LogServices/SEL"
+ }
+ ],
+ "Oem": {},
+ "@odata.context": "/redfish/v1/$metadata#LogServiceCollection.LogServiceCollection",
+ "@odata.id": "/redfish/v1/Systems/2M220100SL/LogServices",
+ "@Redfish.Copyright": "Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright."
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/index.json
new file mode 100644
index 0000000000..814f5f6373
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/index.json
@@ -0,0 +1,70 @@
+{
+ "@odata.type": "#ComputerSystem.v1_1_0.ComputerSystem",
+ "Id": "2M220100SL",
+ "Name": "Catfish System",
+ "SystemType": "Physical",
+ "AssetTag": "CATFISHASSETTAG",
+ "Manufacturer": "CatfishManufacturer",
+ "Model": "YellowCat1000",
+ "SerialNumber": "2M220100SL",
+ "SKU": "867530",
+ "PartNumber": "224071-J23",
+ "Description": "Catfish Implementation Recipe of simple scale-out monolithic server",
+ "UUID": "00000000-0000-0000-0000-000000000000",
+ "HostName": "catfishHostname",
+ "PowerState": "On",
+ "BiosVersion": "X00.1.2.3.4(build-23)",
+ "Status": {
+ "State": "Enabled",
+ "Health": "OK"
+ },
+ "IndicatorLED": "Off",
+ "Boot": {
+ "BootSourceOverrideEnabled": "Once",
+ "BootSourceOverrideMode": "UEFI",
+ "UefiTargetBootSourceOverride": "uefiDevicePath",
+ "BootSourceOverrideTarget": "Pxe",
+ "BootSourceOverrideTarget@Redfish.AllowableValues": [
+ "None",
+ "Pxe",
+ "Usb",
+ "Hdd",
+ "BiosSetup",
+ "UefiTarget",
+ "UefiHttp"
+ ]
+ },
+ "LogServices": {
+ "@odata.id": "/redfish/v1/Systems/2M220100SL/LogServices"
+ },
+ "Links": {
+ "Chassis": [
+ {
+ "@odata.id": "/redfish/v1/Chassis/A33"
+ }
+ ],
+ "ManagedBy": [
+ {
+ "@odata.id": "/redfish/v1/Managers/bmc"
+ }
+ ],
+ "Oem": {}
+ },
+ "Actions": {
+ "#ComputerSystem.Reset": {
+ "target": "/redfish/v1/Systems/2M220100SL/Actions/ComputerSystem.Reset",
+ "ResetType@Redfish.AllowableValues": [
+ "On",
+ "ForceOff",
+ "GracefulShutdown",
+ "ForceRestart",
+ "Nmi",
+ "GracefulRestart",
+ "ForceOn"
+ ]
+ }
+ },
+ "@odata.context": "/redfish/v1/$metadata#ComputerSystem.ComputerSystem",
+ "@odata.id": "/redfish/v1/Systems/2M220100SL",
+ "@Redfish.Copyright": "Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright."
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/index.json
new file mode 100644
index 0000000000..091849e1a6
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/index.json
@@ -0,0 +1,13 @@
+{
+ "@odata.type": "#ComputerSystemCollection.ComputerSystemCollection",
+ "Name": "Computer System Collection",
+ "Members@odata.count": 1,
+ "Members": [
+ {
+ "@odata.id": "/redfish/v1/Systems/2M220100SL"
+ }
+ ],
+ "@odata.context": "/redfish/v1/$metadata#ComputerSystemCollection.ComputerSystemCollection",
+ "@odata.id": "/redfish/v1/Systems",
+ "@Redfish.Copyright": "Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright."
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/index.json
new file mode 100644
index 0000000000..89312bcec1
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/index.json
@@ -0,0 +1,31 @@
+{
+ "@odata.type": "#ServiceRoot.v1_0_2.ServiceRoot",
+ "Id": "RootService",
+ "Name": "Root Service",
+ "RedfishVersion": "1.0.2",
+ "UUID": "92384634-2938-2342-8820-489239905423",
+ "Systems": {
+ "@odata.id": "/redfish/v1/Systems"
+ },
+ "Chassis": {
+ "@odata.id": "/redfish/v1/Chassis"
+ },
+ "Managers": {
+ "@odata.id": "/redfish/v1/Managers"
+ },
+ "SessionService": {
+ "@odata.id": "/redfish/v1/SessionService"
+ },
+ "AccountService": {
+ "@odata.id": "/redfish/v1/AccountService"
+ },
+ "Links": {
+ "Sessions": {
+ "@odata.id": "/redfish/v1/SessionService/Sessions"
+ }
+ },
+ "Oem": {},
+ "@odata.context": "/redfish/v1/$metadata#ServiceRoot.ServiceRoot",
+ "@odata.id": "/redfish/v1/",
+ "@Redfish.Copyright": "Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright."
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/odata/index.json b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/odata/index.json
new file mode 100644
index 0000000000..ef253a35cb
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/odata/index.json
@@ -0,0 +1,56 @@
+{
+ "value": [
+ {
+ "name": "Service",
+ "kind": "Singleton",
+ "url": "/redfish/v1/"
+ },
+ {
+ "name": "Systems",
+ "kind": "Singleton",
+ "url": "/redfish/v1/Systems"
+ },
+ {
+ "name": "Chassis",
+ "kind": "Singleton",
+ "url": "/redfish/v1/Chassis"
+ },
+ {
+ "name": "Managers",
+ "kind": "Singleton",
+ "url": "/redfish/v1/Managers"
+ },
+ {
+ "name": "AccountService",
+ "kind": "Singleton",
+ "url": "/redfish/v1/AccountService"
+ },
+ {
+ "name": "SessionService",
+ "kind": "Singleton",
+ "url": "/redfish/v1/SessionService"
+ },
+ {
+ "name": "EventService",
+ "kind": "Singleton",
+ "url": "/redfish/v1/EventService"
+ },
+ {
+ "name": "JsonSchemas",
+ "kind": "Singleton",
+ "url": "/redfish/v1/JsonSchemas"
+ },
+ {
+ "name": "Registries",
+ "kind": "Singleton",
+ "url": "/redfish/v1/Registries"
+ },
+ {
+ "name": "Sessions",
+ "kind": "Singleton",
+ "url": "/redfish/v1/SessionService/Sessions"
+ }
+ ],
+ "@odata.context": "/redfish/v1/$metadata",
+ "@Redfish.Copyright":"Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright."
+}
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/redfishProfileSimulator.py b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/redfishProfileSimulator.py
new file mode 100644
index 0000000000..24be52bafc
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/redfishProfileSimulator.py
@@ -0,0 +1,125 @@
+# Copyright Notice:
+# Copyright 2016 Distributed Management Task Force, Inc. All rights reserved.
+# License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/Redfish-Profile-Simulator/blob/master/LICENSE.md
+
+# This program is dependent on the following Python packages that should be installed separately with pip:
+# pip install Flask
+#
+# standard python packages
+import sys
+import getopt
+import os
+
+rfVersion = "0.9.6"
+rfProgram1 = "redfishProfileSimulator"
+rfProgram2 = " "
+rfUsage1 = "[-Vh] [--Version][--help]"
+rfUsage2 = "[-H<hostIP>] [-P<port>] [-p<profile_path>]"
+rfUsage3 = "[--Host=<hostIP>] [--Port=<port>] [--profile_path=<profile_path>]"
+
+
+def rf_usage():
+ print("Usage:")
+ print(" ", rfProgram1, " ", rfUsage1)
+ print(" ", rfProgram1, " ", rfUsage2)
+ print(" ", rfProgram2, " ", rfUsage3)
+
+
+def rf_help():
+ print(rfProgram1,"implements a simulation of a redfish service for the \"Simple OCP Server V1\" Mockup.")
+ print(" The simulation includes an http server, RestEngine, and dynamic Redfish datamodel.")
+ print(" You can GET, PATHCH,... to the service just like a real Redfish service.")
+ print(" Both Basic and Redfish Session/Token authentication is supported (for a single user/passwd and token")
+ print(" the user/passwd is: root/password123456. The authToken is: 123456SESSIONauthcode")
+ print(" these can be changed by editing the redfishURIs.py file. will make dynamic later.")
+ print(" The http service and Rest engine is built on Flask, and all code is Python 3.4+")
+ print(" The data model resources are \"initialized\" from the SPMF \"SimpleOcpServerV1\" Mockup.")
+ print(" and stored as python dictionaries--then the dictionaries are updated with patches, posts, deletes.")
+ print(" The program can be extended to support other mockup \"profiles\".")
+ print("")
+ print(" By default, the simulation runs on localhost (127.0.0.1), on port 5000.")
+ print(" These can be changed with CLI options: -P<port> -H <hostIP> | --port=<port> --host=<hostIp>")
+ print("")
+ print("Version: ", rfVersion)
+ rf_usage()
+ print("")
+ print(" -V, --Version, --- the program version")
+ print(" -h, --help, --- help")
+ print(" -H<hostIP>, --Host=<hostIp> --- host IP address. dflt=127.0.0.1")
+ print(" -P<port>, --Port=<port> --- the port to use. dflt=5000")
+ print(" -p<profile_path>, --profile=<profile_path> --- the path to the Redfish profile to use. "
+ "dflt=\"./MockupData/SimpleOcpServerV1\" ")
+
+
+def main(argv):
+ # set default option args
+ rf_profile_path = os.path.abspath("./MockupData/SimpleOcpServerV1")
+ rf_host = "127.0.0.1"
+ rf_port = 5000
+
+ try:
+ opts, args = getopt.getopt(argv[1:], "VhH:P:p:",
+ ["Version", "help", "Host=", "Port=", "profile="])
+ except getopt.GetoptError:
+ print(rfProgram1, ": Error parsing options")
+ rf_usage()
+ sys.exit(2)
+ for opt, arg in opts:
+ if opt in ("-h", "--help"):
+ rf_help()
+ sys.exit(0)
+ elif opt in ("-V", "--Version"):
+ print("Version:", rfVersion)
+ sys.exit(0)
+ elif opt in ("-p", "--profile"):
+ rf_profile_path = arg
+ elif opt in "--Host=":
+ rf_host = arg
+ elif opt in "--Port=":
+ rf_port=int(arg)
+ else:
+ print(" ", rfProgram1, ": Error: unsupported option")
+ rf_usage()
+ sys.exit(2)
+
+ print("{} Version: {}".format(rfProgram1,rfVersion))
+ print(" Starting redfishProfileSimulator at: hostIP={}, port={}".format(rf_host, rf_port))
+ print(" Using Profile at {}".format(rf_profile_path))
+
+ if os.path.isdir(rf_profile_path):
+ # import the classes and code we run from main.
+ from v1sim.serviceVersions import RfServiceVersions
+ from v1sim.serviceRoot import RfServiceRoot
+ # rfApi_SimpleServer is a function in ./RedfishProfileSim/redfishURIs.py.
+ # It loads the flask APIs (URIs), and starts the flask service
+ from v1sim.redfishURIs import rfApi_SimpleServer
+
+ # create the root service resource
+ root_path = os.path.normpath("redfish/v1")
+
+ # create the version resource for GET /redfish
+ versions = RfServiceVersions(rf_profile_path, "redfish")
+ root = RfServiceRoot(rf_profile_path, root_path)
+
+ # start the flask REST API service
+ rfApi_SimpleServer(root, versions, host=rf_host, port=rf_port)
+ else:
+ print("invalid profile path")
+
+
+if __name__ == "__main__":
+ main(sys.argv)
+
+
+
+
+ #http://127.0.0.1:5000/
+
+ #app.run(host="0.0.0.0") # run on all IPs
+ #run(host=None, port=None, debug=None, **options)
+ # host=0.0.0.0 server avail externally -- all IPs
+ # host=127.0.0.1 is default
+ # port=5000 default, or port defined in SERVER_NAME config var
+
+
+
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/__init__.py b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/__init__.py
new file mode 100644
index 0000000000..72007ff42a
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/__init__.py
@@ -0,0 +1,4 @@
+# Copyright Notice:
+# Copyright 2016 Distributed Management Task Force, Inc. All rights reserved.
+# License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/Redfish-Profile-Simulator/blob/master/LICENSE.md
+
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/accountService.py b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/accountService.py
new file mode 100644
index 0000000000..1c056f0b86
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/accountService.py
@@ -0,0 +1,76 @@
+# Copyright Notice:
+# Copyright 2016 Distributed Management Task Force, Inc. All rights reserved.
+# License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/Redfish-Profile-Simulator/blob/master/LICENSE.md
+
+import os
+
+from .resource import RfResource, RfCollection
+
+
+class RfAccountServiceObj(RfResource):
+ # create instance of each AccountService
+ def create_sub_objects(self, base_path, rel_path):
+ if os.path.isdir(os.path.join(base_path, os.path.normpath("redfish/v1/AccountService/Accounts"))):
+ self.components["Accounts"] = RfAccountCollection(base_path,
+ os.path.normpath("redfish/v1/AccountService/Accounts"),
+ parent=self)
+
+ if os.path.isdir(os.path.join(base_path, os.path.normpath("redfish/v1/AccountService/Roles"))):
+ self.components["Roles"] = RfRoleCollection(base_path,
+ os.path.normpath("redfish/v1/AccountService/Roles"),
+ parent=self)
+
+ def patch_resource(self, patch_data):
+ # first verify client didn't send us a property we cant patch
+ patachables = ("MinPasswordLength", "AccountLockoutThreshold",
+ "AccountLockoutDuration", "AccountLockoutCounterResetAfter")
+
+ for key in patch_data.keys():
+ if key not in patachables:
+ return 4, 400, "Invalid Patch Property Sent", ""
+
+ # now patch the valid properties sent
+ for key in patch_data.keys():
+ new_val = patch_data[key]
+ print("new_val:{}".format(new_val))
+ try:
+ num_val = round(new_val)
+ except ValueError:
+ return 4, 400, "invalid value", ""
+ else:
+ patch_data[key] = num_val
+
+ # if here, we know all the patch data is valid properties and properties
+ new_duration = self.res_data["AccountLockoutDuration"]
+ new_reset_after = self.res_data["AccountLockoutCounterResetAfter"]
+ if "AccountLockoutDuration" in patch_data:
+ new_duration = patch_data["AccountLockoutDuration"]
+ if "AccountLockoutCounterResetAfter" in patch_data:
+ new_reset_after = patch_data["AccountLockoutCounterResetAfter"]
+ if new_duration < new_reset_after:
+ return 4, 400, "invalid value", ""
+
+ # if here, all values are good. set them
+ for key in patch_data.keys():
+ self.res_data[key] = patch_data[key]
+ return 0, 204, None, None
+
+
+class RfAccountCollection(RfCollection):
+ def element_type(self):
+ return RfAccountObj
+
+
+# Service Collection Entries
+class RfAccountObj(RfResource):
+ pass
+
+
+class RfRoleCollection(RfCollection):
+ def element_type(self):
+ return RfRoleObj
+
+
+# Service Collection Entries
+class RfRoleObj(RfResource):
+ pass
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/chassis.py b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/chassis.py
new file mode 100644
index 0000000000..88e5a000f3
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/chassis.py
@@ -0,0 +1,115 @@
+# Copyright Notice:
+# Copyright 2016 Distributed Management Task Force, Inc. All rights reserved.
+# License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/Redfish-Profile-Simulator/blob/master/LICENSE.md
+
+import os
+
+from .resource import RfResource, RfCollection
+
+
+class RfChassisCollection(RfCollection):
+ def element_type(self):
+ return RfChassisObj
+
+
+class RfChassisObj(RfResource):
+ # create the dependent sub-objects that live under the chassis object
+ def create_sub_objects(self, base_path, rel_path):
+ resource_path = os.path.join(base_path, rel_path);
+ contents = os.listdir(resource_path)
+ for item in contents:
+ if item == "Thermal":
+ self.components[item] = RfChassisThermal(base_path, os.path.join(rel_path, item), parent=self)
+ elif item == "Power":
+ self.components[item] = RfChassisPower(base_path, os.path.join(rel_path, item), parent=self)
+
+ def patch_resource(self, patch_data):
+ # first verify client didn't send us a property we cant patch
+ for key in patch_data.keys():
+ if key != "AssetTag" and key != "IndicatorLED":
+ return 4, 400, "Invalid Patch Property Sent", ""
+ # now patch the valid properties sent
+ if "AssetTag" in patch_data:
+ self.res_data['AssetTag'] = patch_data['AssetTag']
+ if "IndicatorLED" in patch_data:
+ self.res_data['IndicatorLED'] = patch_data['IndicatorLED']
+ return 0, 204, None, None
+
+ def reset_resource(self, reset_data):
+ if "ResetType" in reset_data:
+ # print("RESETDATA: {}".format(resetData))
+ value = reset_data['ResetType']
+ valid_values = self.res_data["Actions"]["#Chassis.Reset"]["ResetType@Redfish.AllowableValues"]
+ if value in valid_values:
+ # it is a supoported reset action modify other properties appropritely
+ if value == "On":
+ self.res_data["PowerState"] = "On"
+ print("PROFILE_SIM--SERVER WAS RESET. power now ON")
+ elif value == "ForceOff":
+ self.res_data["PowerState"] = "Off"
+ print("PROFILE_SIM--SERVER WAS RESET. Power now Off")
+ return 0, 204, "Chassis Reset", ""
+ else:
+ return 4, 400, "Invalid reset value: ResetType", ""
+ else: # invalid request
+ return 4, 400, "Invalid request property", ""
+
+
+# subclass Thermal Metrics
+class RfChassisThermal(RfResource):
+ pass
+
+
+# subclass Power Metrics
+class RfChassisPower(RfResource):
+ def create_sub_objects(self, base_path, rel_path):
+ resource_path = os.path.join(base_path, rel_path);
+ contents = os.listdir(resource_path)
+ for item in contents:
+ if item == "FastPowerMeter":
+ self.components[item] = RfFastPowerMeter(base_path, os.path.join(rel_path, item), parent=self)
+ elif item == "FederatedGroupCapping":
+ self.components[item] = RfFederatedGroupCapping(base_path, os.path.join(rel_path, item), parent=self)
+ elif item == "PowerMeter":
+ self.components[item] = RfPowerMeter(base_path, os.path.join(rel_path, item), parent=self)
+
+ def patch_resource(self, patchData):
+ # first verify client didn't send us a property we cant patch
+ for key in patchData.keys():
+ if key != "PowerControl":
+ return 4, 400, "Invalid Patch Property Sent", ""
+ else: # Powercontrol:
+ for prop2 in patchData["PowerControl"][0].keys():
+ if prop2 != "PowerLimit":
+ return 4, 400, "Invalid Patch Property Sent", ""
+ else: # PowerLimit
+ for prop3 in patchData["PowerControl"][0]["PowerLimit"].keys():
+ if prop3 != "LimitInWatts" and prop3 != "LimitException" and prop3 != "CorrectionInMs":
+ return 4, 400, "Invalid Patch Property Sent", ""
+ # now patch the valid properties sent
+ if "PowerControl" in patchData:
+ if "PowerLimit" in patchData["PowerControl"][0]:
+ patch_power_limit_dict = patchData["PowerControl"][0]["PowerLimit"]
+ catfish_power_limit_dict = self.res_data["PowerControl"][0]["PowerLimit"]
+ if "LimitInWatts" in patch_power_limit_dict:
+ self.res_data["PowerControl"][0]["PowerLimit"]["LimitInWatts"] = \
+ patch_power_limit_dict['LimitInWatts']
+ if "LimitException" in patch_power_limit_dict:
+ self.res_data["PowerControl"][0]["PowerLimit"]['LimitException'] = \
+ patch_power_limit_dict['LimitException']
+ if "CorrectionInMs" in patch_power_limit_dict:
+ self.res_data["PowerControl"][0]["PowerLimit"]['CorrectionInMs'] = \
+ patch_power_limit_dict['CorrectionInMs']
+ return 0, 204, None, None
+
+
+class RfFastPowerMeter(RfResource):
+ pass
+
+
+class RfFederatedGroupCapping(RfResource):
+ pass
+
+
+class RfPowerMeter(RfResource):
+ pass
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/common_services.py b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/common_services.py
new file mode 100644
index 0000000000..b1a5082d45
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/common_services.py
@@ -0,0 +1,28 @@
+import os
+
+from .resource import RfCollection, RfResource
+
+
+class RfLogServiceCollection(RfCollection):
+ def element_type(self):
+ return RfLogService
+
+
+class RfLogService(RfResource):
+ def create_sub_objects(self, base_path, rel_path):
+ resource_path = os.path.join(base_path, rel_path);
+ contents = os.listdir(resource_path)
+ for item in contents:
+ if item == "Entries":
+ self.components[item] = RfLogEntriesCollection(base_path,
+ os.path.join(rel_path, item),
+ parent=self)
+
+
+class RfLogEntriesCollection(RfCollection):
+ def element_type(self):
+ return RfLogEntry
+
+
+class RfLogEntry(RfResource):
+ pass
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/flask_redfish_auth.py b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/flask_redfish_auth.py
new file mode 100644
index 0000000000..61a5fd97e9
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/flask_redfish_auth.py
@@ -0,0 +1,278 @@
+# Copyright Notice:
+# Copyright 2016 Distributed Management Task Force, Inc. All rights reserved.
+# License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/Redfish-Profile-Simulator/blob/master/LICENSE.md
+
+"""
+flask_redfish_auth
+
+adapted from:
+ flask_httpauth
+ ==================
+ This module provides Basic and Digest HTTP authentication for Flask routes.
+ :copyright: (C) 2014 by Miguel Grinberg.
+ :license: MIT, see LICENSE for more details,
+ at https://github.com/miguelgrinberg/Flask-HTTPAuth/blob/master/LICENSE
+
+ see documentation at: http://flask.pocoo.org/snippets/8/
+ code and docs at: https://github.com/miguelgrinberg/flask-httpauth/
+
+**** modified to implement EITHER Redfish Token Auth or Basic Auth
+ this file is imported by: catfishURIs.py
+
+ Usage: In RedfishProfileSimulator: see this flow below in redfishURIs.py
+ ... in redfishURIs.py
+ from .flask_redfish_auth import RfHTTPBasicOrTokenAuth
+ ...
+ #create instance of the modified Basic or Redfish Token auth
+ # this is what is in this file
+ auth=RfHTTPBasicOrTokenAuth
+
+ #define basic auth decorator used by flask
+ @auth.verify_basic_password
+ def verifyRfPasswd(user,passwd):
+ ...
+
+ #define Redfish Token/Session auth decorator used by flask
+ @auth.verify_token
+ def verifyRfToken(auth_token):
+ ..
+
+ @app.route("/api", methods=['GET'])
+ @auth.rfAuthRequired
+ def api()
+ ...
+"""
+
+from functools import wraps
+
+from flask import request, make_response
+
+
+# this is the Base HTTP Auth class that is used to derive the Redfish "Basic or Token Auth" class
+class HTTPAuth(object):
+ def __init__(self, scheme=None, realm=None):
+ def default_get_password(userx):
+ return None
+
+ def default_basic_auth_error():
+ return "Unauthorized Access"
+
+ def default_token_auth_error():
+ return "Unauthorized Access. Invalid authentication token"
+
+ self.scheme = scheme
+ self.realm = realm or "Authentication Required"
+ self.get_password(default_get_password)
+ self.basic_error_handler(default_basic_auth_error)
+ self.token_error_handler(default_token_auth_error)
+
+ def get_password(self, f):
+ self.get_password_callback = f
+ return f
+
+ def token_error_handler(self, f):
+ @wraps(f)
+ def decorated(*args, **kwargs):
+ res = f(*args, **kwargs)
+ if type(res) == str:
+ res = make_response(res)
+ res.status_code = 401
+ return res
+
+ self.auth_token_error_callback = decorated
+ return decorated
+
+ def basic_error_handler(self, f):
+ @wraps(f)
+ def decorated(*args, **kwargs):
+ res = f(*args, **kwargs)
+ if type(res) == str:
+ res = make_response(res)
+ res.status_code = 401
+ if 'WWW-Authenticate' not in res.headers.keys():
+ res.headers['WWW-Authenticate'] = self.authenticate_header()
+ return res
+
+ self.auth_basic_error_callback = decorated
+ return decorated
+
+ # for redfish, we need to hook this to check if its token auth before trying basic auth
+ def rfAuthRequired(self, f):
+ @wraps(f)
+ def decorated(*args, **kwargs):
+ auth = request.authorization
+ print("in rfAuthRequired")
+ print("headers: {}".format(request.headers))
+ # We need to ignore authentication headers for OPTIONS to avoid
+ # unwanted interactions with CORS.
+ # Chrome and Firefox issue a preflight OPTIONS request to check
+ # Access-Control-* headers, and will fail if it returns 401.
+ if request.method != 'OPTIONS':
+ # auth is None if the Basic auth header didn't come in the request
+ found_token = False
+ if (auth is None):
+ ###print("auth is None")
+ # check if we have a redfish auth token
+ hdr_token_key = "X-Auth-Token"
+ auth_token = request.headers.get(hdr_token_key)
+ ###print("token={}".format(auth_token))
+ if (auth_token is not None):
+ found_token = True
+ # yeah! we have an auth token in the headers
+ authOk = self.verify_token_callback(auth_token)
+ ###print("verify_token={}".format(authOk))
+ if (authOk is not True):
+ # we had an auth token, but it didn't validate
+ return (self.auth_token_error_callback())
+
+ # now continue with normal Basic Auth validation
+ if (found_token is not True):
+ ###print("try basic")
+ if auth:
+ password = self.get_password_callback(auth.username)
+ else:
+ password = None
+ ###print("basic auth: auth={}, pwd={}".format(auth,password))
+ if (not self.authenticate(auth, password)):
+ return (self.auth_basic_error_callback())
+ ###print("now execute the function")
+ return (f(*args, **kwargs))
+
+ return (decorated)
+
+ def username(self):
+ if not request.authorization:
+ return ""
+ return request.authorization.username
+
+
+# this class is derived from HTTPAuth above
+class RfHTTPBasicOrTokenAuth(HTTPAuth):
+ def __init__(self, scheme=None, realm=None):
+ super(RfHTTPBasicOrTokenAuth, self).__init__(scheme, realm)
+ self.hash_password(None)
+ self.verify_basic_password(None)
+ self.verify_token(None)
+
+ def hash_password(self, f):
+ self.hash_password_callback = f
+ return f
+
+ def verify_basic_password(self, f):
+ self.verify_password_callback = f
+ return f
+
+ def verify_token(self, f):
+ self.verify_token_callback = f
+ return f
+
+ def authenticate_header(self):
+ return '{0} realm="{1}"'.format(self.scheme or 'Basic', self.realm)
+
+ def authenticate(self, auth, stored_password):
+ if auth:
+ username = auth.username
+ client_password = auth.password
+ else:
+ username = ""
+ client_password = ""
+ if self.verify_password_callback:
+ return self.verify_password_callback(username, client_password)
+ if not auth:
+ return False
+ if self.hash_password_callback:
+ try:
+ client_password = self.hash_password_callback(client_password)
+ except TypeError:
+ client_password = self.hash_password_callback(username,
+ client_password)
+ return client_password == stored_password
+
+
+'''
+class HTTPDigestAuth(HTTPAuth):
+ def __init__(self, scheme=None, realm=None, use_ha1_pw=False):
+ super(HTTPDigestAuth, self).__init__(scheme, realm)
+ self.use_ha1_pw = use_ha1_pw
+ self.random = SystemRandom()
+ try:
+ self.random.random()
+ except NotImplementedError:
+ self.random = Random()
+
+ def _generate_random():
+ return md5(str(self.random.random()).encode('utf-8')).hexdigest()
+
+ def default_generate_nonce():
+ session["auth_nonce"] = _generate_random()
+ return session["auth_nonce"]
+
+ def default_verify_nonce(nonce):
+ return nonce == session.get("auth_nonce")
+
+ def default_generate_opaque():
+ session["auth_opaque"] = _generate_random()
+ return session["auth_opaque"]
+
+ def default_verify_opaque(opaque):
+ return opaque == session.get("auth_opaque")
+
+ self.generate_nonce(default_generate_nonce)
+ self.generate_opaque(default_generate_opaque)
+ self.verify_nonce(default_verify_nonce)
+ self.verify_opaque(default_verify_opaque)
+
+ def generate_nonce(self, f):
+ self.generate_nonce_callback = f
+ return f
+
+ def verify_nonce(self, f):
+ self.verify_nonce_callback = f
+ return f
+
+ def generate_opaque(self, f):
+ self.generate_opaque_callback = f
+ return f
+
+ def verify_opaque(self, f):
+ self.verify_opaque_callback = f
+ return f
+
+ def get_nonce(self):
+ return self.generate_nonce_callback()
+
+ def get_opaque(self):
+ return self.generate_opaque_callback()
+
+ def generate_ha1(self, username, password):
+ a1 = username + ":" + self.realm + ":" + password
+ a1 = a1.encode('utf-8')
+ return md5(a1).hexdigest()
+
+ def authenticate_header(self):
+ session["auth_nonce"] = self.get_nonce()
+ session["auth_opaque"] = self.get_opaque()
+ return '{0} realm="{1}",nonce="{49}",opaque="{3}"'.format(
+ self.scheme or 'Digest', self.realm, session["auth_nonce"],
+ session["auth_opaque"])
+
+ def authenticate(self, auth, stored_password_or_ha1):
+ if not auth or not auth.username or not auth.realm or not auth.uri \
+ or not auth.nonce or not auth.response \
+ or not stored_password_or_ha1:
+ return False
+ if not(self.verify_nonce_callback(auth.nonce)) or \
+ not(self.verify_opaque_callback(auth.opaque)):
+ return False
+ if self.use_ha1_pw:
+ ha1 = stored_password_or_ha1
+ else:
+ a1 = auth.username + ":" + auth.realm + ":" + \
+ stored_password_or_ha1
+ ha1 = md5(a1.encode('utf-8')).hexdigest()
+ a2 = request.method + ":" + auth.uri
+ ha2 = md5(a2.encode('utf-8')).hexdigest()
+ a3 = ha1 + ":" + auth.nonce + ":" + ha2
+ response = md5(a3.encode('utf-8')).hexdigest()
+ return response == auth.response
+'''
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/managers.py b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/managers.py
new file mode 100644
index 0000000000..e09ae3d500
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/managers.py
@@ -0,0 +1,211 @@
+# Copyright Notice:
+# Copyright 2016 Distributed Management Task Force, Inc. All rights reserved.
+# License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/Redfish-Profile-Simulator/blob/master/LICENSE.md
+
+import os
+
+from .common_services import RfLogServiceCollection
+from .network import RfNetworkService
+from .resource import RfResource, RfCollection
+from .security import RfSecurityService
+
+
+class RfManagersCollection(RfCollection):
+ def element_type(self):
+ return RfManagerObj
+
+
+class RfManagerObj(RfResource):
+ """
+ create the dependent sub-objects that live under the Manager object
+ """
+
+ def create_sub_objects(self, base_path, rel_path):
+ resource_path = os.path.join(base_path, rel_path);
+ contents = os.listdir(resource_path)
+ for item in contents:
+ if item == "EthernetInterfaces":
+ self.components[item] = RfManagerEthernetColl(base_path, os.path.join(rel_path, item), parent=self)
+ elif item == "NetworkProtocol":
+ self.components[item] = RfManagerNetworkProtocol(base_path, os.path.join(rel_path, item), parent=self)
+ elif item == "SerialInterfaces":
+ self.components[item] = RfSerialInterfaceCollection(base_path, os.path.join(rel_path, item),
+ parent=self)
+ elif item == "VirutalMedia":
+ self.components[item] = RfVirtualMediaCollection(base_path, os.path.join(rel_path, item), parent=self)
+ elif item == "NICs":
+ self.components[item] = RfNics(base_path, os.path.join(rel_path, item), parent=self)
+ elif item == "LogServices":
+ self.components[item] = RfLogServiceCollection(base_path, os.path.join(rel_path, item), parent=self)
+ elif item == "ActiveHealthSystem":
+ self.components[item] = RfActiveHealthSystem(base_path, os.path.join(rel_path, item), parent=self)
+ elif item == "DateTime":
+ self.components[item] = RfDateTime(base_path, os.path.join(rel_path, item), parent=self)
+ elif item == "EmbeddedMedia":
+ self.components[item] = RfEmbeddedMedia(base_path, os.path.join(rel_path, item), parent=self)
+ elif item == "FederationGroups":
+ self.components[item] = RfFederationGroupCollection(base_path, os.path.join(rel_path, item),
+ parent=self)
+ elif item == "FederationPeers":
+ self.components[item] = RfFederationPeerCollection(base_path, os.path.join(rel_path, item), parent=self)
+ elif item == "LicenseService":
+ self.components[item] = RfLicenseServiceCollection(base_path, os.path.join(rel_path, item), parent=self)
+ elif item == "SecurityService":
+ self.components[item] = RfSecurityService(base_path, os.path.join(rel_path, item), parent=self)
+ elif item == "UpdateService":
+ self.components[item] = RfManagerUpdateService(base_path, os.path.join(rel_path, item), parent=self)
+ elif item == "NetworkService":
+ self.components[item] = RfNetworkService(base_path, os.path.join(rel_path, item), parent=self)
+
+ def patch_resource(self, patch_data):
+ # first verify client didn't send us a property we cant patch
+ for key in patch_data.keys():
+ if key != "DateTime" and key != "DateTimeLocalOffset":
+ return 4, 400, "Invalid Patch Property Sent", ""
+
+ date_time = None
+ date_time_offset = None
+ local_offset = None
+
+ # now patch the valid properties sent
+ if "DateTime" in patch_data:
+ date_time = patch_data['DateTime']
+ date_time_offset = date_time[-6:] # get last 6 chars ....+00:00 or -00:00
+ if "DateTimeLocalOffset" in patch_data:
+ local_offset = patch_data['DateTimeLocalOffset']
+
+ # verify that if both DateTime and DateTimeLocalOffset were sent, thant
+ # the offsets are the same. (no reason to send both though)
+ if date_time_offset is not None and local_offset is not None:
+ if date_time_offset != local_offset:
+ return 4, 409, "Offsets in DateTime and DateTimeLocalOffset conflict", None # 409 Conflict
+
+ # reconcile localOffset and the offset in DateTime to write back
+ # if only DateTime was updated, also update dateTimeLocalOffset
+ if local_offset is None:
+ local_offset = date_time_offset
+ # if only DateTimeLocalOffset was updated (timezone change), also update DateTime
+ if date_time is None:
+ date_time = self.res_data['DateTime'] # read current value to get time
+ date_time = date_time[:-6] # strip the offset
+ date_time = date_time + local_offset # add back the offset sent in in DateTimeLocalOFfset
+
+ # TODO: issue 1545 in SPMF is ambiguity of what patching DateTimeLocalOffset should actually do.
+ # this may need to be updated once issue is resolved
+
+ # now write the valid properties with updated values
+ self.res_data['DateTime'] = date_time
+ self.res_data['DateTimeLocalOffset'] = local_offset
+ return 0, 204, None, None
+
+ def reset_resource(self, reset_data):
+ if "ResetType" in reset_data:
+ value = reset_data['ResetType']
+ valid_values = self.res_data["Actions"]["#Manager.Reset"]["ResetType@Redfish.AllowableValues"]
+ if value in valid_values:
+ # it is a supoported reset action modify other properties appropritely
+ # nothing to do--manager always on in this profile
+ return 0, 204, "System Reset", ""
+ else:
+ return 4, 400, "Invalid reset value: ResetType", ""
+ else: # invalid request
+ return 4, 400, "Invalid request property", ""
+
+
+class RfManagerNetworkProtocol(RfResource):
+ pass
+
+
+# the Manager Ethernet Collection
+class RfManagerEthernetColl(RfCollection):
+ def element_type(self):
+ return RfManagerEthernet
+
+
+# the Manager Ethernet Instance
+class RfManagerEthernet(RfResource):
+ def patch_resource(self, patch_data):
+ # TODO: check and save the data
+ # for now, just return ok w/ 204 no content
+ return 0, 204, None, None
+
+
+class RfSerialInterfaceCollection(RfCollection):
+ def element_type(self):
+ return RfSerialInterface
+
+
+class RfSerialInterface(RfResource):
+ pass
+
+
+class RfVirtualMediaCollection(RfCollection):
+ def element_type(self):
+ return RfVirtualMedia
+
+
+class RfVirtualMedia(RfResource):
+ pass
+
+
+class RfNics(RfResource):
+ def create_sub_objects(self, base_path, rel_path):
+ resource_path = os.path.join(base_path, rel_path);
+ contents = os.listdir(resource_path)
+ for item in contents:
+ if item == "Dedicated":
+ self.components[item] = RfDedicatedNicCollection(base_path,
+ os.path.join(rel_path, item),
+ parent=self)
+
+
+class RfDedicatedNicCollection(RfCollection):
+ def element_type(self):
+ return RfNic
+
+
+class RfNic(RfResource):
+ pass
+
+
+class RfActiveHealthSystem(RfResource):
+ pass
+
+
+class RfDateTime(RfResource):
+ pass
+
+
+class RfEmbeddedMedia(RfResource):
+ pass
+
+
+class RfLicenseServiceCollection(RfCollection):
+ def element_type(self):
+ return RfLicenseService
+
+
+class RfLicenseService(RfResource):
+ pass
+
+
+class RfFederationGroupCollection(RfCollection):
+ def element_type(self):
+ return RfFederationGroup
+
+
+class RfFederationGroup(RfResource):
+ pass
+
+
+class RfFederationPeerCollection(RfCollection):
+ def element_type(self):
+ return RfFederationPeer
+
+
+class RfFederationPeer(RfResource):
+ pass
+
+
+class RfManagerUpdateService(RfResource):
+ pass
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/network.py b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/network.py
new file mode 100644
index 0000000000..d96d29c5ad
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/network.py
@@ -0,0 +1,48 @@
+import os
+
+from .resource import RfCollection, RfResource
+
+
+class RfNetworkService(RfResource):
+ pass
+
+
+class RfEthernetCollection(RfCollection):
+ def element_type(self):
+ return RfEthernet
+
+ def create_sub_objects(self, base_path, rel_path):
+ self.elements = {}
+ resource_path = os.path.join(base_path, rel_path);
+ contents = os.listdir(resource_path)
+ for item in contents:
+ if item == "VLANs":
+ self.components[item] = RfVLanCollection(base_path, os.path.join(rel_path, item), parent=self)
+ else:
+ item_path = os.path.join(resource_path, item)
+ if os.path.isdir(item_path):
+ etype = self.element_type() # type: Type[RfEthernetCollection]
+ self.elements[item] = etype(base_path,
+ os.path.normpath("%s/%s" % (rel_path, item)),
+ parent=self)
+
+class RfEthernet(RfResource):
+ pass
+
+
+class RfVLanCollection(RfCollection):
+ def element_type(self):
+ return RfVLan
+
+
+class RfVLan(RfResource):
+ pass
+
+
+class RfNetworkInterfaceCollection(RfCollection):
+ def element_type(self):
+ return RfNetworkInterface
+
+
+class RfNetworkInterface(RfResource):
+ pass
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/redfishURIs.py b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/redfishURIs.py
new file mode 100644
index 0000000000..2380a4058a
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/redfishURIs.py
@@ -0,0 +1,309 @@
+# Copyright Notice:
+# Copyright 2016 Distributed Management Task Force, Inc. All rights reserved.
+# License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/Redfish-Profile-Simulator/blob/master/LICENSE.md
+
+import json
+
+from flask import Flask
+from flask import request
+
+from .flask_redfish_auth import RfHTTPBasicOrTokenAuth
+from .resource import RfResource, RfResourceRaw, RfCollection
+
+
+def rfApi_SimpleServer(root, versions, host="127.0.0.1", port=5000):
+ app = Flask(__name__)
+
+ # create auth class that does basic or redifish session auth
+ auth = RfHTTPBasicOrTokenAuth()
+
+ # define basic auth decorator used by flask
+ # for basic auth, we only support user=catfish, passwd=hunter
+ @auth.verify_basic_password
+ def verify_rf_passwd(user, passwd):
+ if user == "root":
+ if passwd == "password123456":
+ return True
+ return False
+
+ # define Redfish Token/Session auth decorator used by flask
+ # for session token auth, only support toden: 123456CATFISHauthcode
+ @auth.verify_token
+ def verify_rf_token(auth_token):
+ # lookup the user for this token
+ # lookup the privileges for this user
+ # check privilege
+ # print("at verify_rf_token. auth_token={}".format(auth_token))
+ if auth_token == "123456SESSIONauthcode": # the magic token
+ return True
+ else:
+ return False
+
+ # define redfish URI APIs for flask
+
+ # GET /redfish
+ @app.route("/redfish", methods=['GET'])
+ @app.route("/redfish/", methods=['GET'])
+ def rf_versions():
+ return versions.get_resource()
+
+ # GET /redfish/v1
+ @app.route("/redfish/v1", methods=['GET'])
+ @app.route("/redfish/v1/", methods=['GET'])
+ def rf_service_root():
+ return root.get_resource()
+
+ # GET /redfish/v1/$metadata
+ @app.route("/redfish/v1/$metadata", methods=['GET'])
+ def rf_metadata(rf_path='$metadata'):
+ return resolve_path(root, rf_path)
+
+ # GET /redfish/v1/odata
+ @app.route("/redfish/v1/odata", methods=['GET'])
+ @app.route("/redfish/v1/odata/", methods=['GET'])
+ def rf_odata(rf_path='odata'):
+ return resolve_path(root, rf_path)
+
+ @app.route("/redfish/v1/<path:rf_path>", methods=['GET'])
+ @app.route("/redfish/v1/<path:rf_path>/", methods=['GET'])
+ @auth.rfAuthRequired
+ def rf_subsystems(rf_path):
+ return resolve_path(root, rf_path)
+
+ # this is a special test API -- an authenticated service root
+ @app.route("/redfish/v1/A", methods=['GET'])
+ @auth.rfAuthRequired
+ def rf_service_root2():
+ print("root2")
+ return root.get_resource()
+
+ @app.route("/redfish/v1/Systems/<path:sys_path>", methods=['PATCH'])
+ @app.route("/redfish/v1/Systems/<path:sys_path>/", methods=['PATCH'])
+ @auth.rfAuthRequired
+ def rf_computer_systempatch(sys_path):
+ rdata = request.get_json(cache=True)
+ print("rdata:{}".format(rdata))
+ obj = patch_path(root.systems, sys_path)
+ rc, status_code, err_string, resp = obj.patch_resource(rdata)
+ if rc == 0:
+ return "", status_code
+ else:
+ return err_string, status_code
+
+ @app.route("/redfish/v1/Systems/<string:system_id>/Actions/ComputerSystem.Reset", methods=['POST'])
+ @app.route("/redfish/v1/Systems/<string:system_id>/Actions/ComputerSystem.Reset/", methods=['POST'])
+ @auth.rfAuthRequired
+ def rf_computer_systemreset(system_id):
+ # print("in reset")
+ rdata = request.get_json(cache=True)
+ # print("rdata:{}".format(rdata))
+ rc, status_code, err_string, resp = root.components['Systems'].get_element(system_id).reset_resource(rdata)
+ if rc == 0:
+ return "", status_code
+ else:
+ return err_string, status_code
+
+ @app.route("/redfish/v1/Systems/<string:system_id>/bios/Actions/Bios.ResetBios", methods=['POST'])
+ @app.route("/redfish/v1/Systems/<string:system_id>/bios/Actions/Bios.ResetBios/", methods=['POST'])
+ @auth.rfAuthRequired
+ def rf_computer_biosreset(system_id):
+ # print("in reset")
+ rdata = request.get_json(cache=True)
+ # print("rdata:{}".format(rdata))
+ system = root.systems.get_element(system_id)
+ bios = system.get_component("bios")
+ rc, status_code, err_string, resp = bios.reset_resource(rdata)
+ if rc == 0:
+ return "", status_code
+ else:
+ return err_string, status_code
+
+ @app.route("/redfish/v1/Systems/<string:system_id>/bios/Actions/Bios.ChangePassword", methods=['PATCH'])
+ @app.route("/redfish/v1/Systems/<string:system_id>/bios/Actions/Bios.ChangePassword/", methods=['PATCH'])
+ @auth.rfAuthRequired
+ def rf_computer_change_pswd(system_id):
+ # print("in reset")
+ rdata = request.get_json(cache=True)
+ # print("rdata:{}".format(rdata))
+ system = root.systems.get_element(system_id)
+ bios = system.get_component("bios")
+ rc, status_code, err_string, resp = bios.change_password(rdata)
+ if rc == 0:
+ return "", status_code
+ else:
+ return err_string, status_code
+
+ @app.route("/redfish/v1/Chassis/<string:chassis_id>/Actions/Chassis.Reset", methods=['POST'])
+ @app.route("/redfish/v1/Chassis/<string:chassis_id>/Actions/Chassis.Reset/", methods=['POST'])
+ @auth.rfAuthRequired
+ def rf_computer_chassisreset(chassis_id):
+ # print("in reset")
+ rdata = request.get_json(cache=True)
+ # print("rdata:{}".format(rdata))
+ rc, status_code, err_string, resp = root.chassis.get_element(chassis_id).reset_resource(rdata)
+ if rc == 0:
+ return "", status_code
+ else:
+ return err_string, status_code
+
+ @app.route("/redfish/v1/Chassis/<string:chassis_id>/Power", methods=['PATCH'])
+ @app.route("/redfish/v1/Chassis/<string:chassis_id>/Power/", methods=['PATCH'])
+ @auth.rfAuthRequired
+ def rf_chassis_powerpatch(chassis_id):
+ # rawdata=request.data
+ rdata = request.get_json(cache=True)
+ # print("RRrdata:{}".format(rdata))
+ rc, status_code, err_string, resp = root.chassis.get_element(chassis_id).power.patch_resource(rdata)
+ if rc == 0:
+ return "", status_code
+ else:
+ return err_string, status_code
+
+ @app.route("/redfish/v1/Managers/<string:manager_id>", methods=['PATCH'])
+ @app.route("/redfish/v1/Managers/<string:manager_id>/", methods=['PATCH'])
+ @auth.rfAuthRequired
+ def rf_patch_manager_entity(manager_id):
+ rdata = request.get_json(cache=True)
+ # print("RRrdata:{}".format(rdata))
+ rc, status_code, err_string, resp = root.managers.get_element(manager_id).patch_resource(rdata)
+ if rc == 0:
+ return "", status_code
+ else:
+ return err_string, status_code
+
+ # rest/v1/Managers/1
+ @app.route("/redfish/v1/Managers/<string:manager_id>/Actions/Manager.Reset", methods=['POST'])
+ @app.route("/redfish/v1/Managers/<string:manager_id>/Actions/Manager.Reset/", methods=['POST'])
+ @auth.rfAuthRequired
+ def rf_reset_manager(manager_id):
+ rdata = request.get_json(cache=True)
+ # print("rdata:{}".format(rdata))
+ rc, status_code, err_string, resp = root.managers.get_element(manager_id).reset_resource(rdata)
+ if rc == 0:
+ return "", status_code
+ else:
+ return err_string, status_code
+
+ @app.route("/redfish/v1/Managers/<string:manager_id>/EthernetInterfaces/<string:eth_id>", methods=['PATCH'])
+ @app.route("/redfish/v1/Managers/<string:manager_id>/EthernetInterfaces/<string:eth_id>/", methods=['PATCH'])
+ @auth.rfAuthRequired
+ def rf_patch_manager_nic_entity(manager_id, eth_id):
+ resp = root.managers.get_element(manager_id).ethernetColl.get_interface(eth_id).get_resource()
+ rdata = request.get_json(cache=True)
+ # print("RRrdata:{}".format(rdata))
+ ethernet_coll = root.managers.get_element(manager_id).ethernetColl
+ rc, status_code, err_string, resp = ethernet_coll.get_interface(eth_id).patch_resource(rdata)
+ if rc == 0:
+ return "", status_code
+ else:
+ return err_string, status_code
+
+ @app.route("/redfish/v1/SessionService", methods=['PATCH'])
+ @app.route("/redfish/v1/SessionService/", methods=['PATCH'])
+ @auth.rfAuthRequired
+ def rf_patch_session_service():
+ rdata = request.get_json(cache=True)
+ # print("RRrdata:{}".format(rdata))
+ rc, status_code, err_string, resp = root.sessionService.patch_resource(rdata)
+ if rc == 0:
+ return "", status_code
+ else:
+ return err_string, status_code
+
+ # TODO: call root.sessionService.sessions.sessionLogin(usr,pwd), return resp, status_code, hdr
+ # login API, user catfish, password=hunter, authToken=123456CATFISHauthcode
+ @app.route("/redfish/v1/SessionService/Sessions", methods=['POST'])
+ def rf_login():
+ print("login")
+ rdata = request.get_json(cache=True)
+ print("rdata:{}".format(rdata))
+ if rdata["UserName"] == "root" and rdata["Password"] == "password123456":
+ x = {"Id": "SESSION123456"}
+ resp = json.dumps(x)
+ print("resp:{}".format(resp))
+ hdr = {"X-Auth-Token": "123456SESSIONauthcode",
+ "Location": "/redfish/v1/SessionService/Sessions/SESSION123456"}
+ return resp, 201, hdr
+ else:
+ return "", 401
+
+ # TODO: call root.sessionService.sessions.delete(sessId), return resp,status,hdr
+ # logout API
+ @app.route("/redfish/v1/SessionService/Sessions/<string:session_id>", methods=['DELETE'])
+ @auth.rfAuthRequired
+ def rf_session_logout(session_id):
+ print("session logout %s" % session_id)
+ # rdata=request.get_json(cache=True)
+ # print("rdata:{}".format(rdata))
+ return "", 204
+
+ @app.route("/redfish/v1/AccountService", methods=['PATCH'])
+ @auth.rfAuthRequired
+ def rf_patch_account_service():
+ rdata = request.get_json(cache=True)
+ rc, status_code, err_string, resp = root.accountService.patch_resource(rdata)
+ if rc == 0:
+ return "", status_code
+ else:
+ return err_string, status_code
+
+ def resolve_path(service, path):
+ parts = path.split('/')
+ result = service
+ current_obj = service
+ for part in parts:
+ if isinstance(current_obj, RfCollection):
+ result = current_obj.get_element(part)
+ current_obj = result
+ elif isinstance(current_obj, RfResource):
+ result = current_obj.get_component(part)
+ if not result:
+ result = current_obj.get_attribute(part)
+ break
+ else:
+ current_obj = result
+
+ if isinstance(result, (RfResource, RfResourceRaw)):
+ return result.get_resource()
+ else:
+ return result
+
+ def patch_path(service, path):
+ parts = path.split('/')
+ result = None
+ current_obj = service
+ for part in parts:
+ if isinstance(current_obj, RfCollection):
+ result = current_obj.get_element(part)
+ current_obj = result
+ elif isinstance(current_obj, RfResource):
+ result = current_obj.get_component(part)
+ if not result:
+ result = current_obj
+ break
+ else:
+ current_obj = result
+ return result
+
+ '''
+ @app.route("/rest/v1/xxx/x", methods=['GET'])
+ def rfXxxx():
+ resp=xxx.getObject()
+ return(resp)
+ '''
+
+ # END file redfishURIs
+
+ # start Flask REST engine running
+ app.run(host=host, port=port)
+
+ # never returns
+
+
+'''
+reference source links:
+https://gist.github.com/lrei/2408383
+http://docs.python-requests.org/en/v0.10.6/api/
+http://flask.pocoo.org/docs/0.10/quickstart/
+
+'''
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/resource.py b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/resource.py
new file mode 100644
index 0000000000..6fee348064
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/resource.py
@@ -0,0 +1,100 @@
+# Copyright Notice:
+# Copyright 2016 Distributed Management Task Force, Inc. All rights reserved.
+# License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/Redfish-Profile-Simulator/blob/master/LICENSE.md
+
+import json
+import os
+import sys
+
+import flask
+
+if sys.version_info >= (3, 5):
+ from typing import Type
+
+
+class RfResource:
+ def __init__(self, base_path, rel_path, parent=None):
+ self.parent = parent
+ self.components = {}
+
+ path = os.path.join(base_path, rel_path)
+ indx_file_path = os.path.join(path, "index.json")
+ print("*****Loading Mockup json file:{}".format(indx_file_path))
+ if os.path.exists(indx_file_path):
+ res_file = open(indx_file_path, "r")
+ res_rawdata = res_file.read()
+ self.res_data = json.loads(res_rawdata)
+ self.create_sub_objects(base_path, rel_path)
+ self.final_init_processing(base_path, rel_path)
+ else:
+ self.res_data = {}
+
+ def create_sub_objects(self, base_path, rel_path):
+ pass
+
+ def final_init_processing(self, base_path, rel_path):
+ pass
+
+ def get_resource(self):
+ return flask.jsonify(self.res_data)
+
+ def get_attribute(self, attribute):
+ return flask.jsonify(self.res_data[attribute])
+
+ def get_component(self, component):
+ if component in self.components:
+ return self.components[component]
+ else:
+ return None
+
+ def patch_resource(self, patch_data):
+ for key in patch_data.keys():
+ if key in self.res_data:
+ self.res_data[key] = patch_data[key]
+ else:
+ raise Exception("attribute %s not found" % key)
+
+
+class RfResourceRaw:
+ def __init__(self, base_path, rel_path, parent=None):
+ self.parent = parent
+ path = os.path.join(base_path, rel_path)
+ indx_file_path = os.path.join(path, "index.xml")
+ print("*****Loading Mockup raw data file:{}".format(indx_file_path))
+ res_file = open(indx_file_path, "r")
+ res_raw_data = res_file.read()
+ self.res_data = res_raw_data
+ self.create_subobjects(base_path, rel_path)
+ self.final_init_processing(base_path, rel_path)
+
+ def create_subobjects(self, base_path, rel_path):
+ pass
+
+ def final_init_processing(self, base_path, rel_path):
+ pass
+
+ def get_resource(self):
+ return flask.Response(response=self.res_data, status=200, mimetype='application/xml')
+
+
+class RfCollection(RfResource):
+ def create_sub_objects(self, base_path, rel_path):
+ self.elements = {}
+ subpath = os.path.join(base_path, rel_path)
+ contents = os.listdir(subpath)
+ for item in contents:
+ item_path = os.path.join(subpath, item)
+ if os.path.isdir(item_path):
+ etype = self.element_type() # type: Type[RfResource]
+ self.elements[item] = etype(base_path,
+ os.path.normpath("%s/%s" % (rel_path, item)),
+ parent=self)
+
+ def element_type(self):
+ pass
+
+ def get_elements(self):
+ return self.elements
+
+ def get_element(self, element_id):
+ return self.elements[element_id]
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/security.py b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/security.py
new file mode 100644
index 0000000000..deec1b2df9
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/security.py
@@ -0,0 +1,35 @@
+import os
+
+from .resource import RfResource
+
+
+class RfSecurityService(RfResource):
+ def create_sub_objects(self, base_path, rel_path):
+ resource_path = os.path.join(base_path, rel_path);
+ contents = os.listdir(resource_path)
+ for item in contents:
+ if item == "ESKM":
+ self.components[item] = RfESKM(base_path, os.path.join(rel_path, item), parent=self)
+ if item == "HttpsCert":
+ self.components[item] = RfHttpsCert(base_path, os.path.join(rel_path, item), parent=self)
+ if item == "SSO":
+ self.components[item] = RfSSO(base_path, os.path.join(rel_path, item), parent=self)
+ if item == "CertificateAuthentication":
+ self.components[item] = RfCertificateAuthentication(base_path, os.path.join(rel_path, item),
+ parent=self)
+
+
+class RfESKM(RfResource):
+ pass
+
+
+class RfHttpsCert(RfResource):
+ pass
+
+
+class RfSSO(RfResource):
+ pass
+
+
+class RfCertificateAuthentication(RfResource):
+ pass
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/serviceRoot.py b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/serviceRoot.py
new file mode 100644
index 0000000000..6334ab1b5a
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/serviceRoot.py
@@ -0,0 +1,87 @@
+# Copyright Notice:
+# Copyright 2016 Distributed Management Task Force, Inc. All rights reserved.
+# License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/Redfish-Profile-Simulator/blob/master/LICENSE.md
+
+import os
+
+from .accountService import RfAccountServiceObj
+from .chassis import RfChassisCollection
+from .managers import RfManagersCollection
+from .resource import RfResource, RfCollection
+from .resource import RfResourceRaw
+from .sessionService import RfSessionServiceObj
+from .systems import RfSystemsCollection
+from .updateService import RfUpdateServiceObj
+
+
+class RfServiceRoot(RfResource):
+ def create_sub_objects(self, base_path, rel_path):
+ resource_path = os.path.join(base_path, rel_path);
+ contents = os.listdir(resource_path)
+ for item in contents:
+ if item == "odata":
+ self.components[item] = RfOdataServiceDoc(base_path, os.path.join(rel_path, item), parent=self)
+ elif item == "$metadata":
+ self.components[item] = RfOdataMetadata(base_path, os.path.join(rel_path, item), parent=self)
+ elif item == "Systems":
+ self.components[item] = RfSystemsCollection(base_path, os.path.join(rel_path, item), parent=self)
+ elif item == "Chassis":
+ self.components[item] = RfChassisCollection(base_path, os.path.join(rel_path, item), parent=self)
+ elif item == "Managers":
+ self.components[item] = RfManagersCollection(base_path, os.path.join(rel_path, item), parent=self)
+ elif item == "AccountService":
+ self.components[item] = RfAccountServiceObj(base_path, os.path.join(rel_path, item), parent=self)
+ elif item == "SessionService":
+ self.components[item] = RfSessionServiceObj(base_path, os.path.join(rel_path, item), parent=self)
+ elif item == "ResourceDirectory":
+ self.components[item] = RfResourceDirectoryObj(base_path, os.path.join(rel_path, item), parent=self)
+ elif item == "UpdateService":
+ self.components[item] = RfUpdateServiceObj(base_path, os.path.join(rel_path, item), parent=self)
+ elif item == "Registries":
+ self.components[item] = RfRegistryCollection(base_path, os.path.join(rel_path, item), parent=self)
+ elif item == "EventService":
+ self.components[item] = RfEventServiceObj(base_path, os.path.join(rel_path, item), parent=self)
+
+ def final_init_processing(self, base_path, rel_path):
+ print("\n\n{}".format(self.res_data['Name']))
+
+
+class RfOdataServiceDoc(RfResource):
+ pass
+
+
+class RfOdataMetadata(RfResourceRaw):
+ pass
+
+
+class RfResourceDirectoryObj(RfResource):
+ pass
+
+
+class RfRegistryCollection(RfCollection):
+ def element_type(self):
+ return RfRegistry
+
+
+class RfRegistry(RfResource):
+ pass
+
+
+class RfEventServiceObj(RfResource):
+ def create_sub_objects(self, base_path, rel_path):
+ resource_path = os.path.join(base_path, rel_path);
+ contents = os.listdir(resource_path)
+ for item in contents:
+ if item == "EventSubscriptions":
+ self.components[item] = RfEventSubscriptionCollection(base_path,
+ os.path.join(rel_path, item),
+ parent=self)
+
+
+class RfEventSubscriptionCollection(RfCollection):
+ def element_type(self):
+ return RfEventSubscription
+
+
+class RfEventSubscription(RfResource):
+ pass
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/serviceVersions.py b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/serviceVersions.py
new file mode 100644
index 0000000000..00279e5019
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/serviceVersions.py
@@ -0,0 +1,9 @@
+# Copyright Notice:
+# Copyright 2016 Distributed Management Task Force, Inc. All rights reserved.
+# License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/Redfish-Profile-Simulator/blob/master/LICENSE.md
+
+from .resource import RfResource
+
+
+class RfServiceVersions(RfResource):
+ pass
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/sessionService.py b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/sessionService.py
new file mode 100644
index 0000000000..0eeb93b91a
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/sessionService.py
@@ -0,0 +1,41 @@
+# Copyright Notice:
+# Copyright 2016 Distributed Management Task Force, Inc. All rights reserved.
+# License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/Redfish-Profile-Simulator/blob/master/LICENSE.md
+
+import os
+
+from .resource import RfResource, RfCollection
+
+
+class RfSessionServiceObj(RfResource):
+ # create instance of sessionService
+ def create_sub_objects(self, base_path, rel_path):
+ self.components["Sessions"] = RfSessionCollection(base_path,
+ os.path.normpath("redfish/v1/SessionService/Sessions"),
+ parent=self)
+
+ def patch_resource(self, patch_data):
+ # first verify client didn't send us a property we cant patch
+ for key in patch_data.keys():
+ if key != "SessionTimeout":
+ return 4, 400, "Invalid Patch Property Sent", ""
+ # now patch the valid properties sent
+ if "SessionTimeout" in patch_data:
+ new_val = patch_data['SessionTimeout']
+ if new_val < 30 or new_val > 86400:
+ return 4, 400, "Bad Request-not in correct range", ""
+ else:
+ self.res_data['SessionTimeout'] = new_val
+ return 0, 204, None, None
+ else:
+ return 4, 400, "Invalid Patch Property Sent", ""
+
+
+class RfSessionCollection(RfCollection):
+ def element_type(self):
+ return RfSessionObj
+
+
+# Service Collection Entries
+class RfSessionObj(RfResource):
+ pass
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/storage.py b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/storage.py
new file mode 100644
index 0000000000..04586d8332
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/storage.py
@@ -0,0 +1,116 @@
+# Copyright Notice:
+# Copyright 2016 Distributed Management Task Force, Inc. All rights reserved.
+# License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/Redfish-Profile-Simulator/blob/master/LICENSE.md
+
+import os
+
+from .resource import RfResource, RfCollection
+
+
+class RfSimpleStorageCollection(RfCollection):
+ def element_type(self):
+ return RfSimpleStorage
+
+
+class RfSimpleStorage(RfResource):
+ pass
+
+
+class RfSmartStorage(RfResource):
+ def create_sub_objects(self, base_path, rel_path):
+ resource_path = os.path.join(base_path, rel_path);
+ contents = os.listdir(resource_path)
+ for item in contents:
+ if item == "ArrayControllers":
+ self.components[item] = RfArrayControllerCollection(base_path,
+ os.path.join(rel_path, item),
+ parent=self)
+ if item == "HostBusAdapters":
+ self.components[item] = RfHostBusAdapterCollection(base_path,
+ os.path.join(rel_path, item),
+ parent=self)
+
+
+class RfArrayControllerCollection(RfCollection):
+ def element_type(self):
+ return RfArrayController
+
+
+class RfArrayController(RfResource):
+ def create_sub_objects(self, base_path, rel_path):
+ resource_path = os.path.join(base_path, rel_path);
+ contents = os.listdir(resource_path)
+ for item in contents:
+ if item == "DiskDrives":
+ self.components[item] = RfDiskDriveCollection(base_path, os.path.join(rel_path, item),
+ parent=self)
+ if item == "LogicalDrives":
+ self.components[item] = RfLogicalDriveCollection(base_path, os.path.join(rel_path, item),
+ parent=self)
+
+ if item == "StorageEnclosures":
+ self.components[item] = RfStorageEnclosureCollection(base_path, os.path.join(rel_path, item),
+ parent=self)
+ if item == "UnconfiguredDrives":
+ self.components[item] = RfUnconfiguredDriveCollection(base_path, os.path.join(rel_path, item),
+ parent=self)
+
+
+class RfHostBusAdapterCollection(RfCollection):
+ def element_type(self):
+ return RfHostBusAdapter
+
+
+class RfHostBusAdapter(RfResource):
+ pass
+
+
+class RfDiskDriveCollection(RfCollection):
+ def element_type(self):
+ return RfDiskDrive
+
+
+class RfDiskDrive(RfResource):
+ pass
+
+
+class RfLogicalDriveCollection(RfCollection):
+ def element_type(self):
+ return RfLogicalDrive
+
+
+class RfLogicalDrive(RfResource):
+ def create_sub_objects(self, base_path, rel_path):
+ resource_path = os.path.join(base_path, rel_path);
+ contents = os.listdir(resource_path)
+ for item in contents:
+ if item == "DataDrives":
+ self.components[item] = RfDataDriveCollection(base_path, os.path.join(rel_path, item),
+ parent=self)
+
+
+class RfDataDriveCollection(RfCollection):
+ def element_type(self):
+ return RfDataDrive
+
+
+class RfDataDrive(RfResource):
+ pass
+
+
+class RfStorageEnclosureCollection(RfCollection):
+ def element_type(self):
+ return RfStorageEnclosure
+
+
+class RfStorageEnclosure(RfResource):
+ pass
+
+
+class RfUnconfiguredDriveCollection(RfCollection):
+ def element_type(self):
+ return RfUnconfiguredDrive
+
+
+class RfUnconfiguredDrive(RfResource):
+ pass
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/systems.py b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/systems.py
new file mode 100644
index 0000000000..b107f035db
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/systems.py
@@ -0,0 +1,198 @@
+# Copyright Notice:
+# Copyright 2016 Distributed Management Task Force, Inc. All rights reserved.
+# License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/Redfish-Profile-Simulator/blob/master/LICENSE.md
+
+import os
+
+from .common_services import RfLogServiceCollection
+from .network import RfEthernetCollection, RfNetworkInterfaceCollection
+from .resource import RfResource, RfCollection
+from .storage import RfSimpleStorageCollection, RfSmartStorage
+
+
+class RfSystemsCollection(RfCollection):
+ def element_type(self):
+ return RfSystemObj
+
+
+class RfSystemObj(RfResource):
+ def create_sub_objects(self, base_path, rel_path):
+ resource_path = os.path.join(base_path, rel_path)
+ contents = os.listdir(resource_path)
+ for item in contents:
+ if item == "Bios":
+ self.components[item] = RfBios(base_path, os.path.join(rel_path, item), parent=self)
+ elif item == "EthernetInterfaces":
+ self.components[item] = RfEthernetCollection(base_path, os.path.join(rel_path, item), parent=self)
+ elif item == "LogServices":
+ self.components[item] = RfLogServiceCollection(base_path, os.path.join(rel_path, item), parent=self)
+ elif item == "Memory":
+ self.components[item] = RfMemoryCollection(base_path, os.path.join(rel_path, item), parent=self)
+ elif item == "Processors":
+ self.components[item] = RfProcessorCollection(base_path, os.path.join(rel_path, item), parent=self)
+ elif item == "SimpleStorage":
+ self.components[item] = RfSimpleStorageCollection(base_path, os.path.join(rel_path, item), parent=self)
+ elif item == "SmartStorage":
+ self.components[item] = RfSmartStorage(base_path, os.path.join(rel_path, item), parent=self)
+ elif item == "SecureBoot":
+ self.components[item] = RfSecureBoot(base_path, os.path.join(rel_path, item), parent=self)
+ elif item == "NetworkInterfaces":
+ self.components[item] = RfNetworkInterfaceCollection(base_path, os.path.join(rel_path, item), parent=self)
+ elif item == "PCIeDevices":
+ self.components[item] = RfPCIeDeviceCollection(base_path, os.path.join(rel_path, item), parent=self)
+ elif item == "PCISlots":
+ self.components[item] = RfPCISlotCollection(base_path, os.path.join(rel_path, item), parent=self)
+ elif item == "FirmwareInventory":
+ self.components[item] = RfSystemFirmwareInventory(base_path, os.path.join(rel_path, item), parent=self)
+ elif item == "USBDevices":
+ self.components[item] = RfUSBDeviceCollection(base_path, os.path.join(rel_path, item), parent=self)
+ elif item == "USBPorts":
+ self.components[item] = RfUSBPortCollection(base_path, os.path.join(rel_path, item), parent=self)
+
+ def patch_resource(self, patch_data):
+ # first verify client didn't send us a property we cant patch
+ for key in patch_data.keys():
+ if key != "AssetTag" and key != "IndicatorLED" and key != "Boot":
+ return 4, 400, "Invalid Patch Property Sent", ""
+ elif key == "Boot":
+ for prop2 in patch_data["Boot"].keys():
+ if prop2 != "BootSourceOverrideEnabled" and prop2 != "BootSourceOverrideTarget":
+ return 4, 400, "Invalid Patch Property Sent", ""
+ # now patch the valid properties sent
+ if "AssetTag" in patch_data:
+ print("assetTag:{}".format(patch_data["AssetTag"]))
+ self.res_data['AssetTag'] = patch_data['AssetTag']
+ if "IndicatorLED" in patch_data:
+ self.res_data['IndicatorLED'] = patch_data['IndicatorLED']
+ if "Boot" in patch_data:
+ boot_data = patch_data["Boot"]
+ if "BootSourceOverrideEnabled" in boot_data:
+ value = boot_data["BootSourceOverrideEnabled"]
+ valid_values = ["Once", "Disabled", "Continuous"]
+ if value in valid_values:
+ self.res_data['Boot']['BootSourceOverrideEnabled'] = value
+ else:
+ return 4, 400, "Invalid_Value_Specified: BootSourceOverrideEnable", ""
+ if "BootSourceOverrideTarget" in boot_data:
+ value = boot_data["BootSourceOverrideTarget"]
+ valid_values = self.res_data['Boot']['BootSourceOverrideTarget@Redfish.AllowableValues']
+ if value in valid_values:
+ self.res_data['Boot']['BootSourceOverrideTarget'] = value
+ else:
+ return 4, 400, "Invalid_Value_Specified: BootSourceOverrideTarget", ""
+ return 0, 204, None, None
+
+ def reset_resource(self, reset_data):
+ if "ResetType" in reset_data:
+ # print("RESETDATA: {}".format(resetData))
+ value = reset_data['ResetType']
+ valid_values = self.res_data["Actions"]["#ComputerSystem.Reset"]["ResetType@Redfish.AllowableValues"]
+ if value in valid_values:
+ # it is a supoported reset action modify other properties appropritely
+ if value == "On" or value == "ForceRestart" or value == "GracefulRestart":
+ self.res_data["PowerState"] = "On"
+ print("PROFILE_SIM--SERVER WAS RESET. power now ON")
+ elif value == "GracefulShutdown" or value == "ForceOff":
+ self.res_data["PowerState"] = "Off"
+ print("PROFILE_SIM--SERVER WAS RESET. Power now Off")
+ return 0, 204, "System Reset", ""
+ else:
+ return 4, 400, "Invalid reset value: ResetType", ""
+ else: # invalid request
+ return 4, 400, "Invalid request property", ""
+
+
+# subclass Logs Collection
+class RfMemoryCollection(RfCollection):
+ def element_type(self):
+ return RfMemory
+
+
+class RfMemory(RfResource):
+ pass
+
+
+class RfProcessorCollection(RfCollection):
+ def element_type(self):
+ return RfProcessor
+
+
+class RfProcessor(RfResource):
+ pass
+
+
+class RfBios(RfResource):
+ def create_sub_objects(self, base_path, rel_path):
+ resource_path = os.path.join(base_path, rel_path)
+ contents = os.listdir(resource_path)
+ for item in contents:
+ if item == "Settings":
+ self.components[item] = RfBiosSettings(base_path, os.path.join(rel_path, item), parent=self)
+
+ def reset_resource(self, req_data):
+ print("bios was reset")
+ return 0, 204, "Bios Reset", ""
+
+ def change_password(self, req_data):
+ if "PasswordName" in req_data and "OldPassword" in req_data and "NewPassword" in req_data:
+ print("changed password of type %s" % req_data["PasswordName"])
+ return 0, 204, "Password Change", ""
+ else: # invalid request
+ return 4, 400, "Invalid request property", ""
+
+
+class RfBiosSettings(RfResource):
+ def patch_resource(self, patch_data):
+ if "Attributes" not in patch_data:
+ return 4, 400, "Invalid Payload. No Attributes found", ""
+ for key in patch_data["Attributes"].keys():
+ # verify client didn't send us a property we cant patch
+ if key not in self.res_data["Attributes"]:
+ return 4, 400, "Invalid Patch Property Sent", ""
+ else:
+ self.parent.res_data["Attributes"][key] = patch_data["Attributes"][key]
+ return 0, 204, None, None
+
+
+class RfPCIeDeviceCollection(RfCollection):
+ def element_type(self):
+ return RfPCIeDevice
+
+
+class RfPCIeDevice(RfResource):
+ pass
+
+
+class RfPCISlotCollection(RfCollection):
+ def element_type(self):
+ return RfPCISlot
+
+
+class RfPCISlot(RfResource):
+ pass
+
+
+class RfSecureBoot(RfResource):
+ pass
+
+
+class RfSystemFirmwareInventory(RfResource):
+ pass
+
+
+class RfUSBDeviceCollection(RfCollection):
+ def element_type(self):
+ return RfUSBDevice
+
+
+class RfUSBDevice(RfResource):
+ pass
+
+
+class RfUSBPortCollection(RfCollection):
+ def element_type(self):
+ return RfUSBPort
+
+
+class RfUSBPort(RfResource):
+ pass
diff --git a/RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/updateService.py b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/updateService.py
new file mode 100644
index 0000000000..66bdf35f42
--- /dev/null
+++ b/RedfishClientPkg/Tools/Redfish-Profile-Simulator/v1sim/updateService.py
@@ -0,0 +1,84 @@
+# Copyright Notice:
+# Copyright 2016 Distributed Management Task Force, Inc. All rights reserved.
+# License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/Redfish-Profile-Simulator/blob/master/LICENSE.md
+
+import os
+
+from .resource import RfResource, RfCollection
+
+
+class RfUpdateServiceObj(RfResource):
+ def create_sub_objects(self, base_path, rel_path):
+ if os.path.isdir(os.path.join(base_path, os.path.normpath("redfish/v1/UpdateService/ComponentRepository"))):
+ self.components["ComponentRepository"] \
+ = RfComponentRepositoryCollection(base_path,
+ os.path.normpath("redfish/v1/UpdateService/ComponentRepository"),
+ parent=self)
+ if os.path.isdir(os.path.join(base_path, os.path.normpath("redfish/v1/UpdateService/FirmwareInventory"))):
+ self.components["FirmwareInventory"] \
+ = RfFirmwareInventoryCollection(base_path,
+ os.path.normpath("redfish/v1/UpdateService/FirmwareInventory"),
+ parent=self)
+
+ if os.path.isdir(os.path.join(base_path, os.path.normpath("redfish/v1/UpdateService/InstallSets"))):
+ self.components["InstallSets"] \
+ = RfInstallSetCollection(base_path,
+ os.path.normpath("redfish/v1/UpdateService/InstallSets"),
+ parent=self)
+
+ if os.path.isdir(os.path.join(base_path, os.path.normpath("redfish/v1/UpdateService/SoftwareInventory"))):
+ self.components["SoftwareInventory"] \
+ = RfSoftwareInventoryCollection(base_path,
+ os.path.normpath("redfish/v1/UpdateService/SoftwareInventory"),
+ parent=self)
+
+ if os.path.isdir(os.path.join(base_path, os.path.normpath("redfish/v1/UpdateService/UpdateTaskQueue"))):
+ self.components["UpdateTaskQueue"] \
+ = RfUpdateTaskQueueCollection(base_path,
+ os.path.normpath("redfish/v1/UpdateService/UpdateTaskQueue"),
+ parent=self)
+
+
+class RfComponentRepositoryCollection(RfCollection):
+ def element_type(self):
+ return RfComponentRepository
+
+
+class RfComponentRepository(RfResource):
+ pass
+
+
+class RfFirmwareInventoryCollection(RfCollection):
+ def element_type(self):
+ return RfComponentRepository
+
+
+class RfFirmwareInventory(RfResource):
+ pass
+
+
+class RfInstallSetCollection(RfCollection):
+ def element_type(self):
+ return RfInstallSet
+
+
+class RfInstallSet(RfResource):
+ pass
+
+
+class RfSoftwareInventoryCollection(RfCollection):
+ def element_type(self):
+ return RfSoftwareInventory
+
+
+class RfSoftwareInventory(RfResource):
+ pass
+
+
+class RfUpdateTaskQueueCollection(RfCollection):
+ def element_type(self):
+ return RfUpdateTaskQueue
+
+
+class RfUpdateTaskQueue(RfResource):
+ pass
--
2.17.1

5261 - 5280 of 84076