From: Marcin Siodelski Date: Wed, 15 May 2019 14:11:12 +0000 (+0200) Subject: [#71,!314] Documented commands for IPv4 subnets. X-Git-Tag: Kea-1.6.0-beta~60 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=225b8abdd73451eede353bebab42c62ea1e85c1e;p=thirdparty%2Fkea.git [#71,!314] Documented commands for IPv4 subnets. --- diff --git a/doc/guide/hooks-cb-cmds.xml b/doc/guide/hooks-cb-cmds.xml index fad5c5cd04..a2337d9bb8 100644 --- a/doc/guide/hooks-cb-cmds.xml +++ b/doc/guide/hooks-cb-cmds.xml @@ -561,12 +561,190 @@ } ] } - } +
+ remote-subnet4-del-by-id + This is the first variant of the command used to delete an IPv4 subnet + from the database. It uses subnet ID to identify the subnet. + For example, in order to delete the subnet with ID of 5: + +{ + "command": "remote-subnet4-del-by-id", + "arguments": { + "subnets": [ { + "id": 5 + } ], + "remote": { + "type": "mysql" + } + } +} + + +
+ +
+ remote-subnet4-del-by-prefix + This is the second variant of the command used to delete an IPv4 subnet + from the database. It uses the subnet prefix to identify the subnet. + For example: + +{ + "command": "remote-subnet4-del-by-prefix", + "arguments": { + "subnets": [ { + "subnet": "192.0.2.0/24" + } ], + "remote": { + "type": "mysql" + } + } +} + + +
+ +
+ remote-subnet4-get-by-id + This command is used to fetch a subnet with the specified ID from the + database. For example: + +{ + "command": "remote-subnet4-get-by-id", + "arguments": { + "subnets": [ + { + "id": 5 + } + ], + "remote": { + "type": "mysql" + } + } +} + + +
+ +
+ remote-subnet4-get-by-prefix + This command is used to fetch a subnet with the specified prefix from + the database. For example: + +{ + "command": "remote-subnet4-get-by-prefix", + "arguments": { + "subnets": [ + { + "subnet": "192.0.2.0/24" + } + ], + "remote": { + "type": "mysql" + } + } +} + + +
+ +
+ remote-subnet4-list + This command is used to list all IPv4 subnets from the database. + It takes no parameters except the optional remote map. + The returned information about each subnet is limited to subnet identifier, + prefix and associated shared network name. In order to retrieve full + information about the selected subnet use the + remote-subnet4-get-by-id or + remote-subnet4-get-by-prefix. + +
+ +
+ remote-subnet4-set + This command is used to create a new subnet or replace an existing + subnet in the database. Setting the subnet also associates or disassociates + the subnet with/from a shared network. + + The structure of the subnet information is similar to the structure + used in the configuration file (see ). + The subnet information conveyed in the remote-subnet4-set + must include additional parameter shared-network-name + which indicates whether the subnet belongs to a shared network or not. + + + Consider the following example: + +{ + "command": "remote-subnet4-set", + "arguments": { + "subnets": [ { + "id": 5, + "subnet": "192.0.2.0/24", + "shared-network-name": "level3", + "pools": [ { "pool": "192.0.2.100-192.0.2.200" } ], + "option-data": [ { + "name": "routers", + "data": "192.0.2.1" + } ] + } ], + "remote": { + "type": "mysql" + } + } +} + + + + It creates the subnet and associates the subnet with the "level3" + shared network. The "level3" must be created with the + remote-network4-set prior to creating the subnet. + + + If the created subnet must be global (not associated with any + shared network), the shared-network-name must be + explicitly set to null: + +{ + "command": "remote-subnet4-set", + "arguments": { + "subnets": [ { + "id": 5, + "subnet": "192.0.2.0/24", + "shared-network-name": null, + "pools": [ { "pool": "192.0.2.100-192.0.2.200" } ], + "option-data": [ { + "name": "routers", + "data": "192.0.2.1" + } ] + } ] + } +} + + + + The subnet created in the previous example is replaced with the + new subnet having the same parameters but becomes global. + + The shared-network-name parameter is mandatory + for the remote-subnet4-set command. + + + + Same as for other "set" commands, this command replaces the entire + information about the particular subnet in the database, if the subnet + information is already present. Therefore, when sending this command, + make sure to always include all parameters that must be specified for + the updated subnet instance. Any unspecified parameter will be marked + as unspecified in the database, even if its value was present prior to + sending the command. + + +