def test_ce_static_route_bfd_changed_true(self):
     srBfdPara_1 = load_fixture('ce_static_route_bfd', 'srBfdPara_1.txt')
     srBfdPara_2 = load_fixture('ce_static_route_bfd', 'srBfdPara_2.txt')
     staticrtbase_1 = load_fixture('ce_static_route_bfd',
                                   'staticrtbase_1.txt')
     staticrtbase_2 = load_fixture('ce_static_route_bfd',
                                   'staticrtbase_2.txt')
     self.get_nc_config.side_effect = (srBfdPara_1, staticrtbase_1,
                                       srBfdPara_2, staticrtbase_2)
     updates = [
         'ip route-static vpn-instance mgnt 255.255.0.0 255.255.252.0 10GE1/0/1 10.10.1.1',
         ' preference 22', ' tag 23', ' track bfd-session 43',
         ' description for a test'
     ]
     config = dict(prefix='255.255.0.0',
                   mask=22,
                   aftype='v4',
                   next_hop='10.10.1.1',
                   nhp_interface='10GE1/0/1',
                   vrf='mgnt',
                   destvrf='_public_',
                   tag=23,
                   description='for a test',
                   pref='22',
                   function_flag='dynamicBFD',
                   min_tx_interval='32',
                   min_rx_interval='23',
                   detect_multiplier='24',
                   bfd_session_name='43')
     set_module_args(config)
     result = self.execute_module(changed=True)
     self.assertEqual(sorted(result['updates']), sorted(updates))
Ejemplo n.º 2
0
 def test_lacp_global_present(self):
     xml_existing = load_fixture('ce_lacp', 'ce_lacp_10.txt')
     xml_end_state = load_fixture('ce_lacp', 'ce_lacp_11.txt')
     self.get_nc_config.side_effect = (xml_existing, xml_end_state)
     set_module_args(dict(global_priority=32769, state='present'))
     result = self.execute_module(changed=True)
     self.assertEqual(result['updates'], ['lacp priority 32769'])
Ejemplo n.º 3
0
 def test_lacp_eturnk_absent(self):
     xml_existing = load_fixture('ce_lacp', 'ce_lacp_10.txt')
     xml_end_state = load_fixture('ce_lacp', 'ce_lacp_00.txt')
     default_values = [
         'undo lacp priority', 'lacp timeout Fast',
         'lacp max active-linknumber 1', 'lacp collector delay 0',
         'lacp preempt enable false', 'lacp dampening state-flapping false',
         'lacp dampening unexpected-mac disable false',
         'lacp mixed-rate link enable false',
         'lacp port-id-extension enable false', 'lacp preempt delay 30',
         'lacp select Speed', 'lacp system-id 11-22-33',
         'lacp timeout user-defined 3'
     ]
     self.get_nc_config.side_effect = (xml_existing, xml_end_state)
     set_module_args(
         dict(mode='Dynamic',
              trunk_id='10',
              preempt_enable='true',
              state_flapping='true',
              port_id_extension_enable='true',
              unexpected_mac_disable='true',
              system_id='0000-1111-2222',
              timeout_type='Fast',
              fast_timeout='10',
              mixed_rate_link_enable='true',
              preempt_delay=11,
              collector_delay=12,
              max_active_linknumber=13,
              select='Speed',
              state='absent'))
     result = self.execute_module(changed=True)
     self.assertEqual(sorted(result['updates']), sorted(default_values))
Ejemplo n.º 4
0
 def test_lacp_sys_parameter_present(self):
     update = [
         'lldp enable', 'lldp mdn enable', 'lldp mdn enable',
         'lldp transmit interval 8', 'lldp transmit multiplier 8',
         'lldp restart 8', 'lldp transmit delay 8', 'lldp trap-interval 8',
         'lldp fast-count 8', 'lldp mdn trap-interval 8',
         'lldp management-address 1.1.1.1',
         'lldp management-address bind interface bind-name'
     ]
     self.get_nc_config.side_effect = self.get_side_effect
     self.set_nc_config.side_effect = [self.result_ok] * 11
     set_module_args(
         dict(lldpenable='enabled',
              mdnstatus='rxOnly',
              interval=8,
              hold_multiplier=8,
              restart_delay=8,
              transmit_delay=8,
              notification_interval=8,
              fast_count=8,
              mdn_notification_interval=8,
              management_address='1.1.1.1',
              bind_name='bind-name'))
     result = self.execute_module(changed=True)
     self.assertEqual(sorted(result['updates']), sorted(update))
 def test_lldp_absent(self):
     self.get_nc_config.side_effect = (self.xml_present, self.xml_present,
                                       self.xml_absent, self.xml_absent)
     self.set_nc_config.return_value = self.result_ok
     config = dict(lldpenable='enabled',
                   function_lldp_interface_flag='disableINTERFACE',
                   type_tlv_disable='basic_tlv',
                   type_tlv_enable='dot1_tlv',
                   ifname='10GE1/0/1',
                   lldpadminstatus='txOnly',
                   manaddrtxenable=False,
                   portdesctxenable=False,
                   syscaptxenable=False,
                   sysdesctxenable=False,
                   sysnametxenable=False,
                   portvlantxenable=False,
                   protovlantxenable=False,
                   txprotocolvlanid=False,
                   vlannametxenable=False,
                   txvlannameid=18,
                   txinterval=18,
                   protoidtxenable=False,
                   macphytxenable=False,
                   linkaggretxenable=False,
                   maxframetxenable=False,
                   eee=False,
                   dcbx=False,
                   state='absent')
     set_module_args(config)
     result = self.execute_module(changed=False)
 def test_repeat_enable(self):
     self.get_nc_config.side_effect = (self.after, self.after, self.after, self.after, )
     set_module_args(dict(
         lldpenable='enabled',
         mdnstatus='rxOnly',
         ifname='10GE1/0/1')
     )
     self.execute_module(changed=False)
 def test_mdn_enable(self):
     update = [['lldp enable', 'interface 10GE1/0/1', 'lldp mdn enable']]
     self.get_nc_config.side_effect = (self.before, self.before, self.after, self.after)
     set_module_args(dict(
         lldpenable='enabled',
         mdnstatus='rxOnly',
         ifname='10GE1/0/1')
     )
     result = self.execute_module(changed=True)
     self.assertEquals(sorted(result['updates']), sorted(update))
 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_isis_interface_absent(self):
     update = [
         'interface 10GE1/0/1', 'undo isis enable',
         'undo isis circuit-level', 'undo isis ppp-negotiation'
     ]
     self.get_nc_config.side_effect = (self.after, self.before)
     config = dict(instance_id=100,
                   ifname='10GE1/0/1',
                   leveltype='level_1',
                   level1dispriority=10,
                   silentenable=True,
                   silentcost=True,
                   typep2penable=True,
                   snpacheck=True,
                   p2pnegotiationmode='2_way',
                   p2ppeeripignore=True,
                   ppposicpcheckenable=True,
                   level2cost=10,
                   state='absent')
     set_module_args(config)
     result = self.execute_module(changed=True)
     self.assertEquals(sorted(result['updates']), sorted(update))
    def test_ce_static_route_bfd_changed_false(self):
        srBfdPara_1 = load_fixture('ce_static_route_bfd', 'srBfdPara_1.txt')
        staticrtbase_1 = load_fixture('ce_static_route_bfd',
                                      'staticrtbase_1.txt')
        self.get_nc_config.side_effect = (srBfdPara_1, srBfdPara_1,
                                          staticrtbase_1, staticrtbase_1)

        config = dict(prefix='255.255.0.0',
                      mask=22,
                      aftype='v4',
                      next_hop='10.10.1.1',
                      nhp_interface='10GE1/0/1',
                      vrf='mgnt',
                      destvrf='_public_',
                      tag=23,
                      description='for a test',
                      pref='22',
                      function_flag='dynamicBFD',
                      min_tx_interval='32',
                      min_rx_interval='23',
                      detect_multiplier='24',
                      bfd_session_name='43')
        set_module_args(config)
        self.execute_module(changed=False)
 def test_multicast_undo_enable(self):
     update = ['undo multicast routing-enable']
     self.get_nc_config.side_effect = (self.after, self.before)
     set_module_args(dict(aftype='v4', vrf='vpna', state='absent'))
     result = self.execute_module(changed=True)
     self.assertEquals(sorted(result['updates']), sorted(update))
    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))