This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
pespin gerrit-no-reply at lists.osmocom.orgpespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-gsm-tester/+/17132 ) Change subject: Inroduce RunNode class ...................................................................... Inroduce RunNode class This class will be used to hold information for a run node, that is, a target system or environment were a process or task is run. It superseeds in functionality the old ip_address resource, which will eventually be droped in favor of RunNode. Change-Id: I647bedf116aa9a570d925a5281c9491c9032e343 --- M src/osmo_gsm_tester/resource.py A src/osmo_gsm_tester/run_node.py M src/osmo_gsm_tester/suite.py 3 files changed, 79 insertions(+), 1 deletion(-) Approvals: Jenkins Builder: Verified pespin: Looks good to me, approved diff --git a/src/osmo_gsm_tester/resource.py b/src/osmo_gsm_tester/resource.py index 992734d..0cdcb8a 100644 --- a/src/osmo_gsm_tester/resource.py +++ b/src/osmo_gsm_tester/resource.py @@ -40,14 +40,19 @@ RESERVED_RESOURCES_FILE = 'reserved_resources.state' R_IP_ADDRESS = 'ip_address' +R_RUN_NODE = 'run_node' R_BTS = 'bts' R_ARFCN = 'arfcn' R_MODEM = 'modem' R_OSMOCON = 'osmocon_phone' -R_ALL = (R_IP_ADDRESS, R_BTS, R_ARFCN, R_MODEM, R_OSMOCON) +R_ALL = (R_IP_ADDRESS, R_RUN_NODE, R_BTS, R_ARFCN, R_MODEM, R_OSMOCON) RESOURCES_SCHEMA = { 'ip_address[].addr': schema.IPV4, + 'run_node[].run_type': schema.STR, + 'run_node[].run_addr': schema.IPV4, + 'run_node[].ssh_user': schema.STR, + 'run_node[].ssh_addr': schema.IPV4, 'bts[].label': schema.STR, 'bts[].type': schema.STR, 'bts[].ipa_unit_id': schema.UINT, diff --git a/src/osmo_gsm_tester/run_node.py b/src/osmo_gsm_tester/run_node.py new file mode 100644 index 0000000..88555a6 --- /dev/null +++ b/src/osmo_gsm_tester/run_node.py @@ -0,0 +1,69 @@ +# osmo_gsm_tester: run_node: object holding information on a target env to run stuff. +# +# Copyright (C) 2020 by sysmocom - s.f.m.c. GmbH +# +# Author: Pau Espin Pedrol <pespin at sysmocom.de> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +from . import log + +class RunNode(log.Origin): + + T_LOCAL = 'local' + T_REM_SSH = 'ssh' + + def __init__(self, type=None, run_addr=None, ssh_user=None, ssh_addr=None): + super().__init__(log.C_RUN, 'runnode') + self._type = type + self._run_addr = run_addr + self._ssh_user = ssh_user + self._ssh_addr = ssh_addr + if not self._type: + raise log.Error('run_type not set') + if not self._run_addr: + raise log.Error('run_addr not set') + if self._type == RunNode.T_LOCAL and (self._ssh_user or self._ssh_addr): + raise log.Error('run_type=%s but ssh info set' % RunNode.T_LOCAL) + if self._type == RunNode.T_REM_SSH and not (self._ssh_user and self._ssh_addr): + raise log.Error('run_type=%s but ssh info NOT set' % RunNode.T_LOCAL) + + if self._type == RunNode.T_LOCAL: + self.set_name('run-' + self._run_addr) + else: + self.set_name('run-' + self._run_addr + "(" + self._ssh_user + '@' + self._ssh_addr + ")") + + @classmethod + def from_conf(cls, conf): + return cls(conf.get('run_type', None), conf.get('run_addr', None), conf.get('ssh_user', None), conf.get('ssh_addr', None)) + + def is_local(self): + return self._type == RunNode.T_LOCAL + + def __str__(self): + return self.name() + + def run_type(self): + return self._type + + def run_addr(self): + return self._run_addr + + def ssh_user(self): + return self._ssh_user + + def ssh_addr(self): + return self._ssh_addr + +# vim: expandtab tabstop=4 shiftwidth=4 diff --git a/src/osmo_gsm_tester/suite.py b/src/osmo_gsm_tester/suite.py index 0738e96..457bfb3 100644 --- a/src/osmo_gsm_tester/suite.py +++ b/src/osmo_gsm_tester/suite.py @@ -24,6 +24,7 @@ from . import config, log, util, resource, test from .event_loop import MainLoop from . import osmo_nitb, osmo_hlr, osmo_mgcpgw, osmo_mgw, osmo_msc, osmo_bsc, osmo_stp, osmo_ggsn, osmo_sgsn, esme, osmocon, ms_driver, iperf3, process +from . import run_node class Timeout(Exception): pass @@ -358,6 +359,9 @@ self.register_for_cleanup(esme_obj) return esme_obj + def run_node(self, specifics=None): + return run_node.RunNode.from_conf(self.reserved_resources.get(resource.R_RUN_NODE, specifics=specifics)) + def osmocon(self, specifics=None): conf = self.reserved_resources.get(resource.R_OSMOCON, specifics=specifics) osmocon_obj = osmocon.Osmocon(self, conf=conf) -- To view, visit https://gerrit.osmocom.org/c/osmo-gsm-tester/+/17132 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-gsm-tester Gerrit-Branch: master Gerrit-Change-Id: I647bedf116aa9a570d925a5281c9491c9032e343 Gerrit-Change-Number: 17132 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin at sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: pespin <pespin at sysmocom.de> Gerrit-MessageType: merged -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200211/b6acbf42/attachment.htm>