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))
def test_pdb_to_ixp(self): expected = peerfinder.IXP( name="Test IX", subnet4=[IPv4Address("192.0.2.1")], subnet6=[IPv6Address("0100::")], ) self.assertEqual(expected, peerfinder.pdb_to_ixp(self.netixlan_set))
def test_fetch_common_facilities(self): ixp = [peerfinder.pdb_to_ixp(self.netixlan_set)] fac = [peerfinder.pdb_to_fac(self.netfac_set)] peer = [peerfinder.pdb_to_peer(self.peer, ixp, fac)] expected = {"Test Facility"} self.assertEqual(expected, peerfinder.fetch_common_facilities(peer))
def test_fetch_ix_from_ixps(self): expected = peerfinder.pdb_to_ixp(self.netixlan_set) ixp = [peerfinder.pdb_to_ixp(self.netixlan_set)] self.assertEqual(expected, peerfinder.fetch_ix_from_ixps("Test IX", ixp))