├── .gitignore ├── license-template ├── src ├── main │ ├── resources │ │ ├── buildInfo.properties │ │ ├── AvailableBundle.properties │ │ ├── LocalMsgResources │ │ │ ├── common │ │ │ │ ├── CommonExceptionDtls_de.properties │ │ │ │ ├── CommonExceptionDtls_en.properties │ │ │ │ ├── CommonExceptionDtls_fr.properties │ │ │ │ ├── CommonExceptionDtls_ja.properties │ │ │ │ ├── CommonExceptionDtls_ko.properties │ │ │ │ └── CommonExceptionDtls_zh_CN.properties │ │ │ └── infrastructure │ │ │ │ ├── IdentityExceptionDtls_de.properties │ │ │ │ ├── IdentityExceptionDtls_en.properties │ │ │ │ ├── IdentityExceptionDtls_fr.properties │ │ │ │ ├── IdentityExceptionDtls_ja.properties │ │ │ │ ├── IdentityExceptionDtls_ko.properties │ │ │ │ └── IdentityExceptionDtls_zh_CN.properties │ │ └── bootstrap.yml │ ├── java │ │ └── com │ │ │ └── dell │ │ │ └── isg │ │ │ └── smi │ │ │ └── firmwareupdate │ │ │ ├── BuildInfo.java │ │ │ ├── service │ │ │ ├── MyComp.java │ │ │ ├── IFirmwareService.java │ │ │ └── FirmwareServiceImpl.java │ │ │ ├── SimpleCORSFilter.java │ │ │ ├── common │ │ │ ├── Response.java │ │ │ ├── Credentials.java │ │ │ ├── UriConstants.java │ │ │ ├── FirmwareConstants.java │ │ │ └── CredentialsConstant.java │ │ │ ├── adapter │ │ │ ├── IDuecAdapter.java │ │ │ ├── util │ │ │ │ ├── Utility.java │ │ │ │ └── ProtocolCredentialUtil.java │ │ │ ├── DuecAdapterImpl.java │ │ │ ├── IFirmwareAdapter.java │ │ │ ├── model │ │ │ │ ├── ProtocolEnum.java │ │ │ │ └── ProxyConfig.java │ │ │ └── WsmanFirmwareAdapterImpl.java │ │ │ ├── controller │ │ │ ├── model │ │ │ │ ├── Version.java │ │ │ │ ├── Firmware.java │ │ │ │ ├── DupRequest.java │ │ │ │ ├── ObmRequestBase.java │ │ │ │ ├── UpdateRequest.java │ │ │ │ ├── CatalogComparison.java │ │ │ │ ├── JobStatusRequest.java │ │ │ │ └── ApplicableUpdateRequest.java │ │ │ ├── RootController.java │ │ │ ├── IFirmwareUpdateController.java │ │ │ └── FirmwareUpdateController.java │ │ │ ├── exception │ │ │ └── ErrorCodeEnum.java │ │ │ ├── ServiceServerFirmwareupdateApplication.java │ │ │ └── infrastructure │ │ │ ├── IFirmwareInfrastructure.java │ │ │ └── FirmwareInfrastructureImpl.java │ └── docker │ │ └── Dockerfile ├── docs │ └── asciidoc │ │ ├── api-firmware-update-v1.adoc │ │ ├── misc.adoc │ │ └── readme.adoc └── test │ └── java │ └── com │ └── dell │ └── isg │ └── smi │ └── firmwareupdate │ ├── Swagger2MarkupTest.java │ └── ServiceServerFirmwareupdateApplicationTests.java ├── Dockerfile ├── settings.gradle.example ├── gradle.properties ├── .project ├── README.md └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | /bin/ 2 | /build/ 3 | .classpath 4 | .gradle/ 5 | .settings/ 6 | /gradle 7 | -------------------------------------------------------------------------------- /license-template: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RackHD/smi-service-dell-server-firmwareupdate/master/license-template -------------------------------------------------------------------------------- /src/main/resources/buildInfo.properties: -------------------------------------------------------------------------------- 1 | buildInfo.version=1.0 2 | buildInfo.tag=devel 3 | buildInfo.date=10-02-2017_02-56 -------------------------------------------------------------------------------- /src/main/resources/AvailableBundle.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RackHD/smi-service-dell-server-firmwareupdate/master/src/main/resources/AvailableBundle.properties -------------------------------------------------------------------------------- /src/main/java/com/dell/isg/smi/firmwareupdate/BuildInfo.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RackHD/smi-service-dell-server-firmwareupdate/master/src/main/java/com/dell/isg/smi/firmwareupdate/BuildInfo.java -------------------------------------------------------------------------------- /src/main/java/com/dell/isg/smi/firmwareupdate/service/MyComp.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RackHD/smi-service-dell-server-firmwareupdate/master/src/main/java/com/dell/isg/smi/firmwareupdate/service/MyComp.java -------------------------------------------------------------------------------- /src/docs/asciidoc/api-firmware-update-v1.adoc: -------------------------------------------------------------------------------- 1 | include::{generated}/overview.adoc[] 2 | include::readme.adoc[] 3 | include::{generated}/paths.adoc[] 4 | include::{generated}/definitions.adoc[] 5 | include::misc.adoc[] -------------------------------------------------------------------------------- /src/main/java/com/dell/isg/smi/firmwareupdate/SimpleCORSFilter.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RackHD/smi-service-dell-server-firmwareupdate/master/src/main/java/com/dell/isg/smi/firmwareupdate/SimpleCORSFilter.java -------------------------------------------------------------------------------- /src/main/java/com/dell/isg/smi/firmwareupdate/common/Response.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RackHD/smi-service-dell-server-firmwareupdate/master/src/main/java/com/dell/isg/smi/firmwareupdate/common/Response.java -------------------------------------------------------------------------------- /src/main/java/com/dell/isg/smi/firmwareupdate/common/Credentials.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RackHD/smi-service-dell-server-firmwareupdate/master/src/main/java/com/dell/isg/smi/firmwareupdate/common/Credentials.java -------------------------------------------------------------------------------- /src/main/java/com/dell/isg/smi/firmwareupdate/common/UriConstants.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RackHD/smi-service-dell-server-firmwareupdate/master/src/main/java/com/dell/isg/smi/firmwareupdate/common/UriConstants.java -------------------------------------------------------------------------------- /src/test/java/com/dell/isg/smi/firmwareupdate/Swagger2MarkupTest.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RackHD/smi-service-dell-server-firmwareupdate/master/src/test/java/com/dell/isg/smi/firmwareupdate/Swagger2MarkupTest.java -------------------------------------------------------------------------------- /src/main/java/com/dell/isg/smi/firmwareupdate/adapter/IDuecAdapter.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RackHD/smi-service-dell-server-firmwareupdate/master/src/main/java/com/dell/isg/smi/firmwareupdate/adapter/IDuecAdapter.java -------------------------------------------------------------------------------- /src/main/java/com/dell/isg/smi/firmwareupdate/adapter/util/Utility.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RackHD/smi-service-dell-server-firmwareupdate/master/src/main/java/com/dell/isg/smi/firmwareupdate/adapter/util/Utility.java -------------------------------------------------------------------------------- /src/main/java/com/dell/isg/smi/firmwareupdate/adapter/DuecAdapterImpl.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RackHD/smi-service-dell-server-firmwareupdate/master/src/main/java/com/dell/isg/smi/firmwareupdate/adapter/DuecAdapterImpl.java -------------------------------------------------------------------------------- /src/main/java/com/dell/isg/smi/firmwareupdate/adapter/IFirmwareAdapter.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RackHD/smi-service-dell-server-firmwareupdate/master/src/main/java/com/dell/isg/smi/firmwareupdate/adapter/IFirmwareAdapter.java -------------------------------------------------------------------------------- /src/main/java/com/dell/isg/smi/firmwareupdate/common/FirmwareConstants.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RackHD/smi-service-dell-server-firmwareupdate/master/src/main/java/com/dell/isg/smi/firmwareupdate/common/FirmwareConstants.java -------------------------------------------------------------------------------- /src/main/java/com/dell/isg/smi/firmwareupdate/controller/model/Version.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RackHD/smi-service-dell-server-firmwareupdate/master/src/main/java/com/dell/isg/smi/firmwareupdate/controller/model/Version.java -------------------------------------------------------------------------------- /src/main/java/com/dell/isg/smi/firmwareupdate/exception/ErrorCodeEnum.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RackHD/smi-service-dell-server-firmwareupdate/master/src/main/java/com/dell/isg/smi/firmwareupdate/exception/ErrorCodeEnum.java -------------------------------------------------------------------------------- /src/main/java/com/dell/isg/smi/firmwareupdate/service/IFirmwareService.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RackHD/smi-service-dell-server-firmwareupdate/master/src/main/java/com/dell/isg/smi/firmwareupdate/service/IFirmwareService.java -------------------------------------------------------------------------------- /src/main/java/com/dell/isg/smi/firmwareupdate/adapter/model/ProtocolEnum.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RackHD/smi-service-dell-server-firmwareupdate/master/src/main/java/com/dell/isg/smi/firmwareupdate/adapter/model/ProtocolEnum.java -------------------------------------------------------------------------------- /src/main/java/com/dell/isg/smi/firmwareupdate/adapter/model/ProxyConfig.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RackHD/smi-service-dell-server-firmwareupdate/master/src/main/java/com/dell/isg/smi/firmwareupdate/adapter/model/ProxyConfig.java -------------------------------------------------------------------------------- /src/main/java/com/dell/isg/smi/firmwareupdate/common/CredentialsConstant.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RackHD/smi-service-dell-server-firmwareupdate/master/src/main/java/com/dell/isg/smi/firmwareupdate/common/CredentialsConstant.java -------------------------------------------------------------------------------- /src/main/java/com/dell/isg/smi/firmwareupdate/controller/RootController.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RackHD/smi-service-dell-server-firmwareupdate/master/src/main/java/com/dell/isg/smi/firmwareupdate/controller/RootController.java -------------------------------------------------------------------------------- /src/main/java/com/dell/isg/smi/firmwareupdate/controller/model/Firmware.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RackHD/smi-service-dell-server-firmwareupdate/master/src/main/java/com/dell/isg/smi/firmwareupdate/controller/model/Firmware.java -------------------------------------------------------------------------------- /src/main/resources/LocalMsgResources/common/CommonExceptionDtls_de.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RackHD/smi-service-dell-server-firmwareupdate/master/src/main/resources/LocalMsgResources/common/CommonExceptionDtls_de.properties -------------------------------------------------------------------------------- /src/main/resources/LocalMsgResources/common/CommonExceptionDtls_en.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RackHD/smi-service-dell-server-firmwareupdate/master/src/main/resources/LocalMsgResources/common/CommonExceptionDtls_en.properties -------------------------------------------------------------------------------- /src/main/resources/LocalMsgResources/common/CommonExceptionDtls_fr.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RackHD/smi-service-dell-server-firmwareupdate/master/src/main/resources/LocalMsgResources/common/CommonExceptionDtls_fr.properties -------------------------------------------------------------------------------- /src/main/resources/LocalMsgResources/common/CommonExceptionDtls_ja.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RackHD/smi-service-dell-server-firmwareupdate/master/src/main/resources/LocalMsgResources/common/CommonExceptionDtls_ja.properties -------------------------------------------------------------------------------- /src/main/resources/LocalMsgResources/common/CommonExceptionDtls_ko.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RackHD/smi-service-dell-server-firmwareupdate/master/src/main/resources/LocalMsgResources/common/CommonExceptionDtls_ko.properties -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM openjdk:8-jre 2 | VOLUME /tmp 3 | ADD build/libs/service-server-firmwareupdate*.jar app.jar 4 | EXPOSE 46010 5 | RUN bash -c 'touch /app.jar' 6 | ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"] -------------------------------------------------------------------------------- /src/main/docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM java:8 2 | VOLUME /tmp 3 | ADD build/libs/service-server-firmwareupdate*.jar app.jar 4 | RUN bash -c 'touch /app.jar' 5 | ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"] 6 | 7 | -------------------------------------------------------------------------------- /src/main/java/com/dell/isg/smi/firmwareupdate/controller/model/DupRequest.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RackHD/smi-service-dell-server-firmwareupdate/master/src/main/java/com/dell/isg/smi/firmwareupdate/controller/model/DupRequest.java -------------------------------------------------------------------------------- /src/main/java/com/dell/isg/smi/firmwareupdate/service/FirmwareServiceImpl.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RackHD/smi-service-dell-server-firmwareupdate/master/src/main/java/com/dell/isg/smi/firmwareupdate/service/FirmwareServiceImpl.java -------------------------------------------------------------------------------- /src/main/resources/LocalMsgResources/common/CommonExceptionDtls_zh_CN.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RackHD/smi-service-dell-server-firmwareupdate/master/src/main/resources/LocalMsgResources/common/CommonExceptionDtls_zh_CN.properties -------------------------------------------------------------------------------- /src/main/java/com/dell/isg/smi/firmwareupdate/controller/model/ObmRequestBase.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RackHD/smi-service-dell-server-firmwareupdate/master/src/main/java/com/dell/isg/smi/firmwareupdate/controller/model/ObmRequestBase.java -------------------------------------------------------------------------------- /src/main/java/com/dell/isg/smi/firmwareupdate/controller/model/UpdateRequest.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RackHD/smi-service-dell-server-firmwareupdate/master/src/main/java/com/dell/isg/smi/firmwareupdate/controller/model/UpdateRequest.java -------------------------------------------------------------------------------- /settings.gradle.example: -------------------------------------------------------------------------------- 1 | include ':commons-model' 2 | include ':adapter-server' 3 | project(':commons-model').projectDir = new File (settingsDir, '../commons-model') 4 | project(':adapter-server').projectDir = new File (settingsDir, '../adapter-server') -------------------------------------------------------------------------------- /src/main/java/com/dell/isg/smi/firmwareupdate/adapter/WsmanFirmwareAdapterImpl.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RackHD/smi-service-dell-server-firmwareupdate/master/src/main/java/com/dell/isg/smi/firmwareupdate/adapter/WsmanFirmwareAdapterImpl.java -------------------------------------------------------------------------------- /src/main/java/com/dell/isg/smi/firmwareupdate/controller/model/CatalogComparison.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RackHD/smi-service-dell-server-firmwareupdate/master/src/main/java/com/dell/isg/smi/firmwareupdate/controller/model/CatalogComparison.java -------------------------------------------------------------------------------- /src/main/java/com/dell/isg/smi/firmwareupdate/controller/model/JobStatusRequest.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RackHD/smi-service-dell-server-firmwareupdate/master/src/main/java/com/dell/isg/smi/firmwareupdate/controller/model/JobStatusRequest.java -------------------------------------------------------------------------------- /src/main/java/com/dell/isg/smi/firmwareupdate/adapter/util/ProtocolCredentialUtil.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RackHD/smi-service-dell-server-firmwareupdate/master/src/main/java/com/dell/isg/smi/firmwareupdate/adapter/util/ProtocolCredentialUtil.java -------------------------------------------------------------------------------- /src/main/java/com/dell/isg/smi/firmwareupdate/controller/IFirmwareUpdateController.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RackHD/smi-service-dell-server-firmwareupdate/master/src/main/java/com/dell/isg/smi/firmwareupdate/controller/IFirmwareUpdateController.java -------------------------------------------------------------------------------- /src/main/resources/LocalMsgResources/infrastructure/IdentityExceptionDtls_de.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RackHD/smi-service-dell-server-firmwareupdate/master/src/main/resources/LocalMsgResources/infrastructure/IdentityExceptionDtls_de.properties -------------------------------------------------------------------------------- /src/main/resources/LocalMsgResources/infrastructure/IdentityExceptionDtls_en.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RackHD/smi-service-dell-server-firmwareupdate/master/src/main/resources/LocalMsgResources/infrastructure/IdentityExceptionDtls_en.properties -------------------------------------------------------------------------------- /src/main/resources/LocalMsgResources/infrastructure/IdentityExceptionDtls_fr.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RackHD/smi-service-dell-server-firmwareupdate/master/src/main/resources/LocalMsgResources/infrastructure/IdentityExceptionDtls_fr.properties -------------------------------------------------------------------------------- /src/main/resources/LocalMsgResources/infrastructure/IdentityExceptionDtls_ja.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RackHD/smi-service-dell-server-firmwareupdate/master/src/main/resources/LocalMsgResources/infrastructure/IdentityExceptionDtls_ja.properties -------------------------------------------------------------------------------- /src/main/resources/LocalMsgResources/infrastructure/IdentityExceptionDtls_ko.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RackHD/smi-service-dell-server-firmwareupdate/master/src/main/resources/LocalMsgResources/infrastructure/IdentityExceptionDtls_ko.properties -------------------------------------------------------------------------------- /src/main/java/com/dell/isg/smi/firmwareupdate/ServiceServerFirmwareupdateApplication.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RackHD/smi-service-dell-server-firmwareupdate/master/src/main/java/com/dell/isg/smi/firmwareupdate/ServiceServerFirmwareupdateApplication.java -------------------------------------------------------------------------------- /src/main/java/com/dell/isg/smi/firmwareupdate/infrastructure/IFirmwareInfrastructure.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RackHD/smi-service-dell-server-firmwareupdate/master/src/main/java/com/dell/isg/smi/firmwareupdate/infrastructure/IFirmwareInfrastructure.java -------------------------------------------------------------------------------- /src/main/resources/LocalMsgResources/infrastructure/IdentityExceptionDtls_zh_CN.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RackHD/smi-service-dell-server-firmwareupdate/master/src/main/resources/LocalMsgResources/infrastructure/IdentityExceptionDtls_zh_CN.properties -------------------------------------------------------------------------------- /src/docs/asciidoc/misc.adoc: -------------------------------------------------------------------------------- 1 | Licensing 2 | --------- 3 | 4 | This docker microservice is available under the 5 | http://www.apache.org/licenses/LICENSE-2.0.txt[Apache 2.0 License]. 6 | 7 | Support 8 | -------- 9 | 10 | Slack Channel: codecommunity.slack.com -------------------------------------------------------------------------------- /src/main/java/com/dell/isg/smi/firmwareupdate/controller/model/ApplicableUpdateRequest.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RackHD/smi-service-dell-server-firmwareupdate/master/src/main/java/com/dell/isg/smi/firmwareupdate/controller/model/ApplicableUpdateRequest.java -------------------------------------------------------------------------------- /src/main/java/com/dell/isg/smi/firmwareupdate/infrastructure/FirmwareInfrastructureImpl.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RackHD/smi-service-dell-server-firmwareupdate/master/src/main/java/com/dell/isg/smi/firmwareupdate/infrastructure/FirmwareInfrastructureImpl.java -------------------------------------------------------------------------------- /src/test/java/com/dell/isg/smi/firmwareupdate/ServiceServerFirmwareupdateApplicationTests.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RackHD/smi-service-dell-server-firmwareupdate/master/src/test/java/com/dell/isg/smi/firmwareupdate/ServiceServerFirmwareupdateApplicationTests.java -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | version=1.0 2 | dockerTag=devel 3 | buildInfo.licenseControl.runChecks=true 4 | buildInfo.licenseControl.autoDiscover=true 5 | buildInfo.build.name=com.dell.isg.smi:service-server-firmwareupdate 6 | systemProp.sonar.host.url=https://sonarqube.com 7 | systemProp.sonar.organization=rackhd-smi 8 | systemProp.sonar.login=##sonarqubeLogin-placeholder## 9 | bintrayRepo=docs 10 | bintrayUserOrg=rackhd 11 | bintrayVcsUrl=https://bintray.com/rackhd/docs/apidoc 12 | bintrayUser=##bintray-user-placeholder## 13 | bintrayApiKey=##bintray-api-key-placeholder## -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | service-server-firmwareupdate 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.buildship.core.gradleprojectbuilder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.jdt.core.javanature 21 | org.eclipse.buildship.core.gradleprojectnature 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 46010 3 | --- 4 | 5 | spring: 6 | profiles: default 7 | application: 8 | name: SERVER-FIRMWARE-UPDATE 9 | cloud: 10 | bus: 11 | enabled: false 12 | consul: 13 | enabled: false 14 | config: 15 | enabled: false 16 | --- 17 | 18 | spring: 19 | profiles: consul 20 | application: 21 | name: SERVER-FIRMWARE-UPDATE 22 | cloud: 23 | consul: 24 | enabled: true 25 | host: service-registry 26 | port: 8500 27 | config: 28 | prefix: config 29 | profileSeparator: '::' 30 | format: YAML 31 | data-key: data 32 | fail-fast: true -------------------------------------------------------------------------------- /src/docs/asciidoc/readme.adoc: -------------------------------------------------------------------------------- 1 | Purpose 2 | ~~~~~~~ 3 | 4 | DUSE Microservice updates firmware on Dell PowerEdge server using industry standard WS-Management - WSMAN Protocol. Service to compare and apply firmware updates for a Dell server using a repository catalog. 5 | 6 | For use with Dell 11th Generation and newer servers. 7 | - Download the catalog from ftp.dell.com to a local share 8 | - Determine updates from a Dell Repository Manager catalog that can be applied to a Dell server 9 | - Create a custom catalog 10 | - Schedule updates from a Dell Repository Manager catalog to a dell server 11 | 12 | The docker container Exposes a REST API that provides methods to orchestrate the comparison and upgrade Dell 11th Generation and newer servers using a Dell Repository Catalog. The catalog.xml file in the repository contains information about the Update Bundles and their "Dell Update Packages" (DUPs) available in the repository. 13 | 14 | By default the dell-server-firmwareupdate docker-container will use the catalog available on ftp.dell.com, unless a custom catalog is specified in the request. 15 | 16 | To update firmware, a NFS or CIFS folder with write permission must be mounted on the host, and the local location provided as part of the Docker run command. This share must be accessible by the IDRACs of the Dell servers that you wish to update. When a firmware update is initiated DUPs are stored in a folder this share, and downloaded from there by the IDRAC. 17 | 18 | Prerequisites 19 | +++++++++++++ 20 | - Docker running on Linux 21 | - A NFS or CIFS share running locally or mounted locally on the docker host. 22 | - The IDRAC must have read access to the NFS or CIFS host 23 | - The IDRAC must be accessible from the Docker Container 24 | - Access to ftp.dell.com, or a repository created by the Dell Repository Manager placed on a network share. 25 | 26 | How to Use 27 | ~~~~~~~~~~ 28 | 29 | 1. Mount the NFS or CIFS share on the Host Linux based OS that is Running Docker (example /mnt/myShare/myFolder) 30 | 2. Start the Docker Container 31 | 32 | .... 33 | sudo docker run -p 0.0.0.0:46010:46010 --name dell-server-firmwareupdate -v /mnt/myShare/myFolder:/fwRepo -d rackhd/dell-server-firmwareupdate:1.0.0 34 | .... 35 | 3. Verify the shared directory exists and you can see any files you have on the share from within your docker container. 36 | .... 37 | sudo docker exec -it dell-server-firmwareupdate /bin/bash 38 | ls fwRepo 39 | .... 40 | 41 | 4. Verify you can access the Swagger UI at http://hostIP:46010/swagger-ui.html 42 | 5. Call the Version API (to make sure the API is working). 43 | ..... 44 | http://hostIP:46010/ 45 | ..... 46 | The service can also start up to bootstrap its configuration from consul. More information about registration with and using advanced configuration settings provided by a Consul K/V store can be found in the online help. 47 | 48 | Example Firmware Update API Flow (Without Using RackHD) 49 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 50 | 51 | 1. Put a Dell catalog file on the mounted share 52 | Option 1 - Download the catalog from ftp.dell.com 53 | .... 54 | http://hostIP:46010/api/1.0/server/firmware/downloader?fileName=Catalog.xml.gz&fileUrl=ftp.dell.com/catalog&targetLocation=/fwRepo 55 | .... 56 | Option 2 - Alternatively, you can use Dell Repository Manager to create a custom repository for your system(s) and place the files, to include the catalog file, on your network share. 57 | 2. Determine the DUPs in the catalog that are available to be applied to a specific Dell server. 58 | 59 | http://hostIP:46010/api/1.0/server/firmware/comparer 60 | .... 61 | { 62 | "address":"", 63 | "catalogPath":"nfs/Catalog.xml", 64 | "type":"wsman", 65 | "updateableComponentInventory":"string" 66 | } 67 | .... 68 | The curl command above will return a list of applicable updates (DUPS) for the systems specified. 69 | 3. Create a custom repository for your server that contain only the DUPs you want to apply. 70 | -- If using ftp.dell.com for your catalog, this step will download DUPs from the internet into the new repository. 71 | -- If using a Dell Repository Manager catalog, it will copy the DUPs from the catalog's repository into the new repository. 72 | 73 | Ideally, a consuming UI will read the results from the previous step, allow you to pick the updates, and build the payload for this method. Alternatively you can manually construct a CURL command using the data returned from the previous step, removing the components you do not wish to apply. You can also apply all of the results from the previous method by using it directly as your payload. 74 | 75 | Example Post 76 | ++++++++++++ 77 | 78 | http://hostIP:46010/api/1.0/server/firmware/comparer/custom 79 | 80 | .... 81 | { 82 | "catalogFilePath":"nfs/Catalog.xml", 83 | "targetFilePath":"nfs/repo", 84 | "updates": [ 85 | { 86 | "version": "2.23", 87 | "path": "FOLDER02909018M/6/Firmware_635G9_WN32_2.23_A00-00.EXE", 88 | "name": "13G SEP Firmware", 89 | "criticality": "Recommended", 90 | "uniqueIdentifier": "635G9LWXP", 91 | "updateAction": "EQUAL", 92 | "targetIdentifier": "101434", 93 | "packageInformationPath": "FOLDER02909018M/6/Firmware_635G9_WN32_2.23_A00-00.EXE", 94 | "sourceName": "DCIM:INSTALLED#314_C_RAID.Backplane.Firmware.1", 95 | "category": "Firmware" 96 | } 97 | ] 98 | } 99 | .... 100 | 101 | 4. Initiate a firmware update job for the server. 102 | 103 | http://hostIP:46010/v1/server/firmware/updater 104 | 105 | ..... 106 | { 107 | "serverAddress": "<>", 108 | "shareAddress" : "<>", 109 | "shareName": "/nfs/repo", 110 | "catalogFileName" : "Catalog.xml", 111 | "shareType" : "0", 112 | "shareUserName" : "user1", 113 | "sharePassword" : "user1", 114 | "applyUpdate" : "1", 115 | "Reboot" : "YES" 116 | } 117 | ..... 118 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Service to compare and apply firmware updates for a Dell server using a repository catalog. 2 | 3 | [![Quality Gate](http://100.68.126.201:9000/api/badges/gate?key=org.sonarqube:service-server-firmwareupdate)](http://100.68.126.201:9000/dashboard/index/org.sonarqube:service-server-firmwareupdate) 4 | 5 | Copyright © 2017 Dell Inc. or its subsidiaries. All Rights Reserved. 6 | 7 | ### Purpose 8 | For use with Dell 11th Generation and newer servers. 9 | - Download the catalog from ftp.dell.com to a local share 10 | - Determine updates from a Dell Repository Manager catalog that can be applied to a Dell server 11 | - Create a custom catalog 12 | - Schedule updates from a Dell Repository Manager catalog to a dell server 13 | 14 | 15 | ### Overview 16 | The docker container Exposes a REST API that provides methods to orchestrate the comparison and upgrade Dell 11th Generation and newer servers using a Dell Repository Catalog. The catalog.xml file in the repository contains information about the Update Bundles and their "Dell Update Packages" (DUPs) available in the repository. 17 | 18 | By default the dell-server-firmwareupdate docker-container will use the catalog available on ftp.dell.com, unless a custom catalog is specified in the request. 19 | 20 | To update firmware, a NFS or CIFS folder with write permission must be mounted on the host, and the local location provided as part of the Docker run command. This share must be accessible by the IDRACs of the Dell servers that you wish to update. When a firmware update is initiated DUPs are stored in a folder this share, and downloaded from there by the IDRAC. 21 | 22 | ### Prerequisites 23 | - Docker running on Linux 24 | - A NFS or CIFS share running locally or mounted locally on the docker host. 25 | - The IDRAC must have read access to the NFS or CIFS host 26 | - The IDRAC must be accessible from the Docker Container 27 | - Access to ftp.dell.com, or a repository created by the Dell Repository Manager placed on a network share. 28 | 29 | --- 30 | 31 | ### How to Launch 32 | 1. Mount the NFS or CIFS share on the Host Linux based OS that is Running Docker (example /mnt/myShare/myFolder) 33 | 2. Start the Docker Container 34 | ~~~ 35 | sudo docker run -p 0.0.0.0:46010:46010 --name dell-server-firmwareupdate -v /mnt/myShare/myFolder:/fwRepo -d rackhd/dell-server-firmwareupdate:1.0.0 36 | ~~~ 37 | 3. Verify the shared directory exists and you can see any files you have on the share from within your docker container. 38 | ~~~ 39 | sudo docker exec -it dell-server-firmwareupdate /bin/bash 40 | ls fwRepo 41 | ~~~ 42 | 4. Verify you can access the Swagger UI at http://<>:46010/swagger-ui.html 43 | 5. Call the Version API (to make sure the API is working). 44 | ~~~ 45 | http://<>:46010/api/1.0/server/firmware/version 46 | ~~~ 47 | ___ 48 | 49 | ### How to Use 50 | 51 | #### API Definitions 52 | A swagger UI is provided bythe microservice at: 53 | http://<>:46010/swagger-ui.html 54 | 55 | #### Example Firmware Update API Flow (Without Using RackHD) 56 | 1. Put a Dell catalog file on the mounted share 57 | Option 1 - Download the catalog from ftp.dell.com 58 | ~~~ 59 | http://<>:46010/api/1.0/server/firmware/downloader?fileName=Catalog.xml.gz&fileUrl=ftp.dell.com/catalog&targetLocation=/fwRepo 60 | ~~~ 61 | Option 2 - Alternatively, you can use Dell Repository Manager to create a custom repository for your system(s) and place the files, to include the catalog file, on your network share. 62 | 2. Determine the DUPs in the catalog that are available to be applied to a specific Dell server. 63 | ~~~ 64 | http://<>:46010/api/1.0/server/firmware/comparer 65 | {"address":"","catalogPath":"nfs/Catalog.xml","type":"wsman",updateableComponentInventory:"string"} 66 | ~~~ 67 | The curl command above will return a list of applicable updates (DUPS) for the systems specified. 68 | 3. Create a custom repository for your server that contain only the DUPs you want to apply. 69 | -- If using ftp.dell.com for your catalog, this step will download DUPs from the internet into the new repository. 70 | -- If using a Dell Repository Manager catalog, it will copy the DUPs from the catalog's repository into the new repository. 71 | 72 | Ideally, a consuming UI will read the results from the previous step, allow you to pick the updates, and build the payload for this method. Alternatively you can manually construct a CURL command using the data returned from the previous step, removing the components you do not wish to apply. You can also apply all of the results from the previous method by using it directly as your payload. 73 | 74 | Example payload 75 | ~~~ 76 | http://<>:46010/api/1.0/server/firmware/comparer/custom 77 | { 78 | "catalogFilePath":"nfs/Catalog.xml", 79 | "targetFilePath":"nfs/repo", 80 | "updates": [ 81 | { 82 | "version": "2.23", 83 | "path": "FOLDER02909018M/6/Firmware_635G9_WN32_2.23_A00-00.EXE", 84 | "name": "13G SEP Firmware", 85 | "criticality": "Recommended", 86 | "uniqueIdentifier": "635G9LWXP", 87 | "updateAction": "EQUAL", 88 | "targetIdentifier": "101434", 89 | "packageInformationPath": "FOLDER02909018M/6/Firmware_635G9_WN32_2.23_A00-00.EXE", 90 | "sourceName": "DCIM:INSTALLED#314_C_RAID.Backplane.Firmware.1", 91 | "category": "Firmware" 92 | } 93 | ] 94 | } 95 | ~~~ 96 | 4. Initiate a firmware update job for the server. 97 | ~~~ 98 | http://<>:46010/v1/server/firmware/updater 99 | { 100 | "serverAddress": "<>", 101 | "shareAddress" : "<>", 102 | "shareName": "/nfs/repo", 103 | "catalogFileName" : "Catalog.xml", 104 | "shareType" : "0", 105 | "shareUserName" : "user1", 106 | "sharePassword" : "user1", 107 | "applyUpdate" : "1", 108 | "Reboot" : "YES" 109 | } 110 | ~~~ 111 | 112 | #### Example Firmware Update Using RackHD 113 | The <> taskgraph allows you to apply all of the applicable firmware for a bundle in a repository to a given server. 114 | 115 | #### Example Firmware Update API Flow with callback monitoring 116 | 1. Set up a way to listen for http data 117 | a. On a linux computer that you would like to use as the callback target, start netcat. Netcat, when started with the options in the example below, it will echo any requests it receives on port 5000 to the terminal. 118 | ~~~ 119 | netcat -kl 5000 120 | ~~~ 121 | b. Test it out by making a http request to port 5000 http://<:5000/foo/bar 122 | 2. Make the following CURL calls to these endpoints: 123 | TODO: 124 | 125 | --- 126 | 127 | 128 | ### Licensing 129 | 130 | Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 131 | 132 | Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 133 | 134 | RackHD is a Trademark of Dell EMC 135 | 136 | ### Support 137 | Slack Channel: codecommunity.slack.com 138 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /src/main/java/com/dell/isg/smi/firmwareupdate/controller/FirmwareUpdateController.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright � 2017 DELL Inc. or its subsidiaries. All Rights Reserved. 3 | */ 4 | package com.dell.isg.smi.firmwareupdate.controller; 5 | 6 | /** 7 | * @author rahman.muhammad 8 | * 9 | */ 10 | 11 | import java.util.ArrayList; 12 | import java.util.List; 13 | 14 | import org.slf4j.Logger; 15 | import org.slf4j.LoggerFactory; 16 | import org.springframework.beans.factory.annotation.Autowired; 17 | import org.springframework.web.bind.annotation.RequestBody; 18 | import org.springframework.web.bind.annotation.RequestParam; 19 | import org.springframework.web.bind.annotation.RestController; 20 | 21 | import com.dell.isg.smi.commons.elm.exception.InvalidArgumentsException; 22 | import com.dell.isg.smi.commons.elm.exception.RuntimeCoreException; 23 | import com.dell.isg.smi.commons.model.common.CallBackResponse; 24 | import com.dell.isg.smi.commons.model.server.JobStatus; 25 | import com.dell.isg.smi.commons.model.server.firmware.ApplicableUpdate; 26 | import com.dell.isg.smi.commons.model.server.firmware.ComputerSystem; 27 | import com.dell.isg.smi.commons.model.server.firmware.SoftwareIdentity; 28 | import com.dell.isg.smi.commons.model.server.firmware.request.CompareCatalogRequest; 29 | import com.dell.isg.smi.commons.model.server.firmware.request.CustomRepoRequest; 30 | import com.dell.isg.smi.firmwareupdate.common.Credentials; 31 | import com.dell.isg.smi.firmwareupdate.common.CredentialsConstant; 32 | import com.dell.isg.smi.firmwareupdate.common.Response; 33 | import com.dell.isg.smi.firmwareupdate.controller.model.ApplicableUpdateRequest; 34 | import com.dell.isg.smi.firmwareupdate.controller.model.CatalogComparison; 35 | import com.dell.isg.smi.firmwareupdate.controller.model.DupRequest; 36 | import com.dell.isg.smi.firmwareupdate.controller.model.JobStatusRequest; 37 | import com.dell.isg.smi.firmwareupdate.controller.model.ObmRequestBase; 38 | import com.dell.isg.smi.firmwareupdate.controller.model.UpdateRequest; 39 | import com.dell.isg.smi.firmwareupdate.controller.model.Version; 40 | import com.dell.isg.smi.firmwareupdate.service.IFirmwareService; 41 | 42 | @RestController 43 | 44 | public class FirmwareUpdateController implements IFirmwareUpdateController { 45 | 46 | @Autowired 47 | private IFirmwareService firmwareService; 48 | 49 | private static final Logger logger = LoggerFactory.getLogger(FirmwareUpdateController.class.getName()); 50 | 51 | /* 52 | * webMethod to return installed firmware update Micro services version 53 | * 54 | */ 55 | @Override 56 | public Version version() { 57 | return new Version(); 58 | } 59 | 60 | /* 61 | * Endpoint for installed firmware version on provided server , 62 | * 63 | */ 64 | @Override 65 | public List getFirmwareInventory(@RequestBody ObmRequestBase request) { 66 | 67 | logger.info("FirmwareUpdateController - getFirmwareInventory(..) for server : {}", request.getServerAddress()); 68 | 69 | if (isInvalid(request.getServerAddress())) { 70 | InvalidArgumentsException exp = new InvalidArgumentsException("serverAddress"); 71 | throw exp; 72 | } else if (isInvalid(request.getUserName())) { 73 | InvalidArgumentsException exp = new InvalidArgumentsException("userName"); 74 | throw exp; 75 | } else if (isInvalid(request.getPassword())) { 76 | InvalidArgumentsException exp = new InvalidArgumentsException("password"); 77 | throw exp; 78 | } 79 | 80 | try { 81 | 82 | logger.info("requesting firmware version for server: {}", request.getServerAddress()); 83 | Credentials cred = new Credentials(); 84 | cred.setAddress(request.getServerAddress()); 85 | cred.setUserName(request.getUserName()); 86 | cred.setPassword(request.getPassword()); 87 | return firmwareService.getFirmwareInventory(cred.getAddress(), cred.getUserName(), cred.getPassword()); 88 | } catch (Exception exp) { 89 | logger.error(exp.toString()); 90 | RuntimeCoreException runExp = new RuntimeCoreException(exp); 91 | throw runExp; 92 | } 93 | 94 | } 95 | 96 | /* 97 | * Rest API for returning all updateable component inventory for a provided 98 | * system 99 | * 100 | */ 101 | @Override 102 | public List getUpdateableComponentInventory(@RequestBody ObmRequestBase request) { 103 | 104 | logger.info("FirmwareUpdateController - getUpdateableComponentInventory(..) for server : {}", 105 | request.getServerAddress()); 106 | 107 | if (isInvalid(request.getServerAddress())) { 108 | InvalidArgumentsException exp = new InvalidArgumentsException("serverAddress"); 109 | throw exp; 110 | } else if (isInvalid(request.getUserName())) { 111 | InvalidArgumentsException exp = new InvalidArgumentsException("userName"); 112 | throw exp; 113 | } else if (isInvalid(request.getPassword())) { 114 | InvalidArgumentsException exp = new InvalidArgumentsException("password"); 115 | throw exp; 116 | } 117 | 118 | try { 119 | logger.info("requesting firmware version for server: {} ", request.getServerAddress()); 120 | Credentials cred = new Credentials(); 121 | cred.setAddress(request.getServerAddress()); 122 | cred.setUserName(request.getUserName()); 123 | cred.setPassword(request.getPassword()); 124 | return firmwareService.getUpdateableComponentInventory(cred.getAddress(), cred.getUserName(), 125 | cred.getPassword()); 126 | 127 | } catch (Exception exp) { 128 | logger.error(exp.toString()); 129 | RuntimeCoreException runExp = new RuntimeCoreException(exp); 130 | throw runExp; 131 | } 132 | 133 | } 134 | 135 | /* 136 | * API for returning all applicable updates for a system 137 | * 138 | */ 139 | 140 | @Override 141 | public List getApplicableUpdates(@RequestBody ApplicableUpdateRequest request) { 142 | 143 | List applicableUpdates = new ArrayList(); 144 | logger.info("FirmwareUpdateController - getApplicableUpdates(..) "); 145 | 146 | if (request == null) { 147 | InvalidArgumentsException exp = new InvalidArgumentsException("request"); 148 | throw exp; 149 | } 150 | 151 | boolean isCatalogValid = false; 152 | if (request.getCatalogPath() != null) { 153 | String extension = ""; 154 | int i = request.getCatalogPath().lastIndexOf('.'); 155 | if (i > 0) { 156 | extension = request.getCatalogPath().substring(i + 1); 157 | } 158 | if (extension.equals("xml")) { 159 | isCatalogValid = true; 160 | } 161 | } 162 | 163 | if (!isCatalogValid) { 164 | InvalidArgumentsException exp = new InvalidArgumentsException("catalogPath"); 165 | throw exp; 166 | } 167 | 168 | try { 169 | Credentials cred = new Credentials(); 170 | cred.setAddress(request.getServerAddress()); 171 | cred.setUserName(request.getUserName()); 172 | cred.setPassword(request.getPassword()); 173 | applicableUpdates = firmwareService.getApplicableUpdates(cred, request.getUpdateableComponentInventory(), 174 | request.getCatalogPath(), request.getType()); 175 | 176 | } catch (Exception exp) { 177 | logger.error(exp.toString()); 178 | RuntimeCoreException runExp = new RuntimeCoreException(exp); 179 | throw runExp; 180 | } 181 | return applicableUpdates; 182 | } 183 | 184 | /* 185 | * API for creating custom catalog based on provided applicable updates 186 | */ 187 | @Override 188 | 189 | public Response createBaseLineRepository(@RequestBody CustomRepoRequest request) { 190 | 191 | Response response = new Response(); 192 | 193 | logger.info("firmwareUpdate controller - createBaseLineRepository(..)"); 194 | 195 | if (request == null) { 196 | InvalidArgumentsException exp = new InvalidArgumentsException("request"); 197 | throw exp; 198 | } else if (request.getUpdates() == null) { 199 | InvalidArgumentsException exp = new InvalidArgumentsException("updates"); 200 | throw exp; 201 | } else if (request.getCatalogFilePath() == null) { 202 | InvalidArgumentsException exp = new InvalidArgumentsException("catalogPath"); 203 | throw exp; 204 | } else if (request.getTargetFilePath() == null) { 205 | InvalidArgumentsException exp = new InvalidArgumentsException("targetFilePath"); 206 | throw exp; 207 | } 208 | 209 | try { 210 | firmwareService.createBaseLineRepository(request.getUpdates(), request.getCatalogFilePath(), 211 | request.getTargetFilePath()); 212 | response.setId("0"); 213 | response.setName("createCustomeRepository"); 214 | response.setStatus("Completed"); 215 | response.setDescription("Firmware update on Dell PowerEdge Server required a repository of DUPs"); 216 | } catch (Exception exp) { 217 | logger.error(exp.toString()); 218 | RuntimeCoreException runExp = new RuntimeCoreException(exp); 219 | throw runExp; 220 | } 221 | 222 | return response; 223 | } 224 | 225 | /* 226 | * API for comparing two catalogs 227 | */ 228 | @Override 229 | 230 | public CatalogComparison CompareCatalogs(@RequestBody CompareCatalogRequest request) { 231 | 232 | int returnCode = -1; 233 | String EMPTY_STRING = ""; 234 | if (request == null) { 235 | InvalidArgumentsException exp = new InvalidArgumentsException("request"); 236 | throw exp; 237 | } else if (EMPTY_STRING.equals(request.getSourceCatalog())) { 238 | InvalidArgumentsException exp = new InvalidArgumentsException("sourceCatalog"); 239 | throw exp; 240 | } else if (EMPTY_STRING.equals(request.getSourceCatalog())) { 241 | InvalidArgumentsException exp = new InvalidArgumentsException("targetCatalog"); 242 | throw exp; 243 | } 244 | 245 | try { 246 | returnCode = firmwareService.compareCatalogs(request.getSourceCatalog(), request.getTargetCatalog()); 247 | 248 | } catch (Exception exp) { 249 | logger.error(exp.toString()); 250 | RuntimeCoreException runExp = new RuntimeCoreException(exp); 251 | throw runExp; 252 | } 253 | CatalogComparison cmp = new CatalogComparison(); 254 | cmp.setStatus(String.valueOf(returnCode)); 255 | return cmp; 256 | } 257 | 258 | /* 259 | * Allows to download file from specified location, to the target location. 260 | * 261 | * @param sourceType - value for source type e.g NFS, CIFS, FTP etc 262 | * 263 | * @param fileUrl - file location to download 264 | * 265 | * @param targetLocation - where the file will be downloaded 266 | */ 267 | 268 | @Override 269 | public Response downloadFile(@RequestParam(value = "fileName", defaultValue = "") String fileName, 270 | @RequestParam(value = "fileUrl", defaultValue = "") String fileUrl, 271 | @RequestParam(value = "targetLocation", defaultValue = "") String targetLocation) { 272 | 273 | logger.info("firmwareUpdate controller - downloadFile(..)"); 274 | Response response = new Response(); 275 | 276 | if (fileName.isEmpty()) { 277 | InvalidArgumentsException exp = new InvalidArgumentsException("fileName"); 278 | throw exp; 279 | } else if (fileUrl.isEmpty()) { 280 | InvalidArgumentsException exp = new InvalidArgumentsException("fileUrl"); 281 | throw exp; 282 | } else if (targetLocation.isEmpty()) { 283 | InvalidArgumentsException exp = new InvalidArgumentsException("targetLocation"); 284 | throw exp; 285 | } 286 | 287 | try { 288 | firmwareService.downloadFile(fileName, fileUrl, targetLocation); 289 | response.setId("0"); 290 | response.setName(fileName); 291 | response.setStatus("Download completed successfully"); 292 | response.setDescription("Firmware update on Dell PowerEdge Server required a catalog file"); 293 | 294 | } catch (Exception exp) { 295 | logger.error(exp.toString()); 296 | RuntimeCoreException runExp = new RuntimeCoreException(exp); 297 | throw runExp; 298 | } 299 | 300 | return response; 301 | } 302 | 303 | /* 304 | * API for execuring the firmware update on target server 305 | */ 306 | @Override 307 | public List updateFirmware(@RequestBody UpdateRequest request) { 308 | logger.info("FirmwareUpdate Controller - update(.....) starts"); 309 | 310 | List jobStatusList = new ArrayList<>(); 311 | 312 | if (request == null) { 313 | InvalidArgumentsException exp = new InvalidArgumentsException("request"); 314 | throw exp; 315 | } 316 | 317 | try { 318 | 319 | Credentials cred = new Credentials(); 320 | cred.setAddress(request.getServerAddress()); 321 | cred.setUserName(request.getUserName()); 322 | cred.setPassword(request.getPassword()); 323 | 324 | List jobs = firmwareService.updateFirmware(cred, request); 325 | jobs.forEach(item -> { 326 | JobStatus status = new JobStatus(); 327 | status.setServerAddress(request.getServerAddress()); 328 | status.setJobId(item); 329 | jobStatusList.add(status); 330 | }); 331 | 332 | if (request.getCallBack() != null && request.getCallBack().getCallbackUri() != null) { 333 | firmwareService.updateFirmwareViaCallback(cred, request, jobs); 334 | 335 | } 336 | 337 | } catch (Exception exp) { 338 | logger.error(exp.toString()); 339 | RuntimeCoreException runExp = new RuntimeCoreException(exp); 340 | throw runExp; 341 | } 342 | 343 | logger.info("FirmwareUpdate Controller - update(.....) ends "); 344 | 345 | return jobStatusList; 346 | 347 | } 348 | 349 | /* 350 | * (non-Javadoc) Test method for CallBack funtions 351 | * 352 | */ 353 | @Override 354 | public int updateFirmwareTest(@RequestBody CallBackResponse request) { 355 | 356 | logger.info("test REST API called succesfully {} ", request.getData()); 357 | 358 | return 0; 359 | } 360 | 361 | @Override 362 | public List getJobStatus(@RequestBody JobStatusRequest request) { 363 | 364 | if (request == null) { 365 | InvalidArgumentsException exp = new InvalidArgumentsException("request"); 366 | throw exp; 367 | } else if (isInvalid(request.getServerAddress())) { 368 | InvalidArgumentsException exp = new InvalidArgumentsException("serverAddress"); 369 | throw exp; 370 | } else if (isInvalid(request.getUserName())) { 371 | InvalidArgumentsException exp = new InvalidArgumentsException("userName"); 372 | throw exp; 373 | } else if (isInvalid(request.getPassword())) { 374 | InvalidArgumentsException exp = new InvalidArgumentsException("password"); 375 | throw exp; 376 | } 377 | 378 | try { 379 | 380 | Credentials cred = new Credentials(); 381 | cred.setUserName(request.getUserName()); 382 | cred.setPassword(request.getPassword()); 383 | cred.setAddress(request.getServerAddress()); 384 | return firmwareService.getJobStatus(request.getJobs(), cred); 385 | } catch (Exception exp) { 386 | logger.error(exp.toString()); 387 | RuntimeCoreException runExp = new RuntimeCoreException(exp); 388 | throw runExp; 389 | } 390 | 391 | } 392 | 393 | @Override 394 | public List singleFirmwareUpdate(@RequestBody DupRequest request) { 395 | logger.info("firmware update controller - singleFirmwareUpdate()"); 396 | 397 | if (request == null) { 398 | InvalidArgumentsException exp = new InvalidArgumentsException("request"); 399 | throw exp; 400 | } else if (isInvalid(request.getServerAddress())) { 401 | InvalidArgumentsException exp = new InvalidArgumentsException("serverAddress"); 402 | throw exp; 403 | } else if (isInvalid(request.getComponentId())) { 404 | InvalidArgumentsException exp = new InvalidArgumentsException("componentId"); 405 | throw exp; 406 | } else if (isInvalid(request.getFileName())) { 407 | InvalidArgumentsException exp = new InvalidArgumentsException("fileName"); 408 | throw exp; 409 | } else if (isInvalid(request.getPath())) { 410 | InvalidArgumentsException exp = new InvalidArgumentsException("path"); 411 | throw exp; 412 | } else if (isInvalid(request.getUserName())){ 413 | InvalidArgumentsException exp = new InvalidArgumentsException("userName"); 414 | throw exp; 415 | 416 | } else if (isInvalid(request.getPassword())){ 417 | InvalidArgumentsException exp = new InvalidArgumentsException("Password"); 418 | throw exp; 419 | 420 | } 421 | 422 | Credentials cred = new Credentials(); 423 | cred.setAddress(request.getServerAddress()); 424 | cred.setUserName(request.getUserName()); 425 | cred.setPassword(request.getPassword()); 426 | 427 | try { 428 | return firmwareService.updateDupFirmware(request.getServerAddress(), request.getComponentId(), 429 | request.getPath(), request.getFileName(), cred); 430 | 431 | } catch (Exception exp) { 432 | logger.error(exp.toString()); 433 | RuntimeCoreException runExp = new RuntimeCoreException(exp); 434 | throw runExp; 435 | } 436 | } 437 | 438 | private boolean isInvalid(String data) { 439 | 440 | return data == null || data.isEmpty(); 441 | } 442 | 443 | } 444 | --------------------------------------------------------------------------------