integ tests: Create and remove linux bridge
Signed-off-by: Sveta Haas <sveta.haas@gmail.com>
This commit is contained in:
parent
118dac5f86
commit
1afa55dfe1
68
tests/integration/linux_bridge_test.py
Normal file
68
tests/integration/linux_bridge_test.py
Normal file
@ -0,0 +1,68 @@
|
||||
#
|
||||
# Copyright 2019 Red Hat, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
import yaml
|
||||
|
||||
from libnmstate import netapplier
|
||||
|
||||
from .testlib import statelib
|
||||
from .testlib.statelib import INTERFACES
|
||||
|
||||
|
||||
IPV4_ADDRESS1 = '192.0.2.251'
|
||||
IPV4_ADDRESS2 = '192.0.2.252'
|
||||
|
||||
LINUX_BRIDGE_YAML_BASE = """
|
||||
interfaces:
|
||||
- name: linux-br0
|
||||
type: linux-bridge
|
||||
state: up
|
||||
bridge:
|
||||
options:
|
||||
group-forward-mask: 0
|
||||
mac-ageing-time: 300
|
||||
multicast-snooping: true
|
||||
stp:
|
||||
enabled: true
|
||||
forward-delay: 15
|
||||
hello-time: 2
|
||||
max-age: 20
|
||||
priority: 32768
|
||||
port:
|
||||
- name: eth1
|
||||
stp-hairpin-mode: false
|
||||
stp-path-cost: 100
|
||||
stp-priority: 32
|
||||
"""
|
||||
|
||||
|
||||
def test_create_and_remove_linux_bridge(eth1_up):
|
||||
state = yaml.load(LINUX_BRIDGE_YAML_BASE)
|
||||
netapplier.apply(state)
|
||||
|
||||
setup_remove_linux_bridge_state = {
|
||||
INTERFACES: [
|
||||
{
|
||||
'name': 'linux-br0',
|
||||
'type': 'linux-bridge',
|
||||
'state': 'absent'
|
||||
}
|
||||
]
|
||||
}
|
||||
netapplier.apply(setup_remove_linux_bridge_state)
|
||||
state = statelib.show_only((state[INTERFACES][0]['name'],))
|
||||
assert not state[INTERFACES]
|
Loading…
x
Reference in New Issue
Block a user