Lines Matching +full:redfish +full:- +full:messages
1 // SPDX-License-Identifier: Apache-2.0
2 // SPDX-FileCopyrightText: Copyright OpenBMC Authors
3 // SPDX-FileCopyrightText: Copyright 2020 Intel Corporation
25 #include <asm-generic/errno.h>
50 namespace redfish namespace
65 BMCWEB_ROUTE(app, "/redfish/v1/EventService/") in requestRoutesEventService()
66 .privileges(redfish::privileges::getEventService) in requestRoutesEventService()
72 if (!redfish::setUpRedfishRoute(app, req, asyncResp)) in requestRoutesEventService()
77 asyncResp->res.jsonValue["@odata.id"] = "/redfish/v1/EventService"; in requestRoutesEventService()
78 asyncResp->res.jsonValue["@odata.type"] = in requestRoutesEventService()
80 asyncResp->res.jsonValue["Id"] = "EventService"; in requestRoutesEventService()
81 asyncResp->res.jsonValue["Name"] = "Event Service"; in requestRoutesEventService()
82 asyncResp->res.jsonValue["ServerSentEventUri"] = in requestRoutesEventService()
83 "/redfish/v1/EventService/SSE"; in requestRoutesEventService()
85 asyncResp->res.jsonValue["Subscriptions"]["@odata.id"] = in requestRoutesEventService()
86 "/redfish/v1/EventService/Subscriptions"; in requestRoutesEventService()
87 asyncResp->res.jsonValue["Actions"]["#EventService.SubmitTestEvent"] in requestRoutesEventService()
89 "/redfish/v1/EventService/Actions/EventService.SubmitTestEvent"; in requestRoutesEventService()
95 asyncResp->res.jsonValue["Status"]["State"] = in requestRoutesEventService()
97 asyncResp->res.jsonValue["ServiceEnabled"] = in requestRoutesEventService()
99 asyncResp->res.jsonValue["DeliveryRetryAttempts"] = in requestRoutesEventService()
101 asyncResp->res.jsonValue["DeliveryRetryIntervalSeconds"] = in requestRoutesEventService()
103 asyncResp->res.jsonValue["EventFormatTypes"] = in requestRoutesEventService()
105 asyncResp->res.jsonValue["RegistryPrefixes"] = supportedRegPrefixes; in requestRoutesEventService()
106 asyncResp->res.jsonValue["ResourceTypes"] = supportedResourceTypes; in requestRoutesEventService()
116 asyncResp->res.jsonValue["SSEFilterPropertiesSupported"] = in requestRoutesEventService()
120 BMCWEB_ROUTE(app, "/redfish/v1/EventService/") in requestRoutesEventService()
121 .privileges(redfish::privileges::patchEventService) in requestRoutesEventService()
125 if (!redfish::setUpRedfishRoute(app, req, asyncResp)) in requestRoutesEventService()
133 req, asyncResp->res, // in requestRoutesEventService()
153 // Supported range [1-3] in requestRoutesEventService()
156 messages::queryParameterOutOfRange( in requestRoutesEventService()
157 asyncResp->res, std::to_string(*retryAttemps), in requestRoutesEventService()
158 "DeliveryRetryAttempts", "[1-3]"); in requestRoutesEventService()
168 // Supported range [5 - 180] in requestRoutesEventService()
171 messages::queryParameterOutOfRange( in requestRoutesEventService()
172 asyncResp->res, std::to_string(*retryInterval), in requestRoutesEventService()
173 "DeliveryRetryIntervalSeconds", "[5-180]"); in requestRoutesEventService()
190 app, "/redfish/v1/EventService/Actions/EventService.SubmitTestEvent/") in requestRoutesSubmitTestEvent()
191 .privileges(redfish::privileges::postEventService) in requestRoutesSubmitTestEvent()
195 if (!redfish::setUpRedfishRoute(app, req, asyncResp)) in requestRoutesSubmitTestEvent()
200 // From the Redfish spec on EventId in requestRoutesSubmitTestEvent()
206 // clang-format off in requestRoutesSubmitTestEvent()
208 req, asyncResp->res, in requestRoutesSubmitTestEvent()
221 // clang-format on in requestRoutesSubmitTestEvent()
226 messages::serviceDisabled(asyncResp->res, in requestRoutesSubmitTestEvent()
227 "/redfish/v1/EventService/"); in requestRoutesSubmitTestEvent()
230 asyncResp->res.result(boost::beast::http::status::no_content); in requestRoutesSubmitTestEvent()
247 BMCWEB_LOG_ERROR("D-Bus response error on GetManagedObjects {}", ec); in doSubscriptionCollection()
248 messages::internalError(asyncResp->res); in doSubscriptionCollection()
251 nlohmann::json& memberArray = asyncResp->res.jsonValue["Members"]; in doSubscriptionCollection()
259 messages::internalError(asyncResp->res); in doSubscriptionCollection()
269 BMCWEB_ROUTE(app, "/redfish/v1/EventService/Subscriptions/") in requestRoutesEventDestinationCollection()
270 .privileges(redfish::privileges::getEventDestinationCollection) in requestRoutesEventDestinationCollection()
274 if (!redfish::setUpRedfishRoute(app, req, asyncResp)) in requestRoutesEventDestinationCollection()
278 asyncResp->res.jsonValue["@odata.type"] = in requestRoutesEventDestinationCollection()
280 asyncResp->res.jsonValue["@odata.id"] = in requestRoutesEventDestinationCollection()
281 "/redfish/v1/EventService/Subscriptions"; in requestRoutesEventDestinationCollection()
282 asyncResp->res.jsonValue["Name"] = in requestRoutesEventDestinationCollection()
286 asyncResp->res.jsonValue["Members"]; in requestRoutesEventDestinationCollection()
291 asyncResp->res.jsonValue["Members@odata.count"] = in requestRoutesEventDestinationCollection()
298 "/redfish/v1/EventService/Subscriptions/{}" + id); in requestRoutesEventDestinationCollection()
301 crow::connections::systemBus->async_method_call( in requestRoutesEventDestinationCollection()
311 BMCWEB_ROUTE(app, "/redfish/v1/EventService/Subscriptions/") in requestRoutesEventDestinationCollection()
312 .privileges(redfish::privileges::postEventDestinationCollection) in requestRoutesEventDestinationCollection()
318 if (!redfish::setUpRedfishRoute(app, req, asyncResp)) in requestRoutesEventDestinationCollection()
325 messages::eventSubscriptionLimitExceeded(asyncResp->res); in requestRoutesEventDestinationCollection()
345 req, asyncResp->res, // in requestRoutesEventDestinationCollection()
365 // clang-format on in requestRoutesEventDestinationCollection()
367 …// https://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url-in-different-bro… in requestRoutesEventDestinationCollection()
371 messages::stringValueTooLong(asyncResp->res, "Destination", in requestRoutesEventDestinationCollection()
378 if (!regPrefixes->empty() && !msgIds->empty()) in requestRoutesEventDestinationCollection()
380 messages::propertyValueConflict( in requestRoutesEventDestinationCollection()
381 asyncResp->res, "MessageIds", "RegistryPrefixes"); in requestRoutesEventDestinationCollection()
392 messages::propertyValueFormatError(asyncResp->res, destUrl, in requestRoutesEventDestinationCollection()
396 url->normalize(); in requestRoutesEventDestinationCollection()
399 if (url->has_port() && url->port_number() == 0) in requestRoutesEventDestinationCollection()
402 url->port()); in requestRoutesEventDestinationCollection()
403 messages::propertyValueFormatError(asyncResp->res, destUrl, in requestRoutesEventDestinationCollection()
411 if (url->path().empty()) in requestRoutesEventDestinationCollection()
413 url->set_path("/"); in requestRoutesEventDestinationCollection()
416 if (url->has_userinfo()) in requestRoutesEventDestinationCollection()
418 messages::propertyValueFormatError(asyncResp->res, destUrl, in requestRoutesEventDestinationCollection()
427 messages::propertyValueConflict(asyncResp->res, "Context", in requestRoutesEventDestinationCollection()
433 messages::propertyValueConflict( in requestRoutesEventDestinationCollection()
434 asyncResp->res, "EventFormatType", "Protocol"); in requestRoutesEventDestinationCollection()
439 messages::propertyValueConflict(asyncResp->res, in requestRoutesEventDestinationCollection()
445 messages::propertyValueConflict( in requestRoutesEventDestinationCollection()
446 asyncResp->res, "SendHeartbeat", "Protocol"); in requestRoutesEventDestinationCollection()
451 messages::propertyValueConflict( in requestRoutesEventDestinationCollection()
452 asyncResp->res, "HeartbeatIntervalMinutes", "Protocol"); in requestRoutesEventDestinationCollection()
457 messages::propertyValueConflict(asyncResp->res, in requestRoutesEventDestinationCollection()
463 messages::propertyValueConflict( in requestRoutesEventDestinationCollection()
464 asyncResp->res, "RegistryPrefixes", "Protocol"); in requestRoutesEventDestinationCollection()
469 messages::propertyValueConflict( in requestRoutesEventDestinationCollection()
470 asyncResp->res, "ResourceTypes", "Protocol"); in requestRoutesEventDestinationCollection()
475 messages::propertyValueConflict(asyncResp->res, in requestRoutesEventDestinationCollection()
481 messages::propertyValueConflict( in requestRoutesEventDestinationCollection()
482 asyncResp->res, "MetricReportDefinitions", "Protocol"); in requestRoutesEventDestinationCollection()
485 if (url->scheme() != "snmp") in requestRoutesEventDestinationCollection()
487 messages::propertyValueConflict(asyncResp->res, in requestRoutesEventDestinationCollection()
492 addSnmpTrapClient(asyncResp, url->host_address(), in requestRoutesEventDestinationCollection()
493 url->port_number()); in requestRoutesEventDestinationCollection()
506 messages::propertyValueNotInList( in requestRoutesEventDestinationCollection()
507 asyncResp->res, *subscriptionType, "SubscriptionType"); in requestRoutesEventDestinationCollection()
510 subValue->userSub->subscriptionType = *subscriptionType; in requestRoutesEventDestinationCollection()
515 subValue->userSub->subscriptionType = "RedfishEvent"; in requestRoutesEventDestinationCollection()
518 if (protocol != "Redfish") in requestRoutesEventDestinationCollection()
520 messages::propertyValueNotInList(asyncResp->res, protocol, in requestRoutesEventDestinationCollection()
524 subValue->userSub->protocol = protocol; in requestRoutesEventDestinationCollection()
528 subValue->userSub->verifyCertificate = *verifyCertificate; in requestRoutesEventDestinationCollection()
537 messages::propertyValueNotInList( in requestRoutesEventDestinationCollection()
538 asyncResp->res, *eventFormatType2, "EventFormatType"); in requestRoutesEventDestinationCollection()
541 subValue->userSub->eventFormatType = *eventFormatType2; in requestRoutesEventDestinationCollection()
546 subValue->userSub->eventFormatType = "Event"; in requestRoutesEventDestinationCollection()
553 if (context->size() > maxContextSize) in requestRoutesEventDestinationCollection()
555 messages::stringValueTooLong(asyncResp->res, "Context", in requestRoutesEventDestinationCollection()
559 subValue->userSub->customText = *context; in requestRoutesEventDestinationCollection()
574 messages::propertyValueFormatError( in requestRoutesEventDestinationCollection()
575 asyncResp->res, item.second, in requestRoutesEventDestinationCollection()
583 cumulativeLen += item.first.size() + value->size() + 6; in requestRoutesEventDestinationCollection()
588 messages::arraySizeTooLong( in requestRoutesEventDestinationCollection()
589 asyncResp->res, "HttpHeaders", maxHeaderSizeED); in requestRoutesEventDestinationCollection()
592 subValue->userSub->httpHeaders.set(item.first, *value); in requestRoutesEventDestinationCollection()
604 messages::propertyValueNotInList(asyncResp->res, it, in requestRoutesEventDestinationCollection()
609 subValue->userSub->registryPrefixes = *regPrefixes; in requestRoutesEventDestinationCollection()
614 subValue->userSub->originResources = *originResources; in requestRoutesEventDestinationCollection()
624 messages::propertyValueNotInList(asyncResp->res, it, in requestRoutesEventDestinationCollection()
629 subValue->userSub->resourceTypes = *resTypes; in requestRoutesEventDestinationCollection()
638 if (subValue->userSub->registryPrefixes.empty()) in requestRoutesEventDestinationCollection()
645 registryPrefix = subValue->userSub->registryPrefixes; in requestRoutesEventDestinationCollection()
655 const std::span<const redfish::registries::MessageEntry> in requestRoutesEventDestinationCollection()
657 redfish::registries::getRegistryFromPrefix(it); in requestRoutesEventDestinationCollection()
661 [&id](const redfish::registries::MessageEntry& in requestRoutesEventDestinationCollection()
673 messages::propertyValueNotInList(asyncResp->res, id, in requestRoutesEventDestinationCollection()
679 subValue->userSub->registryMsgIds = *msgIds; in requestRoutesEventDestinationCollection()
687 messages::propertyValueNotInList( in requestRoutesEventDestinationCollection()
688 asyncResp->res, *retryPolicy, "DeliveryRetryPolicy"); in requestRoutesEventDestinationCollection()
691 subValue->userSub->retryPolicy = *retryPolicy; in requestRoutesEventDestinationCollection()
696 subValue->userSub->retryPolicy = "TerminateAfterRetries"; in requestRoutesEventDestinationCollection()
700 subValue->userSub->sendHeartbeat = *sendHeartbeat; in requestRoutesEventDestinationCollection()
706 messages::propertyValueOutOfRange( in requestRoutesEventDestinationCollection()
707 asyncResp->res, *hbIntervalMinutes, in requestRoutesEventDestinationCollection()
711 subValue->userSub->hbIntervalMinutes = *hbIntervalMinutes; in requestRoutesEventDestinationCollection()
720 if (!json_util::readJsonObject(mrdObj, asyncResp->res, in requestRoutesEventDestinationCollection()
726 subValue->userSub->metricReportDefinitions.emplace_back( in requestRoutesEventDestinationCollection()
736 messages::internalError(asyncResp->res); in requestRoutesEventDestinationCollection()
740 messages::created(asyncResp->res); in requestRoutesEventDestinationCollection()
741 asyncResp->res.addHeader( in requestRoutesEventDestinationCollection()
742 "Location", "/redfish/v1/EventService/Subscriptions/" + id); in requestRoutesEventDestinationCollection()
745 if (subValue->userSub->sendHeartbeat) in requestRoutesEventDestinationCollection()
747 subValue->scheduleNextHeartbeatEvent(); in requestRoutesEventDestinationCollection()
754 BMCWEB_ROUTE(app, "/redfish/v1/EventService/Subscriptions/<str>/") in requestRoutesEventDestination()
755 .privileges(redfish::privileges::getEventDestination) in requestRoutesEventDestination()
760 if (!redfish::setUpRedfishRoute(app, req, asyncResp)) in requestRoutesEventDestination()
775 asyncResp->res.result( in requestRoutesEventDestination()
782 *subValue->userSub; in requestRoutesEventDestination()
784 nlohmann::json& jVal = asyncResp->res.jsonValue; in requestRoutesEventDestination()
788 event_destination::EventDestinationProtocol::Redfish; in requestRoutesEventDestination()
790 "/redfish/v1/EventService/Subscriptions/{}", id); in requestRoutesEventDestination()
816 BMCWEB_ROUTE(app, "/redfish/v1/EventService/Subscriptions/<str>/") in requestRoutesEventDestination()
820 //.privileges(redfish::privileges::patchEventDestination) in requestRoutesEventDestination()
826 if (!redfish::setUpRedfishRoute(app, req, asyncResp)) in requestRoutesEventDestination()
834 asyncResp->res.result( in requestRoutesEventDestination()
847 req, asyncResp->res, // in requestRoutesEventDestination()
861 subValue->userSub->customText = *context; in requestRoutesEventDestination()
875 messages::propertyValueFormatError( in requestRoutesEventDestination()
876 asyncResp->res, it.second, in requestRoutesEventDestination()
883 subValue->userSub->httpHeaders = std::move(fields); in requestRoutesEventDestination()
892 messages::propertyValueNotInList(asyncResp->res, in requestRoutesEventDestination()
897 subValue->userSub->retryPolicy = *retryPolicy; in requestRoutesEventDestination()
902 subValue->userSub->sendHeartbeat = *sendHeartbeat; in requestRoutesEventDestination()
908 messages::propertyValueOutOfRange( in requestRoutesEventDestination()
909 asyncResp->res, *hbIntervalMinutes, in requestRoutesEventDestination()
913 subValue->userSub->hbIntervalMinutes = *hbIntervalMinutes; in requestRoutesEventDestination()
921 subValue->heartbeatParametersChanged(); in requestRoutesEventDestination()
926 subValue->userSub->verifyCertificate = *verifyCertificate; in requestRoutesEventDestination()
931 BMCWEB_ROUTE(app, "/redfish/v1/EventService/Subscriptions/<str>/") in requestRoutesEventDestination()
935 //.privileges(redfish::privileges::deleteEventDestination) in requestRoutesEventDestination()
941 if (!redfish::setUpRedfishRoute(app, req, asyncResp)) in requestRoutesEventDestination()
955 messages::resourceNotFound(asyncResp->res, in requestRoutesEventDestination()
959 messages::success(asyncResp->res); in requestRoutesEventDestination()
963 } // namespace redfish