| commit | 9fa0335da0674ed463dcaba9971b55d0073160db | [log] [tgz] |
|---|---|---|
| author | Chandramohan83 <Chandramohan.harkude@gmail.com> | Fri Aug 16 22:47:56 2024 +0530 |
| committer | Chandra Harkude <Chandramohan.harkude@gmail.com> | Mon May 19 06:15:40 2025 +0000 |
| tree | 60c42ee1019448d8dc5694f9875dfb0ca7399272 | |
| parent | 920602f5f89b7aeeb7fd31dc77c768f1149cc1f2 [diff] |
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>
meson builddir ninja -C builddir
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.
meson builddir -Dwrap_mode=nofallback ninja -C builddir
meson builddir -Dbuildtype=debug ninja -C builddir
meson builddir -Db_coverage=true -Dtests=enabled ninja -C builddir test ninja -C builddir coverage