mirror of
https://github.com/espressif/openthread.git
synced 2026-09-09 10:40:09 +00:00
[simulation] add configuration MAX_NETWORK_SIZE (#5565)
Currently, the WELLKNOWN_NODE_ID = 34 is not properly defined. - In virtual time simulation, WELLKNOWN_NODE_ID limits the number of ports each PORT_OFFSET can occupy. The virtual time simulator listens at the nodeid=0 port rather than nodeid=34 port. So, there is no such thing as wellknown node ID in virtual time simulation. - In real time simulation, the sniffer listens at the nodeid=34 port. This PR changes it to nodeid=0 port to be consistent with other parts. - In posix virtual time, the simulator listens at the nodeid=0 port. So, there is no such thing as wellknown node ID in Posix virtual time. This commit changes it to MAX_NETWORK_SIZE = 33 and make it (configuration OPENTHREAD_SIMULATION_MAX_NETWORK_SIZE) configurable in simulation by: - Makefile configuration: MAX_NETWORK_SIZE - Cmake configuration: OT_SIMULATION_MAX_NETWORK_SIZE
This commit is contained in:
@@ -137,7 +137,7 @@ class VirtualTime(BaseSimulator):
|
||||
EVENT_DATA = 5
|
||||
|
||||
BASE_PORT = 9000
|
||||
MAX_NODES = 34
|
||||
MAX_NODES = 33
|
||||
MAX_MESSAGE = 1024
|
||||
END_OF_TIME = float('inf')
|
||||
PORT_OFFSET = int(os.getenv('PORT_OFFSET', '0'))
|
||||
@@ -152,7 +152,7 @@ class VirtualTime(BaseSimulator):
|
||||
self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
||||
|
||||
ip = '127.0.0.1'
|
||||
self.port = self.BASE_PORT + (self.PORT_OFFSET * self.MAX_NODES)
|
||||
self.port = self.BASE_PORT + (self.PORT_OFFSET * (self.MAX_NODES + 1))
|
||||
self.sock.bind((ip, self.port))
|
||||
|
||||
self.devices = {}
|
||||
|
||||
Reference in New Issue
Block a user