junipernetworks.junos.junos_routing_instances модуль — Управление маршрутными экземплярами на устройствах Junos.
Примечание
Этот модуль является частью коллекции junipernetworks.junos (версия 8.0.0).
Эта коллекция, возможно, уже установлена, если вы используете пакет ansible. Она не включена в ansible-core. Чтобы проверить установку, выполните ansible-galaxy collection list.
Для установки используйте: ansible-galaxy collection install junipernetworks.junos. Для использования этого модуля необходимы дополнительные требования. Подробности см. в разделе Требования.
Чтобы использовать его в книге задач, укажите: junipernetworks.junos.junos_routing_instances.
Новинка в junipernetworks.junos 2.1.0
Описание
- Управление маршрутными экземплярами на сетевых устройствах Junos.
Псевдонимы: routing_instances
Требования
Ниже перечислены требования, которые должны быть выполнены на хосте, на котором будет выполняться этот модуль.
- ncclient (>=v0.6.4)
- xmltodict (>=0.12.0)
Параметры
Параметр | Комментарии |
|---|---|
config list / elements=dictionary | Предоставленный список конфигурации маршрутного экземпляра. |
|
connector_id_advertise boolean |
Объявление атрибута connector-id. Варианты:
|
|
description string |
Укажите текстовое описание маршрутного экземпляра. |
|
egress_protection dictionary |
Словарь защиты исходящего экземпляра. |
|
context_identifier string |
Укажите идентификатор контекста. |
|
protector boolean |
Включить функцию Edge Protector для этой VPN. Варианты:
|
|
instance_role string |
Основная роль маршрутизатора L2Backhaul-vpn. Варианты:
|
|
interfaces list / elements=dictionary |
Имя интерфейса для этого маршрутного экземпляра. |
|
name string |
Укажите имя интерфейса. |
|
protect_interface string |
Укажите имя защищенного интерфейса. |
|
l2vpn_id string |
Идентификатор VPN уровня 2 для этого экземпляра. |
|
name string |
Укажите имя маршрутного экземпляра. |
|
no_irb_layer_2_copy boolean |
Отключить передачу копии пакетов уровня 2 маршрутного интерфейса irb. Варианты:
|
|
no_local_switching boolean |
Отключить нормализацию идентификатора VLAN для интерфейсов. Варианты:
|
|
no_normalization boolean |
Отключить нормализацию идентификатора VLAN для интерфейсов. Варианты:
|
|
no_vrf_advertise boolean |
Отключить нормализацию идентификатора VLAN для интерфейсов. Варианты:
|
|
no_vrf_propagate_ttl boolean |
Отключить распространение TTL из IP в MPLS (при push) и из MPLS в IP (при pop). Варианты:
|
|
qualified_bum_pruning_mode boolean |
Включить обрезку BUM для экземпляра VPLS. Варианты:
|
|
route_distinguisher string |
Дискриминатор маршрута для этого экземпляра |
|
routing_interface list / elements=string |
Имя маршрутного интерфейса для этого маршрутного экземпляра. |
|
type string |
Укажите тип экземпляра. Варианты:
|
|
vrf_exports список / элементы=строка |
Политика экспорта для RIB экземпляров VRF. |
|
vrf_imports список / элементы=строка |
Политика импорта для RIB экземпляров VRF. |
running_config строка | Этот параметр используется только со состоянием parsed. Значение этого параметра должно соответствовать выводу с устройства Junos, полученному при выполнении команды show routing-instances. Состояние parsed считывает конфигурацию из |
state строка | Состояние, в котором должна быть оставлена конфигурация. Варианты:
|
Примечания
Примечание
- Для данного модуля необходимо включить системную службу netconf на управляемом устройстве.
- Данный модуль работает с подключением
netconf. См. Параметры платформы Junos OS. - Тестировалось на JunOS v18.4R1
Примеры
# Using merged
#
# Before state
# ------------
#
# admin# show routing-instances
#
# [edit]
# vagrant@vsrx# show policy-options
# policy-statement test-policy {
# term t1 {
# then reject;
# }
# }
# policy-statement test-policy-1 {
# term t1 {
# then reject;
# }
# }
- name: Merge Junos BGP address family configuration
junipernetworks.junos.junos_routing_instances:
config:
- name: "test"
type: "vrf"
route_distinguisher: "10.58.255.1:37"
vrf_imports:
- "test-policy"
vrf_exports:
- "test-policy"
- "test-policy-1"
interfaces:
- name: "sp-0/0/0.0"
- name: "gr-0/0/0.0"
connector_id_advertise: true
- name: "forwardinst"
type: "forwarding"
description: "Configured by Ansible Content Team"
state: merged
#
# -------------------------
# Module Execution Result
# -------------------------
#
# After state
# -----------
#
# admin# show routing-instances
# forwardinst {
# description "Configured by Ansible Content Team";
# instance-type forwarding;
# }
# test {
# instance-type vrf;
# interface gr-0/0/0.0; ## 'gr-0/0/0.0' is not defined
# interface sp-0/0/0.0; ## 'sp-0/0/0.0' is not defined
# route-distinguisher 10.58.255.1:37;
# vrf-import test-policy;
# vrf-export [ test-policy test-policy-1 ];
# connector-id-advertise;
# }
#
# Using gathered
#
# Before state
# ------------
#
# admin# show routing-instances
#
# [edit]
# admin# show routing-instances
# forwardinst {
# description "Configured by Ansible Content Team";
# instance-type forwarding;
# }
# test {
# instance-type vrf;
# interface gr-0/0/0.0; ## 'gr-0/0/0.0' is not defined
# interface sp-0/0/0.0; ## 'sp-0/0/0.0' is not defined
# route-distinguisher 10.58.255.1:37;
# vrf-import test-policy;
# vrf-export [ test-policy test-policy-1 ];
# connector-id-advertise;
# }
- name: Gather Junos routing-instances
junipernetworks.junos.junos_routing_instances:
state: gathered
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
# "gathered": [
# {
# "description": "Configured by Ansible Content Team",
# "name": "forwardinst",
# "type": "forwarding"
# },
# {
# "connector_id_advertise": true,
# "interfaces": [
# {
# "name": "gr-0/0/0.0"
# },
# {
# "name": "sp-0/0/0.0"
# }
# ],
# "name": "test",
# "route_distinguisher": "10.58.255.1:37",
# "type": "vrf",
# "vrf_exports": [
# "test-policy",
# "test-policy-1"
# ],
# "vrf_imports": [
# "test-policy"
# ]
# }
# ]
#
# Using replaced
#
# Before state
# ------------
#
# admin# show routing-instances
# forwardinst {
# description "Configured by Ansible Content Team";
# instance-type forwarding;
# }
# test {
# instance-type vrf;
# interface gr-0/0/0.0; ## 'gr-0/0/0.0' is not defined
# interface sp-0/0/0.0; ## 'sp-0/0/0.0' is not defined
# route-distinguisher 10.58.255.1:37;
# vrf-import test-policy;
# vrf-export [ test-policy test-policy-1 ];
# connector-id-advertise;
# }
- name: Replace existing Junos routing instance config with provided config
junipernetworks.junos.junos_routing_instances:
config:
address_family:
- name: "test"
type: "vrf"
route_distinguisher: "10.57.255.1:37"
vrf_imports:
- "test-policy"
vrf_exports:
- "test-policy"
interfaces:
- name: "sp-0/0/0.0"
- name: "gr-0/0/0.0"
connector_id_advertise: false
description: "Configured by Ansible Content Team"
state: replaced
# After state
# -----------
#
# admin@vsrx# show routing-instances
# forwardinst {
# description "Configured by Ansible Content Team";
# instance-type forwarding;
# }
# test {
# description "Configured by Ansible Content Team";
# instance-type vrf;
# interface gr-0/0/0.0; ## 'gr-0/0/0.0' is not defined
# interface sp-0/0/0.0; ## 'sp-0/0/0.0' is not defined
# route-distinguisher 10.57.255.1:37;
# vrf-import test-policy;
# vrf-export test-policy;
# }
# Using overridden
#
# Before state
# ------------
#
# admin@vsrx# show routing-instances
# forwardinst {
# description "Configured by Ansible Content Team";
# instance-type forwarding;
# }
# test {
# description "Configured by Ansible Content Team";
# instance-type vrf;
# interface gr-0/0/0.0; ## 'gr-0/0/0.0' is not defined
# interface sp-0/0/0.0; ## 'sp-0/0/0.0' is not defined
# route-distinguisher 10.57.255.1:37;
# vrf-import test-policy;
# vrf-export test-policy;
# }
- name: Override Junos routing-instances configuration
junipernetworks.junos.junos_routing_instances:
config:
- name: "test"
type: "vrf"
route_distinguisher: "10.58.255.1:37"
vrf_imports:
- "test-policy"
vrf_exports:
- "test-policy"
- "test-policy-1"
interfaces:
- name: "sp-0/0/0.0"
- name: "gr-0/0/0.0"
connector_id_advertise: true
- name: "forwardinst"
type: "forwarding"
description: "Configured by Ansible Content Team"
- name: "vtest1"
type: "virtual-router"
state: overridden
# After state
# -----------
#
# admin@vsrx# show routing-instances
# forwardinst {
# description "Configured by Ansible Content Team";
# instance-type forwarding;
# }
# test {
# instance-type vrf;
# interface gr-0/0/0.0; ## 'gr-0/0/0.0' is not defined
# interface sp-0/0/0.0; ## 'sp-0/0/0.0' is not defined
# route-distinguisher 10.58.255.1:37;
# vrf-import test-policy;
# vrf-export [ test-policy test-policy-1 ];
# connector-id-advertise;
# }
# vtest1 {
# instance-type virtual-router;
# }
# Using deleted
#
# Before state
# ------------
#
# admin@vsrx# show routing-instances
# forwardinst {
# description "Configured by Ansible Content Team";
# instance-type forwarding;
# }
# test {
# instance-type vrf;
# interface gr-0/0/0.0; ## 'gr-0/0/0.0' is not defined
# interface sp-0/0/0.0; ## 'sp-0/0/0.0' is not defined
# route-distinguisher 10.58.255.1:37;
# vrf-import test-policy;
# vrf-export [ test-policy test-policy-1 ];
# connector-id-advertise;
# }
- name: Delete provided junos routing-instamce
junipernetworks.junos.junos_routing_instances:
config:
- name: "test"
state: deleted
# After state
# -----------
#
# admin@vsrx# show routing-instances
# forwardinst {
# description "Configured by Ansible Content Team";
# instance-type forwarding;
# }
# Using deleted without config
#
# Before state
# ------------
#
# admin@vsrx# show routing-instances
# forwardinst {
# description "Configured by Ansible Content Team";
# instance-type forwarding;
# }
# test {
# instance-type vrf;
# interface gr-0/0/0.0; ## 'gr-0/0/0.0' is not defined
# interface sp-0/0/0.0; ## 'sp-0/0/0.0' is not defined
# route-distinguisher 10.58.255.1:37;
# vrf-import test-policy;
# vrf-export [ test-policy test-policy-1 ];
# connector-id-advertise;
# }
# vtest1 {
# instance-type virtual-router;
# }
- name: Delete complete Junos routing-instances config
junipernetworks.junos.junos_routing_instances:
config:
state: deleted
# After state
# -----------
#
# admin@vsrx# show routing-instances
#
# [edit]
- name: Gather Junos BGP address family config
junipernetworks.junos.junos_routing_instances:
config:
state: gathered
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
# "gathered": {
# "address_family": [
# {
# "af_type": [
# {
# "accepted_prefix_limit": {
# "idle_timeout_value": 2001,
# "limit_threshold": 98,
# "maximum": 20
# },
# "damping": true,
# "defer_initial_multipath_build": {
# "maximum_delay": 2
# },
# "type": "signaling"
# }
# ],
# "afi": "evpn"
# },
# {
# "af_type": [
# {
# "accepted_prefix_limit": {
# "idle_timeout_value": 2000,
# "limit_threshold": 99,
# "maximum": 20
# },
# "damping": true,
# "defer_initial_multipath_build": {
# "maximum_delay": 2
# },
# "delay_route_advertisements": {
# "max_delay_route_age": 20,
# "max_delay_routing_uptime": 32000,
# "min_delay_inbound_convergence": 32000,
# "min_delay_routing_uptime": 23000
# },
# "graceful_restart_forwarding_state_bit": "from-fib",
# "type": "any"
# },
# {
# "legacy_redirect_ip_action": {
# "receive": true,
# "send": true
# },
# "loops": 4,
# "no_install": true,
# "output_queue_priority_expedited": true,
# "secondary_independent_resolution": true,
# "type": "flow"
# },
# {
# "entropy_label": {
# "no_next_hop_validation": true
# },
# "explicit_null": {
# "connected_only": true
# },
# "per_group_label": true,
# "per_prefix_label": true,
# "prefix_limit": {
# "forever": true,
# "limit_threshold": 99,
# "maximum": 20
# },
# "resolve_vpn": true,
# "rib": "inet.3",
# "route_refresh_priority_priority": 3,
# "type": "labeled-unicast"
# },
# {
# "extended_nexthop": true,
# "extended_nexthop_color": true,
# "local_ipv4_address": "9.9.9.9",
# "type": "unicast"
# }
# ],
# "afi": "inet"
# }
# ]
# }
#
# Using parsed
# parsed.cfg
# ------------
# <?xml version="1.0" encoding="UTF-8"?>
# <rpc-reply message-id="urn:uuid:0cadb4e8-5bba-47f4-986e-72906227007f">
# <configuration changed-seconds="1590139550" changed-localtime="2020-05-22 09:25:50 UTC">
# <version>18.4R1-S2.4</version>
# <routing-instances>
# <instance>
# <name>forwardinst</name>
# <description>Configured by Ansible Content Team</description>
# <instance-type>forwarding</instance-type>
# </instance>
# <instance>
# <name>test</name>
# <instance-type>vrf</instance-type>
# <interface>
# <name>gr-0/0/0.0</name>
# </interface>
# <interface>
# <name>sp-0/0/0.0</name>
# </interface>
# <route-distinguisher>
# <rd-type>10.58.255.1:37</rd-type>
# </route-distinguisher>
# <vrf-import>test-policy</vrf-import>
# <vrf-export>test-policy</vrf-export>
# <vrf-export>test-policy-1</vrf-export>
# <connector-id-advertise/>
# </instance>
# </routing-instances>
# </configuration>
# </rpc-reply>
- name: Parse routing instance running config
junipernetworks.junos.junos_routing_instances:
running_config: "{{ lookup('file', './parsed.cfg') }}"
state: parsed
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
#
# "parsed": [
# {
# "description": "Configured by Ansible Content Team",
# "name": "forwardinst",
# "type": "forwarding"
# },
# {
# "connector_id_advertise": true,
# "interfaces": [
# {
# "name": "gr-0/0/0.0"
# },
# {
# "name": "sp-0/0/0.0"
# }
# ],
# "name": "test",
# "route_distinguisher": "10.58.255.1:37",
# "type": "vrf",
# "vrf_exports": [
# "test-policy",
# "test-policy-1"
# ],
# "vrf_imports": [
# "test-policy"
# ]
# }
# ]
#
#
# Using rendered
#
#
- name: Render the xml for provided configuration
junipernetworks.junos.junos_routing_instances:
config:
- name: "test"
type: "vrf"
route_distinguisher: "10.58.255.1:37"
vrf_imports:
- "test-policy"
vrf_exports:
- "test-policy"
- "test-policy-1"
interfaces:
- name: "sp-0/0/0.0"
- name: "gr-0/0/0.0"
connector_id_advertise: true
- name: "forwardinst"
type: "forwarding"
description: "Configured by Ansible Content Team"
state: rendered
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
#
# "rendered": "<nc:routing-instances xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">
# <nc:instance><nc:name>test</nc:name><nc:connector-id-advertise/><nc:instance-type>vrf</nc:instance-type>
# <nc:interface><nc:name>sp-0/0/0.0</nc:name></nc:interface><nc:interface><nc:name>gr-0/0/0.0</nc:name></nc:interface>
# <nc:route-distinguisher><nc:rd-type>10.58.255.1:37</nc:rd-type></nc:route-distinguisher>
# <nc:vrf-import>test-policy</nc:vrf-import><nc:vrf-export>test-policy</nc:vrf-export>
# <nc:vrf-export>test-policy-1</nc:vrf-export></nc:instance>
# <nc:instance><nc:name>forwardinst</nc:name><nc:description>Configured by Ansible Content Team</nc:description>
# <nc:instance-type>forwarding</nc:instance-type></nc:instance></nc:routing-instances>"
Возвращаемые значения
Общие возвращаемые значения описаны здесь, ниже приведены поля, уникальные для данного модуля:
Ключ | Описание |
|---|---|
after список / элементы=строка | Вызов модели конфигурации в результате. Возвращается: при изменении Пример: |
before список / элементы=строка | Конфигурация до вызова модели. Возвращается: всегда Пример: |
commands список / элементы=строка | Набор команд, отправленных на удалённое устройство. Возвращается: всегда Пример: |
Ссылки на коллекцию
© 2012–2018 Michael DeHaan
© 2018–2024 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/junipernetworks/junos/junos_routing_instances_module.html