common: fix: add emit_added calls

Add these calls to make bmcweb and mapper aware of our DBus interfaces.

Adding emit_added() should be safe to do since the interface already
exists and the function is idempotent.

Also set the activation status of the current software version to
'Active' after 'initDevice' returns.

Tested: on Tyan S8030

Restarting BIOS sw manager without this patch yields

```
{
  "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/HostSPIFlash_7868",
  "@odata.type": "#SoftwareInventory.v1_1_0.SoftwareInventory",
  "Description": "Unknown image",
  "Id": "HostSPIFlash_7868",
  "Name": "Software Inventory",
  "Status": {
    "Health": "Warning",
    "HealthRollup": "OK",
    "State": "Disabled"
  },
  "Updateable": true,
  "Version": "Unknown"
}
```

which is wrong since there is currently a sw version enabled.

First testing update process without this patch

```
curl -k --insecure --user root:root -H Content-Type:multipart/form-data -X POST -F 'UpdateParameters={"Targets":["/redfish/v1/UpdateService/FirmwareInventory/HostSPIFlash_7868"],"@Redfish.OperationApplyTime":"Immediate"};type=application/json' -F 'UpdateFile=@pldm-package-s8030-host-v4.01.bin;type=application/octet-stream' https://${bmc}/redfish/v1/UpdateService/update-multipart
```

yields

```
{
  "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/HostSPIFlash_5637",
  "@odata.type": "#SoftwareInventory.v1_1_0.SoftwareInventory",
  "Description": "Unknown image",
  "Id": "HostSPIFlash_5637",
  "Name": "Software Inventory",
  "Status": {
    "Health": "OK",
    "HealthRollup": "OK",
    "State": "Enabled"
  },
  "Updateable": true,
  "Version": "mycompversion"
}
```

BIOS update process completes and bmcweb shows fw inventory as expected

Starting the update process (with this patch):
```
curl -k --insecure --user root:root -H Content-Type:multipart/form-data -X POST -F 'UpdateParameters={"Targets":["/redfish/v1/UpdateService/FirmwareInventory/HostSPIFlash_8460"],"@Redfish.OperationApplyTime":"Immediate"};type=application/json' -F 'UpdateFile=@pldm-package-s8030-host-v4.01.bin;type=application/octet-stream' https://${bmc}/redfish/v1/UpdateService/update-multipart
```

Task returned from starting update process
```
{
  "@odata.id": "/redfish/v1/TaskService/Tasks/2",
  "@odata.type": "#Task.v1_4_3.Task",
  "Id": "2",
  "TaskState": "Running",
  "TaskStatus": "OK"
}
```

After update:
```
curl --insecure --user root:root https://${bmc}/redfish/v1/UpdateService/FirmwareInventory/HostSPIFlash_918
```

```
{
  "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/HostSPIFlash_918",
  "@odata.type": "#SoftwareInventory.v1_1_0.SoftwareInventory",
  "Description": "Unknown image",
  "Id": "HostSPIFlash_918",
  "Name": "Software Inventory",
  "Status": {
    "Health": "OK",
    "HealthRollup": "OK",
    "State": "Enabled"
  },
  "Updateable": true,
  "Version": "mycompversion"
}
```

So we concluded that the fw inventory is correct even without the patch
but on initial start of the BIOS sw manager the fw inventory is not
correct.

After restarting the BIOS sw manager with this patch:

```
{
  "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/HostSPIFlash_2291",
  "@odata.type": "#SoftwareInventory.v1_1_0.SoftwareInventory",
  "Description": "Unknown image",
  "Id": "HostSPIFlash_2291",
  "Name": "Software Inventory",
  "Status": {
    "Health": "OK",
    "HealthRollup": "OK",
    "State": "Enabled"
  },
  "Updateable": true,
  "Version": "Unknown"
}
```

Change-Id: I3aee245311b30e1ceba50d16598f940bb87626b0
Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>
3 files changed
tree: e533827dc0dd1b22d58afbd1c8bb50093a09e2ee
  1. bios/
  2. bmc/
  3. common/
  4. cpld/
  5. eeprom-device/
  6. i2c-vr/
  7. subprojects/
  8. test/
  9. .clang-format
  10. .clang-tidy
  11. .gitignore
  12. .shellcheck
  13. LICENSE
  14. meson.build
  15. meson.options
  16. OWNERS
  17. README.md
README.md

phosphor-bmc-code-mgmt

Phosphor BMC Code Management provides a set of system software management applications. More information can be found at Software Architecture

To Build

To build this package, do the following steps:

  1. meson build
  2. ninja -C build

To clean the repository run rm -r build.