Update skeleton and put code samples in order to have materials for hackaton.

This commit is contained in:
Uggla 2015-06-30 23:46:21 +02:00
parent d677e12ed8
commit 63718ffd19
8 changed files with 1232 additions and 7 deletions

View File

@ -1,6 +1,7 @@
[alexandria]
port=8080
[itop]
drvtype=cmdb
endpoint=http://itop/rest

View File

@ -4,12 +4,8 @@ from flask import Flask
from flask import jsonify
from flask import request
import config
# Vars
alexandria_version = "0.1"
# Configuration file
conf_file = config.AlexandriaConfiguration("alexandria.conf")
import models
import pprint
# Initialise Flask
app = Flask(__name__)
@ -41,6 +37,9 @@ def bruno():
#coucou = "Coucou"
return coucou
@app.route('/ci', methods=['POST'])
def create_ci():
pass
@app.route("/", methods = ["GET"])
def api_root():
@ -65,4 +64,19 @@ def shutdown_server():
if __name__ == "__main__":
# Vars
alexandria_version = "0.1"
# Define a PrettyPrinter for debugging.
pp = pprint.PrettyPrinter(indent=4)
# Configuration file
conf_file = config.AlexandriaConfiguration("alexandria.conf")
# Model
models = models.Model()
print models.reference_items
pp.pprint(models.EthernetInterface) # debugging example.
pp.pprint(models.Manager) # debugging example.
app.run(port=int(conf_file.get_alexandria_port()))

View File

@ -10,10 +10,17 @@ class AlexandriaConfiguration(object):
self.config.read(configuration_file)
def get_drivers(self):
drivers = self.config.sections()
drivers.remove("alexandria")
return drivers
return self.config.sections()
def get_driver_info(self,driver):
return self.config.options(driver)
def get_alexandria_port(self):
return self.config.get("alexandria", "port")
return self.config.get("alexandria", "port")

19
alexandria/drivers.py Normal file
View File

@ -0,0 +1,19 @@
# coding=utf-8
class Driver(object):
def __init__(self, alexandria_configuration):
# Get credentials from conf files
pass
class itop(Driver):
def get_ci(self,uuid):
pass
def push_ci(self,uuid):

View File

@ -0,0 +1,459 @@
{
"$schema": "http://schemas.dmtf.org/redfish/v1/redfish-schema.0.96.0",
"title": "ComputerSystem.0.96.0",
"type": "object",
"additionalProperties": false,
"properties": {
"@odata.context": {
"$ref": "odata.4.0.0.json#context"
},
"@odata.id": {
"$ref": "odata.4.0.0.json#id"
},
"@odata.type": {
"$ref": "odata.4.0.0.json#type"
},
"Oem": {
"$ref": "Resource.0.96.0.json#Oem",
"description": "This is the manufacturer/provider specific extension moniker used to divide the Oem object into sections.",
"longDescription": "The value of this string shall be of the format for the reserved word *Oem*."
},
"Id": {
"$ref": "Resource.0.96.0.json#Id"
},
"Description": {
"$ref": "Resource.0.96.0.json#Description"
},
"Name": {
"$ref": "Resource.0.96.0.json#Name"
},
"SystemType": {
"type": "string",
"enum": [
"Physical",
"Virtual",
"OS",
"PhysicallyPartitioned",
"VirtuallyPartitioned"
],
"enumDescriptions": {
"Physical": "A computer system",
"Virtual": "A virtual machine instance running on this system",
"OS": "An operating system instance",
"PhysicallyPartitioned": "A hardware-based partition of a computer system",
"VirtuallyPartitioned": "A virtual or software-based partition of a computer system"
},
"readonly": true,
"description": "The type of computer system represented by this resource.",
"longDescription": "An enumeration that indicates the kind of system that this resource represents."
},
"Links": {
"type": "object",
"additionalProperties": false,
"properties": {
"Oem": {
"$ref": "Resource.0.96.0.json#Oem",
"description": "Oem extension object.",
"longDescription": "This object represents the Oem property. All values for resources described by this schema shall comply to the requirements as described in the Redfish specification."
},
"Chassis": {
"type": "array",
"items": {
"type": "object",
"properties": {
"@odata.id" :{
"$ref": "odata.4.0.0.json#Id"
}
}
},
"readonly": true,
"description": "An array of references to the chassis in which this system is contained",
"longDescription": "The value of this property shall reference a resource of type Chassis that represents the physical container associated with this resource."
},
"Processors": {
"type": "object",
"properties": {
"@odata.id" :{
"$ref": "odata.4.0.0.json#Id"
}
},
"readonly": true,
"description": "A reference to the collection of Processors associated with this system",
"longDescription": "The value of this property shall be a link to a processor collection."
},
"ManagedBy": {
"type": "array",
"items": {
"type": "object",
"properties": {
"@odata.id" :{
"$ref": "odata.4.0.0.json#Id"
}
}
},
"readonly": true,
"description": "An array of references to the Managers responsible for this system",
"longDescription": "The value of this property shall reference a resource of type manager that represents the resource with management responsibility for this resource."
},
"EthernetInterfaces": {
"type": "object",
"properties": {
"@odata.id" :{
"$ref": "odata.4.0.0.json#Id"
}
},
"readonly": true,
"description": "A reference to the Ethernet interfaces associated with this system",
"longDescription": "The value of this property shall be a link to a collection of EthernetInterfaces."
},
"SimpleStorage": {
"type": "object",
"properties": {
"@odata.id" :{
"$ref": "odata.4.0.0.json#Id"
}
},
"readonly": true,
"description": "A reference to the storage devices associated with this system",
"longDescription": "The value of this property shall be a link to a collection of SimpleStorages."
},
"LogServices": {
"type": "object",
"properties": {
"@odata.id" :{
"$ref": "odata.4.0.0.json#Id"
}
},
"readonly": true,
"description": "A reference to the Log Service associated with this system",
"longDescription": "The value of this property shall be a link to a collection of LogServices."
},
"PoweredBy": {
"type": "array",
"items": {
"type": "object",
"properties": {
"@odata.id" :{
"$ref": "odata.4.0.0.json#Id"
}
}
},
"readonly": true,
"description": "An array of ID[s] of resources that power this computer system. Normally the ID will be a chassis or a specific set of powerSupplies",
"longDescription": "The value of this property shall be an array of IDs containing pointers to the resource that powers this computer system."
},
"CooledBy": {
"type": "array",
"items": {
"type": "object",
"properties": {
"@odata.id" :{
"$ref": "odata.4.0.0.json#Id"
}
}
},
"readonly": true,
"description": "An array of ID[s] of resources that cool this computer system. Normally the ID will be a chassis or a specific set of fans.",
"longDescription": "The value of this property shall be an array of IDs containing pointers to the resource that powers this computer system."
}
},
"readonly": true,
"description": "Contains links to other resources that are related to this resource."
},
"AssetTag": {
"type": [
"string",
"null"
],
"readonly": false,
"description": "The user definable tag that can be used to track this computer system for inventory or other client purposes",
"longDescription": "The value of this property shall contain the value of the asset tag of the system."
},
"Manufacturer": {
"type": [
"string",
"null"
],
"readonly": true,
"description": "The manufacturer or OEM of this system.",
"longDescription": "The value of this property shall contain a value that represents the manufacturer of the system."
},
"Model": {
"type": [
"string",
"null"
],
"readonly": true,
"description": "The model number for this system",
"longDescription": "The value of this property shall contain the information about how the manufacturer references this system."
},
"SKU": {
"type": [
"string",
"null"
],
"readonly": true,
"description": "The manufacturer SKU for this system",
"longDescription": "The value of this property shall contain the Stock Keeping Unit (SKU) for the system."
},
"SerialNumber": {
"type": [
"string",
"null"
],
"readonly": true,
"description": "The serial number for this system",
"longDescription": "The value of this property shall contain the serial number for the system."
},
"PartNumber": {
"type": [
"string",
"null"
],
"readonly": true,
"description": "The part number for this system",
"longDescription": "The value of this property shall contain the part number for the system as defined by the manufacturer."
},
"UUID": {
"type": [
"string",
"null"
],
"readonly": true,
"description": "The universal unique identifier (UUID) for this system",
"longDescription": "The value of this property shall contain the universal unique identifier number for the system."
},
"HostName": {
"type": [
"string",
"null"
],
"description": "The DNS Host Name, without any domain information",
"longDescription": "The value of this property shall be the host name for this system, as reported by the operating system or hypervisor."
},
"IndicatorLED": {
"type": [
"string",
"null"
],
"enum": [
"Unknown",
"Lit",
"Blinking",
"Off"
],
"enumDescriptions": {
"Unknown": "The state of the Indicator LED cannot be determined.",
"Lit": "The Indicator LED is lit.",
"Blinking": "The Indicator LED is blinking.",
"Off": "The Indicator LED is off."
},
"readonly": false,
"description": "The state of the indicator LED, used to identify the system",
"longDescription": "The value of this property shall contain the indicator light state for the indicator light associated with this system."
},
"PowerState": {
"type": [
"string",
"null"
],
"enum": [
"On",
"Off",
"Unknown",
"Reset"
],
"readonly": true,
"description": "This is the current power state of the system",
"longDescription": "The value of this property shall contain the power state of the system."
},
"Boot": {
"type": "object",
"additionalProperties": false,
"properties": {
"BootSourceOverrideTarget": {
"type": [
"string",
"null"
],
"enum": [
"None",
"Pxe",
"Floppy",
"Cd",
"Usb",
"Hdd",
"BiosSetup",
"Utilities",
"Diags",
"UefiShell",
"UefiTarget"
],
"enumDescriptions": {
"None": "Boot from the normal boot device",
"Pxe": "Boot from the Pre-Boot EXecution (PXE) environment",
"Floppy": "Boot from the floppy disk drive",
"Cd": "Boot from the CD/DVD disc",
"Usb": "Boot from a USB device as specified by the system BIOS",
"Hdd": "Boot from a hard drive",
"BiosSetup": "Boot to the BIOS Setup Utility",
"Utilities": "Boot the manufacturer's Utilities program(s)",
"Diags": "Boot the manufacturer's Diagnostics program",
"UefiShell": "Boot to the UEFI Shell",
"UefiTarget": "Boot to the UEFI Device specified in the UefiTargetBootSourceOverride property"
},
"readonly": false,
"description": "The current boot source to be used at next boot instead of the normal boot device, if BootSourceOverrideEnabled is true.",
"longDescription": "The value of this property shall contain the source to boot the system from, overriding the normal boot order. The valid values for this property are specified through the DMTF.AllowableValues annotation. Pxe indicates to PXE boot from the primary NIC; Floppy, Cd, Usb, Hdd indicates to boot from their devices respectively. BiosSetup indicates to boot into the native BIOS screen setup. Utilities and Diags indicate to boot from the local utilities or diags partitions and UefiTarget indicates to boot from the UEFI device path found in UefiTargetBootSourceOverride."
},
"BootSourceOverrideEnabled": {
"type": [
"string",
"null"
],
"enum": [
"Disabled",
"Once",
"Continuous"
],
"enumDescriptions": {
"Disabled": "The system will boot as normal",
"Once": "On its next boot cycle, the system will boot (one time) to the Boot Source Override Target.",
"Continuous": "The system will boot to the target specified in the BootSourceOverrideTarget until this property is set to Disabled."
},
"readonly": false,
"description": "Describes the state of the Boot Source Override feature",
"longDescription": "The value of this property shall be Once if this is a one time boot override and Continuous if this selection should remain active until cancelled."
},
"UefiTargetBootSourceOverride": {
"type": [
"string",
"null"
],
"readonly": false,
"description": "This property is the Uefi Device Path of the device to boot from when BootSourceOverrideSupported is UefiTarget.",
"longDescription": "The value of this property shall be the UEFI device path of the override boot target. The valid values for this property are specified through the DMTF.AllowableValues annotation. BootSourceOverrideEnabled = Continuous is not supported for Uefi Boot Source Override as this setting is defined in UEFI as a one time boot only."
}
},
"description": "This object contains the boot information for the current resource."
},
"BiosVersion": {
"type": [
"string",
"null"
],
"description": "The version of the system BIOS or primary system firmware.",
"longDescription": "The value of this property shall be the version string of the currently installed and running BIOS (for x86 systems). For other systems, the value may contain a version string representing the primary system firmware."
},
"ProcessorSummary": {
"type": "object",
"additionalProperties": false,
"properties": {
"Count": {
"type": [
"integer",
"null"
],
"readonly": true,
"description": "The number of processors in the system.",
"longDescription": "This property shall contain the number of central processors in the system."
},
"Model": {
"type": [
"string",
"null"
],
"readonly": true,
"description": "The processor model for the primary or majority of processors in this system.",
"longDescription": "This property shall contain the processor model for the central processors in the system, per the description in Table 22 of the SMBIOS Specification DSP0134 2.8 or later."
},
"Status": {
"$ref": "Resource.0.96.0.json#Status"
}
},
"description": "This object describes the central processors of the system in general detail."
},
"MemorySummary": {
"type": "object",
"additionalProperties": false,
"properties": {
"TotalSystemMemoryGiB": {
"type": [
"integer",
"null"
],
"readonly": true,
"description": "This is the total amount of memory in the system measured in GiB.",
"longDescription": "This property shall contain the amount of system general purpose volatile (RAM) memory as measured in gibibytes."
},
"Status": {
"$ref": "Resource.0.96.0.json#Status"
}
},
"description": "This object describes the central memory of the system in general detail."
},
"Actions": {
"type": "object",
"additionalProperties": false,
"properties": {
"Oem": {
"type": [
"object",
"null"
],
"additionalProperties": false,
"properties": {
}
},
"#ComputerSystem.Reset": {
"type": "object",
"additionalProperties": false,
"properties": {
"title": {
"type": "string",
"description": "Friendly action name"
},
"target": {
"type": "string",
"description": "Link to invoke action"
},
"ResetType@DMTF.AllowableValues": {
"type": "array",
"items": {
"type": "string",
"enum": [
"On",
"ForceOff",
"GracefulRestart",
"ForceRestart",
"Nmi",
"ForceOn",
"PushPowerButton"
],
"enumDescriptions": {
"On": "Turn the system on",
"ForceOff": "Turn the system off immediately (non-graceful) shutdown",
"GracefulRestart": "Perform a graceful system shutdown followed by a restart of the system",
"ForceRestart": "Perform an immediate (non-graceful) shutdown, followed by a restart of the system",
"Nmi": "Generate a Non-Maskable Interrupt to cause an immediate system halt",
"ForceOn": "Turn the system on immediately",
"PushPowerButton": "Simulate the pressing of the physical power button on this system"
}
},
"description": "The type of reset to be performed",
"longDescription": "This defines the property name for the action."
}
}
}
},
"readonly": true,
"description": "The Actions object contains the available custom actions on this resource."
},
"Status": {
"$ref": "Resource.0.96.0.json#Status"
}
},
"description": "This schema defines a computer system and its respective properties. A computer system represents a machine (physical or virtual) and the local resources such as memory, cpu and other devices that can be accessed from that machine.",
"longDescription": "This resource shall be used to represent resources that represent a computing system in the Redfish specification."
}

View File

@ -0,0 +1,250 @@
{
"$schema": "http://schemas.dmtf.org/redfish/v1/redfish-schema.0.96.0",
"title": "EthernetInterface.0.96.0",
"type": "object",
"additionalProperties": false,
"properties": {
"@odata.context": {
"$ref": "odata.4.0.0.json#context"
},
"@odata.id": {
"$ref": "odata.4.0.0.json#id"
},
"@odata.type": {
"$ref": "odata.4.0.0.json#type"
},
"Oem": {
"$ref": "Resource.0.96.0.json#Oem",
"description": "This is the manufacturer/provider specific extension moniker used to divide the Oem object into sections.",
"longDescription": "The value of this string shall be of the format for the reserved word *Oem*."
},
"Id": {
"$ref": "Resource.0.96.0.json#Id"
},
"Description": {
"$ref": "Resource.0.96.0.json#Description"
},
"Name": {
"$ref": "Resource.0.96.0.json#Name"
},
"UefiDevicePath": {
"type": [
"string",
"null"
],
"readonly": true,
"description": "The UEFI device path for this NIC",
"longDescription": "The value of this property shall be the UEFI device path of this interface."
},
"Status": {
"$ref": "Resource.0.96.0.json#Status"
},
"InterfaceEnabled": {
"type": [
"boolean",
"null"
],
"description": "This indicates whether this interface is enabled.",
"longDescription": "The value of this property shall be a boolean indicating whether this interface is enabled."
},
"PermanentMACAddress": {
"type": [
"string",
"null"
],
"pattern": "^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$",
"readonly": true,
"description": "This is the MAC address assigned to this NIC at the factory.",
"longDescription": "The value of this property shall be the Permanent MAC Address of this interface."
},
"MacAddress": {
"type": [
"string",
"null"
],
"pattern": "^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$",
"description": "This is the MAC address of the logical port interface.",
"longDescription": "The value of this property shall be the effective current MAC Address of this interface. If an assignable MAC address is not supported, this is a read only alias of the PermanentMACAddress."
},
"SpeedMbps": {
"type": [
"integer",
"null"
],
"description": "This is the current speed in Mbps of this NIC.",
"longDescription": "The value of this property shall be the link speed of the interface in Mbps."
},
"AutoNeg": {
"type": [
"boolean",
"null"
],
"description": "This indicates if the speed and duplex is automatically configured by the NIC.",
"longDescription": "The value of this property shall be true of AutoNeg of speed and duplex is enabled and false if it is disabled."
},
"FullDuplex": {
"type": [
"boolean",
"null"
],
"description": "This indicates if the NIC is in Full Duplex mode or not.",
"longDescription": "The value of this property shall be the connection duplex status."
},
"MTUSize": {
"type": [
"integer",
"null"
],
"description": "This is the currently configured MTU size in bytes on this Ethernet interface.",
"longDescription": "The value of this property shall be the Ethernet (MAC) frame size in bytes."
},
"HostName": {
"type": [
"string",
"null"
],
"description": "The DNS Host Name, without any domain information",
"longDescription": "The value of this property shall be host name for this interface."
},
"FQDN": {
"type": [
"string",
"null"
],
"description": "This is the complete, fully qualified domain name obtained by DNS for this interface.",
"longDescription": "The value of this property shall be the fully qualified domain name for this interface."
},
"MaxIPv6StaticAddresses": {
"type": [
"integer",
"null"
],
"readonly": true,
"description": "This indicates the maximum number of Static IPv6 addresses that can be configured on this interface.",
"longDescription": "The value of this property shall indicate the number of array items supported by IPv6StaticAddresses."
},
"VLAN": {
"$ref": "VLanNetworkInterface.0.96.0.json#VLAN",
"readonly": true,
"description": "If this Network Interface supports more than one VLAN, this property will not be present and the client should look for VLANs collection in the link section of this resource.",
"longDescription": "The value of this property shall be the VLAN for this interface. If this interface supports more than one VLAN, the VLAN property shall not be present and the VLANS collection link shall be present instead."
},
"IPv4Addresses": {
"type": "array",
"items": {
"$ref": "IPAddresses.0.96.0.json#IPv4Address"
},
"readonly": true,
"description": "This array of objects is used to represent the IPv4 connection characteristics for this interface."
},
"IPv6AddressPolicyTable": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"Prefix": {
"type": [
"string",
"null"
],
"description": "IPv6 Address Prefix for this table entry as defined in RFC 3484 section 2.1."
},
"Precedence": {
"type": [
"integer",
"null"
],
"description": "Precedence value for this table entry as defined in RFC 3484 section 2.1."
},
"Label": {
"type": [
"integer",
"null"
],
"description": "Label value for this table entry, as defined in RFC 3484 section 2.1."
}
}
},
"description": "This array of objects represents the RFC3484 Address Selection Policy Table.",
"longDescription": "This array represents the Address Selection Policy Table as defined in RFC3484."
},
"IPv6Addresses": {
"type": "array",
"items": {
"$ref": "IPAddresses.0.96.0.json#IPv6Address"
},
"readonly": true,
"description": "This array of objects enumerates all of the currently assigned IPv6 addresses on this interface."
},
"IPv6StaticAddresses": {
"type": "array",
"items": {
"$ref": "IPAddresses.0.96.0.json#IPv6StaticAddress"
},
"readonly": true,
"description": "This array of objects represents all of the IPv6 static addresses to be assigned on this interface."
},
"IPv6DefaultGateway": {
"type": [
"string",
"null"
],
"readonly": true,
"description": "This is the IPv6 default gateway address that is currently in use on this interface.",
"longDescription": "The value of this property shall be the current IPv6 default gateway address that is in use on this interface."
},
"NameServers": {
"type": "array",
"items": {
"type": [
"string",
"null"
]
},
"readonly": true,
"longDescription": "The value of this property shall be the DNS name servers for this interface."
},
"SettingsResult": {
"$ref": "Resource.0.96.0.json#SettingsResult",
"description": "If there is a link to Settings, this property has the results of the last application of those settings to this NIC.",
"longDescription": "If using separate Settings, these properties shall report the result of applying settings."
},
"Links": {
"type": "object",
"additionalProperties": false,
"properties": {
"Oem": {
"$ref": "Resource.0.96.0.json#Oem",
"description": "Oem extension object.",
"longDescription": "This object represents the Oem property. All values for resources described by this schema shall comply to the requirements as described in the Redfish specification."
},
"Settings": {
"type": "object",
"properties": {
"@odata.id" :{
"$ref": "odata.4.0.0.json#Id"
}
},
"description": "If this resource is supports changing properties by modifying a separate (settings) resource, this is the reference to that resource. ",
"longDescription": "If network settings are not dynamically settable (e.g. a reset required that doesn't happen automatically), this value shall be used to reference a separately PATCHable representation of this data to be used for configuration purposes."
},
"VLANs": {
"type": "object",
"properties": {
"@odata.id" :{
"$ref": "odata.4.0.0.json#Id"
}
},
"readonly": true,
"description": "This is a reference to a collection of VLANs and is only used if the NIC supports more than one VLAN.",
"longDescription": "The value of this property shall reference a collection of VLAN resources. If this property is used, the VLANEnabled and VLANId property shall not be used."
}
},
"readonly": true,
"description": "This object contains the links to other resources that are related to this resource."
}
},
"description": "This schema defines a simple ethernet NIC resource.",
"longDescription": "This resource shall be used to represent NIC resources as part of the Redfish specification."
}

View File

@ -0,0 +1,439 @@
{
"$schema": "http://schemas.dmtf.org/redfish/v1/redfish-schema.0.96.0",
"title": "Manager.0.96.0",
"type": "object",
"additionalProperties": false,
"properties": {
"@odata.context": {
"$ref": "odata.4.0.0.json#context"
},
"@odata.id": {
"$ref": "odata.4.0.0.json#id"
},
"@odata.type": {
"$ref": "odata.4.0.0.json#type"
},
"Oem": {
"$ref": "Resource.0.96.0.json#Oem",
"description": "This is the manufacturer/provider specific extension moniker used to divide the Oem object into sections.",
"longDescription": "The value of this string shall be of the format for the reserved word *Oem*."
},
"Id": {
"$ref": "Resource.0.96.0.json#Id"
},
"Description": {
"$ref": "Resource.0.96.0.json#Description"
},
"Name": {
"$ref": "Resource.0.96.0.json#Name"
},
"ManagerType": {
"type": "string",
"enum": [
"ManagementController",
"EnclosureManager",
"BMC",
"RackManager",
"AuxiliaryController"
],
"enumDescriptions": {
"ManagementController": "A controller used primarily to monitor or manage the operation of a device or system",
"EnclosureManager": "A controller which provides management functions for a chassis or group of devices or systems",
"BMC": "A controller which provides management functions for a single computer system",
"RackManager": "A controller which provides management functions for a whole or part of a rack",
"AuxiliaryController": "A controller which provides management functions for a particular subsystem or group of devices"
},
"readonly": true,
"description": "This property represents the type of manager that this resource represents.",
"longDescription": "The value of this property shall describe the function of this manager. The value EnclosureManager shall be used if this manager controls one or more services through aggregation. The value BMC shall be used if this manager represents a traditional server management controller. The value ManagementController shall be used if none of the other enumerations apply."
},
"Links": {
"type": "object",
"additionalProperties": false,
"properties": {
"Oem": {
"$ref": "Resource.0.96.0.json#Oem",
"description": "Oem extension object.",
"longDescription": "This object represents the Oem property. All values for resources described by this schema shall comply to the requirements as described in the Redfish specification."
},
"ManagerForServers": {
"type": "array",
"items": {
"type": "object",
"properties": {
"@odata.id" :{
"$ref": "odata.4.0.0.json#Id"
}
}
},
"readonly": true,
"description": "This property is an array of references to the systems that this manager has control over.",
"longDescription": "This is a reference to a collection of ComputerSystem resources."
},
"ManagerForChassis": {
"type": "array",
"items": {
"type": "object",
"properties": {
"@odata.id" :{
"$ref": "odata.4.0.0.json#Id"
}
}
},
"readonly": true,
"description": "This property is an array of references to the chasis that this manager has control over.",
"longDescription": "This is a reference to a collection of ListenerDestination resources."
},
"EthernetInterfaces": {
"type": "object",
"properties": {
"@odata.id" :{
"$ref": "odata.4.0.0.json#Id"
}
},
"readonly": true,
"description": "This is a reference to a collection of NICs that this manager uses for network communication. It is here that clients will find NIC configuration options and settings.",
"longDescription": "This is a reference to a collection of ListenerDestination resources."
},
"SerialInterfaces": {
"type": "object",
"properties": {
"@odata.id" :{
"$ref": "odata.4.0.0.json#Id"
}
},
"readonly": true,
"description": "This is a reference to a collection of serial interfaces that this manager uses for serial and console communication. It is here that clients will find serial configuration options and settings.",
"longDescription": "The value of this property shall be a link to a collection of SerialInterfaces which are for the use of this manager."
},
"NetworkProtocol": {
"type": "object",
"properties": {
"@odata.id" :{
"$ref": "odata.4.0.0.json#Id"
}
},
"readonly": true,
"description": "This is a reference to the network services and their settings that the manager controls. It is here that clients will find network configuration options as well as network services.",
"longDescription": "The value of this property shall contain a reference to a resource of type ManagerNetworkProtocol which represents the network services for this manager."
},
"LogServices": {
"type": "object",
"properties": {
"@odata.id" :{
"$ref": "odata.4.0.0.json#Id"
}
},
"readonly": true,
"description": "This is a reference to a collection of Logs used by the manager.",
"longDescription": "The value of this property shall contain a reference to a collection of LogService which are for the use of this manager."
},
"VirtualMedia": {
"type": "object",
"properties": {
"@odata.id" :{
"$ref": "odata.4.0.0.json#Id"
}
},
"readonly": true,
"description": "This is a reference to the virtual media services for this particular manager.",
"longDescription": "The value of this property shall contain a reference to a collection of VirtualMedia which are for the use of this manager."
}
},
"readonly": true,
"description": "This object contains the links to other resources that are related to this resource."
},
"ServiceEntryPointUUID": {
"type": "string",
"readonly": true,
"description": "The UUID of the Redfish Service Entry Point provided by this manager",
"longDescription": "This property shall contain the UUID of the Redfish Service Entry Point provided by this manager. This property shall not be present if this manager does not provide a Redfish Service Entry Point."
},
"UUID": {
"type": [
"string",
"null"
],
"readonly": true,
"description": "The Universal Unique Identifier (UUID) for this Manager",
"longDescription": "The value of this property shall contain the universal unique identifier number for the manager."
},
"Model": {
"type": [
"string",
"null"
],
"readonly": true,
"description": "The model information of this Manager as defined by the manufacturer",
"longDescription": "The value of this property shall contain the information about how the manufacturer references this manager."
},
"DateTime": {
"type": [
"string",
"null"
],
"readonly": false,
"description": "The current DateTime (with offset) for the manager, used to set or read time.",
"longDescription": "The value of this property shall represent the current DateTime value for the manager, with offset from UTC, in Redfish Timestamp format."
},
"DateTimeLocalOffset": {
"type": [
"string",
"null"
],
"readonly": false,
"description": "The time offset from UTC that the DateTime property is set to in format: +06:00 .",
"longDescription": "The value is property shall represent the offset from UTC time that the current value of DataTime property contains.",
"pattern": "([-+][0-1][0-9]:[0-5][0-9])"
},
"FirmwareVersion": {
"type": [
"string",
"null"
],
"readonly": true,
"description": "The firmware version of this Manager",
"longDescription": "This property shall contain the firwmare version as defined by the manufacturer for the associated manager."
},
"SerialConsole": {
"type": "object",
"additionalProperties": false,
"properties": {
"Enabled": {
"type": "boolean",
"description": "Indicates if the service is enabled for this manager.",
"longDescription": "The value of this property shall contain the enabled status of the protocol used for the service. The value shall be true if enabled and false if disabled."
},
"MaxConcurrentSessions": {
"type": "integer",
"readonly": true,
"description": "Indicates the maximum number of service sessions, regardless of protocol, this manager is able to support.",
"longDescription": "The value of this property shall contain the maximum number of concurrent service sessions supported by the implementation."
},
"ConnectTypesSupported": {
"type": "array",
"items": {
"type": "string",
"enum": [
"SSH",
"Telnet",
"IPMI",
"Oem"
],
"enumDescriptions": {
"SSH": "The controller supports a Serial Console connection using the SSH protocol",
"Telnet": "The controller supports a Serial Console connection using the Telnet protocol",
"IPMI": "The controller supports a Serial Console connection using the IPMI Serial-over-LAN (SOL) protocol",
"Oem": "The controller supports a Serial Console connection using an OEM-specific protocol"
}
},
"readonly": true,
"description": "This object is used to enumerate the Serial Console connection types allowed by the implementation.",
"longDescription": "The value of ConnectTypesSupported shall be an array of the enumerations provided here. SSH shall be included if the Secure Shell (SSH) protocol is supported. Telnet shall be included if the Telnet protocol is supported. IPMI shall be included if the IPMI (Serial-over-LAN) protocol is supported."
}
},
"description": "The value of this property shall contain the information about the Serial Console service of this manager."
},
"CommandShell": {
"type": [
"object",
"null"
],
"additionalProperties": false,
"properties": {
"Enabled": {
"type": "boolean",
"description": "Indicates if the service is enabled for this manager.",
"longDescription": "The value of this property shall contain the enabled status of the protocol used for the service. The value shall be true if enabled and false if disabled."
},
"MaxConcurrentSessions": {
"type": "integer",
"readonly": true,
"description": "Indicates the maximum number of service sessions, regardless of protocol, this manager is able to support.",
"longDescription": "The value of this property shall contain the maximum number of concurrent service sessions supported by the implementation."
},
"ConnectTypesSupported": {
"type": "array",
"items": {
"type": "string",
"enum": [
"SSH",
"Telnet",
"IPMI",
"Oem"
],
"enumDescriptions": {
"SSH": "The controller supports a Command Shell connection using the SSH protocol",
"Telnet": "The controller supports a Command Shell connection using the SSH protocol",
"IPMI": "The controller supports a Command Shell connection using the SSH protocol",
"Oem": "The controller supports a Command Shell connection using an OEM-specific protocol"
}
},
"readonly": true,
"description": "This object is used to enumerate the Command Shell connection types allowed by the implementation.",
"longDescription": "The value of ConnectTypesSupported shall be an array of the enumerations provided here. SSH shall be included if the Secure Shell (SSH) protocol is supported. Telnet shall be included if the Telnet protocol is supported. IPMI shall be included if the IPMI (Serial-over-LAN) protocol is supported."
}
},
"description": "The value of this property shall contain the information about the Command Shell service of this manager."
},
"GraphicalConsole": {
"type": [
"object",
"null"
],
"additionalProperties": false,
"properties": {
"Enabled": {
"type": "boolean",
"description": "Indicates if the service is enabled for this manager.",
"longDescription": "The value of this property shall contain the enabled status of the protocol used for the service. The value shall be true if enabled and false if disabled."
},
"MaxConcurrentSessions": {
"type": "integer",
"readonly": true,
"description": "Indicates the maximum number of service sessions, regardless of protocol, this manager is able to support.",
"longDescription": "The value of this property shall contain the maximum number of concurrent service sessions supported by the implementation."
},
"ConnectTypesSupported": {
"type": "array",
"items": {
"type": "string",
"enum": [
"KVMIP",
"Oem"
],
"enumDescriptions": {
"KVMIP": "The controller supports a Graphical Console connection using a KVM-IP (redirection of Keyboard, Video, Mouse over IP) protocol",
"Oem": "The controller supports a Graphical Console connection using an OEM-specific protocol"
}
},
"readonly": true,
"description": "This object is used to enumerate the Graphical Console connection types allowed by the implementation.",
"longDescription": "The value of ConnectTypesSupported shall be an array of the enumerations provided here. RDP shall be included if the Remote Desktop (RDP) protocol is supported. KVMIP shall be included if a vendor-define KVM-IP protocol is supported."
}
},
"description": "The value of this property shall contain the information about the Graphical Console (KVM-IP) service of this manager."
},
"Actions": {
"type": "object",
"additionalProperties": false,
"properties": {
"Oem": {
"type": [
"object",
"null"
],
"additionalProperties": false,
"properties": {
}
},
"#Manager.Reset": {
"type": "object",
"additionalProperties": false,
"properties": {
"title": {
"type": "string",
"description": "Friendly action name"
},
"target": {
"type": "string",
"description": "Link to invoke action"
}
}
},
"#Manager.ForceFailover": {
"type": "object",
"additionalProperties": false,
"properties": {
"title": {
"type": "string",
"description": "Friendly action name"
},
"target": {
"type": "string",
"description": "Link to invoke action"
},
"href@DMTF.AllowableValues": {
"type": "array",
"items": {
"type": "array",
"items": {
"@odata.id": "Resource.0.96.0.json#Resource"
}
},
"description": "This array defines the supported values for this property on this resource. In this case, a valid reference is supported."
}
}
},
"#Manager.ModifyRedundancySet": {
"type": "object",
"additionalProperties": false,
"properties": {
"title": {
"type": "string",
"description": "Friendly action name"
},
"target": {
"type": "string",
"description": "Link to invoke action"
},
"Add@DMTF.AllowableValues": {
"type": "array",
"items": {
"type": "array",
"items": {
"@odata.id": "Resource.0.96.0.json#Resource"
}
},
"description": "This array defines the supported values for this property on this resource. In this case, a valid reference is supported. Add shall be used to Add members to the manager redundancy group."
},
"Remove@DMTF.AllowableValues": {
"type": "array",
"items": {
"type": "array",
"items": {
"@odata.id": "Resource.0.96.0.json#Resource"
}
},
"description": "This array defines the supported values for this property on this resource. In this case, a valid reference is supported. Remove shall be used to remove members from the manager redundancy group."
}
}
}
},
"readonly": true,
"description": "The Actions object contains the available custom actions on this resource."
},
"Status": {
"$ref": "Resource.0.96.0.json#Status"
},
"Redundancy": {
"type": "array",
"items": {
"$ref": "Redundancy.0.96.0.json#Redundancy"
},
"readonly": true,
"description": "Redundancy information for the managers of this system"
},
"ManagerService": {
"type": "object",
"additionalProperties": false,
"properties": {
"Enabled": {
"type": "boolean",
"description": "Indicates if the service is enabled for this manager.",
"longDescription": "The value of this property shall contain the enabled status of the protocol used for the service. The value shall be true if enabled and false if disabled."
},
"MaxConcurrentSessions": {
"type": "integer",
"readonly": true,
"description": "Indicates the maximum number of service sessions, regardless of protocol, this manager is able to support.",
"longDescription": "The value of this property shall contain the maximum number of concurrent service sessions supported by the implementation."
}
},
"description": "Used for describing services like Serial Console, Command Shell or Graphical Console"
}
},
"description": "This is the schema definition for a Manager. Examples of managers are BMCs, Enclosure Managers, Management Controllers and other subsystems assigned managability functions.",
"longDescription": "This resource shall be used to represent a management subsystem for a Redfish implementation."
}

36
alexandria/models.py Normal file
View File

@ -0,0 +1,36 @@
# coding=utf-8
import json
import glob
import os
import re
class Model(object):
def __init__(self):
self.reference_items = []
self.read_ref_files()
pass
def read_ref_files(self):
cwd = os.getcwd()
model_files = glob.glob(cwd + "/model/*.json")
for file in model_files:
# Derive attribute name from file.
attr_name = os.path.basename(file)
attr_name = re.sub(r"\..*$", "", attr_name)
# read json file
with open(file) as json_data:
data_structure = json.load(json_data)
json_data.close()
# Create an class attribute for that structure
setattr(self, attr_name, data_structure)
self.reference_items.append(attr_name)
return True