Commit Graph

13 Commits (a576aeaf1ea685e78148fd468853c9ad10f4f7db)

Author SHA1 Message Date
Jose M. Guisado a576aeaf1e Add 'create image'
Enables creation of images using /image/create from ogServer API.

Summary of the options:

	--disk
	Disk number

	--part
	Partition number

	--name
	Image name which will be used for the .img file.

	--desc
	Description of the image. This option enables ogServer to store
	an entry in the database regarding this image.

	--repo
	Optional. Holds the ip address of the repo which will store the
	created image. Defaults to ogserver address specified inside
	ogcli.json

	--client-ip
	Client ip for which we want to create a partition image
2021-04-06 13:16:46 +02:00
Jose M. Guisado 4dfb90cf56 Add 'list disks'
Enables consuming /client/setup API from ogServer in order to fetch
partition and disk setup information from a given client.

Example, if pc11 is a client with 1 disk, 4 part (1:linux,2-3:empty,4:cache):

ogcli list disk --client-ip 192.168.56.11

{
  "partitions": [
    {
      "disk": 1,
      "partition": 0,
      "code": 1,
      "size": 52428800,
      "used_size": 0,
      "filesystem": 0,
      "os": 0,
      "image": 0,
      "software": 0
    },
    {
      "disk": 1,
      "partition": 1,
      "code": 131,
      "size": 40000000,
      "used_size": 4,
      "filesystem": 6,
      "os": 8,
      "image": 0,
      "software": 0
    },
    {
      "disk": 1,
      "partition": 2,
      "code": 0,
      "size": 0,
      "used_size": 0,
      "filesystem": 1,
      "os": 0,
      "image": 0,
      "software": 0
    },
    {
      "disk": 1,
      "partition": 3,
      "code": 0,
      "size": 0,
      "used_size": 0,
      "filesystem": 1,
      "os": 0,
      "image": 0,
      "software": 0
    },
    {
      "disk": 1,
      "partition": 4,
      "code": 202,
      "size": 10000000,
      "used_size": 1,
      "filesystem": 2,
      "os": 0,
      "image": 0,
      "software": 0
    }
  ]
}
2021-04-06 13:16:46 +02:00
Jose M. Guisado 6fd3cb7a25 Add 'restore image' command
Adds cli capability to send image restore commands to the ogServer.

It has the following options:

	--id
	To specify image id

	--disk
	Target disk

	--part
	Target partition

	--type
	To specify type of restore to send. UNICAST-DIRECT or
	UNICAST-CACHE are supported as of this patch.

	--repo
	Optional argument to specify image repo to fetch the image. This
	applies for UNICAST-DIRECT cases. (not restoring from a cache
	partition). If not specified it will default to rest.URL ip
	(ie. ogServer ip)

	--client-ip, --room-id and --center-id
	Target client args
2021-03-30 14:01:39 +02:00
Jose M. Guisado 5abe862228 Add list images
ogServer exposes a list of known partition images at /images, use it to
implement 'list images' command.
2021-03-30 14:00:25 +02:00
Jose M. Guisado e81c38f098 Fix help messages
program name of subsequent parsers after the first one need their
"prog=" parameter specified so they do not show sys.argv[0] only.

With this patch, for example:

	ogcli list --help

Shows:

	usage: ogcli list [-h] {clients,scopes,modes,hardware,client}
	...

Instead of:

	usage: ogcli [-h] {clients,scopes,modes,hardware,client}
	...
2021-03-29 13:54:37 +02:00
Jose M. Guisado 0f55ce7341 Add WoL sending capability
Builds a json payload to consume the ogServer API to send
WoL packets.

Adds 'send' as a command:

	ogcli send

Adds a wol object for to the 'send' command, so that sending a wol can
be specified as:

	ogcli send wol

* WoL packet type is specified with --type option.
* Specifying targets follows same parameters as 'set modes' with:
	--client-ip
	--room-id
	--center-id
2021-03-29 13:47:28 +02:00
Roberto Hueso Gómez 513308fe81 Add ogcli list client command
This requests GET /client/properties by calling something like:
ogcli list client --id=6

It is important to notice that 'id' must be a "computer" type
scope id.
2020-07-14 11:21:16 +02:00
Roberto Hueso Gómez f4e1bb767b Add ogcli list hardware command
This requests GET /hardware by calling something like:
ogcli list hardware --scope-id=6

It is important to notice that 'scope-id' must be a "computer" type scope id.
2020-07-08 13:38:50 +02:00
Roberto Hueso Gómez e3d30d23ff Add payload option on GET requests
Instead of using query strings we use a json body for GET HTTP requests. This is
allowed under RFCs 7230-7237.

https://stackoverflow.com/questions/978061/http-get-with-request-body
2020-07-08 11:43:49 +02:00
Roberto Hueso Gómez 8961937329 Add ogcli set mode command
This requests POST /modes and changes a scope mode by calling something like:
ogcli set modes --scope-id=1 --scope-type=computer --mode=pxe
2020-07-06 13:32:02 +02:00
Roberto Hueso Gómez 4dddd359e7 Add post() to OgREST
This is a wrapper that provides HTTP POST requests.
2020-07-03 14:25:22 +02:00
OpenGnSys Support Team 14b7729a71 add license header to source code files 2020-07-01 12:34:46 +02:00
Roberto Hueso Gómez dbf0f00650 Rename files to remove 'og' prefix
This prefix is redundant on almost every file, so the prefix is removed from
filenames and imports.
2020-06-30 12:51:51 +02:00