diff --git a/lib/ansible/modules/network/ios/ios_interface.py b/lib/ansible/modules/network/ios/ios_interface.py index 49ba5bdeb83..a66f446df1c 100644 --- a/lib/ansible/modules/network/ios/ios_interface.py +++ b/lib/ansible/modules/network/ios/ios_interface.py @@ -143,8 +143,6 @@ from ansible.module_utils.ios import ios_argument_spec, check_args from ansible.module_utils.netcfg import NetworkConfig from ansible.module_utils.network_common import conditional, remove_default_spec -DEFAULT_DESCRIPTION = "configured by ios_interface" - def validate_mtu(value, module): if value and not 64 <= int(value) <= 9600: @@ -284,13 +282,6 @@ def map_obj_to_commands(updates): if candidate: cmd = item + ' ' + str(candidate) add_command_to_interface(interface, cmd, commands) - elif running: - # if value present in device is default value for - # interface, don't delete - if running == 'auto' and item in ('speed', 'duplex'): - continue - cmd = 'no ' + item + ' ' + str(running) - add_command_to_interface(interface, cmd, commands) if disable and not obj_in_have.get('disable', False): add_command_to_interface(interface, 'shutdown', commands) @@ -360,7 +351,7 @@ def main(): """ element_spec = dict( name=dict(), - description=dict(default=DEFAULT_DESCRIPTION), + description=dict(), speed=dict(), mtu=dict(), duplex=dict(choices=['full', 'half', 'auto']), diff --git a/lib/ansible/modules/network/iosxr/iosxr_interface.py b/lib/ansible/modules/network/iosxr/iosxr_interface.py index 72f9d27516c..126c4004a84 100644 --- a/lib/ansible/modules/network/iosxr/iosxr_interface.py +++ b/lib/ansible/modules/network/iosxr/iosxr_interface.py @@ -93,6 +93,9 @@ EXAMPLES = """ aggregate: - name: GigabitEthernet0/0/0/3 - name: GigabitEthernet0/0/0/2 + speed: 100 + duplex: full + mtu: 512 state: present - name: Delete interface using aggregate @@ -139,8 +142,6 @@ from ansible.module_utils.iosxr import get_config, load_config from ansible.module_utils.iosxr import iosxr_argument_spec, check_args from ansible.module_utils.network_common import conditional, remove_default_spec -DEFAULT_DESCRIPTION = "configured by iosxr_interface" - def validate_mtu(value, module): if value and not 64 <= int(value) <= 65535: @@ -182,7 +183,6 @@ def search_obj_in_list(name, lst): def map_params_to_obj(module): obj = [] - args = ['name', 'description', 'speed', 'duplex', 'mtu'] aggregate = module.params.get('aggregate') if aggregate: @@ -202,7 +202,7 @@ def map_params_to_obj(module): obj.append(d) else: - validate_param_values(module, args) + validate_param_values(module, module.params) params = { 'name': module.params['name'], 'description': module.params['description'], @@ -279,9 +279,6 @@ def map_obj_to_commands(updates): if candidate: cmd = interface + ' ' + item + ' ' + str(candidate) commands.append(cmd) - elif running: - cmd = 'no ' + interface + ' ' + item + ' ' + str(running) - commands.append(cmd) if disable and not obj_in_have.get('disable', False): commands.append(interface + ' shutdown') @@ -292,7 +289,6 @@ def map_obj_to_commands(updates): value = w.get(item) if value: commands.append(interface + ' ' + item + ' ' + str(value)) - if disable: commands.append('no ' + interface + ' shutdown') return commands @@ -354,7 +350,7 @@ def main(): """ element_spec = dict( name=dict(), - description=dict(default=DEFAULT_DESCRIPTION), + description=dict(), speed=dict(), mtu=dict(), duplex=dict(choices=['full', 'half']), diff --git a/lib/ansible/modules/network/junos/junos_linkagg.py b/lib/ansible/modules/network/junos/junos_linkagg.py index fe3c1c3c792..c9e239c7431 100644 --- a/lib/ansible/modules/network/junos/junos_linkagg.py +++ b/lib/ansible/modules/network/junos/junos_linkagg.py @@ -170,7 +170,6 @@ except ImportError: from xml.etree.ElementTree import tostring USE_PERSISTENT_CONNECTION = True -DEFAULT_COMMENT = 'configured by junos_linkagg' def validate_device_count(value, module): @@ -263,7 +262,7 @@ def main(): members=dict(type='list'), min_links=dict(type='int'), device_count=dict(type='int'), - description=dict(default=DEFAULT_COMMENT), + description=dict(), state=dict(default='present', choices=['present', 'absent', 'up', 'down']), active=dict(default=True, type='bool') ) diff --git a/lib/ansible/modules/network/junos/junos_vlan.py b/lib/ansible/modules/network/junos/junos_vlan.py index 2b70afa51f2..99a09409c46 100644 --- a/lib/ansible/modules/network/junos/junos_vlan.py +++ b/lib/ansible/modules/network/junos/junos_vlan.py @@ -121,7 +121,6 @@ except ImportError: from xml.etree.ElementTree import tostring USE_PERSISTENT_CONNECTION = True -DEFAULT_DESCRIPTION = "configured by junos_vlan" def validate_vlan_id(value, module): @@ -145,7 +144,7 @@ def main(): element_spec = dict( name=dict(), vlan_id=dict(type='int'), - description=dict(default=DEFAULT_DESCRIPTION), + description=dict(), interfaces=dict(), state=dict(default='present', choices=['present', 'absent']), active=dict(default=True, type='bool') diff --git a/lib/ansible/modules/network/vyos/vyos_interface.py b/lib/ansible/modules/network/vyos/vyos_interface.py index edcf71ab22b..bef849e852f 100644 --- a/lib/ansible/modules/network/vyos/vyos_interface.py +++ b/lib/ansible/modules/network/vyos/vyos_interface.py @@ -138,8 +138,6 @@ from ansible.module_utils.network_common import conditional, remove_default_spec from ansible.module_utils.vyos import load_config, get_config from ansible.module_utils.vyos import vyos_argument_spec, check_args -DEFAULT_DESCRIPTION = "'configured by vyos_interface'" - def search_obj_in_list(name, lst): for o in lst: @@ -302,7 +300,7 @@ def main(): """ element_spec = dict( name=dict(), - description=dict(default=DEFAULT_DESCRIPTION), + description=dict(), speed=dict(), mtu=dict(type='int'), duplex=dict(choices=['full', 'half', 'auto']), diff --git a/test/integration/targets/ios_interface/tests/cli/basic.yaml b/test/integration/targets/ios_interface/tests/cli/basic.yaml index e4013e691bc..6418f75939f 100644 --- a/test/integration/targets/ios_interface/tests/cli/basic.yaml +++ b/test/integration/targets/ios_interface/tests/cli/basic.yaml @@ -1,5 +1,5 @@ --- -- debug: msg="START ios_interface netconf/basic.yaml" +- debug: msg="START ios_interface cli/basic.yaml" - name: Configure interface (setup) ios_interface: @@ -46,7 +46,6 @@ name: GigabitEthernet0/2 description: test-interface speed: 100 - duplex: half mtu: 512 state: present authorize: yes @@ -59,7 +58,6 @@ - '"interface GigabitEthernet0/2" in result.commands' - '"description test-interface" in result.commands' - '"speed 100" in result.commands' - - '"duplex half" in result.commands' - '"mtu 512" in result.commands' - name: Change interface parameters @@ -67,7 +65,7 @@ name: GigabitEthernet0/2 description: test-interface-1 speed: 10 - duplex: full + duplex: half mtu: 256 state: present authorize: yes @@ -80,38 +78,9 @@ - '"interface GigabitEthernet0/2" in result.commands' - '"description test-interface-1" in result.commands' - '"speed 10" in result.commands' - - '"duplex full" in result.commands' + - '"duplex half" in result.commands' - '"mtu 256" in result.commands' -- name: Delete interface parameters - ios_interface: - name: GigabitEthernet0/2 - state: present - authorize: yes - provider: "{{ cli }}" - register: result - -- assert: - that: - - 'result.changed == true' - - '"interface GigabitEthernet0/2" in result.commands' - - '"description configured by ios_interface" in result.commands' - - '"no speed 10" in result.commands' - - '"no duplex full" in result.commands' - - '"no mtu 256" in result.commands' - -- name: Delete interface parameters (idempotent) - ios_interface: - name: GigabitEthernet0/2 - state: present - authorize: yes - provider: "{{ cli }}" - register: result - -- assert: - that: - - 'result.changed == false' - - name: Disable interface ios_interface: name: GigabitEthernet0/2 @@ -145,7 +114,7 @@ name: GigabitEthernet0/1 description: test-interface-initial speed: 100 - duplex: full + duplex: half mtu: 516 state: present authorize: yes @@ -194,31 +163,6 @@ that: - 'result.changed == false' - -- name: Change interface parameters in aggregate - ios_interface: - aggregate: - - { name: GigabitEthernet0/1 } - - { name: GigabitEthernet0/2 } - state: present - authorize: yes - provider: "{{ cli }}" - register: result - -- assert: - that: - - 'result.changed == true' - - '"interface GigabitEthernet0/1" in result.commands' - - '"no speed 100" in result.commands' - - '"description configured by ios_interface" in result.commands' - - '"no duplex full" in result.commands' - - '"no mtu 256" in result.commands' - - '"interface GigabitEthernet0/2" in result.commands' - - '"no speed 100" in result.commands' - - '"description configured by ios_interface" in result.commands' - - '"no duplex full" in result.commands' - - '"no mtu 516" in result.commands' - - name: Disable interface aggregate ios_interface: aggregate: @@ -257,6 +201,14 @@ - '"interface GigabitEthernet0/2" in result.commands' - '"no shutdown" in result.commands' +- name: loopback interface setup + ios_interface: + aggregate: + - name: Loopback9 + - name: Loopback10 + state: absent + authorize: yes + - name: Create loopback interface aggregate ios_interface: aggregate: @@ -271,9 +223,7 @@ that: - 'result.changed == true' - '"interface Loopback9" in result.commands' - - '"description configured by ios_interface" in result.commands' - '"interface Loopback10" in result.commands' - - '"description configured by ios_interface" in result.commands' - name: Delete loopback interface aggregate ios_interface: diff --git a/test/integration/targets/iosxr_interface/tests/cli/basic.yaml b/test/integration/targets/iosxr_interface/tests/cli/basic.yaml index 9de092d647d..b74f674ea1b 100644 --- a/test/integration/targets/iosxr_interface/tests/cli/basic.yaml +++ b/test/integration/targets/iosxr_interface/tests/cli/basic.yaml @@ -72,28 +72,16 @@ - '"interface GigabitEthernet0/0/0/2 duplex full" in result.commands' - '"interface GigabitEthernet0/0/0/2 mtu 256" in result.commands' -- name: Delete interface parameters +- name: Change interface parameters (idempotent) iosxr_interface: name: GigabitEthernet0/0/0/2 + description: test-interface-1 + speed: 10 + duplex: full + mtu: 256 state: present provider: "{{ cli }}" register: result - -- assert: - that: - - 'result.changed == true' - - '"interface GigabitEthernet0/0/0/2 description configured by iosxr_interface" in result.commands' - - '"no interface GigabitEthernet0/0/0/2 speed 10" in result.commands' - - '"no interface GigabitEthernet0/0/0/2 duplex full" in result.commands' - - '"no interface GigabitEthernet0/0/0/2 mtu 256" in result.commands' - -- name: Delete interface parameters (idempotent) - iosxr_interface: - name: GigabitEthernet0/0/0/2 - state: present - provider: "{{ cli }}" - register: result - - assert: that: - 'result.changed == false' @@ -135,11 +123,20 @@ - 'result.changed == true' - '"interface GigabitEthernet0/0/0/3 description test-interface-initial" in result.commands' +- name: Delete interface aggregate (setup) + iosxr_interface: + aggregate: + - name: GigabitEthernet0/0/0/3 + - name: GigabitEthernet0/0/0/2 + state: absent + - name: Add interface aggregate iosxr_interface: aggregate: - - { name: GigabitEthernet0/0/0/3, speed: 10, duplex: half, mtu: 256, description: test-interface-1 } - - { name: GigabitEthernet0/0/0/2, speed: 100, duplex: full, mtu: 516, description: test-interface-2 } + - { name: GigabitEthernet0/0/0/3, mtu: 256, description: test-interface-1 } + - { name: GigabitEthernet0/0/0/2, mtu: 516, description: test-interface-2 } + speed: 100 + duplex: full state: present provider: "{{ cli }}" register: result @@ -147,20 +144,23 @@ - assert: that: - 'result.changed == true' - - '"interface GigabitEthernet0/0/0/3 speed 10" in result.commands' + - '"interface GigabitEthernet0/0/0/3 speed 100" in result.commands' - '"interface GigabitEthernet0/0/0/3 description test-interface-1" in result.commands' - - '"interface GigabitEthernet0/0/0/3 duplex half" in result.commands' + - '"interface GigabitEthernet0/0/0/3 duplex full" in result.commands' - '"interface GigabitEthernet0/0/0/3 mtu 256" in result.commands' - '"interface GigabitEthernet0/0/0/2 speed 100" in result.commands' - '"interface GigabitEthernet0/0/0/2 description test-interface-2" in result.commands' - '"interface GigabitEthernet0/0/0/2 duplex full" in result.commands' - '"interface GigabitEthernet0/0/0/2 mtu 516" in result.commands' + - name: Add interface aggregate (idempotent) iosxr_interface: aggregate: - - { name: GigabitEthernet0/0/0/3, speed: 10, duplex: half, mtu: 256, description: test-interface-1 } - - { name: GigabitEthernet0/0/0/2, speed: 100, duplex: full, mtu: 516, description: test-interface-2 } + - { name: GigabitEthernet0/0/0/3, mtu: 256, description: test-interface-1 } + - { name: GigabitEthernet0/0/0/2, mtu: 516, description: test-interface-2 } + speed: 100 + duplex: full state: present provider: "{{ cli }}" register: result @@ -169,33 +169,12 @@ that: - 'result.changed == false' - -- name: Change interface parameters in aggregate +- name: Disable interface aggregate iosxr_interface: aggregate: - name: GigabitEthernet0/0/0/3 - name: GigabitEthernet0/0/0/2 - state: present - provider: "{{ cli }}" - register: result - -- assert: - that: - - 'result.changed == true' - - '"no interface GigabitEthernet0/0/0/3 speed 10" in result.commands' - - '"interface GigabitEthernet0/0/0/3 description configured by iosxr_interface" in result.commands' - - '"no interface GigabitEthernet0/0/0/3 duplex half" in result.commands' - - '"no interface GigabitEthernet0/0/0/3 mtu 256" in result.commands' - - '"no interface GigabitEthernet0/0/0/2 speed 100" in result.commands' - - '"interface GigabitEthernet0/0/0/2 description configured by iosxr_interface" in result.commands' - - '"no interface GigabitEthernet0/0/0/2 duplex full" in result.commands' - - '"no interface GigabitEthernet0/0/0/2 mtu 516" in result.commands' - -- name: Disable interface aggregate - iosxr_interface: - aggregate: - - { name: GigabitEthernet0/0/0/3, enabled: False } - - { name: GigabitEthernet0/0/0/2, enabled: False } + enabled: False state: present provider: "{{ cli }}" register: result @@ -235,7 +214,9 @@ iosxr_interface: aggregate: - name: GigabitEthernet0/0/0/4 + description: test_interface_1 - name: GigabitEthernet0/0/0/5 + description: test_interface_2 state: present provider: "{{ cli }}" register: result @@ -243,8 +224,8 @@ - assert: that: - 'result.changed == true' - - '"interface GigabitEthernet0/0/0/4 description configured by iosxr_interface" in result.commands' - - '"interface GigabitEthernet0/0/0/5 description configured by iosxr_interface" in result.commands' + - '"interface GigabitEthernet0/0/0/4 description test_interface_1" in result.commands' + - '"interface GigabitEthernet0/0/0/5 description test_interface_2" in result.commands' - name: Delete interface aggregate iosxr_interface: diff --git a/test/integration/targets/iosxr_interface/tests/cli/intent.yaml b/test/integration/targets/iosxr_interface/tests/cli/intent.yaml index ac0e34523d6..57680d0edbe 100644 --- a/test/integration/targets/iosxr_interface/tests/cli/intent.yaml +++ b/test/integration/targets/iosxr_interface/tests/cli/intent.yaml @@ -4,6 +4,7 @@ - name: Setup (interface is up) iosxr_interface: name: GigabitEthernet0/0/0/5 + description: test_interface_5 enabled: True state: present provider: "{{ cli }}" diff --git a/test/integration/targets/junos_linkagg/tests/netconf/basic.yaml b/test/integration/targets/junos_linkagg/tests/netconf/basic.yaml index 8c9a9d82378..e3f072c12b3 100644 --- a/test/integration/targets/junos_linkagg/tests/netconf/basic.yaml +++ b/test/integration/targets/junos_linkagg/tests/netconf/basic.yaml @@ -37,7 +37,6 @@ - "'4' in config.xml" - "'ae0' in config.xml" - "'' in config.xml" - - "'configured by junos_linkagg' in config.xml" - name: configure linkagg (idempotent) junos_linkagg: diff --git a/test/integration/targets/junos_vlan/tests/netconf/basic.yaml b/test/integration/targets/junos_vlan/tests/netconf/basic.yaml index 6b518595949..af5ecb4837f 100644 --- a/test/integration/targets/junos_vlan/tests/netconf/basic.yaml +++ b/test/integration/targets/junos_vlan/tests/netconf/basic.yaml @@ -126,7 +126,6 @@ - result.diff.prepared | search("\+ *test_vlan_1") - result.diff.prepared | search("\+ *vlan-id 159") - result.diff.prepared | search("\+ *test_vlan_2") - - result.diff.prepared | search("\+ *description \"configured by junos_vlan\"") - name: Deactivate vlan configuration using aggregate junos_vlan: diff --git a/test/integration/targets/net_interface/tests/ios/basic.yaml b/test/integration/targets/net_interface/tests/ios/basic.yaml index 6cd446378c6..2fff24315c3 100644 --- a/test/integration/targets/net_interface/tests/ios/basic.yaml +++ b/test/integration/targets/net_interface/tests/ios/basic.yaml @@ -1,5 +1,5 @@ --- -- debug: msg="START net_interface ios/basic.yaml" +- debug: msg="START net_interface cli/basic.yaml" - name: Configure interface (setup) net_interface: @@ -46,7 +46,6 @@ name: GigabitEthernet0/2 description: test-interface speed: 100 - duplex: half mtu: 512 state: present authorize: yes @@ -59,7 +58,6 @@ - '"interface GigabitEthernet0/2" in result.commands' - '"description test-interface" in result.commands' - '"speed 100" in result.commands' - - '"duplex half" in result.commands' - '"mtu 512" in result.commands' - name: Change interface parameters @@ -67,7 +65,7 @@ name: GigabitEthernet0/2 description: test-interface-1 speed: 10 - duplex: full + duplex: half mtu: 256 state: present authorize: yes @@ -80,38 +78,9 @@ - '"interface GigabitEthernet0/2" in result.commands' - '"description test-interface-1" in result.commands' - '"speed 10" in result.commands' - - '"duplex full" in result.commands' + - '"duplex half" in result.commands' - '"mtu 256" in result.commands' -- name: Delete interface parameters - net_interface: - name: GigabitEthernet0/2 - state: present - authorize: yes - provider: "{{ cli }}" - register: result - -- assert: - that: - - 'result.changed == true' - - '"interface GigabitEthernet0/2" in result.commands' - - '"description configured by ios_interface" in result.commands' - - '"no speed 10" in result.commands' - - '"no duplex full" in result.commands' - - '"no mtu 256" in result.commands' - -- name: Delete interface parameters (idempotent) - net_interface: - name: GigabitEthernet0/2 - state: present - authorize: yes - provider: "{{ cli }}" - register: result - -- assert: - that: - - 'result.changed == false' - - name: Disable interface net_interface: name: GigabitEthernet0/2 @@ -145,7 +114,7 @@ name: GigabitEthernet0/1 description: test-interface-initial speed: 100 - duplex: full + duplex: half mtu: 516 state: present authorize: yes @@ -155,8 +124,10 @@ - name: Add interface aggregate net_interface: aggregate: - - { name: GigabitEthernet0/1, speed: 10, duplex: half, mtu: 256, description: test-interface-1 } - - { name: GigabitEthernet0/2, speed: 100, duplex: full, mtu: 516, description: test-interface-2 } + - { name: GigabitEthernet0/1, mtu: 256, description: test-interface-1 } + - { name: GigabitEthernet0/2, mtu: 516, description: test-interface-2 } + duplex: full + speed: 100 state: present authorize: yes provider: "{{ cli }}" @@ -166,9 +137,9 @@ that: - 'result.changed == true' - '"interface GigabitEthernet0/1" in result.commands' - - '"speed 10" in result.commands' + - '"speed 100" in result.commands' - '"description test-interface-1" in result.commands' - - '"duplex half" in result.commands' + - '"duplex full" in result.commands' - '"mtu 256" in result.commands' - '"interface GigabitEthernet0/2" in result.commands' - '"speed 100" in result.commands' @@ -179,8 +150,10 @@ - name: Add interface aggregate (idempotent) net_interface: aggregate: - - { name: GigabitEthernet0/1, speed: 10, duplex: half, mtu: 256, description: test-interface-1 } - - { name: GigabitEthernet0/2, speed: 100, duplex: full, mtu: 516, description: test-interface-2 } + - { name: GigabitEthernet0/1, mtu: 256, description: test-interface-1 } + - { name: GigabitEthernet0/2, mtu: 516, description: test-interface-2 } + duplex: full + speed: 100 state: present authorize: yes provider: "{{ cli }}" @@ -190,36 +163,12 @@ that: - 'result.changed == false' - -- name: Change interface parameters in aggregate - net_interface: - aggregate: - - { name: GigabitEthernet0/1 } - - { name: GigabitEthernet0/2 } - state: present - authorize: yes - provider: "{{ cli }}" - register: result - -- assert: - that: - - 'result.changed == true' - - '"interface GigabitEthernet0/1" in result.commands' - - '"no speed 10" in result.commands' - - '"description configured by ios_interface" in result.commands' - - '"no duplex half" in result.commands' - - '"no mtu 256" in result.commands' - - '"interface GigabitEthernet0/2" in result.commands' - - '"no speed 100" in result.commands' - - '"description configured by ios_interface" in result.commands' - - '"no duplex full" in result.commands' - - '"no mtu 516" in result.commands' - - name: Disable interface aggregate net_interface: aggregate: - - { name: GigabitEthernet0/1, enabled: False } - - { name: GigabitEthernet0/2, enabled: False } + - name: GigabitEthernet0/1 + - name: GigabitEthernet0/2 + enabled: False state: present authorize: yes provider: "{{ cli }}" @@ -236,8 +185,9 @@ - name: Enable interface aggregate net_interface: aggregate: - - { name: GigabitEthernet0/1, enabled: True } - - { name: GigabitEthernet0/2, enabled: True } + - name: GigabitEthernet0/1 + - name: GigabitEthernet0/2 + enabled: True state: present authorize: yes provider: "{{ cli }}" @@ -251,11 +201,19 @@ - '"interface GigabitEthernet0/2" in result.commands' - '"no shutdown" in result.commands' +- name: loopback interface setup + net_interface: + aggregate: + - name: Loopback9 + - name: Loopback10 + state: absent + authorize: yes + - name: Create loopback interface aggregate net_interface: aggregate: - - { name: Loopback9 } - - { name: Loopback10 } + - name: Loopback9 + - name: Loopback10 state: present authorize: yes provider: "{{ cli }}" @@ -265,16 +223,14 @@ that: - 'result.changed == true' - '"interface Loopback9" in result.commands' - - '"description configured by ios_interface" in result.commands' - '"interface Loopback10" in result.commands' - - '"description configured by ios_interface" in result.commands' - name: Delete loopback interface aggregate net_interface: aggregate: - - { name: Loopback9, state: absent } - - { name: Loopback10, state: absent } - state: present + - name: Loopback9 + - name: Loopback10 + state: absent authorize: yes provider: "{{ cli }}" register: result @@ -288,9 +244,9 @@ - name: Delete loopback interface aggregate (idempotent) net_interface: aggregate: - - { name: Loopback9, state: absent } - - { name: Loopback10, state: absent } - state: present + - name: Loopback9 + - name: Loopback10 + state: absent authorize: yes provider: "{{ cli }}" register: result @@ -299,4 +255,4 @@ that: - 'result.changed == false' -- debug: msg="END net_interface ios/basic.yaml" +- debug: msg="END net_interface cli/basic.yaml" diff --git a/test/integration/targets/net_interface/tests/iosxr/basic.yaml b/test/integration/targets/net_interface/tests/iosxr/basic.yaml index 58607ecf0f6..3ca0cfc687d 100644 --- a/test/integration/targets/net_interface/tests/iosxr/basic.yaml +++ b/test/integration/targets/net_interface/tests/iosxr/basic.yaml @@ -72,28 +72,16 @@ - '"interface GigabitEthernet0/0/0/2 duplex full" in result.commands' - '"interface GigabitEthernet0/0/0/2 mtu 256" in result.commands' -- name: Delete interface parameters +- name: Change interface parameters (idempotent) net_interface: name: GigabitEthernet0/0/0/2 + description: test-interface-1 + speed: 10 + duplex: full + mtu: 256 state: present provider: "{{ cli }}" register: result - -- assert: - that: - - 'result.changed == true' - - '"interface GigabitEthernet0/0/0/2 description configured by iosxr_interface" in result.commands' - - '"no interface GigabitEthernet0/0/0/2 speed 10" in result.commands' - - '"no interface GigabitEthernet0/0/0/2 duplex full" in result.commands' - - '"no interface GigabitEthernet0/0/0/2 mtu 256" in result.commands' - -- name: Delete interface parameters (idempotent) - net_interface: - name: GigabitEthernet0/0/0/2 - state: present - provider: "{{ cli }}" - register: result - - assert: that: - 'result.changed == false' @@ -135,11 +123,20 @@ - 'result.changed == true' - '"interface GigabitEthernet0/0/0/3 description test-interface-initial" in result.commands' +- name: Delete interface aggregate (setup) + net_interface: + aggregate: + - name: GigabitEthernet0/0/0/3 + - name: GigabitEthernet0/0/0/2 + state: absent + - name: Add interface aggregate net_interface: aggregate: - - { name: GigabitEthernet0/0/0/3, speed: 10, duplex: half, mtu: 256, description: test-interface-1 } - - { name: GigabitEthernet0/0/0/2, speed: 100, duplex: full, mtu: 516, description: test-interface-2 } + - { name: GigabitEthernet0/0/0/3, mtu: 256, description: test-interface-1 } + - { name: GigabitEthernet0/0/0/2, mtu: 516, description: test-interface-2 } + speed: 100 + duplex: full state: present provider: "{{ cli }}" register: result @@ -147,20 +144,23 @@ - assert: that: - 'result.changed == true' - - '"interface GigabitEthernet0/0/0/3 speed 10" in result.commands' + - '"interface GigabitEthernet0/0/0/3 speed 100" in result.commands' - '"interface GigabitEthernet0/0/0/3 description test-interface-1" in result.commands' - - '"interface GigabitEthernet0/0/0/3 duplex half" in result.commands' + - '"interface GigabitEthernet0/0/0/3 duplex full" in result.commands' - '"interface GigabitEthernet0/0/0/3 mtu 256" in result.commands' - '"interface GigabitEthernet0/0/0/2 speed 100" in result.commands' - '"interface GigabitEthernet0/0/0/2 description test-interface-2" in result.commands' - '"interface GigabitEthernet0/0/0/2 duplex full" in result.commands' - '"interface GigabitEthernet0/0/0/2 mtu 516" in result.commands' + - name: Add interface aggregate (idempotent) net_interface: aggregate: - - { name: GigabitEthernet0/0/0/3, speed: 10, duplex: half, mtu: 256, description: test-interface-1 } - - { name: GigabitEthernet0/0/0/2, speed: 100, duplex: full, mtu: 516, description: test-interface-2 } + - { name: GigabitEthernet0/0/0/3, mtu: 256, description: test-interface-1 } + - { name: GigabitEthernet0/0/0/2, mtu: 516, description: test-interface-2 } + speed: 100 + duplex: full state: present provider: "{{ cli }}" register: result @@ -169,33 +169,12 @@ that: - 'result.changed == false' - -- name: Change interface parameters in aggregate - net_interface: - aggregate: - - { name: GigabitEthernet0/0/0/3 } - - { name: GigabitEthernet0/0/0/2 } - state: present - provider: "{{ cli }}" - register: result - -- assert: - that: - - 'result.changed == true' - - '"no interface GigabitEthernet0/0/0/3 speed 10" in result.commands' - - '"interface GigabitEthernet0/0/0/3 description configured by iosxr_interface" in result.commands' - - '"no interface GigabitEthernet0/0/0/3 duplex half" in result.commands' - - '"no interface GigabitEthernet0/0/0/3 mtu 256" in result.commands' - - '"no interface GigabitEthernet0/0/0/2 speed 100" in result.commands' - - '"interface GigabitEthernet0/0/0/2 description configured by iosxr_interface" in result.commands' - - '"no interface GigabitEthernet0/0/0/2 duplex full" in result.commands' - - '"no interface GigabitEthernet0/0/0/2 mtu 516" in result.commands' - - name: Disable interface aggregate net_interface: aggregate: - - { name: GigabitEthernet0/0/0/3, enabled: False } - - { name: GigabitEthernet0/0/0/2, enabled: False } + - name: GigabitEthernet0/0/0/3 + - name: GigabitEthernet0/0/0/2 + enabled: False state: present provider: "{{ cli }}" register: result @@ -209,8 +188,9 @@ - name: Enable interface aggregate net_interface: aggregate: - - { name: GigabitEthernet0/0/0/3, enabled: True } - - { name: GigabitEthernet0/0/0/2, enabled: True } + - name: GigabitEthernet0/0/0/3 + - name: GigabitEthernet0/0/0/2 + enabled: True state: present provider: "{{ cli }}" register: result @@ -221,11 +201,22 @@ - '"no interface GigabitEthernet0/0/0/3 shutdown" in result.commands' - '"no interface GigabitEthernet0/0/0/2 shutdown" in result.commands' +- name: interface aggregate (setup) + net_interface: + aggregate: + - name: GigabitEthernet0/0/0/4 + - name: GigabitEthernet0/0/0/5 + description: test-interface-initial + provider: "{{ cli }}" + register: result + - name: Create interface aggregate net_interface: aggregate: - - { name: GigabitEthernet0/0/0/4 } - - { name: GigabitEthernet0/0/0/5 } + - name: GigabitEthernet0/0/0/4 + description: test_interface_1 + - name: GigabitEthernet0/0/0/5 + description: test_interface_2 state: present provider: "{{ cli }}" register: result @@ -233,15 +224,15 @@ - assert: that: - 'result.changed == true' - - '"interface GigabitEthernet0/0/0/4 description configured by iosxr_interface" in result.commands' - - '"interface GigabitEthernet0/0/0/5 description configured by iosxr_interface" in result.commands' + - '"interface GigabitEthernet0/0/0/4 description test_interface_1" in result.commands' + - '"interface GigabitEthernet0/0/0/5 description test_interface_2" in result.commands' - name: Delete interface aggregate net_interface: aggregate: - - { name: GigabitEthernet0/0/0/4, state: absent } - - { name: GigabitEthernet0/0/0/5, state: absent } - state: present + - name: GigabitEthernet0/0/0/4 + - name: GigabitEthernet0/0/0/5 + state: absent provider: "{{ cli }}" register: result @@ -254,9 +245,9 @@ - name: Delete interface aggregate (idempotent) net_interface: aggregate: - - { name: GigabitEthernet0/0/0/4, state: absent } - - { name: GigabitEthernet0/0/0/5, state: absent } - state: present + - name: GigabitEthernet0/0/0/4 + - name: GigabitEthernet0/0/0/5 + state: absent provider: "{{ cli }}" register: result diff --git a/test/integration/targets/net_interface/tests/iosxr/intent.yaml b/test/integration/targets/net_interface/tests/iosxr/intent.yaml index 272fcb5cc24..909b0e22a21 100644 --- a/test/integration/targets/net_interface/tests/iosxr/intent.yaml +++ b/test/integration/targets/net_interface/tests/iosxr/intent.yaml @@ -1,9 +1,10 @@ --- -- debug: msg="START net_interface cli/intent.yaml" +- debug: msg="START net_interface iosxr/intent.yaml" - name: Setup (interface is up) net_interface: name: GigabitEthernet0/0/0/5 + description: test_interface_5 enabled: True state: present provider: "{{ cli }}" diff --git a/test/integration/targets/net_linkagg/tests/junos/basic.yaml b/test/integration/targets/net_linkagg/tests/junos/basic.yaml index 53b4c2bd8dc..6133221bf77 100644 --- a/test/integration/targets/net_linkagg/tests/junos/basic.yaml +++ b/test/integration/targets/net_linkagg/tests/junos/basic.yaml @@ -37,7 +37,6 @@ - "'4' in config.xml" - "'ae0' in config.xml" - "'' in config.xml" - - "'configured by junos_linkagg' in config.xml" - name: configure linkagg (idempotent) net_linkagg: