コード例 #1
0
 def test_print_fac(self):
     fac1 = peerfinder.Facility(name="Test Facility 1", ASN=1,)
     fac2 = peerfinder.Facility(name="Test Facility 2", ASN=1,)
     peer1 = peerfinder.Peer(
         name="peer1", ASN=1, present_in=[fac1, fac2], peering_on=[]
     )
     peer2 = peerfinder.Peer(name="peer2", ASN=1, present_in=[fac1], peering_on=[])
     self.assertIsNone(peerfinder.print_fac([peer1, peer2]))
コード例 #2
0
 def test_pdb_to_peer(self):
     ixp = peerfinder.pdb_to_ixp(self.netixlan_set)
     fac = peerfinder.pdb_to_fac(self.netfac_set)
     expected = peerfinder.Peer(
         name="Test Peer", ASN=65536, peering_on=ixp, present_in=fac,
     )
     self.assertEqual(expected, peerfinder.pdb_to_peer(self.peer, ixp, fac))
コード例 #3
0
 def test_fetch_different_ixps(self):
     ix1 = peerfinder.IXP(
         name="Test IX1",
         subnet4=[IPv4Address("192.0.2.1")],
         subnet6=[IPv6Address("0100::")],
         speed=1000,
     )
     ix2 = peerfinder.IXP(
         name="Test IX2",
         subnet4=[IPv4Address("192.0.2.2")],
         subnet6=[IPv6Address("0100::")],
         speed=1000,
     )
     expected = ["Test IX1", "Test IX2"]
     peer1 = peerfinder.Peer(name="peer1", ASN=1, present_in=[], peering_on=[ix1])
     peer2 = peerfinder.Peer(name="peer2", ASN=1, present_in=[], peering_on=[ix2])
     self.assertEqual(expected, peerfinder.fetch_different_ixps([peer1, peer2]))
コード例 #4
0
 def test_print_uncommon(self):
     ix1 = peerfinder.IXP(
         name="Test IX1",
         subnet4=[IPv4Address("192.0.2.1")],
         subnet6=[IPv6Address("0100::")],
         speed=1000,
     )
     ix2 = peerfinder.IXP(
         name="Test IX2",
         subnet4=[IPv4Address("192.0.2.2")],
         subnet6=[IPv6Address("0100::")],
         speed=1000,
     )
     peer1 = peerfinder.Peer(name="peer1", ASN=1, present_in=[], peering_on=[ix1])
     peer2 = peerfinder.Peer(
         name="peer2", ASN=1, present_in=[], peering_on=[ix1, ix2]
     )
     self.assertIsNone(peerfinder.print_uncommon([peer1, peer2]))