Пример #1
0
 def setup(self):
     self.network = SimpleNetwork(4)
     name = "/node4/nfn_service_ControlRequestTest/(@x call 2 x 'test')/NFN"
     Request(self.network.nodes[0], name).send()
     name = "/node4/nfn_service_ControlRequestTest/(@x call 2 x 'test')/R2C/CTRL 1/NFN"
     Request(self.network.nodes[0], name).send_later(3)
     name = "/node4/nfn_service_ControlRequestTest/(@x call 2 x 'test')/R2C/CTRL 3/NFN"
     Request(self.network.nodes[0], name).send_later(5)
Пример #2
0
 def setup(self):
     self.network = SimpleNetwork(4)
     name = "/node4/nfn_service_ChunkTest/(@x call 1 x)/NFN"
     Request(self.network.nodes[0],
             name,
             on_data=self.on_data,
             on_timeout=self.on_timeout).send()
 def send_interest(self):
     word_count = randint(1, LoremIpsum.max_length - 1)
     words = LoremIpsum.random_words(word_count)
     name = self.current_prefix + "(@x call 2 x '" + words + "')/NFN"
     Request(self.network.spokes[0][0],
             name,
             on_data=self.on_mobile_data,
             on_timeout=self.on_mobile_timeout).send()
Пример #4
0
    def setup(self):
        self.network = SimpleNetwork(4)
        basename = "/node4/nfn_service_IntermediateTest/(@x call 2 x 'foo bar')"
        Request(self.network.nodes[0], basename + "/NFN").send()

        # TODO: implement send later with requests
        self.network.nodes[0].send_interest_later(3,
                                                  basename + "/R2C/CANCEL/NFN")
Пример #5
0
 def setup(self):
     self.network = SimpleNetwork(4)
     name = "/node4/SimpleContentTest"
     data = "this is a test content".encode()
     time.sleep(1)
     self.network.nodes[3].add_content(name, data)
     time.sleep(1)
     Request(self.network.nodes[0], name, on_data=self.on_data).send()
Пример #6
0
 def setup(self):
     self.network = ThesisNetwork()
     nbody = "/node6/nfn_service_NBody_SimulationService/(@x call 1 x)/NFN"
     render = "/node6/nfn_service_NBody_RenderService/(@x call 2 x ())/NFN"
     nbody_escaped = nbody.replace("/", "%2F")
     render_escaped = render.replace("/", "%2F")
     name = "/node4/nfn_service_ChainIntermediates/(@x call 3 x '{0}' '{1}')/NFN".format(
         nbody_escaped, nbody_escaped)
     Request(self.network.nodes[0], name).send()
 def setup(self):
     self.network = StarNetwork(4, 2)
     identifier = "test"
     name = "/hub/nfn_service_Waypoint/(@x call 2 x '" + identifier + "')/NFN"
     Request(self.network.spokes[0][0],
             name,
             on_intermediate=self.on_waypoint_intermediate).send()
     self.timer = threading.Timer(1, self.timer_fired)
     self.timer.start()
     signal.signal(signal.SIGINT, self.sigint_handler)
 def setup(self):
     self.update_interval = 1
     self.process_interval = 1
     # self.max_duration = 30
     self.network = SerialNetwork(6)
     if self.enable_ui:
         self.widget = QWidget()
         self.widget.resize(500, 500)
         self.widget.move(300, 300)
         self.widget.setWindowTitle('N-body Render')
         self.image_label = QLabel(self.widget)
         self.image_label.resize(500, 500)
         self.widget.show()
     name = "/node4/nfn_service_NBody_SimulationRenderService/(@x call 1 x)/NFN"
     Request(self.network.nodes[0],
             name,
             on_data=self.on_data,
             on_intermediate=self.on_intermediate).send()
Пример #9
0
 def setup(self):
     self.network = SimpleNetwork(4)
     name = "/node4/nfn_service_ChunkTest/(@x call 1 x)/NFN"
     Request(self.network.nodes[0], name).send()
Пример #10
0
 def setup(self):
     self.network = ThesisNetwork()
     basename = "call 2 %2Fnode4%2Fnfn_service_WordCount (call 2 %2Fnode6%2Fnfn_service_WordCount 'foo bar')"
     Request(self.network.nodes[0], basename + "/NFN").send()
Пример #11
0
 def setup(self):
     self.network = SimpleNetwork(4)
     name = "/node4/nfn_service_NBody_SimulationService"
     Request(self.network.nodes[0], name).send()
Пример #12
0
# Log.level = LogLevel.Warning

try:

    notify_node_input = input("Notify node [9000]: ").strip()
    if not notify_node_input:
        notify_node_input = "9000"

    waypoint_prefix = input(
        "Waypoint prefix [/hub/nfn_service_Waypoint]: ").strip()
    if not waypoint_prefix:
        waypoint_prefix = "/hub/nfn_service_Waypoint"

    node = NFNNode(int(notify_node_input), launch=False)
    node.connect()

    while True:
        print()
        new_prefix = input("Move server to prefix: ").strip()
        if not new_prefix:
            break

        new_prefix = new_prefix.replace("/", "%2F")
        identifier = "test"
        name = waypoint_prefix + "/(@x call 2 x '" + identifier + "')/R2C/CTRL " + new_prefix + "/NFN"
        request = Request(node, name).send()

except (KeyboardInterrupt, SystemExit):
    Log.error("\nQuitting.")
Пример #13
0
 def setup(self):
     self.network = SimpleNetwork(4)
     Request(
         self.network.nodes[0],
         "/node4/nfn_service_WordCount/(@x call 2 x 'foo bar lorem ipsum dolor')/NFN",
         on_data=self.on_data).send()
Пример #14
0
 def setup(self):
     self.network = ThesisNetwork()
     Request(
         self.network.nodes[0],
         "/node4/nfn_service_FetchContentTest/(@x call 2 x 'foo bar')/NFN",
         on_data=self.on_data).send()
Пример #15
0
 def setup(self):
     self.network = SimpleNetwork(4)
     basename = "/node4/nfn_service_Echo/(@x call 2 x 'foo bar')"
     Request(self.network.nodes[0], basename + "/NFN",
             on_data=self.on_data).send()
Пример #16
0
Log.level = LogLevel.Warning

default_broker = "/node4/nfn_service_PubSubBroker/"

ask_node_input = input("Ask node [9001]: ").strip()
broker = input("Broker prefix [" + default_broker + "]: ").strip()
identifier = input("Thread ID [thread]: ").strip()

if not ask_node_input:
    ask_node_input = "9001"

if not broker:
    broker = default_broker

if not identifier:
    identifier = "thread"

node = NFNNode(int(ask_node_input), launch=False)
node.connect()

name = broker + "(@x call 2 x '" + identifier + "')/NFN"

signal.signal(signal.SIGINT, sigint_handler)

request = Request(node, name, timeout=None, on_intermediate=on_intermediate)
request.send()

timer = threading.Timer(1, timer_fired)
timer.start()
Пример #17
0
 def setup(self):
     broker = "/node4/nfn_service_PubSubBroker"
     self.network = ThesisNetwork()
     identifier = "thread"
     name = broker + "/(@x call 2 x '" + identifier + "')/NFN"
     Request(self.network.nodes[0], name).send()
Пример #18
0
 def setup(self):
     self.network = SerialNetwork(6)
     name = "/node6/nfn_service_NBody_SimulationService/(@x call 2 x 'foo bar')/NFN"
     Request(self.network.nodes[0], name, on_data=self.on_data).send()
Пример #19
0
 def setup(self):
     self.network = SerialNetwork(6)
     Request(self.network.nodes[0],
             "/node6/nfn_service_WordCount/(@x call 2 x 'foo bar')/NFN",
             on_data=self.on_data).send()
Пример #20
0
    default_prefix = "/node6/PubSubMsg/" + identifier + "/"
    message_prefix = input("Message prefix [" + default_prefix + "]: ").strip()

    if not message_prefix:
        message_prefix = default_prefix

    firstNode = NFNNode(int(notify_node_input), launch=False)
    firstNode.connect()

    publishNode = NFNNode(int(publish_node_input), launch=False)
    publishNode.connect()

    print("Starting PubSub broker service.")
    notification = broker + "(@x call 2 x '" + identifier + "')/NFN"
    Request(firstNode, notification).send()

    print()
    print("Enter content to publish:")

    for line in sys.stdin:
        print("Publishing content: " + line)
        name = message_prefix + str(uuid.uuid4())
        data = line.encode()
        publishNode.add_content(name, data)

        param = name.replace("/", "%2F")
        notification = broker + "(@x call 2 x '" + identifier + "')/R2C/CTRL " + param + "/NFN"
        request = Request(firstNode, notification).send()

except (KeyboardInterrupt, SystemExit):