Ejemplo n.º 1
0
    def test_create_endpoint(self):
        end1 = create_endpoint(self.EXAMPLE_IP[0], self.EXAMPLE_IP[0])
        src1 = end1.src
        dst1 = end1.dst
        self.assertEqual(src1, dst1)
        end1.delete()

        end2 = create_endpoint(self.EXAMPLE_IP[0], self.EXAMPLE_IP[1])
        self.assertEqual(src1, end2.src)
        self.assertNotEqual(dst1, end2.dst)
        end2.delete()
Ejemplo n.º 2
0
 def test_create_endpoint(self):
     end1 = create_endpoint(self.EXAMPLE_IP[0], self.EXAMPLE_IP[0])
     src1 = end1.src
     dst1 = end1.dst
     self.assertEqual(src1, dst1)
     end1.delete()
     
     end2 = create_endpoint(self.EXAMPLE_IP[0], self.EXAMPLE_IP[1])
     self.assertEqual(src1, end2.src)
     self.assertNotEqual(dst1, end2.dst)
     end2.delete()
Ejemplo n.º 3
0
 def test_find_endpoint(self):
     self.assertIsNone(find_endpoint(self.EXAMPLE_IP[0], self.EXAMPLE_IP[0]))
     
     end1 = create_endpoint(self.EXAMPLE_IP[0], self.EXAMPLE_IP[0])
     end1_find = find_endpoint(self.EXAMPLE_IP[0], self.EXAMPLE_IP[0])
     self.assertEqual(end1, end1_find)
     
     self.assertIsNone(find_endpoint(self.EXAMPLE_IP[0], self.EXAMPLE_IP[1]))
     end2 = create_endpoint(self.EXAMPLE_IP[0], self.EXAMPLE_IP[1])
     end2_find = find_endpoint(self.EXAMPLE_IP[0], self.EXAMPLE_IP[1])
     self.assertEqual(end2, end2_find)
     
     self.assertIsNone(find_endpoint(self.EXAMPLE_IP[1], self.EXAMPLE_IP[0]))
Ejemplo n.º 4
0
    def test_find_endpoint(self):
        self.assertIsNone(find_endpoint(self.EXAMPLE_IP[0],
                                        self.EXAMPLE_IP[0]))

        end1 = create_endpoint(self.EXAMPLE_IP[0], self.EXAMPLE_IP[0])
        end1_find = find_endpoint(self.EXAMPLE_IP[0], self.EXAMPLE_IP[0])
        self.assertEqual(end1, end1_find)

        self.assertIsNone(find_endpoint(self.EXAMPLE_IP[0],
                                        self.EXAMPLE_IP[1]))
        end2 = create_endpoint(self.EXAMPLE_IP[0], self.EXAMPLE_IP[1])
        end2_find = find_endpoint(self.EXAMPLE_IP[0], self.EXAMPLE_IP[1])
        self.assertEqual(end2, end2_find)

        self.assertIsNone(find_endpoint(self.EXAMPLE_IP[1],
                                        self.EXAMPLE_IP[0]))
Ejemplo n.º 5
0
def register_endpoints_meta(service, meta):
    """
    Registers that a service holds information about EndPointPair data.
    for example IPerf, OWAMP, Pinger

    see L{register_metadata}.
    """
    if not isinstance(meta, psMetadata):
        raise ValueError("meta must be of type psapi.protocol.Metadata")

    if not isinstance(meta.subject.contents, psEndPointPair):
        raise ValueError("metadata subject must be of type "
            "psapi.protocol.EndPointPair, not %s" % type(meta.subject.contents))

    src = meta.subject.src
    dst = meta.subject.dst

    endpoints = create_endpoint(src, dst)
    register_service_watch_list(service, endpoints, meta.event_types)

    return endpoints