RIP Module
- Sample RIP configuration file
- XML Schema
- Module Design
- Allowed Commands
- Netconf edit-config Operations Examples
/etc/init.d/zebra start /etc/init.d/ripd start |
Sample RIP configuration file
! router rip version 2 redistribute kernel metric 1 route-map 1 redistribute ospf route-map 4 redistribute bgp metric 5 network 10.0.0.0/8 network eth0 neighbor 10.0.0.1 neighbor 10.0.0.2 passive-interface eth3 passive-interface eth8 distribute-list private in eth0 ! |
<rip version="2" default-metric="1"> <redistribute> <kernel metric="1" route-map="1"/> <ospf route-map="4"/> <bgp metric="5"/> </redistribute> <networks> <network>10.0.0.0/8</network> <network>11.0.0.0/8</network> <network>eth0</network> </networks> <neighbors> <neighbor>10.0.0.1</neighbor> <neighbor>10.0.0.2</neighbor> </neighbors> <passive-interfaces> <passive-interface>eth3</passive-interface> <passive-interface>eth8</passive-interface> </passive-interfaces> <distribute-lists> <distribute-list direct="in" name="private">eth0</distribute-list> </distribute-lists> </rip> |
The previous XML document is intended to reflect as close as possible the original CLI RIP configuration. This makes the mapping between CLI commands and XML Netconf data easier. It also intends to make the XML validation more efficient. For example, the redistribute element permits checking that one redistribute is allowed for each source (kernel, ospf, bgp, connected, static). redistribute, networks, neighbors and passive-interfaces are all optional elements. In the future, some new elements may be added to address all the CLI configuration. As it is now, it is already very operational but it still misses a few features. We also tried to make the document very human-readable and not too verbose.
XML Schema
<?xml version="1.0" encoding="UTF-8"?> <xs:schema targetNamespace="urn:madynes:params:xml:ns:netconf:rip:1.0" elementFormDefault="qualified" attributeFormDefault="unqualified" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="urn:madynes:params:xml:ns:netconf:rip:1.0"> <xs:element name="rip" type="ripType"/> <xs:complexType name="ripType"> <xs:sequence> <xs:element name="redistribute" type="redistributeType" minOccurs="0" maxOccurs="1"/> <xs:element name="networks" type="networksType" minOccurs="0" maxOccurs="1"/> <xs:element name="neighbors" type="neighborsType" minOccurs="0" maxOccurs="1"/> <xs:element name="passive-interfaces" type="passive-interfacesType" minOccurs="0" maxOccurs="1"/> <xs:element name="distribute-lists" type="distribute-listsType" minOccurs="0" maxOccurs="1"/> </xs:sequence> </xs:complexType> <xs:complexType name="redistributeType"> <xs:sequence> <xs:element name="kernel" type="redistributesubType" minOccurs="0" maxOccurs="1"/> <xs:element name="connected" type="redistributesubType" minOccurs="0" maxOccurs="1"/> <xs:element name="ospf" type="redistributesubType" minOccurs="0" maxOccurs="1"/> <xs:element name="bgp" type="redistributesubType" minOccurs="0" maxOccurs="1"/> </xs:sequence> </xs:complexType> <xs:complexType name="redistributesubType"> <xs:attribute name="metric" type="xs:positiveInteger" use="optional"/> <xs:attribute name="route-map" type="xs:string" use="optional"/> </xs:complexType> <xs:complexType name="networksType"> <xs:sequence> <xs:element name="network" type="xs:string" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> <xs:complexType name="neighborsType"> <xs:sequence> <!-- should be changed to ip address --> <xs:element name="neighbor" type="xs:string" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> <xs:complexType name="passive-interfacesType"> <xs:sequence> <xs:element name="passive-interface" type="xs:string" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> <xs:complexType name="distribute-listsType"> <xs:sequence> <xs:element name="distribute-list" type="xs:string" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> </xs:schema> |
Module Design
This schema shows the data model of the RIP module. Each command (redistribute, network, neighbor, ...) is converted to a class that inherits from RIP_Command. The methods toCLI() and toXML(document) are missing in the schema. The first one serializes the command into a regular text command. The second returns an XML node belonging to the document.
Allowed Commands
- rip
- replace: ...
- create: ...
- delete: ...
- merge: ...
- redistribute
- replace: ...
- create: ...
- delete: ...
- merge: ...
- bgp, kernel
- replace: ...
- create: ...
- delete: ...
- merge: ...
Netconf edit-config Operations Examples
Redistribute routing information from kernel (respectively static, connected, ospf, bgp) route entries into the RIP tables
- Enable redistribute routing information from kernel with metric 1 and route-map 1
redistribute kernel metric 1 route-map 1 |
<rip> <redistribute> <kernel xc:operation=="create" metric=="1" route-map=="1"/> </redistribute> </rip> |
- Disable redistribute routing information from kernel whatever the values of the metric and route-map attributes
no redistribute kernel |
<rip> <redistribute> <kernel xc:operation=="delete"/> </redistribute> </rip> |
Network
- Enable a network
network 10.0.0.1 |
<rip> <networks> <network xc:operation=="create">10.0.0.1</network> </networks> </rip> |
- Disable a network
no network 10.0.0.1 |
<rip> <networks> <network xc:operation=="delete">10.0.0.1</network> </networks> </rip> |