1# Network Management
2
3## Overview
4
5A Network Manager is a daemon which handles network management operations. It
6must implement the `xyz.openbmc_project.Network.SystemConfiguration.interface`
7and `org.freedesktop.DBus.ObjectManager`.
8
9When the network manager daemon comes up, it should create objects implementing
10physical link/virtual interfaces such as
11`xyz.openbmc_project.Network.EthernetInterface` or
12`xyz.openbmc_project.Network.VLANInterface` on the system.
13
14IP address(v4 and v6) objects must be children objects of the physical/virtual
15interface object.
16
17## Interfaces
18
191. SystemConfiguration: This describes the system-specific parameters.
202. EthernetInterface: This describes the interface-specific parameters.
213. IP: This describes the IP address-specific parameters.
224. IPProtocol: This describes the IP protocol type (IPv4/IPv6).
235. VLANInterface: This describes the VLAN-specific properties.
246. Bond: This describes the interface bonding parameters.
25
26## DbusObjects
27
28### Interface Objects
29
30Interface objects can be physical as well as virtual.
31
32If the object is a physical interface, it can't be deleted, but if it is a
33virtual interface object it can be deleted.
34
35Example: `/xyz/openbmc_project/network/eth0`
36
37### IPAddress Objects
38
39There can be multiple IP address objects under an interface object. These
40objects can be deleted by the delete function.
41
42IPv4 objects will have the following D-Bus object path.
43
44Example: `/xyz/openbmc_project/network/eth0/ipv4/3fd41d13/`
45
46IPv6 objects will have the following D-Bus object path.
47
48Example: `/xyz/openbmc_project/network/eth0/ipv6/5dfghilp/`
49
50### Conf Object
51
52This object will have the system configuration related parameters.
53
54Example: `/xyz/openbmc_project/network/conf`
55
56## UseCases
57
58### Configure IP address
59
60```sh
61busctl call xyz.openbmc_project.Network /xyz/openbmc_project/network/<interface>
62xyz.openbmc_project.Network.IP.Create IP ssys
63"xyz.openbmc_project.Network.IP.Protocol.IPv4" "<ip>" <subnetmask>
64"<networkgateway>"
65
66curl -c cjar -b cjar -k -H "Content-Type: application/json" -X POST -d
67'{"data":["xyz.openbmc_project.Network.IP.Protocol.IPv4","<ip>",<subnetmask>,"<networkGateway>"]
68}' https://<hostname/ip>/xyz/openbmc_project/network/eth0/action/IP
69```
70
71### Configure Default Gateway
72
73#### Get
74
75```sh
76busctl get-property xyz.openbmc_project.Network
77/xyz/openbmc_project/network/config
78xyz.openbmc_project.Network.SystemConfiguration DefaultGateway
79
80curl -c cjar -b cjar -k -H "Content-Type: application/json" -X GET
81https://<hostname/ip>/xyz/openbmc_project/network/config/attr/DefaultGateway
82```
83
84#### Set
85
86```sh
87busctl set-property xyz.openbmc_project.Network
88/xyz/openbmc_project/network/config
89xyz.openbmc_project.Network.SystemConfiguration DefaultGateway s
90"<DefaultGateway>"
91
92curl -c cjar -b cjar -k -H "Content-Type: application/json" -X PUT -d '{"data":
93"x.x.x.x"}'
94https://<hostname/ip>/xyz/openbmc_project/network/config/attr/DefaultGateway
95```
96
97NOTE: Since the system does not allow unpingable gateway address, make sure the
98gateway address is pingable.
99
100### Configure HostName
101
102#### Get
103
104```sh
105busctl get-property xyz.openbmc_project.Network
106/xyz/openbmc_project/network/config
107xyz.openbmc_project.Network.SystemConfiguration HostName
108
109curl -c cjar -b cjar -k -H "Content-Type: application/json" -X GET
110https://<hostname/ip>/xyz/openbmc_project/network/config/attr/HostName
111```
112
113#### Set
114
115```sh
116busctl set-property xyz.openbmc_project.Network
117/xyz/openbmc_project/network/config
118xyz.openbmc_project.Network.SystemConfiguration HostName s "<HostName>"
119
120curl -c cjar -b cjar -k -H "Content-Type: application/json" -X PUT -d '{"data":
121"<hostname>"}'
122https://<hostname/ip>/xyz/openbmc_project/network/config/attr/HostName
123```
124
125### Delete IP address
126
127```sh
128busctl call xyz.openbmc_project.Network
129/xyz/openbmc_project/network/<interface>/ipv4/<id>
130xyz.openbmc_project.Object.Delete Delete
131```
132
133NOTE: How to get the ipv4/id: After creating the IP address object enumerate the
134network interface object.
135
136```sh
137curl -c cjar -b cjar -k -H "Content-Type: application/json" -X DELETE
138https://<hostname/ip>/xyz/openbmc_project/network/eth0/ipv4/fbfc29b
139```
140
141### Configure DHCP
142
143#### Get
144
145```sh
146busctl get-property xyz.openbmc_project.Network
147/xyz/openbmc_project/network/eth0 xyz.openbmc_project.Network.EthernetInterface
148DHCPEnabled
149
150curl -c cjar -b cjar -k -H "Content-Type: application/json" -X GET
151https://<hostname/ip>/xyz/openbmc_project/network/eth0/attr/DHCPEnabled
152```
153
154#### Set
155
156```sh
157busctl set-property xyz.openbmc_project.Network
158/xyz/openbmc_project/network/eth0 xyz.openbmc_project.Network.EthernetInterface
159DHCPEnabled b 1
160
161curl -c cjar -b cjar -k -H "Content-Type: application/json" -X PUT -d '{"data":
1621}' https://<hostname/ip>/xyz/openbmc_project/network/eth0/attr/DHCPEnabled
163```
164
165### Configure MACAddress
166
167#### Get
168
169```sh
170busctl get-property xyz.openbmc_project.Network
171/xyz/openbmc_project/network/eth0 xyz.openbmc_project.Network.MACAddress
172MACAddress
173
174curl -c cjar -b cjar -k -H "Content-Type: application/json" -X GET
175https://<hostname/ip>/xyz/openbmc_project/network/eth0/attr/MACAddress
176```
177
178#### Set
179
180NOTE: MAC address should be LOCAL ADMIN MAC (2nd bit of first byte should be
181on).
182
183```sh
184busctl set-property xyz.openbmc_project.Network
185/xyz/openbmc_project/network/eth0 xyz.openbmc_project.Network.MACAddress
186MACAddress s "XX:XX:XX:XX:XX:XX"
187
188curl -c cjar -b cjar -k -H "Content-Type: application/jon" -X PUT -d '{"data":
189"XX:XX:XX:XX:XX:XX" }'
190https://<hostname/ip>/xyz/openbmc_project/network/eth0/attr/MACAddress
191```
192
193### Network factory reset
194
195```sh
196busctl call xyz.openbmc_project.Network /xyz/openbmc_project/network
197xyz.openbmc_project.Common.FactoryReset Reset
198
199curl -c cjar -b cjar -k -H "Content-Type: application/json" -X POST -d
200'{"data":[] }' https://<hostname/ip>/xyz/openbmc_project/network/action/Reset
201```
202
203### VLAN
204
205#### Create
206
207```sh
208curl -c cjar -b cjar -k -H "Content-Type: application/json" -X POST -d
209'{"data":["eth0",50] }'
210https://<hostname/ip>/xyz/openbmc_project/network/action/VLAN
211```
212
213#### Delete
214
215```sh
216curl -c cjar -b cjar -k -H "Content-Type: application/json" -X DELETE
217https://<hostname/ip>/xyz/openbmc_project/network/eth0_50
218
219busctl call xyz.openbmc_project.Network /xyz/openbmc_project/network/eth0_50
220xyz.openbmc_project.Object.Delete Delete
221```
222
223#### Enumerate
224
225```sh
226curl -c cjar -b cjar -k -H "Content-Type: application/json" -X GET
227https://<hostname/ip>/xyz/openbmc_project/network/eth0_50/enumerate
228```
229
230#### Configure IP on VLAN Interface
231
232Please refer to the "Configure IP address" section.
233