create_fixed_address
Reserve a specific IP address for a device by binding it to a MAC address in Infoblox DHCP. This ensures consistent network connectivity and simplifies device management.
Instructions
Create a DHCP fixed address (reservation) in Infoblox
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ipv4addr | Yes | IPv4 address to reserve | |
| mac | Yes | MAC address of the client (e.g., 00:11:22:33:44:55) | |
| name | No | Name for the fixed address | |
| comment | No | Description | |
| network_view | No | Network view | |
| match_client | No | Client matching method | MAC_ADDRESS |
| options | No | DHCP options |
Implementation Reference
- src/tools/dhcp.ts:121-149 (handler)The handler function for 'create_fixed_address' tool. It builds the data object from input parameters and calls client.create('fixedaddress', data) to create a DHCP fixed address reservation in Infoblox. Returns success message with reference or error message.
async ({ ipv4addr, mac, name, comment, network_view, match_client, options, }) => { const data: Record<string, unknown> = { ipv4addr, mac }; if (name) data.name = name; if (comment) data.comment = comment; if (network_view) data.network_view = network_view; if (match_client) data.match_client = match_client; if (options) data.options = options; try { const ref = await client.create("fixedaddress", data); return toolResult( `Fixed address created successfully.\nReference: ${ref}`, ); } catch (error) { return toolResult( `Error creating fixed address: ${error}`, true, ); } }, ); - src/tools/dhcp.ts:79-120 (schema)Zod schema definition for 'create_fixed_address' tool inputs. Defines validation for ipv4addr (required), mac (required), name, comment, network_view, match_client (enum with default), and options (array of DHCP option objects).
{ ipv4addr: z.string().describe("IPv4 address to reserve"), mac: z .string() .describe( "MAC address of the client (e.g., 00:11:22:33:44:55)", ), name: z .string() .optional() .describe("Name for the fixed address"), comment: z .string() .optional() .describe("Description"), network_view: z .string() .optional() .describe("Network view"), match_client: z .enum([ "MAC_ADDRESS", "CLIENT_ID", "CIRCUIT_ID", "REMOTE_ID", ]) .optional() .default("MAC_ADDRESS") .describe("Client matching method"), options: z .array( z.object({ name: z.string().describe("Option name"), num: z.number().describe("Option number"), use_option: z.boolean().default(true), value: z.string().describe("Option value"), vendor_class: z.string().default("DHCP"), }), ) .optional() .describe("DHCP options"), }, - src/tools/dhcp.ts:76-149 (registration)Registration of 'create_fixed_address' tool using server.tool(). Includes tool name, description, input schema, and handler function. Part of the registerDhcpTools function that registers all DHCP-related tools.
server.tool( "create_fixed_address", "Create a DHCP fixed address (reservation) in Infoblox", { ipv4addr: z.string().describe("IPv4 address to reserve"), mac: z .string() .describe( "MAC address of the client (e.g., 00:11:22:33:44:55)", ), name: z .string() .optional() .describe("Name for the fixed address"), comment: z .string() .optional() .describe("Description"), network_view: z .string() .optional() .describe("Network view"), match_client: z .enum([ "MAC_ADDRESS", "CLIENT_ID", "CIRCUIT_ID", "REMOTE_ID", ]) .optional() .default("MAC_ADDRESS") .describe("Client matching method"), options: z .array( z.object({ name: z.string().describe("Option name"), num: z.number().describe("Option number"), use_option: z.boolean().default(true), value: z.string().describe("Option value"), vendor_class: z.string().default("DHCP"), }), ) .optional() .describe("DHCP options"), }, async ({ ipv4addr, mac, name, comment, network_view, match_client, options, }) => { const data: Record<string, unknown> = { ipv4addr, mac }; if (name) data.name = name; if (comment) data.comment = comment; if (network_view) data.network_view = network_view; if (match_client) data.match_client = match_client; if (options) data.options = options; try { const ref = await client.create("fixedaddress", data); return toolResult( `Fixed address created successfully.\nReference: ${ref}`, ); } catch (error) { return toolResult( `Error creating fixed address: ${error}`, true, ); } }, ); - src/infoblox-client.ts:79-84 (helper)InfobloxClient.create() method used by the handler to make the actual API call. Sends a POST request to create the fixed address object in Infoblox and returns the reference string.
async create( objectType: string, data: Record<string, unknown>, ): Promise<string> { return this.request("POST", objectType, data) as Promise<string>; } - src/index.ts:44-44 (registration)Main entry point calls registerDhcpTools(server, client) to register all DHCP tools including 'create_fixed_address'.
registerDhcpTools(server, client);