Skip to the main content.

Network Interfaces Module

This module allows to manage network interfaces: retrieve configuration and update values like mtu, netmask, broadcast addresses, ipv4 addresses and so on. It is based on a command design pattern to make roll back easier. Currently, it is possible to update mtu, and ipv4 address, netmask and broadcast. The Interfaces module is bound to the following namespace: urn:loria:madynes:ensuite:yencap:module:Interfaces:1.0

Yang data model

module Interfaces {

	namespace "urn:loria:madynes:ensuite:yencap:module:interfaces:1.0";
	prefix "ifs";
	import ietf-inet-types { prefix yt; }
	grouping generic-state {
	    leaf bytes {type uint64;}
	    leaf packets { type uint64;}
	    leaf drop { type uint64;}
	    leaf compressed {type uint64;}
	    leaf fifo { type uint64;}
	    leaf errs {type uint64;}
	}
	grouping v4add {
		container ipv4 {
			leaf address-v4 { type yt:ipv4-address; }
			leaf netmask { type yt:ipv4-address; }
		}
	}
	grouping v6add {
		container ipv6 {
			leaf address-v6 { type yt:ipv6-address; }
			leaf netmask { type yt:ipv6-address; }
		}
	}
	container interfaces {
		list interface {
			key name;
			leaf name { type string;}
			leaf mac-address { type string;}
			leaf mtu { type uint32;}
			choice ad-type {
				case v4 { uses v4add; }
				case v6 { uses v6add; }
			}
			container stats {
				config false;
				container received { 
				  uses generic-state;
				  leaf frame { type int64;}
				  leaf multicast { type int64;}
				}
				container transmit { 
				config false;
					uses generic-state;
					leaf carrier { type uint64;}
					leaf colls { type uint64;}
				}
			}
		} 
	}
}


XML configuration data example

<interfaces xmlns="urn:loria:madynes:ensuite:yencap:module:Interfaces:1.0">
  <interface>
    <name>eth0</name>
    <mac-address>00:0c:f1:82:47:5e</mac-address>
    <mtu>1500</mtu>
    <flags broadcast="false" running="false" multicast="false" up="true"/>
    <ipv4>
       <netmask>255.255.....</netmask>
       <broadcast>152.81.....</broadcast>
       <address-v4>152.81.....</address-v4>
    </ipv4>
    <ipv6>
      <address-v6 scope="global" prefix="40">200106604501000.......</address-v6>
      <address-v6 scope="link-local" prefix="40">fe800000000.......</address-v6>
    </ipv6>
  </interface>
</interfaces>