diff options
| author | Ed Tanous <ed.tanous@intel.com> | 2017-10-24 17:04:52 -0700 |
|---|---|---|
| committer | Ed Tanous <ed.tanous@intel.com> | 2017-10-24 17:10:33 -0700 |
| commit | 710adfcf07d73b00a9bb6f8bf977cdb0897fa4b8 (patch) | |
| tree | 15b50e4a242788ad4d6ce385cf2e7111c477535c /include | |
| parent | ba9f9a6cebfbb7a12ecf869afa0cdc5aef9c8372 (diff) | |
| download | bmcweb-710adfcf07d73b00a9bb6f8bf977cdb0897fa4b8.tar.gz bmcweb-710adfcf07d73b00a9bb6f8bf977cdb0897fa4b8.zip | |
Add the redfish static files to the build
...And delete the old webserver static files from the repo.
Move $metadata to a static file, as that's really where it belongs.
Change-Id: I2caeee7cd779b7c07cfc10cd693459105656671f
Diffstat (limited to 'include')
| -rw-r--r-- | include/redfish_v1.hpp | 264 | ||||
| -rw-r--r-- | include/webassets.hpp | 8 |
2 files changed, 17 insertions, 255 deletions
diff --git a/include/redfish_v1.hpp b/include/redfish_v1.hpp index d13eb13..e106079 100644 --- a/include/redfish_v1.hpp +++ b/include/redfish_v1.hpp @@ -61,260 +61,6 @@ void request_routes(Crow<Middlewares...>& app) { res.end(); }); - CROW_ROUTE(app, "/redfish/v1/$metadata/") - .methods( - "GET"_method)([&](const crow::request& req, crow::response& res) { - const char* response_text = R"(<?xml version="1.0" encoding="UTF-8"?> - <edmx:Edmx xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx" Version="4.0"> - <edmx:Reference Uri="/redfish/v1/schema/ServiceRoot_v1.xml"> - <edmx:Include Namespace="ServiceRoot"/> - <edmx:Include Namespace="ServiceRoot.v1_0_4"/> - <edmx:Include Namespace="ServiceRoot.v1_1_1"/> - </edmx:Reference> - <edmx:Reference Uri="/redfish/v1/schema/AccountService_v1.xml"> - <edmx:Include Namespace="AccountService"/> - <edmx:Include Namespace="AccountService.v1_0_3"/> - <edmx:Include Namespace="AccountService.v1_1_0"/> - </edmx:Reference> - <edmx:Reference Uri="/redfish/v1/schema/Chassis_v1.xml"> - <edmx:Include Namespace="Chassis"/> - <edmx:Include Namespace="Chassis.v1_0_3"/> - <edmx:Include Namespace="Chassis.v1_1_3"/> - <edmx:Include Namespace="Chassis.v1_2_1"/> - <edmx:Include Namespace="Chassis.v1_3_1"/> - <edmx:Include Namespace="Chassis.v1_4_0"/> - </edmx:Reference> - <edmx:Reference Uri="/redfish/v1/schema/ChassisCollection_v1.xml"> - <edmx:Include Namespace="ChassisCollection"/> - </edmx:Reference> - <edmx:Reference Uri="/redfish/v1/schema/ComputerSystem_v1.xml"> - <edmx:Include Namespace="ComputerSystem"/> - <edmx:Include Namespace="ComputerSystem.v1_0_4"/> - <edmx:Include Namespace="ComputerSystem.v1_1_2"/> - <edmx:Include Namespace="ComputerSystem.v1_2_1"/> - <edmx:Include Namespace="ComputerSystem.v1_3_0"/> - </edmx:Reference> - <edmx:Reference Uri="/redfish/v1/schema/ComputerSystemCollection_v1.xml"> - <edmx:Include Namespace="ComputerSystemCollection"/> - </edmx:Reference> - <edmx:Reference Uri="/redfish/v1/schema/EthernetInterface_v1.xml"> - <edmx:Include Namespace="EthernetInterface"/> - <edmx:Include Namespace="EthernetInterface.v1_0_3"/> - <edmx:Include Namespace="EthernetInterface.v1_1_1"/> - <edmx:Include Namespace="EthernetInterface.v1_2_0"/> - </edmx:Reference> - <edmx:Reference Uri="/redfish/v1/schema/EthernetInterfaceCollection_v1.xml"> - <edmx:Include Namespace="EthernetInterfaceCollection"/> - </edmx:Reference> - <edmx:Reference Uri="/redfish/v1/schema/LogEntry_v1.xml"> - <edmx:Include Namespace="LogEntry"/> - <edmx:Include Namespace="LogEntry.v1_0_3"/> - <edmx:Include Namespace="LogEntry.v1_1_1"/> - </edmx:Reference> - <edmx:Reference Uri="/redfish/v1/schema/LogEntryCollection_v1.xml"> - <edmx:Include Namespace="LogEntryCollection"/> - </edmx:Reference> - <edmx:Reference Uri="/redfish/v1/schema/LogService_v1.xml"> - <edmx:Include Namespace="LogService"/> - <edmx:Include Namespace="LogService.v1_0_3"/> - </edmx:Reference> - <edmx:Reference Uri="/redfish/v1/schema/LogServiceCollection_v1.xml"> - <edmx:Include Namespace="LogServiceCollection"/> - </edmx:Reference> - <edmx:Reference Uri="/redfish/v1/schema/Manager_v1.xml"> - <edmx:Include Namespace="Manager"/> - <edmx:Include Namespace="Manager.v1_0_3"/> - <edmx:Include Namespace="Manager.v1_1_1"/> - <edmx:Include Namespace="Manager.v1_2_1"/> - <edmx:Include Namespace="Manager.v1_3_0"/> - </edmx:Reference> - <edmx:Reference Uri="/redfish/v1/schema/ManagerAccount_v1.xml"> - <edmx:Include Namespace="ManagerAccount"/> - <edmx:Include Namespace="ManagerAccount.v1_0_3"/> - </edmx:Reference> - <edmx:Reference Uri="/redfish/v1/schema/ManagerNetworkProtocol_v1.xml"> - <edmx:Include Namespace="ManagerNetworkProtocol"/> - <edmx:Include Namespace="ManagerNetworkProtocol.v1_0_3"/> - <edmx:Include Namespace="ManagerNetworkProtocol.v1_1_0"/> - </edmx:Reference> - <edmx:Reference Uri="/redfish/v1/schema/ManagerAccountCollection_v1.xml"> - <edmx:Include Namespace="ManagerAccountCollection"/> - </edmx:Reference> - <edmx:Reference Uri="/redfish/v1/schema/ManagerCollection_v1.xml"> - <edmx:Include Namespace="ManagerCollection"/> - </edmx:Reference> - <edmx:Reference Uri="/redfish/v1/schema/Power_v1.xml"> - <edmx:Include Namespace="Power"/> - <edmx:Include Namespace="Power.v1_0_3"/> - <edmx:Include Namespace="Power.v1_1_1"/> - <edmx:Include Namespace="Power.v1_2_1"/> - </edmx:Reference> - <edmx:Reference Uri="/redfish/v1/schema/Processor_v1.xml"> - <edmx:Include Namespace="Processor"/> - <edmx:Include Namespace="Processor.v1_0_3"/> - </edmx:Reference> - <edmx:Reference Uri="/redfish/v1/schema/ProcessorCollection_v1.xml"> - <edmx:Include Namespace="ProcessorCollection"/> - </edmx:Reference> - <edmx:Reference Uri="/redfish/v1/schema/Role_v1.xml"> - <edmx:Include Namespace="Role"/> - <edmx:Include Namespace="Role.v1_0_2"/> - </edmx:Reference> - <edmx:Reference Uri="/redfish/v1/schema/RoleCollection_v1.xml"> - <edmx:Include Namespace="RoleCollection"/> - </edmx:Reference> - <edmx:Reference Uri="/redfish/v1/schema/Session_v1.xml"> - <edmx:Include Namespace="Session"/> - <edmx:Include Namespace="Session.v1_0_3"/> - </edmx:Reference> - <edmx:Reference Uri="/redfish/v1/schema/SessionCollection_v1.xml"> - <edmx:Include Namespace="SessionCollection"/> - </edmx:Reference> - <edmx:Reference Uri="/redfish/v1/schema/SessionService_v1.xml"> - <edmx:Include Namespace="SessionService"/> - <edmx:Include Namespace="SessionService.v1_0_3"/> - <edmx:Include Namespace="SessionService.v1_1_1"/> - </edmx:Reference> - <edmx:Reference Uri="/redfish/v1/schema/Thermal_v1.xml"> - <edmx:Include Namespace="Thermal"/> - <edmx:Include Namespace="Thermal.v1_0_3"/> - <edmx:Include Namespace="Thermal.v1_1_1"/> - <edmx:Include Namespace="Thermal.v1_2_0"/> - </edmx:Reference> - <edmx:Reference Uri="/redfish/v1/schema/RedfishExtensions_v1.xml"> - <edmx:Include Namespace="RedfishExtensions.v1_0_0" Alias="Redfish"/> - </edmx:Reference> - <edmx:Reference Uri="/redfish/v1/schema/IPAddresses_v1.xml"> - <edmx:Include Namespace="IPAddresses"/> - <edmx:Include Namespace="IPAddresses.v1_0_4"/> - </edmx:Reference> - <edmx:Reference Uri="/redfish/v1/schema/MemoryCollection_v1.xml"> - <edmx:Include Namespace="MemoryCollection"/> - </edmx:Reference> - <edmx:Reference Uri="/redfish/v1/schema/MemoryMetrics_v1.xml"> - <edmx:Include Namespace="MemoryMetrics"/> - <edmx:Include Namespace="MemoryMetrics.v1_0_1"/> - <edmx:Include Namespace="MemoryMetrics.v1_1_1"/> - </edmx:Reference> - <edmx:Reference Uri="/redfish/v1/schema/Memory_v1.xml"> - <edmx:Include Namespace="Memory"/> - <edmx:Include Namespace="Memory.v1_0_1"/> - <edmx:Include Namespace="Memory.v1_1_0"/> - </edmx:Reference> - <edmx:Reference Uri="/redfish/v1/schema/PhysicalContext_v1.xml"> - <edmx:Include Namespace="PhysicalContext"/> - <edmx:Include Namespace="PhysicalContext.v1_0_3"/> - </edmx:Reference> - <edmx:Reference Uri="/redfish/v1/schema/Privileges_v1.xml"> - <edmx:Include Namespace="Privileges"/> - <edmx:Include Namespace="Privileges.v1_0_3"/> - </edmx:Reference> - <edmx:Reference Uri="/redfish/v1/schema/Redundancy_v1.xml"> - <edmx:Include Namespace="Redundancy"/> - <edmx:Include Namespace="Redundancy.v1_0_3"/> - <edmx:Include Namespace="Redundancy.v1_1_1"/> - </edmx:Reference> - <edmx:Reference Uri="/redfish/v1/schema/Resource_v1.xml"> - <edmx:Include Namespace="Resource"/> - <edmx:Include Namespace="Resource.v1_0_3"/> - <edmx:Include Namespace="Resource.v1_1_2"/> - <edmx:Include Namespace="Resource.v1_2_1"/> - <edmx:Include Namespace="Resource.v1_3_0"/> - </edmx:Reference> - <edmx:Reference Uri="/redfish/v1/schema/VirtualMediaCollection_v1.xml"> - <edmx:Include Namespace="VirtualMediaCollection"/> - </edmx:Reference> - <edmx:Reference Uri="/redfish/v1/schema/VirtualMedia_v1.xml"> - <edmx:Include Namespace="VirtualMedia"/> - <edmx:Include Namespace="VirtualMedia.v1_0_3"/> - </edmx:Reference> - <edmx:Reference Uri="/redfish/v1/schema/VLanNetworkInterfaceCollection_v1.xml"> - <edmx:Include Namespace="VLanNetworkInterfaceCollection"/> - </edmx:Reference> - <edmx:Reference Uri="/redfish/v1/schema/VLanNetworkInterface_v1.xml"> - <edmx:Include Namespace="VLanNetworkInterface"/> - <edmx:Include Namespace="VLanNetworkInterface.v1_0_3"/> - </edmx:Reference> - <edmx:Reference Uri="/redfish/v1/schema/StorageCollection_v1.xml"> - <edmx:Include Namespace="StorageCollection"/> - </edmx:Reference> - <edmx:Reference Uri="/redfish/v1/schema/Storage_v1.xml"> - <edmx:Include Namespace="Storage"/> - <edmx:Include Namespace="Storage.v1_0_2"/> - <edmx:Include Namespace="Storage.v1_1_1"/> - </edmx:Reference> - <edmx:Reference Uri="/redfish/v1/schema/Drive_v1.xml"> - <edmx:Include Namespace="Drive"/> - <edmx:Include Namespace="Drive.v1_0_2"/> - <edmx:Include Namespace="Drive.v1_1_1"/> - </edmx:Reference> - <edmx:Reference Uri="/redfish/v1/schema/SoftwareInventoryCollection_v1.xml"> - <edmx:Include Namespace="SoftwareInventoryCollection"/> - </edmx:Reference> - <edmx:Reference Uri="/redfish/v1/schema/SoftwareInventory_v1.xml"> - <edmx:Include Namespace="SoftwareInventory"/> - <edmx:Include Namespace="SoftwareInventory.v1_0_1"/> - <edmx:Include Namespace="SoftwareInventory.v1_1_1"/> - </edmx:Reference> - <edmx:Reference Uri="/redfish/v1/schema/UpdateService_v1.xml"> - <edmx:Include Namespace="UpdateService"/> - <edmx:Include Namespace="UpdateService.v1_0_1"/> - <edmx:Include Namespace="UpdateService.v1_1_0"/> - </edmx:Reference> - <edmx:Reference Uri="/redfish/v1/schema/Message_v1.xml"> - <edmx:Include Namespace="Message"/> - <edmx:Include Namespace="Message.v1_0_4"/> - </edmx:Reference> - <edmx:Reference Uri="/redfish/v1/schema/EndpointCollection_v1.xml"> - <edmx:Include Namespace="EndpointCollection"/> - </edmx:Reference> - <edmx:Reference Uri="/redfish/v1/schema/Endpoint_v1.xml"> - <edmx:Include Namespace="Endpoint"/> - <edmx:Include Namespace="Endpoint.v1_0_1"/> - </edmx:Reference> - <edmx:Reference Uri="/redfish/v1/schema/HostInterfaceCollection_v1.xml"> - <edmx:Include Namespace="HostInterfaceCollection"/> - </edmx:Reference> - <edmx:Reference Uri="/redfish/v1/schema/HostInterface_v1.xml"> - <edmx:Include Namespace="HostInterface"/> - <edmx:Include Namespace="HostInterface.v1_0_0"/> - </edmx:Reference> - <edmx:Reference Uri="/redfish/v1/schema/MessageRegistryFileCollection_v1.xml"> - <edmx:Include Namespace="MessageRegistryFileCollection"/> - </edmx:Reference> - <edmx:Reference Uri="/redfish/v1/schema/MessageRegistryFile_v1.xml"> - <edmx:Include Namespace="MessageRegistryFile"/> - <edmx:Include Namespace="MessageRegistryFile.v1_0_3"/> - </edmx:Reference> - <edmx:Reference Uri="/redfish/v1/schema/EventService_v1.xml"> - <edmx:Include Namespace="EventService"/> - <edmx:Include Namespace="EventService.v1_0_3"/> - </edmx:Reference> - <edmx:Reference Uri="/redfish/v1/schema/EventDestinationCollection_v1.xml"> - <edmx:Include Namespace="EventDestinationCollection"/> - </edmx:Reference> - <edmx:Reference Uri="/redfish/v1/schema/EventDestination_v1.xml"> - <edmx:Include Namespace="EventDestination"/> - <edmx:Include Namespace="EventDestination.v1_0_3"/> - <edmx:Include Namespace="EventDestination.v1_1_1"/> - </edmx:Reference> - <edmx:Reference Uri="/redfish/v1/schema/Event_v1.xml"> - <edmx:Include Namespace="Event"/> - <edmx:Include Namespace="Event.v1_0_4"/> - <edmx:Include Namespace="Event.v1_1_2"/> - </edmx:Reference> - <edmx:DataServices> - <Schema xmlns="http://docs.oasis-open.org/odata/ns/edm" Namespace="Service"> - <EntityContainer Name="Service" Extends="ServiceRoot.v1_0_0.ServiceContainer"/> - </Schema> - </edmx:DataServices> - </edmx:Edmx>)"; - - res.body = response_text; - res.add_header("Content-Type", "application/xml"); - res.end(); - }); - CROW_ROUTE(app, "/redfish/v1/Chassis/") .methods("GET"_method)( [&](const crow::request& req, crow::response& res) { @@ -561,7 +307,15 @@ void request_routes(Crow<Middlewares...>& app) { const std::string& session) { auto& data_middleware = app.template get_middleware<PersistentData::Middleware>(); - auto session_it = data_middleware.auth_tokens.find(session); + // TODO(Ed) this is inefficient + auto session_it = data_middleware.auth_tokens.begin(); + while (session_it != data_middleware.auth_tokens.end()) { + if (session_it->second.unique_id == session) { + break; + } + session_it++; + } + if (session_it == data_middleware.auth_tokens.end()) { res.code = 404; res.end(); diff --git a/include/webassets.hpp b/include/webassets.hpp index 7845d71..3afa61f 100644 --- a/include/webassets.hpp +++ b/include/webassets.hpp @@ -78,6 +78,14 @@ void request_routes(Crow<Middlewares...>& app) { auto content_type_it = content_types.find(webpath.extension().c_str()); if (content_type_it != content_types.end()) { content_type = content_type_it->second; + } else { + if (webpath.string() == "$metadata"){ + content_type_it = content_types.find(".xml"); + // should always be true + if (content_type_it != content_types.end()) { + content_type = content_type_it->second; + } + } } app.route_dynamic(std::string(webpath.string()))( [is_gzip, absolute_path_str, content_type](const crow::request& req, |

