BGP Community Data Type

A bgp_community data type tests data for being an instance of python's built-in class str or int and if it represents a BGP standard community (4 bytes).

Features/Limitations

  • Validate BGP Community format
  • Supports BGP Community format conversion
  • Validate BGP Community specific attributes
  • Validate against allowed and not allowed BGP Communities
  • Supports Referencing Feature

BGP Community Definition Syntax

Table

Key/Option Type Default Value Restrictions Description
type str 'bgp_community'
description str Data type description
default_value Must match data type's type(s) Value used to set as default value
allowed_ranges list[dict] min length: 1 Value must be within defined ranges
  - start int|str required
    end int|str required
not_allowed_ranges list[dict] Value mustn't be within defined ranges
  - start int|str required
    end int|str required
allowed_values list Data must match one of these values
  - < value > int|str Must match data type's type(s)
not_allowed_values list Data mustn't match all of these values
  - < value > int|str Must match data type's type(s)
format enum allowed_values:
  - integer
  - new-format
  - hex
- integer example: 70116
- new-format example: 1.4580
- hex example: '0x111E4'
public bool BGP Community's source AS must be a public (true) or a private (false) AS number
well_known bool BGP Community must (true) or must not (false) be well-known
convert_to_format enum allowed_values:
  - integer
  - new-format
  - hex
template str must be definded in schema Merge options from this template
template_merge_options dict Define schema-global template merge instructions
    recursive bool True Merge data type definition options in template options recursively.
If false, data type defintion options overwrites template options.
    list_merge str append_rp Allowed values:
- append
- append_rp
- prepend
- prepend_rp
- replace
How lists within options data should be merged.
reference dict|str
  option 1 str Reference keys (implies unique global mode)
  option 2 dict
  key str required
  mode str Allowed values:
- unique
- producer
- consumer
  unique_scope str Allowed values:
- global
- namespace
  producer_scope str Allowed values:
- global
- namespace
  consumer_scope str Allowed values:
- global
- namespace
  allow_orphan_producer bool True
  credit int 1 (if mode consumer) min: 0
references list[dict|str]
  - dict|str
    option 1 str Reference keys (implies unique global mode)
    option 2 dict
    key str required
    mode str Allowed values:
- unique
- producer
- consumer
    unique_scope str Allowed values:
- global
- namespace
    producer_scope str Allowed values:
- global
- namespace
    consumer_scope str Allowed values:
- global
- namespace
    allow_orphan_producer bool True
    credit int 1 (if mode consumer) min: 0
doc_value_name str Set value name for documentation

YAML

type: bgp_community
description: <str>
default_value: <default_value>

allowed_ranges:
 - start: <int|str>
   end: <int|str>
not_allowed_ranges:
 - start: <int|str>
   end: <int|str>
allowed_values:
  - <int|str>
not_allowed_values:
  - <int|str>
format: <integer|new-format|hex>
public: <true|false>
well_known: <true|false>
convert_to_format: <integer|new-format|hex>

template: <str>
template_merge_options:
  recursive: <true|false>
  list_merge: <append|append_rp|prepend|prepend_rp|replace>

reference: <reference_definition>
  # Multitype!!!
  <str>
  # or:
  key: <str>
  mode: <unique|producer|consumer>
  unique_scope: <global|namespace>
  producer_scope: <global|namespace>
  consumer_scope: <global|namespace>
  allow_orphan_producer: <true|false>
  credits: <int>
references:
  - <reference_definition>
    # Multitype!!!
    <str>
    # or
    key: <str>
    mode: <unique|producer|consumer>
    unique_scope: <global|namespace>
    producer_scope: <global|namespace>
    consumer_scope: <global|namespace>
    allow_orphan_producer: <true|false>
    credits: <int>

doc_value_name: <str>

Example

type: bgp_community
description: "Example bgp_community definition"
default_value: GRACEFUL_SHUTDOWN

format: colon-separated
well_known: false
public: false
convert_to_format: integer

not_allowed_values:
  - NO_EXPORT
  - 7001
  - 0:7002
  - 0xA0001

not_allowed_ranges:
  - start: 65498:0
    end: 65498:65535

reference: ref_key