diff --git a/examples/policy/capture_all/current.yml b/examples/policy/capture_all/current.yml new file mode 100644 index 0000000000..a66abfe0a5 --- /dev/null +++ b/examples/policy/capture_all/current.yml @@ -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 diff --git a/examples/policy/capture_all/expected.yml b/examples/policy/capture_all/expected.yml new file mode 100644 index 0000000000..5c817d3c34 --- /dev/null +++ b/examples/policy/capture_all/expected.yml @@ -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 diff --git a/examples/policy/capture_all/policy.yml b/examples/policy/capture_all/policy.yml new file mode 100644 index 0000000000..de6d63c70a --- /dev/null +++ b/examples/policy/capture_all/policy.yml @@ -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 }}" diff --git a/rust/src/lib/policy/capture.rs b/rust/src/lib/policy/capture.rs index 34d90f85d2..035dd712eb 100644 --- a/rust/src/lib/policy/capture.rs +++ b/rust/src/lib/policy/capture.rs @@ -192,7 +192,8 @@ impl NetworkCaptureCommand { ) }); } else { - return Ok(NetworkState::new()); + // User just want to store full state to a new name + return Ok(input); } }