Skip to content

Commit

Permalink
Merge pull request #450 from coreemu/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
bharnden authored May 13, 2020
2 parents d5dec12 + fa163c3 commit cc7c134
Show file tree
Hide file tree
Showing 146 changed files with 3,887 additions and 3,022 deletions.
30 changes: 30 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,33 @@
## 2020-05-11 CORE 6.4.0
* Enhancements
* updates to core-route-monitor, allow specific session, configurable settings, and properly
listen on all interfaces
* install.sh now has a "-r" option to help with reinstalling from current branch and installing
current python dependencies
* \#202 - enable OSPFv2 fast convergence
* \#178 - added comments to OVS service
* Python GUI Enhancements
* added initial documentation to help support usage
* supports drawing multiple links for wireless connections
* supports differentiating wireless networks with different colored links
* implemented unlink in node context menu to delete links to other nodes
* implemented node run tool dialog
* implemented find node dialog
* implemented address configuration dialog
* implemented mac configuration dialog
* updated link address creation to more closely mimic prior behavior
* updated configuration to use yaml class based configs
* implemented auto grid layout for nodes
* fixed drawn wlan ranges during configuration
* Bugfixes
* no longer writes link option data for WLAN/EMANE links in XML
* avoid configuring links for WLAN/EMANE link options in XML, due to them being written to XML prior
* updates to allow building python docs again
* \#431 - peer to peer node uplink link data was not using an enum properly due to code changes
* \#432 - loading XML was not setting EMANE nodes model
* \#435 - loading XML was not maintaining existing session options
* \#448 - fixed issue sorting hooks being saved to XML

## 2020-04-13 CORE 6.3.0
* Features
* \#424 - added FRR IS-IS service
Expand Down
23 changes: 9 additions & 14 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.

# this defines the CORE version number, must be static for AC_INIT
AC_INIT(core, 6.3.0)
AC_INIT(core, 6.4.0)

# autoconf and automake initialization
AC_CONFIG_SRCDIR([netns/version.h.in])
Expand Down Expand Up @@ -43,6 +43,11 @@ AC_ARG_ENABLE([gui],
[build and install the GUI (default is yes)])],
[], [enable_gui=yes])
AC_SUBST(enable_gui)
AC_ARG_ENABLE([docs],
[AS_HELP_STRING([--enable-docs[=ARG]],
[build python documentation (default is no)])],
[], [enable_docs=no])
AC_SUBST(enable_docs)

AC_ARG_ENABLE([python],
[AS_HELP_STRING([--enable-python[=ARG]],
Expand Down Expand Up @@ -191,8 +196,7 @@ if [ test "x$enable_daemon" = "xyes" || test "x$enable_vnodedonly" = "xyes" ] ;
fi

want_docs=no
if test "x$enable_docs" = "xyes" ; then

if [test "x$want_python" = "xyes" && test "x$enable_docs" = "xyes"] ; then
AC_CHECK_PROG(help2man, help2man, yes, no, $SEARCHPATH)

if test "x$help2man" = "xno" ; then
Expand All @@ -210,21 +214,12 @@ if test "x$enable_docs" = "xyes" ; then
# check for sphinx required during make
AC_CHECK_PROG(sphinxapi_path, sphinx-apidoc, $as_dir, no, $SEARCHPATH)
if test "x$sphinxapi_path" = "xno" ; then
AC_MSG_ERROR(["Could not location sphinx-apidoc, from the python-sphinx package"])
AC_MSG_ERROR(["Could not locate sphinx-apidoc, install python3 -m pip install sphinx"])
want_docs=no
fi
AS_IF([$PYTHON -c "import sphinx_rtd_theme" &> /dev/null], [], [AC_MSG_ERROR([doc dependency missing, please install python3 -m pip install sphinx-rtd-theme])])
fi

#AC_PATH_PROGS(tcl_path, [tclsh tclsh8.5 tclsh8.4], no)
#if test "x$tcl_path" = "xno" ; then
# AC_MSG_ERROR([Could not locate tclsh. Please install Tcl/Tk.])
#fi

#AC_PATH_PROGS(wish_path, [wish wish8.5 wish8.4], no)
#if test "x$wish_path" = "xno" ; then
# AC_MSG_ERROR([Could not locate wish. Please install Tcl/Tk.])
#fi

AC_ARG_WITH([startup],
[AS_HELP_STRING([--with-startup=option],
[option=systemd,suse,none to install systemd/SUSE init scripts])],
Expand Down
2 changes: 1 addition & 1 deletion daemon/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ verify_ssl = true

[scripts]
core = "python scripts/core-daemon -f data/core.conf -l data/logging.conf"
coretk = "python scripts/coretk-gui"
core-pygui = "python scripts/core-pygui"
test = "pytest -v tests"
test-mock = "pytest -v --mock tests"
test-emane = "pytest -v tests/emane"
Expand Down
1 change: 0 additions & 1 deletion daemon/core/api/grpc/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,6 @@ def events(
"""
request = core_pb2.EventsRequest(session_id=session_id, events=events)
stream = self.stub.Events(request)
logging.info("STREAM TYPE: %s", type(stream))
start_streamer(stream, handler)
return stream

Expand Down
48 changes: 2 additions & 46 deletions daemon/core/api/grpc/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from typing import Iterable

from core.api.grpc import core_pb2
from core.api.grpc.grpcutils import convert_value
from core.api.grpc.grpcutils import convert_link
from core.emulator.data import (
ConfigData,
EventData,
Expand Down Expand Up @@ -40,51 +40,7 @@ def handle_link_event(event: LinkData) -> core_pb2.LinkEvent:
:param event: link data
:return: link event that has message type and link information
"""
interface_one = None
if event.interface1_id is not None:
interface_one = core_pb2.Interface(
id=event.interface1_id,
name=event.interface1_name,
mac=convert_value(event.interface1_mac),
ip4=convert_value(event.interface1_ip4),
ip4mask=event.interface1_ip4_mask,
ip6=convert_value(event.interface1_ip6),
ip6mask=event.interface1_ip6_mask,
)

interface_two = None
if event.interface2_id is not None:
interface_two = core_pb2.Interface(
id=event.interface2_id,
name=event.interface2_name,
mac=convert_value(event.interface2_mac),
ip4=convert_value(event.interface2_ip4),
ip4mask=event.interface2_ip4_mask,
ip6=convert_value(event.interface2_ip6),
ip6mask=event.interface2_ip6_mask,
)

options = core_pb2.LinkOptions(
opaque=event.opaque,
jitter=event.jitter,
key=event.key,
mburst=event.mburst,
mer=event.mer,
per=event.per,
bandwidth=event.bandwidth,
burst=event.burst,
delay=event.delay,
dup=event.dup,
unidirectional=event.unidirectional,
)
link = core_pb2.Link(
type=event.link_type.value,
node_one_id=event.node1_id,
node_two_id=event.node2_id,
interface_one=interface_one,
interface_two=interface_two,
options=options,
)
link = convert_link(event)
return core_pb2.LinkEvent(message_type=event.message_type.value, link=link)


Expand Down
38 changes: 13 additions & 25 deletions daemon/core/api/grpc/grpcutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from core.emulator.emudata import InterfaceData, LinkOptions, NodeOptions
from core.emulator.enumerations import LinkTypes, NodeTypes
from core.emulator.session import Session
from core.nodes.base import CoreNetworkBase, NodeBase
from core.nodes.base import NodeBase
from core.nodes.interface import CoreInterface
from core.services.coreservices import CoreService

Expand Down Expand Up @@ -263,17 +263,16 @@ def get_node_proto(session: Session, node: NodeBase) -> core_pb2.Node:
)


def get_links(session: Session, node: NodeBase):
def get_links(node: NodeBase):
"""
Retrieve a list of links for grpc to use
Retrieve a list of links for grpc to use.
:param session: node's section
:param node: node to get links from
:return: [core.api.grpc.core_pb2.Link]
:return: protobuf links
"""
links = []
for link_data in node.all_link_data():
link = convert_link(session, link_data)
link = convert_link(link_data)
links.append(link)
return links

Expand Down Expand Up @@ -307,48 +306,35 @@ def parse_emane_model_id(_id: int) -> Tuple[int, int]:
return node_id, interface


def convert_link(session: Session, link_data: LinkData) -> core_pb2.Link:
def convert_link(link_data: LinkData) -> core_pb2.Link:
"""
Convert link_data into core protobuf Link
Convert link_data into core protobuf link.
:param session:
:param link_data:
:param link_data: link to convert
:return: core protobuf Link
"""
interface_one = None
if link_data.interface1_id is not None:
node = session.get_node(link_data.node1_id)
interface_name = None
if not isinstance(node, CoreNetworkBase):
interface = node.netif(link_data.interface1_id)
interface_name = interface.name
interface_one = core_pb2.Interface(
id=link_data.interface1_id,
name=interface_name,
name=link_data.interface1_name,
mac=convert_value(link_data.interface1_mac),
ip4=convert_value(link_data.interface1_ip4),
ip4mask=link_data.interface1_ip4_mask,
ip6=convert_value(link_data.interface1_ip6),
ip6mask=link_data.interface1_ip6_mask,
)

interface_two = None
if link_data.interface2_id is not None:
node = session.get_node(link_data.node2_id)
interface_name = None
if not isinstance(node, CoreNetworkBase):
interface = node.netif(link_data.interface2_id)
interface_name = interface.name
interface_two = core_pb2.Interface(
id=link_data.interface2_id,
name=interface_name,
name=link_data.interface2_name,
mac=convert_value(link_data.interface2_mac),
ip4=convert_value(link_data.interface2_ip4),
ip4mask=link_data.interface2_ip4_mask,
ip6=convert_value(link_data.interface2_ip6),
ip6mask=link_data.interface2_ip6_mask,
)

options = core_pb2.LinkOptions(
opaque=link_data.opaque,
jitter=link_data.jitter,
Expand All @@ -362,14 +348,16 @@ def convert_link(session: Session, link_data: LinkData) -> core_pb2.Link:
dup=link_data.dup,
unidirectional=link_data.unidirectional,
)

return core_pb2.Link(
type=link_data.link_type.value,
node_one_id=link_data.node1_id,
node_two_id=link_data.node2_id,
interface_one=interface_one,
interface_two=interface_two,
options=options,
network_id=link_data.network_id,
label=link_data.label,
color=link_data.color,
)


Expand Down
14 changes: 7 additions & 7 deletions daemon/core/api/grpc/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,6 @@ def StartSession(
for service_exception in boot_exception.args:
exceptions.append(str(service_exception))
return core_pb2.StartSessionResponse(result=False, exceptions=exceptions)

return core_pb2.StartSessionResponse(result=True)

def StopSession(
Expand Down Expand Up @@ -543,7 +542,7 @@ def GetSession(
continue
node_proto = grpcutils.get_node_proto(session, node)
nodes.append(node_proto)
node_links = get_links(session, node)
node_links = get_links(node)
links.extend(node_links)

session_proto = core_pb2.Session(
Expand Down Expand Up @@ -788,7 +787,7 @@ def GetNodeLinks(
logging.debug("get node links: %s", request)
session = self.get_session(request.session_id, context)
node = self.get_node(session, request.node_id, context)
links = get_links(session, node)
links = get_links(node)
return core_pb2.GetNodeLinksResponse(links=links)

def AddLink(
Expand Down Expand Up @@ -1031,8 +1030,7 @@ def GetServiceDefaults(
"""
Retrieve all the default services of all node types in a session
:param request:
get-default-service request
:param request: get-default-service request
:param context: context object
:return: get-service-defaults response about all the available default services
"""
Expand All @@ -1050,8 +1048,8 @@ def SetServiceDefaults(
) -> SetServiceDefaultsResponse:
"""
Set new default services to the session after whipping out the old ones
:param request: set-service-defaults
request
:param request: set-service-defaults request
:param context: context object
:return: set-service-defaults response
"""
Expand Down Expand Up @@ -1494,12 +1492,14 @@ def EmaneLink(
flag = MessageFlags.ADD
else:
flag = MessageFlags.DELETE
color = session.get_link_color(emane_one.id)
link = LinkData(
message_type=flag,
link_type=LinkTypes.WIRELESS,
node1_id=node_one.id,
node2_id=node_two.id,
network_id=emane_one.id,
color=color,
)
session.broadcast_link(link)
return EmaneLinkResponse(result=True)
Expand Down
3 changes: 1 addition & 2 deletions daemon/core/api/tlv/coreapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,7 @@ def new_obj(value):
"""
# only use 48 bits
value = binascii.hexlify(value[2:]).decode()
mac = netaddr.EUI(value)
mac.dialect = netaddr.mac_unix
mac = netaddr.EUI(value, dialect=netaddr.mac_unix_expanded)
return str(mac)


Expand Down
4 changes: 1 addition & 3 deletions daemon/core/api/tlv/corehandlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,14 +367,12 @@ def handle_broadcast_link(self, link_data):
(LinkTlvs.NETWORK_ID, link_data.network_id),
(LinkTlvs.KEY, link_data.key),
(LinkTlvs.INTERFACE1_NUMBER, link_data.interface1_id),
(LinkTlvs.INTERFACE1_NAME, link_data.interface1_name),
(LinkTlvs.INTERFACE1_IP4, link_data.interface1_ip4),
(LinkTlvs.INTERFACE1_IP4_MASK, link_data.interface1_ip4_mask),
(LinkTlvs.INTERFACE1_MAC, link_data.interface1_mac),
(LinkTlvs.INTERFACE1_IP6, link_data.interface1_ip6),
(LinkTlvs.INTERFACE1_IP6_MASK, link_data.interface1_ip6_mask),
(LinkTlvs.INTERFACE2_NUMBER, link_data.interface2_id),
(LinkTlvs.INTERFACE2_NAME, link_data.interface2_name),
(LinkTlvs.INTERFACE2_IP4, link_data.interface2_ip4),
(LinkTlvs.INTERFACE2_IP4_MASK, link_data.interface2_ip4_mask),
(LinkTlvs.INTERFACE2_MAC, link_data.interface2_mac),
Expand Down Expand Up @@ -2062,7 +2060,7 @@ def broadcast(self, message):
if not isinstance(message, (coreapi.CoreNodeMessage, coreapi.CoreLinkMessage)):
return

clients = self.tcp_handler.session_clients[self.session.id]
clients = self.tcp_handler.session_clients.get(self.session.id, [])
for client in clients:
try:
client.sendall(message.raw_message)
Expand Down
Loading

0 comments on commit cc7c134

Please sign in to comment.