Esempio n. 1
0
    def test_BundleEtherInterface(self):

        Genie.testbed = Testbed()
        dev1 = Device(name='PE1', os='iosxr')
        lo0 = Interface(device=dev1, name='Loopback0')
        intf1 = Interface(device=dev1, name='GigabitEthernet0/0/0/1')
        intf2 = Interface(device=dev1, name='GigabitEthernet0/0/0/2')

        bundle = Interface(device=dev1, name='Bundle-Ether1')
        self.assertEqual(bundle.interface_number, 1)
        bundle.ipv4 = '14.14.14.14/24'
        bundle.ipv6 = '14:14:14::4/64'
        bundle.lag_bfd_v4_destination = '5.0.0.97'
        bundle.lag_bfd_v4_fast_detect = True
        bundle.lag_bfd_v4_min_interval = 100
        bundle.lag_bfd_v6_destination = '6.0.0.98'
        bundle.lag_bfd_v6_fast_detect = True
        bundle.lag_bfd_v6_min_interval = 200

        intf1.bundle = bundle
        intf1.bundle_mode = 'active'

        intf2.bundle = bundle

        cfg = bundle.build_config(apply=False)
        self.assertMultiLineEqual(
            str(cfg), '\n'.join([
                'interface Bundle-Ether1',
                ' ipv4 address 14.14.14.14/24',
                ' ipv6 address 14:14:14::4/64',
                ' bfd address-family ipv4 destination 5.0.0.97',
                ' bfd address-family ipv4 fast-detect',
                ' bfd address-family ipv4 minimum-interval 100',
                ' bfd address-family ipv6 destination 6.0.0.98',
                ' bfd address-family ipv6 fast-detect',
                ' bfd address-family ipv6 minimum-interval 200',
                ' exit',
            ]))

        cfg = intf1.build_config(apply=False)
        self.assertMultiLineEqual(
            str(cfg), '\n'.join([
                'interface GigabitEthernet0/0/0/1',
                ' bundle id 1 mode active',
                ' exit',
            ]))

        cfg = intf2.build_config(apply=False)
        self.assertMultiLineEqual(
            str(cfg), '\n'.join([
                'interface GigabitEthernet0/0/0/2',
                ' bundle id 1',
                ' exit',
            ]))
Esempio n. 2
0
    def test_BundleEtherInterface(self):

        Genie.testbed = Testbed()
        dev1 = Device(name='PE1', os='iosxr')
        lo0 = Interface(device=dev1, name='Loopback0')
        intf1 = Interface(device=dev1, name='GigabitEthernet0/0/0/1')
        intf2 = Interface(device=dev1, name='GigabitEthernet0/0/0/2')

        bundle = Interface(device=dev1, name='Bundle-Ether1')
        self.assertEqual(bundle.interface_number, 1)
        bundle.ipv4 = '14.14.14.14/24'
        bundle.ipv6 = '14:14:14::4/64'

        intf1.bundle = bundle
        intf1.bundle_mode = 'active'

        intf2.bundle = bundle

        cfg = bundle.build_config(apply=False)
        self.assertMultiLineEqual(
            str(cfg), '\n'.join([
                'interface Bundle-Ether1',
                ' ipv4 address 14.14.14.14/24',
                ' ipv6 address 14:14:14::4/64',
                ' exit',
            ]))

        cfg = intf1.build_config(apply=False)
        self.assertMultiLineEqual(
            str(cfg), '\n'.join([
                'interface GigabitEthernet0/0/0/1',
                ' bundle id 1 mode active',
                ' exit',
            ]))

        cfg = intf2.build_config(apply=False)
        self.assertMultiLineEqual(
            str(cfg), '\n'.join([
                'interface GigabitEthernet0/0/0/2',
                ' bundle id 1',
                ' exit',
            ]))