Network simulation is complete

parent 6201ad94
......@@ -52,7 +52,7 @@ class Link(SystemEntity):
:return:
'''
self.messageQueue.append(message)
print("message enqued")
# print("message enqued")
def dequeMessage(self):
return self.messageQueue.pop(0)
......
......@@ -2,6 +2,7 @@ from SystemEntity import SystemEntity
from Link import Link
import csv
from Node import Node
from OverlayNode import OverlayNode
import logging
logger = logging.getLogger(__name__)
......@@ -29,7 +30,7 @@ class Network():
reader = csv.reader(f)
for row in reader:
node = row[0] # tuple of a link
self.nodes.update({node:Node(node,self)})
self.nodes.update({node:OverlayNode(node,self)})
# print(self.nodes.get('1')) #keys are strings
......
......@@ -24,7 +24,7 @@ class Node(SystemEntity):
:return:
'''
self.messageQueue.append(message)
print("message enqued")
# print("message enqued")
def dequeMessage(self):
return self.messageQueue.pop(0)
......@@ -42,6 +42,12 @@ class Node(SystemEntity):
self.logger.info("Sending : " + str((time,params)))
pass
def broadcast(self,time,gossipPayload):
for node in self.adjacentNodes:
link = self.network.links.get((self.id, node.id))
link.enqueMessage((time, (self.id, node.id,gossipPayload)))
self.logger.info("Sending : " + str((time, (self.id, node.id,gossipPayload))))
def processMessage(self,time,payload):
print("fianlly reached : " + str(payload))
'''remove any extra headers like source and destination here '''
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment