Exemple #1
0
    def __init__(self, dialect, mav, source_system, source_component, nogui,
                 multi, loop, initialModules):
        """
        Start up PaGS
        """

        self.source_system = source_system
        self.source_component = source_component
        self.dialect = dialect
        self.mav = mav

        # The PaGS settings dir
        self.settingsdir = os.path.join(str(Path.home()), ".PaGS")
        if not os.path.exists(self.settingsdir):
            os.makedirs(self.settingsdir)

        # logging.basicConfig(level=logging.DEBUG)
        self.loop = loop

        # Start the connection maxtrix
        self.connmtrx = ConnectionManager(self.loop, dialect, mav,
                                          source_system, source_component)

        # Dict of vehicles
        self.allvehicles = VehicleManager(self.loop)

        # Module manager
        self.modules = moduleManager.moduleManager(self.loop, self.settingsdir,
                                                   not nogui)

        # event links from connmaxtrix -> vehicle manager
        self.connmtrx.onPacketAttach(self.allvehicles.onPacketRecieved)

        # event links from vehicle manager -> connmatrix
        self.allvehicles.onPacketBufTxAttach(self.connmtrx.outgoingPacket)
        asyncio.ensure_future(
            self.allvehicles.onLinkAddAttach(self.connmtrx.addVehicleLink))
        asyncio.ensure_future(
            self.allvehicles.onLinkRemoveAttach(self.connmtrx.removeLink))

        # event links from module manager -> vehicle manager
        self.modules.onPktTxAttach(self.allvehicles.send_message)
        self.modules.onVehListAttach(self.allvehicles.get_vehiclelist)
        self.modules.onVehGetAttach(self.allvehicles.get_vehicle)

        # event links vehicle manager -> module manager
        self.allvehicles.onAddVehicleAttach(self.modules.addVehicle)
        self.allvehicles.onRemoveVehicleAttach(self.modules.removeVehicle)
        self.allvehicles.onPacketRxAttach(self.modules.incomingPacket)

        # Need to load initial modules
        for m in initialModules:
            self.modules.addModule(m)

        # redirect stdout to the terminal printer, if loaded
        # Thus print() can be used properly
        if self.modules.multiModules.get('modules.terminalModule'):
            sys.stdout = RedirPrint(
                self.modules.multiModules.get('modules.terminalModule').print)
    async def test_linkretry_tcp(self):
        """For each of the TCP link types, test that they
        keep re-trying to connect, by only adding in the
        other side of the link 0.5 sec after startup"""
        matrix = ConnectionManager(
            self.loop, self.dialect, self.version, 0, 0, 0.05)
        matrix.onPacketAttach(self.newpacketcallbackVeh)

        await matrix.addVehicleLink(self.VehA.name, self.VehA.target_system, self.linkA)
        await matrix.addVehicleLink(self.VehB.name, self.VehB.target_system, self.linkB)

        # now wait for a bit
        await asyncio.sleep(0.10)

        # now connect the other sides
        tcpserver = TCPConnection(rxcallback=self.newpacketcallbackLnk,
                                  dialect=self.dialect, mavversion=self.version,
                                  srcsystem=0, srccomp=0,
                                  server=True, name='tcpserver:127.0.0.1:15001')
        tcpclient = TCPConnection(rxcallback=self.newpacketcallbackLnk,
                                  dialect=self.dialect, mavversion=self.version,
                                  srcsystem=0, srccomp=0,
                                  server=False, name='tcpclient:127.0.0.1:15020')
        await self.loop.create_server(lambda: tcpserver, self.ip, 15001)
        await self.loop.create_connection(lambda: tcpclient, self.ip, 15020)

        # send packets on each link and wait
        await asyncio.sleep(0.20)

        pkt = self.mod.MAVLink_heartbeat_message(
            5, 4, 0, 0, 0, int(self.version))
        pktbytes = pkt.pack(self.mavUAS, force_mavlink1=False)
        pktbytesone = pkt.pack(self.mavoneUAS, force_mavlink1=False)
        tcpserver.send_data(pktbytes)
        tcpclient.send_data(pktbytesone)

        await asyncio.sleep(0.20)

        await matrix.stoploop()

        tcpserver.close()
        tcpclient.close()

        # assert the links are all still there
        assert len(matrix.getAllVeh()) == 2
        assert len(matrix.linkdict) == 2

        # assert packets were recived on both links (vehicles) in the matrix
        assert self.vehpkts[self.VehA.name][0].get_msgbuf() == pktbytes
        assert self.vehpkts[self.VehB.name][0].get_msgbuf() == pktbytesone
    async def test_matrixstartup(self):
        """Test a simple startup of the matrix"""
        matrix = ConnectionManager(self.loop, self.dialect, self.version, 0, 0)

        await matrix.stoploop()

        assert matrix is not None
    async def test_matrixaddremove(self):
        """Test adding and removing vehicles from the matrix"""
        matrix = ConnectionManager(self.loop, self.dialect, self.version, 0, 0)
        matrix.onPacketAttach(self.newpacketcallbackVeh)

        await matrix.addVehicleLink(self.VehA.name, self.VehA.target_system, self.linkB)
        await matrix.addVehicleLink(self.VehB.name, self.VehB.target_system, self.linkB)
        await matrix.addVehicleLink(self.VehC.name, self.VehC.target_system, self.linkD)

        # now wait for a bit - 0.02 sec
        await asyncio.sleep(0.02)

        assert len(matrix.getAllVeh()) == 3
        assert len(matrix.linkdict) == 2

        # remove a link - it will remove the associated veh C too
        await matrix.removeLink(self.linkD)

        # now wait for a bit - 0.02 sec
        await asyncio.sleep(0.02)

        assert len(matrix.getAllVeh()) == 2
        assert len(matrix.linkdict) == 1

        # remove a vehicle
        await matrix.removeVehicle(self.VehA.name)

        # now wait for a bit - 0.02 sec
        await asyncio.sleep(0.02)

        await matrix.stoploop()

        # assert. It should be VehA and linkB left
        assert len(matrix.getAllVeh()) == 1
        assert len(matrix.linkdict) == 1
    async def test_startup(self):
        """ Test that we can cleanly startup and shutdown
        """
        # Start the connection maxtrix
        self.connmtrx = ConnectionManager(
            self.loop, self.dialect, self.version, 0, 0)

        # Dict of vehicles
        self.allvehicles = VehicleManager(self.loop)

        # Module manager
        self.allModules = moduleManager(
            self.loop, self.dialect, self.version, False)

        # and link them all together
        await self.doEventLinkages()
    async def test_singleConnection(self):
        """ Test that we can get a packet with a single
        vehicle with single connection
        """
        # Start the connection maxtrix
        self.connmtrx = ConnectionManager(
            self.loop, self.dialect, self.version, 0, 0)

        # Dict of vehicles
        self.allvehicles = VehicleManager(self.loop)

        # Module manager
        self.allModules = moduleManager(
            self.loop, self.dialect, self.version, False)

        # and link them all together
        await self.doEventLinkages()

        # add a link
        await self.allvehicles.add_vehicle("VehA", 255, 0, 4, 0,
                                           self.dialect, self.version, 'tcpserver:127.0.0.1:15000')

        # Start a remote connection (TCP)
        self.remoteClient = TCPConnection(rxcallback=self.newpacketcallback,
                                          dialect=self.dialect, mavversion=self.version,
                                          srcsystem=0, srccomp=0,
                                          server=False, name=self.cname)

        await asyncio.sleep(0.3)

        await self.loop.create_connection(lambda: self.remoteClient, self.ip, self.port)

        # wait for 0.02 sec
        await asyncio.sleep(0.02)

        # send a heartbeat packet
        pkt = self.mod.MAVLink_heartbeat_message(
            5, 4, 0, 0, 0, int(self.version))
        self.remoteClient.send_data(pkt.pack(self.mav, force_mavlink1=False))

        await asyncio.sleep(0.02)

        self.remoteClient.close()

        # assert the vehicle recieved the packet
        assert len(self.allvehicles.get_vehicle("VehA").latestPacketDict) == 1
        assert self.allvehicles.get_vehicle("VehA").latestPacketDict[0] == pkt
Exemple #7
0
class pags():
    """
    A single PaGS instance
    """
    def __init__(self, dialect, mav, source_system, source_component, nogui,
                 multi, loop, initialModules):
        """
        Start up PaGS
        """

        self.source_system = source_system
        self.source_component = source_component
        self.dialect = dialect
        self.mav = mav

        # The PaGS settings dir
        self.settingsdir = os.path.join(str(Path.home()), ".PaGS")
        if not os.path.exists(self.settingsdir):
            os.makedirs(self.settingsdir)

        # logging.basicConfig(level=logging.DEBUG)
        self.loop = loop

        # Start the connection maxtrix
        self.connmtrx = ConnectionManager(self.loop, dialect, mav,
                                          source_system, source_component)

        # Dict of vehicles
        self.allvehicles = VehicleManager(self.loop)

        # Module manager
        self.modules = moduleManager.moduleManager(self.loop, self.settingsdir,
                                                   not nogui)

        # event links from connmaxtrix -> vehicle manager
        self.connmtrx.onPacketAttach(self.allvehicles.onPacketRecieved)

        # event links from vehicle manager -> connmatrix
        self.allvehicles.onPacketBufTxAttach(self.connmtrx.outgoingPacket)
        asyncio.ensure_future(
            self.allvehicles.onLinkAddAttach(self.connmtrx.addVehicleLink))
        asyncio.ensure_future(
            self.allvehicles.onLinkRemoveAttach(self.connmtrx.removeLink))

        # event links from module manager -> vehicle manager
        self.modules.onPktTxAttach(self.allvehicles.send_message)
        self.modules.onVehListAttach(self.allvehicles.get_vehiclelist)
        self.modules.onVehGetAttach(self.allvehicles.get_vehicle)

        # event links vehicle manager -> module manager
        self.allvehicles.onAddVehicleAttach(self.modules.addVehicle)
        self.allvehicles.onRemoveVehicleAttach(self.modules.removeVehicle)
        self.allvehicles.onPacketRxAttach(self.modules.incomingPacket)

        # Need to load initial modules
        for m in initialModules:
            self.modules.addModule(m)

        # redirect stdout to the terminal printer, if loaded
        # Thus print() can be used properly
        if self.modules.multiModules.get('modules.terminalModule'):
            sys.stdout = RedirPrint(
                self.modules.multiModules.get('modules.terminalModule').print)

    async def addVehicles(self, source):
        # Create vehicles and links
        # Each sysID is assumed to be a different vehicle
        # Multiple links with the same sysid will create a multilink vehicle
        for connection in source:
            Vehname = "Veh_" + str(connection)
            cn = connection.split(':')[0] + ":" + connection.split(
                ':')[1] + ":" + connection.split(':')[2]
            asyncio.ensure_future(
                self.allvehicles.add_vehicle(Vehname, self.source_system,
                                             self.source_component,
                                             connection.split(':')[3],
                                             connection.split(':')[4],
                                             self.dialect, self.mav, cn))

    def close(self):
        """
        Cleanly shutdown a pags instance
        """

        # shutdown all the modules
        self.loop.run_until_complete(self.modules.closeAllModules())

        # Shutdown all the running tasks
        for veh in self.allvehicles.get_vehiclelist():
            self.loop.run_until_complete(
                self.allvehicles.get_vehicle(veh).stopheartbeat())
            self.loop.run_until_complete(
                self.allvehicles.get_vehicle(veh).stoprxtimeout())

        self.loop.run_until_complete(self.connmtrx.stoploop())
Exemple #8
0
    def __init__(self, dialect, mav, source_system, source_component, nogui,
                 multi, source, loop, initialModules):
        """
        Start up PaGS
        """

        # logging.basicConfig(level=logging.DEBUG)
        self.loop = loop

        # Start the connection maxtrix
        self.connmtrx = ConnectionManager(self.loop, dialect, mav,
                                          source_system, source_component)

        # Dict of vehicles
        self.allvehicles = VehicleManager(self.loop)

        # Module manager
        self.modules = moduleManager.moduleManager(self.loop, dialect, mav,
                                                   not nogui)

        # event links from connmaxtrix -> vehicle manager
        self.connmtrx.onPacketAttach(self.allvehicles.onPacketRecieved)

        # event links from vehicle manager -> connmatrix
        self.allvehicles.onPacketBufTxAttach(self.connmtrx.outgoingPacket)
        asyncio.ensure_future(
            self.allvehicles.onLinkAddAttach(self.connmtrx.addVehicleLink))
        asyncio.ensure_future(
            self.allvehicles.onLinkRemoveAttach(self.connmtrx.removeLink))

        # event links from module manager -> vehicle manager
        self.modules.onPktTxAttach(self.allvehicles.send_message)
        self.modules.onVehListAttach(self.allvehicles.get_vehiclelist)
        self.modules.onVehGetAttach(self.allvehicles.get_vehicle)

        # event links vehicle manager -> module manager
        self.allvehicles.onAddVehicleAttach(self.modules.addVehicle)
        self.allvehicles.onRemoveVehicleAttach(self.modules.removeVehicle)
        self.allvehicles.onPacketRxAttach(self.modules.incomingPacket)

        # Need to load initial modules
        for m in initialModules:
            self.modules.addModule(m)

        # redirect stdout to the terminal printer, if loaded
        # Thus print() can be used properly
        if self.modules.multiModules.get('modules.terminalModule'):
            sys.stdout = RedirPrint(
                self.modules.multiModules.get('modules.terminalModule').print)

        # Single or multi-vehicle?
        if multi != "":
            # TODO: figure out multivehicle parsing file
            pass
        else:
            # Create vehicles and links
            # Each sysID is assumed to be a different vehicle
            # Multiple links with the same sysid will create a multilink vehicle
            for connection in source:
                Vehname = "Veh_" + str(connection.split(':')[3])
                cn = connection.split(':')[0] + ":" + connection.split(
                    ':')[1] + ":" + connection.split(':')[2]
                asyncio.ensure_future(
                    self.allvehicles.add_vehicle(Vehname, source_system,
                                                 source_component,
                                                 connection.split(':')[3],
                                                 connection.split(':')[4],
                                                 dialect, mav, cn))
    async def test_outgoingdistribution(self):
        """Test outgoing packets (from gcs) are distributed
        correctly"""
        # -VehA: LinkA,LinkB, VehB: LinkB, VehC: LinkC
        await self.VehA.setHearbeatRate(0)
        await self.VehB.setHearbeatRate(0)
        await self.VehC.setHearbeatRate(0)

        matrix = ConnectionManager(
            self.loop, self.dialect, self.version, 0, 0, 0.05)
        matrix.onPacketAttach(self.newpacketcallbackVeh)

        self.VehA.onPacketTxAttach(matrix.outgoingPacket)
        self.VehB.onPacketTxAttach(matrix.outgoingPacket)
        self.VehC.onPacketTxAttach(matrix.outgoingPacket)

        await matrix.addVehicleLink(self.VehA.name, self.VehA.target_system, self.linkA)
        await matrix.addVehicleLink(self.VehA.name, self.VehA.target_system, self.linkB)
        await matrix.addVehicleLink(self.VehB.name, self.VehB.target_system, self.linkB)
        await matrix.addVehicleLink(self.VehC.name, self.VehC.target_system, self.linkC)

        # now wait for a bit
        await asyncio.sleep(0.15)

        # now connect the other sides
        tcpserver = TCPConnection(rxcallback=self.newpacketcallbackLnk,
                                  dialect=self.dialect, mavversion=self.version,
                                  srcsystem=0, srccomp=0,
                                  server=True, name='tcpserver:127.0.0.1:15001')
        tcpclient = TCPConnection(rxcallback=self.newpacketcallbackLnk,
                                  dialect=self.dialect, mavversion=self.version,
                                  srcsystem=0, srccomp=0,
                                  server=False, name='tcpclient:127.0.0.1:15020')
        udpserver = UDPConnection(rxcallback=self.newpacketcallbackLnk,
                                  dialect=self.dialect, mavversion=self.version,
                                  srcsystem=0, srccomp=0,
                                  server=True, name='udpserver:127.0.0.1:15002')
        await self.loop.create_server(lambda: tcpserver, self.ip, 15001)
        await self.loop.create_connection(lambda: tcpclient, self.ip, 15020)
        await self.loop.create_datagram_endpoint(lambda: udpserver,
                                                 local_addr=(self.ip, 15002))

        # send packets on each link and wait
        await asyncio.sleep(0.15)

        # send packet from the GCS of VehA, VehB and VehC
        pktbytesA = self.VehA.sendPacket(self.mod.MAVLINK_MSG_ID_HEARTBEAT,
                                         type=self.mod.MAV_TYPE_GCS,
                                         autopilot=self.mod.MAV_AUTOPILOT_INVALID,
                                         base_mode=0,
                                         custom_mode=0,
                                         system_status=0,
                                         mavlink_version=int(self.VehA.mavversion))
        await asyncio.sleep(0.10)
        pktbytesB = self.VehB.sendPacket(self.mod.MAVLINK_MSG_ID_HEARTBEAT,
                                         type=self.mod.MAV_TYPE_GCS,
                                         autopilot=self.mod.MAV_AUTOPILOT_INVALID,
                                         base_mode=0,
                                         custom_mode=0,
                                         system_status=0,
                                         mavlink_version=int(self.VehB.mavversion))
        await asyncio.sleep(0.10)
        pktbytesC = self.VehC.sendPacket(self.mod.MAVLINK_MSG_ID_HEARTBEAT,
                                         type=self.mod.MAV_TYPE_GCS,
                                         autopilot=self.mod.MAV_AUTOPILOT_INVALID,
                                         base_mode=0,
                                         custom_mode=0,
                                         system_status=0,
                                         mavlink_version=int(self.VehC.mavversion))

        # wait for packets to send
        await asyncio.sleep(0.15)

        # and close everything
        await matrix.stoploop()

        tcpserver.close()
        tcpclient.close()
        udpserver.close()

        # assert the links are all still there
        assert len(matrix.getAllVeh()) == 3
        assert len(matrix.linkdict) == 3

        # assert packets were recived on the endpoints
        assert self.rxdata['tcpserver:127.0.0.1:15001'][0].get_msgbuf(
        ) == pktbytesA
        assert self.rxdata['tcpclient:127.0.0.1:15020'][0].get_msgbuf(
        ) == pktbytesC
        assert self.rxdata['tcpclient:127.0.0.1:15020'][1].get_msgbuf(
        ) == pktbytesB
        assert self.rxdata['udpserver:127.0.0.1:15002'][0].get_msgbuf(
        ) == pktbytesC
    async def test_incomingdistribution(self):
        """Test incoming packets (from vehicle) are distributed
        correctly"""
        # -VehA: LinkA,LinkB, VehB: LinkB, VehC: LinkC
        matrix = ConnectionManager(
            self.loop, self.dialect, self.version, 0, 0, 0.05)
        matrix.onPacketAttach(self.newpacketcallbackVeh)

        await matrix.addVehicleLink(self.VehA.name, self.VehA.target_system, self.linkA)
        await matrix.addVehicleLink(self.VehA.name, self.VehA.target_system, self.linkB)
        await matrix.addVehicleLink(self.VehB.name, self.VehB.target_system, self.linkB)
        await matrix.addVehicleLink(self.VehC.name, self.VehC.target_system, self.linkD)

        # now wait for a bit
        await asyncio.sleep(0.10)

        # now connect the other sides
        tcpserver = TCPConnection(rxcallback=self.newpacketcallbackLnk,
                                  dialect=self.dialect, mavversion=self.version,
                                  srcsystem=0, srccomp=0,
                                  server=True, name='tcpserver:127.0.0.1:15001')
        tcpclient = TCPConnection(rxcallback=self.newpacketcallbackLnk,
                                  dialect=self.dialect, mavversion=self.version,
                                  srcsystem=0, srccomp=0,
                                  server=False, name='tcpclient:127.0.0.1:15020')
        udpclient = UDPConnection(rxcallback=self.newpacketcallbackLnk,
                                  dialect=self.dialect, mavversion=self.version,
                                  srcsystem=0, srccomp=0,
                                  server=False, name='udpclient:127.0.0.1:15021')
        await self.loop.create_server(lambda: tcpserver, self.ip, 15001)
        await self.loop.create_connection(lambda: tcpclient, self.ip, 15020)
        await self.loop.create_datagram_endpoint(lambda: udpclient,
                                                 remote_addr=(self.ip, 15021))

        # send packets on each link and wait
        await asyncio.sleep(0.10)

        pkt = self.mod.MAVLink_heartbeat_message(
            5, 4, 0, 0, 0, int(self.version))
        pktbytes = pkt.pack(self.mavUAS, force_mavlink1=False)
        pktbytesone = pkt.pack(self.mavoneUAS, force_mavlink1=False)

        # send packet to VehA on LinkA
        tcpserver.send_data(pktbytes)
        await asyncio.sleep(0.10)

        # send new (updated) packet to VehA on LinkB
        pktupdate = self.mod.MAVLink_heartbeat_message(
            5, 3, 0, 0, 0, int(self.version))
        pktbytesupdate = pktupdate.pack(self.mavUAS, force_mavlink1=False)
        tcpclient.send_data(pktbytesupdate)

        # need a small sleep here otherwise the linkB gets confused
        await asyncio.sleep(0.10)

        # send packet to VehB on linkB
        tcpclient.send_data(pktbytesone)
        await asyncio.sleep(0.10)

        # send packet to VehC on LinkC
        udpclient.send_data(pktbytes)

        # wait for packets to send
        await asyncio.sleep(0.10)

        # and close everything
        await matrix.stoploop()

        tcpserver.close()
        tcpclient.close()
        udpclient.close()

        # assert the links are all still there
        assert len(matrix.getAllVeh()) == 3
        assert len(matrix.linkdict) == 3

        # assert packets were recived
        assert self.vehpkts[self.VehA.name][0].get_msgbuf() == pktbytes
        assert self.vehpkts[self.VehA.name][1].get_msgbuf() == pktbytesupdate
        assert self.vehpkts[self.VehB.name][0].get_msgbuf() == pktbytesone
        assert self.vehpkts[self.VehC.name][0].get_msgbuf() == pktbytes
    async def test_linkretry_udp(self):
        """For each of the UDP link types, test that they
        keep re-trying to connect, by only adding in the
        other side of the link 0.5 sec after startup"""
        matrix = ConnectionManager(
            self.loop, self.dialect, self.version, 0, 0, 0.05)
        matrix.onPacketAttach(self.newpacketcallbackVeh)

        self.VehA.onPacketTxAttach(matrix.outgoingPacket)
        self.VehB.onPacketTxAttach(matrix.outgoingPacket)

        await matrix.addVehicleLink(self.VehA.name, self.VehA.target_system, self.linkC)
        await matrix.addVehicleLink(self.VehB.name, self.VehB.target_system, self.linkD)

        # now wait for a bit - 0.02 sec
        await asyncio.sleep(0.02)

        # now connect the other sides
        udpserver = UDPConnection(rxcallback=self.newpacketcallbackLnk,
                                  dialect=self.dialect, mavversion=self.version,
                                  srcsystem=0, srccomp=0,
                                  server=True, name='udpserver:127.0.0.1:15002')
        udpclient = UDPConnection(rxcallback=self.newpacketcallbackLnk,
                                  dialect=self.dialect, mavversion=self.version,
                                  srcsystem=0, srccomp=0,
                                  server=False, name='udpclient:127.0.0.1:15021')
        await self.loop.create_datagram_endpoint(lambda: udpserver,
                                                 local_addr=(self.ip, 15002))
        await self.loop.create_datagram_endpoint(lambda: udpclient,
                                                 remote_addr=(self.ip, 15021))

        # send packets on each link and wait 0.02 sec
        await asyncio.sleep(0.02)

        pkt = self.mod.MAVLink_heartbeat_message(
            5, 4, 0, 0, 0, int(self.version))
        pktbytes = pkt.pack(self.mavUAS, force_mavlink1=False)
        pktbytesone = pkt.pack(self.mavoneUAS, force_mavlink1=False)

        # need to send a packet from client to server to init the link
        self.VehA.sendPacket(self.VehA.mod.MAVLINK_MSG_ID_HEARTBEAT,
                             type=self.VehA.mod.MAV_TYPE_GCS,
                             autopilot=self.VehA.mod.MAV_AUTOPILOT_INVALID,
                             base_mode=0,
                             custom_mode=0,
                             system_status=0,
                             mavlink_version=int(self.VehA.mavversion))

        await asyncio.sleep(0.02)

        udpserver.send_data(pktbytes)
        udpclient.send_data(pktbytesone)

        await asyncio.sleep(0.02)

        await matrix.stoploop()

        udpserver.close()
        udpclient.close()

        # assert the links are all still there
        assert len(matrix.getAllVeh()) == 2
        assert len(matrix.linkdict) == 2

        # assert packets were recived on both links (vehicles) in the matrix
        assert len(self.vehpkts) == 2
        assert self.vehpkts[self.VehA.name][0].get_msgbuf() == pktbytes
        assert self.vehpkts[self.VehB.name][0].get_msgbuf() == pktbytesone