94 Module 3 Netconf
94 Module 3 Netconf
v0.1.1
(2015-‐11-‐05)
Overview
and
Objec6ves
This
presenta6on
uses
a
set
of
common
configura6on
management
tasks
to
walk
through
the
main
features
of
the
NETCONF
protocol.
AIer
this
presenta6on,
you
should
be
able
to:
• Obtain
desired
configura6on
aMributes
from
a
device
using
NETCONF
• Configure
a
network
device
using
NETCONF
• Understand
NETCONF
transac6ons
NETCONF
Layering
Model
Layer
NETCONF
Example
<get>
<edit-config>
Opera6ons
<get-‐config>
<config>
...Content...
</config>
Messages
<rpc>
<no6fica6on>
</edit-config>
Secure
</rpc>
ssh
Transport
NETCONF
Datastores
<copy>
<copy>
Candidate
Startup
(:candidate)
Running
<commit>
(:startup)
Working
copy
to
manipulate
Complete
and
ac6ve
Configura6on
loaded
by
the
with
no
impact
on
current
configura6on
device
at
startup
configura6on
Basic
NETCONF
Session
Capabili6es
Exchange
<hello>
Perform
opera6ons
<rpc>
<rpc-‐reply>
...
client
server
End
session
<close-‐session>/<kill-‐session>
Capabili6es
Exchange
-‐
Hello
<rpc-reply message-id="1“
xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<data> <data>
<!-- ... entire set of data returned ... -->
</data>
</rpc-reply>
More
Realis6c
<get>
Response
<rpc-reply message-id="1" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<data> <data>
<interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces">
<interface>
<name>eth0</name>
<type xmlns:ianaift="urn:ietf:params:xml:ns:yang:iana-if-type">ianaift:ethernetCsmacd</type>
<enabled>true</enabled>
<ipv6 xmlns="urn:ietf:params:xml:ns:yang:ietf-ip">
<address>
<ip>2001:db8:c18:1::3</ip>
<prefix-length>128</prefix-length>
</address>
</ipv6>
</interface>
<interface>
<name>eth1</name>
<type xmlns:ianaift="urn:ietf:params:xml:ns:yang:iana-if-type">ianaift:ethernetCsmacd</type>
<enabled>true</enabled>
<ipv6 xmlns="urn:ietf:params:xml:ns:yang:ietf-ip">
<address>
<ip>2001:db8:c18:2::1</ip>
<prefix-length>128</prefix-length>
</address>
</ipv6>
</interface>
</interfaces>
</data>
</rpc-reply>
Filtering
Data
How
do
I
filter
to
get
data
for
just
one
interface
instead
of
all?
We
will
use:
• The
<get>
or
<get-config>
opera6ons
• The
<filter>
parameter
to
select
a
par6cular
subtree
in
the
reply
Example
of
Filtering
Data
<rpc message-id="101” xmlns=”urn:ietf:param
<get>
<filter type="subtree">
Return
just
the
interfaces
list
<top xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces";
<interfaces>
</interfaces>
</top>
</filter>
</get>
</rpc>
Example:
Enabling
and
configuring
the
IPv6
address
for
an
interface
We
will
use:
• The
<edit-config>
opera6on
to
edit
the
datastore
content
– The
<target>
parameter
to
specify
the
datastore,
• The
<commit>
opera6on
to
commit
the
candidate
datastore
content
to
the
running
datastore
Using
<edit-‐config>
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1”>
<edit-config>
<target> ...Spcecify
the
data
store
to
edit
...
</target>
<config> ... Provide
the
desired
configura6on
to
write
...
</config>
</edit-config>
</rpc>
Example:
Enabling
the
Interface
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1">
<edit-config>
<target>
<running/>
</target>
<config>
<interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces">
<interface>
<name>eth0</name>
<type xmlns:ianaift="urn:ietf:params:xml:ns:yang:iana-if-
type">ianaift:ethernetCsmacd</type>
<enabled>true</enabled>
</interface>
</interfaces>
</config>
</edit-config>
</rpc>
Using
<edit-‐config>
on
candidate
<rpc>
• Requires
:candidate
capability
<delete-config>
<target><candidate/></target>
</delete-config>
</rpc>
<rpc>
Clear
Candidate
<edit-config>
<target>
<candidate/>
</target>
<config>
Edit
Candidate
...New Configuration...
</config>
</edit-config>
</rpc>
Commit
<rpc>
<commit\>
</rpc>
Example:
Adding
IPv6
Address
<rpc message-id="1" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<edit-config>
<target>
<candidate/>
</target>
<config>
<interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces">
<interface>
<name>eth0</name>
<ipv6 xmlns="urn:ietf:params:xml:ns:yang:ietf-ip">
<address>
<ip>2001:db8:c18:1::3</ip>
<prefix-length>128</prefix-length>
</address>
</ipv6>
</interface>
</interfaces>
</config>
</edit-config>
</rpc>
Clear Candidate
Edit Candidate
Commit
Free
Datastore
Clear
the
Candidate
Datastore
Lock
Datastore
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"
message-id="3">
<delete-config>
Clear
Candidate
<target>
<candidate/>
</target>
</delete-config>
Edit
Candidate
</rpc>
Commit
Free
Datastore
Edit
the
Candidate
Datastore
Lock
Datastore
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"
Clear
Candidate
message-id="4">
<edit-config>
<target>
<candidate/>
Edit
Candidate
</target>
<config>
...
Configura3on
data...
</config>
</edit-config>
Commit
</rpc>
Free
Datastore
Commit
the
Candidate
to
the
Running
Lock
Datastore
Clear Candidate
Edit Candidate
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"
Commit
message-id="5">
<commit/>
</rpc>
Free
Datastore
Unlock
the
Running
Datastore
Lock
Datastore
Clear Candidate
Edit Candidate
Commit
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"
message-id=“6">
<unlock>
Unlock
Datastore
<target><running/></target>
</unlock>
</rpc>
Valida6on
and
Rollback
I
want
to
test
the
configura6on
before
I
commit
and
cancel
out
if
necessary!
We
will
use:
• The
<validate>
opera6on
to
validate
the
content
of
a
datastore
• The
<commit> opera6on
to
commit
candidate
to
running
– The
<confirmed> parameter
to
denote
a
confirmed
commit
– The
<persist> parameter
to
specify
a
commit
iden6fier
– The
<confirm-timeout> parameter
to
specify
a
6meout
before
rollback
Valida6on
...
Confirming
Commit
Confirming
Commit
...
Edit Candidate
Validate
Validate
Validate
Validate
Step
#1:
Commit
Commit
Commit
Commit