Example #1
0
    def test_ios_bgp_address_family_neighbors(self):
        af_nbr_1 = dict(neighbor='192.51.100.1',
                        maximum_prefix=35,
                        activate=True)
        af_nbr_2 = dict(neighbor='192.51.100.3',
                        route_reflector_client=True,
                        activate=True)

        config = dict(bgp_as=64496,
                      address_family=[
                          dict(afi='ipv4',
                               safi='multicast',
                               neighbors=[af_nbr_1, af_nbr_2])
                      ],
                      networks=None)

        obj = Provider(params=dict(config=config, operation='merge'))

        commands = obj.render(self._bgp_config)
        cmd = [
            'router bgp 64496', 'address-family ipv4 multicast',
            'neighbor 192.51.100.1 activate',
            'neighbor 192.51.100.1 maximum-prefix 35',
            'neighbor 192.51.100.3 activate',
            'neighbor 192.51.100.3 route-reflector-client',
            'exit-address-family', 'exit'
        ]
        self.assertEqual(sorted(commands), sorted(cmd))
Example #2
0
    def test_ios_bgp_address_family_redistribute_idempotent(self):
        rd_1 = dict(protocol='eigrp', metric=10, route_map='RMAP_3', id=None)
        rd_2 = dict(protocol='static', metric=100, id=None, route_map=None)

        config = dict(bgp_as=64496,
                      address_family=[
                          dict(afi='ipv4',
                               safi='unicast',
                               redistribute=[rd_1, rd_2])
                      ],
                      networks=None)

        obj = Provider(params=dict(config=config, operation='merge'))

        commands = obj.render(self._bgp_config)
        self.assertEqual(commands, [])
Example #3
0
    def test_ios_bgp_address_family_redistribute(self):
        rd_1 = dict(protocol='ospf', id='233', metric=90, route_map=None)

        config = dict(bgp_as=64496,
                      address_family=[
                          dict(afi='ipv4', safi='unicast', redistribute=[rd_1])
                      ],
                      networks=None)

        obj = Provider(params=dict(config=config, operation='merge'))

        commands = obj.render(self._bgp_config)
        cmd = [
            'router bgp 64496', 'address-family ipv4',
            'redistribute ospf 233 metric 90', 'exit-address-family', 'exit'
        ]
        self.assertEqual(sorted(commands), sorted(cmd))