Skip to content

Commit

Permalink
Merge pull request #767 from coreemu/develop
Browse files Browse the repository at this point in the history
CORE 9.0.2
  • Loading branch information
bharnden authored Mar 3, 2023
2 parents ecf380c + 04e778e commit c44dc52
Show file tree
Hide file tree
Showing 35 changed files with 1,037 additions and 670 deletions.
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
## 2023-03-02 CORE 9.0.2

* Installation
* updated python dependencies, including invoke to resolve python 3.10+ issues
* improved example dockerfiles to use less space for built images
* Documentation
* updated emane install instructions
* added Docker related issues to install instructions
* core-daemon
* fixed issue using invalid device name in sysctl commands
* updated PTP nodes to properly disable mac learning for their linux bridge
* fixed issue for LXC nodes to properly use a configured image name and write it to XML
* \#742 - fixed issue with bad wlan node id being used
* \#744 - fixed issue not properly setting broadcast address

## core-gui
* fixed sample1.xml to remove SSH service
* fixed emane demo examples
* fixed issue displaying emane configs generally configured for a node

## 2022-11-28 CORE 9.0.1

* Installation
Expand Down
2 changes: 1 addition & 1 deletion 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, 9.0.1)
AC_INIT(core, 9.0.2)

# autoconf and automake initialization
AC_CONFIG_SRCDIR([netns/version.h.in])
Expand Down
10 changes: 5 additions & 5 deletions daemon/core/api/grpc/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,12 @@ def throughput_listener(
stream: Any, handler: Callable[[wrappers.ThroughputsEvent], None]
) -> None:
"""
Listen for throughput events and provide them to the handler.
Listen for throughput events and provide them to the handler.
:param stream: grpc stream that will provide events
:param handler: function that handles an event
:return: nothing
"""
:param stream: grpc stream that will provide events
:param handler: function that handles an event
:return: nothing
"""
try:
for event_proto in stream:
event = wrappers.ThroughputsEvent.from_proto(event_proto)
Expand Down
24 changes: 7 additions & 17 deletions daemon/core/api/grpc/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from queue import Empty, Queue
from typing import Iterable, Optional

from core.api.grpc import core_pb2
from core.api.grpc import core_pb2, grpcutils
from core.api.grpc.grpcutils import convert_link_data
from core.emulator.data import (
ConfigData,
Expand All @@ -17,28 +17,18 @@
logger = logging.getLogger(__name__)


def handle_node_event(node_data: NodeData) -> core_pb2.Event:
def handle_node_event(session: Session, node_data: NodeData) -> core_pb2.Event:
"""
Handle node event when there is a node event
:param session: session node is from
:param node_data: node data
:return: node event that contains node id, name, model, position, and services
"""
node = node_data.node
x, y, _ = node.position.get()
position = core_pb2.Position(x=x, y=y)
lon, lat, alt = node.position.get_geo()
geo = core_pb2.Geo(lon=lon, lat=lat, alt=alt)
services = [x.name for x in node.services]
node_proto = core_pb2.Node(
id=node.id,
name=node.name,
model=node.model,
icon=node.icon,
position=position,
geo=geo,
services=services,
)
emane_configs = grpcutils.get_emane_model_configs_dict(session)
node_emane_configs = emane_configs.get(node.id, [])
node_proto = grpcutils.get_node_proto(session, node, node_emane_configs)
message_type = node_data.message_type.value
node_event = core_pb2.NodeEvent(message_type=message_type, node=node_proto)
return core_pb2.Event(node_event=node_event, source=node_data.source)
Expand Down Expand Up @@ -189,7 +179,7 @@ def process(self) -> Optional[core_pb2.Event]:
try:
data = self.queue.get(timeout=1)
if isinstance(data, NodeData):
event = handle_node_event(data)
event = handle_node_event(self.session, data)
elif isinstance(data, LinkData):
event = handle_link_event(data)
elif isinstance(data, EventData):
Expand Down
6 changes: 3 additions & 3 deletions daemon/core/api/grpc/grpcutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
)
from core.nodes.docker import DockerNode, DockerOptions
from core.nodes.interface import CoreInterface
from core.nodes.lxd import LxcNode
from core.nodes.lxd import LxcNode, LxcOptions
from core.nodes.network import CoreNetwork, CtrlNet, PtpNet, WlanNode
from core.nodes.wireless import WirelessNode
from core.services.coreservices import CoreService
Expand Down Expand Up @@ -81,7 +81,7 @@ def add_node_data(
options.config_services = node_proto.config_services
if isinstance(options, EmaneOptions):
options.emane_model = node_proto.emane
if isinstance(options, DockerOptions):
if isinstance(options, (DockerOptions, LxcOptions)):
options.image = node_proto.image
position = Position()
position.set(node_proto.position.x, node_proto.position.y)
Expand Down Expand Up @@ -117,7 +117,7 @@ def link_iface(iface_proto: core_pb2.Interface) -> InterfaceData:


def add_link_data(
link_proto: core_pb2.Link
link_proto: core_pb2.Link,
) -> Tuple[InterfaceData, InterfaceData, LinkOptions]:
"""
Convert link proto to link interfaces and options data.
Expand Down
9 changes: 7 additions & 2 deletions daemon/core/emulator/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ def add_node(
self.set_node_pos(node, position.x, position.y)
# setup default wlan
if isinstance(node, WlanNode):
self.mobility.set_model_config(self.id, BasicRangeModel.name)
self.mobility.set_model_config(node.id, BasicRangeModel.name)
# boot core nodes after runtime
is_runtime = self.state == EventTypes.RUNTIME_STATE
if is_runtime and isinstance(node, CoreNode):
Expand Down Expand Up @@ -1113,7 +1113,12 @@ def boot_node(self, node: CoreNode) -> None:
:param node: node to boot
:return: nothing
"""
logger.info("booting node(%s): %s", node.name, [x.name for x in node.services])
logger.info(
"booting node(%s): config services(%s) services(%s)",
node.name,
", ".join(node.config_services.keys()),
", ".join(x.name for x in node.services),
)
self.services.boot_services(node)
node.start_config_services()

Expand Down
2 changes: 1 addition & 1 deletion daemon/core/gui/coreclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@ def get_config_service_rendered(self, node_id: int, name: str) -> Dict[str, str]
return self.client.get_config_service_rendered(self.session.id, node_id, name)

def get_config_service_configs_proto(
self
self,
) -> List[configservices_pb2.ConfigServiceConfig]:
config_service_protos = []
for node in self.session.nodes.values():
Expand Down
Loading

0 comments on commit c44dc52

Please sign in to comment.