From 4bf4f91f5466131bf278a97a6e3685f66106fc6f Mon Sep 17 00:00:00 2001 From: Javier Hernandez Date: Fri, 27 Oct 2023 11:38:24 +0200 Subject: client: support for adding clients Add a new client with command: $ ogcli add client --repo-id --netmask --room-id --hostname --mac --ip --boot-mode For example: To add a new client with hostname "javipc", netmask 255.255.255.0, mac address a2:54:00:2e:05:7a, ip address 192.168.56.101, assign it to repo id 1, room id 1 and set its boot mode to oglive use: $ ogcli add client --hostname javipc --netmask 255.255.255.0 --mac a2:54:00:2e:05:7a --ip 192.168.56.101 --repo-id 1 --room-id 1 --boot-mode oglive Notes: - ogserver API REST json payload does not allow to specify a server (table 'entorno') for the client. It will automatically assign client to server with id 1 - ogserver API REST json payload specifies mac address without ':'. - payload must contain 'netiface', ogcli specifies 'eth0' is specified which is the default value in netiface column in db (table 'ordenadores') - netdriver column uses "generic" as default, this field is not used anymore, but it is set to "generic" by now. - ogserver should validate that boot mode set is correct. --- cli/cli.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'cli/cli.py') diff --git a/cli/cli.py b/cli/cli.py index ddc4a01..95b0f82 100644 --- a/cli/cli.py +++ b/cli/cli.py @@ -215,7 +215,7 @@ class OgCLI(): OgRoom.delete_room(self.rest, args[1:]) def add(self, args): - choices = ['server', 'repo', 'center', 'room'] + choices = ['server', 'repo', 'center', 'room', 'client'] parser = argparse.ArgumentParser(prog='ogcli add') parser.add_argument('add_obj', choices=choices) @@ -233,3 +233,5 @@ class OgCLI(): OgCenter.add_center(self.rest, args[1:]) elif parsed_args.add_obj == 'room': OgRoom.add_room(self.rest, args[1:]) + elif parsed_args.add_obj == 'client': + OgClient.add_client(self.rest, args[1:]) -- cgit v1.2.3-18-g5258