Beispiel #1
0
    def test_7_matches(self):
        m1a = rtm.Match(exa.AFI(exa.AFI.ipv4),
                        exa.SAFI(exa.SAFI.mpls_vpn),
                        exa.RouteTarget(64512, 1))
        m1b = rtm.Match(exa.AFI(exa.AFI.ipv4),
                        exa.SAFI(exa.SAFI.mpls_vpn),
                        exa.RouteTarget(64512, 1))
        m1c = rtm.Match(exa.AFI(exa.AFI.ipv4),
                        exa.SAFI(exa.SAFI.mpls_vpn),
                        exa.RouteTarget(64512, 1, False))
        m2 = rtm.Match(exa.AFI(exa.AFI.ipv4),
                       exa.SAFI(exa.SAFI.mpls_vpn),
                       exa.RouteTarget(64512, 2))
        m3 = rtm.Match(exa.AFI(exa.AFI.ipv4),
                       exa.SAFI(exa.SAFI.mpls_vpn),
                       exa.RouteTarget(64513, 1))

        self.assertEqual(hash(m1a), hash(m1b))
        self.assertEqual(hash(m1a), hash(m1c))
        self.assertNotEqual(hash(m1a), hash(m2))
        self.assertNotEqual(hash(m1a), hash(m3))

        self.assertEqual(m1a, m1b)
        self.assertEqual(m1a, m1c)
        self.assertNotEqual(m1a, m2)
        self.assertNotEqual(m1a, m3)
Beispiel #2
0
   - testDx : to test worker cleanup
   - testEx : to test dumpState

"""

import testtools
from unittest import mock

from networking_bagpipe.bagpipe_bgp import engine
from networking_bagpipe.bagpipe_bgp.engine import bgp_peer_worker as bpw
from networking_bagpipe.bagpipe_bgp.engine import exa
from networking_bagpipe.bagpipe_bgp.engine import route_table_manager as rtm
from networking_bagpipe.bagpipe_bgp.engine import worker
from networking_bagpipe.tests.unit.bagpipe_bgp import base as t

MATCH1 = rtm.Match(exa.AFI(exa.AFI.ipv4), exa.SAFI(exa.SAFI.mpls_vpn), t.RT1)
MATCH2 = rtm.Match(exa.AFI(exa.AFI.ipv4), exa.SAFI(exa.SAFI.mpls_vpn), t.RT2)
MATCH3 = rtm.Match(exa.AFI(exa.AFI.ipv4), exa.SAFI(exa.SAFI.mpls_vpn), t.RT3)


class TestRouteTableManager(testtools.TestCase, t.BaseTestBagPipeBGP):
    def setUp(self):
        super(TestRouteTableManager, self).setUp()
        self.rtm = rtm.RouteTableManager(mock.Mock(), mock.Mock())
        self.rtm.start()
        self.set_event_target_worker(self.rtm)

    def tearDown(self):
        super(TestRouteTableManager, self).tearDown()
        self.rtm.stop()
        self.rtm.join()