From bf1bc511e28b429355ef2a5d20a704f4aaf714be Mon Sep 17 00:00:00 2001 From: Blake Harnden <32446120+bharnden@users.noreply.github.com> Date: Fri, 5 Jun 2020 14:34:19 -0700 Subject: [PATCH] removed configuration option for number of for corehandler threads as it cannot properly deal with anything more than 1, updated man pages to current 6.4 versions for now --- daemon/core/api/tlv/corehandlers.py | 12 +++--------- daemon/data/core.conf | 1 - daemon/scripts/core-daemon | 11 +---------- daemon/scripts/core-imn-to-xml | 2 +- daemon/scripts/core-manage | 2 +- daemon/scripts/core-pygui | 2 +- daemon/scripts/core-route-monitor | 2 +- daemon/scripts/core-service-update | 2 +- daemon/scripts/coresendmsg | 2 +- daemon/tests/conftest.py | 6 +++--- man/core-cleanup.1 | 6 +++--- man/core-daemon.1 | 24 +++++++++++------------- man/core-gui.1 | 6 +++--- man/core-manage.1 | 6 +++--- man/coresendmsg.1 | 10 +++++----- man/netns.1 | 6 +++--- man/vcmd.1 | 6 +++--- man/vnoded.1 | 6 +++--- 18 files changed, 47 insertions(+), 65 deletions(-) diff --git a/daemon/core/api/tlv/corehandlers.py b/daemon/core/api/tlv/corehandlers.py index 1a22cedd..7e2cd040 100644 --- a/daemon/core/api/tlv/corehandlers.py +++ b/daemon/core/api/tlv/corehandlers.py @@ -79,15 +79,9 @@ class CoreHandler(socketserver.BaseRequestHandler): self._sessions_lock = threading.Lock() self.handler_threads = [] - num_threads = int(server.config["numthreads"]) - if num_threads < 1: - raise ValueError(f"invalid number of threads: {num_threads}") - - logging.debug("launching core server handler threads: %s", num_threads) - for _ in range(num_threads): - thread = threading.Thread(target=self.handler_thread) - self.handler_threads.append(thread) - thread.start() + thread = threading.Thread(target=self.handler_thread, daemon=True) + thread.start() + self.handler_threads.append(thread) self.session = None self.coreemu = server.coreemu diff --git a/daemon/data/core.conf b/daemon/data/core.conf index 13b50785..5ff0be7f 100644 --- a/daemon/data/core.conf +++ b/daemon/data/core.conf @@ -4,7 +4,6 @@ listenaddr = localhost port = 4038 grpcaddress = localhost grpcport = 50051 -numthreads = 1 quagga_bin_search = "/usr/local/bin /usr/bin /usr/lib/quagga" quagga_sbin_search = "/usr/local/sbin /usr/sbin /usr/lib/quagga" frr_bin_search = "/usr/local/bin /usr/bin /usr/lib/frr" diff --git a/daemon/scripts/core-daemon b/daemon/scripts/core-daemon index 9f738467..a95e59fa 100755 --- a/daemon/scripts/core-daemon +++ b/daemon/scripts/core-daemon @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ core-daemon: the CORE daemon is a server process that receives CORE API messages and instantiates emulated nodes and networks within the kernel. Various @@ -93,12 +93,10 @@ def get_merged_config(filename): # these are the defaults used in the config file default_log = os.path.join(constants.CORE_CONF_DIR, "logging.conf") default_grpc_port = "50051" - default_threads = "1" default_address = "localhost" defaults = { "port": str(CORE_API_PORT), "listenaddr": default_address, - "numthreads": default_threads, "grpcport": default_grpc_port, "grpcaddress": default_address, "logfile": default_log @@ -110,8 +108,6 @@ def get_merged_config(filename): help=f"read config from specified file; default = {filename}") parser.add_argument("-p", "--port", dest="port", type=int, help=f"port number to listen on; default = {CORE_API_PORT}") - parser.add_argument("-n", "--numthreads", dest="numthreads", type=int, - help=f"number of server threads; default = {default_threads}") parser.add_argument("--ovs", action="store_true", help="enable experimental ovs mode, default is false") parser.add_argument("--grpc-port", dest="grpcport", help=f"grpc port to listen on; default {default_grpc_port}") @@ -148,14 +144,9 @@ def main(): :return: nothing """ - # get a configuration merged from config file and command-line arguments cfg = get_merged_config(f"{CORE_CONF_DIR}/core.conf") - - # load logging configuration load_logging_config(cfg["logfile"]) - banner() - try: cored(cfg) except KeyboardInterrupt: diff --git a/daemon/scripts/core-imn-to-xml b/daemon/scripts/core-imn-to-xml index 725d7119..495093ed 100755 --- a/daemon/scripts/core-imn-to-xml +++ b/daemon/scripts/core-imn-to-xml @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import argparse import re import sys diff --git a/daemon/scripts/core-manage b/daemon/scripts/core-manage index 14e10e5b..5587c9ae 100755 --- a/daemon/scripts/core-manage +++ b/daemon/scripts/core-manage @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ core-manage: Helper tool to add, remove, or check for services, models, and node types in a CORE installation. diff --git a/daemon/scripts/core-pygui b/daemon/scripts/core-pygui index f30b531b..46860ce9 100755 --- a/daemon/scripts/core-pygui +++ b/daemon/scripts/core-pygui @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import argparse import logging from logging.handlers import TimedRotatingFileHandler diff --git a/daemon/scripts/core-route-monitor b/daemon/scripts/core-route-monitor index a9b48aff..b12e6205 100755 --- a/daemon/scripts/core-route-monitor +++ b/daemon/scripts/core-route-monitor @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import argparse import enum import select diff --git a/daemon/scripts/core-service-update b/daemon/scripts/core-service-update index 6d0be06c..d0ca863f 100755 --- a/daemon/scripts/core-service-update +++ b/daemon/scripts/core-service-update @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import argparse import re from io import TextIOWrapper diff --git a/daemon/scripts/coresendmsg b/daemon/scripts/coresendmsg index ae89ecb1..13e20b5c 100755 --- a/daemon/scripts/coresendmsg +++ b/daemon/scripts/coresendmsg @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ coresendmsg: utility for generating CORE messages """ diff --git a/daemon/tests/conftest.py b/daemon/tests/conftest.py index 0c021b25..9d54d9c2 100644 --- a/daemon/tests/conftest.py +++ b/daemon/tests/conftest.py @@ -44,8 +44,8 @@ class PatchManager: class MockServer: - def __init__(self, config, coreemu): - self.config = config + def __init__(self, coreemu): + self.config = {} self.coreemu = coreemu @@ -108,7 +108,7 @@ def module_grpc(global_coreemu): def module_coretlv(patcher, global_coreemu, global_session): request_mock = MagicMock() request_mock.fileno = MagicMock(return_value=1) - server = MockServer({"numthreads": "1"}, global_coreemu) + server = MockServer(global_coreemu) request_handler = CoreHandler(request_mock, "", server) request_handler.session = global_session request_handler.add_session_handlers() diff --git a/man/core-cleanup.1 b/man/core-cleanup.1 index 64aa18fb..0f56c14c 100644 --- a/man/core-cleanup.1 +++ b/man/core-cleanup.1 @@ -1,7 +1,7 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.3. -.TH CORE-CLEANUP "1" "June 2019" "CORE" "User Commands" +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.6. +.TH CORE-CLEANUP "1" "June 2020" "CORE" "User Commands" .SH NAME -core-cleanup \- manual page for core-cleanup 5.3.0 +core-cleanup \- manual page for core-cleanup 6.4.0 .SH DESCRIPTION usage: ../daemon/scripts/core\-cleanup [\-d [\-l]] .IP diff --git a/man/core-daemon.1 b/man/core-daemon.1 index c8061e0d..01799894 100644 --- a/man/core-daemon.1 +++ b/man/core-daemon.1 @@ -1,14 +1,14 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.3. -.TH CORE-DAEMON "1" "June 2019" "CORE" "User Commands" +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.6. +.TH CORE-DAEMON "1" "June 2020" "CORE" "User Commands" .SH NAME -core-daemon \- manual page for core-daemon 5.3.0 +core-daemon \- manual page for core-daemon 6.4.0 .SH DESCRIPTION -usage: core\-daemon [\-h] [\-f CONFIGFILE] [\-p PORT] [\-n NUMTHREADS] [\-\-ovs] +usage: core\-daemon [\-h] [\-f CONFIGFILE] [\-p PORT] [\-\-ovs] .IP -[\-\-grpc] [\-\-grpc\-port GRPCPORT] -[\-\-grpc\-address GRPCADDRESS] +[\-\-grpc\-port GRPCPORT] [\-\-grpc\-address GRPCADDRESS] +[\-l LOGFILE] .PP -CORE daemon v.5.3.0 instantiates Linux network namespace nodes. +CORE daemon v.6.4.0 instantiates Linux network namespace nodes. .SS "optional arguments:" .TP \fB\-h\fR, \fB\-\-help\fR @@ -21,17 +21,15 @@ read config from specified file; default = \fB\-p\fR PORT, \fB\-\-port\fR PORT port number to listen on; default = 4038 .TP -\fB\-n\fR NUMTHREADS, \fB\-\-numthreads\fR NUMTHREADS -number of server threads; default = 1 -.TP \fB\-\-ovs\fR enable experimental ovs mode, default is false .TP -\fB\-\-grpc\fR -enable grpc api, default is false -.TP \fB\-\-grpc\-port\fR GRPCPORT grpc port to listen on; default 50051 .TP \fB\-\-grpc\-address\fR GRPCADDRESS grpc address to listen on; default localhost +.TP +\fB\-l\fR LOGFILE, \fB\-\-logfile\fR LOGFILE +core logging configuration; default +\fI\,/etc/core/logging.conf\/\fP diff --git a/man/core-gui.1 b/man/core-gui.1 index 5792e0c6..2a7b95ac 100644 --- a/man/core-gui.1 +++ b/man/core-gui.1 @@ -1,7 +1,7 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.3. -.TH CORE-GUI "1" "June 2019" "CORE" "User Commands" +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.6. +.TH CORE-GUI "1" "June 2020" "CORE" "User Commands" .SH NAME -core-gui \- manual page for core-gui version 5.3.0 (20190607) +core-gui \- manual page for core-gui version 6.4.0 (20200513) .SH SYNOPSIS .B core-gui [\fI\,-h|-v\/\fR] [\fI\,-b|-c \/\fR] [\fI\,-s\/\fR] [\fI\,-a address\/\fR] [\fI\,-p port\/\fR] diff --git a/man/core-manage.1 b/man/core-manage.1 index 7e7c6f42..594a5f64 100644 --- a/man/core-manage.1 +++ b/man/core-manage.1 @@ -1,7 +1,7 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.3. -.TH CORE-MANAGE "1" "June 2019" "CORE" "User Commands" +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.6. +.TH CORE-MANAGE "1" "June 2020" "CORE" "User Commands" .SH NAME -core-manage \- manual page for core-manage 5.3.0 +core-manage \- manual page for core-manage 6.4.0 .SH SYNOPSIS .B core-manage [\fI\,-h\/\fR] [\fI\,options\/\fR] \fI\, \/\fR diff --git a/man/coresendmsg.1 b/man/coresendmsg.1 index 9a42e29a..8815b189 100644 --- a/man/coresendmsg.1 +++ b/man/coresendmsg.1 @@ -1,17 +1,17 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.3. -.TH CORESENDMSG "1" "June 2019" "CORE" "User Commands" +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.6. +.TH CORESENDMSG "1" "June 2020" "CORE" "User Commands" .SH NAME -coresendmsg \- manual page for coresendmsg 5.3.0 +coresendmsg \- manual page for coresendmsg 6.4.0 .SH SYNOPSIS .B coresendmsg [\fI\,-h|-H\/\fR] [\fI\,options\/\fR] [\fI\,message-type\/\fR] [\fI\,flags=flags\/\fR] [\fI\,message-TLVs\/\fR] .SH DESCRIPTION .SS "Supported message types:" .IP -['NODE', 'LINK', 'EXECUTE', 'REGISTER', 'CONFIG', 'FILE', 'INTERFACE', 'EVENT', 'SESSION', 'EXCEPTION'] +node link execute register config file interface event session exception .SS "Supported message flags (flags=f1,f2,...):" .IP -['ADD', 'DELETE', 'CRI', 'LOCAL', 'STRING', 'TEXT', 'TTY'] +none add delete cri local string text tty .SH OPTIONS .TP \fB\-h\fR, \fB\-\-help\fR diff --git a/man/netns.1 b/man/netns.1 index 5cb6e312..abc62ee2 100644 --- a/man/netns.1 +++ b/man/netns.1 @@ -1,7 +1,7 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.3. -.TH NETNS "1" "June 2019" "CORE" "User Commands" +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.6. +.TH NETNS "1" "June 2020" "CORE" "User Commands" .SH NAME -netns \- manual page for netns version 5.3.0 +netns \- manual page for netns version 6.4.0 .SH SYNOPSIS .B netns [\fI\,-h|-V\/\fR] [\fI\,-w\/\fR] \fI\,-- command \/\fR[\fI\,args\/\fR...] diff --git a/man/vcmd.1 b/man/vcmd.1 index 79f14f50..f5438978 100644 --- a/man/vcmd.1 +++ b/man/vcmd.1 @@ -1,7 +1,7 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.3. -.TH VCMD "1" "June 2019" "CORE" "User Commands" +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.6. +.TH VCMD "1" "June 2020" "CORE" "User Commands" .SH NAME -vcmd \- manual page for vcmd version 5.3.0 +vcmd \- manual page for vcmd version 6.4.0 .SH SYNOPSIS .B vcmd [\fI\,-h|-V\/\fR] [\fI\,-v\/\fR] [\fI\,-q|-i|-I\/\fR] \fI\,-c -- command args\/\fR... diff --git a/man/vnoded.1 b/man/vnoded.1 index 841b00e9..11874e39 100644 --- a/man/vnoded.1 +++ b/man/vnoded.1 @@ -1,7 +1,7 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.3. -.TH VNODED "1" "June 2019" "CORE" "User Commands" +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.6. +.TH VNODED "1" "June 2020" "CORE" "User Commands" .SH NAME -vnoded \- manual page for vnoded version 5.3.0 +vnoded \- manual page for vnoded version 6.4.0 .SH SYNOPSIS .B vnoded [\fI\,-h|-V\/\fR] [\fI\,-v\/\fR] [\fI\,-n\/\fR] [\fI\,-C \/\fR] [\fI\,-l \/\fR] [\fI\,-p \/\fR] \fI\,-c \/\fR