What are data models in network automation?
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 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: ACCESS01stack_size: 2site: 10snmp_engineid: 1001snmp_server_location: \"Building01_FirstFloor\"host_vlans:2:name: \"In-BandManagement\"3:name: WirelessAccessPoints10:name: BLUE_Zone11:name: BLUE_Zone_Voice20:name: RED_Zone30:name: GREEN_Zone50:name: SECURITYhost_virtual_interfaces:Vlan2:description: \"In-BandManagement\"ip_address: \"192.168.1.1 255.255.255.0\"state_enabled: truehost_port_channels:Port-channel1:port_channel: 1description: \"Distribution Uplink\"encapsulation: dot1qswitchport_mode: trunkswitchport_nonegotiate: truevlans: 2,3,10,11,20,30,50state_enabled: truemembers:GigabitEthernet1/0/48:power_inline: falsesrr_queue_share: truesrr_queue_shape: truepriority_queue: outtrust_dscp: truelacp: activeservice_policy:input: QoS-INstate_enabled: trueGigabitEthernet2/0/48:power_inline: falsesrr_queue_share: truesrr_queue_shape: truepriority_queue: outtrust_dscp: truelacp: activeservice_policy:input: QoS-INstate_enabled: truehost_interfaces:GigabitEthernet1/0/1:type: OPZonedescription: Standard OPZone Interfacevlan: 10voice_vlan: 11state_enabled: trueGigabitEthernet1/0/2:type: SECURITYdescription: Standard Security Interfacevlan: 50state_enabled: true
Free Resources