summaryrefslogtreecommitdiffstats
path: root/test/test_util.cpp
Commit message (Collapse)AuthorAgeFilesLines
* util: Use standard ether functions for conversionWilliam A. Kennington III2019-04-091-1/+1
| | | | | | | | This should be slightly faster and is more standard for interop with other programs using the same conversion functions. Change-Id: I4d7a2cb4df2173afda421c5b41ee5e98e722d6c6 Signed-off-by: William A. Kennington III <wak@google.com>
* util: Add a MacAddr population functionWilliam A. Kennington III2019-02-141-0/+13
| | | | | | | | | | | | This one is pretty trivial since there is only one size of mac address, but we want to be sure we validate the buffer. Tested: Built and runs through unit tests. Works when integrated into neighbor parsing code. Change-Id: Iaf58fc398b51a3bcbbf70968cbe353beeb7b9f54 Signed-off-by: William A. Kennington III <wak@google.com>
* util: Add InAddrAny population functionWilliam A. Kennington III2019-02-141-0/+24
| | | | | | | | | | | | We commonly want to be able to turn netlink network order address data into the corresponding InAddrAny when parsing netlink data. This makes it trivial given the address family and data buffer. Tested: Ran throgh unit tests and builds fine in a BMC image. Change-Id: I4ebe1dbd284f150ea03ee091cddda5a06806c01f Signed-off-by: William A. Kennington III <wak@google.com>
* util: Add a function for converting IP bytes to stringsWilliam A. Kennington III2019-02-141-0/+30
| | | | | | | | | | We need this for future work which turns netlink data into IP addresses. Tested: Run through unit tests. Change-Id: If078b28246509ca2ebd3bf7bab652b84258df0bd Signed-off-by: William A. Kennington III <wak@google.com>
* util: Add a function for converting MAC addressesWilliam A. Kennington III2019-02-141-0/+22
| | | | | | | | | | | We need to be able to convert a mac addresses from byte form into our typical human readable string form. Tested: Unit tests pass. Change-Id: I6e68cfefd4d5962e1125c1b5229e61fce475729a Signed-off-by: William A. Kennington III <wak@google.com>
* Re-enable unit testRatan Gupta2018-11-301-4/+7
| | | | | | | | | | | | Unit test were broken after sd bus calls started throwing exception, In this repo we start the systemd-networkd with the use of sd bus calls, which throws exception and it was not handled in the test case. This commit fixes the problem by mocking the network manager which mock the functionality of function which makes the sdbus call. Change-Id: I5b60a2117a661cffa36200415ca611b85dd2fda1 Signed-off-by: Ratan Gupta <ratagupt@linux.vnet.ibm.com>
* clang-format: Update to match docs repoGunnar Mills2018-09-151-29/+25
| | | | | | | | | Update the .clang-format file and run clang-format-6.0. This .clang-format matches the example one in https://github.com/openbmc/docs/blob/master/cpp-style-and-conventions.md#clang-formatting Change-Id: Ia331c9a5b040e1a3c45a0ebf1b8d776d93b05ae5 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
* reorder headersPatrick Venture2018-08-271-1/+0
| | | | | | | | | | | | | | | | | | Reordering all the headers to the following structure: header file: local c cpp (including openbmc libraries) source file: source.hpp (if applicable) local c cpp Change-Id: Ia74a5c761a3029819366159de3cfd40c5e4c4a2c Signed-off-by: Patrick Venture <venture@google.com>
* Added new unit testcasesNagaraju Goruganti2018-01-301-0/+83
| | | | | | | | | | 1. Added testcases to validate IP/PrefixLengnth/MACAddress. 2. Added test to rtnetlink. Resolves openbmc/openbmc#2546 Change-Id: I61efbf69682a50f7479b68e32d9714e9c81a32d7 Signed-off-by: Nagaraju Goruganti <ngorugan@in.ibm.com>
* IP Address use case validationNagaraju Goruganti2017-10-111-4/+13
| | | | | | | | | | | -validates IPAddress/gateway using inet_pton api. -validates prefix length for ipv4/ipv6. -if dhcp is enabled, it won't allow to set ip/gateway. Resolves openbmc/openbmc#1671 Change-Id: I76c1d9d11dfb59002eb1310d87e94ee622714a4a Signed-off-by: Nagaraju Goruganti <ngorugan@in.ibm.com>
* Fetch the network portion of the IP addressRatan Gupta2017-06-081-1/+23
| | | | | | | eg 192.168.2.24/24 ==> 192.168.2.0 Change-Id: I5e46ce7b371360c90ef74fac175c8379c6f31d4c Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
* test: Add unit test cases for utilRatan Gupta2017-06-081-0/+89
Change-Id: I75cc1c1642bd4160191853d6ebfa5427e7f534c3 Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
OpenPOWER on IntegriCloud