Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

network
automation
data models

What are data models in network automation?

Hassaan Waqar

Data models are structured, human-readable, intent-based text files that contain data important to a device or group of devices. The use of data models transforms the network into an intent-based system. The developer’s intent can be expressed in a single file. Network devices can then be configured to the desired state based on the intent.

An intent-based networking system enables the administrator to send a request that the network will automatically respond to.

Data models are also referred to as data dictionaries that hold variables under dynamic templates. They lie at the core of automatically derived configurations and documentation files.

The illustration below shows how data models aid in achieving network automation:

Data models in network automation

Data models mostly consist of key-value pairs and lists. There can be both group and host variables used to control an individual device or group of devices on the network.

It is important to model data carefully in network automation. An efficient way to scale data must be drafted. Therefore, considerable time should be invested in modeling data.

The code snippet below shows a sample data model used for a campus access switch:

Data models are written in YAML format.

host_defaults:
  hostname: ACCESS01
  stack_size: 2
  site: 10
  snmp_engineid: 1001
  snmp_server_location: \"Building01_FirstFloor\"
  host_vlans:

2:
  name: \"In-BandManagement\"

3:
  name: WirelessAccessPoints

10:
  name: BLUE_Zone

11:
  name: BLUE_Zone_Voice

20:
  name: RED_Zone

30:
  name: GREEN_Zone

50:
  name: SECURITY

host_virtual_interfaces:
  Vlan2:
    description: \"In-BandManagement\"
    ip_address: \"192.168.1.1 255.255.255.0\"
    state_enabled: true

host_port_channels:

  Port-channel1:
    port_channel: 1
    description: \"Distribution Uplink\"
    encapsulation: dot1q
    switchport_mode: trunk
    switchport_nonegotiate: true
    vlans: 2,3,10,11,20,30,50
    state_enabled: true
    members:
      GigabitEthernet1/0/48:
        power_inline: false
        srr_queue_share: true
        srr_queue_shape: true
        priority_queue: out
        trust_dscp: true
        lacp: active
        service_policy:
        input: QoS-IN
        state_enabled: true

      GigabitEthernet2/0/48:
        power_inline: false
        srr_queue_share: true
        srr_queue_shape: true
        priority_queue: out
        trust_dscp: true
        lacp: active
        service_policy:
        input: QoS-IN
        state_enabled: true

host_interfaces:
  GigabitEthernet1/0/1:
    type: OPZone
    description: Standard OPZone Interface
    vlan: 10
    voice_vlan: 11
    state_enabled: true

  GigabitEthernet1/0/2:
    type: SECURITY
    description: Standard Security Interface
    vlan: 50
    state_enabled: true
    

RELATED TAGS

network
automation
data models

CONTRIBUTOR

Hassaan Waqar
Copyright ©2022 Educative, Inc. All rights reserved
RELATED COURSES

View all Courses

Keep Exploring