community.network.exos_l2_interfaces – Управление интерфейсами L2 на устройствах Extreme Networks EXOS.
Примечание
Этот плагин входит в коллекцию community.network (версия 2.0.1).
Для его установки используйте: ansible-galaxy collection install community.network.
Для использования в плейбуке укажите: community.network.exos_l2_interfaces.
Новый в версии 0.2.0: of community.network
Обзор
- Этот модуль обеспечивает декларативное управление интерфейсами L2 на сетевых устройствах Extreme Networks EXOS.
Параметры
| Параметр | Варианты/Значения по умолчанию | Комментарии | ||
|---|---|---|---|---|
| config список / элементы=словарь | Словарь параметров интерфейсов L2 | |||
| access словарь | Команда switchport mode access для настройки интерфейса как порта доступа второго уровня. | |||
| vlan целое число | Настройка заданного VLAN на порту доступа. Используется как идентификатор VLAN доступа. | |||
| name строка / обязательно | Имя интерфейса | |||
| trunk словарь | Команда switchport mode trunk для настройки интерфейса как транкового порта второго уровня. | |||
| native_vlan целое число | VLAN по умолчанию для настройки транкового порта. Используется как идентификатор VLAN по умолчанию для транкового порта. | |||
| trunk_allowed_vlans список / элементы=строка | Список разрешенных VLAN на заданном транковом порте. Это единственные VLAN, которые будут настроены на транковом порте. | |||
| state строка |
| Состояние, в котором должна остаться конфигурация | ||
Примечания
Примечание
- Проверено на EXOS 30.2.1.8
- Этот модуль работает с подключением
httpapi. См. Параметры платформы EXOS
Примеры
# Using deleted
# Before state:
# -------------
# path: /rest/restconf/data/openconfig-interfaces:interfaces/
# method: GET
# data:
# {
# "openconfig-interfaces:interfaces": {
# "interface": [
# {
# "name": "1",
# "openconfig-if-ethernet:ethernet": {
# "openconfig-vlan:switched-vlan": {
# "config": {
# "interface-mode": "ACCESS",
# "access-vlan": 10
# }
# }
# }
# },
# {
# "name": "2",
# "openconfig-if-ethernet:ethernet": {
# "openconfig-vlan:switched-vlan": {
# "config": {
# "interface-mode": "TRUNK",
# "native-vlan": 1,
# "trunk-vlans": [
# 10
# ]
# }
# }
# }
# },
# {
# "name": "3",
# "openconfig-if-ethernet:ethernet": {
# "openconfig-vlan:switched-vlan": {
# "config": {
# "interface-mode": "TRUNK",
# "native-vlan": 10,
# "trunk-vlans": [
# 20,
# 30
# ]
# }
# }
# }
# }
# ]
# }
# }
- name: Delete L2 interface configuration for the given arguments
community.network.exos_l2_interfaces:
config:
- name: '3'
state: deleted
# Module Execution Results:
# -------------------------
#
# "before": [
# {
# "access": {
# "vlan": 10
# },
# "name": "1",
# "trunk": null
# },
# {
# "access": null,
# "name": "2",
# "trunk": {
# "native_vlan": 1,
# "trunk_allowed_vlans": [
# 10
# ]
# }
# },
# {
# "access": null,
# "name": "3",
# "trunk": {
# "native_vlan": 10,
# "trunk_allowed_vlans": [
# 20,
# 30
# ]
# }
# }
# ],
#
# "requests": [
# {
# "data": {
# "openconfig-vlan:config": {
# "access-vlan": 1,
# "interface-mode": "ACCESS"
# }
# }
# "method": "PATCH",
# "path": "rest/restconf/data/openconfig-interfaces:interfaces/interface=3/openconfig-if-ethernet:ethernet/openconfig-vlan:switched-vlan/config"
# }
# ],
#
# "after": [
# {
# "access": {
# "vlan": 10
# },
# "name": "1",
# "trunk": null
# },
# {
# "access": null,
# "name": "2",
# "trunk": {
# "native_vlan": 1,
# "trunk_allowed_vlans": [
# 10
# ]
# }
# },
# {
# "access": {
# "vlan": 1
# },
# "name": "3",
# "trunk": null
# }
# ]
#
# After state:
# -------------
#
# path: /rest/restconf/data/openconfig-interfaces:interfaces/
# method: GET
# data:
# {
# "openconfig-interfaces:interfaces": {
# "interface": [
# {
# "name": "1",
# "openconfig-if-ethernet:ethernet": {
# "openconfig-vlan:switched-vlan": {
# "config": {
# "interface-mode": "ACCESS",
# "access-vlan": 10
# }
# }
# }
# },
# {
# "name": "2",
# "openconfig-if-ethernet:ethernet": {
# "openconfig-vlan:switched-vlan": {
# "config": {
# "interface-mode": "TRUNK",
# "native-vlan": 1,
# "trunk-vlans": [
# 10
# ]
# }
# }
# }
# },
# {
# "name": "3",
# "openconfig-if-ethernet:ethernet": {
# "openconfig-vlan:switched-vlan": {
# "config": {
# "interface-mode": "ACCESS",
# "access-vlan": 1
# }
# }
# }
# }
# ]
# }
# }
# Using deleted without any config passed
#"(NOTE: This will delete all of configured resource module attributes from each configured interface)"
# Before state:
# -------------
# path: /rest/restconf/data/openconfig-interfaces:interfaces/
# method: GET
# data:
# {
# "openconfig-interfaces:interfaces": {
# "interface": [
# {
# "name": "1",
# "openconfig-if-ethernet:ethernet": {
# "openconfig-vlan:switched-vlan": {
# "config": {
# "interface-mode": "ACCESS",
# "access-vlan": 10
# }
# }
# }
# },
# {
# "name": "2",
# "openconfig-if-ethernet:ethernet": {
# "openconfig-vlan:switched-vlan": {
# "config": {
# "interface-mode": "TRUNK",
# "native-vlan": 1,
# "trunk-vlans": [
# 10
# ]
# }
# }
# }
# },
# {
# "name": "3",
# "openconfig-if-ethernet:ethernet": {
# "openconfig-vlan:switched-vlan": {
# "config": {
# "interface-mode": "TRUNK",
# "native-vlan": 10,
# "trunk-vlans": [
# 20,
# 30
# ]
# }
# }
# }
# }
# ]
# }
# }
- name: Delete L2 interface configuration for the given arguments
community.network.exos_l2_interfaces:
state: deleted
# Module Execution Results:
# -------------------------
#
# "before": [
# {
# "access": {
# "vlan": 10
# },
# "name": "1",
# "trunk": null
# },
# {
# "access": null,
# "name": "2",
# "trunk": {
# "native_vlan": 1,
# "trunk_allowed_vlans": [
# 10
# ]
# }
# },
# {
# "access": null,
# "name": "3",
# "trunk": {
# "native_vlan": 10,
# "trunk_allowed_vlans": [
# 20,
# 30
# ]
# }
# }
# ],
#
# "requests": [
# {
# "data": {
# "openconfig-vlan:config": {
# "access-vlan": 1,
# "interface-mode": "ACCESS"
# }
# }
# "method": "PATCH",
# "path": "rest/restconf/data/openconfig-interfaces:interfaces/interface=1/openconfig-if-ethernet:ethernet/openconfig-vlan:switched-vlan/config"
# },
# {
# "data": {
# "openconfig-vlan:config": {
# "access-vlan": 1,
# "interface-mode": "ACCESS"
# }
# }
# "method": "PATCH",
# "path": "rest/restconf/data/openconfig-interfaces:interfaces/interface=2/openconfig-if-ethernet:ethernet/openconfig-vlan:switched-vlan/config"
# },
# {
# "data": {
# "openconfig-vlan:config": {
# "access-vlan": 1,
# "interface-mode": "ACCESS"
# }
# }
# "method": "PATCH",
# "path": "rest/restconf/data/openconfig-interfaces:interfaces/interface=3/openconfig-if-ethernet:ethernet/openconfig-vlan:switched-vlan/config"
# }
# ],
#
# "after": [
# {
# "access": {
# "vlan": 1
# },
# "name": "1",
# "trunk": null
# },
# {
# "access": {
# "vlan": 1
# },
# "name": "2",
# "trunk": null
# },
# {
# "access": {
# "vlan": 1
# },
# "name": "3",
# "trunk": null
# }
# ]
#
# After state:
# -------------
#
# path: /rest/restconf/data/openconfig-interfaces:interfaces/
# method: GET
# data:
# {
# "openconfig-interfaces:interfaces": {
# "interface": [
# {
# "name": "1",
# "openconfig-if-ethernet:ethernet": {
# "openconfig-vlan:switched-vlan": {
# "config": {
# "interface-mode": "ACCESS",
# "access-vlan": 1
# }
# }
# }
# },
# {
# "name": "2",
# "openconfig-if-ethernet:ethernet": {
# "openconfig-vlan:switched-vlan": {
# "config": {
# "interface-mode": "ACCESS",
# "access-vlan": 1
# }
# }
# }
# },
# {
# "name": "3",
# "openconfig-if-ethernet:ethernet": {
# "openconfig-vlan:switched-vlan": {
# "config": {
# "interface-mode": "ACCESS",
# "access-vlan": 1
# }
# }
# }
# }
# ]
# }
# }
# Using merged
# Before state:
# -------------
# path: /rest/restconf/data/openconfig-interfaces:interfaces/
# method: GET
# data:
# {
# "openconfig-interfaces:interfaces": {
# "interface": [
# {
# "name": "1",
# "openconfig-if-ethernet:ethernet": {
# "openconfig-vlan:switched-vlan": {
# "config": {
# "interface-mode": "ACCESS",
# "access-vlan": 1
# },
# }
# }
# },
# {
# "name": "2",
# "openconfig-if-ethernet:ethernet": {
# "openconfig-vlan:switched-vlan": {
# "config": {
# "interface-mode": "ACCESS",
# "access-vlan": 1
# },
# }
# }
# },
# {
# "name": "3",
# "openconfig-if-ethernet:ethernet": {
# "openconfig-vlan:switched-vlan": {
# "config": {
# "interface-mode": "ACCESS",
# "access-vlan": 1
# },
# }
# }
# },
# ]
# }
# }
- name: Merge provided configuration with device configuration
community.network.exos_l2_interfaces:
config:
- access:
vlan: 10
name: '1'
- name: '2'
trunk:
trunk_allowed_vlans: 10
- name: '3'
trunk:
native_vlan: 10
trunk_allowed_vlans: 20
state: merged
# Module Execution Results:
# -------------------------
#
# "before": [
# {
# "access": {
# "vlan": 1
# },
# "name": "1",
# "trunk": null
# },
# {
# "access": {
# "vlan": 1
# },
# "name": "2",
# "trunk": null
# },
# {
# "access": {
# "vlan": 1
# },
# "name": "3",
# "trunk": null
# }
# ],
#
# "requests": [
# {
# "data": {
# "openconfig-vlan:config": {
# "access-vlan": 10,
# "interface-mode": "ACCESS"
# }
# }
# "method": "PATCH",
# "path": "rest/restconf/data/openconfig-interfaces:interfaces/interface=1/openconfig-if-ethernet:ethernet/openconfig-vlan:switched-vlan/config"
# },
# {
# "data": {
# "openconfig-vlan:config": {
# "trunk-vlans": [10],
# "interface-mode": "TRUNK"
# }
# }
# "method": "PATCH",
# "path": "rest/restconf/data/openconfig-interfaces:interfaces/interface=2/openconfig-if-ethernet:ethernet/openconfig-vlan:switched-vlan/config"
# },
# {
# "data": {
# "openconfig-vlan:config": {
# "native-vlan": 10,
# "trunk-vlans": [20],
# "interface-mode": "TRUNK"
# }
# }
# "method": "PATCH",
# "path": "rest/restconf/data/openconfig-interfaces:interfaces/interface=3/openconfig-if-ethernet:ethernet/openconfig-vlan:switched-vlan/config"
# }
# ],
#
# "after": [
# {
# "access": {
# "vlan": 10
# },
# "name": "1",
# "trunk": null
# },
# {
# "access": null,
# "name": "2",
# "trunk": {
# "native_vlan": 1,
# "trunk_allowed_vlans": [
# 10
# ]
# }
# },
# {
# "access": null,
# "name": "3",
# "trunk": {
# "native_vlan": 10,
# "trunk_allowed_vlans": [
# 20
# ]
# }
# }
# ]
#
# After state:
# -------------
#
# path: /rest/restconf/data/openconfig-interfaces:interfaces/
# method: GET
# data:
# {
# "openconfig-interfaces:interfaces": {
# "interface": [
# {
# "name": "1",
# "openconfig-if-ethernet:ethernet": {
# "openconfig-vlan:switched-vlan": {
# "config": {
# "interface-mode": "ACCESS",
# "access-vlan": 10
# }
# }
# }
# },
# {
# "name": "2",
# "openconfig-if-ethernet:ethernet": {
# "openconfig-vlan:switched-vlan": {
# "config": {
# "interface-mode": "TRUNK",
# "native-vlan": 1,
# "trunk-vlans": [
# 10
# ]
# }
# }
# }
# },
# {
# "name": "3",
# "openconfig-if-ethernet:ethernet": {
# "openconfig-vlan:switched-vlan": {
# "config": {
# "interface-mode": "TRUNK",
# "native-vlan": 10,
# "trunk-vlans": [
# 20
# ]
# }
# }
# }
# },
# ]
# }
# }
# Using overridden
# Before state:
# -------------
# path: /rest/restconf/data/openconfig-interfaces:interfaces/
# method: GET
# data:
# {
# "openconfig-interfaces:interfaces": {
# "interface": [
# {
# "name": "1",
# "openconfig-if-ethernet:ethernet": {
# "openconfig-vlan:switched-vlan": {
# "config": {
# "interface-mode": "ACCESS",
# "access-vlan": 10
# }
# }
# }
# },
# {
# "name": "2",
# "openconfig-if-ethernet:ethernet": {
# "openconfig-vlan:switched-vlan": {
# "config": {
# "interface-mode": "TRUNK",
# "native-vlan": 1,
# "trunk-vlans": [
# 10
# ]
# }
# }
# }
# },
# {
# "name": "3",
# "openconfig-if-ethernet:ethernet": {
# "openconfig-vlan:switched-vlan": {
# "config": {
# "interface-mode": "TRUNK",
# "native-vlan": 10,
# "trunk-vlans": [
# 20,
# 30
# ]
# }
# }
# }
# }
# ]
# }
# }
- name: Overrride device configuration of all L2 interfaces with provided configuration
community.network.exos_l2_interfaces:
config:
- access:
vlan: 10
name: '2'
state: overridden
# Module Execution Results:
# -------------------------
#
# "before": [
# {
# "access": {
# "vlan": 10
# },
# "name": "1",
# "trunk": null
# },
# {
# "access": null,
# "name": "2",
# "trunk": {
# "native_vlan": 1,
# "trunk_allowed_vlans": [
# 10
# ]
# }
# },
# {
# "access": null,
# "name": "3",
# "trunk": {
# "native_vlan": 10,
# "trunk_allowed_vlans": [
# 20,
# 30
# ]
# }
# }
# ],
#
# "requests": [
# {
# "data": {
# "openconfig-vlan:config": {
# "access-vlan": 1,
# "interface-mode": "ACCESS"
# }
# }
# "method": "PATCH",
# "path": "rest/restconf/data/openconfig-interfaces:interfaces/interface=1/openconfig-if-ethernet:ethernet/openconfig-vlan:switched-vlan/config"
# },
# {
# "data": {
# "openconfig-vlan:config": {
# "access-vlan": 10,
# "interface-mode": "ACCESS"
# }
# }
# "method": "PATCH",
# "path": "rest/restconf/data/openconfig-interfaces:interfaces/interface=2/openconfig-if-ethernet:ethernet/openconfig-vlan:switched-vlan/config"
# }
# {
# "data": {
# "openconfig-vlan:config": {
# "access-vlan": 1,
# "interface-mode": "ACCESS"
# }
# }
# "method": "PATCH",
# "path": "rest/restconf/data/openconfig-interfaces:interfaces/interface=3/openconfig-if-ethernet:ethernet/openconfig-vlan:switched-vlan/config"
# }
# ],
#
# "after": [
# {
# "access": {
# "vlan": 1
# },
# "name": "1",
# "trunk": null
# },
# {
# "access": {
# "vlan": 10
# },
# "name": "2",
# "trunk": null
# },
# {
# "access": {
# "vlan": 1
# },
# "name": "3",
# "trunk": null
# }
# ]
#
# After state:
# -------------
#
# path: /rest/restconf/data/openconfig-interfaces:interfaces/
# method: GET
# data:
# {
# "openconfig-interfaces:interfaces": {
# "interface": [
# {
# "name": "1",
# "openconfig-if-ethernet:ethernet": {
# "openconfig-vlan:switched-vlan": {
# "config": {
# "interface-mode": "ACCESS",
# "access-vlan": 1
# }
# }
# }
# },
# {
# "name": "2",
# "openconfig-if-ethernet:ethernet": {
# "openconfig-vlan:switched-vlan": {
# "config": {
# "interface-mode": "ACCESS",
# "access-vlan": 10
# }
# }
# }
# },
# {
# "name": "3",
# "openconfig-if-ethernet:ethernet": {
# "openconfig-vlan:switched-vlan": {
# "config": {
# "interface-mode": "ACCESS",
# "access-vlan": 1
# }
# }
# }
# }
# ]
# }
# }
# Using replaced
# Before state:
# -------------
# path: /rest/restconf/data/openconfig-interfaces:interfaces/
# method: GET
# data:
# {
# "openconfig-interfaces:interfaces": {
# "interface": [
# {
# "name": "1",
# "openconfig-if-ethernet:ethernet": {
# "openconfig-vlan:switched-vlan": {
# "config": {
# "interface-mode": "ACCESS",
# "access-vlan": 10
# }
# }
# }
# },
# {
# "name": "2",
# "openconfig-if-ethernet:ethernet": {
# "openconfig-vlan:switched-vlan": {
# "config": {
# "interface-mode": "ACCESS",
# "access-vlan": 20
# }
# }
# }
# },
# {
# "name": "3",
# "openconfig-if-ethernet:ethernet": {
# "openconfig-vlan:switched-vlan": {
# "config": {
# "interface-mode": "TRUNK",
# "native-vlan": 1,
# "trunk-vlans": [
# 10
# ]
# }
# }
# }
# }
# ]
# }
# }
- name: Replace device configuration of listed L2 interfaces with provided configuration
community.network.exos_l2_interfaces:
config:
- access:
vlan: 20
name: '1'
- name: '2'
trunk:
trunk_allowed_vlans: 10
- name: '3'
trunk:
native_vlan: 10
trunk_allowed_vlan: 20,30
state: replaced
# Module Execution Results:
# -------------------------
#
# "before": [
# {
# "access": {
# "vlan": 10
# },
# "name": "1",
# "trunk": null
# },
# {
# "access": {
# "vlan": 20
# },
# "name": "2",
# "trunk": null
# },
# {
# "access": null,
# "name": "3",
# "trunk": {
# "native_vlan": 1,
# "trunk_allowed_vlans": [
# 10
# ]
# }
# }
# ],
#
# "requests": [
# {
# "data": {
# "openconfig-vlan:config": {
# "access-vlan": 20,
# "interface-mode": "ACCESS"
# }
# }
# "method": "PATCH",
# "path": "rest/restconf/data/openconfig-interfaces:interfaces/interface=1/openconfig-if-ethernet:ethernet/openconfig-vlan:switched-vlan/config"
# },
# {
# "data": {
# "openconfig-vlan:config": {
# "trunk-vlans": [10],
# "interface-mode": "TRUNK"
# }
# }
# "method": "PATCH",
# "path": "rest/restconf/data/openconfig-interfaces:interfaces/interface=2/openconfig-if-ethernet:ethernet/openconfig-vlan:switched-vlan/config"
# },
# {
# "data": {
# "openconfig-vlan:config": {
# "native-vlan": 10,
# "trunk-vlans": [20, 30]
# "interface-mode": "TRUNK"
# }
# }
# "method": "PATCH",
# "path": "rest/restconf/data/openconfig-interfaces:interfaces/interface=3/openconfig-if-ethernet:ethernet/openconfig-vlan:switched-vlan/config"
# }
# ],
#
# "after": [
# {
# "access": {
# "vlan": 20
# },
# "name": "1",
# "trunk": null
# },
# {
# "access": null,
# "name": "2",
# "trunk": {
# "native_vlan": null,
# "trunk_allowed_vlans": [
# 10
# ]
# }
# },
# {
# "access": null,
# "name": "3",
# "trunk": {
# "native_vlan": 10,
# "trunk_allowed_vlans": [
# 20,
# 30
# ]
# }
# }
# ]
#
# After state:
# -------------
#
# path: /rest/restconf/data/openconfig-interfaces:interfaces/
# method: GET
# data:
# {
# "openconfig-interfaces:interfaces": {
# "interface": [
# {
# "name": "1",
# "openconfig-if-ethernet:ethernet": {
# "openconfig-vlan:switched-vlan": {
# "config": {
# "interface-mode": "ACCESS",
# "access-vlan": 20
# }
# }
# }
# },
# {
# "name": "2",
# "openconfig-if-ethernet:ethernet": {
# "openconfig-vlan:switched-vlan": {
# "config": {
# "interface-mode": "TRUNK",
# "trunk-vlans": [
# 10
# ]
# }
# }
# }
# },
# {
# "name": "3",
# "openconfig-if-ethernet:ethernet": {
# "openconfig-vlan:switched-vlan": {
# "config": {
# "interface-mode": "TRUNK",
# "native-vlan": 10,
# "trunk-vlans": [
# 20,
# 30
# ]
# }
# }
# }
# }
# ]
# }
# }
Возвращаемые значения
Общие возвращаемые значения документированы здесь, следующие поля уникальны для данного модуля:
| Ключ | Возвращаемое значение | Описание |
|---|---|---|
| after список / элементы=строка | при изменении | Результат вызова модели конфигурации. Пример: Возвращаемая конфигурация всегда будет в том же формате, что и параметры выше. |
| before список / элементы=строка | всегда | Конфигурация до вызова модели. Пример: Возвращаемая конфигурация всегда будет в том же формате, что и параметры выше. |
| requests список / элементы=строка | всегда | Набор запросов, отправленных на удаленное устройство. Пример: [{'data': '...', 'method': '...', 'path': '...'}, {'data': '...', 'method': '...', 'path': '...'}, {'data': '...', 'method': '...', 'path': '...'}] |
Авторы
- Jayalakshmi Viswanathan (@jayalakshmiV)
© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.11/collections/community/network/exos_l2_interfaces_module.html