mirror of
https://github.com/linux-system-roles/network.git
synced 2026-08-01 23:32:23 +00:00
RFE: Support dummy interfaces
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
This commit is contained in:
parent
637e1e6bbe
commit
f848949c76
7 changed files with 85 additions and 0 deletions
17
examples/dummy_simple.yml
Normal file
17
examples/dummy_simple.yml
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
---
|
||||
- hosts: all
|
||||
vars:
|
||||
network_connections:
|
||||
# Specify the dummy profile
|
||||
- name: dummy0
|
||||
state: up
|
||||
type: dummy
|
||||
interface_name: dummy0
|
||||
ip:
|
||||
address:
|
||||
- "192.0.2.42/30"
|
||||
|
||||
roles:
|
||||
- linux-system-roles.network
|
||||
...
|
||||
|
|
@ -821,6 +821,8 @@ class NMUtil:
|
|||
s_bond.add_option("miimon", str(connection["bond"]["miimon"]))
|
||||
elif connection["type"] == "team":
|
||||
s_con.set_property(NM.SETTING_CONNECTION_TYPE, NM.SETTING_TEAM_SETTING_NAME)
|
||||
elif connection["type"] == "dummy":
|
||||
s_con.set_property(NM.SETTING_CONNECTION_TYPE, NM.SETTING_DUMMY_SETTING_NAME)
|
||||
elif connection["type"] == "vlan":
|
||||
s_con.set_property(NM.SETTING_CONNECTION_TYPE, NM.SETTING_VLAN_SETTING_NAME)
|
||||
s_vlan = self.connection_ensure_setting(con, NM.SettingVlan)
|
||||
|
|
|
|||
|
|
@ -1006,6 +1006,7 @@ class ArgValidator_DictConnection(ArgValidatorDict):
|
|||
"vlan",
|
||||
"macvlan",
|
||||
"wireless",
|
||||
"dummy",
|
||||
]
|
||||
VALID_SLAVE_TYPES = ["bridge", "bond", "team"]
|
||||
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ EXTRA_RUN_CONDITION = "extra_run_condition"
|
|||
NM_ONLY_TESTS = {
|
||||
"playbooks/tests_802_1x_updated.yml": {},
|
||||
"playbooks/tests_802_1x.yml": {},
|
||||
"playbooks/tests_dummy.yml": {},
|
||||
"playbooks/tests_ethtool_features.yml": {
|
||||
MINIMUM_VERSION: "'1.20.0'",
|
||||
"comment": "# NetworkManager 1.20.0 introduced ethtool settings support",
|
||||
|
|
|
|||
30
tests/playbooks/tests_dummy.yml
Normal file
30
tests/playbooks/tests_dummy.yml
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
---
|
||||
- hosts: all
|
||||
vars:
|
||||
interface: dummy0
|
||||
profile: "{{ interface }}"
|
||||
lsr_fail_debug:
|
||||
- __network_connections_result
|
||||
tasks:
|
||||
- debug:
|
||||
msg: "this is: playbooks/tests_dummy.yml"
|
||||
tags:
|
||||
- always
|
||||
|
||||
- block:
|
||||
- include_tasks: tasks/run_test.yml
|
||||
vars:
|
||||
lsr_description: Create a dummy interface
|
||||
lsr_setup:
|
||||
- tasks/delete_interface.yml
|
||||
- tasks/assert_device_absent.yml
|
||||
lsr_test:
|
||||
- tasks/create_dummy_profile.yml
|
||||
lsr_assert:
|
||||
- tasks/assert_profile_present.yml
|
||||
- tasks/assert_device_present.yml
|
||||
lsr_cleanup:
|
||||
- tasks/cleanup_profile+device.yml
|
||||
tags:
|
||||
- tests::dummy:create
|
||||
15
tests/tasks/create_dummy_profile.yml
Normal file
15
tests/tasks/create_dummy_profile.yml
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
---
|
||||
- include_role:
|
||||
name: linux-system-roles.network
|
||||
vars:
|
||||
network_connections:
|
||||
- name: "{{ interface }}"
|
||||
state: up
|
||||
type: dummy
|
||||
ip:
|
||||
address:
|
||||
- "192.0.2.42/30"
|
||||
- debug:
|
||||
var: __network_connections_result
|
||||
...
|
||||
19
tests/tests_dummy_nm.yml
Normal file
19
tests/tests_dummy_nm.yml
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
# This file was generated by ensure_provider_tests.py
|
||||
---
|
||||
# set network provider and gather facts
|
||||
- hosts: all
|
||||
name: Run playbook 'playbooks/tests_dummy.yml' with nm as provider
|
||||
tasks:
|
||||
- name: Set network provider to 'nm'
|
||||
set_fact:
|
||||
network_provider: nm
|
||||
tags:
|
||||
- always
|
||||
|
||||
|
||||
# The test requires or should run with NetworkManager, therefore it cannot run
|
||||
# on RHEL/CentOS 6
|
||||
- import_playbook: playbooks/tests_dummy.yml
|
||||
when:
|
||||
- ansible_distribution_major_version != '6'
|
||||
Loading…
Add table
Add a link
Reference in a new issue