add a new module to configure isis on isis-view. (#63720)
* add a new module. * update docs. * update docs. * update again. * add __future__ * update docs, some args type * update docs, some args type * add integration test. * add unittest. * update for shippabel. * update for syntax error. * Update setup.yaml * Update setup.yaml * Update cleanup.yaml * update for review. * add notes.
This commit is contained in:
parent
2cf079bc8f
commit
cc5132a8ba
21 changed files with 3568 additions and 0 deletions
1956
lib/ansible/modules/network/cloudengine/ce_is_is_view.py
Normal file
1956
lib/ansible/modules/network/cloudengine/ce_is_is_view.py
Normal file
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
testcase: "[^_].*"
|
||||
test_items: []
|
2
test/integration/targets/ce_is_is_view/tasks/main.yaml
Normal file
2
test/integration/targets/ce_is_is_view/tasks/main.yaml
Normal file
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
- { include: netconf.yaml, tags: ['netconf'] }
|
17
test/integration/targets/ce_is_is_view/tasks/netconf.yaml
Normal file
17
test/integration/targets/ce_is_is_view/tasks/netconf.yaml
Normal file
|
@ -0,0 +1,17 @@
|
|||
---
|
||||
- name: collect all netconf test cases
|
||||
find:
|
||||
paths: "{{ role_path }}/tests/netconf"
|
||||
patterns: "{{ testcase }}.yaml"
|
||||
use_regex: true
|
||||
connection: local
|
||||
register: test_cases
|
||||
|
||||
- name: set test_items
|
||||
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
|
||||
|
||||
- name: run test case (connection=netconf)
|
||||
include: "{{ test_case_to_run }} ansible_connection=netconf"
|
||||
with_items: "{{ test_items }}"
|
||||
loop_control:
|
||||
loop_var: test_case_to_run
|
|
@ -0,0 +1,21 @@
|
|||
---
|
||||
- debug:
|
||||
msg: "CLEANUP ce_is_is_view, deleted integration tests on connection={{ ansible_connection }}"
|
||||
|
||||
- name: Get lacp config by ce_netconf.
|
||||
ce_netconf:
|
||||
rpc: get
|
||||
cfg_xml: "<config>
|
||||
<isiscomm xmlns=\"http://www.huawei.com/netconf/vrp\" content-version=\"1.0\" format-version=\"1.0\">
|
||||
<isSites>
|
||||
<isSite operation=\"delete\">
|
||||
<instanceId>100</instanceId>
|
||||
<vpnName>_public_</vpnName>
|
||||
<description>ISIS</description>
|
||||
</isSite>
|
||||
</isSites>
|
||||
</isiscomm>
|
||||
</config>"
|
||||
|
||||
- debug:
|
||||
msg: "END CLEANUP ce_is_is_view, deleted integration tests on connection={{ ansible_connection }}"
|
|
@ -0,0 +1,22 @@
|
|||
---
|
||||
- debug:
|
||||
msg: "SETUP ce_is_is_view integration tests on connection={{ ansible_connection }}"
|
||||
# create ISIS 100
|
||||
|
||||
- name: Get lacp config by ce_netconf.
|
||||
ce_netconf:
|
||||
rpc: get
|
||||
cfg_xml: "<config>
|
||||
<isiscomm xmlns=\"http://www.huawei.com/netconf/vrp\" content-version=\"1.0\" format-version=\"1.0\">
|
||||
<isSites>
|
||||
<isSite operation=\"merg\">
|
||||
<instanceId>100</instanceId>
|
||||
<vpnName>_public_</vpnName>
|
||||
<description>ISIS</description>
|
||||
</isSite>
|
||||
</isSites>
|
||||
</isiscomm>
|
||||
</config>"
|
||||
|
||||
- debug:
|
||||
msg: "END SETUP ce_is_is_view integration tests on connection={{ ansible_connection }}"
|
|
@ -0,0 +1,78 @@
|
|||
---
|
||||
- debug:
|
||||
msg: "START ce_is_is_view entity presented integration tests on connection={{ ansible_connection }}"
|
||||
- include_tasks: setup.yaml
|
||||
|
||||
- name: present the provided configuration with the exisiting running configuration
|
||||
ce_is_is_view: &present
|
||||
instance_id: 100
|
||||
netentity: isis_net_entity
|
||||
register: result
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
|
||||
- name: Get basic config by ce_netconf.
|
||||
ce_netconf: &get_config
|
||||
rpc: get
|
||||
cfg_xml: "<filter type=\"subtree\">
|
||||
<isiscomm xmlns=\"http://www.huawei.com/netconf/vrp\" content-version=\"1.0\" format-version=\"1.0\">
|
||||
<isSites>
|
||||
<isSite>
|
||||
<instanceId>100</instanceId>
|
||||
<isNetEntitys>
|
||||
<isNetEntity>
|
||||
<netEntity></netEntity>
|
||||
</isNetEntity>
|
||||
</isNetEntitys>
|
||||
</isSite>
|
||||
</isSites>
|
||||
</isiscomm>
|
||||
</filter>"
|
||||
register: result_xml
|
||||
|
||||
|
||||
- name: present the provided configuration with the existing running configuration (IDEMPOTENT)
|
||||
ce_is_is_view: *present
|
||||
register: repeat
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "repeat.changed == false"
|
||||
- "'<instanceId>100</instanceId>' in result_xml.end_state.result"
|
||||
- "'<netEntity>isis_net_entity</netEntity>' in result_xml.end_state.result"
|
||||
|
||||
- name: present the provided configuration with the exisiting running configuration
|
||||
ce_is_is_view: &absent
|
||||
instance_id: 100
|
||||
netentity: isis_net_entity
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
|
||||
- name: present the provided configuration with the existing running configuration (IDEMPOTENT)
|
||||
ce_is_is_view: *absent
|
||||
register: repeat
|
||||
|
||||
- name: Get basic config by ce_netconf.
|
||||
ce_netconf: *get_config
|
||||
register: result_xml
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "repeat.changed == false"
|
||||
- "'<instanceId>100</instanceId>' not in result_xml.end_state.result"
|
||||
- "''<netEntity>isis_net_entity</netEntity>' not in result_xml.end_state.result"
|
||||
# after present, isis 100 should be deleted
|
||||
- include_tasks: cleanup.yaml
|
||||
- debug:
|
||||
msg: "END ce_is_is_view pentity resentd integration tests on connection={{ ansible_connection }}"
|
|
@ -0,0 +1,92 @@
|
|||
---
|
||||
- debug:
|
||||
msg: "START ce_is_is_view EXPORTROUTE route policy presented integration tests on connection={{ ansible_connection }}"
|
||||
- include_tasks: setup.yaml
|
||||
|
||||
- name: present the provided configuration with the exisiting running configuration
|
||||
ce_is_is_view: &present
|
||||
instance_id: 100
|
||||
bfd_min_rx: 100
|
||||
bfd_min_tx: 100
|
||||
bfd_multiplier_num: 10
|
||||
register: result
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
|
||||
- name: Get basic config by ce_netconf.
|
||||
ce_netconf: &get_config
|
||||
rpc: get
|
||||
cfg_xml: "<filter type=\"subtree\">
|
||||
<isiscomm xmlns=\"http://www.huawei.com/netconf/vrp\" content-version=\"1.0\" format-version=\"1.0\">
|
||||
<isSites>
|
||||
<isSite>
|
||||
<instanceId>100</instanceId>
|
||||
<isSiteMTs>
|
||||
<isSiteMT>
|
||||
<addressFamily>afIpv4</addressFamily>
|
||||
<mtId>0</mtId>
|
||||
<bfdMinRx></bfdMinRx>
|
||||
<bfdMinTx></bfdMinTx>
|
||||
<bfdMultNum></bfdMultNum>
|
||||
</isSiteMT>
|
||||
</isSiteMTs>
|
||||
</isSite>
|
||||
</isSites>
|
||||
</isiscomm>
|
||||
</filter>"
|
||||
register: result_xml
|
||||
|
||||
|
||||
- name: present the provided configuration with the existing running configuration (IDEMPOTENT)
|
||||
ce_is_is_view: *present
|
||||
register: repeat
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "repeat.changed == false"
|
||||
- "'<bfdMinRx>100</bfdMinRx>' in result_xml.end_state.result"
|
||||
- "'<bfdMinTx>100</bfdMinTx>' in result_xml.end_state.result"
|
||||
- "'<bfdMultNum>10</bfdMultNum>' in result_xml.end_state.result"
|
||||
|
||||
- name: present the provided configuration with the exisiting running configuration
|
||||
ce_is_is_view: &absent
|
||||
instance_id: 100
|
||||
defaultmode: always
|
||||
cost: 10
|
||||
mode_tag: 10
|
||||
level_type: level_1
|
||||
avoid_learning: true
|
||||
mode_routepolicyname: routepolicy_name
|
||||
tag: 100
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
|
||||
- name: present the provided configuration with the existing running configuration (IDEMPOTENT)
|
||||
ce_is_is_view: *absent
|
||||
register: repeat
|
||||
|
||||
- name: Get basic config by ce_netconf.
|
||||
ce_netconf: *get_config
|
||||
register: result_xml
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "repeat.changed == false"
|
||||
- "'<bfdMinRx>100</bfdMinRx>' not in result_xml.end_state.result"
|
||||
- "'<bfdMinTx>100</bfdMinTx>' not in result_xml.end_state.result"
|
||||
- "'<bfdMultNum>10</bfdMultNum>' not in result_xml.end_state.result"
|
||||
# after present, isis 100 should be deleted
|
||||
- include_tasks: cleanup.yaml
|
||||
- debug:
|
||||
msg: "END ce_is_is_view EXPORTROUTE route policy resentd integration tests on connection={{ ansible_connection }}"
|
|
@ -0,0 +1,96 @@
|
|||
---
|
||||
- debug:
|
||||
msg: "START ce_is_is_view EXPORTROUTE route policy presented integration tests on connection={{ ansible_connection }}"
|
||||
- include_tasks: setup.yaml
|
||||
|
||||
- name: present the provided configuration with the exisiting running configuration
|
||||
ce_is_is_view: &present
|
||||
instance_id: 100
|
||||
export_protocol: ospf
|
||||
export_policytype: aclNumOrName
|
||||
export_processid: 100
|
||||
register: result
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
|
||||
- name: Get basic config by ce_netconf.
|
||||
ce_netconf: &get_config
|
||||
rpc: get
|
||||
cfg_xml: "<filter type=\"subtree\">
|
||||
<isiscomm xmlns=\"http://www.huawei.com/netconf/vrp\" content-version=\"1.0\" format-version=\"1.0\">
|
||||
<isSites>
|
||||
<isSite>
|
||||
<instanceId>100</instanceId>
|
||||
<isSiteMTs>
|
||||
<isSiteMT>
|
||||
<addressFamily>afIpv4</addressFamily>
|
||||
<mtId>0</mtId>
|
||||
<isFilterExports>
|
||||
<isFilterExport>
|
||||
<protocol></protocol>
|
||||
<processId></processId>
|
||||
<policyType></policyType>
|
||||
</isFilterExport>
|
||||
</isFilterExports>
|
||||
</isSiteMT>
|
||||
</isSiteMTs>
|
||||
</isSite>
|
||||
</isSites>
|
||||
</isiscomm>
|
||||
</filter>"
|
||||
register: result_xml
|
||||
|
||||
|
||||
- name: present the provided configuration with the existing running configuration (IDEMPOTENT)
|
||||
ce_is_is_view: *present
|
||||
register: repeat
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "repeat.changed == false"
|
||||
- "'<protocol>ospf</protocol>' in result_xml.end_state.result"
|
||||
- "'<processId>100</processId>' in result_xml.end_state.result"
|
||||
- "'<policyType>level_1</policyType>' in result_xml.end_state.result"
|
||||
|
||||
- name: present the provided configuration with the exisiting running configuration
|
||||
ce_is_is_view: &absent
|
||||
instance_id: 100
|
||||
defaultmode: always
|
||||
cost: 10
|
||||
mode_tag: 10
|
||||
level_type: level_1
|
||||
avoid_learning: true
|
||||
mode_routepolicyname: routepolicy_name
|
||||
tag: 100
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
|
||||
- name: present the provided configuration with the existing running configuration (IDEMPOTENT)
|
||||
ce_is_is_view: *absent
|
||||
register: repeat
|
||||
|
||||
- name: Get basic config by ce_netconf.
|
||||
ce_netconf: *get_config
|
||||
register: result_xml
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "repeat.changed == false"
|
||||
- "'<protocol>ospf</protocol>' not in result_xml.end_state.result"
|
||||
- "'<processId>100</processId>' not in result_xml.end_state.result"
|
||||
- "'<policyType>level_1</policyType>' in result_xml.end_state.result"
|
||||
# after present, isis 100 should be deleted
|
||||
- include_tasks: cleanup.yaml
|
||||
- debug:
|
||||
msg: "END ce_is_is_view EXPORTROUTE route policy resentd integration tests on connection={{ ansible_connection }}"
|
|
@ -0,0 +1,124 @@
|
|||
---
|
||||
- debug:
|
||||
msg: "START ce_is_is_view import route policy presented integration tests on connection={{ ansible_connection }}"
|
||||
- include_tasks: setup.yaml
|
||||
|
||||
- name: present the provided configuration with the exisiting running configuration
|
||||
ce_is_is_view: &present
|
||||
instance_id: 100
|
||||
protocol: ospf
|
||||
processid: 100
|
||||
cost_type: external
|
||||
import_cost: 10
|
||||
import_tag: 10
|
||||
import_route_policy: routepolicy_name
|
||||
impotr_leveltype: level_1
|
||||
inheritcost: true
|
||||
permitibgp: true
|
||||
tag: 100
|
||||
register: result
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
|
||||
- name: Get basic config by ce_netconf.
|
||||
ce_netconf: &get_config
|
||||
rpc: get
|
||||
cfg_xml: "<filter type=\"subtree\">
|
||||
<isiscomm xmlns=\"http://www.huawei.com/netconf/vrp\" content-version=\"1.0\" format-version=\"1.0\">
|
||||
<isSites>
|
||||
<isSite>
|
||||
<instanceId>100</instanceId>
|
||||
<isSiteMTs>
|
||||
<isSiteMT>
|
||||
<addressFamily>afIpv4</addressFamily>
|
||||
<mtId>0</mtId>
|
||||
<isImportRoutes>
|
||||
<isImportRoute>
|
||||
<protocol></protocol>
|
||||
<processId></processId>
|
||||
<costType></costType>
|
||||
<cost></cost>
|
||||
<tag></tag>
|
||||
<policyType></policyType>
|
||||
<routePolicyName></routePolicyName>
|
||||
<levelType></levelType>
|
||||
<inheritCost></inheritCost>
|
||||
<permitIbgp></permitIbgp>
|
||||
</isImportRoute>
|
||||
</isImportRoutes>
|
||||
</isSiteMT>
|
||||
</isSiteMTs>
|
||||
</isSite>
|
||||
</isSites>
|
||||
</isiscomm>
|
||||
</filter>"
|
||||
register: result_xml
|
||||
|
||||
|
||||
- name: present the provided configuration with the existing running configuration (IDEMPOTENT)
|
||||
ce_is_is_view: *present
|
||||
register: repeat
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "repeat.changed == false"
|
||||
- "'<protocol>ospf</protocol>' in result_xml.end_state.result"
|
||||
- "'<processId>100</processId>' in result_xml.end_state.result"
|
||||
- "'<costType>external</costType>' in result_xml.end_state.result"
|
||||
- "'<cost>10</cost>' in result_xml.end_state.result"
|
||||
- "'<tag>10</tag>' in result_xml.end_state.result"
|
||||
- "'<policyType>level_1</policyType>' in result_xml.end_state.result"
|
||||
- "'<routePolicyName>routepolicy_name</routePolicyName>' in result_xml.end_state.result"
|
||||
- "'<levelType>level_1</levelType>' in result_xml.end_state.result"
|
||||
- "'<inheritCost>true</inheritCost>' in result_xml.end_state.result"
|
||||
- "'<permitIbgp>true</permitIbgp>' in result_xml.end_state.result"
|
||||
|
||||
- name: present the provided configuration with the exisiting running configuration
|
||||
ce_is_is_view: &absent
|
||||
instance_id: 100
|
||||
defaultmode: always
|
||||
cost: 10
|
||||
mode_tag: 10
|
||||
level_type: level_1
|
||||
avoid_learning: true
|
||||
mode_routepolicyname: routepolicy_name
|
||||
tag: 100
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
|
||||
- name: present the provided configuration with the existing running configuration (IDEMPOTENT)
|
||||
ce_is_is_view: *absent
|
||||
register: repeat
|
||||
|
||||
- name: Get basic config by ce_netconf.
|
||||
ce_netconf: *get_config
|
||||
register: result_xml
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "repeat.changed == false"
|
||||
- "'<protocol>ospf</protocol>' not in result_xml.end_state.result"
|
||||
- "'<processId>100</processId>' not in result_xml.end_state.result"
|
||||
- "'<costType>external</costType>' not in result_xml.end_state.result"
|
||||
- "'<cost>10</cost>' not in result_xml.end_state.result"
|
||||
- "'<tag>10</tag>' not in result_xml.end_state.result"
|
||||
- "'<policyType>level_1</policyType>' not in result_xml.end_state.result"
|
||||
- "'<routePolicyName>routepolicy_name</routePolicyName>' not in result_xml.end_state.result"
|
||||
- "'<levelType>level_1</levelType>' not in result_xml.end_state.result"
|
||||
- "'<inheritCost>true</inheritCost>' not in result_xml.end_state.result"
|
||||
- "'<permitIbgp>true</permitIbgp>' not in result_xml.end_state.result"
|
||||
# after present, isis 100 should be deleted
|
||||
- include_tasks: cleanup.yaml
|
||||
- debug:
|
||||
msg: "END ce_is_is_view import route policy resentd integration tests on connection={{ ansible_connection }}"
|
|
@ -0,0 +1,109 @@
|
|||
---
|
||||
- debug:
|
||||
msg: "START ce_is_is_view import route policy presented integration tests on connection={{ ansible_connection }}"
|
||||
- include_tasks: setup.yaml
|
||||
|
||||
- name: present the provided configuration with the exisiting running configuration
|
||||
ce_is_is_view: &present
|
||||
instance_id: 100
|
||||
allow_filter: true
|
||||
allow_up_down: true
|
||||
ip_prefix_name: prefix_name
|
||||
aclnum_or_name: 3001
|
||||
penetration_direct: level1-level2
|
||||
import_routepolicy_name: routepolicy_name
|
||||
tag: 100
|
||||
register: result
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
|
||||
- name: Get basic config by ce_netconf.
|
||||
ce_netconf: &get_config
|
||||
rpc: get
|
||||
cfg_xml: "<filter type=\"subtree\">
|
||||
<isiscomm xmlns=\"http://www.huawei.com/netconf/vrp\" content-version=\"1.0\" format-version=\"1.0\">
|
||||
<isSites>
|
||||
<isSite>
|
||||
<instanceId>100</instanceId>
|
||||
<isSiteMTs>
|
||||
<isSiteMT>
|
||||
<addressFamily>afIpv4</addressFamily>
|
||||
<mtId>0</mtId>
|
||||
<isLeakRouteLevel2ToLevel1s>
|
||||
<isLeakRouteLevel2ToLevel1>
|
||||
<tag></tag>
|
||||
<routePolicyName></routePolicyName>
|
||||
<aclNumOrName></aclNumOrName>
|
||||
<ipPrefix></ipPrefix>
|
||||
<allowFilter></allowFilter>
|
||||
<allowUpdown></allowUpdown>
|
||||
</isLeakRouteLevel2ToLevel1>
|
||||
</isLeakRouteLevel2ToLevel1s>
|
||||
</isSiteMT>
|
||||
</isSiteMTs>
|
||||
</isSite>
|
||||
</isSites>
|
||||
</isiscomm>
|
||||
</filter>"
|
||||
register: result_xml
|
||||
|
||||
|
||||
- name: present the provided configuration with the existing running configuration (IDEMPOTENT)
|
||||
ce_is_is_view: *present
|
||||
register: repeat
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "repeat.changed == false"
|
||||
- "'<tag>100</tag>' in result_xml.end_state.result"
|
||||
- "'<routePolicyName>routepolicy_name</routePolicyName>' in result_xml.end_state.result"
|
||||
- "'<allowUpdown>true</allowUpdown>' in result_xml.end_state.result"
|
||||
- "'<aclNumOrName>3001</aclNumOrName>' in result_xml.end_state.result"
|
||||
- "'<ipPrefix>prefix_name</ipPrefix>' in result_xml.end_state.result"
|
||||
- "'<allowFilter>true</allowFilter>' in result_xml.end_state.result"
|
||||
|
||||
- name: present the provided configuration with the exisiting running configuration
|
||||
ce_is_is_view: &absent
|
||||
instance_id: 100
|
||||
allow_filter: true
|
||||
allow_up_down: true
|
||||
ip_prefix_name: prefix_name
|
||||
aclnum_or_name: 3001
|
||||
penetration_direct: level1-level2
|
||||
import_routepolicy_name: routepolicy_name
|
||||
tag: 100
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
|
||||
- name: present the provided configuration with the existing running configuration (IDEMPOTENT)
|
||||
ce_is_is_view: *absent
|
||||
register: repeat
|
||||
|
||||
- name: Get basic config by ce_netconf.
|
||||
ce_netconf: *get_config
|
||||
register: result_xml
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "repeat.changed == false"
|
||||
- "'<tag>100</tag>' in result_xml.end_state.result"
|
||||
- "'<routePolicyName>routepolicy_name</routePolicyName>' not in result_xml.end_state.result"
|
||||
- "'<allowUpdown>true</allowUpdown>' not in result_xml.end_state.result"
|
||||
- "'<aclNumOrName>3001</aclNumOrName>' not in result_xml.end_state.result"
|
||||
- "'<ipPrefix>prefix_name</ipPrefix>' not in result_xml.end_state.result"
|
||||
- "'<allowFilter>true</allowFilter>' not in result_xml.end_state.result"
|
||||
# after present, isis 100 should be deleted
|
||||
- include_tasks: cleanup.yaml
|
||||
- debug:
|
||||
msg: "END ce_is_is_view import route policy resentd integration tests on connection={{ ansible_connection }}"
|
|
@ -0,0 +1,109 @@
|
|||
---
|
||||
- debug:
|
||||
msg: "START ce_is_is_view import route policy presented integration tests on connection={{ ansible_connection }}"
|
||||
- include_tasks: setup.yaml
|
||||
|
||||
- name: present the provided configuration with the exisiting running configuration
|
||||
ce_is_is_view: &present
|
||||
instance_id: 100
|
||||
penetration_direct: level2-level1
|
||||
allow_filter: true
|
||||
allow_up_down: true
|
||||
ip_prefix_name: prefix_name
|
||||
aclnum_or_name: 3001
|
||||
import_routepolicy_name: routepolicy_name
|
||||
tag: 100
|
||||
register: result
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
|
||||
- name: Get basic config by ce_netconf.
|
||||
ce_netconf: &get_config
|
||||
rpc: get
|
||||
cfg_xml: "<filter type=\"subtree\">
|
||||
<isiscomm xmlns=\"http://www.huawei.com/netconf/vrp\" content-version=\"1.0\" format-version=\"1.0\">
|
||||
<isSites>
|
||||
<isSite>
|
||||
<instanceId>100</instanceId>
|
||||
<isSiteMTs>
|
||||
<isSiteMT>
|
||||
<addressFamily>afIpv4</addressFamily>
|
||||
<mtId>0</mtId>
|
||||
<isLeakRouteLevel2ToLevel1s>
|
||||
<isLeakRouteLevel1ToLevel2s>
|
||||
<tag></tag>
|
||||
<routePolicyName></routePolicyName>
|
||||
<aclNumOrName></aclNumOrName>
|
||||
<ipPrefix></ipPrefix>
|
||||
<allowFilter></allowFilter>
|
||||
<allowUpdown></allowUpdown>
|
||||
</isLeakRouteLevel1ToLevel2s>
|
||||
</isLeakRouteLevel2ToLevel1s>
|
||||
</isSiteMT>
|
||||
</isSiteMTs>
|
||||
</isSite>
|
||||
</isSites>
|
||||
</isiscomm>
|
||||
</filter>"
|
||||
register: result_xml
|
||||
|
||||
|
||||
- name: present the provided configuration with the existing running configuration (IDEMPOTENT)
|
||||
ce_is_is_view: *present
|
||||
register: repeat
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "repeat.changed == false"
|
||||
- "'<tag>100</tag>' in result_xml.end_state.result"
|
||||
- "'<routePolicyName>routepolicy_name</routePolicyName>' in result_xml.end_state.result"
|
||||
- "'<allowUpdown>true</allowUpdown>' in result_xml.end_state.result"
|
||||
- "'<aclNumOrName>3001</aclNumOrName>' in result_xml.end_state.result"
|
||||
- "'<ipPrefix>prefix_name</ipPrefix>' in result_xml.end_state.result"
|
||||
- "'<allowFilter>true</allowFilter>' in result_xml.end_state.result"
|
||||
|
||||
- name: present the provided configuration with the exisiting running configuration
|
||||
ce_is_is_view: &absent
|
||||
instance_id: 100
|
||||
penetration_direct: level2-level1
|
||||
allow_filter: true
|
||||
allow_up_down: true
|
||||
ip_prefix_name: prefix_name
|
||||
aclnum_or_name: 3001
|
||||
import_routepolicy_name: routepolicy_name
|
||||
tag: 100
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
|
||||
- name: present the provided configuration with the existing running configuration (IDEMPOTENT)
|
||||
ce_is_is_view: *absent
|
||||
register: repeat
|
||||
|
||||
- name: Get basic config by ce_netconf.
|
||||
ce_netconf: *get_config
|
||||
register: result_xml
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "repeat.changed == false"
|
||||
- "'<tag>100</tag>' in result_xml.end_state.result"
|
||||
- "'<routePolicyName>routepolicy_name</routePolicyName>' not in result_xml.end_state.result"
|
||||
- "'<allowUpdown>true</allowUpdown>' not in result_xml.end_state.result"
|
||||
- "'<aclNumOrName>3001</aclNumOrName>' not in result_xml.end_state.result"
|
||||
- "'<ipPrefix>prefix_name</ipPrefix>' not in result_xml.end_state.result"
|
||||
- "'<allowFilter>true</allowFilter>' not in result_xml.end_state.result"
|
||||
# after present, isis 100 should be deleted
|
||||
- include_tasks: cleanup.yaml
|
||||
- debug:
|
||||
msg: "END ce_is_is_view import route policy resentd integration tests on connection={{ ansible_connection }}"
|
|
@ -0,0 +1,80 @@
|
|||
---
|
||||
- debug:
|
||||
msg: "START ce_is_is_view maxLoadBalancing presented integration tests on connection={{ ansible_connection }}"
|
||||
- include_tasks: setup.yaml
|
||||
|
||||
- name: present the provided configuration with the exisiting running configuration
|
||||
ce_is_is_view: &present
|
||||
instance_id: 100
|
||||
max_load: 30
|
||||
register: result
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
|
||||
- name: Get basic config by ce_netconf.
|
||||
ce_netconf: &get_config
|
||||
rpc: get
|
||||
cfg_xml: "<filter type=\"subtree\">
|
||||
<isiscomm xmlns=\"http://www.huawei.com/netconf/vrp\" content-version=\"1.0\" format-version=\"1.0\">
|
||||
<isSites>
|
||||
<isSite>
|
||||
<instanceId>100</instanceId>
|
||||
<isSiteMTs>
|
||||
<isSiteMT>
|
||||
<addressFamily>afIpv4</addressFamily>
|
||||
<mtId>0</mtId>
|
||||
<maxLoadBalancing></maxLoadBalancing>
|
||||
</isSiteMT>
|
||||
</isSiteMTs>
|
||||
</isSite>
|
||||
</isSites>
|
||||
</isiscomm>
|
||||
</filter>"
|
||||
register: result_xml
|
||||
|
||||
|
||||
- name: present the provided configuration with the existing running configuration (IDEMPOTENT)
|
||||
ce_is_is_view: *present
|
||||
register: repeat
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "repeat.changed == false"
|
||||
- "'<instanceId>100</instanceId>' in result_xml.end_state.result"
|
||||
- "'<maxLoadBalancing>30</maxLoadBalancing>' in result_xml.end_state.result"
|
||||
|
||||
- name: present the provided configuration with the exisiting running configuration
|
||||
ce_is_is_view: &absent
|
||||
instance_id: 100
|
||||
max_load: 30
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
|
||||
- name: present the provided configuration with the existing running configuration (IDEMPOTENT)
|
||||
ce_is_is_view: *absent
|
||||
register: repeat
|
||||
|
||||
- name: Get basic config by ce_netconf.
|
||||
ce_netconf: *get_config
|
||||
register: result_xml
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "repeat.changed == false"
|
||||
- "'<instanceId>100</instanceId>' not in result_xml.end_state.result"
|
||||
- "'<maxLoadBalancing>30</maxLoadBalancing>' not in result_xml.end_state.result"
|
||||
# after present, isis 100 should be deleted
|
||||
- include_tasks: cleanup.yaml
|
||||
- debug:
|
||||
msg: "END ce_is_is_view maxLoadBalancing resentd integration tests on connection={{ ansible_connection }}"
|
|
@ -0,0 +1,87 @@
|
|||
---
|
||||
- debug:
|
||||
msg: "START ce_is_is_view preferences presented integration tests on connection={{ ansible_connection }}"
|
||||
- include_tasks: setup.yaml
|
||||
|
||||
- name: present the provided configuration with the exisiting running configuration
|
||||
ce_is_is_view: &present
|
||||
instance_id: 100
|
||||
preference_value: 100
|
||||
route_policy_name: route
|
||||
register: result
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
|
||||
- name: Get basic config by ce_netconf.
|
||||
ce_netconf: &get_config
|
||||
rpc: get
|
||||
cfg_xml: "<filter type=\"subtree\">
|
||||
<isiscomm xmlns=\"http://www.huawei.com/netconf/vrp\" content-version=\"1.0\" format-version=\"1.0\">
|
||||
<isSites>
|
||||
<isSite>
|
||||
<instanceId>100</instanceId>
|
||||
<isSiteMTs>
|
||||
<isSiteMT>
|
||||
<isPreferences>
|
||||
<isPreference>
|
||||
<preferenceValue></preferenceValue>
|
||||
<routePolicyName></routePolicyName>
|
||||
</isPreference>
|
||||
</isPreferences>
|
||||
</isSiteMT>
|
||||
</isSiteMTs>
|
||||
</isSite>
|
||||
</isSites>
|
||||
</isiscomm>
|
||||
</filter>"
|
||||
register: result_xml
|
||||
|
||||
|
||||
- name: present the provided configuration with the existing running configuration (IDEMPOTENT)
|
||||
ce_is_is_view: *present
|
||||
register: repeat
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "repeat.changed == false"
|
||||
- "'<instanceId>100</instanceId>' in result_xml.end_state.result"
|
||||
- "'<preferenceValue>100</preferenceValue>' in result_xml.end_state.result"
|
||||
- "'<routePolicyName>route</routePolicyName>' in result_xml.end_state.result"
|
||||
|
||||
- name: present the provided configuration with the exisiting running configuration
|
||||
ce_is_is_view: &absent
|
||||
instance_id: 100
|
||||
preference_value: 100
|
||||
route_policy_name: route
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
|
||||
- name: present the provided configuration with the existing running configuration (IDEMPOTENT)
|
||||
ce_is_is_view: *absent
|
||||
register: repeat
|
||||
|
||||
- name: Get basic config by ce_netconf.
|
||||
ce_netconf: *get_config
|
||||
register: result_xml
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "repeat.changed == false"
|
||||
- "'<instanceId>100</instanceId>' not in result_xml.end_state.result"
|
||||
- "''<preferenceValue>100</preferenceValue>' not in result_xml.end_state.result"
|
||||
- "''<routePolicyName>route</routePolicyName>' not in result_xml.end_state.result"
|
||||
# after present, isis 100 should be deleted
|
||||
- include_tasks: cleanup.yaml
|
||||
- debug:
|
||||
msg: "END ce_is_is_view Preference resentd integration tests on connection={{ ansible_connection }}"
|
|
@ -0,0 +1,115 @@
|
|||
---
|
||||
- debug:
|
||||
msg: "START ce_is_is_view presented integration tests on connection={{ ansible_connection }}"
|
||||
- include_tasks: setup.yaml
|
||||
|
||||
- name: present the provided configuration with the exisiting running configuration
|
||||
ce_is_is_view: &present
|
||||
instance_id: 100
|
||||
description: ISIS
|
||||
islevel: level_1
|
||||
coststyle: narrow
|
||||
relaxSpfLimit: true
|
||||
stdlevel1cost: 60
|
||||
stdlevel2cost: 60
|
||||
stdbandwidth: 100
|
||||
autocostenable: true
|
||||
autocostenablecompatible: true
|
||||
register: result
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
|
||||
- name: Get basic config by ce_netconf.
|
||||
ce_netconf: &get_config
|
||||
rpc: get
|
||||
cfg_xml: "<filter type=\"subtree\">
|
||||
<isiscomm xmlns=\"http://www.huawei.com/netconf/vrp\" content-version=\"1.0\" format-version=\"1.0\">
|
||||
<isSites>
|
||||
<isSite>
|
||||
<instanceId>100</instanceId>
|
||||
<description></description>
|
||||
<isLevel></isLevel>
|
||||
<costStyle></costStyle>
|
||||
<relaxSpfLimit></relaxSpfLimit>
|
||||
<stdLevel1Cost></stdLevel1Cost>
|
||||
<stdLevel2Cost></stdLevel2Cost>
|
||||
<stdbandwidth></stdbandwidth>
|
||||
<stdAutoCostEnable></stdAutoCostEnable>
|
||||
<stdAutoCostEnableCompatible></stdAutoCostEnableCompatible>
|
||||
</isSite>
|
||||
</isiscomm>
|
||||
</filter>"
|
||||
register: result_xml
|
||||
|
||||
|
||||
- name: present the provided configuration with the existing running configuration (IDEMPOTENT)
|
||||
ce_is_is_view: *present
|
||||
register: repeat
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "repeat.changed == false"
|
||||
- "'<instanceId>100</instanceId>' in result_xml.end_state.result"
|
||||
- "'<vpnName>_public_</vpnName>' in result_xml.end_state.result"
|
||||
- "'<description>ISIS</description>' in result_xml.end_state.result"
|
||||
- "'<isLevel>level_1</isLevel>' in result_xml.end_state.result"
|
||||
- "'<costStyle>narrow</costStyle>' in result_xml.end_state.result"
|
||||
- "'<relaxSpfLimit>true</relaxSpfLimit>' in result_xml.end_state.result"
|
||||
- "'<stdLevel1Cost>60</stdLevel1Cost>' in result_xml.end_state.result"
|
||||
- "'<stdLevel2Cost>60</stdLevel2Cost>' in result_xml.end_state.result"
|
||||
- "'<stdbandwidth>100</stdbandwidth>' in result_xml.end_state.result"
|
||||
- "'<stdAutoCostEnable>true</stdAutoCostEnable>' in result_xml.end_state.result"
|
||||
- "'<stdAutoCostEnableCompatible>true</stdAutoCostEnableCompatible>' in result_xml.end_state.result"
|
||||
|
||||
- name: present the provided configuration with the exisiting running configuration
|
||||
ce_is_is_view: &absent
|
||||
instance_id: 100
|
||||
description: ISIS
|
||||
islevel: level_1
|
||||
coststyle: narrow
|
||||
relaxSpfLimit: true
|
||||
stdlevel1cost: 60
|
||||
stdlevel2cost: 60
|
||||
stdbandwidth: 100
|
||||
autocostenable: true
|
||||
autocostenablecompatible: true
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
|
||||
- name: present the provided configuration with the existing running configuration (IDEMPOTENT)
|
||||
ce_is_is_view: *absent
|
||||
register: repeat
|
||||
|
||||
- name: Get basic config by ce_netconf.
|
||||
ce_netconf: *get_config
|
||||
register: result_xml
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "repeat.changed == false"
|
||||
- "'<instanceId>100</instanceId>' not in result_xml.end_state.result"
|
||||
- "'<vpnName>_public_</vpnName>' not in result_xml.end_state.result"
|
||||
- "'<description>ISIS</description>' not in result_xml.end_state.result"
|
||||
- "'<isLevel>level_1</isLevel>' not in result_xml.end_state.result"
|
||||
- "'<costStyle>narrow</costStyle>' not in result_xml.end_state.result"
|
||||
- "'<relaxSpfLimit>true</relaxSpfLimit>' not in result_xml.end_state.result"
|
||||
- "'<stdLevel1Cost>60</stdLevel1Cost>' not in result_xml.end_state.result"
|
||||
- "'<stdLevel2Cost>60</stdLevel2Cost>' not in result_xml.end_state.result"
|
||||
- "'<stdbandwidth>100</stdbandwidth>' not in result_xml.end_state.result"
|
||||
- "'<stdAutoCostEnable>true</stdAutoCostEnable>' not in result_xml.end_state.result"
|
||||
- "'<stdAutoCostEnableCompatible>true</stdAutoCostEnableCompatible>' not in result_xml.end_state.result"
|
||||
# after present, isis 100 should be deleted
|
||||
- include_tasks: cleanup.yaml
|
||||
- debug:
|
||||
msg: "END ce_is_is_view presentd integration tests on connection={{ ansible_connection }}"
|
|
@ -0,0 +1,111 @@
|
|||
---
|
||||
- debug:
|
||||
msg: "START ce_is_is_view import route policy presented integration tests on connection={{ ansible_connection }}"
|
||||
- include_tasks: setup.yaml
|
||||
|
||||
- name: present the provided configuration with the exisiting running configuration
|
||||
ce_is_is_view: &present
|
||||
instance_id: 100
|
||||
defaultmode: always
|
||||
cost: 10
|
||||
mode_tag: 10
|
||||
level_type: level_1
|
||||
avoid_learning: true
|
||||
mode_routepolicyname: routepolicy_name
|
||||
tag: 100
|
||||
register: result
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
|
||||
- name: Get basic config by ce_netconf.
|
||||
ce_netconf: &get_config
|
||||
rpc: get
|
||||
cfg_xml: "<filter type=\"subtree\">
|
||||
<isiscomm xmlns=\"http://www.huawei.com/netconf/vrp\" content-version=\"1.0\" format-version=\"1.0\">
|
||||
<isSites>
|
||||
<isSite>
|
||||
<instanceId>100</instanceId>
|
||||
<isSiteMTs>
|
||||
<isSiteMT>
|
||||
<addressFamily>afIpv4</addressFamily>
|
||||
<mtId>0</mtId>
|
||||
<isDefaultRoutes>
|
||||
<isDefaultRoute>
|
||||
<defaultMode></defaultMode>
|
||||
<routePolicyName></routePolicyName>
|
||||
<cost></cost>
|
||||
<tag></tag>
|
||||
<levelType></levelType>
|
||||
<avoidLearning></avoidLearning>
|
||||
</isDefaultRoute>
|
||||
</isDefaultRoutes>
|
||||
</isSiteMT>
|
||||
</isSiteMTs>
|
||||
</isSite>
|
||||
</isSites>
|
||||
</isiscomm>
|
||||
</filter>"
|
||||
register: result_xml
|
||||
|
||||
|
||||
- name: present the provided configuration with the existing running configuration (IDEMPOTENT)
|
||||
ce_is_is_view: *present
|
||||
register: repeat
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "repeat.changed == false"
|
||||
- "'<tag>100</tag>' in result_xml.end_state.result"
|
||||
- "'<defaultMode>always</defaultMode>' in result_xml.end_state.result"
|
||||
- "'<routePolicyName>routepolicy_name</routePolicyName>' in result_xml.end_state.result"
|
||||
- "'<cost>10</cost>' in result_xml.end_state.result"
|
||||
- "'<tag>10</tag>' in result_xml.end_state.result"
|
||||
- "'<levelType>level_1</levelType>' in result_xml.end_state.result"
|
||||
- "'<avoidLearning>true</avoidLearning>' in result_xml.end_state.result"
|
||||
|
||||
- name: present the provided configuration with the exisiting running configuration
|
||||
ce_is_is_view: &absent
|
||||
instance_id: 100
|
||||
defaultmode: always
|
||||
cost: 10
|
||||
mode_tag: 10
|
||||
level_type: level_1
|
||||
avoid_learning: true
|
||||
mode_routepolicyname: routepolicy_name
|
||||
tag: 100
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
|
||||
- name: present the provided configuration with the existing running configuration (IDEMPOTENT)
|
||||
ce_is_is_view: *absent
|
||||
register: repeat
|
||||
|
||||
- name: Get basic config by ce_netconf.
|
||||
ce_netconf: *get_config
|
||||
register: result_xml
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "repeat.changed == false"
|
||||
- "'<tag>100</tag>' not in result_xml.end_state.result"
|
||||
- "'<defaultMode>always</defaultMode>' not in result_xml.end_state.result"
|
||||
- "'<routePolicyName>routepolicy_name</routePolicyName>' not in result_xml.end_state.result"
|
||||
- "'<cost>10</cost>' not in result_xml.end_state.result"
|
||||
- "'<tag>10</tag>' not in result_xml.end_state.result"
|
||||
- "'<levelType>level_1</levelType>' not in result_xml.end_state.result"
|
||||
- "'<avoidLearning>true</avoidLearning>' not in result_xml.end_state.result"
|
||||
# after present, isis 100 should be deleted
|
||||
- include_tasks: cleanup.yaml
|
||||
- debug:
|
||||
msg: "END ce_is_is_view import route policy resentd integration tests on connection={{ ansible_connection }}"
|
|
@ -0,0 +1,97 @@
|
|||
---
|
||||
- debug:
|
||||
msg: "START ce_is_is_view EXPORTROUTE route policy presented integration tests on connection={{ ansible_connection }}"
|
||||
- include_tasks: setup.yaml
|
||||
|
||||
- name: present the provided configuration with the exisiting running configuration
|
||||
ce_is_is_view: &present
|
||||
instance_id: 100
|
||||
import_aclnumorname: 301
|
||||
import_ipprefix: ipprefix
|
||||
import_routepolicyname: routepolicyname
|
||||
register: result
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
|
||||
- name: Get basic config by ce_netconf.
|
||||
ce_netconf: &get_config
|
||||
rpc: get
|
||||
cfg_xml: "<filter type=\"subtree\">
|
||||
<isiscomm xmlns=\"http://www.huawei.com/netconf/vrp\" content-version=\"1.0\" format-version=\"1.0\">
|
||||
<isSites>
|
||||
<isSite>
|
||||
<instanceId>100</instanceId>
|
||||
<isSiteMTs>
|
||||
<isSiteMT>
|
||||
<addressFamily>afIpv4</addressFamily>
|
||||
<mtId>0</mtId>
|
||||
<isFilterImports>
|
||||
<isFilterImport>
|
||||
<aclNumOrName></aclNumOrName>
|
||||
<ipPrefix></ipPrefix>
|
||||
<routePolicyName></routePolicyName>
|
||||
</isFilterImport>
|
||||
</isFilterImports>
|
||||
</isSiteMT>
|
||||
</isSiteMTs>
|
||||
</isSite>
|
||||
</isSites>
|
||||
</isiscomm>
|
||||
</filter>"
|
||||
register: result_xml
|
||||
|
||||
|
||||
- name: present the provided configuration with the existing running configuration (IDEMPOTENT)
|
||||
ce_is_is_view: *present
|
||||
register: repeat
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "repeat.changed == false"
|
||||
- "'<aclNumOrName>3001</aclNumOrName>' in result_xml.end_state.result"
|
||||
- "'<ipPrefix>ipprefix</ipPrefix>' in result_xml.end_state.result"
|
||||
- "'<routePolicyName>routepolicyname</routePolicyName>' in result_xml.end_state.result"
|
||||
|
||||
- name: present the provided configuration with the exisiting running configuration
|
||||
ce_is_is_view: &absent
|
||||
instance_id: 100
|
||||
defaultmode: always
|
||||
cost: 10
|
||||
mode_tag: 10
|
||||
level_type: level_1
|
||||
avoid_learning: true
|
||||
mode_routepolicyname: routepolicy_name
|
||||
tag: 100
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
|
||||
- name: present the provided configuration with the existing running configuration (IDEMPOTENT)
|
||||
ce_is_is_view: *absent
|
||||
register: repeat
|
||||
|
||||
- name: Get basic config by ce_netconf.
|
||||
ce_netconf: *get_config
|
||||
register: result_xml
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "repeat.changed == false"
|
||||
- "'<aclNumOrName>3001</aclNumOrName>' not in result_xml.end_state.result"
|
||||
- "'<ipPrefix>ipprefix</ipPrefix>' not in result_xml.end_state.result"
|
||||
- "'<routePolicyName>routepolicyname</routePolicyName>' not in result_xml.end_state.result"
|
||||
|
||||
# after present, isis 100 should be deleted
|
||||
- include_tasks: cleanup.yaml
|
||||
- debug:
|
||||
msg: "END ce_is_is_view EXPORTROUTE route policy resentd integration tests on connection={{ ansible_connection }}"
|
|
@ -0,0 +1,87 @@
|
|||
---
|
||||
- debug:
|
||||
msg: "START ce_is_is_view next hop presented integration tests on connection={{ ansible_connection }}"
|
||||
- include_tasks: setup.yaml
|
||||
|
||||
- name: present the provided configuration with the exisiting running configuration
|
||||
ce_is_is_view: &present
|
||||
instance_id: 100
|
||||
ip_address: 1.1.1.1
|
||||
weight: 100
|
||||
register: result
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
|
||||
- name: Get basic config by ce_netconf.
|
||||
ce_netconf: &get_config
|
||||
rpc: get
|
||||
cfg_xml: "<filter type=\"subtree\">
|
||||
<isiscomm xmlns=\"http://www.huawei.com/netconf/vrp\" content-version=\"1.0\" format-version=\"1.0\">
|
||||
<isSites>
|
||||
<isSite>
|
||||
<instanceId>100</instanceId>
|
||||
<isSiteMTs>
|
||||
<isSiteMT>
|
||||
<addressFamily>afIpv4</addressFamily>
|
||||
<mtId>0</mtId>
|
||||
<isNextHopWeights>
|
||||
<isNextHopWeight>
|
||||
<ipAddress></ipAddress>
|
||||
<weight></weight>
|
||||
</isNextHopWeight>
|
||||
</isNextHopWeights>
|
||||
</isSiteMT>
|
||||
</isSiteMTs>
|
||||
</isSite>
|
||||
</isSites>
|
||||
</isiscomm>
|
||||
</filter>"
|
||||
register: result_xml
|
||||
|
||||
|
||||
- name: present the provided configuration with the existing running configuration (IDEMPOTENT)
|
||||
ce_is_is_view: *present
|
||||
register: repeat
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "repeat.changed == false"
|
||||
- "'<ipAddress>1.1.1.1</ipAddress>' in result_xml.end_state.result"
|
||||
- "'<weight>100</weight>' in result_xml.end_state.result"
|
||||
|
||||
- name: present the provided configuration with the exisiting running configuration
|
||||
ce_is_is_view: &absent
|
||||
instance_id: 100
|
||||
ip_address: 1.1.1.1
|
||||
weight: 100
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
|
||||
- name: Assert the configuration is reflected on host
|
||||
assert:
|
||||
that:
|
||||
- "result['changed'] == true"
|
||||
|
||||
- name: present the provided configuration with the existing running configuration (IDEMPOTENT)
|
||||
ce_is_is_view: *absent
|
||||
register: repeat
|
||||
|
||||
- name: Get basic config by ce_netconf.
|
||||
ce_netconf: *get_config
|
||||
register: result_xml
|
||||
|
||||
- name: Assert that the previous task was idempotent
|
||||
assert:
|
||||
that:
|
||||
- "repeat.changed == false"
|
||||
- "'<ipAddress>1.1.1.1</ipAddress>' not in result_xml.end_state.result"
|
||||
- "'<weight>100</weight>' not in result_xml.end_state.result"
|
||||
# after present, isis 100 should be deleted
|
||||
- include_tasks: cleanup.yaml
|
||||
- debug:
|
||||
msg: "END ce_is_is_view next hop resentd integration tests on connection={{ ansible_connection }}"
|
|
@ -0,0 +1,104 @@
|
|||
<data>
|
||||
<isiscomm>
|
||||
<isSites>
|
||||
<isSite>
|
||||
<instanceId>100</instanceId>
|
||||
<vpnName>_public_</vpnName>
|
||||
<description>ISIS</description>
|
||||
<isLevel>level_1</isLevel>
|
||||
<costStyle>narrow</costStyle>
|
||||
<relaxSpfLimit>true</relaxSpfLimit>
|
||||
<stdLevel1Cost>60</stdLevel1Cost>
|
||||
<stdLevel2Cost>60</stdLevel2Cost>
|
||||
<stdbandwidth>100</stdbandwidth>
|
||||
<stdAutoCostEnable>true</stdAutoCostEnable>
|
||||
<stdAutoCostEnableCompatible>true</stdAutoCostEnableCompatible>
|
||||
<isNetEntitys>
|
||||
<isNetEntity>
|
||||
<netEntity>netentity</netEntity>
|
||||
</isNetEntity>
|
||||
</isNetEntitys>
|
||||
<isSiteMTs>
|
||||
<isSiteMT>
|
||||
<addressFamily>afIpv4</addressFamily>
|
||||
<mtId>0</mtId>
|
||||
<bfdMinRx>100</bfdMinRx>
|
||||
<bfdMinTx>100</bfdMinTx>
|
||||
<bfdMultNum>10</bfdMultNum>
|
||||
<maxLoadBalancing>32</maxLoadBalancing>
|
||||
<isPreferences>
|
||||
<isPreference>
|
||||
<preferenceValue>100</preferenceValue>
|
||||
<routePolicyName>route</routePolicyName>
|
||||
</isPreference>
|
||||
</isPreferences>
|
||||
<isNextHopWeights>
|
||||
<isNextHopWeight>
|
||||
<ipAddress>1.1.1.1</ipAddress>
|
||||
<weight>100</weight>
|
||||
</isNextHopWeight>
|
||||
</isNextHopWeights>
|
||||
<isFilterImports>
|
||||
<isFilterImport>
|
||||
<aclNumOrName>3001</aclNumOrName>
|
||||
<ipPrefix>ip</ipPrefix>
|
||||
<routePolicyName>route</routePolicyName>
|
||||
<policyType>level_1</policyType>
|
||||
</isFilterImport>
|
||||
</isFilterImports>
|
||||
<isFilterExports>
|
||||
<isFilterExport>
|
||||
<protocol>ospf</protocol>
|
||||
<processId>100</processId>
|
||||
<policyType>level_1</policyType>
|
||||
</isFilterExport>
|
||||
</isFilterExports>
|
||||
<isDefaultRoutes>
|
||||
<isDefaultRoute>
|
||||
<defaultMode>always</defaultMode>
|
||||
<routePolicyName>mode</routePolicyName>
|
||||
<cost>100</cost>
|
||||
<tag>100</tag>
|
||||
<levelType>level_1</levelType>
|
||||
<avoidLearning>true</avoidLearning>
|
||||
</isDefaultRoute>
|
||||
</isDefaultRoutes>
|
||||
<isImportRoutes>
|
||||
<isImportRoute>
|
||||
<protocol>import</protocol>
|
||||
<processId>100</processId>
|
||||
<costType>level_1</costType>
|
||||
<cost>100</cost>
|
||||
<tag>100</tag>
|
||||
<policyType>level_1</policyType>
|
||||
<routePolicyName>import</routePolicyName>
|
||||
<levelType>level_1</levelType>
|
||||
<inheritCost>100</inheritCost>
|
||||
<permitIbgp>true</permitIbgp>
|
||||
</isImportRoute>
|
||||
</isImportRoutes>
|
||||
<isLeakRouteLevel1ToLevel2s>
|
||||
<isLeakRouteLevel1ToLevel2>
|
||||
<tag>100</tag>
|
||||
<routePolicyName>route</routePolicyName>
|
||||
<aclNumOrName>3001</aclNumOrName>
|
||||
<ipPrefix>ip</ipPrefix>
|
||||
<leakEnableFlag>true</leakEnableFlag>
|
||||
<allowFilter>true</allowFilter>
|
||||
</isLeakRouteLevel1ToLevel2>
|
||||
</isLeakRouteLevel1ToLevel2s>
|
||||
<isLeakRouteLevel2ToLevel1s>
|
||||
<isLeakRouteLevel2ToLevel1>
|
||||
<tag>100</tag>
|
||||
<routePolicyName>route</routePolicyName>
|
||||
<aclNumOrName>3001</aclNumOrName>
|
||||
<ipPrefix>ip</ipPrefix>
|
||||
<allowFilter>true</allowFilter>
|
||||
</isLeakRouteLevel2ToLevel1>
|
||||
</isLeakRouteLevel2ToLevel1s>
|
||||
</isSiteMT>
|
||||
</isSiteMTs>
|
||||
</isSite>
|
||||
</isSites>
|
||||
</isiscomm>
|
||||
</data>
|
|
@ -0,0 +1,10 @@
|
|||
<data>
|
||||
<isiscomm>
|
||||
<isSites>
|
||||
<isSite>
|
||||
<instanceId>100</instanceId>
|
||||
<vpnName>_public_</vpnName>
|
||||
</isSite>
|
||||
</isSites>
|
||||
</isiscomm>
|
||||
</data>
|
248
test/units/modules/network/cloudengine/test_ce_is_is_view.py
Normal file
248
test/units/modules/network/cloudengine/test_ce_is_is_view.py
Normal file
|
@ -0,0 +1,248 @@
|
|||
# (c) 2019 Red Hat Inc.
|
||||
#
|
||||
# This file is part of Ansible
|
||||
#
|
||||
# Ansible 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Ansible 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 Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
from units.compat.mock import patch
|
||||
from ansible.modules.network.cloudengine import ce_is_is_view
|
||||
from units.modules.network.cloudengine.ce_module import TestCloudEngineModule, load_fixture
|
||||
from units.modules.utils import set_module_args
|
||||
|
||||
|
||||
class TestCloudEngineLacpModule(TestCloudEngineModule):
|
||||
module = ce_is_is_view
|
||||
|
||||
def setUp(self):
|
||||
super(TestCloudEngineLacpModule, self).setUp()
|
||||
|
||||
self.mock_get_config = patch('ansible.modules.network.cloudengine.ce_is_is_view.get_nc_config')
|
||||
self.get_nc_config = self.mock_get_config.start()
|
||||
|
||||
self.mock_set_config = patch('ansible.modules.network.cloudengine.ce_is_is_view.set_nc_config')
|
||||
self.set_nc_config = self.mock_set_config.start()
|
||||
self.set_nc_config.return_value = None
|
||||
|
||||
self.before = load_fixture('ce_is_is_view', 'before.txt')
|
||||
self.after = load_fixture('ce_is_is_view', 'after.txt')
|
||||
|
||||
def tearDown(self):
|
||||
super(TestCloudEngineLacpModule, self).tearDown()
|
||||
self.mock_set_config.stop()
|
||||
self.mock_get_config.stop()
|
||||
|
||||
def test_ce_is_is_view_absent(self):
|
||||
self.get_nc_config.side_effect = (self.after, self.before)
|
||||
config = dict(
|
||||
instance_id=100,
|
||||
description='ISIS',
|
||||
islevel='level_1',
|
||||
coststyle='narrow',
|
||||
stdlevel2cost=60,
|
||||
stdbandwidth=100,
|
||||
autocostenable=True,
|
||||
autocostenablecompatible=True,
|
||||
netentity='netentity',
|
||||
preference_value=100,
|
||||
route_policy_name='route',
|
||||
max_load=32,
|
||||
ip_address='1.1.1.1',
|
||||
weight=100,
|
||||
penetration_direct='level2-level1',
|
||||
import_routepolicy_name='import',
|
||||
tag=100,
|
||||
allow_filter=True,
|
||||
allow_up_down=True,
|
||||
enablelevel1tolevel2=True,
|
||||
defaultmode='always',
|
||||
mode_routepolicyname='mode',
|
||||
cost=100,
|
||||
mode_tag=100,
|
||||
level_type='level_1',
|
||||
avoid_learning=True,
|
||||
protocol='ospf',
|
||||
processid=100,
|
||||
cost_type='external',
|
||||
import_cost=100,
|
||||
import_tag=100,
|
||||
import_route_policy='import',
|
||||
impotr_leveltype='level_1',
|
||||
inheritcost=True,
|
||||
permitibgp=True,
|
||||
export_protocol='ospf',
|
||||
export_policytype='aclNumOrName',
|
||||
export_processid=100,
|
||||
export_ipprefix='export',
|
||||
export_routepolicyname='export',
|
||||
import_aclnumorname='acl',
|
||||
import_routepolicyname='import',
|
||||
bfd_min_rx=100,
|
||||
bfd_min_tx=100,
|
||||
bfd_multiplier_num=10,
|
||||
state='absent'
|
||||
)
|
||||
set_module_args(config)
|
||||
self.execute_module(changed=True)
|
||||
|
||||
def test_ce_is_is_view_present(self):
|
||||
self.get_nc_config.side_effect = (self.before, self.after)
|
||||
update = ['isis 100',
|
||||
'description ISIS',
|
||||
'is-level level_1',
|
||||
'cost-style narrow',
|
||||
'circuit-cost 60 level-2',
|
||||
'bandwidth-reference 100',
|
||||
'network-entity netentity',
|
||||
'preference 100 route-policy route',
|
||||
'maximum load-balancing 32',
|
||||
'nexthop 1.1.1.1 weight 100',
|
||||
'import-route isis level-2 into level-1 filter-policy route-policy import tag 100 direct allow-filter-policy allow-up-down-bit',
|
||||
'preference 100 route-policy route',
|
||||
'undo import-route isis level-1 into level-2 disable',
|
||||
'default-route-advertise always cost 100 tag 100 level-1 avoid-learning',
|
||||
'import-route isis level-2 into level-1 filter-policy route-policy import tag 100 direct allow-filter-policy allow-up-down-bit',
|
||||
'preference 100 route-policy route',
|
||||
'import-route ospf 100 inherit-cost cost-type external cost 100 tag 100 route-policy import level-1',
|
||||
'default-route-advertise always cost 100 tag 100 level-1 avoid-learning',
|
||||
'import-route isis level-2 into level-1 filter-policy route-policy import tag 100 direct allow-filter-policy allow-up-down-bit',
|
||||
'preference 100 route-policy route',
|
||||
'bfd all-interfaces enable',
|
||||
'bfd all-interfaces min-rx-interval 100 min-tx-interval 100 detect-multiplier 10',
|
||||
'import-route ospf 100 inherit-cost cost-type external cost 100 tag 100 route-policy import level-1',
|
||||
'default-route-advertise always cost 100 tag 100 level-1 avoid-learning',
|
||||
'import-route isis level-2 into level-1 filter-policy route-policy import tag 100 direct allow-filter-policy allow-up-down-bit',
|
||||
'preference 100 route-policy route',
|
||||
'filter-policy ip-prefix export route-policy export export ospf 100',
|
||||
'bfd all-interfaces min-rx-interval 100 min-tx-interval 100 detect-multiplier 10',
|
||||
'import-route ospf 100 inherit-cost cost-type external cost 100 tag 100 route-policy import level-1',
|
||||
'default-route-advertise always cost 100 tag 100 level-1 avoid-learning',
|
||||
'import-route isis level-2 into level-1 filter-policy route-policy import tag 100 direct allow-filter-policy allow-up-down-bit',
|
||||
'preference 100 route-policy route',
|
||||
'filter-policy acl-name acl route-policy importimport',
|
||||
'filter-policy ip-prefix export route-policy export export ospf 100',
|
||||
'bfd all-interfaces min-rx-interval 100 min-tx-interval 100 detect-multiplier 10',
|
||||
'import-route ospf 100 inherit-cost cost-type external cost 100 tag 100 route-policy import level-1',
|
||||
'default-route-advertise always cost 100 tag 100 level-1 avoid-learning',
|
||||
'import-route isis level-2 into level-1 filter-policy route-policy import tag 100 direct allow-filter-policy allow-up-down-bit',
|
||||
'preference 100 route-policy route',
|
||||
'auto-cost enable',
|
||||
'auto-cost enable compatible']
|
||||
|
||||
config = dict(
|
||||
instance_id=100,
|
||||
description='ISIS',
|
||||
islevel='level_1',
|
||||
coststyle='narrow',
|
||||
stdlevel2cost=60,
|
||||
stdbandwidth=100,
|
||||
autocostenable=True,
|
||||
autocostenablecompatible=True,
|
||||
netentity='netentity',
|
||||
preference_value=100,
|
||||
route_policy_name='route',
|
||||
max_load=32,
|
||||
ip_address='1.1.1.1',
|
||||
weight=100,
|
||||
penetration_direct='level2-level1',
|
||||
import_routepolicy_name='import',
|
||||
tag=100,
|
||||
allow_filter=True,
|
||||
allow_up_down=True,
|
||||
enablelevel1tolevel2=True,
|
||||
defaultmode='always',
|
||||
mode_routepolicyname='mode',
|
||||
cost=100,
|
||||
mode_tag=100,
|
||||
level_type='level_1',
|
||||
avoid_learning=True,
|
||||
protocol='ospf',
|
||||
processid=100,
|
||||
cost_type='external',
|
||||
import_cost=100,
|
||||
import_tag=100,
|
||||
import_route_policy='import',
|
||||
impotr_leveltype='level_1',
|
||||
inheritcost=True,
|
||||
permitibgp=True,
|
||||
export_protocol='ospf',
|
||||
export_policytype='aclNumOrName',
|
||||
export_processid=100,
|
||||
export_ipprefix='export',
|
||||
export_routepolicyname='export',
|
||||
import_aclnumorname='acl',
|
||||
import_routepolicyname='import',
|
||||
bfd_min_rx=100,
|
||||
bfd_min_tx=100,
|
||||
bfd_multiplier_num=10
|
||||
)
|
||||
set_module_args(config)
|
||||
result = self.execute_module(changed=True)
|
||||
self.assertEquals(sorted(result['updates']), sorted(update))
|
||||
|
||||
def test_ce_is_is_view_no_changed(self):
|
||||
self.get_nc_config.side_effect = (self.after, self.after)
|
||||
config = dict(
|
||||
instance_id=100,
|
||||
description='ISIS',
|
||||
islevel='level_1',
|
||||
coststyle='narrow',
|
||||
stdlevel2cost=60,
|
||||
stdbandwidth=100,
|
||||
autocostenable=True,
|
||||
autocostenablecompatible=True,
|
||||
netentity='netentity',
|
||||
preference_value=100,
|
||||
route_policy_name='route',
|
||||
max_load=32,
|
||||
ip_address='1.1.1.1',
|
||||
weight=100,
|
||||
penetration_direct='level2-level1',
|
||||
import_routepolicy_name='import',
|
||||
tag=100,
|
||||
allow_filter=True,
|
||||
allow_up_down=True,
|
||||
enablelevel1tolevel2=True,
|
||||
defaultmode='always',
|
||||
mode_routepolicyname='mode',
|
||||
cost=100,
|
||||
mode_tag=100,
|
||||
level_type='level_1',
|
||||
avoid_learning=True,
|
||||
protocol='ospf',
|
||||
processid=100,
|
||||
cost_type='external',
|
||||
import_cost=100,
|
||||
import_tag=100,
|
||||
import_route_policy='import',
|
||||
impotr_leveltype='level_1',
|
||||
inheritcost=True,
|
||||
permitibgp=True,
|
||||
export_protocol='ospf',
|
||||
export_policytype='aclNumOrName',
|
||||
export_processid=100,
|
||||
export_ipprefix='export',
|
||||
export_routepolicyname='export',
|
||||
import_aclnumorname='acl',
|
||||
import_routepolicyname='import',
|
||||
bfd_min_rx=100,
|
||||
bfd_min_tx=100,
|
||||
bfd_multiplier_num=10
|
||||
)
|
||||
set_module_args(config)
|
||||
self.execute_module(changed=False)
|
Loading…
Reference in a new issue