updates to try and clean up info logging, moved some statements to debug

This commit is contained in:
bharnden 2019-09-11 15:05:05 -07:00
parent 8a39d070b8
commit 0d5692e7e8
14 changed files with 37 additions and 37 deletions

View file

@ -175,7 +175,7 @@ class CoreGrpcServer(core_pb2_grpc.CoreApiServicer):
context.abort(grpc.StatusCode.CANCELLED, "server stopping") context.abort(grpc.StatusCode.CANCELLED, "server stopping")
def listen(self, address): def listen(self, address):
logging.info("starting grpc api: %s", address) logging.info("CORE gRPC API listening on: %s", address)
self.server = grpc.server(futures.ThreadPoolExecutor(max_workers=10)) self.server = grpc.server(futures.ThreadPoolExecutor(max_workers=10))
core_pb2_grpc.add_CoreApiServicer_to_server(self, self.server) core_pb2_grpc.add_CoreApiServicer_to_server(self, self.server)
self.server.add_insecure_port(address) self.server.add_insecure_port(address)

View file

@ -164,7 +164,7 @@ class CoreBroker(object):
""" """
Reset to initial state. Reset to initial state.
""" """
logging.info("clearing state") logging.debug("broker reset")
self.nodemap_lock.acquire() self.nodemap_lock.acquire()
self.nodemap.clear() self.nodemap.clear()
for server in self.nodecounts: for server in self.nodecounts:

View file

@ -1611,7 +1611,9 @@ class CoreHandler(socketserver.BaseRequestHandler):
self.session.start_mobility(node_ids=(node.id,)) self.session.start_mobility(node_ids=(node.id,))
return () return ()
logging.warning("dropping unhandled Event message with node number") logging.warning(
"dropping unhandled event message for node: %s", node_id
)
return () return ()
self.session.set_state(event_type) self.session.set_state(event_type)
@ -1663,7 +1665,9 @@ class CoreHandler(socketserver.BaseRequestHandler):
handled = True handled = True
if not handled: if not handled:
logging.warning( logging.warning(
"Unhandled event message: event type %s ", event_type.name "unhandled event message: event type %s, name %s ",
event_type.name,
name,
) )
elif event_type == EventTypes.FILE_OPEN: elif event_type == EventTypes.FILE_OPEN:
filename = event_data.name filename = event_data.name
@ -1685,8 +1689,6 @@ class CoreHandler(socketserver.BaseRequestHandler):
self.session.add_event(float(etime), node=node, name=name, data=data) self.session.add_event(float(etime), node=node, name=name, data=data)
else: else:
raise NotImplementedError raise NotImplementedError
else:
logging.warning("unhandled event message: event type %s", event_type)
return () return ()
@ -1797,7 +1799,6 @@ class CoreHandler(socketserver.BaseRequestHandler):
logging.warning("session %s not found", session_id) logging.warning("session %s not found", session_id)
continue continue
logging.info("request to modify to session: %s", session.id)
if names is not None: if names is not None:
session.name = names[index] session.name = names[index]

View file

@ -380,11 +380,8 @@ class ModelManager(ConfigurableManager):
:param dict config: model configuration, None for default configuration :param dict config: model configuration, None for default configuration
:return: nothing :return: nothing
""" """
logging.info( logging.debug(
"setting mobility model(%s) for node(%s): %s", "setting model(%s) for node(%s): %s", model_class.name, node.id, config
model_class.name,
node.id,
config,
) )
self.set_model_config(node.id, model_class.name, config) self.set_model_config(node.id, model_class.name, config)
config = self.get_model_config(node.id, model_class.name) config = self.get_model_config(node.id, model_class.name)

View file

@ -220,7 +220,7 @@ class EmaneManager(ModelManager):
Load EMANE models and make them available. Load EMANE models and make them available.
""" """
for emane_model in emane_models: for emane_model in emane_models:
logging.info("loading emane model: %s", emane_model.__name__) logging.debug("loading emane model: %s", emane_model.__name__)
emane_prefix = self.session.options.get_config( emane_prefix = self.session.options.get_config(
"emane_prefix", default=DEFAULT_EMANE_PREFIX "emane_prefix", default=DEFAULT_EMANE_PREFIX
) )

View file

@ -1462,7 +1462,7 @@ class Session(object):
# this is called from instantiate() after receiving an event message # this is called from instantiate() after receiving an event message
# for the instantiation state, and from the broker when distributed # for the instantiation state, and from the broker when distributed
# nodes have been started # nodes have been started
logging.info( logging.debug(
"session(%s) checking if not in runtime state, current state: %s", "session(%s) checking if not in runtime state, current state: %s",
self.id, self.id,
coreapi.state_name(self.state), coreapi.state_name(self.state),
@ -1513,7 +1513,7 @@ class Session(object):
and links remain. and links remain.
""" """
node_count = self.get_node_count() node_count = self.get_node_count()
logging.info( logging.debug(
"session(%s) checking shutdown: %s nodes remaining", self.id, node_count "session(%s) checking shutdown: %s nodes remaining", self.id, node_count
) )
@ -1550,7 +1550,11 @@ class Session(object):
node, NodeTypes.RJ45 node, NodeTypes.RJ45
): ):
# add a control interface if configured # add a control interface if configured
logging.info("booting node(%s): %s", node.name, node.services) logging.info(
"booting node(%s): %s",
node.name,
[x.name for x in node.services],
)
self.add_remove_control_interface(node=node, remove=False) self.add_remove_control_interface(node=node, remove=False)
result = pool.apply_async(self.services.boot_services, (node,)) result = pool.apply_async(self.services.boot_services, (node,))
results.append(result) results.append(result)

View file

@ -72,8 +72,8 @@ class MobilityManager(ModelManager):
node_ids = self.nodes() node_ids = self.nodes()
for node_id in node_ids: for node_id in node_ids:
logging.info("checking mobility startup for node: %s", node_id) logging.debug("checking mobility startup for node: %s", node_id)
logging.info( logging.debug(
"node mobility configurations: %s", self.get_all_configs(node_id) "node mobility configurations: %s", self.get_all_configs(node_id)
) )
@ -415,7 +415,7 @@ class BasicRangeModel(WirelessModel):
:return: nothing :return: nothing
""" """
self.range = int(float(config["range"])) self.range = int(float(config["range"]))
logging.info( logging.debug(
"basic range model configured for WLAN %d using range %d", "basic range model configured for WLAN %d using range %d",
self.wlan.id, self.wlan.id,
self.range, self.range,

View file

@ -624,7 +624,7 @@ class CoreNode(CoreNodeBase):
:raises CoreCommandError: when a non-zero exit status occurs :raises CoreCommandError: when a non-zero exit status occurs
""" """
source = os.path.abspath(source) source = os.path.abspath(source)
logging.info("node(%s) mounting: %s at %s", self.name, source, target) logging.debug("node(%s) mounting: %s at %s", self.name, source, target)
cmd = 'mkdir -p "%s" && %s -n --bind "%s" "%s"' % ( cmd = 'mkdir -p "%s" && %s -n --bind "%s" "%s"' % (
target, target,
constants.MOUNT_BIN, constants.MOUNT_BIN,
@ -1020,7 +1020,7 @@ class CoreNode(CoreNodeBase):
with self.opennodefile(filename, "w") as open_file: with self.opennodefile(filename, "w") as open_file:
open_file.write(contents) open_file.write(contents)
os.chmod(open_file.name, mode) os.chmod(open_file.name, mode)
logging.info( logging.debug(
"node(%s) added file: %s; mode: 0%o", self.name, open_file.name, mode "node(%s) added file: %s; mode: 0%o", self.name, open_file.name, mode
) )

View file

@ -250,7 +250,7 @@ class DockerNode(CoreNode):
:param str path: path to create :param str path: path to create
:return: nothing :return: nothing
""" """
logging.info("creating node dir: %s", path) logging.debug("creating node dir: %s", path)
args = "mkdir -p {path}".format(path=path) args = "mkdir -p {path}".format(path=path)
self.check_cmd(args) self.check_cmd(args)
@ -263,7 +263,7 @@ class DockerNode(CoreNode):
:return: nothing :return: nothing
:raises CoreCommandError: when a non-zero exit status occurs :raises CoreCommandError: when a non-zero exit status occurs
""" """
logging.info("mounting source(%s) target(%s)", source, target) logging.debug("mounting source(%s) target(%s)", source, target)
raise Exception("not supported") raise Exception("not supported")
def nodefile(self, filename, contents, mode=0o644): def nodefile(self, filename, contents, mode=0o644):
@ -275,8 +275,8 @@ class DockerNode(CoreNode):
:param int mode: mode for file :param int mode: mode for file
:return: nothing :return: nothing
""" """
logging.info("node dir(%s) ctrlchannel(%s)", self.nodedir, self.ctrlchnlname) logging.debug("node dir(%s) ctrlchannel(%s)", self.nodedir, self.ctrlchnlname)
logging.info("nodefile filename(%s) mode(%s)", filename, mode) logging.debug("nodefile filename(%s) mode(%s)", filename, mode)
file_path = os.path.join(self.nodedir, filename) file_path = os.path.join(self.nodedir, filename)
with open(file_path, "w") as f: with open(file_path, "w") as f:
os.chmod(f.name, mode) os.chmod(f.name, mode)

View file

@ -262,7 +262,7 @@ class LxcNode(CoreNode):
:return: nothing :return: nothing
:raises CoreCommandError: when a non-zero exit status occurs :raises CoreCommandError: when a non-zero exit status occurs
""" """
logging.info("mounting source(%s) target(%s)", source, target) logging.debug("mounting source(%s) target(%s)", source, target)
raise Exception("not supported") raise Exception("not supported")
def nodefile(self, filename, contents, mode=0o644): def nodefile(self, filename, contents, mode=0o644):
@ -274,8 +274,8 @@ class LxcNode(CoreNode):
:param int mode: mode for file :param int mode: mode for file
:return: nothing :return: nothing
""" """
logging.info("node dir(%s) ctrlchannel(%s)", self.nodedir, self.ctrlchnlname) logging.debug("node dir(%s) ctrlchannel(%s)", self.nodedir, self.ctrlchnlname)
logging.info("nodefile filename(%s) mode(%s)", filename, mode) logging.debug("nodefile filename(%s) mode(%s)", filename, mode)
file_path = os.path.join(self.nodedir, filename) file_path = os.path.join(self.nodedir, filename)
with open(file_path, "w") as f: with open(file_path, "w") as f:
os.chmod(f.name, mode) os.chmod(f.name, mode)

View file

@ -1153,7 +1153,7 @@ class WlanNode(CoreNetwork):
:param dict config: configuration for model being set :param dict config: configuration for model being set
:return: nothing :return: nothing
""" """
logging.info("adding model: %s", model.name) logging.debug("node(%s) setting model: %s", self.name, model.name)
if model.config_type == RegisterTlvs.WIRELESS.value: if model.config_type == RegisterTlvs.WIRELESS.value:
self.model = model(session=self.session, _id=self.id) self.model = model(session=self.session, _id=self.id)
self.updatemodel(config) self.updatemodel(config)
@ -1169,7 +1169,7 @@ class WlanNode(CoreNetwork):
def updatemodel(self, config): def updatemodel(self, config):
if not self.model: if not self.model:
raise ValueError("no model set to update for node(%s)", self.id) raise ValueError("no model set to update for node(%s)", self.id)
logging.info( logging.debug(
"node(%s) updating model(%s): %s", self.id, self.model.name, config "node(%s) updating model(%s): %s", self.id, self.model.name, config
) )
self.model.update_config(config) self.model.update_config(config)

View file

@ -414,7 +414,6 @@ class CoreServices(object):
"unknown service(%s) for node(%s)", service_name, node.name "unknown service(%s) for node(%s)", service_name, node.name
) )
continue continue
logging.info("adding service to node(%s): %s", node.name, service_name)
node.services.append(service) node.services.append(service)
def all_configs(self): def all_configs(self):
@ -483,7 +482,9 @@ class CoreServices(object):
:return: nothing :return: nothing
""" """
logging.info( logging.info(
"booting node services: %s", " -> ".join([x.name for x in boot_path]) "booting node(%s) services: %s",
node.name,
" -> ".join([x.name for x in boot_path]),
) )
for service in boot_path: for service in boot_path:
try: try:
@ -743,9 +744,6 @@ class CoreServices(object):
:param CoreService service: service to reconfigure :param CoreService service: service to reconfigure
:return: nothing :return: nothing
""" """
logging.info(
"node(%s) service(%s) creating config files", node.name, service.name
)
# get values depending on if custom or not # get values depending on if custom or not
config_files = service.configs config_files = service.configs
if not service.custom: if not service.custom:

View file

@ -360,7 +360,7 @@ class CoreXmlWriter(object):
for model_name in all_configs: for model_name in all_configs:
config = all_configs[model_name] config = all_configs[model_name]
logging.info( logging.debug(
"writing mobility config node(%s) model(%s)", node_id, model_name "writing mobility config node(%s) model(%s)", node_id, model_name
) )
mobility_configuration = etree.SubElement( mobility_configuration = etree.SubElement(

View file

@ -81,7 +81,7 @@ def cored(cfg, use_ovs):
# close handlers # close handlers
close_onexec(server.fileno()) close_onexec(server.fileno())
logging.info("tcp/udp servers started, listening on: %s:%s", host, port) logging.info("CORE TLV API TCP/UDP listening on: %s:%s", host, port)
server.serve_forever() server.serve_forever()