Hello my friend,

Today topic of the network programmability is popular. There is a quite pragmatic approach behind this popularity, which is to lower the operational costs of the network and increase its agility. By agility I mean the way how we create the network services, which time we spend on it and so on. Let’s evaluate how model-driven configuration can help us to do it for Nokia SR OS 16.0.

Brief description

Why have I mentioned SR OS version 16.0? Because model-driven CLI is available starting from SR OS 16.0.R1, which was released some days ago (beginning of June 2018). Actually, it’s one of the very important introductions of this the release in direction of network programmability.

The idea of model-driven CLI (shortly MD-CLI) is very straightforward: to have a single configuration approach based on YANG-models for all configuration interfaces:

  • CLI
  • NETCONF
  • gRPC

You remember, some time ago, we were configuring Nokia (Alcatel-Lucent) SR OS and Cisco IOS XR using NETCONF/YANG (link). We did some reverse engineering activities to rebuild the structure of YANG models directly from the router, though it was possible to read original YANG packages. One of the reasons for that was different structure (or at least not clear relations) between CLI configuration model and YANG data mode. This is something MD-CLI overcomes.

There are some new features, what makes life of the configurator easier, which we’ll review in this article.

What we are going to test?

We’ll review new MD-CLI (model-driven CLI), which is available in Nokia SR OS starting from version 16.0.R1. We aren’t configuring any particular technologies and so on, but we rather focus on CLI itself.

Software version

The following infrastructure is used in my lab:

  • CentOS 7 with python 2.7.
  • Ansible 2.5.2
  • Nokia VSR 16.0.R1 (NEW!)

See the previous article to get details how to build the lab

Nokia VSR 16.0.R1 is the current latest version of VSR, which has been released in the beginning of June 2018.

Topology

As we aren’t configuring particular technologies, there is no particular topology. New VSR is just connected to the management network and is reachable over SSH:

No initial configuration is provided as Nokia VSR has default configuration.

Deployment of Nokia VSR 16.0.R1

The deployment of VM with Nokia VSR 16.0.R1 is just the same as it was for VSR 15.0. You can either read some information about manual deployment or you can use our VNF onboarding tool with small modifications. If you are familiar with Ansible, you can easily update it.

Usage of MD-CLI

When we are logged into newly deployed Nokia VSR 16.0.R1 router, we see just standard CLI, nothing new

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
.Login: admin
.Password:
.
. SR OS Software
. Copyright (c) Nokia 2018.  All Rights Reserved.
.
. Trademarks
.
. Nokia and the Nokia logo are registered trademarks of Nokia. All other
. trademarks are the property of their respective owners.
.
. IMPORTANT: READ CAREFULLY
.
. The SR OS Software (the "Software") is proprietary to Nokia and is subject
. to and governed by the terms and conditions of the End User License
. Agreement accompanying the product, made available at the time of your order,
. or posted on the Nokia website (collectively, the "EULA").  As set forth
. more fully in the EULA, use of the Software is strictly limited to your
. internal use.  Downloading, installing, or using the Software constitutes
. acceptance of the EULA and you are binding yourself and the business entity
. that you represent to the EULA.  If you do not agree to all of the terms of
. the EULA, then Nokia is unwilling to license the Software to you and (a) you
. may not download, install or use the Software, and (b) you may return the
. Software as more fully set forth in the EULA.
.
. This product contains cryptographic features and is subject to United States
. and local country laws governing import, export, transfer and use. Delivery
. of Nokia cryptographic products does not imply third-party authority to
. import, export, distribute or use encryption.
.
. If you require further assistance please contact us by sending an email
. to support@nokia.com.
.
.A:VSR#

Let’s briefly check the version of our Nokia VSR:

1
2
3
4
.A:VSR# show version
.TiMOS-B-16.0.R1 both/x86_64 Nokia 7750 SR Copyright (c) 2000-2018 Nokia.
.All rights reserved. All use subject to applicable license agreements.
.Built on Thu May 31 16:23:56 PDT 2018 by builder in /builds/160B/R1/panos/main

Having checked that VSR has correct version, we can enable MD-CLI mode, which is disabled by default. To do that we need to enter the following two commands, logout and log in back to the CLI:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
.A:VSR# configure system management-interface cli md-cli auto-config-save
.*A:VSR# configure system management-interface configuration-mode model-driven
.
.
.*A:VSR# logout
.
.TiMOS-B-16.0.R1 both/x86_64 Nokia 7750 SR Copyright (c) 2000-2018 Nokia.
.All rights reserved. All use subject to applicable license agreements.
.Built on Thu May 31 16:23:56 PDT 2018 by builder in /builds/160B/R1/panos/main
.
.
.Login: admin
.Password:
.
. SR OS Software
. Copyright (c) Nokia 2018. All Rights Reserved.
.
. Trademarks
.
. Nokia and the Nokia logo are registered trademarks of Nokia. All other
. trademarks are the property of their respective owners.
.
. IMPORTANT: READ CAREFULLY
.
. The SR OS Software (the "Software") is proprietary to Nokia and is subject
. to and governed by the terms and conditions of the End User License
. Agreement accompanying the product, made available at the time of your order,
. or posted on the Nokia website (collectively, the "EULA"). As set forth
. more fully in the EULA, use of the Software is strictly limited to your
. internal use. Downloading, installing, or using the Software constitutes
. acceptance of the EULA and you are binding yourself and the business entity
. that you represent to the EULA. If you do not agree to all of the terms of
. the EULA, then Nokia is unwilling to license the Software to you and (a) you
. may not download, install or use the Software, and (b) you may return the
. Software as more fully set forth in the EULA.
.
. This product contains cryptographic features and is subject to United States
. and local country laws governing import, export, transfer and use. Delivery
. of Nokia cryptographic products does not imply third-party authority to
. import, export, distribute or use encryption.
.
. If you require further assistance please contact us by sending an email
. to support@nokia.com.
.
.
.[]
.A:admin@VSR#

As you might see after re-login the CLI looks in a bit different way. Let’s check what is available from the commands in the top level of MD-CLI by default:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
.[]
.A:admin@VSR# ?
.
. admin                + Enter the administrative context for system operations
. clear                + Clear statistics or reset operational state
. configure            + Enter the configuration context
. environment          + Enter the environment configuration context
. show                 + Show operational information
. tools                + Enter the tools context for troubleshooting and
.                        debugging
.
. Global commands:
. back                 - Move back one or more levels
. commit               - Commit changes to the running datastore
. compare              - Show changes between datastores
. discard              - Discard changes in the candidate datastore
. edit-config          - Enter a candidate configuration mode
. exec                 - Execute commands from a file
. exit                 - Return to the previous working context or to the
.                        operational root
. history              - Show the most recently entered commands
. info                 - Show the configuration from the present working context
. load                 - Load a configuration from a file
. logout               - Exit the CLI session
. pwc                  - Show the present working context
. quit-config          - Leave the candidate configuration mode
. rollback             - Rollback to a previous configuration
. top                  - Move to the top level of the context
. tree                 - Show the command tree under the present working context
. validate             - Validate changes in the candidate datastore

Most of the commands are familiar to you, but there are some new like “edit-config” and “quit-config

What are the changes then? Let’s review them one by one.

#1. Candidate config

Long ago we have shown the possibility to use candidate config option for previous releases of Nokia SR OS. Now it’s mandatory in MD-CLI. So we need to enter the “edit-config” mode, before we can do anything and by the end of the configuration we’ll need to commit changes in order they are implemented. Let’s try to test without new command:

1
2
3
4
.[]
.A:admin@VSR# configure
.             ^^^^^^^^^
.MINOR: CLI #2069: Operation not allowed - 'edit-config' required before entering 'configure'

The message is self-explanatory, so we enable configuration mode:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
.[]
.A:admin@VSR# edit-config ?
.
. edit-config
.
. Configuration modes:
. exclusive            - Obtain exclusive lock for candidate configuration.
. global               - Enter global (shared) mode for candidate configuration.
. read-only            - Enter read-only mode for candidate configuration.
.
.
.[]
.A:admin@VSR# edit-config exclusive
.INFO: CLI #2060: Entering exclusive configuration mode
.WARNING: CLI #2061: Uncommitted changes are discarded on 'quit-config'
.
.(ex)[]
.A:admin@VSR#

#2. Watching into existing config

Now we are able to configure something. But before we start configuration, we can review the existing configuration using new structure:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
.(ex)[]
.A:admin@VSR# info
.    configure {
.        log {
.            filter 1001 {
.                entry 10 {
.                    description "Collect only events of major severity or higher"
.                    action forward
.                    match {
.                        severity {
.                            gte major
.                        }
.                    }
.                }
.            }
.            log-id 99 {
.                description "Default System Log"
.                source {
.                    main true
.                }
.                destination {
.                    memory {
.                        max-entries 500
.                    }
.Press Q to quit, Enter to print next line or any other key to print next page.

The output of Info will depend on the role that user has. As we are using default “admin” with unlimited rights, we can see everything.

To show running configuration from any user, there is another new command:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
.[]
.A:admin@VSR# admin show configuration
.# TiMOS-B-16.0.R1 both/x86_64 Nokia 7750 SR Copyright (c) 2000-2018 Nokia.
.# All rights reserved. All use subject to applicable license agreements.
.# Built on Thu May 31 16:23:56 PDT 2018 by builder in /builds/160B/R1/panos/main
.
.# Generated WED JUN 13 17:22:25 2018 UTC
.
.configure {
.    card 1 {
.        card-type iom-v
.        mda 1 {
.            mda-type m20-v
.        }
.    }
.    log {
.        filter 1001 {
.            entry 10 {
.                description "Collect only events of major severity or higher"
.                action forward
.                match {
.                    severity {
.                        gte major
.                    }
.                }
.Press Q to quit, Enter to print next line or any other key to print next page.

This command was introduced instead of “admin display-config” used in classic CLI.

It’s also possible using “info detail” to see the default values, which are configured and not shown normally:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
.(ex)[]
.A:admin@VSR# info detail
.    configure {
.        aaa {
.            radius-coa-port 3799
.            wpp {
.             ## portal-group
.            }
.         ## acct-on-off-group
.         ## radius-script-policy
.         ## radius-server-policy
.         ## route-downloader
.         ## l2tp-accounting-policy
.         ## diameter-peer-policy
.         ## isa-radius-policy
.        }
.        bfd {
.         ## bfd-template
.        }
.        bmp {
.            admin-state disable
.         ## station
.        }
.     ## card
.     ## cflowd
.Press Q to quit, Enter to print next line or any other key to print next page.

You might spot that there are some a lot of commands starting with “##” symbol. It shows the command, that might exist in certain configuration context, but it isn’t configured currently. On the one hand it gives you additional possibility to see, where you need to configure something; on the other hand you don’t need to guess anymore, if there is implicit (default) value is configured or nothing is configured.

There is also possibility to review config file in form of exact commands needs to be issued to get it using keyword “full-context” after “info” command:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
.(ex)[]
.A:admin@VSR# info full-context
.    /configure card 1 card-type iom-v
.    /configure card 1 mda 1 mda-type m20-v
.    /configure log filter 1001 entry 10 description "Collect only events of major severity or higher"
.    /configure log filter 1001 entry 10 action forward
.    /configure log filter 1001 entry 10 match severity gte major
.    /configure log log-id 99 description "Default System Log"
.    /configure log log-id 99 source main true
.    /configure log log-id 99 destination memory max-entries 500
.    /configure log log-id 100 description "Default Serious Errors Log"
.    /configure log log-id 100 filter 1001
.    /configure log log-id 100 source main true
.    /configure log log-id 100 destination memory max-entries 500
.    /configure { log log-id 101 destination netconf }
.    /configure port 1/1/1 admin-state enable
.    /configure port 1/1/1 ethernet mode network
.    /configure port 1/1/1 ethernet encap-type dot1q
.    /configure router "Base" interface "toSR2" port 1/1/1:12
.    /configure router "Base" interface "toSR2" ipv4 primary address 10.11.22.11
.    /configure router "Base" interface "toSR2" ipv4 primary prefix-length 24
.    /configure system name "VSR"
.    /configure system dns address-pref ipv4-only
.    /configure system management-interface configuration-mode model-driven
.Press Q to quit, Enter to print next line or any other key to print next page.

This option of “info” output provides you understanding, which commands you need to apply from top-level context to avoid walk between configuration contexts.

#3. Configuration process

Configuration process hasn’t changed, though some commands might be different (really, just minority of the commands). Let’s provision the card to see how it works:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
.(ex)[]
.A:admin@VSR# show card
.
.===============================================================================
.Card Summary
.===============================================================================
.Slot      Provisioned Type                         Admin Operational   Comments
.              Equipped Type (if different)         State State
.-------------------------------------------------------------------------------
.1         (not provisioned)                        up    unprovisioned
.              iom-v
.A         cpm-v                                    up    up/active
.===============================================================================
.
.(ex)[]
.A:admin@VSR# configure
.
.(ex)[configure]
.A:admin@VSR# card 1
.
.*(ex)[configure card 1]
.A:admin@VSR# card-type io
. iom-a
. iom-c4-xp
. iom-e
. iom-v
. iom-xp
. iom3-xp
. iom3-xp-b
. iom3-xp-c
. iom4-e
. iom4-e-b
. iom5-e
.
.*(ex)[configure card 1]
.A:admin@VSR# card-type iom-v
.
.*(ex)[configure card 1]
.A:admin@VSR#

You see that navigation across CLI has changed. Now there is no long string before “#”, which points to configuration context. It’s shown in “[]”, just before the line, where we enter configuration commands.

As I said earlier, all the configuration is done only in candidate mode, that’s why no changes are applied unless we commit them:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
.*(ex)[configure card 1]
.A:admin@VSR# exit all
.
.*(ex)[]
.A:admin@VSR# show card
.
.===============================================================================
.Card Summary
.===============================================================================
.Slot      Provisioned Type                         Admin Operational   Comments
.              Equipped Type (if different)         State State
.-------------------------------------------------------------------------------
.1         (not provisioned)                        up    .unprovisioned
.              iom-v
.A         cpm-v                                    up    up/active
.===============================================================================

Before committing changes, we have possibility to see what is changing in this iteration:

1
2
3
4
5
6
7
.*(ex)[]
.A:admin@VSR# compare
.    configure {
.+       card 1 {
.+           card-type iom-v
.+       }
.    }

Now we commit changes and review that they are applied:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
.*(ex)[]
.A:admin@VSR# commit
.
.(ex)[]
.A:admin@VSR# show card
.
.===============================================================================
.Card Summary
.===============================================================================
.Slot      Provisioned Type                         Admin Operational   Comments
.              Equipped Type (if different)         State State
.-------------------------------------------------------------------------------
.1         iom-v                                    up    up
.A         cpm-v                                    up    up/active
.===============================================================================

With bold I’ve highlighted the fact that “*” symbol, which means unsaved changes, are removed after configuration is committed, as we configured in the very beginning, during activation of MD-CLI, auto-save function.

#4. Configuration commands’ sequence doesn’t matter any more

In previous versions of Nokia SR OS, even if we use candidate mode (link), there were some problems, if the sequence of the commends aren’t correct. With SR OS 16.0.R1 this problem is solved:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
.(ex)[]
.A:admin@VSR# configure
.
.(ex)[configure]
.A:admin@VSR# router
.
.(ex)[configure router "Base"]
.A:admin@VSR# interface toSR2
.
.*(ex)[configure router "Base" interface "toSR2"]
.A:admin@VSR# ipv4 primary address 10.11.22.11 prefix-length 24
.
.*(ex)[configure router "Base" interface "toSR2"]
.A:admin@VSR# port 1/1/1:12
.
.*(ex)[configure router "Base" interface "toSR2"]
.A:admin@VSR# exit
.
.*(ex)[configure router "Base"]
.A:admin@VSR# exit
.
.*(ex)[configure]
.A:admin@VSR# card 1 mda 1 mda-type m20-v
.
.*(ex)[configure]
.A:admin@VSR# port 1/1/1 ethernet encap-type dot1q
.
.*(ex)[configure]
.A:admin@VSR# <strong>port 1/1/1 admin-state enable</strong>

As you see, the sequence isn’t correct, as I’m assigning port to the interface before I really configure port to use dot1q encapsulation and before I in general provision corresponding MDA.

Moreover, due to further adaptation of YANG models, the command to configure IPv4 address on interfaces has changed to distinguish each component of IP addresses, which is highlighted by first bold entry. The second bold entry also shows changes to activation of context using “admin-state” comparing to previous “shutdown / no shutdown” construct

Now, when we have entered commands in false order, let’s try to apply them to see, if it works correct:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
.*(ex)[configure]
.A:admin@VSR# com
. commit  compare
.
.*(ex)[configure]
.A:admin@VSR# compare
.    card 1 {
.+       mda 1 {
.+           mda-type m20-v
.+       }
.    }
.+   port 1/1/1 {
.+       admin-state enable
.+       ethernet {
.+           encap-type dot1q
.+       }
.+   }
.+   router "Base" {
.+       interface "toSR2" {
.+           port 1/1/1:12
.+           ipv4 {
.+               primary {
.+                   address 10.11.22.11
.+                   prefix-length 24
.+               }
.+           }
.+       }
.+   }
.
.*(ex)[configure]
.A:admin@VSR# commit
.
.(ex)[configure]
.A:admin@VSR#

When we see the commands to be applied using “compare” functions, the commands are already in correct order. So there is no problem, when we issue commit.

#5. Switching to classic CLI

Even if we have activated MD-CLI and we are in MD-CLI mode, we have possibility to switch to classic CLI view and/or just call commands from that mode.

To call the command from another CLI mode just use “//” before the command:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
.(ex)[]
.A:admin@VSR# quit-config
.INFO: CLI #2064: Exiting exclusive configuration mode
.
.A:admin@VSR# //admin display
.INFO: CLI #2051: Switching to the classic CLI engine
.A:VSR# /admin display
.# TiMOS-B-16.0.R1 both/x86_64 Nokia 7750 SR Copyright (c) 2000-2018 Nokia.
.# All rights reserved. All use subject to applicable license agreements.
.# Built on Thu May 31 16:23:56 PDT 2018 by builder in /builds/160B/R1/panos/main
.
.# Generated SUN JUN 10 09:23:38 2018 UTC
.
.exit all
.configure
.#--------------------------------------------------
.echo "System Configuration"
.#--------------------------------------------------
.    system
.        management-interface
.            cli
.                md-cli
.                    auto-config-save
.                exit
.            exit
.        exit
.        snmp
.            shutdown
.        exit
.Press any key to continue (Q to quit)

In order to switch to another CLI mode, again, just use “//” without any further command:

1
2
3
4
5
6
7
8
.[]
.A:admin@VSR# //
.INFO: CLI #2051: Switching to the classic CLI engine
.<strong>A:VSR#</strong> //
.INFO: CLI #2052: Switching to the MD-CLI engine
.
.[]
.A:admin@VSR#

Besides informational message, the console definition changes from “[] admin@VSR#” to ordinary “VSR#”, what we have in previous versions.

Lessons learned

As you have seen, some commands have changed. That’s why we would need to learn new commands, if we want to configure MD-CLI manually. But I’d say it makes sense to learn new command and config structure, as it will make easy development of network automation scripts and modules, using NETCONF/YANG model.

Conclusion

The network operations is typically quite rigid to introduction of new CLI modes, as they have learned a lot previous commands and have scripts build to utilize them. But in this case Nokia introduces possibility to switch back from MD-CLI to classic CLI, so the migration is easier and smoother comparing to “make-and-break” approach having only one CLI mode. I personally find new MD-CLI more logical from data model prospective and useful due to mandatory “candidate” mode and compare option. Take care and good bye!

P.S.

If you have further questions or you need help with your networks, I’m happy to assist you, just send me message. Also don’t forget to share the article on your social media, if you like it.

Support us





BR,

Anton Karneliuk