xref: /openbmc/phosphor-dbus-interfaces/yaml/xyz/openbmc_project/Network/README.md (revision a1347418307d31a94bd21f22897aa508df938dcf)
1b1b4d261SWilliam A. Kennington III# Network Management
2b1b4d261SWilliam A. Kennington III
3b1b4d261SWilliam A. Kennington III## Overview
4b1b4d261SWilliam A. Kennington III
5*a1347418SPatrick WilliamsA Network Manager is a daemon which handles network management operations. It
6*a1347418SPatrick Williamsmust implement the `xyz.openbmc_project.Network.SystemConfiguration.interface`
7*a1347418SPatrick Williamsand `org.freedesktop.DBus.ObjectManager`.
8b1b4d261SWilliam A. Kennington III
9*a1347418SPatrick WilliamsWhen the network manager daemon comes up, it should create objects implementing
10*a1347418SPatrick Williamsphysical link/virtual interfaces such as
11b1b4d261SWilliam A. Kennington III`xyz.openbmc_project.Network.EthernetInterface` or
12b1b4d261SWilliam A. Kennington III`xyz.openbmc_project.Network.VLANInterface` on the system.
13b1b4d261SWilliam A. Kennington III
14*a1347418SPatrick WilliamsIP address(v4 and v6) objects must be children objects of the physical/virtual
15*a1347418SPatrick Williamsinterface object.
16b1b4d261SWilliam A. Kennington III
17b1b4d261SWilliam A. Kennington III## Interfaces
18b1b4d261SWilliam A. Kennington III
19b1b4d261SWilliam A. Kennington III1. SystemConfiguration: This describes the system-specific parameters.
20b1b4d261SWilliam A. Kennington III2. EthernetInterface: This describes the interface specific parameters.
21b1b4d261SWilliam A. Kennington III3. IP: This describes the IP address specific parameters.
22b1b4d261SWilliam A. Kennington III4. IPProtocol: This describes the IP protocol type(IPv4/IPv6).
23b1b4d261SWilliam A. Kennington III5. VLANInterface: This describes the VLAN specific properties.
24b1b4d261SWilliam A. Kennington III6. Bond: This describes the interface bonding parameters.
25b1b4d261SWilliam A. Kennington III
26b1b4d261SWilliam A. Kennington III## D-Bus Objects
27b1b4d261SWilliam A. Kennington III
28388b58f9SPatrick Williams### Interface Objects
29b1b4d261SWilliam A. Kennington III
30b1b4d261SWilliam A. Kennington IIIInterface objects can be physical as well as virtual.
31b1b4d261SWilliam A. Kennington III
32*a1347418SPatrick WilliamsIf the object is a physical interface, it can't be deleted, but if it is a
33*a1347418SPatrick Williamsvirtual interface object it can be deleted.
34b1b4d261SWilliam A. Kennington III
35b1b4d261SWilliam A. Kennington IIIE.g. `/xyz/openbmc_project/network/<interfacename>`
36b1b4d261SWilliam A. Kennington III
37388b58f9SPatrick Williams### IP Address Objects
38b1b4d261SWilliam A. Kennington III
39*a1347418SPatrick WilliamsThere can be multiple IP address objects under an interface object. These
40*a1347418SPatrick Williamsobjects can be deleted by the delete function.
41b1b4d261SWilliam A. Kennington III
42b1b4d261SWilliam A. Kennington IIIIPv4 objects will have the following D-Bus object path:
43b1b4d261SWilliam A. Kennington III
44b1b4d261SWilliam A. Kennington III`/xyz/openbmc_project/network/<interface>/ipv4/<id>`
45b1b4d261SWilliam A. Kennington III
46b1b4d261SWilliam A. Kennington IIIIPv6 objects will have the following D-Bus object path:
47b1b4d261SWilliam A. Kennington III
48b1b4d261SWilliam A. Kennington III`/xyz/openbmc_project/network/<interface>/ipv6/<id>`
49b1b4d261SWilliam A. Kennington III
50388b58f9SPatrick Williams### Network Configuration Object
51b1b4d261SWilliam A. Kennington III
52b1b4d261SWilliam A. Kennington IIIThe network configuration object will have system configuration parameters:
53b1b4d261SWilliam A. Kennington III
54b1b4d261SWilliam A. Kennington III`/xyz/openbmc_project/network/conf`
55b1b4d261SWilliam A. Kennington III
56b1b4d261SWilliam A. Kennington III## Commands
57b1b4d261SWilliam A. Kennington III
58388b58f9SPatrick Williams### Create Static IPv4 Address
59b1b4d261SWilliam A. Kennington III
60388b58f9SPatrick Williams```sh
61388b58f9SPatrick Williamsbusctl call xyz.openbmc_project.Network \
62388b58f9SPatrick Williams    /xyz/openbmc_project/network/<interface> \
63388b58f9SPatrick Williams    xyz.openbmc_project.Network.IP.Create \
64388b58f9SPatrick Williams    IP ssys "xyz.openbmc_project.Network.IP.Protocol.IPv4" \
65388b58f9SPatrick Williams    "<IP Address>" <Netmask Prefix> "<Network Gateway>"
66b1b4d261SWilliam A. Kennington III```
67388b58f9SPatrick Williams
68388b58f9SPatrick Williams```sh
69388b58f9SPatrick Williamscurl -c cjar -b cjar -k -H "Content-Type: application/json" -X  POST \
70388b58f9SPatrick Williams    -d '{
71388b58f9SPatrick Williams            "data": [
72388b58f9SPatrick Williams                "xyz.openbmc_project.Network.IP.Protocol.IPv4",
73388b58f9SPatrick Williams                "<IP Address",
74388b58f9SPatrick Williams                <Netmask Prefix>,
75388b58f9SPatrick Williams                "<Network Gateway>"
76388b58f9SPatrick Williams            ]
77388b58f9SPatrick Williams        }' \
78388b58f9SPatrick Williams    https://${bmc}/xyz/openbmc_project/network/<interface>/action/IP
79b1b4d261SWilliam A. Kennington III```
80b1b4d261SWilliam A. Kennington III
81b1b4d261SWilliam A. Kennington IIIE.g.
82388b58f9SPatrick Williams
83388b58f9SPatrick Williams```sh
84388b58f9SPatrick Williamscurl -c cjar -b cjar -k -H "Content-Type: application/json" -X POST \
85388b58f9SPatrick Williams    -d '{
86388b58f9SPatrick Williams            "data": [
87388b58f9SPatrick Williams                "xyz.openbmc_project.Network.IP.Protocol.IPv4",
88388b58f9SPatrick Williams                "8.8.8.8",
89388b58f9SPatrick Williams                24,
90388b58f9SPatrick Williams                "8.8.8.0"
91388b58f9SPatrick Williams            ]
92388b58f9SPatrick Williams        }' \
93388b58f9SPatrick Williams    https://${bmc}/xyz/openbmc_project/network/eth0/action/IP
94b1b4d261SWilliam A. Kennington III```
95b1b4d261SWilliam A. Kennington III
96388b58f9SPatrick WilliamsNote: After creating the IP address object enumerate the network interface
97388b58f9SPatrick Williamsobject to get the IPv4 id.
98b1b4d261SWilliam A. Kennington III
99388b58f9SPatrick Williams### Delete IPv4 Address
100b1b4d261SWilliam A. Kennington III
101388b58f9SPatrick Williams```sh
102388b58f9SPatrick Williamsbusctl call xyz.openbmc_project.Network \
103388b58f9SPatrick Williams    /xyz/openbmc_project/network/<interface>/ipv4/<id> \
104388b58f9SPatrick Williams    xyz.openbmc_project.Object.Delete Delete
105b1b4d261SWilliam A. Kennington III```
106b1b4d261SWilliam A. Kennington III
107388b58f9SPatrick Williams```sh
108388b58f9SPatrick Williamscurl -c cjar -b cjar -k -H "Content-Type: application/json" -X DELETE \
109388b58f9SPatrick Williams    https://${bmc}/xyz/openbmc_project/network/<interface>/ipv4/<id>
110b1b4d261SWilliam A. Kennington III```
111b1b4d261SWilliam A. Kennington III
112388b58f9SPatrick Williams### Default Gateway
113b1b4d261SWilliam A. Kennington III
114388b58f9SPatrick Williams#### Get
115388b58f9SPatrick Williams
116388b58f9SPatrick Williams```sh
117388b58f9SPatrick Williamsbusctl get-property xyz.openbmc_project.Network \
118388b58f9SPatrick Williams    /xyz/openbmc_project/network/config \
119388b58f9SPatrick Williams    xyz.openbmc_project.Network.SystemConfiguration DefaultGateway
120b1b4d261SWilliam A. Kennington III```
121388b58f9SPatrick Williams
122388b58f9SPatrick Williams```sh
123388b58f9SPatrick Williamscurl -c cjar -b cjar -k -H "Content-Type: application/json" \
124388b58f9SPatrick Williams    https://${bmc}/xyz/openbmc_project/network/config/attr/DefaultGateway
125b1b4d261SWilliam A. Kennington III```
126388b58f9SPatrick Williams
127388b58f9SPatrick Williams#### Set
128388b58f9SPatrick Williams
129388b58f9SPatrick Williams```sh
130388b58f9SPatrick Williamsbusctl set-property xyz.openbmc_project.Network \
131388b58f9SPatrick Williams    /xyz/openbmc_project/network/config \
132388b58f9SPatrick Williams    xyz.openbmc_project.Network.SystemConfiguration \
133388b58f9SPatrick Williams    DefaultGateway s "<DefaultGateway>"
134b1b4d261SWilliam A. Kennington III```
135388b58f9SPatrick Williams
136388b58f9SPatrick Williams```sh
137388b58f9SPatrick Williamscurl -c cjar -b cjar -k -H "Content-Type: application/json" -X PUT \
138388b58f9SPatrick Williams    -d '{"data": "<DefaultGateway>"}' \
139388b58f9SPatrick Williams    https://${bmc}/xyz/openbmc_project/network/config/attr/DefaultGateway
140b1b4d261SWilliam A. Kennington III```
141b1b4d261SWilliam A. Kennington III
142b1b4d261SWilliam A. Kennington IIINOTE: The default gateway must be pingable, if not 0.0.0.0 will be used.
143b1b4d261SWilliam A. Kennington III
144388b58f9SPatrick Williams### HostName
145b1b4d261SWilliam A. Kennington III
146388b58f9SPatrick Williams#### Get
147b1b4d261SWilliam A. Kennington III
148388b58f9SPatrick Williams```sh
149388b58f9SPatrick Williamsbusctl get-property xyz.openbmc_project.Network \
150388b58f9SPatrick Williams    /xyz/openbmc_project/network/config \
151388b58f9SPatrick Williams    xyz.openbmc_project.Network.SystemConfiguration HostName
152b1b4d261SWilliam A. Kennington III```
153b1b4d261SWilliam A. Kennington III
154388b58f9SPatrick Williams```sh
155388b58f9SPatrick Williamscurl -c cjar -b cjar -k -H "Content-Type: application/json" \
156388b58f9SPatrick Williams    https://${bmc}/xyz/openbmc_project/network/config/attr/HostName
157b1b4d261SWilliam A. Kennington III```
158b1b4d261SWilliam A. Kennington III
159388b58f9SPatrick Williams#### Set
160b1b4d261SWilliam A. Kennington III
161388b58f9SPatrick Williams```sh
162388b58f9SPatrick Williamsbusctl set-property xyz.openbmc_project.Network \
163388b58f9SPatrick Williams    /xyz/openbmc_project/network/config \
164388b58f9SPatrick Williams    xyz.openbmc_project.Network.SystemConfiguration HostName s "<HostName>"
165b1b4d261SWilliam A. Kennington III```
166b1b4d261SWilliam A. Kennington III
167388b58f9SPatrick Williams```sh
168388b58f9SPatrick Williamscurl -c cjar -b cjar -k -H "Content-Type: application/json" -X PUT \
169388b58f9SPatrick Williams    -d '{"data": "<HostName>"}' \
170388b58f9SPatrick Williams    https://${bmc}/xyz/openbmc_project/network/config/attr/HostName
171b1b4d261SWilliam A. Kennington III```
172b1b4d261SWilliam A. Kennington III
173388b58f9SPatrick Williams### DHCP
174b1b4d261SWilliam A. Kennington III
175388b58f9SPatrick Williams#### Get
176b1b4d261SWilliam A. Kennington III
177388b58f9SPatrick Williams```sh
178388b58f9SPatrick Williamsbusctl get-property xyz.openbmc_project.Network \
179388b58f9SPatrick Williams    /xyz/openbmc_project/network/eth0 \
180388b58f9SPatrick Williams    xyz.openbmc_project.Network.EthernetInterface DHCPEnabled
181b1b4d261SWilliam A. Kennington III```
182b1b4d261SWilliam A. Kennington III
183388b58f9SPatrick Williams```sh
184388b58f9SPatrick Williamscurl -c cjar -b cjar -k -H "Content-Type: application/json" \
185388b58f9SPatrick Williams    https://${bmc}/xyz/openbmc_project/network/eth0/attr/DHCPEnabled
186b1b4d261SWilliam A. Kennington III```
187b1b4d261SWilliam A. Kennington III
188388b58f9SPatrick Williams#### Enable
189b1b4d261SWilliam A. Kennington III
190388b58f9SPatrick Williams```sh
191388b58f9SPatrick Williamsbusctl set-property xyz.openbmc_project.Network \
192388b58f9SPatrick Williams    /xyz/openbmc_project/network/eth0 \
193388b58f9SPatrick Williams    xyz.openbmc_project.Network.EthernetInterface DHCPEnabled b 1
194b1b4d261SWilliam A. Kennington III```
195b1b4d261SWilliam A. Kennington III
196388b58f9SPatrick Williams```sh
197388b58f9SPatrick Williamscurl -c cjar -b cjar -k -H "Content-Type: application/json" -X PUT \
198388b58f9SPatrick Williams    -d '{"data": 1}' \
199388b58f9SPatrick Williams    https://${bmc}/xyz/openbmc_project/network/eth0/attr/DHCPEnabled
200388b58f9SPatrick Williams```
201b1b4d261SWilliam A. Kennington III
202388b58f9SPatrick Williams### MAC Address
203b1b4d261SWilliam A. Kennington III
204388b58f9SPatrick Williams#### Get
205388b58f9SPatrick Williams
206388b58f9SPatrick Williams```sh
207388b58f9SPatrick Williamsbusctl get-property xyz.openbmc_project.Network \
208388b58f9SPatrick Williams    /xyz/openbmc_project/network/eth0 \
209388b58f9SPatrick Williams    xyz.openbmc_project.Network.MACAddress MACAddress
210b1b4d261SWilliam A. Kennington III```
211388b58f9SPatrick Williams
212388b58f9SPatrick Williams```sh
213388b58f9SPatrick Williamscurl -c cjar -b cjar -k -H "Content-Type: application/json" \
214388b58f9SPatrick Williams    https://${bmc}/xyz/openbmc_project/network/<interface>/attr/MACAddress
215b1b4d261SWilliam A. Kennington III```
216388b58f9SPatrick Williams
217388b58f9SPatrick Williams#### Set
218388b58f9SPatrick Williams
219388b58f9SPatrick Williams```sh
220388b58f9SPatrick Williamsbusctl set-property xyz.openbmc_project.Network \
221388b58f9SPatrick Williams    /xyz/openbmc_project/network/<interface> \
222388b58f9SPatrick Williams    xyz.openbmc_project.Network.MACAddress MACAddress s "<MAC Address>"
223b1b4d261SWilliam A. Kennington III```
224388b58f9SPatrick Williams
225388b58f9SPatrick Williams```sh
226388b58f9SPatrick Williamscurl -c cjar -b cjar -k -H "Content-Type: application/json" -X PUT \
227388b58f9SPatrick Williams    -d '{"data": "<MAC Address>" }' \
228388b58f9SPatrick Williams    https://${bmc}/xyz/openbmc_project/network/<interface>/attr/MACAddress
229388b58f9SPatrick Williams```
230388b58f9SPatrick Williams
231388b58f9SPatrick WilliamsNOTE: MAC address should be a local admin MAC (2nd bit of first byte should be
232388b58f9SPatrick Williamson).
233388b58f9SPatrick Williams
234388b58f9SPatrick Williams### Network Factory Reset
235388b58f9SPatrick Williams
236388b58f9SPatrick Williams```sh
237388b58f9SPatrick Williamsbusctl call xyz.openbmc_project.Network /xyz/openbmc_project/network \
238388b58f9SPatrick Williams    xyz.openbmc_project.Common.FactoryReset Reset
239388b58f9SPatrick Williams```
240388b58f9SPatrick Williams
241388b58f9SPatrick Williams```sh
242388b58f9SPatrick Williamscurl -c cjar -b cjar -k -H "Content-Type: application/json" -X POST \
243388b58f9SPatrick Williams    -d '{"data":[] }' https://${bmc}/xyz/openbmc_project/network/action/Reset
244388b58f9SPatrick Williams```
245388b58f9SPatrick Williams
246388b58f9SPatrick Williams### VLAN
247388b58f9SPatrick Williams
248388b58f9SPatrick Williams#### Create
249388b58f9SPatrick Williams
250388b58f9SPatrick Williams```sh
251388b58f9SPatrick Williamsbusctl call xyz.openbmc_project.Network /xyz/openbmc_project/network \
252388b58f9SPatrick Williams    xyz.openbmc_project.Network.VLAN.Create VLAN su "<interface>" <VLAN id>
253388b58f9SPatrick Williams```
254388b58f9SPatrick Williams
255388b58f9SPatrick Williams```sh
256388b58f9SPatrick Williamscurl -c cjar -b cjar -k -H "Content-Type: application/json" -X POST \
257388b58f9SPatrick Williams    -d '{"data":["<interface>", <VLAN id>] }' \
258388b58f9SPatrick Williams    https://${bmc}/xyz/openbmc_project/network/action/VLAN
259b1b4d261SWilliam A. Kennington III```
260b1b4d261SWilliam A. Kennington III
261b1b4d261SWilliam A. Kennington IIIE.g.
262388b58f9SPatrick Williams
263388b58f9SPatrick Williams```sh
264388b58f9SPatrick Williamscurl -c cjar -b cjar -k -H "Content-Type: application/json" -X POST \
265388b58f9SPatrick Williams    -d '{"data":["eth0",50] }' \
266388b58f9SPatrick Williams    https://${bmc}/xyz/openbmc_project/network/action/VLAN
267b1b4d261SWilliam A. Kennington III```
268b1b4d261SWilliam A. Kennington III
269388b58f9SPatrick Williams#### Delete
270b1b4d261SWilliam A. Kennington III
271388b58f9SPatrick Williams```sh
272388b58f9SPatrick Williamsbusctl call xyz.openbmc_project.Network \
273388b58f9SPatrick Williams    /xyz/openbmc_project/network/<VLAN interface> \
274388b58f9SPatrick Williams    xyz.openbmc_project.Object.Delete Delete
275b1b4d261SWilliam A. Kennington III```
276388b58f9SPatrick Williams
277388b58f9SPatrick Williams```sh
278388b58f9SPatrick Williamscurl -c cjar -b cjar -k -H "Content-Type: application/json" -X DELETE \
279388b58f9SPatrick Williams    https://${bmc}/xyz/openbmc_project/network/<VLAN interface>
280b1b4d261SWilliam A. Kennington III```
281b1b4d261SWilliam A. Kennington III
282b1b4d261SWilliam A. Kennington IIIE.g.
283388b58f9SPatrick Williams
284388b58f9SPatrick Williams```sh
285388b58f9SPatrick Williamscurl -c cjar -b cjar -k -H "Content-Type: application/json" -X DELETE \
286388b58f9SPatrick Williams    https://${bmc}/xyz/openbmc_project/network/eth0_50
287b1b4d261SWilliam A. Kennington III```
288b1b4d261SWilliam A. Kennington III
289388b58f9SPatrick Williams#### Enumerate
290b1b4d261SWilliam A. Kennington III
291388b58f9SPatrick Williams```sh
292388b58f9SPatrick Williamscurl -c cjar -b cjar -k -H "Content-Type: application/json" \
293388b58f9SPatrick Williams    https://${bmc}/xyz/openbmc_project/network/<VLAN interface>/enumerate
294b1b4d261SWilliam A. Kennington III```
295b1b4d261SWilliam A. Kennington III
296388b58f9SPatrick Williams### IPMI VLAN and IP
297b1b4d261SWilliam A. Kennington III
298388b58f9SPatrick Williams#### Create
299b1b4d261SWilliam A. Kennington III
300388b58f9SPatrick Williams```sh
301b1b4d261SWilliam A. Kennington IIIipmitool -I dbus lan set 1 ipsrc static
302b1b4d261SWilliam A. Kennington III
303b1b4d261SWilliam A. Kennington IIIipmitool -I dbus lan set 1 ipaddr <IP address>
304b1b4d261SWilliam A. Kennington III
305b1b4d261SWilliam A. Kennington IIIipmitool -I dbus lan set 1 netmask <mask>
306b1b4d261SWilliam A. Kennington III
307b1b4d261SWilliam A. Kennington IIIipmitool -I dbus lan set 1 defgw ipaddr <IP address>
308b1b4d261SWilliam A. Kennington III
309b1b4d261SWilliam A. Kennington IIIipmitool -I dbus lan set 1 vlan id <id>
310b1b4d261SWilliam A. Kennington III
311b1b4d261SWilliam A. Kennington IIIipmitool -I dbus raw 0x06 0x40 // To the save settings
312b1b4d261SWilliam A. Kennington III```
313b1b4d261SWilliam A. Kennington III
314*a1347418SPatrick WilliamsNOTE: It takes 4-5 seconds to create the VLAN and configure the IP. If a VLAN
315*a1347418SPatrick Williamsinterface is not desired don't set the VLAN id above.
316b1b4d261SWilliam A. Kennington III
317388b58f9SPatrick Williams#### Delete
318b1b4d261SWilliam A. Kennington III
319388b58f9SPatrick Williams```sh
320b1b4d261SWilliam A. Kennington IIIipmitool -I dbus lan set 1 vlan id off
321b1b4d261SWilliam A. Kennington III
322b1b4d261SWilliam A. Kennington IIIipmitool -I dbus raw 0x06 0x40 // To the save settings
323b1b4d261SWilliam A. Kennington III```
324