Quick Start
When IPRoute2-Sysrepo is initiated, it automatically undertakes the following tasks:
- Loads the existing Linux networking configuration into the running datastore.
- Subscribes to any configuration changes within the Sysrepo system.
Testing
Below will be demonstrating creating the following interfaces in one transaction using sysrepocfg tool:
- veth interface with ipv4 and ipv6 addresses.
- vlan interface with id 10.
- veth interface mapped to vlan 10.
- bridge interface.
1- Start IPRoute2-Sysrepo and keep it running:
$ sudo iproute2-sysrepo
2- Edit sysrepo running ds using NETCONF or ONM-CLI:
- ONM-CLI
- NETCONF
$./onm-cli
pc> enable
pc# sysrepo load-modules
pc# configure terminal
pc(config)# links-iproute2
pc(config-links-iproute2)# bridge br1
pc(config-bridge[name='br1'])# br-info ageing_time 1000
pc(config-bridge[name='br1'])# exit
pc(config-links-iproute2)# link dummy0
pc(config-[name='dummy0'])# type iproute2-ip-link:dummy
pc(config-[name='dummy0'])# admin-status up
pc(config-[name='dummy0'])# ip 192.1.2.1/32
pc(config-[name='dummy0'])# ip 2001:bd8::11/64
pc(config-[name='dummy0'])# master br1
pc(config-[name='dummy0'])# exit
pc(config-links-iproute2)# vlan vlan10
pc(config-[name='vlan10'])# device dummy0
pc(config-[name='vlan10'])# vlan-info protocol 802.1q
pc(config-[name='vlan10'])# vlan-info id 10
pc(config-[name='vlan10'])# exit
<rpc message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<edit-config>
<target>
<running/>
</target>
<config xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">
<links xmlns="urn:okda:iproute2:ip:link">
<link>
<name>dummy0</name>
<type>dummy</type>
<master>br1</master>
<ip>
<address>192.1.2.1/32</address>
</ip>
<ip>
<address>2001:bd8::11/64</address>
</ip>
</link>
<link>
<name>testIf1</name>
<type>veth</type>
</link>
<vlan>
<name>vlan10</name>
<device>testIf1</device>
<vlan-info>
<protocol>802.1q</protocol>
<id>10</id>
</vlan-info>
</vlan>
<bridge>
<name>br1</name>
<br-info>
<ageing_time>1000</ageing_time>
</br-info>
</bridge>
</links>
</config>
</edit-config>
</rpc>
- Iproute2-sysrepo will generate and execute the following iproute2 commands:
ip link add name br1 type bridge ageing_time 1000
ip link add name dummy0 mtu 1500 up master br1 type dummy
ip address add 192.1.2.1/32 dev dummy0
ip address add 2001:bd8::11/64 dev dummy0
ip link add name vlan10 mtu 1500 link dummy0 type vlan protocol 802.1q id 10
info
With iproute2-sysrepo
, a wrapper is added on top of the original iproute2's do_cmd()
function.
This means that do_cmd()
is internally invoked to execute commands,
resulting in all iproute2
commands being executed within the main thread.