-
Notifications
You must be signed in to change notification settings - Fork 174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] runtime add/remove distributed links #516
Comments
Do you see an error? What exactly is the issue? It does not seem clear. Thanks for reporting though. Provide as much detail as possible, including the specific actions being made and any errors that may result. |
Hi,
I am attaching my code.
Looking at the logs it seems that the GRE tunnel is not created in scenario where links are created after session instantiation.
My code and logs are attached. The not working logs are in “logs_not_working_dynamic_add”
If line number 73(session instantiation ) is commented out and line 81 is uncommented out ,that scenario works fine(logs_working_distributed)
Thanks,
Sunil
From: bharnden <notifications@github.com>
Sent: Wednesday, October 7, 2020 5:22 PM
To: coreemu/core <core@noreply.github.com>
Cc: Nair, Sunil - 0665 - MITLL <Sunil.Nair@ll.mit.edu>; Author <author@noreply.github.com>
Subject: Re: [coreemu/core] [BUG] (#516)
Do you see an error? What exactly is the issue? It does not seem clear. Thanks for reporting though.
Provide as much detail as possible, including the specific actions being made and any errors that may result.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <#516 (comment)> , or unsubscribe <https://github.com/notifications/unsubscribe-auth/ARJKUKMCFTIFZKEFHJ4ZMC3SJTLWVANCNFSM4SH5LQXQ> . <https://github.com/notifications/beacon/ARJKUKJTAK6ODVDW3IJQJPTSJTLWVA5CNFSM4SH5LQX2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOFIEIFAY.gif>
"""
Example for scripting a standalone distributed peer to peer session that does not
interact with the GUI.
"""
import sys
import argparse
import logging
sys.path.append('/home/SU27454/RNET/core-release-7.2.0/core/daemon')
from core.emulator.coreemu import CoreEmu
from core.emulator.data import IpPrefixes, NodeOptions
from core.emulator.enumerations import EventTypes
from core.nodes.base import CoreNode
import subprocess
import time
def parse(name):
parser = argparse.ArgumentParser(description=f"Run {name} example")
parser.add_argument(
"-a",
"--address",
help="local address that distributed servers will use for gre tunneling",
)
parser.add_argument(
"-s", "--server", help="distributed server to use for creating nodes"
)
options = parser.parse_args()
return options
def ping_address(
from_node: CoreNode, address: str, count: int = 3
):
index = from_node.id - 1
print("Ping " + address + " from Node index:" + str(index) + " from Node Id:" + str(from_node.id))
command = " /usr/local/bin/vcmd -c /tmp/pycore.1/CoreNode%d" % from_node.id
p = subprocess.Popen(command, stdin=subprocess.PIPE, stdout=subprocess.PIPE, shell=True, encoding='utf8')
cmd = "ping -c " + str(count) + " " + address
stdout_data = p.communicate(cmd)[0]
print('STDOUT:{}'.format(stdout_data))
def executeremotevcmd(session, remote_node, cmd):
servers = session.distributed.servers
for name in servers:
server = servers[name]
command = "vcmd -c /tmp/pycore.1/CoreNode%d -- %s" %(remote_node.id, cmd)
print(command)
result = server.remote_cmd(command)
print(result)
def main(args):
# ip generator for example
prefixes = IpPrefixes(ip4_prefix="10.0.0.0/16")
args.address ="172.19.2.116"
# create emulator instance for creating sessions and utility methods
coreemu = CoreEmu({"distributed_address": args.address})
session = coreemu.create_session()
# initialize distributed
server_name = "core2"
#server_name = "SU27454"
args.server="172.19.2.114"
session.distributed.add_server(server_name, args.server)
# must be in configuration state for nodes to start, when using "node_add" below
session.set_state(EventTypes.CONFIGURATION_STATE)
# create local node, switch, and remote nodes
options = NodeOptions()
node1 = session.add_node(CoreNode, options=options)
options.server = server_name
node2 = session.add_node(CoreNode, options=options)
# instantiate session
session.instantiate()
# create node interfaces and link
interface1_data = prefixes.create_iface(node1)
interface2_data = prefixes.create_iface(node2)
session.add_link(node1.id, node2.id, interface1_data, interface2_data)
# instantiate session
#session.instantiate()
#print(result)
ping_address(node1,"10.0.0.2",5)
ping_address(node1,"10.0.0.1",5)
cmd="ping 10.0.0.1 -c 5"
executeremotevcmd(session,node2,cmd)
# pause script for verification
input("press enter for shutdown")
# shutdown session
coreemu.shutdown()
if __name__ == "__main__":
logging.basicConfig(level=logging.INFO)
args = parse(__file__)
main(args)
|
Code is pasted along with this mail.
"""
Example for scripting a standalone distributed peer to peer session that does not
interact with the GUI.
"""
import sys
import argparse
import logging
sys.path.append
from core.emulator.coreemu import CoreEmu
from core.emulator.data import IpPrefixes, NodeOptions
from core.emulator.enumerations import EventTypes
from core.nodes.base import CoreNode
import subprocess
import time
def parse(name):
parser = argparse.ArgumentParser(description=f"Run {name} example")
parser.add_argument(
"-a",
"--address",
help="local address that distributed servers will use for gre tunneling",
)
parser.add_argument(
"-s", "--server", help="distributed server to use for creating nodes"
)
options = parser.parse_args()
return options
def ping_address(
from_node: CoreNode, address: str, count: int = 3
):
index = from_node.id - 1
print("Ping " + address + " from Node index:" + str(index) + " from Node Id:" + str(from_node.id))
command = " /usr/local/bin/vcmd -c /tmp/pycore.1/CoreNode%d" % from_node.id
p = subprocess.Popen(command, stdin=subprocess.PIPE, stdout=subprocess.PIPE, shell=True, encoding='utf8')
cmd = "ping -c " + str(count) + " " + address
stdout_data = p.communicate(cmd)[0]
print('STDOUT:{}'.format(stdout_data))
def executeremotevcmd(session, remote_node, cmd):
servers = session.distributed.servers
for name in servers:
server = servers[name]
command = "vcmd -c /tmp/pycore.1/CoreNode%d -- %s" %(remote_node.id, cmd)
print(command)
result = server.remote_cmd(command)
print(result)
def main(args):
# ip generator for example
prefixes = IpPrefixes(ip4_prefix="10.0.0.0/16")
args.address ="172.19.2.116"
# create emulator instance for creating sessions and utility methods
coreemu = CoreEmu({"distributed_address": args.address})
session = coreemu.create_session()
# initialize distributed
server_name = "core2"
#server_name = "SU27454"
args.server="172.19.2.114"
session.distributed.add_server(server_name, args.server)
# must be in configuration state for nodes to start, when using "node_add" below
session.set_state(EventTypes.CONFIGURATION_STATE)
# create local node, switch, and remote nodes
options = NodeOptions()
node1 = session.add_node(CoreNode, options=options)
options.server = server_name
node2 = session.add_node(CoreNode, options=options)
# instantiate session
session.instantiate()ç=======================================================================Line 73
# create node interfaces and link
interface1_data = prefixes.create_iface(node1)
interface2_data = prefixes.create_iface(node2)
session.add_link(node1.id, node2.id, interface1_data, interface2_data)
# instantiate session
#session.instantiate()ç=========================================================================Line 81
#print(result)
ping_address(node1,"10.0.0.2",5)
ping_address(node1,"10.0.0.1",5)
cmd="ping 10.0.0.1 -c 5"
executeremotevcmd(session,node2,cmd)
# pause script for verification
input("press enter for shutdown")
# shutdown session
coreemu.shutdown()
if __name__ == "__main__":
logging.basicConfig(level=logging.INFO)
args = parse(__file__)
main(args)
From: Nair, Sunil - 0665 - MITLL
Sent: Wednesday, October 7, 2020 5:50 PM
To: 'coreemu/core' <reply@reply.github.com>; coreemu/core <core@noreply.github.com>
Cc: Author <author@noreply.github.com>
Subject: RE: [coreemu/core] [BUG] (#516)
Hi,
I am attaching my code.
Looking at the logs it seems that the GRE tunnel is not created in scenario where links are created after session instantiation.
My code and logs are attached. The not working logs are in “logs_not_working_dynamic_add”
If line number 73(session instantiation ) is commented out and line 81 is uncommented out ,that scenario works fine(logs_working_distributed)
Thanks,
Sunil
From: bharnden <notifications@github.com <mailto:notifications@github.com> >
Sent: Wednesday, October 7, 2020 5:22 PM
To: coreemu/core <core@noreply.github.com <mailto:core@noreply.github.com> >
Cc: Nair, Sunil - 0665 - MITLL <Sunil.Nair@ll.mit.edu <mailto:Sunil.Nair@ll.mit.edu> >; Author <author@noreply.github.com <mailto:author@noreply.github.com> >
Subject: Re: [coreemu/core] [BUG] (#516)
Do you see an error? What exactly is the issue? It does not seem clear. Thanks for reporting though.
Provide as much detail as possible, including the specific actions being made and any errors that may result.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <#516 (comment)> , or unsubscribe <https://github.com/notifications/unsubscribe-auth/ARJKUKMCFTIFZKEFHJ4ZMC3SJTLWVANCNFSM4SH5LQXQ> . <https://github.com/notifications/beacon/ARJKUKJTAK6ODVDW3IJQJPTSJTLWVA5CNFSM4SH5LQX2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOFIEIFAY.gif>
|
Now that I think about it, there is a piece of logic ran during session startup to account for the gre tunnel creation. This probably needs to be looked at for considering handling it during runtime. There may be other ways of disabling links without completely remove them and adding them back, that may help compensate until there is a proper way of handling this. I will try and take a better look when I get time. Thanks for bringing this up. |
I am going to close this, since it is more or less issue #513 as you noted, thanks for helping bring this issue up. |
Describe the bug
This is a followup on issue#513
Make/Break Link Distributed
To Reproduce
Steps to reproduce the behavior:
4.Do a ping between the 2 nodes
Expected behavior
Dynamic links should be handled.Pings should work fine.
Note 1:If this is not a distributed system, this make/break works fine
Note 2:The scenario listed above works if step 3 is done before 2 but we need to use dynamic link functionality for the project.
Please advise.
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: