blob: a0d45528d356083dc8d9cb71b01341b1ea2484ab [file] [log] [blame]
{
"type": "object",
"$schema": "http://json-schema.org/draft-04/schema#",
"$id": "https://fuchsia.dev/network_manager",
"title": "Network Manager Device Schema for configuration data.",
"definitions": {
"admin_states": {
"type": "string",
"enum": [
"UP",
"DOWN",
"TESTING"
],
"default": "UP"
},
"oper_states": {
"type": "string",
"enum": [
"UP",
"DOWN",
"UNKNOWN",
"TESTING",
"NOT_PRESENT",
"LOWER_LAYER_DOWN"
],
"default": "UP"
},
"interface_types": {
"type": "string",
"enum": [
"IF_ETHERNET",
"IF_AGGREGATE",
"IF_LOOPBACK",
"IF_ROUTED_VLAN",
"IF_SONET",
"IF_TUNNEL_GRE4",
"IF_TUNNEL_GRE6",
"IF_UPLINK"
]
},
"dhcp_client": {
"type": "boolean",
"title": "Enables a DHCP client on the interface in order to request an address",
"default": true
},
"dhcp_server": {
"type": "object",
"additionalProperties": false,
"properties": {
"enabled": {
"default": false,
"description": "Is the DHCP server enabled?",
"type": "boolean"
},
"dhcp_pool": {
"additionalProperties": false,
"description": "Configure the DHCP server address pool",
"type": "object",
"properties": {
"start": {
"type": "string",
"description": "The first IP address of the pool",
"examples": [
"192.168.0.10"
]
},
"end": {
"type": "string",
"description": "The last IP address of the pool",
"examples": [
"192.168.0.254"
]
},
"lease_time": {
"type": "string",
"description": "The time in seconds after which leases will be renewed. Can also be defined in minutes ('m'), hours ('h'), or days ('d').",
"examples": [
"1440",
"24m",
"12h",
"1d"
]
}
}
},
"static_ip_allocations": {
"type": "array",
"additionalItems": false,
"required": [ "name", "mac-address", "ip" ],
"items": {
"device_name": {
"type": "string",
"description": "A human-readable device name.",
"examples": [
"My Web Server"
]
},
"mac_address": {
"type": "string",
"description": "The MAC address of this host.",
"examples": [
"00:1f:3c:e3:c9:73"
]
},
"ip_address": {
"type": "string",
"description": "An IP to statically assign to this host.",
"examples": [
"192.168.1.2"
]
}
}
}
}
},
"ip": {
"type": "string",
"title": "An IP address.",
"examples": [
"169.254.0.1", "fe80::a928:1677:47d9:88ab"
]
},
"prefix_length": {
"type": "integer",
"title": "An CIDR prefix-length.",
"examples": [
"32", "128"
]
},
"cidr_address": {
"type": "object",
"additionalProperties": false,
"required": [ "ip", "prefix_length" ],
"properties": {
"ip": {
"$ref": "#/definitions/ip"
},
"prefix_length": {
"$ref": "#/definitions/prefix_length"
}
}
},
"ip_address_config": {
"type": "object",
"description": "The IP configuration for this interface.",
"additionalProperties": false,
"required": [
"addresses"
],
"properties": {
"addresses": {
"type": "array",
"description": "Describes the IP address configuration.",
"additionalItems": false,
"items": {
"dhcp_client": {
"$ref": "#/definitions/dhcp_client"
},
"cidr_address": {
"$ref": "#/definitions/cidr_address"
},
"dhcp_server": {
"$ref": "#/definitions/dhcp_server"
}
}
}
}
},
"vlan_id": {
"type": "integer",
"title": "Describes a VLAN ID.",
"minimum": 0,
"maximum": 4096,
"example": [
101
],
"default": 0
},
"port_speed": {
"type": "string",
"description": "When auto-negotiate is true, this optionally sets the port-speed that will be advertised to the peer for negotiation. If unspecified, it is expected that the interface will select the highest speed available based on negotiation. When auto-negotiate is set to false, sets the link speed to a fixed value.",
"enum": [
"SPEED_10MB",
"SPEED_100MB",
"SPEED_1GB",
"SPEED_2500MB",
"SPEED_5GB",
"SPEED_10GB",
"SPEED_25GB",
"SPEED_40GB",
"SPEED_50GB",
"SPEED_100GB",
"SPEED_UNKNOWN"
],
"default": "SPEED_UNKNOWN"
}
},
"required": [
"device"
],
"additionalProperties": false,
"maxProperties": 1,
"properties": {
"device": {
"$id": "/properties/device",
"type": "object",
"description": "Describes the configuration for a single device.",
"properties": {
"interfaces": {
"description": "Describes all interfaces on this device.",
"type": "array",
"items": {
"required": [ "interface" ],
"interface": {
"type": "object",
"required": [ "device_id" ],
"properties": {
"config": {
"type": "object",
"properties": {
"name": {
"type": "string",
"title": "Configures the name of this interface.",
"examples": [
"eth0", "wan"
]
},
"type": {
"$ref": "#/definitions/interface_types"
}
}
},
"device_id": {
"type": "string",
"description": "The topological name of the physical device."
},
"oper_state": {
"$ref": "#/definitions/oper_states"
},
"subinterfaces": {
"type": "array",
"required": [ "subinterface" ],
"items": {
"subinterface": {
"type": "object",
"description": "Subinterface describes a Logical Interface (LIF)",
"properties": {
"admin_state": {
"description": "The administrative state of this subinterface",
"$ref": "#/definitions/admin_states"
},
"ipv4": {
"description": "The IPv4 configuration of this subinterface",
"$ref": "#/definitions/ip_address_config"
},
"ipv6": {
"description": "The IPv6 configuration of this subinterface",
"$ref": "#/definitions/ip_address_config"
}
}
}
}
},
"switched_vlan": {
"type": "object",
"required": [ "interface_mode" ],
"properties": {
"interface_mode": {
"type": "string",
"enum": [ "ACCESS", "TRUNK" ]
},
"access_vlan": {
"$ref": "#/definitions/vlan_id"
},
"trunk_vlans": {
"type": "array",
"items": {
"$ref": "#/definitions/vlan_id"
}
}
}
},
"ethernet": {
"type": "object",
"properties": {
"config": {
"properties": {
"auto_negotiate": {
"description": "Set to true to request the interface to auto-negotiate transmission parameters with its peer interface.",
"type": "boolean",
"default": true
},
"duplex_mode": {
"description": "When auto-negotiate is true, this optionally sets the duplex mode that will be advertised to the peer.",
"type": "string",
"enum": [ "FULL", "HALF" ]
},
"enable_flow_control": {
"type": "boolean",
"examples": [ false ]
},
"mac_address": {
"type": "string",
"examples": [
"de:ad:be:ef:ca:fe"
]
},
"mtu": {
"type": "integer"
},
"port_speed": {
"$ref": "#/definitions/port_speed"
}
}
}
},
"tcp_offload": {
"type": "boolean",
"default": false
}
},
"routed_vlan": {
"type": "object",
"required": [ "vlan_id" ],
"properties": {
"vlan_id": {
"$ref": "#/definitions/vlan_id"
},
"ipv4": {
"$ref": "#/definitions/ip_address_config"
},
"ipv6": {
"$ref": "#/definitions/ip_address_config"
}
}
}
}
}
}
},
"acls": {
"type": "object",
"description": "Configuration for packet filtering rules",
"additionalProperties": false,
"properties": {
"acl_entries": {
"type": "array",
"required": ["config"],
"items": {
"config": {
"required": ["forwarding_action"],
"properties": {
"comment": {
"type": "string",
"description": "An optional comment describing this rule."
},
"device_id": {
"type": "string",
"description": "The Device ID to install this rule on. If omitted, installs the rule on all ports."
},
"direction": {
"type": "string",
"description": "The direction of the connection.",
"enum": [
"IN",
"OUT",
"BOTH"
],
"default": "BOTH"
},
"forwarding_action": {
"type": "string",
"description": "Whether to accept or drop a matching connection.",
"enum": [
"ACCEPT",
"DROP"
]
}
},
"ipv4": {
"src_address": {
"type": "string",
"description": "Source IPv4 address including prefix-length",
"examples": [
"192.168.0.0/24"
]
},
"dst_address": {
"type": "string",
"description": "Destination IPv4 address including prefix-length",
"examples": [
"10.0.10.20/32"
]
},
"src_ports": {
"type": "string",
"title": "The source port to match.",
"description": "Port ranges are supported. Omit to match all source ports.",
"examples": [
"22,80,6667-6669"
]
},
"dst_ports": {
"type": "string",
"title": "The destination port to match.",
"description": "Port ranges are supported. Omit to match all destination ports.",
"examples": [
"22,80,6667-6669"
]
},
"protocol": {
"type": "string",
"description": "The IP protocol to match.",
"enum": [
"TCP",
"UDP",
"ICMP",
"ANY"
],
"default": "ANY"
}
},
"ipv6": {
"src_address": {
"type": "string",
"description": "Source IPv6 address including prefix-length",
"examples": [
"fe80::a928:1677:47d9:88ab/64"
]
},
"dst_address": {
"type": "string",
"description": "Destination IPv6 address including prefix-length",
"examples": [
"fe80::a928:1677:47d9:88ab/64"
]
},
"src_ports": {
"type": "string",
"title": "The source port to match.",
"description": "Port ranges are supported. Omit to match all source ports.",
"examples": [
"22,80,6667-6669"
]
},
"dst_ports": {
"type": "string",
"title": "The destination port to match.",
"description": "Port ranges are supported. Omit to match all destination ports.",
"examples": [
"22,80,6667-6669"
]
},
"protocol": {
"type": "string",
"description": "The IP protocol to match.",
"enum": [
"TCP",
"UDP",
"ICMP",
"ANY"
],
"default": "ANY"
}
}
}
}
}
}
},
"services": {
"type": "object",
"description": "Configuration for additional system services",
"additionalProperties": false,
"properties": {
"ip_forwarding": {
"description": "Enables IP forwarding",
"type": "boolean",
"default": false
},
"nat": {
"description": "Enables NAT",
"type": "boolean",
"default": false
}
}
}
}
}
}
}