removed saving default configurations for wlan and mobility by default, updated session.add_node to set default configurations for wlan and emane

This commit is contained in:
Blake Harnden 2019-11-21 12:29:33 -08:00
parent eced9863ad
commit 9445b63bd2
5 changed files with 11 additions and 7 deletions

View file

@ -670,7 +670,6 @@ class CoreClient:
if not config:
response = self.client.get_wlan_config(self.session_id, node_id)
config = response.config
self.wlan_configs[node_id] = config
return config
def get_mobility_config(self, node_id):
@ -678,5 +677,4 @@ class CoreClient:
if not config:
response = self.client.get_mobility_config(self.session_id, node_id)
config = response.config
self.mobility_configs[node_id] = config
return config

View file

@ -30,6 +30,8 @@ def add_node_data(node_proto):
options.opaque = node_proto.opaque
options.image = node_proto.image
options.services = node_proto.services
if node_proto.emane:
options.emane = node_proto.emane
if node_proto.server:
options.server = node_proto.server

View file

@ -713,10 +713,6 @@ class CoreGrpcServer(core_pb2_grpc.CoreApiServicer):
session = self.get_session(request.session_id, context)
_type, _id, options = grpcutils.add_node_data(request.node)
node = session.add_node(_type=_type, _id=_id, options=options)
# configure emane if provided
emane_model = request.node.emane
if emane_model:
session.emane.set_model_config(id, emane_model)
return core_pb2.AddNodeResponse(node_id=node.id)
def GetNode(self, request, context):

View file

@ -89,6 +89,7 @@ class NodeOptions:
self.emulation_id = None
self.server = None
self.image = image
self.emane = None
def set_position(self, x, y):
"""

View file

@ -30,7 +30,7 @@ from core.emulator.sessionconfig import SessionConfig
from core.errors import CoreError
from core.location.corelocation import CoreLocation
from core.location.event import EventLoop
from core.location.mobility import MobilityManager
from core.location.mobility import BasicRangeModel, MobilityManager
from core.nodes.base import CoreNetworkBase, CoreNode, CoreNodeBase
from core.nodes.docker import DockerNode
from core.nodes.ipaddress import MacAddress
@ -703,6 +703,13 @@ class Session:
logging.debug("set node type: %s", node.type)
self.services.add_services(node, node.type, options.services)
# ensure default emane configuration
if _type == NodeTypes.EMANE:
self.emane.set_model_config(_id, node.emane)
# set default wlan config if needed
if _type == NodeTypes.WIRELESS_LAN:
self.mobility.set_model_config(_id, BasicRangeModel.name)
# boot nodes after runtime, CoreNodes, Physical, and RJ45 are all nodes
is_boot_node = isinstance(node, CoreNodeBase) and not isinstance(node, Rj45Node)
if self.state == EventTypes.RUNTIME_STATE.value and is_boot_node: