---
id: query-settings
title: Query Settings
sidebar_label: Query Settings
keywords: [hyperglass, queries]
description: hyperglass query types
---

import Code from "../src/components/JSXCode";
import MiniNote from "../src/components/MiniNote";
import RP from "../src/components/RegexPattern";

<div class="table--full-width" />

Each query type may be disabled, enabled, or customized. The `display_name` parameter defines how the query type will be displayed in the UI's Query Type select element.

## `bgp_route`

| Parameter      |  Type   | Default       | Description                                            |
| :------------- | :-----: | :------------ | :----------------------------------------------------- |
| `enable`       | Boolean | `true`        | Enable or disable the BGP Route query type.            |
| `display_name` | String  | `'BGP Route'` | Text displayed for the BGP Route query type in the UI. |

#### Example

<!-- prettier-ignore -->
```yaml title="hyperglass.yaml"
queries:
  bgp_route:
    display_name: BGP Route
    enable: true
```

## `bgp_community`

| Parameter      |  Type   | Default           | Description                                                                                                                                                                     |
| :------------- | :-----: | :---------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `enable`       | Boolean | `true`            | Enable or disable the BGP Community query type.                                                                                                                                 |
| `display_name` | String  | `'BGP Community'` | Text displayed for the BGP Community query type in the UI.                                                                                                                      |
| `mode`         | String  | `'input'`         | `input` mode requires the user to type the community value in the target element. `select` mode allows the user to select a community from a preconfigured list of communities. |
| `communities`  |         |                   | [BGP Community Definitions](#community-definitions) for `select` mode.                                                                                                          |
| `pattern`      |         |                   | [BGP Community Regular Expression Patterns](#community-patterns) for `input` mode.                                                                                              |

### Community Definitions

If using `select` mode, you may define a list of communities the users can choose from. Each community definition uses the following schema:

| Parameter      |  Type  | Description            | Example                  |
| :------------- | :----: | :--------------------- | :----------------------- |
| `community`    | String | Community value        | `'64496:1001'`           |
| `display_name` | String | Community display name | `'64496:1001'`           |
| `description`  | String | Community description  | `'North America Routes'` |

#### Example

```yaml title="hyperglass.yaml"
queries:
  bgp_community:
    enable: true
    mode: select
    communities:
      - community: 64496:1001
        display_name: 64496:1001
        description: North America Routes
      - community: 64496:1002
        display_name: 64496:1002
        description: Europe Routes
```

### Community Patterns

If using `input` mode, hyperglass allows you to override the default regular expression patterns used to validate UI and API queries. hyperglass supports [Decimal (well known)](https://tools.ietf.org/html/rfc1997) communities, [Extended AS](https://tools.ietf.org/html/rfc4360) communities, and [Large](https://tools.ietf.org/html/rfc8092) communities.

| Parameter     |  Type  | Default                            | Description                                                                                                                    |
| :------------ | :----: | :--------------------------------- | :----------------------------------------------------------------------------------------------------------------------------- |
| `decimal`     | String | <RP pattern="community_decimal"/>  | Regular expression pattern for validating decimal type BGP Community strings.                                                  |
| `extended_as` | String | <RP pattern="community_extended"/> | Regular expression pattern for validating extended AS type BGP Community strings, e.g. `65000:1`                               |
| `large`       | String | <RP pattern="community_large"/>    | Regular expression pattern for validating [large community](http://largebgpcommunities.net/) strings, e.g. `65000:65001:65002` |

#### Example

<!-- prettier-ignore -->
```yaml title="hyperglass.yaml"
queries:
  bgp_community:
    enable: true
    mode: input
    pattern:
      decimal: '^[0-9]{1,10}$'
      extended_as: '^([0-9]{0,5})\:([0-9]{1,5})$'
      large: '^([0-9]{1,10})\:([0-9]{1,10})\:[0-9]{1,10}$'
```

:::caution
Regular expression patterns must be enclosed in single quotes, e.g. `'^.*$'`
:::

## `bgp_aspath`

| Parameter      |  Type   | Default         | Description                                                             |
| :------------- | :-----: | :-------------- | :---------------------------------------------------------------------- |
| `enable`       | Boolean | `true`          | Enable or disable the BGP AS Path query type.                           |
| `display_name` | String  | `'BGP AS Path'` | Text displayed for the BGP AS Path query type in the UI.                |
| `pattern`      |         |                 | [BGP AS Path Settings & Regular Expression Patterns](#as-path-patterns) |

#### Example

<!-- prettier-ignore -->
```yaml title="hyperglass.yaml"
queries:
  bgp_aspath:
    display_name: BGP AS Path
    enable: true
    pattern:
      asdot: '^(\^|^\_)((\d+\.\d+)\_|(\d+\.\d+)\$|(\d+\.\d+)\(\_\.\+\_\))+$'
      asplain: '^(\^|^\_)(\d+\_|\d+\$|\d+\(\_\.\+\_\))+$'
      mode: asplain
```

### AS Path Patterns

AS Path regular expression patterns may also be customized, should you wish to more granularly control what your network considers a valid AS Path pattern. hyperglass makes two "modes" available for validation - [**`asplain`** and **`asdot`**](https://tools.ietf.org/html/rfc5396).

| Parameter |  Type  | Default                        | Description                                                                                                                                                       |
| :-------- | :----: | :----------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `mode`    | String | `'asplain'`                    | Set ASN display mode. This field is dependent on how your network devices are configured. <MiniNote>Must be <Code>asplain</Code> or <Code>asdot</Code></MiniNote> |
| `asplain` | String | <RP pattern="aspath_asplain"/> | Regular expression pattern for validating **asplain** type BGP AS Path queries.                                                                                   |
| `asdot`   | String | <RP pattern="aspath_asdot"/>   | Regular expression pattern for validating **asdot** type BGP AS Path queries.                                                                                     |

## `ping`

| Parameter      |  Type   | Default  | Description                                       |
| :------------- | :-----: | :------- | :------------------------------------------------ |
| `enable`       | Boolean | `true`   | Enable or disable the Ping query type.            |
| `display_name` | String  | `'Ping'` | Text displayed for the Ping query type in the UI. |

#### Example

<!-- prettier-ignore -->
```yaml title="hyperglass.yaml"
queries:
  ping:
    display_name: Ping
    enable: true
```

## `traceroute`

| Parameter      |  Type   | Default        | Description                                             |
| :------------- | :-----: | :------------- | :------------------------------------------------------ |
| `enable`       | Boolean | `true`         | Enable or disable the Traceroute query type.            |
| `display_name` | String  | `'Traceroute'` | Text displayed for the Traceroute query type in the UI. |

#### Example

<!-- prettier-ignore -->
```yaml title="hyperglass.yaml"
queries:
  traceroute:
    display_name: Traceroute
    enable: true
```
