updated all distributed examples to remove usage of common local module to avoid confusion, even if duplicate code

This commit is contained in:
Blake Harnden 2020-04-18 08:24:26 -07:00
parent d1f7eafc57
commit be332a2a29
5 changed files with 84 additions and 23 deletions

View file

@ -1,12 +1,31 @@
"""
Example for scripting a standalone distributed EMANE session that does not interact
with the GUI.
"""
import argparse
import logging
import distributed_parser
from core.emane.ieee80211abg import EmaneIeee80211abgModel
from core.emulator.coreemu import CoreEmu
from core.emulator.emudata import IpPrefixes, NodeOptions
from core.emulator.enumerations import EventTypes, NodeTypes
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 main(args):
# ip generator for example
prefixes = IpPrefixes(ip4_prefix="10.83.0.0/16")
@ -55,5 +74,5 @@ def main(args):
if __name__ == "__main__":
logging.basicConfig(level=logging.INFO)
args = distributed_parser.parse(__file__)
args = parse(__file__)
main(args)

View file

@ -1,11 +1,30 @@
"""
Example for scripting a standalone distributed LXD session that does not interact
with the GUI.
"""
import argparse
import logging
import distributed_parser
from core.emulator.coreemu import CoreEmu
from core.emulator.emudata import IpPrefixes, NodeOptions
from core.emulator.enumerations import EventTypes, NodeTypes
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 main(args):
# ip generator for example
prefixes = IpPrefixes(ip4_prefix="10.83.0.0/16")
@ -44,5 +63,5 @@ def main(args):
if __name__ == "__main__":
logging.basicConfig(level=logging.INFO)
args = distributed_parser.parse(__file__)
args = parse(__file__)
main(args)

View file

@ -1,15 +0,0 @@
import argparse
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

View file

@ -1,11 +1,30 @@
"""
Example for scripting a standalone distributed peer to peer session that does not
interact with the GUI.
"""
import argparse
import logging
import distributed_parser
from core.emulator.coreemu import CoreEmu
from core.emulator.emudata import IpPrefixes, NodeOptions
from core.emulator.enumerations import EventTypes
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 main(args):
# ip generator for example
prefixes = IpPrefixes(ip4_prefix="10.83.0.0/16")
@ -44,5 +63,5 @@ def main(args):
if __name__ == "__main__":
logging.basicConfig(level=logging.INFO)
args = distributed_parser.parse(__file__)
args = parse(__file__)
main(args)

View file

@ -1,11 +1,30 @@
"""
Example for scripting a standalone distributed switch session that does not
interact with the GUI.
"""
import argparse
import logging
import distributed_parser
from core.emulator.coreemu import CoreEmu
from core.emulator.emudata import IpPrefixes, NodeOptions
from core.emulator.enumerations import EventTypes, NodeTypes
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 main(args):
# ip generator for example
prefixes = IpPrefixes(ip4_prefix="10.83.0.0/16")
@ -48,5 +67,5 @@ def main(args):
if __name__ == "__main__":
logging.basicConfig(level=logging.INFO)
args = distributed_parser.parse(__file__)
args = parse(__file__)
main(args)