forked from nmstate/nmstate
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
policy: Fix capture full state with simple line
For capture like `default-gw: override me with the cache`, nmstate should store the full state to `default-gw`. Example file created and will be used for unit tests. Signed-off-by: Gris Ge <[email protected]>
- Loading branch information
Showing
4 changed files
with
71 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
routes: | ||
running: | ||
- destination: 0.0.0.0/0 | ||
next-hop-interface: eth1 | ||
next-hop-address: 192.0.2.1 | ||
config: | ||
- destination: 0.0.0.0/0 | ||
next-hop-interface: eth1 | ||
next-hop-address: 192.0.2.1 | ||
interfaces: | ||
- name: eth1 | ||
type: ethernet | ||
state: up | ||
mac-address: 1c:c1:0c:32:3b:ff | ||
ipv4: | ||
enabled: true | ||
dhcp: false | ||
address: | ||
- ip: 192.0.2.251 | ||
prefix-length: 24 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- | ||
routes: | ||
config: | ||
- destination: 0.0.0.0/0 | ||
next-hop-interface: br1 | ||
next-hop-address: 192.0.2.1 | ||
interfaces: | ||
- name: br1 | ||
description: Linux bridge with base interface as a port | ||
type: linux-bridge | ||
state: up | ||
ipv4: | ||
enabled: true | ||
dhcp: false | ||
address: | ||
- ip: 192.0.2.251 | ||
prefix-length: 24 | ||
bridge: | ||
options: | ||
stp: | ||
enabled: false | ||
port: | ||
- name: eth1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- | ||
capture: | ||
default-gw: override me with the cache | ||
base-iface: >- | ||
interfaces.name == capture.default-gw.routes.running.0.next-hop-interface | ||
base-iface-routes: >- | ||
routes.running.next-hop-interface == | ||
capture.default-gw.routes.running.0.next-hop-interface | ||
bridge-routes: >- | ||
capture.base-iface-routes | routes.running.next-hop-interface:="br1" | ||
desiredState: | ||
interfaces: | ||
- bridge: | ||
options: | ||
stp: | ||
enabled: false | ||
port: | ||
- name: "{{ capture.base-iface.interfaces.0.name }}" | ||
description: Linux bridge with base interface as a port | ||
ipv4: "{{ capture.base-iface.interfaces.0.ipv4 }}" | ||
name: br1 | ||
state: up | ||
type: linux-bridge | ||
routes: | ||
config: "{{ capture.bridge-routes.routes.running }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters