Enable VLAN for ipmitool

```
Currently creating VLAN using ipmitool was failing with error
"LAN parameter failed"
Analyzed and identified 3 issues
1) using command "ipmitool lan set 1 vlan id 2" not able to create
the vlan interface
2) After creating VLAN from ipmitool, ip address getting lost for
ethernet interface eth0 and not able to reach BMC.
3) while checking interface name is part of the network path
"/xyz/openbmc_project/network" it is observed the it is returning
false if the path contains VLAN interface
"/xyz/openbmc_project/network/eth0_2".

Code was only checking for the '/' after
"/xyz/openbmc_project/network/eth0" since this was older
implementation where VLAN is part of ethernet interface eth0.

Solution : It is found that before creating the vlan the
 "deconfigureChannel" API does thwo things
1) delete dbus Object If Exists 2) Reset the DHCP ip address for
parent ethernet interface e.g. eth0

For issue 1) it is found there are read only dbus path getting
created e.g. /xyz/openbmc_project/network/eth0/_310_2e0_2e2_2e15_2f24
while each ethernet interface is created here basically
_310_2e0_2e2_2e15_2f24 translates to the IP address
10.0.2.15 with a subnet mask of 24.
these paths can't be deleted and while deleting these paths
exception thrown.
To fix this, I have added to check if the exception of type
"xyz.openbmc_project.Common.Error.NotAllowed"
then not to throw further exception
For issue 2) I am keeping local copy of the params before creating
VLAN and applying the settings again after creating the VLAN
so that all the configurations of eth0 are restored.

for issue 3)  Added code to handle the VLAN path
"/xyz/openbmc_project/network/eth0_2" by adding check for '' after
path /xyz/openbmc_project/network/eth0 to inform that VLAN interface
starts after

Testing :

root@:~# ipmitool lan set 1 vlan id 2

root@:~# ifconfig
eth0      Link encap:Ethernet  HWaddr 86:82:68:B8:2F:5C
          inet addr:IP  Bcast:IP  Mask:255.255.255.0
          inet6 addr: fe80::8482:68ff:feb8:2f5c/64 Scope:Link
          inet6 addr: fec0::8482:68ff:feb8:2f5c/64 Scope:Site
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:763 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1329 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:94059 (91.8 KiB)  TX bytes:1366477 (1.3 MiB)
          Interrupt:38

eth0.2    Link encap:Ethernet  HWaddr 86:82:68:B8:2F:5C
          inet addr:169.254.86.79  Bcast:10.0.2.255 Mask:255.255.255.0
          inet6 addr: fe80::8482:68ff:feb8:2f5c/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:37 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:5178 (5.0 KiB)

#list vlan in ethernet interface
url -k -u root:0penBmc  -X GET https://BMCIP/redfish/v1/Managers/bmc/EthernetInterfaces
{
  "@odata.id": "/redfish/v1/Managers/bmc/EthernetInterfaces",
  "@odata.type": "#EthernetInterfaceCollection.EthernetInter
faceCollection",
  "Description": "Collection of EthernetInterfaces for this Manager",
  "Members": [
    {
      "@odata.id": "/redfish/v1/Managers/bmc/EthernetInterfaces/eth0"
    },
    {
     "@odata.id": "/redfish/v1/Managers/bmc/EthernetInterfaces/eth0_2"
    }
  ],
  "Members@odata.count": 2,
  "Name": "Ethernet Network Interface Collection"
}

root@:~# ipmitool lan set 1 vlan id 2
IANA PEN registry open failed: No such file or directory
Failed to load entries from IANA PEN Registry

root@:~#
root@:~# ifconfig
eth0      Link encap:Ethernet  HWaddr DE:7F:3D:A4:94:CD
          inet addr:IP  Bcast:IP  Mask:255.255.255.0
          inet6 addr: fe80::dc7f:3dff:fea4:94cd/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:12 errors:0 dropped:0 overruns:0 frame:0
          TX packets:33 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:3086 (3.0 KiB)  TX bytes:3863 (3.7 KiB)
          Interrupt:38

eth0.2    Link encap:Ethernet  HWaddr DE:7F:3D:A4:94:CD
          inet6 addr: fe80::dc7f:3dff:fea4:94cd/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:90 (90.0 B)

root@:~# ipmitool lan set 1 vlan id off
IANA PEN registry open failed: No such file or directory
Failed to load entries from IANA PEN Registry
root@:~#
root@:~# ifconfig
eth0      Link encap:Ethernet  HWaddr DE:7F:3D:A4:94:CD
          inet6 addr: fec0::dc7f:3dff:fea4:94cd/64 Scope:Site
          inet6 addr: fe80::dc7f:3dff:fea4:94cd/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:14 errors:0 dropped:0 overruns:0 frame:0
          TX packets:69 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:3268 (3.1 KiB)  TX bytes:7576 (7.3 KiB)
          Interrupt:38
```

Change-Id: I5cf6c52451040ccbdf391daca070da72fc356bef
Signed-off-by: Chandramohan Harkude <chandramohan.harkude@gmail.com>
1 file changed
tree: 60c42ee1019448d8dc5694f9875dfb0ca7399272
  1. app/
  2. dbus-sdr/
  3. docs/
  4. include/
  5. libipmid/
  6. scripts/
  7. softoff/
  8. subprojects/
  9. test/
  10. transport/
  11. user_channel/
  12. xyz/
  13. .build.sh
  14. .clang-format
  15. .clang-tidy
  16. .gitignore
  17. .shellcheck
  18. .travis.yml
  19. apphandler.cpp
  20. apphandler.hpp
  21. chassishandler.cpp
  22. chassishandler.hpp
  23. dcmihandler.cpp
  24. dcmihandler.hpp
  25. error-HostEvent.hpp
  26. fruread.hpp
  27. generate_whitelist.sh
  28. generate_whitelist_create.sh
  29. globalhandler.cpp
  30. groupext.cpp
  31. host-cmd-manager.cpp
  32. host-cmd-manager.hpp
  33. host-interface.cpp
  34. host-interface.hpp
  35. host-ipmid-whitelist.conf
  36. ipmi_fru_info_area.cpp
  37. ipmi_fru_info_area.hpp
  38. ipmiallowlist.hpp
  39. ipmid-new.cpp
  40. ipmisensor.cpp
  41. LICENSE
  42. meson.build
  43. meson.options
  44. OWNERS
  45. read_fru_data.cpp
  46. read_fru_data.hpp
  47. README.md
  48. sbmrhandler.cpp
  49. selutility.cpp
  50. selutility.hpp
  51. sensordatahandler.cpp
  52. sensordatahandler.hpp
  53. sensorhandler.cpp
  54. sensorhandler.hpp
  55. settings.cpp
  56. settings.hpp
  57. storageaddsel.cpp
  58. storageaddsel.hpp
  59. storagehandler.cpp
  60. sys_info_param.cpp
  61. sys_info_param.hpp
  62. systemintfcmds.cpp
  63. systemintfcmds.hpp
  64. transportconstants.hpp
  65. transporthandler.cpp
  66. transporthandler.hpp
  67. whitelist-filter.cpp
README.md

phosphor-host-ipmid

Compile ipmid with default options

meson builddir
ninja -C builddir

Compile ipmid with yocto defaults

meson builddir -Dbuildtype=minsize -Db_lto=true -Dtests=disabled
ninja -C builddir

If any of the dependencies are not found on the host system during configuration, meson automatically gets them via its wrap dependencies mentioned in ipmid/subprojects.

Enable/Disable meson wrap feature

meson builddir -Dwrap_mode=nofallback
ninja -C builddir

Enable debug traces

meson builddir -Dbuildtype=debug
ninja -C builddir

Generate test coverage report

meson builddir -Db_coverage=true -Dtests=enabled
ninja -C builddir test
ninja -C builddir coverage