summaryrefslogtreecommitdiffstats
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* Use host state object to check if host is onLei YU2017-10-161-10/+10
| | | | | | | | | The code was using pgood to determine if host is on or off. Now we have host state object, which is a more appropriate way to check host on/off. So change pgood related code to use host state object. Change-Id: I553c1a40922ca2e8bc6904688c55e85971bd4720 Signed-off-by: Lei YU <mine260309@gmail.com>
* Let timedate1 to decide on setting time in NTP modeLei YU2017-10-161-5/+1
| | | | | | | | In NTP mode, let timedate1 to set BMC time, for now, it results in error. Change-Id: I2d78cdcfe6868642f43198dd932b20b13fd8523d Signed-off-by: Lei YU <mine260309@gmail.com>
* Use new settings APILei YU2017-10-161-11/+11
| | | | | | | | The new time manager code was using the old settings daemon. Now it uses the new settings API. Change-Id: Id551d97c28a6cfbb81c87118b26292b1b5574e93 Signed-off-by: Lei YU <mine260309@gmail.com>
* Use time mode owner enums in dbus interfaceLei YU2017-10-165-83/+124
| | | | | | | | | | | Dbus interface defines time mode owners in xyz::openbmc_project::Time. Use the enums from the interface instead of repo defined enums and use the generated code to do convertions between strings and enums. Update unit tests accordingly. Change-Id: Ic304aa3b4137375d208bb1702e0f64df512fc5a0 Signed-off-by: Lei YU <mine260309@gmail.com>
* Use elog to throw exceptionsLei YU2017-10-161-16/+16
| | | | | | | Use elog to throw exceptions and update unit tests Change-Id: I338ded4403b3b559a84da311eda5ee15e712569a Signed-off-by: Lei YU <mine260309@gmail.com>
* Change default time mode/owner to MANUAL/BOTHLei YU2017-10-163-6/+11
| | | | | | | | | | OPAL gets error on setting host time because the default time mode/owner is NTP/BMC, which disallows host to set its time. As discussed and requested by OPAL, change the default time mode/owner to MANUAL/BOTH. Change-Id: Ide55f970b66f3025f67ad2ef093a74a3c8f8b8ea Signed-off-by: Lei YU <mine260309@gmail.com>
* Implement mode/owner and string conversionsLei YU2017-10-163-37/+69
| | | | | | | | | | Move Manager::convertToMode() to utils::strToMode(); Move Manager::convertToOwner() to utils::strToOwner(); Add utils::modeToStr() and utils::ownerToStr(); Adjust and add unit tests. Change-Id: Ied35d0e732c477017e1b2db1a3464b0425b12387 Signed-off-by: Lei YU <mine260309@gmail.com>
* Use gmock on property_change_listenerLei YU2017-10-162-9/+98
| | | | | | | | | | | | | 1. Mock property_change_listener; 2. Make unit test link against gmock 3. Update TestManager to use mocked property change listener. 4. Fix an issue found by the updated test case, that when the properties are changed during host is on, and changed back to the same as before, when host becomes off, the properties shall remain the same and listeners shall not be notified. Change-Id: I815b59cb23edfcac910c2a8c26ea5a71e872d92f Signed-off-by: Lei YU <mine260309@gmail.com>
* Invoke SetNTP and UpdateUseNtpField in time managerLei YU2017-10-161-0/+3
| | | | | | | | | | | 1. When time mode is changed, invoke systemd timedate1's SetNTP method to update NTP settings; 2. When settings use_dhcp_ntp property is changed, invoke NetworkManager's UpdateUseNtpField method to update its setting; 3. Move the common code of getProperty() into utils.hpp Change-Id: I981e0e9de9c0430282b3364c38c282312bb2be89 Signed-off-by: Lei YU <mine260309@gmail.com>
* Implement HostEpoch set time logicLei YU2017-10-163-61/+235
| | | | | | | | | | | | | | | | | | | | | | | 1. When setting host epoch, follow below logic: Mode | Owner | Set Host Time ----- | ----- | ------------- NTP | BMC | Not allowed NTP | HOST | Not allowed NTP | SPLIT | OK, and just save offset NTP | BOTH | Not allowed MANUAL| BMC | Not allowed MANUAL| HOST | OK, and set time to BMC MANUAL| SPLIT | OK, and just save offset MANUAL| BOTH | OK, and set time to BMC 2. If owner is SPLIT and BMC time is changed, update the offset accordinly; 3. Use timerfd to get notified on BMC time change, and update host time diff accordingly; 4. Add unit test cases. Change-Id: I2d60a821f7da9b689c579ae7ab672cc37967322c Signed-off-by: Lei YU <mine260309@gmail.com>
* Save properties to persistent storage when host is onLei YU2017-10-162-13/+68
| | | | | | | | | | | | 1. When host is on, set properties as requested properties instead of notify listeners; 2. When host becomes off, and requested properties are not empty, notify the listners and reset the requested properties. Add unit tests. Change-Id: I9359c801c698df0c6e5eab43e12427bb5a6da611 Signed-off-by: Lei YU <mine260309@gmail.com>
* Add time Manager to handle property changes callbackLei YU2017-10-155-32/+101
| | | | | | | | | | 1. Implement time::Manager who registers property change signal for time mode and owner; 2. Add PropertyChangeListner interface to handle the callback; 3. Make EpochBase to implement the interface. Change-Id: I185580ae37353e1ed82a47e4905fb22e269ac09d Signed-off-by: Lei YU <mine260309@gmail.com>
* Initial implementation of HostEpochLei YU2017-08-012-1/+175
| | | | | | | | | | | | When host time is set, the diff between the BmcTime and the value is saved to persistent storage; When host time is retrieved, return the BmcTime plus the diff as host's time. Add the unit test cases for HostEpoch. Change-Id: Ia55b93bfcba4f226ceaed8491136ea7afda7bd77 Signed-off-by: Lei YU <mine260309@gmail.com>
* Implement BmcEpoch set/get elapsed()Lei YU2017-08-011-0/+30
| | | | | | | | | | | Getting elapsed returns BMC's time; Setting elapsed will check the current time mode/owner, and will return error when mode is NTP or owner is HOST. Add unit test cases. Change-Id: Ibf4e90957f3b26b68c4a1b6dc66dc364c66bef10 Signed-off-by: Lei YU <mine260309@gmail.com>
* Implement part of BmcEpochLei YU2017-08-012-1/+57
| | | | | | | | | | Add BmcEpoch which inherits EpochBase and will handle times for BMC, it is partly implemented. Add unit test cases to test basic functions. Change-Id: Ia5e4d0f884156d238f3f84df490a2efbce43e89a Signed-off-by: Lei YU <mine260309@gmail.com>
* Intialize new phosphor-time-managerLei YU2017-08-012-0/+90
phosphor-time-manager will be refactored to use sdbusplus interfaces. This is a initial commit that EpochBase is implemented based on dbus interface xyz/openbmc_project/Time/EpochTime.interface.yaml. EpochBase is the base class that wraps EpochTime interface, and is initialized with time mode and owner from settingsd. An initial unit test case is added. Change-Id: Ic944b70f63ec3c0329762cc8874f0f57b09ddce3 Signed-off-by: Lei YU <mine260309@gmail.com>
OpenPOWER on IntegriCloud