The networking_cisco.tests.unit.cisco.cfg_agent.test_asr1k_cfg_syncer Module

class networking_cisco.tests.unit.cisco.cfg_agent.test_asr1k_cfg_syncer.ASR1kCfgSyncer(*args, **kwds)

Bases: neutron.tests.base.BaseTestCase

setUp()
test_clean_acls_basic_running_cfg(*args, **kwargs)

region 1 acls should be ignored

test_clean_ha_backup_router_with_two_subnet_gw(*args, **kwargs)
test_clean_ha_backup_routers_with_two_subnet_gw_and_single_subnet_gw(*args, **kwargs)
test_clean_interfaces_R2_run_cfg_present_multi_region_enabled(*args, **kwargs)

In this test, we are simulating a cfg-sync, clean_interfaces for region 0000002 cfg-agent. Existing running-cfg exists for region 0000001 and 0000002.

At the end of test, we should expect zero entries in invalid_cfg.

test_clean_interfaces_R2_with_invalid_intfs(*args, **kwargs)

In this test, we are simulating a cfg-sync, clean_interfaces for region 0000002 cfg-agent. Existing running-cfg exists for region 0000001 and 0000002.

At the end of test, we should expect two invalid intfs detected.

invalid tenant router, int Po10.2536 (invalid segment-id) invalid ext-gw-port, int Po10.3000 (invalid HSRP VIP)

test_clean_interfaces_basic_multi_region_enabled(*args, **kwargs)

In this test, we are simulating a cfg-sync, clean_interfaces for region 0000002 cfg-agent. Running-cfg only exists for region 0000001.

At the end of test, we should expect zero entries in invalid_cfg.

test_clean_interfaces_multi_region_disabled(*args, **kwargs)

In this test, we are simulating a cfg-sync, clean_interfaces for region 0000002 cfg-agent. Running-cfg only exists for region 0000001, but multi_region is disabled.

At the end of test, we should expect zero entries in invalid_cfg.

test_clean_nat_pool_overload_basic_running_cfg(*args, **kwargs)

region 1 acls should be ignored

test_clean_router_with_two_subnet_gw(*args, **kwargs)
test_clean_routers_with_two_subnet_gw_and_single_subnet_gw(*args, **kwargs)
test_delete_invalid_cfg_empty_routers_list(*args, **kwargs)

expected invalid_cfg:

[u'ip nat inside source static 10.2.0.5 172.16.0.126 vrf'
  ' nrouter-3ea5f9 redundancy neutron-hsrp-1064-3000',
 u'ip nat inside source list neutron_acl_2564 pool'
  ' nrouter-3ea5f9_nat_pool vrf nrouter-3ea5f9 overload',
 u'ip nat pool nrouter-3ea5f9_nat_pool 172.16.0.124'
  ' 172.16.0.124 netmask 255.255.0.0',
 u'ip route vrf nrouter-3ea5f9 0.0.0.0 0.0.0.0'
  ' Port-channel10.3000 172.16.0.1',
 u'ip access-list standard neutron_acl_2564',
 <IOSCfgLine # 83 'interface Port-channel10.2564'>,
 <IOSCfgLine # 96 'interface Port-channel10.3000'>,
 u'nrouter-3ea5f9']
test_delete_invalid_cfg_with_multi_region_and_empty_routers_list(*args, **kwargs)

This test verifies that the cfg-syncer will delete invalid cfg if the neutron-db (routers dictionary list) happens to be empty.

Since the neutron-db router_db_info is empty, all region 0000002 running-config should be deleted.

Expect 8 invalid configs found:

['ip nat inside source static 10.2.0.5 172.16.0.126 '
 'vrf nrouter-3ea5f9-0000002 redundancy neutron-hsrp-1064-3000',
 'ip nat inside source list neutron_acl_0000002_2564 pool '
 'nrouter-3ea5f9-0000002_nat_pool vrf nrouter-3ea5f9-0000002 '
 'overload',
 'ip nat pool nrouter-3ea5f9-0000002_nat_pool '
 '172.16.0.124 172.16.0.124 netmask 255.255.0.0',
 'ip route vrf nrouter-3ea5f9-0000002 0.0.0.0 0.0.0.0 '
 'Port-channel10.3000 172.16.0.1',
 'ip access-list standard neutron_acl_0000002_2564',
 <IOSCfgLine # 83 'interface Port-channel10.2564'>,
 <IOSCfgLine # 96 'interface Port-channel10.3000'>,
 'nrouter-3ea5f9-0000002']