Skip to content
This repository has been archived by the owner on Aug 23, 2024. It is now read-only.

Commit

Permalink
Merge pull request #3 from DMTF/ProfileSimFix
Browse files Browse the repository at this point in the history
fix simulator after mockup mod, and fix logs
  • Loading branch information
pwvancil authored Dec 8, 2016
2 parents 61eb082 + cd417aa commit 7343bad
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 38 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
-
6 changes: 3 additions & 3 deletions SimpleOcpServerV1Sim/chassis.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
32 changes: 16 additions & 16 deletions SimpleOcpServerV1Sim/redfishURIs.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,15 @@ 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()
return(resp)


#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)
Expand All @@ -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")
Expand All @@ -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)
Expand All @@ -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
Expand All @@ -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()
Expand Down
36 changes: 18 additions & 18 deletions SimpleOcpServerV1Sim/systems.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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)

2 changes: 1 addition & 1 deletion redfishProfileSimulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import getopt
import os

rfVersion="0.9.1"
rfVersion="0.9.2"
rfProgram1="redfishProfileSimulator"
rfProgram2=" "
rfUsage1="[-Vh] [--Version][--help]"
Expand Down

0 comments on commit 7343bad

Please sign in to comment.