{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://catalog.lintel.tools/schemas/schemastore/ifstate-yaml/versions/0.6.json",
  "title": "ifstate.conf",
  "description": "IfState Configuration Schema",
  "x-lintel": {
    "source": "https://ifstate.net/schema/0.6/ifstate.conf.schema.json",
    "sourceSha256": "fa65676f2a0a5cd154be981538390e7a2159823594e69b814e0cbdf3420797ce",
    "fileMatch": [
      "ifstate.yaml",
      "**/ifstate/config.yml"
    ],
    "parsers": [
      "yaml"
    ]
  },
  "type": "object",
  "properties": {
    "options": {
      "description": "global configuration settings",
      "type": "object"
    },
    "ignore": {
      "description": "ignore patterns to skip interface, ip address or routing objects",
      "type": "object",
      "properties": {
        "ipaddr": {
          "description": "list of ip address prefixes to be ignored",
          "type": "array",
          "items": {
            "description": "ip address with prefix length",
            "type": "string",
            "examples": [
              "fe80::/10"
            ]
          }
        },
        "ifname": {
          "description": "interface names matching this list of regex will be ignored",
          "type": "array",
          "items": {
            "description": "regex to match interface name",
            "examples": [
              "^docker\\d+",
              "^lo$",
              "^ppp\\d+$",
              "^veth"
            ],
            "type": "string"
          }
        },
        "routes": {
          "description": "filter routes by options",
          "type": "object",
          "properties": {
            "protos": {
              "type": "array",
              "items": {
                "description": "protocol number (`/etc/iproute2/rt_protos`)",
                "type": "integer"
              }
            }
          }
        }
      }
    },
    "interfaces": {
      "description": "list of interface settings (link settings and ip addresses)",
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "name"
        ],
        "properties": {
          "name": {
            "description": "name of the interface",
            "type": "string"
          },
          "addresses": {
            "description": "ip addresses of the interface",
            "type": "array",
            "items": {
              "type": "string",
              "examples": [
                "192.0.2.1",
                "192.168.0.1/24",
                "2001:db8::1/64"
              ]
            }
          },
          "link": {
            "description": "link settings of the interface",
            "type": "object",
            "oneOf": [
              {
                "description": "generic interface",
                "required": [
                  "kind"
                ],
                "properties": {
                  "kind": {
                    "type": "string",
                    "description": "link type",
                    "enum": [
                      "bond",
                      "bridge",
                      "gtp",
                      "ip6tnl",
                      "ipoib",
                      "ipvlan",
                      "macvlan",
                      "macvtap",
                      "physical",
                      "team",
                      "tuntap",
                      "veth",
                      "vrf",
                      "vti",
                      "vti6"
                    ]
                  },
                  "master": {
                    "$ref": "#/$defs/iface-link_master"
                  },
                  "state": {
                    "$ref": "#/$defs/iface-link_state"
                  }
                },
                "type": "object"
              },
              {
                "description": "VLAN interface",
                "required": [
                  "kind",
                  "link",
                  "vlan_id"
                ],
                "properties": {
                  "kind": {
                    "type": "string",
                    "description": "link type",
                    "enum": [
                      "vlan"
                    ]
                  },
                  "state": {
                    "$ref": "#/$defs/iface-link_state"
                  },
                  "master": {
                    "$ref": "#/$defs/iface-link_master"
                  },
                  "link": {
                    "$ref": "#/$defs/iface-link_link"
                  },
                  "vlan_id": {
                    "type": [
                      "integer"
                    ],
                    "minimum": 0,
                    "maximum": 4094,
                    "description": "specifies the VLAN identifier to use"
                  }
                },
                "type": "object"
              },
              {
                "description": "VXLAN interface",
                "required": [
                  "kind",
                  "vxlan_id",
                  "vxlan_link"
                ],
                "properties": {
                  "kind": {
                    "type": "string",
                    "description": "link type",
                    "enum": [
                      "vxlan"
                    ]
                  },
                  "state": {
                    "$ref": "#/$defs/iface-link_state"
                  },
                  "master": {
                    "$ref": "#/$defs/iface-link_master"
                  },
                  "vxlan_id": {
                    "type": [
                      "integer"
                    ],
                    "minimum": 0,
                    "maximum": 16777215,
                    "description": "specifies the VNI"
                  },
                  "vxlan_link": {
                    "$ref": "#/$defs/iface-link_tun-dev"
                  }
                },
                "type": "object"
              },
              {
                "description": "IPIP interface",
                "required": [
                  "kind",
                  "ipip_remote",
                  "ipip_local"
                ],
                "properties": {
                  "kind": {
                    "type": "string",
                    "description": "link type",
                    "enum": [
                      "ipip"
                    ]
                  },
                  "state": {
                    "$ref": "#/$defs/iface-link_state"
                  },
                  "master": {
                    "$ref": "#/$defs/iface-link_master"
                  },
                  "ipip_remote": {
                    "$ref": "#/$defs/iface-link_tun-remote4"
                  },
                  "ipip_local": {
                    "$ref": "#/$defs/iface-link_tun-local4"
                  }
                },
                "type": "object"
              },
              {
                "description": "SIT interface",
                "required": [
                  "kind",
                  "sit_remote",
                  "sit_local"
                ],
                "properties": {
                  "kind": {
                    "type": "string",
                    "description": "link type",
                    "enum": [
                      "sit"
                    ]
                  },
                  "state": {
                    "$ref": "#/$defs/iface-link_state"
                  },
                  "master": {
                    "$ref": "#/$defs/iface-link_master"
                  },
                  "sit_remote": {
                    "$ref": "#/$defs/iface-link_tun-remote4"
                  },
                  "sit_local": {
                    "$ref": "#/$defs/iface-link_tun-local4"
                  }
                },
                "type": "object"
              },
              {
                "description": "GRE, GRETAP interface",
                "required": [
                  "kind",
                  "gre_remote",
                  "gre_local"
                ],
                "properties": {
                  "kind": {
                    "type": "string",
                    "description": "link type",
                    "enum": [
                      "gre",
                      "gretap"
                    ]
                  },
                  "state": {
                    "$ref": "#/$defs/iface-link_state"
                  },
                  "master": {
                    "$ref": "#/$defs/iface-link_master"
                  },
                  "gre_remote": {
                    "$ref": "#/$defs/iface-link_tun-remote4"
                  },
                  "gre_local": {
                    "$ref": "#/$defs/iface-link_tun-local4"
                  },
                  "gre_link": {
                    "$ref": "#/$defs/iface-link_tun-dev"
                  }
                },
                "type": "object"
              },
              {
                "description": "IP6GRE, IP6GRETAP interface",
                "required": [
                  "kind",
                  "ip6gre_remote",
                  "ip6gre_local"
                ],
                "properties": {
                  "kind": {
                    "type": "string",
                    "description": "link type",
                    "enum": [
                      "ip6gre",
                      "ip6gretap"
                    ]
                  },
                  "state": {
                    "$ref": "#/$defs/iface-link_state"
                  },
                  "master": {
                    "$ref": "#/$defs/iface-link_master"
                  },
                  "ip6gre_remote": {
                    "$ref": "#/$defs/iface-link_tun-remote4"
                  },
                  "ip6gre_local": {
                    "$ref": "#/$defs/iface-link_tun-local4"
                  },
                  "ip6gre_link": {
                    "$ref": "#/$defs/iface-link_tun-dev"
                  }
                },
                "type": "object"
              },
              {
                "description": "GENEVE interface",
                "required": [
                  "kind",
                  "geneve_id"
                ],
                "properties": {
                  "kind": {
                    "type": "string",
                    "description": "link type",
                    "enum": [
                      "geneve"
                    ]
                  },
                  "state": {
                    "$ref": "#/$defs/iface-link_state"
                  },
                  "master": {
                    "$ref": "#/$defs/iface-link_master"
                  },
                  "geneve_id": {
                    "type": [
                      "integer"
                    ],
                    "minimum": 0,
                    "maximum": 16777215,
                    "description": "specifies the VNI to use"
                  }
                },
                "oneOf": [
                  {
                    "description": "tunnel over IPv4",
                    "required": [
                      "geneve_remote"
                    ],
                    "properties": {
                      "geneve_remote": {
                        "$ref": "#/$defs/iface-link_tun-remote4"
                      }
                    },
                    "type": "object"
                  },
                  {
                    "description": "tunnel over IPv6",
                    "required": [
                      "geneve_remote6"
                    ],
                    "properties": {
                      "geneve_remote6": {
                        "$ref": "#/$defs/iface-link_tun-remote6"
                      }
                    },
                    "type": "object"
                  }
                ],
                "type": "object"
              },
              {
                "description": "XFRM interface",
                "required": [
                  "kind",
                  "xfrm_link"
                ],
                "properties": {
                  "kind": {
                    "type": "string",
                    "description": "link type",
                    "enum": [
                      "xfrm"
                    ]
                  },
                  "state": {
                    "$ref": "#/$defs/iface-link_state"
                  },
                  "master": {
                    "$ref": "#/$defs/iface-link_master"
                  },
                  "xfrm_link": {
                    "$ref": "#/$defs/iface-link_tun-dev",
                    "description": "underlying interface used to send and receive the transformed traffic"
                  },
                  "xfrm_if_id": {
                    "type": [
                      "integer"
                    ],
                    "minimum": 0,
                    "maximum": 4294967295,
                    "default": 0,
                    "description": "lookup key to match xfrm policies"
                  }
                },
                "type": "object"
              }
            ]
          }
        }
      }
    },
    "routing": {
      "type": "object",
      "properties": {
        "routes": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "to"
            ],
            "properties": {
              "dev": {
                "type": [
                  "integer",
                  "string"
                ]
              },
              "proto": {
                "type": [
                  "integer",
                  "string"
                ],
                "default": "boot"
              },
              "realm": {
                "type": [
                  "integer",
                  "string"
                ]
              },
              "scope": {
                "type": [
                  "integer",
                  "string"
                ]
              },
              "table": {
                "type": [
                  "integer",
                  "string"
                ],
                "default": "main"
              },
              "to": {
                "type": "string"
              },
              "via": {
                "type": "string"
              }
            }
          }
        }
      }
    }
  },
  "$defs": {
    "iface-link_link": {
      "type": [
        "integer",
        "string"
      ],
      "description": "specifies a parent device name or index"
    },
    "iface-link_master": {
      "type": [
        "integer",
        "string"
      ],
      "description": "specifies a master device name or index"
    },
    "iface-link_state": {
      "type": "string",
      "description": "set device state",
      "enum": [
        "up",
        "down"
      ]
    },
    "iface-link_tun-remote4": {
      "type": "string",
      "description": "remote IPv4 address of the tunnel",
      "format": "ipv4"
    },
    "iface-link_tun-local4": {
      "type": "string",
      "description": "local IPv4 address of the tunnel",
      "format": "ipv4"
    },
    "iface-link_tun-remote6": {
      "type": "string",
      "description": "remote IPv4 address of the tunnel",
      "format": "ipv6"
    },
    "iface-link_tun-local6": {
      "type": "string",
      "description": "local IPv4 address of the tunnel",
      "format": "ipv6"
    },
    "iface-link_tun-dev": {
      "$ref": "#/$defs/iface-link_link",
      "description": "interface to use for tunnel endpoint communication"
    }
  }
}
