Skip to content

Commit 3e90cc4

Browse files
committed
Migrate nmpolicy document to this repo
Signed-off-by: Gris Ge <fge@redhat.com>
1 parent 44ad893 commit 3e90cc4

File tree

37 files changed

+1260
-0
lines changed

37 files changed

+1260
-0
lines changed

nmpolicy/examples.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
title: Examples
3+
toc: true
4+
toc_label: "NMPolicy Examples"
5+
toc_icon: "network-wired"
6+
toc_sticky: true
7+
---
8+
9+
10+
## Linux bridge on top of default gw NIC with DHCP
11+
12+
{% include_relative examples/example.md example="bridge-on-default-gw-dhcp" %}
13+
14+
## Linux bridge on top of default gw NIC without DHCP
15+
16+
{% include_relative examples/example.md example="bridge-on-default-gw-no-dhcp" %}
17+
18+
## OVS SLB bond between primary and secondary nics
19+
20+
It uses the `description` field to filter between primary and secondary NIC.
21+
22+
{% include_relative examples/example.md example="ovs-slb-bond-primary-secondary" %}
23+
24+
## Set all linux bridges down
25+
26+
{% include_relative examples/example.md example="all-linux-bridges-down" %}
27+
28+
## Convert DHCP aware interface to static addressing
29+
30+
{% include_relative examples/example.md example="convert-dhcp-to-static" %}
31+
32+
## Turn LLDP to true at interfaces active interfaces
33+
34+
{% include_relative examples/example.md example="all-ethernet-up" %}
35+
36+
## Create a linux-bridge with all the interfaces matching description
37+
38+
{% include_relative examples/example.md example="bridge-interfaces-by-description" %}
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
ethernets:
2+
metaInfo:
3+
time: "2021-12-15T13:45:40Z"
4+
version: "0"
5+
state:
6+
interfaces:
7+
- accept-all-mac-addresses: false
8+
lldp:
9+
enabled: false
10+
mac-address: 52:55:00:D1:55:01
11+
name: eth0
12+
state: up
13+
type: ethernet
14+
- accept-all-mac-addresses: false
15+
lldp:
16+
enabled: false
17+
mac-address: 52:55:00:D1:56:02
18+
name: eth1
19+
state: down
20+
type: ethernet
21+
- accept-all-mac-addresses: false
22+
mac-address: 52:55:00:D1:57:03
23+
name: eth4
24+
state: up
25+
type: ethernet
26+
- accept-all-mac-addresses: false
27+
mac-address: 52:55:00:D1:56:04
28+
name: eth2
29+
state: down
30+
type: ethernet
31+
ethernets-up:
32+
metaInfo:
33+
time: "2021-12-15T13:45:40Z"
34+
version: "0"
35+
state:
36+
interfaces:
37+
- accept-all-mac-addresses: false
38+
lldp:
39+
enabled: false
40+
mac-address: 52:55:00:D1:55:01
41+
name: eth0
42+
state: up
43+
type: ethernet
44+
- accept-all-mac-addresses: false
45+
mac-address: 52:55:00:D1:57:03
46+
name: eth4
47+
state: up
48+
type: ethernet
49+
ethernets-lldp:
50+
metaInfo:
51+
time: "2021-12-15T13:45:40Z"
52+
version: "0"
53+
state:
54+
interfaces:
55+
- accept-all-mac-addresses: false
56+
lldp:
57+
enabled: true
58+
mac-address: 52:55:00:D1:55:01
59+
name: eth0
60+
state: up
61+
type: ethernet
62+
- accept-all-mac-addresses: false
63+
lldp:
64+
enabled: true
65+
mac-address: 52:55:00:D1:57:03
66+
name: eth4
67+
state: up
68+
type: ethernet
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
interfaces:
2+
- accept-all-mac-addresses: false
3+
lldp:
4+
enabled: false
5+
mac-address: 52:55:00:D1:55:01
6+
name: eth0
7+
state: up
8+
type: ethernet
9+
- accept-all-mac-addresses: false
10+
lldp:
11+
enabled: false
12+
mac-address: 52:55:00:D1:56:02
13+
name: eth1
14+
state: down
15+
type: ethernet
16+
- accept-all-mac-addresses: false
17+
mac-address: 52:55:00:D1:57:03
18+
name: eth4
19+
state: up
20+
type: ethernet
21+
- accept-all-mac-addresses: false
22+
mac-address: 52:55:00:D1:56:04
23+
name: eth2
24+
state: down
25+
type: ethernet
26+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
interfaces:
2+
- accept-all-mac-addresses: false
3+
lldp:
4+
enabled: true
5+
mac-address: 52:55:00:D1:55:01
6+
name: eth0
7+
state: up
8+
type: ethernet
9+
- accept-all-mac-addresses: false
10+
lldp:
11+
enabled: true
12+
mac-address: 52:55:00:D1:57:03
13+
name: eth4
14+
state: up
15+
type: ethernet
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{% raw %}
2+
capture:
3+
ethernets: interfaces.type=="ethernet"
4+
ethernets-up: capture.ethernets.interfaces.state=="up"
5+
ethernets-lldp: capture.ethernets-up | interfaces.lldp.enabled:=true
6+
7+
desiredState:
8+
interfaces: "{{ capture.ethernets-lldp.interfaces }}"
9+
{% endraw %}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
linux-bridges:
2+
metaInfo:
3+
time: "2021-12-15T13:45:40Z"
4+
version: "0"
5+
state:
6+
interfaces:
7+
- name: br1
8+
type: linux-bridge
9+
state: up
10+
- name: br2
11+
type: linux-bridge
12+
state: up
13+
- name: br3
14+
type: linux-bridge
15+
state: up
16+
linux-bridges-down:
17+
metaInfo:
18+
time: "2021-12-15T13:45:40Z"
19+
version: "0"
20+
state:
21+
interfaces:
22+
- name: br1
23+
type: linux-bridge
24+
state: down
25+
- name: br2
26+
type: linux-bridge
27+
state: down
28+
- name: br3
29+
type: linux-bridge
30+
state: down
31+
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
interfaces:
2+
- name: eth0
3+
type: ethernet
4+
- name: br1
5+
type: linux-bridge
6+
state: up
7+
- name: br2
8+
type: linux-bridge
9+
state: up
10+
- name: br3
11+
type: linux-bridge
12+
state: up
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
interfaces:
2+
- name: br1
3+
type: linux-bridge
4+
state: down
5+
- name: br2
6+
type: linux-bridge
7+
state: down
8+
- name: br3
9+
type: linux-bridge
10+
state: down
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{% raw %}
2+
capture:
3+
linux-bridges: interfaces.type=="linux-bridge"
4+
linux-bridges-down: capture.linux-bridges | interfaces.state:="down"
5+
6+
desiredState:
7+
interfaces: "{{ capture.linux-bridges-down.interfaces }}"
8+
{% endraw %}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
primary-nic:
2+
metaInfo:
3+
time: "2021-12-15T13:45:40Z"
4+
version: "0"
5+
state:
6+
interfaces:
7+
- name: eth0
8+
description: primary
9+
type: ethernet
10+
state: up
11+
mac-address: 00:00:5E:00:00:01
12+
secondary-nic:
13+
metaInfo:
14+
time: "2021-12-15T13:45:40Z"
15+
version: "0"
16+
state:
17+
interfaces:
18+
- name: eth1
19+
description: secondary
20+
type: ethernet
21+
state: up
22+
mac-address: 00:00:5E:00:00:02

0 commit comments

Comments
 (0)