예제 #1
0
    def testAttributes(self):
        """! Test attributes function
        @param self this object
        @return none
        """
        ##
        ## Yes, I know, the GetAttribute interface for Python is
        ## horrible, we should fix this soon, I hope.
        ##
        queue = ns.network.DropTailQueue()

        queue.SetAttribute("MaxPackets", ns.core.UintegerValue(123456))

        limit = ns.core.UintegerValue()
        queue.GetAttribute("MaxPackets", limit)
        self.assertEqual(limit.Get(), 123456)

        ## -- object pointer values
        mobility = ns.mobility.RandomWaypointMobilityModel()
        ptr = ns.core.PointerValue()
        mobility.GetAttribute("PositionAllocator", ptr)
        self.assertEqual(ptr.GetObject(), None)

        pos = ns.mobility.ListPositionAllocator()
        mobility.SetAttribute("PositionAllocator", ns.core.PointerValue(pos))

        ptr = ns.core.PointerValue()
        mobility.GetAttribute("PositionAllocator", ptr)
        self.assert_(ptr.GetObject() is not None)
예제 #2
0
    def testAttributes(self):
        """! Test attributes function
        @param self this object
        @return none
        """
        # Templated class DropTailQueue<Packet> in C++
        queue = ns.network.DropTailQueue__Ns3Packet()
        queueSizeValue = ns.network.QueueSizeValue(
            ns.network.QueueSize("500p"))
        queue.SetAttribute("MaxSize", queueSizeValue)

        limit = ns.network.QueueSizeValue()
        queue.GetAttribute("MaxSize", limit)
        self.assertEqual(limit.Get(), ns.network.QueueSize("500p"))

        ## -- object pointer values
        mobility = ns.mobility.RandomWaypointMobilityModel()
        ptr = ns.core.PointerValue()
        mobility.GetAttribute("PositionAllocator", ptr)
        self.assertEqual(ptr.GetObject(), None)

        pos = ns.mobility.ListPositionAllocator()
        mobility.SetAttribute("PositionAllocator", ns.core.PointerValue(pos))

        ptr = ns.core.PointerValue()
        mobility.GetAttribute("PositionAllocator", ptr)
        self.assertTrue(ptr.GetObject() is not None)
예제 #3
0
    def testAttributes(self):

        queue = ns.network.DropTailQueue()

        queue.SetAttribute("MaxPackets", ns.core.UintegerValue(123456))

        limit = ns.core.UintegerValue()
        queue.GetAttribute("MaxPackets", limit)
        self.assertEqual(limit.Get(), 123456)

        mobility = ns.mobility.RandomWaypointMobilityModel()
        ptr = ns.core.PointerValue()
        mobility.GetAttribute("PositionAllocator", ptr)
        self.assertEqual(ptr.GetObject(), None)

        pos = ns.mobility.ListPositionAllocator()
        mobility.SetAttribute("PositionAllocator", ns.core.PointerValue(pos))

        ptr = ns.core.PointerValue()
        mobility.GetAttribute("PositionAllocator", ptr)
        self.assert_(ptr.GetObject() is not None)