From ff66fac7dda475da0445100681952fc8e07118e7 Mon Sep 17 00:00:00 2001 From: pwvancil Date: Thu, 8 Dec 2016 09:55:11 -0600 Subject: [PATCH 1/3] fix simulator after mockup mod, and fix logs --- SimpleOcpServerV1Sim/chassis.py | 6 ++--- SimpleOcpServerV1Sim/redfishURIs.py | 32 ++++++++++++------------- SimpleOcpServerV1Sim/systems.py | 36 ++++++++++++++--------------- 3 files changed, 37 insertions(+), 37 deletions(-) diff --git a/SimpleOcpServerV1Sim/chassis.py b/SimpleOcpServerV1Sim/chassis.py index ed50110..d229ebb 100644 --- a/SimpleOcpServerV1Sim/chassis.py +++ b/SimpleOcpServerV1Sim/chassis.py @@ -8,13 +8,13 @@ class RfChassisCollection(RfResource): # create instance of each chassis in the collection def createSubObjects(self,basePath,relPath): - self.chassis1=RfChassisObj(basePath,os.path.normpath("redfish/v1/Chassis/1")) + self.chassis1=RfChassisObj(basePath,os.path.normpath("redfish/v1/Chassis/A33")) class RfChassisObj(RfResource): # create the dependent sub-objects that live under the chassis object def createSubObjects(self,basePath,relPath): - self.thermal=RfChassisThermal(basePath,os.path.normpath("redfish/v1/Chassis/1/Thermal")) - self.power=RfChassisPower(basePath,os.path.normpath("redfish/v1/Chassis/1/Power")) + self.thermal=RfChassisThermal(basePath,os.path.normpath("redfish/v1/Chassis/A33/Thermal")) + self.power=RfChassisPower(basePath,os.path.normpath("redfish/v1/Chassis/A33/Power")) def patchResource(self,patchData): #first verify client didn't send us a property we cant patch diff --git a/SimpleOcpServerV1Sim/redfishURIs.py b/SimpleOcpServerV1Sim/redfishURIs.py index 9faee0d..51b88dd 100644 --- a/SimpleOcpServerV1Sim/redfishURIs.py +++ b/SimpleOcpServerV1Sim/redfishURIs.py @@ -86,7 +86,7 @@ def rfSystems(): return(resp) #rest/v1/systems/1 - @app.route("/redfish/v1/Systems/1", methods=['GET']) + @app.route("/redfish/v1/Systems/2M220100SL", methods=['GET']) @auth.rfAuthRequired def rfComputerSystem1(): resp=root.systems.system1.getResource() @@ -94,7 +94,7 @@ def rfComputerSystem1(): #rest/v1/systems/1 - @app.route("/redfish/v1/Systems/1", methods=['PATCH']) + @app.route("/redfish/v1/Systems/2M220100SL", methods=['PATCH']) @auth.rfAuthRequired def rfComputerSystem1patch(): rdata=request.get_json(cache=True) @@ -107,7 +107,7 @@ def rfComputerSystem1patch(): #rest/v1/systems/1 - @app.route("/redfish/v1/Systems/1/Actions/ComputerSystem.Reset", methods=['POST']) + @app.route("/redfish/v1/Systems/2M220100SL/Actions/ComputerSystem.Reset", methods=['POST']) @auth.rfAuthRequired def rfComputerSystem1reset(): #print("in reset") @@ -119,27 +119,27 @@ def rfComputerSystem1reset(): else: # error return("",statusCode) - ''' #/rest/v1/systems/1/Logs - @app.route("/redfish/v1/Systems/1/Logs", methods=['GET']) + @app.route("/redfish/v1/Systems/2M220100SL/LogServices", methods=['GET']) def rfSystem1LogsCollection(): - resp=root.systems.system1.logsCollection.getResource() + resp=root.systems.system1.logs.getResource() return(resp) #/rest/v1/systems/1/Logs/SEL - @app.route("/redfish/v1/Systems/1/Logs/SEL", methods=['GET']) + @app.route("/redfish/v1/Systems/2M220100SL/LogServices/SEL", methods=['GET']) def rfSystem1LogService(): - resp=root.systems.system1.logsCollection.logService.getResource() + resp=root.systems.system1.logSel.getResource() return(resp) #/rest/v1/systems/1/Logs/SEL/Entries - @app.route("/redfish/v1/Systems/1/Logs/SEL/Entries", methods=['GET']) + @app.route("/redfish/v1/Systems/2M220100SL/LogServices/SEL/Entries", methods=['GET']) def rfSystem1LogEntryCollection(): - resp=root.systems.system1.logsCollection.logService.logEntryCollection.getResource() + resp=root.systems.system1.logSelEntries.getResource() return(resp) - #/rest/v1/systems/1/Logs/SEL/Entries/1 -- this is a stub for 1st entry - @app.route("/redfish/v1/Systems/1/Logs/SEL/Entries/1", methods=['GET']) + ''' + #/rest/v1/systems/1/LogServices/SEL/Entries/1 -- this is a stub for 1st entry + @app.route("/redfish/v1/Systems/2M220100SL/LogServices/SEL/Entries/1", methods=['GET']) def rfSystem1LogEntry1(): resp=root.systems.system1.logsCollection.logService.logEntryCollection.logEntry1.getResource() return(resp) @@ -152,19 +152,19 @@ def rfChassis(): resp=root.chassis.getResource() return(resp) - @app.route("/redfish/v1/Chassis/1", methods=['GET']) + @app.route("/redfish/v1/Chassis/A33", methods=['GET']) @auth.rfAuthRequired def rfRackmountChassis1(): resp=root.chassis.chassis1.getResource() return(resp) - @app.route("/redfish/v1/Chassis/1/Power", methods=['GET']) + @app.route("/redfish/v1/Chassis/A33/Power", methods=['GET']) @auth.rfAuthRequired def rfRackmountChassis1PowerMetrics(): resp=root.chassis.chassis1.power.getResource() return(resp) - @app.route("/redfish/v1/Chassis/1/Power", methods=['PATCH']) + @app.route("/redfish/v1/Chassis/A33/Power", methods=['PATCH']) @auth.rfAuthRequired def rfChassisPowerpatch(): #rawdata=request.data @@ -177,7 +177,7 @@ def rfChassisPowerpatch(): return("",statusCode) - @app.route("/redfish/v1/Chassis/1/Thermal", methods=['GET']) + @app.route("/redfish/v1/Chassis/A33/Thermal", methods=['GET']) @auth.rfAuthRequired def rfRackmountChassis1ThermalMetrics(): resp=root.chassis.chassis1.thermal.getResource() diff --git a/SimpleOcpServerV1Sim/systems.py b/SimpleOcpServerV1Sim/systems.py index 841a357..0193189 100644 --- a/SimpleOcpServerV1Sim/systems.py +++ b/SimpleOcpServerV1Sim/systems.py @@ -9,14 +9,14 @@ class RfSystemsCollection(RfResource): # create instance of each system in the collection def createSubObjects(self,basePath,relPath): - self.system1=RfSystemObj(basePath,os.path.normpath("redfish/v1/Systems/1")) + self.system1=RfSystemObj(basePath,os.path.normpath("redfish/v1/Systems/2M220100SL")) class RfSystemObj(RfResource): # create the dependent sub-objects that live under the System object def createSubObjects(self,basePath,relPath): - #self.logs=RfLogServiceCollection(path,os.path.normpath("Systems/1/Logs")) - #self.logSel=RfLogService(path,os.path.normpath("Systems/1/Logs/SEL")) - #self.logSelEntries=RfLogEntries(path,os.path.normpath("Systems/1/Logs/SEL/Entries")) + self.logs=RfLogServiceCollection(basePath,os.path.normpath("redfish/v1/Systems/2M220100SL/LogServices")) + self.logSel=RfLogService( basePath,os.path.normpath("redfish/v1/Systems/2M220100SL/LogServices/SEL")) + self.logSelEntries=RfLogEntries( basePath,os.path.normpath("redfish/v1/Systems/2M220100SL/LogServices/SEL/Entries")) pass def getResource(self): @@ -80,24 +80,24 @@ def resetResource(self,resetData): #subclass Logs Collection class RfLogServiceCollection(RfResource): - def createLogServiceObjects(self,path): - #self.log=self.RfSystemLogServiceObj(path,"Systems/1/SEL") - pass + def getResource(self): + #print("HERE") + self.response=json.dumps(self.resData,indent=4) + return(self.response) # sub sub class logService class RfLogService(RfResource): - def createLogEntryCollection(self,rfTime,rfSysInfo): - #self.logEntryCollection=self.RfSystemLogEntryCollection(rfTime,rfSysInfo) - pass + def getResource(self): + #print("HERE") + self.response=json.dumps(self.resData,indent=4) + return(self.response) # sub/sub/sub class LogEntryCollection -class RfLogEntryCollection(RfResource): - def createLogEntries(self,rfTime,rfSysInfo): - #self.logEntry1=self.RfSystemLogEntry1(rfTime,rfSysInfo) - pass - - def getObject(self): - #self.response=json.dumps(self.objData,indent=4) - pass +class RfLogEntries(RfResource): + def getResource(self): + #print("HERE") + self.response=json.dumps(self.resData,indent=4) + return(self.response) + From 15f9d1bd7afc11d654896520ff2d2773d72e4ec3 Mon Sep 17 00:00:00 2001 From: Paul Vancil Date: Thu, 8 Dec 2016 09:59:28 -0600 Subject: [PATCH 2/3] Update redfishProfileSimulator.py --- redfishProfileSimulator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/redfishProfileSimulator.py b/redfishProfileSimulator.py index cd75404..1e30304 100644 --- a/redfishProfileSimulator.py +++ b/redfishProfileSimulator.py @@ -10,7 +10,7 @@ import getopt import os -rfVersion="0.9.1" +rfVersion="0.9.2" rfProgram1="redfishProfileSimulator" rfProgram2=" " rfUsage1="[-Vh] [--Version][--help]" From cd417aa3e0d4b8722b7a7b7943bd78d0334eeedc Mon Sep 17 00:00:00 2001 From: Paul Vancil Date: Thu, 8 Dec 2016 10:01:23 -0600 Subject: [PATCH 3/3] Update CHANGELOG.md --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d7bf62..0a4d97e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ # Change Log +## [0.9.2] - 2016-12-08 +- fix 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 -