Merge branch 'rel/5.1' into core-rest-flask
This commit is contained in:
commit
1ea9de34db
20 changed files with 125 additions and 134 deletions
91
README.md
91
README.md
|
@ -1,5 +1,4 @@
|
|||
CORE
|
||||
====
|
||||
# CORE
|
||||
|
||||
CORE: Common Open Research Emulator
|
||||
|
||||
|
@ -7,24 +6,39 @@ Copyright (c)2005-2018 the Boeing Company.
|
|||
|
||||
See the LICENSE file included in this distribution.
|
||||
|
||||
About
|
||||
-----
|
||||
## About
|
||||
|
||||
CORE is a tool for emulating networks using a GUI or Python scripts. The CORE
|
||||
project site (1) is a good source of introductory information, with a manual,
|
||||
screenshots, and demos about this software. The GitHub project (2) hosts the
|
||||
source repos, wiki, and bug tracker. There is a deprecated
|
||||
Google Code page (3) with the old wiki, blog, bug tracker, and quickstart guide.
|
||||
The Common Open Research Emulator (CORE) is a tool for emulating
|
||||
networks on one or more machines. You can connect these emulated
|
||||
networks to live networks. CORE consists of a GUI for drawing
|
||||
topologies of lightweight virtual machines, and Python modules for
|
||||
scripting network emulation.
|
||||
|
||||
1. http://www.nrl.navy.mil/itd/ncs/products/core
|
||||
1. https://github.com/coreemu/core
|
||||
1. http://code.google.com/p/coreemu/
|
||||
1. [Official Documentation](https://downloads.pf.itd.nrl.navy.mil/docs/core/core-html/index.html)
|
||||
## Documentation and Examples
|
||||
|
||||
Building CORE
|
||||
-------------
|
||||
* Documentation hosted on GitHub
|
||||
* http://coreemu.github.io/core/
|
||||
* Basic Script Examples
|
||||
* [Examples](daemon/examples/api)
|
||||
* Custom Service Example
|
||||
* [sample.py](daemon/examples/myservices/sample.py)
|
||||
* Custom Emane Model Example
|
||||
* [examplemodel.py](daemon/examples/myemane/examplemodel.py)
|
||||
|
||||
To build this software you should use:
|
||||
## Support
|
||||
|
||||
We are leveraging Discord for persistent chat rooms, voice chat, and
|
||||
GitHub integration. This allows for more dynamic conversations and the
|
||||
capability to respond faster. Feel free to join us at the link below.
|
||||
https://discord.gg/AKd7kmP
|
||||
|
||||
You can also get help with questions, comments, or trouble, by using
|
||||
the CORE mailing lists:
|
||||
|
||||
* [core-users](https://pf.itd.nrl.navy.mil/mailman/listinfo/core-users) for general comments and questions
|
||||
* [core-dev](https://pf.itd.nrl.navy.mil/mailman/listinfo/core-dev) for bugs, compile errors, and other development issues
|
||||
|
||||
## Building CORE
|
||||
|
||||
```shell
|
||||
./bootstrap.sh
|
||||
|
@ -33,42 +47,19 @@ make
|
|||
sudo make install
|
||||
```
|
||||
|
||||
Note: You may need to pass the proxy settings to sudo make install:
|
||||
sudo make install HTTP_PROXY=<proxy>
|
||||
|
||||
Here is what is installed with 'make install':
|
||||
|
||||
/usr/local/bin/core-gui
|
||||
/usr/local/bin/core-daemon
|
||||
/usr/local/bin/[vcmd, vnoded, coresendmsg, core-cleanup]
|
||||
/usr/local/lib/core/*
|
||||
/usr/local/share/core/*
|
||||
/usr/local/lib/python2.6/dist-packages/core/*
|
||||
/usr/local/lib/python2.6/dist-packages/[netns,vcmd].so
|
||||
/etc/core/*
|
||||
/etc/init.d/core
|
||||
|
||||
See the manual for the software required for building CORE.
|
||||
|
||||
Building Documentation
|
||||
----------------------
|
||||
|
||||
Being able to build documentation depends on help2man being installed.
|
||||
|
||||
Once that has been done you can run the following commands:
|
||||
|
||||
```shell
|
||||
./bootstrap.sh
|
||||
./configure
|
||||
make html
|
||||
make doc
|
||||
```
|
||||
|
||||
Building Packages
|
||||
-----------------
|
||||
|
||||
Install fpm
|
||||
|
||||
http://fpm.readthedocs.io/en/latest/installing.html
|
||||
Install fpm: http://fpm.readthedocs.io/en/latest/installing.html
|
||||
|
||||
Build package commands, DESTDIR is used for gui packaging only
|
||||
|
||||
|
@ -83,8 +74,12 @@ make fpm DESTDIR=/tmp/core-gui
|
|||
This will produce:
|
||||
|
||||
* CORE GUI rpm/deb files
|
||||
* core-gui_$VERSION_$ARCH
|
||||
* CORE ns3 rpm/deb files
|
||||
* python-core-ns3_$VERSION_$ARCH
|
||||
* CORE python rpm/deb files for SysV and systemd service types
|
||||
* python-core-sysv_$VERSION_$ARCH
|
||||
* python-core-systemd_$VERSION_$ARCH
|
||||
|
||||
Running CORE
|
||||
------------
|
||||
|
@ -92,7 +87,10 @@ Running CORE
|
|||
First start the CORE services:
|
||||
|
||||
```shell
|
||||
sudo /etc/init.d/core-daemon start
|
||||
# sysv
|
||||
sudo service core-daemon start
|
||||
# systemd
|
||||
sudo systemctl start core-daemon
|
||||
```
|
||||
|
||||
This automatically runs the core-daemon program.
|
||||
|
@ -103,12 +101,3 @@ core-gui
|
|||
```
|
||||
|
||||
This launches the CORE GUI. You do not need to run the GUI as root.
|
||||
|
||||
|
||||
Support
|
||||
-------
|
||||
|
||||
If you have questions, comments, or trouble, please use the CORE mailing lists:
|
||||
|
||||
- [core-users](https://pf.itd.nrl.navy.mil/mailman/listinfo/core-users) for general comments and questions
|
||||
- [core-dev](https://pf.itd.nrl.navy.mil/mailman/listinfo/core-dev) for bugs, compile errors, and other development issues
|
||||
|
|
|
@ -142,14 +142,13 @@ class CoreBroker(ConfigurableManager):
|
|||
Close all active sockets; called when the session enters the
|
||||
data collect state
|
||||
"""
|
||||
self.reset()
|
||||
with self.servers_lock:
|
||||
while len(self.servers) > 0:
|
||||
name, server = self.servers.popitem()
|
||||
if server.sock is not None:
|
||||
logger.info("closing connection with %s @ %s:%s" %
|
||||
(name, server.host, server.port))
|
||||
logger.info("closing connection with %s: %s:%s", name, server.host, server.port)
|
||||
server.close()
|
||||
self.reset()
|
||||
self.dorecvloop = False
|
||||
if self.recvthread is not None:
|
||||
self.recvthread.join()
|
||||
|
@ -214,8 +213,7 @@ class CoreBroker(ConfigurableManager):
|
|||
continue
|
||||
rcvlen = self.recv(server)
|
||||
if rcvlen == 0:
|
||||
logger.info("connection with %s @ %s:%s has closed" % (
|
||||
server.name, server.host, server.port))
|
||||
logger.info("connection with server(%s) closed: %s:%s", server.name, server.host, server.port)
|
||||
|
||||
def recv(self, server):
|
||||
"""
|
||||
|
@ -236,18 +234,18 @@ class CoreBroker(ConfigurableManager):
|
|||
return 0
|
||||
|
||||
if len(msghdr) != coreapi.CoreMessage.header_len:
|
||||
logger.info("warning: broker received not enough data len=%s" % len(msghdr))
|
||||
logger.warn("warning: broker received not enough data len=%s", len(msghdr))
|
||||
return len(msghdr)
|
||||
|
||||
msgtype, msgflags, msglen = coreapi.CoreMessage.unpack_header(msghdr)
|
||||
msgdata = server.sock.recv(msglen)
|
||||
data = msghdr + msgdata
|
||||
count = None
|
||||
logger.info("received message type: %s", MessageTypes(msgtype))
|
||||
logger.debug("received message type: %s", MessageTypes(msgtype))
|
||||
# snoop exec response for remote interactive TTYs
|
||||
if msgtype == MessageTypes.EXECUTE.value and msgflags & MessageFlags.TTY.value:
|
||||
data = self.fixupremotetty(msghdr, msgdata, server.host)
|
||||
logger.info("created remote tty message: %s", data)
|
||||
logger.debug("created remote tty message: %s", data)
|
||||
elif msgtype == MessageTypes.NODE.value:
|
||||
# snoop node delete response to decrement node counts
|
||||
if msgflags & MessageFlags.DELETE.value:
|
||||
|
@ -293,22 +291,21 @@ class CoreBroker(ConfigurableManager):
|
|||
with self.servers_lock:
|
||||
server = self.servers.get(name)
|
||||
if server is not None:
|
||||
if host == server.host and port == server.port and \
|
||||
server.sock is not None:
|
||||
if host == server.host and port == server.port and server.sock is not None:
|
||||
# leave this socket connected
|
||||
return
|
||||
|
||||
logger.info("closing connection with %s @ %s:%s" % (name, server.host, server.port))
|
||||
logger.info("closing connection with %s @ %s:%s", name, server.host, server.port)
|
||||
server.close()
|
||||
del self.servers[name]
|
||||
|
||||
logger.info("adding broker server(%s): %s:%s" % (name, host, port))
|
||||
logger.info("adding broker server(%s): %s:%s", name, host, port)
|
||||
server = CoreDistributedServer(name, host, port)
|
||||
if host is not None and port is not None:
|
||||
try:
|
||||
server.connect()
|
||||
except IOError:
|
||||
logger.exception("error connecting to server %s:%s" % (host, port))
|
||||
logger.exception("error connecting to server(%s): %s:%s", name, host, port)
|
||||
if server.sock is not None:
|
||||
self.startrecvloop()
|
||||
self.servers[name] = server
|
||||
|
@ -328,7 +325,7 @@ class CoreBroker(ConfigurableManager):
|
|||
logger.exception("error deleting server")
|
||||
|
||||
if server.sock is not None:
|
||||
logger.info("closing connection with %s @ %s:%s" % (server.name, server.host, server.port))
|
||||
logger.info("closing connection with %s @ %s:%s", server.name, server.host, server.port)
|
||||
server.close()
|
||||
|
||||
def getserverbyname(self, name):
|
||||
|
@ -412,7 +409,7 @@ class CoreBroker(ConfigurableManager):
|
|||
remotenum = n2num
|
||||
|
||||
if key in self.tunnels.keys():
|
||||
logger.warn("tunnel with key %s (%s-%s) already exists!" % (key, n1num, n2num))
|
||||
logger.warn("tunnel with key %s (%s-%s) already exists!", key, n1num, n2num)
|
||||
else:
|
||||
objid = key & ((1 << 16) - 1)
|
||||
logger.info("adding tunnel for %s-%s to %s with key %s", n1num, n2num, remoteip, key)
|
||||
|
@ -494,7 +491,7 @@ class CoreBroker(ConfigurableManager):
|
|||
gt = self.tunnels[key]
|
||||
r.append(gt)
|
||||
continue
|
||||
logger.info("adding tunnel for net %s to %s with key %s" % (node_id, host, key))
|
||||
logger.info("adding tunnel for net %s to %s with key %s", node_id, host, key)
|
||||
gt = GreTap(node=None, name=None, session=self.session, remoteip=host, key=key)
|
||||
self.tunnels[key] = gt
|
||||
r.append(gt)
|
||||
|
@ -698,8 +695,7 @@ class CoreBroker(ConfigurableManager):
|
|||
elif message.message_type == MessageTypes.CONFIG.value:
|
||||
# broadcast location and services configuration everywhere
|
||||
confobj = message.get_tlv(ConfigTlvs.OBJECT.value)
|
||||
if confobj == "location" or confobj == "services" or \
|
||||
confobj == "session" or confobj == "all":
|
||||
if confobj == "location" or confobj == "services" or confobj == "session" or confobj == "all":
|
||||
servers = self.getservers()
|
||||
elif message.message_type == MessageTypes.FILE.value:
|
||||
# broadcast hook scripts and custom service files everywhere
|
||||
|
@ -735,10 +731,10 @@ class CoreBroker(ConfigurableManager):
|
|||
"""
|
||||
server = self.getserverbyname(servername)
|
||||
if server is None:
|
||||
logger.warn("ignoring unknown server: %s" % servername)
|
||||
logger.warn("ignoring unknown server: %s", servername)
|
||||
return
|
||||
if server.sock is None or server.host is None or server.port is None:
|
||||
logger.info("ignoring disconnected server: %s" % servername)
|
||||
logger.info("ignoring disconnected server: %s", servername)
|
||||
return
|
||||
|
||||
# communicate this session"s current state to the server
|
||||
|
@ -811,10 +807,10 @@ class CoreBroker(ConfigurableManager):
|
|||
try:
|
||||
nodecls = nodeutils.get_node_class(NodeTypes(nodetype))
|
||||
except KeyError:
|
||||
logger.warn("broker invalid node type %s" % nodetype)
|
||||
logger.warn("broker invalid node type %s", nodetype)
|
||||
return handle_locally, servers
|
||||
if nodecls is None:
|
||||
logger.warn("broker unimplemented node type %s" % nodetype)
|
||||
logger.warn("broker unimplemented node type %s", nodetype)
|
||||
return handle_locally, servers
|
||||
if issubclass(nodecls, PyCoreNet) and nodetype != NodeTypes.WIRELESS_LAN.value:
|
||||
# network node replicated on all servers; could be optimized
|
||||
|
@ -1013,11 +1009,10 @@ class CoreBroker(ConfigurableManager):
|
|||
# local emulation server, handle this locally
|
||||
handle_locally = True
|
||||
elif server.sock is None:
|
||||
logger.info("server %s @ %s:%s is disconnected" % (
|
||||
server.name, server.host, server.port))
|
||||
logger.info("server %s @ %s:%s is disconnected", server.name, server.host, server.port)
|
||||
else:
|
||||
logger.info("forwarding message to server: %s - %s:\n%s",
|
||||
server.host, server.port, message)
|
||||
logger.info("forwarding message to server(%s): %s:%s", server.name, server.host, server.port)
|
||||
logger.debug("message being forwarded:\n%s", message)
|
||||
server.sock.send(message.raw_message)
|
||||
return handle_locally
|
||||
|
||||
|
@ -1045,7 +1040,7 @@ class CoreBroker(ConfigurableManager):
|
|||
lhost, lport = server.sock.getsockname()
|
||||
f.write("%s %s %s %s %s\n" % (server.name, server.host, server.port, lhost, lport))
|
||||
except IOError:
|
||||
logger.exception("error writing server list to the file: %s" % filename)
|
||||
logger.exception("error writing server list to the file: %s", filename)
|
||||
|
||||
def writenodeserver(self, nodestr, server):
|
||||
"""
|
||||
|
@ -1072,7 +1067,7 @@ class CoreBroker(ConfigurableManager):
|
|||
with open(filename, "w") as f:
|
||||
f.write("%s\n%s\n" % (serverstr, nodestr))
|
||||
except IOError:
|
||||
logger.exception("error writing server file %s for node %s" % (filename, name))
|
||||
logger.exception("error writing server file %s for node %s", filename, name)
|
||||
|
||||
def local_instantiation_complete(self):
|
||||
"""
|
||||
|
@ -1126,9 +1121,9 @@ class CoreBroker(ConfigurableManager):
|
|||
if values_str is None:
|
||||
return
|
||||
|
||||
value_strings = values_str.split('|')
|
||||
value_strings = values_str.split("|")
|
||||
for value_string in value_strings:
|
||||
key, value = value_string.split('=', 1)
|
||||
key, value = value_string.split("=", 1)
|
||||
if key == "controlnet":
|
||||
self.handle_distributed_control_net(message, value_strings, value_strings.index(value_string))
|
||||
|
||||
|
@ -1144,7 +1139,7 @@ class CoreBroker(ConfigurableManager):
|
|||
:return: nothing
|
||||
"""
|
||||
key_value = values[index]
|
||||
key, value = key_value.split('=', 1)
|
||||
key, value = key_value.split("=", 1)
|
||||
control_nets = value.split()
|
||||
|
||||
if len(control_nets) < 2:
|
||||
|
|
|
@ -15,6 +15,9 @@ from core import logger
|
|||
from core.api import coreapi
|
||||
from core.data import ConfigData
|
||||
from core.data import EventData
|
||||
from core.emulator.emudata import InterfaceData
|
||||
from core.emulator.emudata import LinkOptions
|
||||
from core.emulator.emudata import NodeOptions
|
||||
from core.enumerations import ConfigTlvs
|
||||
from core.enumerations import EventTlvs
|
||||
from core.enumerations import EventTypes
|
||||
|
@ -29,9 +32,6 @@ from core.enumerations import NodeTlvs
|
|||
from core.enumerations import NodeTypes
|
||||
from core.enumerations import RegisterTlvs
|
||||
from core.enumerations import SessionTlvs
|
||||
from core.future.futuredata import InterfaceData
|
||||
from core.future.futuredata import LinkOptions
|
||||
from core.future.futuredata import NodeOptions
|
||||
from core.misc import nodeutils
|
||||
from core.misc import structutils
|
||||
from core.misc import utils
|
|
@ -4,7 +4,7 @@ Defines core server for handling TCP connections.
|
|||
|
||||
import SocketServer
|
||||
|
||||
from core.future.coreemu import CoreEmu
|
||||
from core.emulator.coreemu import CoreEmu
|
||||
|
||||
|
||||
class CoreServer(SocketServer.ThreadingMixIn, SocketServer.TCPServer):
|
|
@ -8,11 +8,11 @@ from core import logger
|
|||
from core.coreobj import PyCoreNet
|
||||
from core.coreobj import PyCoreNode
|
||||
from core.data import NodeData
|
||||
from core.emulator.emudata import LinkOptions
|
||||
from core.emulator.emudata import NodeOptions
|
||||
from core.enumerations import EventTypes
|
||||
from core.enumerations import LinkTypes
|
||||
from core.enumerations import NodeTypes
|
||||
from core.future.futuredata import LinkOptions
|
||||
from core.future.futuredata import NodeOptions
|
||||
from core.misc import nodemaps
|
||||
from core.misc import nodeutils
|
||||
from core.session import Session
|
||||
|
@ -45,7 +45,7 @@ def create_interface(node, network, interface_data):
|
|||
|
||||
:param node: node to create interface for
|
||||
:param network: network to associate interface with
|
||||
:param core.future.futuredata.InterfaceData interface_data: interface data
|
||||
:param core.emulator.emudata.InterfaceData interface_data: interface data
|
||||
:return: created interface
|
||||
"""
|
||||
node.newnetif(
|
||||
|
@ -64,7 +64,7 @@ def link_config(network, interface, link_options, devname=None, interface_two=No
|
|||
|
||||
:param network: network to configure link for
|
||||
:param interface: interface to configure
|
||||
:param core.future.futuredata.LinkOptions link_options: data to configure link with
|
||||
:param core.emulator.emudata.LinkOptions link_options: data to configure link with
|
||||
:param str devname: device name, default is None
|
||||
:param interface_two: other interface associated, default is None
|
||||
:return: nothing
|
||||
|
@ -117,9 +117,9 @@ class IdGen(object):
|
|||
return self.id
|
||||
|
||||
|
||||
class FutureSession(Session):
|
||||
class EmuSession(Session):
|
||||
def __init__(self, session_id, config=None, mkdir=True):
|
||||
super(FutureSession, self).__init__(session_id, config, mkdir)
|
||||
super(EmuSession, self).__init__(session_id, config, mkdir)
|
||||
|
||||
# object management
|
||||
self.node_id_gen = IdGen()
|
||||
|
@ -220,9 +220,9 @@ class FutureSession(Session):
|
|||
|
||||
:param int node_one_id: node one id
|
||||
:param int node_two_id: node two id
|
||||
:param core.future.futuredata.InterfaceData interface_one: node one interface data, defaults to none
|
||||
:param core.future.futuredata.InterfaceData interface_two: node two interface data, defaults to none
|
||||
:param core.future.futuredata.LinkOptions link_options: data for creating link, defaults to no options
|
||||
:param core.emulator.emudata.InterfaceData interface_one: node one interface data, defaults to none
|
||||
:param core.emulator.emudata.InterfaceData interface_two: node two interface data, defaults to none
|
||||
:param core.emulator.emudata.LinkOptions link_options: data for creating link, defaults to no options
|
||||
:return:
|
||||
"""
|
||||
# get node objects identified by link data
|
||||
|
@ -386,7 +386,7 @@ class FutureSession(Session):
|
|||
:param int node_two_id: node two id
|
||||
:param int interface_one_id: interface id for node one
|
||||
:param int interface_two_id: interface id for node two
|
||||
:param core.future.futuredata.LinkOptions link_options: data to update link with
|
||||
:param core.emulator.emudata.LinkOptions link_options: data to update link with
|
||||
:return: nothing
|
||||
"""
|
||||
# interface data
|
||||
|
@ -467,7 +467,7 @@ class FutureSession(Session):
|
|||
|
||||
:param core.enumerations.NodeTypes _type: type of node to create
|
||||
:param int _id: id for node, defaults to None for generated id
|
||||
:param core.future.futuredata.NodeOptions node_options: data to create node with
|
||||
:param core.emulator.emudata.NodeOptions node_options: data to create node with
|
||||
:return: created node
|
||||
"""
|
||||
|
||||
|
@ -531,7 +531,7 @@ class FutureSession(Session):
|
|||
Update node information.
|
||||
|
||||
:param int node_id: id of node to update
|
||||
:param core.future.futuredata.NodeOptions node_options: data to update node with
|
||||
:param core.emulator.emudata.NodeOptions node_options: data to update node with
|
||||
:return: True if node updated, False otherwise
|
||||
:rtype: bool
|
||||
"""
|
||||
|
@ -573,7 +573,7 @@ class FutureSession(Session):
|
|||
Set position for a node, use lat/lon/alt if needed.
|
||||
|
||||
:param node: node to set position for
|
||||
:param core.future.futuredata.NodeOptions node_options: data for node
|
||||
:param core.emulator.emudata.NodeOptions node_options: data for node
|
||||
:return: nothing
|
||||
"""
|
||||
# extract location values
|
||||
|
@ -627,9 +627,10 @@ class FutureSession(Session):
|
|||
|
||||
:return: nothing
|
||||
"""
|
||||
logger.info("session(%s) shutting down", self.session_id)
|
||||
self.set_state(EventTypes.DATACOLLECT_STATE, send_event=True)
|
||||
self.set_state(EventTypes.SHUTDOWN_STATE, send_event=True)
|
||||
super(FutureSession, self).shutdown()
|
||||
super(EmuSession, self).shutdown()
|
||||
|
||||
def custom_delete_object(self, object_id):
|
||||
"""
|
||||
|
@ -653,7 +654,7 @@ class FutureSession(Session):
|
|||
:return: True if active, False otherwise
|
||||
"""
|
||||
result = self.state in {EventTypes.RUNTIME_STATE.value, EventTypes.DATACOLLECT_STATE.value}
|
||||
logger.info("checking if session is active: %s", result)
|
||||
logger.info("session(%s) checking if active: %s", self.session_id, result)
|
||||
return result
|
||||
|
||||
def open_xml(self, file_name, start=False):
|
||||
|
@ -775,7 +776,7 @@ class FutureSession(Session):
|
|||
Create a wireless node for use within an wireless/EMANE networks.
|
||||
|
||||
:param int _id: int for node, defaults to None and will be generated
|
||||
:param core.future.futuredata.NodeOptions node_options: options for emane node, model will always be "mdr"
|
||||
:param core.emulator.emudata.NodeOptions node_options: options for emane node, model will always be "mdr"
|
||||
:return: new emane node
|
||||
:rtype: core.netns.nodes.CoreNode
|
||||
"""
|
||||
|
@ -789,7 +790,7 @@ class FutureSession(Session):
|
|||
:param model: emane model to use for emane network
|
||||
:param geo_reference: geo reference point to use for emane node locations
|
||||
:param geo_scale: geo scale to use for emane node locations, defaults to 1.0
|
||||
:param core.future.futuredata.NodeOptions node_options: options for emane node being created
|
||||
:param core.emulator.emudata.NodeOptions node_options: options for emane node being created
|
||||
:return: create emane network
|
||||
"""
|
||||
# required to be set for emane to function properly
|
||||
|
@ -880,7 +881,7 @@ class CoreEmu(object):
|
|||
|
||||
:return: nothing
|
||||
"""
|
||||
logger.info("shutting down all session")
|
||||
logger.info("shutting down all sessions")
|
||||
sessions = self.sessions.copy()
|
||||
self.sessions.clear()
|
||||
for session in sessions.itervalues():
|
||||
|
@ -893,7 +894,7 @@ class CoreEmu(object):
|
|||
:param int _id: session id for new session
|
||||
:param bool master: sets session to master
|
||||
:return: created session
|
||||
:rtype: FutureSession
|
||||
:rtype: EmuSession
|
||||
"""
|
||||
|
||||
session_id = _id
|
||||
|
@ -903,7 +904,7 @@ class CoreEmu(object):
|
|||
if session_id not in self.sessions:
|
||||
break
|
||||
|
||||
session = FutureSession(session_id, config=self.config)
|
||||
session = EmuSession(session_id, config=self.config)
|
||||
logger.info("created session: %s", session_id)
|
||||
if master:
|
||||
session.master = True
|
|
@ -1,5 +1,7 @@
|
|||
from core.enumerations import LinkTypes
|
||||
from core.misc.ipaddress import Ipv4Prefix, Ipv6Prefix, MacAddress
|
||||
from core.misc.ipaddress import Ipv4Prefix
|
||||
from core.misc.ipaddress import Ipv6Prefix
|
||||
from core.misc.ipaddress import MacAddress
|
||||
|
||||
|
||||
class NodeOptions(object):
|
|
@ -891,6 +891,10 @@ def get_endpoint(network_object, interface_object):
|
|||
ep = None
|
||||
l2devport = None
|
||||
|
||||
# skip if either are none
|
||||
if not network_object or not interface_object:
|
||||
return ep
|
||||
|
||||
# if ifcObj references an interface of a node and is part of this network
|
||||
if interface_object.net.objid == network_object.objid and hasattr(interface_object,
|
||||
'node') and interface_object.node:
|
||||
|
@ -957,7 +961,7 @@ def get_endpoints(network_object):
|
|||
if ep is not None:
|
||||
endpoints.append(ep)
|
||||
except:
|
||||
logger.exception("error geting endpoints, was skipped before")
|
||||
logger.debug("error geting endpoints, was skipped before")
|
||||
|
||||
return endpoints
|
||||
|
||||
|
|
|
@ -6,9 +6,9 @@ import datetime
|
|||
|
||||
import parser
|
||||
from core.emane.ieee80211abg import EmaneIeee80211abgModel
|
||||
from core.emulator.coreemu import CoreEmu
|
||||
from core.emulator.emudata import IpPrefixes
|
||||
from core.enumerations import EventTypes
|
||||
from core.future.coreemu import CoreEmu
|
||||
from core.future.futuredata import IpPrefixes
|
||||
|
||||
|
||||
def example(options):
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
import datetime
|
||||
|
||||
import parser
|
||||
from core.emulator.coreemu import CoreEmu
|
||||
from core.emulator.emudata import IpPrefixes
|
||||
from core.enumerations import NodeTypes, EventTypes
|
||||
from core.future.coreemu import CoreEmu
|
||||
from core.future.futuredata import IpPrefixes
|
||||
|
||||
|
||||
def example(options):
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
# and repeat for minnodes <= n <= maxnodes with a step size of
|
||||
# nodestep
|
||||
|
||||
from core.emulator.emudata import IpPrefixes
|
||||
from core.enumerations import NodeTypes, EventTypes
|
||||
from core.future.futuredata import IpPrefixes
|
||||
|
||||
|
||||
def example(nodes):
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
import datetime
|
||||
|
||||
import parser
|
||||
from core.emulator.coreemu import CoreEmu
|
||||
from core.emulator.emudata import IpPrefixes
|
||||
from core.enumerations import NodeTypes, EventTypes
|
||||
from core.future.coreemu import CoreEmu
|
||||
from core.future.futuredata import IpPrefixes
|
||||
from core.mobility import BasicRangeModel
|
||||
|
||||
|
||||
|
|
|
@ -13,8 +13,8 @@ import time
|
|||
from core import constants
|
||||
from core import enumerations
|
||||
from core import logger
|
||||
from core.legacy.corehandler import CoreHandler
|
||||
from core.legacy.coreserver import CoreServer
|
||||
from core.corehandlers import CoreHandler
|
||||
from core.coreserver import CoreServer
|
||||
from core.misc.utils import close_onexec
|
||||
from core.service import ServiceManager
|
||||
|
||||
|
@ -51,7 +51,7 @@ def cored(cfg, use_ovs):
|
|||
sys.exit(1)
|
||||
|
||||
close_onexec(server.fileno())
|
||||
logger.debug("main server started, listening on: %s:%s", host, port)
|
||||
logger.info("server started, listening on: %s:%s", host, port)
|
||||
server.serve_forever()
|
||||
|
||||
|
||||
|
|
|
@ -13,6 +13,10 @@ from core.api.coreapi import CoreEventMessage
|
|||
from core.api.coreapi import CoreExecMessage
|
||||
from core.api.coreapi import CoreLinkMessage
|
||||
from core.api.coreapi import CoreNodeMessage
|
||||
from core.corehandlers import CoreHandler
|
||||
from core.coreserver import CoreServer
|
||||
from core.emulator.coreemu import CoreEmu
|
||||
from core.emulator.emudata import IpPrefixes
|
||||
from core.enumerations import CORE_API_PORT
|
||||
from core.enumerations import ConfigTlvs
|
||||
from core.enumerations import EventTlvs
|
||||
|
@ -23,10 +27,6 @@ from core.enumerations import LinkTypes
|
|||
from core.enumerations import MessageFlags
|
||||
from core.enumerations import NodeTlvs
|
||||
from core.enumerations import NodeTypes
|
||||
from core.future.coreemu import CoreEmu
|
||||
from core.future.futuredata import IpPrefixes
|
||||
from core.legacy.corehandler import CoreHandler
|
||||
from core.legacy.coreserver import CoreServer
|
||||
from core.misc import ipaddress
|
||||
from core.misc.ipaddress import MacAddress
|
||||
|
||||
|
|
|
@ -11,8 +11,8 @@ import pytest
|
|||
from mock import MagicMock
|
||||
|
||||
from core.data import ConfigData
|
||||
from core.emulator.emudata import NodeOptions
|
||||
from core.enumerations import MessageFlags, NodeTypes
|
||||
from core.future.futuredata import NodeOptions
|
||||
from core.mobility import BasicRangeModel
|
||||
from core.netns.vnodeclient import VnodeClient
|
||||
from core.service import ServiceManager
|
||||
|
@ -250,7 +250,7 @@ class TestCore:
|
|||
"""
|
||||
Test basic wlan network.
|
||||
|
||||
:param core.future.coreemu.FutureSession session: session for test
|
||||
:param core.emulator.coreemu.EmuSession session: session for test
|
||||
:param ip_prefixes: generates ip addresses for nodes
|
||||
"""
|
||||
|
||||
|
@ -283,7 +283,7 @@ class TestCore:
|
|||
"""
|
||||
Test basic wlan network.
|
||||
|
||||
:param core.future.coreemu.FutureSession session: session for test
|
||||
:param core.emulator.coreemu.EmuSession session: session for test
|
||||
:param ip_prefixes: generates ip addresses for nodes
|
||||
"""
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ from core.emane.commeffect import EmaneCommEffectModel
|
|||
from core.emane.ieee80211abg import EmaneIeee80211abgModel
|
||||
from core.emane.rfpipe import EmaneRfPipeModel
|
||||
from core.emane.tdma import EmaneTdmaModel
|
||||
from core.future.futuredata import NodeOptions
|
||||
from core.emulator.emudata import NodeOptions
|
||||
|
||||
_EMANE_MODELS = [
|
||||
EmaneIeee80211abgModel,
|
||||
|
@ -27,7 +27,7 @@ class TestEmane:
|
|||
"""
|
||||
Test emane models within a basic network.
|
||||
|
||||
:param core.future.coreemu.FutureSession session: session for test
|
||||
:param core.emulator.coreemu.EmuSession session: session for test
|
||||
:param model: emane model to test
|
||||
:param ip_prefixes: generates ip addresses for nodes
|
||||
"""
|
||||
|
|
|
@ -105,7 +105,7 @@ class TestGui:
|
|||
"""
|
||||
Test session broker creation.
|
||||
|
||||
:param core.future.coreemu.FutureSession session: session for test
|
||||
:param core.emulator.coreemu.EmuSession session: session for test
|
||||
:param cored: cored daemon server to test with
|
||||
"""
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from core.emulator.emudata import LinkOptions
|
||||
from core.enumerations import NodeTypes
|
||||
from core.future.futuredata import LinkOptions
|
||||
from core.misc import utils
|
||||
|
||||
|
||||
|
@ -138,7 +138,7 @@ class TestLinks:
|
|||
"""
|
||||
Test ptp node network with modifying link bandwidth.
|
||||
|
||||
:param core.future.coreemu.FutureSession session: session for test
|
||||
:param core.emulator.coreemu.EmuSession session: session for test
|
||||
:param ip_prefixes: generates ip addresses for nodes
|
||||
"""
|
||||
|
||||
|
@ -169,7 +169,7 @@ class TestLinks:
|
|||
"""
|
||||
Test ptp node network with modifying link packet loss.
|
||||
|
||||
:param core.future.coreemu.FutureSession session: session for test
|
||||
:param core.emulator.coreemu.EmuSession session: session for test
|
||||
:param ip_prefixes: generates ip addresses for nodes
|
||||
"""
|
||||
|
||||
|
@ -200,7 +200,7 @@ class TestLinks:
|
|||
"""
|
||||
Test ptp node network with modifying link packet delay.
|
||||
|
||||
:param core.future.coreemu.FutureSession session: session for test
|
||||
:param core.emulator.coreemu.EmuSession session: session for test
|
||||
:param ip_prefixes: generates ip addresses for nodes
|
||||
"""
|
||||
|
||||
|
@ -232,7 +232,7 @@ class TestLinks:
|
|||
"""
|
||||
Test ptp node network with modifying link packet jitter.
|
||||
|
||||
:param core.future.coreemu.FutureSession session: session for test
|
||||
:param core.emulator.coreemu.EmuSession session: session for test
|
||||
:param ip_prefixes: generates ip addresses for nodes
|
||||
"""
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@ import time
|
|||
|
||||
import pytest
|
||||
|
||||
from core.emulator.emudata import NodeOptions
|
||||
from core.enumerations import NodeTypes
|
||||
from core.future.futuredata import NodeOptions
|
||||
from core.misc import utils
|
||||
|
||||
MODELS = [
|
||||
|
|
Loading…
Reference in a new issue