Adding centralized redfish client api

Adding some basic classes around redfish client.

Change-Id: I5cd581470c0620845992263e323e3f3e1c9767f2
Signed-off-by: jpike <jason.pike@windriver.com>
This commit is contained in:
jpike
2025-09-09 11:51:32 -04:00
parent f21a516452
commit b7fe87a346
16 changed files with 1611 additions and 117 deletions

View File

@@ -33,4 +33,5 @@ sphinx = "==8.1.3"
sphinx-autobuild = "==2024.2.4"
openstackdocstheme = "==3.4.1"
reno = "==4.1.0"
python-redfish = "==0.4.4"
redfish = "*"

289
Pipfile.lock generated
View File

@@ -1,7 +1,7 @@
{
"_meta": {
"hash": {
"sha256": "91b3ddf1a01a08c3c3b52dd48e801b3155f312616b504656e841ae451d5b7616"
"sha256": "bd8e56309a6f27724ae3060a83244cb8839bd0773d89c73fc8146be05c8f53ba"
},
"pipfile-spec": 6,
"requires": {
@@ -110,11 +110,11 @@
},
"certifi": {
"hashes": [
"sha256:3d5da6925056f6f18f119200434a4780a94263f10d1c21d032a6f6b2baa20651",
"sha256:ca78db4565a652026a4db2bcdf68f2fb589ea80d0be70e03929ed730746b84fe"
"sha256:e564105f78ded564e3ae7c923924435e1daa7463faeab5bb932bc53ffae63407",
"sha256:f6c12493cfb1b06ba2ff328595af9350c65d6644968e5d3a2ffd78699af217a5"
],
"markers": "python_version >= '3.6'",
"version": "==2025.1.31"
"markers": "python_version >= '3.7'",
"version": "==2025.8.3"
},
"cffi": {
"hashes": [
@@ -199,101 +199,88 @@
},
"charset-normalizer": {
"hashes": [
"sha256:0167ddc8ab6508fe81860a57dd472b2ef4060e8d378f0cc555707126830f2537",
"sha256:01732659ba9b5b873fc117534143e4feefecf3b2078b0a6a2e925271bb6f4cfa",
"sha256:01ad647cdd609225c5350561d084b42ddf732f4eeefe6e678765636791e78b9a",
"sha256:04432ad9479fa40ec0f387795ddad4437a2b50417c69fa275e212933519ff294",
"sha256:0907f11d019260cdc3f94fbdb23ff9125f6b5d1039b76003b5b0ac9d6a6c9d5b",
"sha256:0924e81d3d5e70f8126529951dac65c1010cdf117bb75eb02dd12339b57749dd",
"sha256:09b26ae6b1abf0d27570633b2b078a2a20419c99d66fb2823173d73f188ce601",
"sha256:09b5e6733cbd160dcc09589227187e242a30a49ca5cefa5a7edd3f9d19ed53fd",
"sha256:0af291f4fe114be0280cdd29d533696a77b5b49cfde5467176ecab32353395c4",
"sha256:0f55e69f030f7163dffe9fd0752b32f070566451afe180f99dbeeb81f511ad8d",
"sha256:1a2bc9f351a75ef49d664206d51f8e5ede9da246602dc2d2726837620ea034b2",
"sha256:22e14b5d70560b8dd51ec22863f370d1e595ac3d024cb8ad7d308b4cd95f8313",
"sha256:234ac59ea147c59ee4da87a0c0f098e9c8d169f4dc2a159ef720f1a61bbe27cd",
"sha256:2369eea1ee4a7610a860d88f268eb39b95cb588acd7235e02fd5a5601773d4fa",
"sha256:237bdbe6159cff53b4f24f397d43c6336c6b0b42affbe857970cefbb620911c8",
"sha256:28bf57629c75e810b6ae989f03c0828d64d6b26a5e205535585f96093e405ed1",
"sha256:2967f74ad52c3b98de4c3b32e1a44e32975e008a9cd2a8cc8966d6a5218c5cb2",
"sha256:2a75d49014d118e4198bcee5ee0a6f25856b29b12dbf7cd012791f8a6cc5c496",
"sha256:2bdfe3ac2e1bbe5b59a1a63721eb3b95fc9b6817ae4a46debbb4e11f6232428d",
"sha256:2d074908e1aecee37a7635990b2c6d504cd4766c7bc9fc86d63f9c09af3fa11b",
"sha256:2fb9bd477fdea8684f78791a6de97a953c51831ee2981f8e4f583ff3b9d9687e",
"sha256:311f30128d7d333eebd7896965bfcfbd0065f1716ec92bd5638d7748eb6f936a",
"sha256:329ce159e82018d646c7ac45b01a430369d526569ec08516081727a20e9e4af4",
"sha256:345b0426edd4e18138d6528aed636de7a9ed169b4aaf9d61a8c19e39d26838ca",
"sha256:363e2f92b0f0174b2f8238240a1a30142e3db7b957a5dd5689b0e75fb717cc78",
"sha256:3a3bd0dcd373514dcec91c411ddb9632c0d7d92aed7093b8c3bbb6d69ca74408",
"sha256:3bed14e9c89dcb10e8f3a29f9ccac4955aebe93c71ae803af79265c9ca5644c5",
"sha256:44251f18cd68a75b56585dd00dae26183e102cd5e0f9f1466e6df5da2ed64ea3",
"sha256:44ecbf16649486d4aebafeaa7ec4c9fed8b88101f4dd612dcaf65d5e815f837f",
"sha256:4532bff1b8421fd0a320463030c7520f56a79c9024a4e88f01c537316019005a",
"sha256:49402233c892a461407c512a19435d1ce275543138294f7ef013f0b63d5d3765",
"sha256:4c0907b1928a36d5a998d72d64d8eaa7244989f7aaaf947500d3a800c83a3fd6",
"sha256:4d86f7aff21ee58f26dcf5ae81a9addbd914115cdebcbb2217e4f0ed8982e146",
"sha256:5777ee0881f9499ed0f71cc82cf873d9a0ca8af166dfa0af8ec4e675b7df48e6",
"sha256:5df196eb874dae23dcfb968c83d4f8fdccb333330fe1fc278ac5ceeb101003a9",
"sha256:619a609aa74ae43d90ed2e89bdd784765de0a25ca761b93e196d938b8fd1dbbd",
"sha256:6e27f48bcd0957c6d4cb9d6fa6b61d192d0b13d5ef563e5f2ae35feafc0d179c",
"sha256:6ff8a4a60c227ad87030d76e99cd1698345d4491638dfa6673027c48b3cd395f",
"sha256:73d94b58ec7fecbc7366247d3b0b10a21681004153238750bb67bd9012414545",
"sha256:7461baadb4dc00fd9e0acbe254e3d7d2112e7f92ced2adc96e54ef6501c5f176",
"sha256:75832c08354f595c760a804588b9357d34ec00ba1c940c15e31e96d902093770",
"sha256:7709f51f5f7c853f0fb938bcd3bc59cdfdc5203635ffd18bf354f6967ea0f824",
"sha256:78baa6d91634dfb69ec52a463534bc0df05dbd546209b79a3880a34487f4b84f",
"sha256:7974a0b5ecd505609e3b19742b60cee7aa2aa2fb3151bc917e6e2646d7667dcf",
"sha256:7a4f97a081603d2050bfaffdefa5b02a9ec823f8348a572e39032caa8404a487",
"sha256:7b1bef6280950ee6c177b326508f86cad7ad4dff12454483b51d8b7d673a2c5d",
"sha256:7d053096f67cd1241601111b698f5cad775f97ab25d81567d3f59219b5f1adbd",
"sha256:804a4d582ba6e5b747c625bf1255e6b1507465494a40a2130978bda7b932c90b",
"sha256:807f52c1f798eef6cf26beb819eeb8819b1622ddfeef9d0977a8502d4db6d534",
"sha256:80ed5e856eb7f30115aaf94e4a08114ccc8813e6ed1b5efa74f9f82e8509858f",
"sha256:8417cb1f36cc0bc7eaba8ccb0e04d55f0ee52df06df3ad55259b9a323555fc8b",
"sha256:8436c508b408b82d87dc5f62496973a1805cd46727c34440b0d29d8a2f50a6c9",
"sha256:89149166622f4db9b4b6a449256291dc87a99ee53151c74cbd82a53c8c2f6ccd",
"sha256:8bfa33f4f2672964266e940dd22a195989ba31669bd84629f05fab3ef4e2d125",
"sha256:8c60ca7339acd497a55b0ea5d506b2a2612afb2826560416f6894e8b5770d4a9",
"sha256:91b36a978b5ae0ee86c394f5a54d6ef44db1de0815eb43de826d41d21e4af3de",
"sha256:955f8851919303c92343d2f66165294848d57e9bba6cf6e3625485a70a038d11",
"sha256:97f68b8d6831127e4787ad15e6757232e14e12060bec17091b85eb1486b91d8d",
"sha256:9b23ca7ef998bc739bf6ffc077c2116917eabcc901f88da1b9856b210ef63f35",
"sha256:9f0b8b1c6d84c8034a44893aba5e767bf9c7a211e313a9605d9c617d7083829f",
"sha256:aabfa34badd18f1da5ec1bc2715cadc8dca465868a4e73a0173466b688f29dda",
"sha256:ab36c8eb7e454e34e60eb55ca5d241a5d18b2c6244f6827a30e451c42410b5f7",
"sha256:b010a7a4fd316c3c484d482922d13044979e78d1861f0e0650423144c616a46a",
"sha256:b1ac5992a838106edb89654e0aebfc24f5848ae2547d22c2c3f66454daa11971",
"sha256:b7b2d86dd06bfc2ade3312a83a5c364c7ec2e3498f8734282c6c3d4b07b346b8",
"sha256:b97e690a2118911e39b4042088092771b4ae3fc3aa86518f84b8cf6888dbdb41",
"sha256:bc2722592d8998c870fa4e290c2eec2c1569b87fe58618e67d38b4665dfa680d",
"sha256:c0429126cf75e16c4f0ad00ee0eae4242dc652290f940152ca8c75c3a4b6ee8f",
"sha256:c30197aa96e8eed02200a83fba2657b4c3acd0f0aa4bdc9f6c1af8e8962e0757",
"sha256:c4c3e6da02df6fa1410a7680bd3f63d4f710232d3139089536310d027950696a",
"sha256:c75cb2a3e389853835e84a2d8fb2b81a10645b503eca9bcb98df6b5a43eb8886",
"sha256:c96836c97b1238e9c9e3fe90844c947d5afbf4f4c92762679acfe19927d81d77",
"sha256:d7f50a1f8c450f3925cb367d011448c39239bb3eb4117c36a6d354794de4ce76",
"sha256:d973f03c0cb71c5ed99037b870f2be986c3c05e63622c017ea9816881d2dd247",
"sha256:d98b1668f06378c6dbefec3b92299716b931cd4e6061f3c875a71ced1780ab85",
"sha256:d9c3cdf5390dcd29aa8056d13e8e99526cda0305acc038b96b30352aff5ff2bb",
"sha256:dad3e487649f498dd991eeb901125411559b22e8d7ab25d3aeb1af367df5efd7",
"sha256:dccbe65bd2f7f7ec22c4ff99ed56faa1e9f785482b9bbd7c717e26fd723a1d1e",
"sha256:dd78cfcda14a1ef52584dbb008f7ac81c1328c0f58184bf9a84c49c605002da6",
"sha256:e218488cd232553829be0664c2292d3af2eeeb94b32bea483cf79ac6a694e037",
"sha256:e358e64305fe12299a08e08978f51fc21fac060dcfcddd95453eabe5b93ed0e1",
"sha256:ea0d8d539afa5eb2728aa1932a988a9a7af94f18582ffae4bc10b3fbdad0626e",
"sha256:eab677309cdb30d047996b36d34caeda1dc91149e4fdca0b1a039b3f79d9a807",
"sha256:eb8178fe3dba6450a3e024e95ac49ed3400e506fd4e9e5c32d30adda88cbd407",
"sha256:ecddf25bee22fe4fe3737a399d0d177d72bc22be6913acfab364b40bce1ba83c",
"sha256:eea6ee1db730b3483adf394ea72f808b6e18cf3cb6454b4d86e04fa8c4327a12",
"sha256:f08ff5e948271dc7e18a35641d2f11a4cd8dfd5634f55228b691e62b37125eb3",
"sha256:f30bf9fd9be89ecb2360c7d94a711f00c09b976258846efe40db3d05828e8089",
"sha256:fa88b843d6e211393a37219e6a1c1df99d35e8fd90446f1118f4216e307e48cd",
"sha256:fc54db6c8593ef7d4b2a331b58653356cf04f67c960f584edb7c3d8c97e8f39e",
"sha256:fd4ec41f914fa74ad1b8304bbc634b3de73d2a0889bd32076342a573e0779e00",
"sha256:ffc9202a29ab3920fa812879e95a9e78b2465fd10be7fcbd042899695d75e616"
"sha256:00237675befef519d9af72169d8604a067d92755e84fe76492fef5441db05b91",
"sha256:02425242e96bcf29a49711b0ca9f37e451da7c70562bc10e8ed992a5a7a25cc0",
"sha256:027b776c26d38b7f15b26a5da1044f376455fb3766df8fc38563b4efbc515154",
"sha256:07a0eae9e2787b586e129fdcbe1af6997f8d0e5abaa0bc98c0e20e124d67e601",
"sha256:0cacf8f7297b0c4fcb74227692ca46b4a5852f8f4f24b3c766dd94a1075c4884",
"sha256:0e78314bdc32fa80696f72fa16dc61168fda4d6a0c014e0380f9d02f0e5d8a07",
"sha256:0f2be7e0cf7754b9a30eb01f4295cc3d4358a479843b31f328afd210e2c7598c",
"sha256:13faeacfe61784e2559e690fc53fa4c5ae97c6fcedb8eb6fb8d0a15b475d2c64",
"sha256:14c2a87c65b351109f6abfc424cab3927b3bdece6f706e4d12faaf3d52ee5efe",
"sha256:1606f4a55c0fd363d754049cdf400175ee96c992b1f8018b993941f221221c5f",
"sha256:16a8770207946ac75703458e2c743631c79c59c5890c80011d536248f8eaa432",
"sha256:18343b2d246dc6761a249ba1fb13f9ee9a2bcd95decc767319506056ea4ad4dc",
"sha256:18b97b8404387b96cdbd30ad660f6407799126d26a39ca65729162fd810a99aa",
"sha256:1bb60174149316da1c35fa5233681f7c0f9f514509b8e399ab70fea5f17e45c9",
"sha256:1e8ac75d72fa3775e0b7cb7e4629cec13b7514d928d15ef8ea06bca03ef01cae",
"sha256:1ef99f0456d3d46a50945c98de1774da86f8e992ab5c77865ea8b8195341fc19",
"sha256:2001a39612b241dae17b4687898843f254f8748b796a2e16f1051a17078d991d",
"sha256:23b6b24d74478dc833444cbd927c338349d6ae852ba53a0d02a2de1fce45b96e",
"sha256:252098c8c7a873e17dd696ed98bbe91dbacd571da4b87df3736768efa7a792e4",
"sha256:257f26fed7d7ff59921b78244f3cd93ed2af1800ff048c33f624c87475819dd7",
"sha256:2c322db9c8c89009a990ef07c3bcc9f011a3269bc06782f916cd3d9eed7c9312",
"sha256:30a96e1e1f865f78b030d65241c1ee850cdf422d869e9028e2fc1d5e4db73b92",
"sha256:30d006f98569de3459c2fc1f2acde170b7b2bd265dc1943e87e1a4efe1b67c31",
"sha256:31a9a6f775f9bcd865d88ee350f0ffb0e25936a7f930ca98995c05abf1faf21c",
"sha256:320e8e66157cc4e247d9ddca8e21f427efc7a04bbd0ac8a9faf56583fa543f9f",
"sha256:34a7f768e3f985abdb42841e20e17b330ad3aaf4bb7e7aeeb73db2e70f077b99",
"sha256:3653fad4fe3ed447a596ae8638b437f827234f01a8cd801842e43f3d0a6b281b",
"sha256:3cd35b7e8aedeb9e34c41385fda4f73ba609e561faedfae0a9e75e44ac558a15",
"sha256:3cfb2aad70f2c6debfbcb717f23b7eb55febc0bb23dcffc0f076009da10c6392",
"sha256:416175faf02e4b0810f1f38bcb54682878a4af94059a1cd63b8747244420801f",
"sha256:41d1fc408ff5fdfb910200ec0e74abc40387bccb3252f3f27c0676731df2b2c8",
"sha256:42e5088973e56e31e4fa58eb6bd709e42fc03799c11c42929592889a2e54c491",
"sha256:4ca4c094de7771a98d7fbd67d9e5dbf1eb73efa4f744a730437d8a3a5cf994f0",
"sha256:511729f456829ef86ac41ca78c63a5cb55240ed23b4b737faca0eb1abb1c41bc",
"sha256:53cd68b185d98dde4ad8990e56a58dea83a4162161b1ea9272e5c9182ce415e0",
"sha256:585f3b2a80fbd26b048a0be90c5aae8f06605d3c92615911c3a2b03a8a3b796f",
"sha256:5b413b0b1bfd94dbf4023ad6945889f374cd24e3f62de58d6bb102c4d9ae534a",
"sha256:5d8d01eac18c423815ed4f4a2ec3b439d654e55ee4ad610e153cf02faf67ea40",
"sha256:6aab0f181c486f973bc7262a97f5aca3ee7e1437011ef0c2ec04b5a11d16c927",
"sha256:6cf8fd4c04756b6b60146d98cd8a77d0cdae0e1ca20329da2ac85eed779b6849",
"sha256:6fb70de56f1859a3f71261cbe41005f56a7842cc348d3aeb26237560bfa5e0ce",
"sha256:6fce4b8500244f6fcb71465d4a4930d132ba9ab8e71a7859e6a5d59851068d14",
"sha256:70bfc5f2c318afece2f5838ea5e4c3febada0be750fcf4775641052bbba14d05",
"sha256:73dc19b562516fc9bcf6e5d6e596df0b4eb98d87e4f79f3ae71840e6ed21361c",
"sha256:74d77e25adda8581ffc1c720f1c81ca082921329452eba58b16233ab1842141c",
"sha256:78deba4d8f9590fe4dae384aeff04082510a709957e968753ff3c48399f6f92a",
"sha256:86df271bf921c2ee3818f0522e9a5b8092ca2ad8b065ece5d7d9d0e9f4849bcc",
"sha256:88ab34806dea0671532d3f82d82b85e8fc23d7b2dd12fa837978dad9bb392a34",
"sha256:8999f965f922ae054125286faf9f11bc6932184b93011d138925a1773830bbe9",
"sha256:8dcfc373f888e4fb39a7bc57e93e3b845e7f462dacc008d9749568b1c4ece096",
"sha256:939578d9d8fd4299220161fdd76e86c6a251987476f5243e8864a7844476ba14",
"sha256:96b2b3d1a83ad55310de8c7b4a2d04d9277d5591f40761274856635acc5fcb30",
"sha256:a2d08ac246bb48479170408d6c19f6385fa743e7157d716e144cad849b2dd94b",
"sha256:b256ee2e749283ef3ddcff51a675ff43798d92d746d1a6e4631bf8c707d22d0b",
"sha256:b5e3b2d152e74e100a9e9573837aba24aab611d39428ded46f4e4022ea7d1942",
"sha256:b89bc04de1d83006373429975f8ef9e7932534b8cc9ca582e4db7d20d91816db",
"sha256:bd28b817ea8c70215401f657edef3a8aa83c29d447fb0b622c35403780ba11d5",
"sha256:c60e092517a73c632ec38e290eba714e9627abe9d301c8c8a12ec32c314a2a4b",
"sha256:c6dbd0ccdda3a2ba7c2ecd9d77b37f3b5831687d8dc1b6ca5f56a4880cc7b7ce",
"sha256:c6e490913a46fa054e03699c70019ab869e990270597018cef1d8562132c2669",
"sha256:c6f162aabe9a91a309510d74eeb6507fab5fff92337a15acbe77753d88d9dcf0",
"sha256:c6fd51128a41297f5409deab284fecbe5305ebd7e5a1f959bee1c054622b7018",
"sha256:cc34f233c9e71701040d772aa7490318673aa7164a0efe3172b2981218c26d93",
"sha256:cc9370a2da1ac13f0153780040f465839e6cccb4a1e44810124b4e22483c93fe",
"sha256:ccf600859c183d70eb47e05a44cd80a4ce77394d1ac0f79dbd2dd90a69a3a049",
"sha256:ce571ab16d890d23b5c278547ba694193a45011ff86a9162a71307ed9f86759a",
"sha256:cf1ebb7d78e1ad8ec2a8c4732c7be2e736f6e5123a4146c5b89c9d1f585f8cef",
"sha256:d0e909868420b7049dafd3a31d45125b31143eec59235311fc4c57ea26a4acd2",
"sha256:d22dbedd33326a4a5190dd4fe9e9e693ef12160c77382d9e87919bce54f3d4ca",
"sha256:d716a916938e03231e86e43782ca7878fb602a125a91e7acb8b5112e2e96ac16",
"sha256:d79c198e27580c8e958906f803e63cddb77653731be08851c7df0b1a14a8fc0f",
"sha256:d95bfb53c211b57198bb91c46dd5a2d8018b3af446583aab40074bf7988401cb",
"sha256:e28e334d3ff134e88989d90ba04b47d84382a828c061d0d1027b1b12a62b39b1",
"sha256:ec557499516fc90fd374bf2e32349a2887a876fbf162c160e3c01b6849eaf557",
"sha256:fb6fecfd65564f208cbf0fba07f107fb661bcd1a7c389edbced3f7a493f70e37",
"sha256:fb731e5deb0c7ef82d698b0f4c5bb724633ee2a489401594c5c88b02e6cb15f7",
"sha256:fb7f67a1bfa6e40b438170ebdc8158b78dc465a5a67b6dde178a46987b244a72",
"sha256:fd10de089bcdcd1be95a2f73dbe6254798ec1bda9f450d5828c96f93e2536b9c",
"sha256:fdabf8315679312cfa71302f9bd509ded4f2f263fb5b765cf1433b39106c3cc9"
],
"markers": "python_version >= '3.7'",
"version": "==3.4.1"
"version": "==3.4.3"
},
"click": {
"hashes": [
@@ -348,6 +335,14 @@
"markers": "python_version >= '3.7' and python_full_version not in '3.9.0, 3.9.1'",
"version": "==44.0.1"
},
"decorator": {
"hashes": [
"sha256:65f266143752f734b0a7cc83c46f4618af75b8c5911b00ccb61d0ac9b6da0360",
"sha256:d316bb415a2d9e2d2b3abcc4084c6502fc09240e292cd76a76afc106a1c8e04a"
],
"markers": "python_version >= '3.8'",
"version": "==5.2.1"
},
"distlib": {
"hashes": [
"sha256:47f8c22fd27c27e25a65601af709b38e4f0a45ea4fc2e710f65755fa8caaaf87",
@@ -445,6 +440,15 @@
"markers": "python_full_version >= '3.8.1'",
"version": "==7.0.0"
},
"future": {
"hashes": [
"sha256:929292d34f5872e70396626ef385ec22355a1fae8ad29e1a734c3e43f9fbc216",
"sha256:bd2968309307861edae1458a4f8a4f3598c03be43b97521076aebf5d94c07b05"
],
"index": "pypi",
"markers": "python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2'",
"version": "==1.0.0"
},
"h11": {
"hashes": [
"sha256:8f19fbbe99e72420ff35c00b27a34cb9937e902a8b810e2c88300c6f0a3b699d",
@@ -505,12 +509,12 @@
},
"jinja2": {
"hashes": [
"sha256:8fefff8dc3034e27bb80d67c671eb8a9bc424c0ef4c0826edbff304cceff43bb",
"sha256:aba0f4dc9ed8013c424088f68a5c226f7d6097ed89b246d7749c2ec4175c6adb"
"sha256:0137fb05990d35f1275a587e9aee6d56da821fc83491a0fb838183be43f66d6d",
"sha256:85ece4451f492d0c13c5dd7c13a64681a86afae63a5f347908daf103ce6d2f67"
],
"index": "pypi",
"markers": "python_version >= '3.7'",
"version": "==3.1.5"
"version": "==3.1.6"
},
"json5": {
"hashes": [
@@ -521,6 +525,28 @@
"markers": "python_version >= '3.8'",
"version": "==0.9.24"
},
"jsonpatch": {
"hashes": [
"sha256:0ae28c0cd062bbd8b8ecc26d7d164fbbea9652a1a3693f3b956c1eae5145dade",
"sha256:9fcd4009c41e6d12348b4a0ff2563ba56a2923a7dfee731d004e212e1ee5030c"
],
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6'",
"version": "==1.33"
},
"jsonpath-rw": {
"hashes": [
"sha256:05c471281c45ae113f6103d1268ec7a4831a2e96aa80de45edc89b11fac4fbec"
],
"version": "==1.4.0"
},
"jsonpointer": {
"hashes": [
"sha256:13e088adc14fca8b6aa8177c044e12701e6ad4b28ff10e65f2267a90109c9942",
"sha256:2b2d729f2091522d61c3b31f82e11870f60b68f43fbc705cb76bf4b832af59ef"
],
"markers": "python_version >= '3.7'",
"version": "==3.0.0"
},
"livereload": {
"hashes": [
"sha256:3d9bf7c05673df06e32bea23b494b8d36ca6d10f7d5c3c8a6989608c09c986a9",
@@ -686,6 +712,13 @@
"markers": "python_version >= '3.8'",
"version": "==1.5.0"
},
"ply": {
"hashes": [
"sha256:00c7c1aaa88358b9c765b6d3000c6eec0ba42abca5351b095321aef446081da3",
"sha256:096f9b8350b65ebd2fd1346b12452efe5b9607f7482813ffca50c22722a807ce"
],
"version": "==3.11"
},
"pre-commit": {
"hashes": [
"sha256:5eae9e10c2b5ac51577c3452ec0a490455c45a0533f7960f993a0d01e59decab",
@@ -865,14 +898,6 @@
"markers": "python_version >= '3.8'",
"version": "==8.1.1"
},
"python-redfish": {
"hashes": [
"sha256:6c37652481dcd5b391e3741234b34f80ece3bcb62b07d9169f6ee3d6495c9e2f",
"sha256:ef5fbbf62cd8d474075c9844a369182c4e1b10dac2e7d4bd461f52c6f1e89ce8"
],
"index": "pypi",
"version": "==0.4.4"
},
"pyyaml": {
"hashes": [
"sha256:01179a4a8559ab5de078078f37e5c1a30d76bb88519906844fd7bdea1b7729ff",
@@ -932,6 +957,14 @@
"markers": "python_version >= '3.8'",
"version": "==6.0.2"
},
"redfish": {
"hashes": [
"sha256:19c102cfabf56796eb37195c3ef187d6df45d3f32b3667be5d095bcbbb8379a9",
"sha256:b3cbd54b246ee796b2a9c90226c02ea5532565c1732594989bce79f777a38c22"
],
"index": "pypi",
"version": "==3.3.3"
},
"reno": {
"hashes": [
"sha256:9b6a2cb768ffb7f7c74bbd76822acff70840a1219f45bcec5080dbc108df4f96",
@@ -943,12 +976,28 @@
},
"requests": {
"hashes": [
"sha256:55365417734eb18255590a9ff9eb97e9e1da868d4ccd6402399eaf68af20a760",
"sha256:70761cfe03c773ceb22aa2f671b4757976145175cdfca038c02654d061d6dcc6"
"sha256:2462f94637a34fd532264295e186976db0f5d453d1cdd31473c85a6a161affb6",
"sha256:dbba0bac56e100853db0ea71b82b4dfd5fe2bf6d3754a8893c3af500cec7d7cf"
],
"index": "pypi",
"markers": "python_version >= '3.8'",
"version": "==2.32.3"
"markers": "python_version >= '3.9'",
"version": "==2.32.5"
},
"requests-toolbelt": {
"hashes": [
"sha256:7681a0a3d047012b5bdc0ee37d7f8f07ebe76ab08caeccfc3921ce23c88d5bc6",
"sha256:cccfdd665f0a24fcf4726e690f65639d272bb0637b9b92dfd91a5568ccf6bd06"
],
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
"version": "==1.0.0"
},
"requests-unixsocket": {
"hashes": [
"sha256:60c4942e9dbecc2f64d611039fb1dfc25da382083c6434ac0316dca3ff908f4d",
"sha256:b2596158c356ecee68d27ba469a52211230ac6fb0cde8b66afb19f0ed47a1995"
],
"markers": "python_version >= '3.9'",
"version": "==0.4.1"
},
"selenium": {
"hashes": [
@@ -967,6 +1016,14 @@
"markers": "python_version >= '3.9'",
"version": "==75.8.0"
},
"six": {
"hashes": [
"sha256:4721f391ed90541fddacab5acf947aa0d3dc7d27b2e1e8eda2be8970586c3274",
"sha256:ff70335d468e7eb6ec65b95b99d3a2836546063f63acc5171de367e834932a81"
],
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2'",
"version": "==1.17.0"
},
"sniffio": {
"hashes": [
"sha256:2f6da418d1f1e0fddd844478f41680e794e6051915791a034ff65e5f100525a2",
@@ -1125,11 +1182,11 @@
"socks"
],
"hashes": [
"sha256:1cee9ad369867bfdbbb48b7dd50374c0967a0bb7710050facf0dd6911440e3df",
"sha256:f8c5449b3cf0861679ce7e0503c7b44b5ec981bec0d1d3795a07f1ba96f0204d"
"sha256:3fc47733c7e419d4bc3f6b3dc2b4f890bb743906a30d56ba4a5bfa4bbff92760",
"sha256:e6b01673c0fa6a13e374b50871808eb3bf7046c4b125b216f6bf1cc604cff0dc"
],
"markers": "python_version >= '3.9'",
"version": "==2.3.0"
"version": "==2.5.0"
},
"virtualenv": {
"hashes": [

View File

@@ -0,0 +1,6 @@
class RedFishClientUnreachable(Exception):
"""
Class for RedFish Unreachable exception
"""
pass

View File

@@ -0,0 +1,130 @@
import time
from typing import Any, Dict, Optional
import redfish
from redfish.rest.v1 import HttpClient
from framework.exceptions.redfish_client_unreachable_exception import RedFishClientUnreachable
from framework.logging.automation_logger import get_logger
class RedFishClient:
"""
Class for RedFish client
"""
def __init__(self, bmc_ip: str, username: str, password: str, timeout: int = 120):
self.bmc_ip = bmc_ip
self.username = username
self.password = password
self.timeout = timeout
self.client_obj = None
self.status_code: int = -1
def _get_connection(self) -> HttpClient:
"""
Gets the connection, creates one if it doesn't exist
Returns:
HttpClient: the connection
"""
if self.client_obj is None:
self.client_obj = self._connect()
return self.client_obj
def _connect(self) -> HttpClient:
"""
Create a connection
Returns:
HttpClient: the connection
"""
self.status_code = -1
end_time = time.time() + self.timeout
last_exception = None
while time.time() < end_time:
try:
get_logger().log_info(f"Getting a Redfish client to {self.bmc_ip} ....")
self.client_obj = redfish.redfish_client(base_url=f"https://{self.bmc_ip}", username=self.username, password=self.password, timeout=30)
self.client_obj.login(auth="session")
get_logger().log_info(f"Redfish client established for {self.bmc_ip} ....")
return self.client_obj
except Exception as e:
last_exception = e
get_logger().log_debug(f"Failed to establish a redfish client: {e}\n Retrying ...")
else:
err_msg = f"Failed to open a redfish client for server with ip: {self.bmc_ip} " f"and credentials {self.username}/{self.password}: {last_exception}"
get_logger().log_warning(err_msg)
raise RedFishClientUnreachable(err_msg)
def get(self, path: str, args: Optional[Dict[str, Any]] = None, headers: Optional[Dict[str, Any]] = None) -> Any:
"""
Executes the REST API GET request to query resources' data.
Args:
path (str): The URI identifying the resource
args (Optional[Dict[str, Any]]): Any additional arguments for the REST API HTTP method
headers (Optional[Dict[str, Any]]): Headers to be appended to the REST API GET request
Returns:
Any: Response object from the REST API call
"""
get_logger().log_debug("running RedFish API:\n" f"METHOD: GET\n" f"URL: {self.bmc_ip}{path}\n" f"ARGS: {args}\n" f"HEADERS: {headers}")
resp = self._get_connection().get(path=path, args=args, headers=headers)
end_time = time.time() + self.timeout
while resp.is_processing and time.time() < end_time:
time.sleep(1)
status = resp.status
get_logger().log_debug(f"Response from RedFish API on URL: {self.bmc_ip}{path}\n:" f"Status: {status}\n" f"Data: {resp.dict}")
self.status_code = resp.status
return resp
def post(self, path: str, args: Optional[Dict[str, Any]] = None, body: Optional[Dict[str, Any]] = None, headers: Optional[Dict[str, Any]] = None) -> Any:
"""
Executes the REST API POST request to create or use actions on resources.
Args:
path (str): The URI identifying the resource
args (Optional[Dict[str, Any]]): Any additional arguments for the REST API HTTP method
body (Optional[Dict[str, Any]]): The payload to be appended to the POST request
headers (Optional[Dict[str, Any]]): Headers to be appended to the REST API POST request
Returns:
Any: Response object from the REST API call
"""
get_logger().log_debug("running RedFish API:\n" f"METHOD: POST\n" f"URL: {self.bmc_ip}{path}\n" f"ARGS: {args}\n" f"BODY: {body}\n" f"HEADERS: {headers}")
resp = self._get_connection().post(path=path, args=args, body=body, headers=headers)
get_logger().log_debug(f"Response from RedFish API on URL: {self.bmc_ip}{path}\n:" f"Status: {resp.status}\n")
return resp
def patch(self, path: str, args: Optional[Dict[str, Any]] = None, body: Optional[Dict[str, Any]] = None, headers: Optional[Dict[str, Any]] = None) -> Any:
"""
Executes the REST API PATCH request to change or add properties on resources.
Args:
path (str): The URI identifying the resource
args (Optional[Dict[str, Any]]): Any additional arguments for the REST API HTTP method
body (Optional[Dict[str, Any]]): The payload to be appended to the PATCH request
headers (Optional[Dict[str, Any]]): Headers to be appended to the REST API PATCH request
Returns:
Any: Response object from the REST API call
"""
return self._get_connection().patch(path=path, args=args, body=body, headers=headers)
def get_status_code(self) -> int:
"""
Getter for status code
Returns:
int: The status code
"""
return self.status_code

View File

@@ -0,0 +1,54 @@
class Boot:
"""Represents system boot configuration."""
def __init__(self, boot_source_override_enabled: str, boot_source_override_target: str, boot_order: list):
"""Initialize Boot object.
Args:
boot_source_override_enabled (str): Boot source override enabled status.
boot_source_override_target (str): Boot source override target.
boot_order (list): Boot order list.
"""
self.boot_source_override_enabled = boot_source_override_enabled
self.boot_source_override_target = boot_source_override_target
self.boot_order = boot_order
def get_boot_source_override_enabled(self) -> str:
"""Get boot source override enabled status.
Returns:
str: Boot source override enabled status.
"""
return self.boot_source_override_enabled
def set_boot_source_override_enabled(self, value: str) -> None:
"""Set boot source override enabled status.
Args:
value (str): Boot source override enabled status.
"""
self.boot_source_override_enabled = value
def get_boot_source_override_target(self) -> str:
"""Get boot source override target.
Returns:
str: Boot source override target.
"""
return self.boot_source_override_target
def set_boot_source_override_target(self, value: str) -> None:
"""Set boot source override target.
Args:
value (str): Boot source override target.
"""
self.boot_source_override_target = value
def get_boot_order(self) -> list:
"""Get boot order.
Returns:
list: Boot order list.
"""
return self.boot_order

View File

@@ -0,0 +1,117 @@
class BootOption:
"""
Class BootOption
"""
def __init__(self, boot_option_id: str, name: str, display_name: str, boot_option_enabled: bool, description: str):
self.boot_option_id = boot_option_id
self.name = name
self.display_name = display_name
self.boot_option_enabled = boot_option_enabled
self.description = description
def get_boot_option_id(self) -> str:
"""
Getter for boot option id
Returns:
str: the boot option id
"""
return self.boot_option_id
def set_boot_option_id(self, boot_option_id: str):
"""
Setter for boot option id
Args:
boot_option_id (str): the boot option id
Returns: None
"""
self.boot_option_id = boot_option_id
def get_name(self) -> str:
"""
Getter for boot option name
Returns:
str: the boot option name
"""
return self.name
def set_name(self, name: str):
"""
Setter for boot option name
Args:
name (str): the boot option name
Returns: None
"""
self.name = name
def get_display_name(self) -> str:
"""
Getter for boot option display name
Returns:
str: the boot option display name
"""
return self.display_name
def set_display_name(self, display_name: str):
"""
Setter for boot option display name
Args:
display_name (str): the boot option display name
Returns: None
"""
self.display_name = display_name
def get_boot_option_enabled(self) -> bool:
"""
Getter for boot option enabled
Returns:
bool: boot option enabled
"""
return self.boot_option_enabled
def set_boot_option_enabled(self, boot_option_enabled: bool):
"""
Setter for boot option enabled
Args:
boot_option_enabled (bool): boot option enabled
Returns: None
"""
self.boot_option_enabled = boot_option_enabled
def get_description(self) -> str:
"""
Getter for boot option description
Returns:
str: the boot option description
"""
return self.description
def set_description(self, description: str):
"""
Setter for boot option description
Args:
description (str): the boot option description
Returns: None
"""
self.description = description

View File

@@ -0,0 +1,44 @@
class ComputerSystemReset:
"""Represents computer system reset action."""
def __init__(self, reset_type_allowable_values: list, target: str):
"""Initialize ComputerSystemReset object.
Args:
reset_type_allowable_values (list): List of allowable reset types.
target (str): Target URL for reset action.
"""
self.reset_type_allowable_values = reset_type_allowable_values
self.target = target
def get_reset_type_allowable_values(self) -> list:
"""Get reset type allowable values.
Returns:
list: List of allowable reset types.
"""
return self.reset_type_allowable_values
def set_reset_type_allowable_values(self, reset_type_allowable_values: list) -> None:
"""Set reset type allowable values.
Args:
reset_type_allowable_values (list): List of allowable reset types.
"""
self.reset_type_allowable_values = reset_type_allowable_values
def get_target(self) -> str:
"""Get target URL.
Returns:
str: Target URL for reset action.
"""
return self.target
def set_target(self, target: str) -> None:
"""Set target URL.
Args:
target (str): Target URL for reset action.
"""
self.target = target

View File

@@ -0,0 +1,65 @@
from framework.redfish.objects.status import Status
class MemorySummary:
"""Represents system memory summary information."""
def __init__(self, total_system_memory_gib: int, memory_mirroring: str, status: Status):
"""Initialize MemorySummary object.
Args:
total_system_memory_gib (int): Total system memory in GiB.
memory_mirroring (str): Memory mirroring configuration.
status (Status): Memory status object.
"""
self.total_system_memory_gib = total_system_memory_gib
self.memory_mirroring = memory_mirroring
self.status = status
def get_total_system_memory_gib(self) -> int:
"""Get total system memory in GiB.
Returns:
int: Total system memory in GiB.
"""
return self.total_system_memory_gib
def set_total_system_memory_gib(self, total_system_memory_gib: int) -> None:
"""Set total system memory in GiB.
Args:
total_system_memory_gib (int): Total system memory in GiB.
"""
self.total_system_memory_gib = total_system_memory_gib
def get_memory_mirroring(self) -> str:
"""Get memory mirroring configuration.
Returns:
str: Memory mirroring configuration.
"""
return self.memory_mirroring
def set_memory_mirroring(self, memory_mirroring: str) -> None:
"""Set memory mirroring configuration.
Args:
memory_mirroring (str): Memory mirroring configuration.
"""
self.memory_mirroring = memory_mirroring
def get_status(self) -> Status:
"""Get memory status.
Returns:
Status: Memory status object.
"""
return self.status
def set_status(self, status: Status) -> None:
"""Set memory status.
Args:
status (Status): Memory status object.
"""
self.status = status

View File

@@ -0,0 +1,119 @@
from framework.redfish.objects.status import Status
class ProcessorSummary:
"""Represents processor summary information."""
def __init__(self, core_count: int, count: int, logical_processor_count: int, model: str, threading_enabled: bool, status: Status):
"""Initialize ProcessorSummary object.
Args:
core_count (int): Number of processor cores.
count (int): Number of processors.
logical_processor_count (int): Number of logical processors.
model (str): Processor model name.
threading_enabled (bool): Whether threading is enabled.
status (Status): Processor status object.
"""
self.core_count = core_count
self.count = count
self.logical_processor_count = logical_processor_count
self.model = model
self.threading_enabled = threading_enabled
self.status = status
def get_core_count(self) -> int:
"""Get core count.
Returns:
int: Number of processor cores.
"""
return self.core_count
def set_core_count(self, core_count: int) -> None:
"""Set core count.
Args:
core_count (int): Number of processor cores.
"""
self.core_count = core_count
def get_count(self) -> int:
"""Get processor count.
Returns:
int: Number of processors.
"""
return self.count
def set_count(self, count: int) -> None:
"""Set processor count.
Args:
count (int): Number of processors.
"""
self.count = count
def get_logical_processor_count(self) -> int:
"""Get logical processor count.
Returns:
int: Number of logical processors.
"""
return self.logical_processor_count
def set_logical_processor_count(self, logical_processor_count: int) -> None:
"""Set logical processor count.
Args:
logical_processor_count (int): Number of logical processors.
"""
self.logical_processor_count = logical_processor_count
def get_model(self) -> str:
"""Get processor model.
Returns:
str: Processor model name.
"""
return self.model
def set_model(self, model: str) -> None:
"""Set processor model.
Args:
model (str): Processor model name.
"""
self.model = model
def get_threading_enabled(self) -> bool:
"""Get threading enabled status.
Returns:
bool: Whether threading is enabled.
"""
return self.threading_enabled
def set_threading_enabled(self, threading_enabled: bool) -> None:
"""Set threading enabled status.
Args:
threading_enabled (bool): Whether threading is enabled.
"""
self.threading_enabled = threading_enabled
def get_status(self) -> Status:
"""Get processor status.
Returns:
Status: Processor status object.
"""
return self.status
def set_status(self, status: Status) -> None:
"""Set processor status.
Args:
status (Status): Processor status object.
"""
self.status = status

View File

@@ -0,0 +1,62 @@
class Status:
"""Represents system status information."""
def __init__(self, health: str, health_rollup: str, state: str):
"""Initialize Status object.
Args:
health (str): Health status value.
health_rollup (str): Health rollup status value.
state (str): State value.
"""
self.health = health
self.health_rollup = health_rollup
self.state = state
def get_health(self) -> str:
"""Get health status.
Returns:
str: Health status value.
"""
return self.health
def set_health(self, health: str) -> None:
"""Set health status.
Args:
health (str): Health status value.
"""
self.health = health
def get_health_rollup(self) -> str:
"""Get health rollup status.
Returns:
str: Health rollup status value.
"""
return self.health_rollup
def set_health_rollup(self, health_rollup: str) -> None:
"""Set health rollup status.
Args:
health_rollup (str): Health rollup status value.
"""
self.health_rollup = health_rollup
def get_state(self) -> str:
"""Get state.
Returns:
str: State value.
"""
return self.state
def set_state(self, state: str) -> None:
"""Set state.
Args:
state (str): State value.
"""
self.state = state

View File

@@ -0,0 +1,89 @@
class SystemCollections:
"""
Class for SystemCollections
"""
def __init__(self, context: str, id: str, type: str, description: str, members: list[str], data_count: int, name: str):
"""
Initializes the SystemCollections object.
Args:
context (str): the context
id (str): the id
type (str): the type
description (str): the description
members (list[str]): the members
data_count (int): the data count
name (str): the name
"""
self.context: str = context
self.id: str = id
self.type: str = type
self.description: str = description
self.members: list[str] = members
self.data_count: int = data_count
self.name: str = name
def get_context(self) -> str:
"""
Getter for context
Returns:
str: The context
"""
return self.context
def get_id(self) -> str:
"""
Getter for id
Returns:
str: The id
"""
return self.id
def get_type(self) -> str:
"""
Getter for type
Returns:
str: The type
"""
return self.type
def get_description(self) -> str:
"""
Getter for description
Returns:
str: The description
"""
return self.description
def get_members(self) -> list[str]:
"""
Getter for members
Returns:
list[str]: The members
"""
return self.members
def get_data_count(self) -> int:
"""
Getter for data_count
Returns:
int: the data count
"""
return self.data_count
def get_name(self) -> str:
"""
Getter for name
Returns:
str: The name
"""
return self.name

View File

@@ -0,0 +1,555 @@
from framework.redfish.objects.boot import Boot
from framework.redfish.objects.computer_system_reset import ComputerSystemReset
from framework.redfish.objects.memory_summary import MemorySummary
from framework.redfish.objects.processor_summary import ProcessorSummary
from framework.redfish.objects.status import Status
from framework.redfish.objects.trusted_modules import TrustedModule
class SystemInfo:
"""Represents system information from Redfish API."""
def __init__(self, data: dict):
"""Initialize SysInfo object.
Args:
data (dict): Dictionary containing system data.
Raises:
ValueError: If data is None or empty.
"""
if not data:
raise ValueError("System data cannot be None or empty")
# Simple attributes
self.power_state = data.get("PowerState", "")
self.manufacturer = data.get("Manufacturer", "")
self.model = data.get("Model", "")
self.serial_number = data.get("SerialNumber", "")
self.bios_version = data.get("BiosVersion", "")
self.asset_tag = data.get("AssetTag", "")
self.host_name = data.get("HostName", "")
self.indicator_led = data.get("IndicatorLED", "")
self.last_reset_time = data.get("LastResetTime", "")
self.location_indicator_active = data.get("LocationIndicatorActive", "")
self.name = data.get("Name", "")
self.part_number = data.get("PartNumber", "")
self.sku = data.get("SKU", "")
self.system_type = data.get("SystemType", "")
self.uuid = data.get("UUID", "")
self.description = data.get("Description", "")
self.id = data.get("Id", "")
# Complex objects
self.status = self.generate_status(data)
self.boot = self.generate_boot(data)
self.memory_summary = self.generate_memory_summary(data)
self.computer_system_reset = self.generate_computer_system_reset(data)
self.processor_summary = self.generate_processor_summary(data)
self.trusted_modules = self.generate_trusted_modules(data)
# Lists
self.pcie_devices = data.get("PCIeDevices", [])
self.pcie_functions = data.get("PCIeFunctions", [])
def get_power_state(self) -> str:
"""Get power state.
Returns:
str: Power state value.
"""
return self.power_state
def set_power_state(self, power_state: str) -> None:
"""Set power state.
Args:
power_state (str): Power state value.
"""
self.power_state = power_state
def get_manufacturer(self) -> str:
"""Get manufacturer.
Returns:
str: Manufacturer name.
"""
return self.manufacturer
def set_manufacturer(self, manufacturer: str) -> None:
"""Set manufacturer.
Args:
manufacturer (str): Manufacturer name.
"""
self.manufacturer = manufacturer
def get_model(self) -> str:
"""Get model.
Returns:
str: Model name.
"""
return self.model
def set_model(self, model: str) -> None:
"""Set model.
Args:
model (str): Model name.
"""
self.model = model
def get_serial_number(self) -> str:
"""Get serial number.
Returns:
str: Serial number.
"""
return self.serial_number
def set_serial_number(self, serial_number: str) -> None:
"""Set serial number.
Args:
serial_number (str): Serial number.
"""
self.serial_number = serial_number
def get_bios_version(self) -> str:
"""Get BIOS version.
Returns:
str: BIOS version.
"""
return self.bios_version
def set_bios_version(self, bios_version: str) -> None:
"""Set BIOS version.
Args:
bios_version (str): BIOS version.
"""
self.bios_version = bios_version
def get_status(self) -> Status:
"""Get system status.
Returns:
Status: System status object.
"""
return self.status
def set_status(self, status: Status) -> None:
"""Set system status.
Args:
status (Status): System status object.
"""
self.status = status
def get_boot(self) -> Boot:
"""Get boot configuration.
Returns:
Boot: Boot configuration object.
"""
return self.boot
def set_boot(self, boot: Boot) -> None:
"""Set boot configuration.
Args:
boot (Boot): Boot configuration object.
"""
self.boot = boot
def get_memory_summary(self) -> MemorySummary:
"""Get memory summary.
Returns:
MemorySummary: Memory summary object.
"""
return self.memory_summary
def set_memory_summary(self, memory_summary: MemorySummary) -> None:
"""Set memory summary.
Args:
memory_summary (MemorySummary): Memory summary object.
"""
self.memory_summary = memory_summary
def get_asset_tag(self) -> str:
"""Get asset tag.
Returns:
str: Asset tag.
"""
return self.asset_tag
def set_asset_tag(self, asset_tag: str) -> None:
"""Set asset tag.
Args:
asset_tag (str): Asset tag.
"""
self.asset_tag = asset_tag
def get_host_name(self) -> str:
"""Get host name.
Returns:
str: Host name.
"""
return self.host_name
def set_host_name(self, asset_tag: str) -> None:
"""Set host name.
Args:
asset_tag (str): Host name.
"""
self.asset_tag = asset_tag
def get_indicator_led(self) -> str:
"""Get indicator LED status.
Returns:
str: Indicator LED status.
"""
return self.asset_tag
def set_indicator_led(self, asset_tag: str) -> None:
"""Set indicator LED status.
Args:
asset_tag (str): Indicator LED status.
"""
self.indicator_led = asset_tag
def get_last_reset_time(self) -> str:
"""Get last reset time.
Returns:
str: Last reset time.
"""
return self.last_reset_time
def set_last_reset_time(self, last_reset_time: str) -> None:
"""Set last reset time.
Args:
last_reset_time (str): Last reset time.
"""
self.last_reset_time = last_reset_time
def get_location_indicator_active(self) -> bool:
"""Get location indicator active status.
Returns:
bool: Location indicator active status.
"""
return self.location_indicator_active
def set_location_indicator_active(self, location_indicator_active: bool) -> None:
"""Set location indicator active status.
Args:
location_indicator_active (bool): Location indicator active status.
"""
self.location_indicator_active = location_indicator_active
def get_name(self) -> str:
"""Get system name.
Returns:
str: System name.
"""
return self.name
def set_name(self, name: str) -> None:
"""Set system name.
Args:
name (str): System name.
"""
self.name = name
def get_part_number(self) -> str:
"""Get part number.
Returns:
str: Part number.
"""
return self.part_number
def set_part_number(self, part_number: str) -> None:
"""Set part number.
Args:
part_number (str): Part number.
"""
self.part_number = part_number
def get_sku(self) -> str:
"""Get SKU.
Returns:
str: SKU.
"""
return self.sku
def set_sku(self, sku: str) -> None:
"""Set SKU.
Args:
sku (str): SKU.
"""
self.sku = sku
def get_system_type(self) -> str:
"""Get system type.
Returns:
str: System type.
"""
return self.system_type
def set_system_type(self, system_type: str) -> None:
"""Set system type.
Args:
system_type (str): System type.
"""
self.system_type = system_type
def get_uuid(self) -> str:
"""Get UUID.
Returns:
str: UUID.
"""
return self.uuid
def set_uuid(self, uuid: str) -> None:
"""Set UUID.
Args:
uuid (str): UUID.
"""
self.uuid = uuid
def get_description(self) -> str:
"""Get description.
Returns:
str: Description.
"""
return self.description
def set_description(self, description: str) -> None:
"""Set description.
Args:
description (str): Description.
"""
self.description = description
def get_id(self) -> str:
"""Get ID.
Returns:
str: System ID.
"""
return self.id
def set_id(self, id: str) -> None:
"""Set ID.
Args:
id (str): System ID.
"""
self.id = id
def get_computer_system_reset(self) -> ComputerSystemReset:
"""Get computer_system_reset.
Returns:
ComputerSystemReset: ComputerSystemReset object.
"""
return self.computer_system_reset
def set_computer_system_reset(self, computer_system_reset: ComputerSystemReset) -> None:
"""Set computer_system_reset.
Args:
computer_system_reset (ComputerSystemReset): ComputerSystemReset object.
"""
self.computer_system_reset = computer_system_reset
def get_processor_summary(self) -> ProcessorSummary:
"""Get processor summary.
Returns:
ProcessorSummary: Processor summary object.
"""
return self.processor_summary
def set_processor_summary(self, processor_summary: ProcessorSummary) -> None:
"""Set processor summary.
Args:
processor_summary (ProcessorSummary): Processor summary object.
"""
self.processor_summary = processor_summary
def get_trusted_modules(self) -> list[TrustedModule]:
"""Get trusted modules.
Returns:
list[TrustedModule]: List of trusted module objects.
"""
return self.trusted_modules
def set_trusted_modules(self, trusted_modules: list[TrustedModule]) -> None:
"""Set trusted modules.
Args:
trusted_modules (list[TrustedModule]): List of trusted module objects.
"""
self.trusted_modules = trusted_modules
def get_pcie_devices(self) -> list:
"""Get PCIe devices.
Returns:
list: List of PCIe device references.
"""
return self.pcie_devices
def set_pcie_devices(self, pcie_devices: list) -> None:
"""Set PCIe devices.
Args:
pcie_devices (list): List of PCIe device references.
"""
self.pcie_devices = pcie_devices
def get_pcie_functions(self) -> list:
"""Get PCIe functions.
Returns:
list: List of PCIe function references.
"""
return self.pcie_functions
def set_pcie_functions(self, pcie_functions: list) -> None:
"""Set PCIe functions.
Args:
pcie_functions (list): List of PCIe function references.
"""
self.pcie_functions = pcie_functions
def generate_status(self, data: dict) -> Status:
"""
Generates the status from the dict
Args:
data (dict): data to get status from
Returns:
Status: Status object.
"""
status_data = data.get("Status", {})
return Status(health=status_data.get("Health", ""), health_rollup=status_data.get("HealthRollup", ""), state=status_data.get("State", "")) if status_data else None
def generate_boot(self, data: dict) -> Boot:
"""
Generates the boot from the dict
Args:
data (dict): data to get the boot from
Returns:
Boot: Boot object.
"""
boot_data = data.get("Boot", {})
return Boot(boot_source_override_enabled=boot_data.get("BootSourceOverrideEnabled", ""), boot_source_override_target=boot_data.get("BootSourceOverrideTarget", ""), boot_order=boot_data.get("BootOrder", [])) if boot_data else None
def generate_memory_summary(self, data: dict) -> MemorySummary | None:
"""
Generates the memory summary
Args:
data (dict): the data to get the memory summary from
Returns:
MemorySummary | None: the memory summary
"""
mem_data = data.get("MemorySummary", {})
if mem_data:
mem_status_data = mem_data.get("Status", {})
mem_status = Status(health=mem_status_data.get("Health", ""), health_rollup=mem_status_data.get("HealthRollup", ""), state=mem_status_data.get("State", "")) if mem_status_data else None
return MemorySummary(total_system_memory_gib=mem_data.get("TotalSystemMemoryGiB", 0), memory_mirroring=mem_data.get("MemoryMirroring", ""), status=mem_status)
else:
return None
def generate_computer_system_reset(self, data: dict) -> ComputerSystemReset | None:
"""
Generates the computer system reset
Args:
data (dict): data to get the computer system reset from
Returns:
ComputerSystemReset | None: the computer system reset
"""
actions_data = data.get("Actions", {})
if actions_data:
reset_data = actions_data.get("#ComputerSystem.Reset", {})
return ComputerSystemReset(reset_type_allowable_values=reset_data.get("ResetType@Redfish.AllowableValues"), target=reset_data.get("target")) if reset_data else None
else:
return None
def generate_processor_summary(self, data: dict) -> ProcessorSummary | None:
"""
Generates the processor summary
Args:
data (dict): data to get the processor summary from
Returns:
ProcessorSummary | None: the processor summary
"""
proc_data = data.get("ProcessorSummary", {})
if proc_data:
proc_status_data = proc_data.get("Status", {})
proc_status = Status(health=proc_status_data.get("Health", ""), health_rollup=proc_status_data.get("HealthRollup", ""), state=proc_status_data.get("State", "")) if proc_status_data else None
return ProcessorSummary(core_count=proc_data.get("CoreCount", 0), count=proc_data.get("Count", 0), logical_processor_count=proc_data.get("LogicalProcessorCount", 0), model=proc_data.get("Model", ""), threading_enabled=proc_data.get("ThreadingEnabled", False), status=proc_status)
else:
return None
def generate_trusted_modules(self, data: dict) -> list[TrustedModule]:
"""
Generates the trusted modules
Args:
data (dict): data to get the trusted modules from
Returns:
list[TrustedModule]: the trusted modules
"""
trusted_modules_list = []
for tm_data in data.get("TrustedModules", []):
tm_status_data = tm_data.get("Status", {})
tm_status = Status("", "", tm_status_data.get("State", "")) if tm_status_data else None
trusted_module = TrustedModule(firmware_version=tm_data.get("FirmwareVersion", ""), interface_type=tm_data.get("InterfaceType", ""), status=tm_status)
trusted_modules_list.append(trusted_module)
return trusted_modules_list

View File

@@ -0,0 +1,65 @@
from framework.redfish.objects.status import Status
class TrustedModule:
"""Represents a trusted module."""
def __init__(self, firmware_version: str, interface_type: str, status: Status):
"""Initialize TrustedModule object.
Args:
firmware_version (str): Firmware version.
interface_type (str): Interface type.
status (Status): Trusted module status object.
"""
self.firmware_version = firmware_version
self.interface_type = interface_type
self.status = status
def get_firmware_version(self) -> str:
"""Get firmware version.
Returns:
str: Firmware version.
"""
return self.firmware_version
def set_firmware_version(self, firmware_version: str) -> None:
"""Set firmware version.
Args:
firmware_version (str): Firmware version.
"""
self.firmware_version = firmware_version
def get_interface_type(self) -> str:
"""Get interface type.
Returns:
str: Interface type.
"""
return self.interface_type
def set_interface_type(self, interface_type: str) -> None:
"""Set interface type.
Args:
interface_type (str): Interface type.
"""
self.interface_type = interface_type
def get_status(self) -> Status:
"""Get trusted module status.
Returns:
Status: Trusted module status object.
"""
return self.status
def set_status(self, status: Status) -> None:
"""Set trusted module status.
Args:
status (Status): Trusted module status object.
"""
self.status = status

View File

@@ -0,0 +1,49 @@
from framework.redfish.client.redfish_client import RedFishClient
from framework.redfish.objects.boot_option import BootOption
from framework.redfish.operations.get_system_info import GetSystemInfo
class BootOrderOperations:
"""
Class for Boot order operations
"""
def __init__(self, bmc_ip: str, username: str, password):
self.redfish_client = RedFishClient(bmc_ip, username, password)
self.sys_info = GetSystemInfo(bmc_ip, username, password)
self.system_id = self.sys_info.get_system_id()
def get_boot_order(self) -> list[BootOption]:
"""
Gets the list of boot options in order
Returns:
list[BootOption]: List of boot options.]
"""
boot_option_list = []
boot_options = self.redfish_client.get(f"{self.system_id}/BootOptions").dict["Members"]
for boot_option in boot_options:
id = boot_option.get("@odata.id")
text = self.redfish_client.get(id)
boot_option_list.append(self.create_boot_option(text.dict))
return boot_option_list
def create_boot_option(self, boot_option_dict: {}) -> BootOption:
"""
Creates a boot option from the given dict.
Args:
boot_option_dict ({}): the dict to create the boot option from
Returns:
BootOption: BootOption object.
"""
boot_option_id = boot_option_dict.get("Id", "")
name = boot_option_dict.get("Name", "")
display_name = boot_option_dict.get("DisplayName", "")
boot_option_enabled = boot_option_dict.get("BootOptionEnabled", False)
description = boot_option_dict.get("Description", "")
return BootOption(boot_option_id, name, display_name, boot_option_enabled, description)

View File

@@ -0,0 +1,43 @@
from framework.redfish.client.redfish_client import RedFishClient
from framework.redfish.objects.system_collections import SystemCollections
from framework.redfish.objects.system_info import SystemInfo
from framework.redfish.operations.get_systems_operations import GetSystemsOperations
class GetSystemInfo:
"""
Class for System Info
"""
def __init__(self, bmc_ip: str, username: str, password: str):
self.bmc_ip = bmc_ip
self.username = username
self.password = password
self.system_id = None
def get_system_id(self) -> str:
"""
Getter for system_id
Returns:
str: system_id
"""
if not self.system_id:
system_collection: SystemCollections = GetSystemsOperations(self.bmc_ip, self.username, self.password).get_systems()
members: list[str] = system_collection.get_members()
# we seem to only ever use the first one so just check it's not empty and return first
if not members:
raise Exception("No members found")
self.system_id: str = members[0]
return self.system_id
def get_system_info(self) -> SystemInfo:
"""Get system information.
Returns:
SystemInfo: System information object.
"""
redfish_client = RedFishClient(self.bmc_ip, self.username, self.password)
resp = redfish_client.get(self.system_id)
return SystemInfo(resp.dict)

View File

@@ -0,0 +1,38 @@
from framework.redfish.client.redfish_client import RedFishClient
from framework.redfish.objects.system_collections import SystemCollections
from framework.validation.validation import validate_equals
class GetSystemsOperations:
"""
Get Systems Operations Class
"""
def __init__(self, bmc_ip: str, username: str, password):
self.redfish_client = RedFishClient(bmc_ip, username, password)
def get_systems(self) -> SystemCollections:
"""
Gets systems
Returns:
SystemCollections: SystemCollections object.
"""
resp = self.redfish_client.get("/redfish/v1/Systems")
validate_equals(self.redfish_client.get_status_code(), 200, "Validate 200 status code")
context = resp.dict.get("@odata.context", "")
id = resp.dict.get("@odata.id", "")
type = resp.dict.get("@odata.type", "")
description = resp.dict.get("Description", "")
members = resp.dict.get("Members", [])
data_count = resp.dict.get("Members@odata.count", 0)
name = resp.dict.get("Name", "")
members_list = []
for member in members:
members_list.append(member["@odata.id"])
system_collections = SystemCollections(context, id, type, description, members_list, data_count, name)
return system_collections