NSO20 StudentGuide PDF
NSO20 StudentGuide PDF
NSO20 StudentGuide PDF
Course Introduction……………………………………………...…1
Cisco NSO Overview…………...…………………………….…..1-0
Network Orchestration Overview .......................................................... 1-1
Need for Network Orchestration ....................................................................................... 1-2
Network Management Challenges ................................................................................... 1-5
Business Implications .................................................................................................... 1-11
Orchestration Use Cases ............................................................................................... 1-17
Summary ....................................................................................................................... 1-33
Cisco NSO Architecture ..................................................................... 1-35
Cisco NSO Logical Architecture ..................................................................................... 1-36
Cisco NSO Components ................................................................................................ 1-42
Northbound APIs ........................................................................................................... 1-50
Packages ....................................................................................................................... 1-55
Network Element Drivers ............................................................................................... 1-58
Summary ....................................................................................................................... 1-68
NETCONF Overview ............................................................................ 1-69
Challenges of Network Management ............................................................................. 1-70
Introduction to NETCONF .............................................................................................. 1-79
NETCONF Operation ..................................................................................................... 1-88
Summary ....................................................................................................................... 1-97
YANG Overview ................................................................................. 1-99
Introduction to YANG ................................................................................................... 1-100
Other Representations of YANG .................................................................................. 1-108
YANG Data Types ....................................................................................................... 1-110
Basic YANG Statements .............................................................................................. 1-118
XPath Overview ........................................................................................................... 1-132
YANG Examples .......................................................................................................... 1-144
Summary ..................................................................................................................... 1-153
Service Management.……...………………………………….….3-0
YANG Tutorial ........................................................................................ 3-1
Cisco NSO YANG Architecture ........................................................................................ 3-2
Creating a Service Package............................................................................................. 3-5
Cisco NSO CLI .............................................................................................................. 3-14
Service Template ........................................................................................................... 3-21
YANG Service Model ..................................................................................................... 3-25
Deploy a Service............................................................................................................ 3-37
Summary ....................................................................................................................... 3-40
FASTMAP..................................................................................................................... 3-41
Introduction .................................................................................................................... 3-42
Service and Device Models ........................................................................................... 3-45
FASTMAP Principles ..................................................................................................... 3-47
Advanced FASTMAP ..................................................................................................... 3-68
Summary ....................................................................................................................... 3-76
Service Design ................................................................................... 3-77
Service Design .............................................................................................................. 3-78
Service Design for Cisco NSO Top-Down Approach ...................................................... 3-85
Service Design for Cisco NSO Bottom-Up Approach ..................................................... 3-90
Device Configuration ..................................................................................................... 3-99
Service Model .............................................................................................................. 3-108
Summary ..................................................................................................................... 3-115
Service Management ........................................................................ 3-117
Service Management Tasks ........................................................................................ 3-118
Service Lifecycle Management Guidelines................................................................... 3-125
Summary ..................................................................................................................... 3-131
ii Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Summary ....................................................................................................................... 4-28
Cisco NSO System Administration ..................................................... 4-29
System Configuration..................................................................................................... 4-30
System Maintenance ..................................................................................................... 4-36
Authentication and Authorization.................................................................................... 4-42
High Availability ............................................................................................................. 4-46
Clustering ...................................................................................................................... 4-50
Scalable System Management ...................................................................................... 4-59
System Troubleshooting ................................................................................................ 4-74
Summary ....................................................................................................................... 4-81
Alarm Management and Reporting ..................................................... 4-83
Alarms Overview ............................................................................................................ 4-84
Alarm Management........................................................................................................ 4-59
Compliance Reporting ................................................................................................... 4-94
Summary ..................................................................................................................... 4-100
© 2016 Cisco Systems, Inc. Cisco Network Services Orchestrator (NSO) 2.0 iii
iv Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
NSO
Course Introduction
Overview
Automation has been identified as one of the main areas where service providers and large enterprises can
reduce cost, which is becoming more and more important in today's business where average return per user is
diminishing year by year. Service Defined Network principles deliver abstractions of existing network
infrastructure, which enable faster service development and deployment. Standards like NETCONF and
YANG are currently the driving force behind those abstractions and are proposing a significant improvement
to network management.
The Cisco Basic NSO course introduces Cisco Network Services Orchestrator solution which leverages the
power of YANG and NETCONF to streamline network operations and management. By focusing on latest
standards and innovation, Cisco NSO is a true multivendor SDN solution.
2 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Lesson 1-1
Network Orchestration
Overview
Overview
This lesson provides an overview of network orchestration.
Objectives
Upon completing this lesson, you will be able to meet these objectives:
Explain why a network orchestration layer is required
Describe the legacy network management issues
Describe the business implications of network orchestration
Need for Network Orchestration
This topic illustrates the need for network orchestration.
Business Challenge
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 4
Network operators and service providers today are struggling to control the difference between the growth of
their operating costs and their revenue. While the revenue from new services seems to be growing slower,
their operating costs seem to be growing faster and their operating complexity grows with each new services.
This makes introduction and deployment of new services much slower compared to service demand and
availability on the market. The main reason for this are inadequate provisioning processes where services are
either configured manually or hard-coded inside the Operations Support Systems (OSS). To make things
worse, adapters to network devices are often expensive and hard to maintain. The adapters used between the
OSS and the network devices are proprietary and usually translate the OSS logic to the device CLI. Adapters
take time to develop and new features need to be added with new versions of device firmware. The support
for these new features has to be incorporated into the network adapters and these upgrades and maintenance
of network adapters is usually expensive.
1-2 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
SDN and NFV Approach
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 5
Software-defined networking and network functions virtualization (SDN and NFV) promise to solve this
dilemma. However, deploying SDN and/or NFV requires extensive changes which touches the whole
organization. Deploying SDN/NFV requires changes to the network, from upgrading software, replacing
physical devices and changing network topology. Additionally, it disrupts operations and requires changes or
even replacement of existing OSS systems.SDN and NFV enables OSS systems to become almost real-time
which enables instant response to customer requests and instant service fulfilment. This makes new, more
flexible business models possible but also requires a change in the business processes.
BSS/OSS
Service attributes
Network Orchestration
Layer
Device Configuration
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 6
An orchestration layer is proposed to achieve the benefits promised by SDN/NFV without overhauling the
network and disrupt operations and introduction of a network service.
1-4 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Network Management Challenges
This topic describes network management issues.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 8
The traditional network management approach is based upon managing separate devices. The industry is
rapidly moving towards a service-oriented approach to network management, where complex services are
supported by many different systems. To manage these, operators are starting a transition from managing
pieces of equipment towards a situation where an operator is actively managing the various aspects of
services.
In the past several years Software-Defined Networking (or SDN) has emerged as a solution. The basic idea is
to provide a centralized, unified set of APIs with which networks and services can be controlled by software
– automatically and in real time. The promised benefits include faster and more precise control of networks
and services leading to higher performance and lower costs.
Cisco NSO enables operators to dynamically adopt the service configuration solution according to changes in
the offered service portfolio. It delivers the SDN vision today in providing a logically centralized interface
towards the multi-vendor network. The network can be a mix of traditional equipment, virtual devices and
OpenFlow switches.
Limited standardization
Network Integration
Not real time Ad-hoc
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 9
Configuring the services and the affected equipment are among the largest cost-drivers in provider networks.
Still, the common configuration management practice involves pervasive manual work or ad hoc scripting.
Why do we still apply these sorts of techniques to the configuration management problem? Two of the
primary reasons are the variations of services and the constant change of devices. These two underlying
characteristics are, to some degree, blocking automated solutions, since it takes too long to update the
solution to cope with daily changes.
1-6 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Network Management Challenges (Cont.)
Programmability Challenges
Manual, per-device configuration
Slow and error prone
Lack of well defined network API
Order Service
Inventory
Management Activation
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 10
When compared to software, networks are much slower to evolve. Configuration is usually done manually on
each device which is a slow process and is prone to errors. There is no such thing as a network API so
operators are usually using scripting when trying to automate device configuration changes. Additionally,
there are no well-defined protocols or data models for network configuration and there is no such thing as an
atomic change. This leads to high complexity and possibility of errors when changing configuration.
There are many sources of configuration changes. Several different engineers are changing configurations
over time. Some of them do it directly through CLI, others write scripts and some changes are even applied
through NMS systems. In a complex network with high amount of changes there is also a lack of strong
governance over network configuration. This leads to inconsistencies between local and centralized network
data and results in faults and provisioning delays. The most common approach is the so called “fire and
forget”.
1-8 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Addressing Network Management Challenges
Cisco NSO Solution Management Network
Applications Engineer
Multi-vendor service orchestration platform
NETCONF, REST,
Multi-vendor service-layer SDN controller CLI, WebUI
Java, WS, Scripts
Supports traditional L2-L7 networking,
virtual devices and OpenFlow
Cisco
Provides a single API and single UI to
NSO
entire managed environment
Keep accurate copy of network
configuration state
Makes sure configuration is synchronized
with the network
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 12
Primarily, Cisco NSO is a multi-vendor service orchestration platform that enables End-to-End Service
Orchestration across physical or virtual devices. Cisco NSO can also be percieved as a multi-vendor service-
layer SDN controller for data centers and service providers. Along with traditional L2 – L7 networking it
also supports virtual devices and OpenFlow. Cisco NSO provides a single API and a single UI to the
network. Cisco NSO keeps an accurate copy of network configuration state at all times so the state of the
NSO database always mirrors the actual state of the network. Cisco NSO makes sure that the configuration
database is synchronized with the network devices at all times.
1-10 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Business Implications
This topic describes the business implications of implementing Cisco NSO.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 15
One of the main benefits of deploying Cisco NSO is faster service deployment and deployment of
configuration management systems. It also makes networks more scalable because new devices can be
added and configured with minimal effort. The same goes for device replacement – devices can be replaced
quickly with little to no additional configuration.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 16
Due to configuration consistency between the physical network and the configuration database configuration
errors can be avoided and the process of network planning and troubleshooting can be improved.
1-12 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Transactional Management
Legacy Situation – No Transactions
No well-defined protocols and data-models
Lack of atomicity OSS
NMS
Ordering problem EMS
NETCONF
Manager
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 17
Legacy network management doesn‘t define any configuration management protocols and data models. The
closest thing to this is the SNMP protocol, which was never intended to manage configurations in the first
place. There are also no clearly defined data models that would describe device configuration and there is no
standardization among different device vendors. When a configuration set is pushed to the device the order
of individual configuration steps is very important and it means the difference between a successful or
unsuccessful application of the configuration. The ordering of the configuration steps is up to the engineer
writing the configuration. As a result, this configuration approach is very complex, doesn‘t scale well and is
therefore also very expensive.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 18
The network service orchestration layer distribute or program network configuration as a single atomic
transaction. A transaction is a set of configuration changes that need to be applied to a device. If there is any
failure in a transaction, the local configuration is supposed to be automatically rolled-back to the state of the
last "good" transaction. Even if a configuration of a single device fails, the entire service deployment can be
compromised. If the configurations that have already been applied are not rolled back completely, the
network is then left in an inconsistent state. Additionally, devices should be able to determine in what order
the individual steps should be applied. This reduces the configuration complexity and cost and increases
scalability.
1-14 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Standards development
RFC 3535
SNMP is not appropriate for
Abstract
configuration management
This document provides an overview of a
workshop held by the Internet Architecture CLI scripting is proprietary,
Board (IAB) on Network Management. The expensive to maintain, often
workshop was hosted by CNRI in Reston, VA, unreliable
USA on June 4 thru June 6, 2002. The goal of
the workshop was to continue the important “Market share” 70%+
dialog started between network operators and
protocol developers, and to guide the IETFs
focus on future work regarding network
management.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 19
The SNMP management technology was created in the late 1980s and has since been widely implemented
and deployed in the Internet. There is lots of implementational and operational experience, and the
characteristics of the technology are thus well understood.
SNMP works reasonably well for device monitoring. The stateless nature of SNMP is useful for statistical
and status polling.
SNMP is widely deployed for basic monitoring.
There are many well defined proprietary MIB modules developed by network device vendors to support their
management products.
SNMP is an important data source for systems that do event correlation, alarm detection, and root cause
analysis. SNMP requires applications to be useful. SNMP was, from its early days, designed as a
programmatic interface between management applications and devices. As such, using SNMP without
management applications or smart tools appears to be more complicated. Standardized MIB modules often
lack writable MIB objects which can be used for configuration, and this leads to a situation where the
interesting writable objects exist in proprietary MIB modules.
There are scaling problems with regard to the number of objects in a device. While SNMP provides
reasonable performance for the retrieval of a small amount of data from many devices, it becomes rather
slow when retrieving large amounts of data (such as routing tables) from a few devices.
There is too little deployment of writable MIB modules. While there are some notable exceptions in areas,
such as cable modems where writable MIB modules are essential, it appears that router equipment is usually
not fully configurable via SNMP.
The SNMP transactional model and the protocol constraints make it more complex to implement MIBs, as
compared to the implementation of commands of a command line interface interpreter. A logical operation
on a MIB can turn into a sequence of SNMP interactions.
Fault
management
When we look into operator‘s cost structure over a 5 year period, it is evident that capital expenditures
decrease over the years while the operational expenditures do not. Sometimes they even rise due to
implementation of new services. After 5 years, around 80% of the total network cost is due to operational
expenditures. When broken down into specific tasks, these amount to:
Service configuration and activation: tasks required to configure and activate a certain service (for
example bandwidth on demand).
Fault management: tasks required to recover from faulty configuration.
Change management: tasks required because the service or service parameters have changed (for
example bandwidth on demand service requires additional access classes for IPTV).
Other tasks.
1-16 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Orchestration Use Cases
This topic describes some of the use cases for deploying Cisco NSO to enable end-to-end and
network-wide orchestration of services.
The following lists some of the possible use cases for Cisco NSO:
Transport services such as those using Layer-2 or Layer-3 MPLS VPNs
Managed services such as the Managed CPE service that may optionally also provide some self-service
capabilities to end users
Virtual Managed Services (vMS) using network function virtualization (NFV) to implement managed
network elements (e.g. vCPE, vFW)
Virtual Packet Core (QvPC) with simple on-demand scaling of mobile packet networking
Resource management configuration such as self-service for the Bandwidth On demand service
Device management such as configuration standardization and compliance enforcement and reporting
Virtualized
Cisco Cisco 3rd Party
OpenStack VMware Infrastructure
APIC VTC VIM
Manager (VIM)
Virtual or
vFW vCPE vSLB vIPS vWSA vESA vISE Physical
AVS VTF OVS/DVS Infrastructure
Physical Network Infra. Virtual Network Infrastructure
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 23
The figure illustrates the ETSI Management and Orchestration (MANO) architecture used to enable a
Network Function Virtualization (NFV) service. The figure illustrates the following layers in the
architecture:
The NFV Orchestrator (NFVO) layer where Cisco NSO can be deployed to orchestrate NFV services.
The VNF Manager (VNFM) layer where Cisco Elastic Services Controller (ESC) can be deployed to
control the lifecycle of Virtual Network Functions (vNFs). Alternatively, any other 3rd party system can
be used to achieve a similar management goal.
The Virtualized Infrastructure Manager (VIM) is used to manage the virtual and optionally also physical
infrastructure hosting and interconnecting the vNFs. The figure lists the following examples:
OpenStack, VMware, Cisco APIC (for Cisco ACI solutions), Cisco VTC (for Cisco VTS solutions), or
any other 3rd party systems.
The last layer consists of the physical and virtual infrastructure that provides the end-functionality for
the designed NFV services such as physical and virtual network devices.
1-18 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
NSO Use Cases
Example: MPLS VPNs
MPLS
CE PE PE CE
Create Service
Instance
Web Cisco
Frontend NSO
The figure illustrates a traditional L2 or L3 MPLS VPN where Cisco NSO can be deployed to manage
provider edge routers (PEs) and optionally also the customer edge routers (CEs).
Additionally, the orchestrated solution would typically involve integration with a frontend portal (e.g.
existing OSS/BSS system or a custom made web portal) to simplify service management.
Service Management
The figure illustrates a solution where a managed CPE service is implemented to streamline the provisioning
and management of CPE devices. In addition to orchestrating the configuration of CPEs, a day-0 server can
be deployed to simplify the deployment of new CPEs with zero-touch provisioning.
1-20 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
NSO Use Cases
Example: Virtual Managed Services
MPLS
or Internet
IPsec over Internet vRTR vFW
CPE PE PE GW
Internal
User
vIPS
DC Remote
Access User
The figure illustrates the Virtual Managed Services (vMS) solution where the following components are
managed end to end:
The transport network such as Layer-2, Layer-3 MPLS VPN, VPLS, IPsec VPN, etc., in order to
connect end-customer sites to the data center.
The CPE devices
The virtual network functions (vNFs)
Cisco
May include a Managed CPE service NSO
In order to streamline the deployment of the vMS service we should employ a day-0 server for zero-touch
provisioning of CPE devices. A new device will register with the day-0 server and retrieve the day-0 config
while the day-0 server will register the new device with Cisco NSO that will manage the CPE device for the
remainder of its lifecycle.
1-22 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
NSO Use Cases
Example: Virtual Managed Services (Cont.)
MPLS
or Internet
IPsec over Internet vRTR vFW
CPE PE PE GW
Internal Day-0
User configuration
vIPS
Service Orchestration
DC Remote
Day-0 Server Access User
Cisco
NSO
Cisco
NSO Initiates VNF VM creation via ESC ESC
The figure illustrates the next element in the solution where the Cisco Elastic Service Controller (ESC) is
used to manage the lifecycle of virtual machines used to implement virtual network functions (vNFs).
Cisco
Web NSO
Frontend(s) Cisco
and ESC
OSS/BSS
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 29
1-24 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Cisco Elastic Service Controller (ESC) Overview
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 30
Cisco Elastic Services Controller (ESC) is a Virtual Network Functions Manager (VNFM) and it performs
life cycle management of Virtual Network Functions (VNFs). ESC provides agentless and multi vendor VNF
management by provisioning the virtual services and monitoring their health and promotes agility, flexibility,
and programmability in Network Function Virtualization (NFV) environments. It provides the flexibility to
define rules for monitoring, and associate actions that are triggered based on the outcome of these rules.
Based on the monitoring results, ESC performs scale in or scale out operations on the VNFs. In the event of a
VM failure ESC also supports automatic VM recovery.
ESC fully integrates with Cisco and other third party applications. As a standalone product, the ESC can be
deployed as a VNF Manager. ESC integrates with Cisco Network Services Orchestrator (NSO) to provide
VNF management along with orchestration. ESC as a VNF Manager targets the virtually managed services
and all service provider NFV deployments such as virtual video, WiFi, authentication and so on. Complex
services include multiple VMs that are orchestrated as a single service with dependencies between them.
These multiple VMs are managed as a single entity, such as, Virtually Managed Services (vMS) 1.0 and
later.
Key Features of Elastic Services Controller
Provides open and modular architecture, which allows multi-vendor OSS, VNF and VIM support.
Provides end-to-end dynamic provisioning and monitoring of virtualized services using a single point of
configuration.
Provides customization across different phases of life cycle management; while monitoring the VM,
service advertisement, and custom actions.
Provides agentless monitoring with an integrated Monitoring Actions (MONA) engine. The monitoring
engine provides simple and complex rules, to decide scale in and scale out of VMs.
Provides scale in and scale out options based on the load of the network.
Deploys or removes VMs based on the monitoring errors and threshold conditions detected as part of
healing (also called as recovery).
Supports service agility by providing faster VNF deployment and life cycle management.
1-26 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Cisco ESC Architecture NETCONF Cisco
1. NSO
ESC
API Module ConfD Module Service Monitoring, Elasticity and
Advertising 2.
Southbound
YANG
programming Service Rules Advertising
Model
Monitor Engine Engine
VM Provisioning Service Configuration
Module Module
VIM / Cloud Integration
Other actions
Native Day-0 Monitor
VIM API Config VM
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 31
ESC Architecture
Cisco Elastic Services Controller (ESC) is built as an open and modular architecture that allows OSS, and
multi-vendor support. It performs life cycle management of the VNFs, that is, VNF onboarding, configuring
the VNFs, monitoring them, and making VNF level life cycle decisions such as healing and scaling based on
the KPI requirements. ESC and its managed VNFs are deployed as VMs running within a Virtual
Infrastructure Manager (VIM). Currently, OpenStack and vCenter 5.5 are the supported VIMs. The ESC core
engine manages transactions, validations, policies, workflows, VM state machines and rollbacks. The
monitoring and actions service engine in ESC performs monitoring based on several monitoring methods.
Events are triggered based on the monitoring actions. The monitoring engine also supports custom
monitoring plugins.
ESC can be configured for High Availability.
ESC interacts with the top orchestration layer using the REST and NETCONF/YANG NB APIs. The
orchestration layer can be a Cisco NSO or any third party OSS. ConfD enables integration with NSO by
adding NETCONF/YANG northbound interface support. A configuration template, Virtual Network
Function Descriptor (VNFD) file is used to describe the deployment parameters and operational behaviors of
the VNFs. The VNFD file is used in the process of onboarding a VNF and managing the life cycle of a VNF
instance.
VM Custom Script
Predefined Action Action
VM Bootstrap VM Service Bootstrap Service Service Overloaded/Underloaded
process alive Process alive Functional Custom Script
Service DEAD Predefined Action
Action
Custom Script
VM DEAD Predefined Action
Action
The figure illustrates the initial VNF provisioning task and the ongoing VNF service instance monitoring and
management tasks.
1-28 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
VNF Lifecycle Management – Monitoring & Elasticity
List of Events List of Actions Simple Rules
VM Alive Notify (callback) Service Alive => advertise
Service Alive Advertise Service
Upper load threshold Withdraw Service VM Dead => withdraw
crossed Restart VM Upper load => scale up
Lower load threshold Scale up (add a VM)
and/or
crossed Scale down (remove
Complex Rules
Service Dead a VM)
VM Dead Individually Service Alive => Advertise, Notify
customizable
Heavy load => Scale up, Notify, Advertise
action(s) for every
event Service Dead => Withdraw, Notify, Restart
Cisco Elastic Services Controller (ESC) provides a single point of control to manage all aspects of VNF
lifecycle for generic virtual network functions (VNFs) in a dynamic environment. It provides advanced VNF
life cycle management capabilities through an open, standards-based platform that conforms to the ETSI
VNF management and orchestration (MANO) reference architecture.
In ESC Release 2.0, you can orchestrate VNFs within a virtual infrastructure domain—either in an
OpenStack or ESXi 5.5 environment. A VNF deployment is initiated as a service request. The service request
comprises of templates that consist of XML payloads.
The figure explains the lifecycle management of ESC:
Onboarding—In ESC, you can onboard any new VNF type as long as it meets the prerequisites for
supporting it in an OpenStack and VMware environment. For example in Openstack environment, Cisco
ESC supports QCOW2 image format and config drive support for the VNF bootstrap mechanism. You
can define the XML template for the new VNF type to onboard the VNF with ESC.
Deploying—When a VNF is deployed, Cisco ESC applies "day-zero" configuration for a new service. A
typical configuration includes credentials, licensing, connectivity information (IP address, gateway), and
other static parameters to make the new virtual resource available to the system. It also activates licenses
for the new VNFs.
Monitoring— ESC integrates with the host hypervisor, whether KVM/OpenStack or VMware, to
monitor the health of virtual machines. It tracks performance metrics such as CPU use, memory
consumption, and other core parameters. The requester can specify all of the characteristics (for
example, vCPU, memory, disk, monitoring KPIs, and more) typically associated with spinning up and
managing a virtual machine in an XML template. It also provides an elaborate framework to monitor
service performance-related metrics and other key parameters that you define.
Healing—ESC heals the VNFs when there is a failure. The failure scenarios are configured in the KPI
section of the datamodel. ESC uses KPI to monitor the VM and the events are triggered based on the
KPI conditions. The actions to be taken for every event that is triggered is configured in the rules section
during the deployment.
Updating— Starting from ESC Release 1.1 and onwards, ESC allows deployment updates during
deployment. You can either perform all the updates (that is, add or delete a vm_group, add or delete a
1-30 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
NSO Use Cases NFV MANO
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 34
As the industry's most complete, fully virtualized evolved packet core, the new Cisco Virtualized Packet
Core (VPC) solution redefines the paradigm of agility for service providers.
Cisco's VPC combines all packet core services—for 4G, 3G, 2G, Wi-Fi, and small cell networks—into a
single solution. It provides those network functions as virtualized services, so you can scale capacity and
introduce new services much faster and more cost-effectively.
Cisco's VPC is the industry's first hardware platform and hypervisor-independent solution that combines
network functions virtualization (NfV) and software-defined networking (SDN). This functionality helps
service providers nimbly scale new packet core systems for markets such as automotive, energy, and
healthcare.
Cisco's VPC allows service providers to leave intact their existing Cisco ASR 5000 Series investments and
continue to scale them for consumer and enterprise services.
Cisco's VPC reduces the time for service providers to deploy new services and reduce your operational
expenditures.
Network Trigger
Reconfiguration
Retrieve
Resource Cisco
WAE
Utilization Data
Analyze and
Optimize Paths
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 35
The figure illustrates a use case where Cisco WAE is used to manage the MPLS Traffic Engineering paths to
optimize the utilization of the entire MPLS network.
1-32 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Summary
This topic summarizes the key points that were discussed in this lesson.
Legacy network management of today has several issues owing to the absence of abstract
models beyond the device level.
Network operations suffer from configuration complexity and inconsistency which results
in high costs, slow network changes and high level of failure management.
Network programmability today is slow and prone to errors. As a result, networks evolve
much slower compared to software.
Introducing the transactional based approach reduces configuration complexity and cost.
A Cisco NSO system speed up service development and deployment and reduce OPEX.
References
For additional information, refer to these resources:
Cisco NSO documentation and manual pages
Objectives
Upon completing this lesson, you will be able to meet these objectives:
Describe the overall NSO Architecture
Identify the different components of NSO and describe their role in the architecture
Cisco NSO Logical Architecture
This topic describes NSO Architecture.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 4
The current state of networking lack the fundamental abstractions that are so commonly used for example in
software development. Abstractions reduce complexity and enable the developers to focus on the task on the
actual problem they are solving. Due to the lack of abstractions the networks have become hard or even
impossible to manage efficiently. The proposed abstraction for networking is a global network view.
1-36 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Three-Layered Architecture
SDN Architecture Abstract Network View
Device Control
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 5
Cisco NSO shares the three-layer management architecture with the Software Defined Networking (SDN)
solutions. SDN is mainly about splitting the Network Problem into more manageable pieces by defining
higher level abstractions. The proposed three-layered architecture consists of the specification, the network
operating system and the forwarding layer. The key here is that the network configuration is derived from the
global network state. It is also worth pointing out that SDN does not equal OpenFlow, which is only one of
the possible implementations for the forwarding layer. In reality, the forwarding layer is usually a mix of
non-OpenFlow and OpenFlow devices.
The Specification Layer (more commonly referred to as the Service Layer) provides an interface for
operators and applications:
It hides the complexities of distributed systems (networks).
Utilizes a model-to-model mapping taking high-level concepts to specific device objects. It uses
models to describe services. These models are mapped to device models which provides a full service to
device mapping.
It is transactional in order to protect operators and applications from having to deal with the
complexities of error recovery and activation orchestration.
The Forwarding Layer can be controlled through OpenFlow or traditional protocols like Cisco CLI, Simple
Network Management Protocol (SNMP) etc:
In reality this is a mix of traditional and OpenFlow devices.
Speaking multiple device protocols is key in real networks.
All device behaviors are described with device data models.
Multivendor
Physical and/or
Virtual Device
Environment
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 6
Cisco NSO implements the Service Layer, the Network Operating System Layer and it also communicates
with the Forwarding Layer using either OpenFlow or through traditional means like CLI, SNMP or even
Remote Procedure Call (RPC). Cisco NSO uses components called Network Element Drivers to implement
this southbound communication. Northbound, that is towards operators or applications, the NSO is able to
speak a variety of different protocols. Regardless of the communication method, the Cisco NSO provides an
abstract network view to the operators and/or applications.
The power of Cisco NSO lies in its model-to-model mapping principles. It is able to describe complex
services at the Service Layer and map those services to device models, which represent different devices
from different vendors. This way, complex services can be described and implemented in a simple way and
pushed to the devices without having to worry about device vendor, configuration semantics, configuration
interfaces, etc.
1-38 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
NSO Architectural Components
OSS/BSS Network EMS/NMS
Engineer
NETCONF REST CLI WebUI SNMP
NSO JAVA/JavaScript Northbound APIs
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 7
The logical architecture outlines the Cisco NSO two-layered approach: a device manager that simplifies
device interface integration and manages device configuration scenarios, and a service manager that applies
service changes to devices. At the core of Cisco NSO is the configuration datastore, Configuration Database
(CDB), which is in sync with the actual device and service configuration. It also manages relationships
between services and devices and can handle revisions of device interfaces.
Cisco NSO addresses the mapping from a desired service configuration to the corresponding device
configuration through a dedicated mapping layer.
The network can be a mix of traditional equipment, virtual devices and OpenFlow switches. The latter
requires the Cisco NSO TailFlow module which is a distributed OpenFlow controller cluster.
A A
B B
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 8
The figure illustrates one of the more complex service implementations where we can use Cisco NSO to
dynamically chain network service. The figure illustrates two service instances:
Service A: end user resources are connected to the Internet using a traffic shaper, and IDS and a
firewall.
Service B: end user resources are connected to the Internet using a content filtering appliance and a
WAN accelerator.
Cisco NSO enables the dynamic addition or removal of service in the service chain. Furthermore, such
services can be implemented using physical or virtual devices (or a combination).
1-40 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Cisco NSO Architecture (Cont.)
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 9
The Cisco NSO Core engine handles fundamental functions like transactions, high availability replication,
upgrades/downgrades etc. All Cisco NSO operations are handled within the transaction manager. Cisco NSO
Core engine functionality can be summarized by the following:
The transaction manager handles nested transactions between services and devices, and is capable to
roll-back service configurations across multiple devices.
All NSO operations passes through a centralized AAA engine which handles authentication and session
management.
Role based access control can be defined at any granularity level.
When high availability is enabled in ncs.conf CDB automatically replicates data written on the master to
the connected slave nodes. Replication is done on a per-transaction basis to all the slaves in parallel. It
can be configured to be done asynchronously (best performance) or synchronously in step with the
transaction (most secure).
All activities are logged in an audit log.
NSO runs its own internal semantic and syntactic validation against the model constraints.
NSO provides transaction rollback and saves configurations rollbacks in separate files.
The Core engine also handles upgrades and downgrades.
Device Manager
Handles device Service models map to FASTMAP algorithm
configurations device configurations: controls and optimizes
Configuration templates (XML) southbound configuration
Device configuration actions:
framework defined using Java or Python code
Create
YANG data models from
NEDs Modify
Delete
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 11
The purpose of the Device Manager is to manage different devices using a clean YANG and Network
Configuration Protocol (NETCONF) view. Irrespective of underlying interface such as SNMP or CLI, the
device manager will provide a transactional view towards the devices. Users or programmers can then
configure the devices and read operational data from the devices in a unified way. When the device supports
YANG and NETCONF natively, the device manager is totally automatic. Non-NETCONF devices are
integrated using the Network Element Driver (NED) toolkit.
The Device Manager supports the following overall features:
Quickly provision a new device by copy-and-edit either from other the configuration of another device
or from a template configuration.
Deploy configuration changes to multiple devices in a fail-safe way using distributed transactions.
Validate the integrity of configurations before deploying to the network.
Apply configuration changes to named device groups.
Apply templates (with variables) to named device groups.
Easily roll back changes, if needed.
Configuration audits: Check if device configurations are in synch with the Cisco NSO database. If they
are not, what is the diff?
Synchronize the Cisco NSO database and the configurations on devices, in case they are not in synch.
This can be done in either direction (import the diff to the Cisco NSO database or deploy the diff on
devices).
Automatic and code-free integration to NETCONF (e.g., Juniper), Cisco-style CLI, and SNMP devices.
Limited amount of code to other proprietary interfaces.
1-42 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Service Manager
Service modeling using Service activation Service testing
YANG Service modification Aggregated operational data
Mapping to device models Service decommissioning
using templates (XML)
and/or Java or Python Service restoration
code Service synchronization
with device configurations
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 12
The Service Manager lets you develop service-aware applications, such as IPTV or Multiprotocol Label
Switching (MPLS) VPNs that configure devices. In this case the data models for the services are not defined
by the devices but they are the result of a modeling activity. Apart from the YANG modeling activity to
define the model, the model needs to be mapped into the corresponding device operations. In most cases this
is done by specifying configuration templates that transforms service parameters to device configuration
parameters. This can also be done programmatically "Mapping Logic" for more complex cases. Both of the
above approaches uses Cisco NSO FASTMAP (explained later), in order to simplify the mapping and also
handling the complete life-cycle such as modifying and deleting service instances.
The Service Manager addresses the following challenges:
Modeling of services.
Dynamic update of user and programmatic northbound interfaces from the service model without other
inputs.
Short development and turn-around time for new services.
Mapping the service model to device models.
Validation of service configuration.
Transaction-safe activation of services across different devices.
What-if scenarios, (dry-run), showing the effects on the network for a service creation/change.
Maintaining relationships between services and corresponding device configurations and vice versa.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 13
Templates is a flexible and powerful mechanism in Cisco NSO which simplifies how changes can be made
across the configuration data and also allows a declarative way to describe such manipulations. Templates
can be applied in a traditional "fire-and-forget" fashion by using them in actions, or through Cisco NSO
FASTMAP using templates as part of a service implementation. When a template is used as part of a service
implementation Cisco NSO remembers the configuration changes made towards the devices and the template
changes can for example be reverted.
Two different types of templates exist:
device-templates: these templates are part of the NSO configuration. Device-templates are created and
changed in the tree /devices/template/config the same way as any other configuration data and are
affected by rollbacks and upgrades. Device-templates can only manipulate configuration data in the
/devices/device/config tree i.e. only device data.
config-templates: these templates get loaded as part of packages. The config-templates are stored in
XML files in the templates sub directory of a package. Config-templates can be used to update any part
of the configuration.
1-44 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Mapping Logic
Service
Parameters
Transforms the service models to device models
When templates are not enough:
External call-outs can be made
Java or Python
Expressions or algorithms in Java or Python code can be used code (optional)
Uses FASTMAP
1 page of code for a complex service
Configuration
NETCONF REST CLI SNMP
NSO Template (XML)
Service Service Templates
Models Manager
Mapping Logic
Device Device
Device
Models Manager FASTMAP
CDB Configuration
NED NED NED
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 14
Mapping logic includes mechanisms for how service related operations are reflected on the devices. This
involves mapping a service operation to available operations on devices. For example, when you add an
access link to a VPN, how is this reflected on Customer Edge (CE) and Provider Edge (PE) routers?
The figure on the right illustrates the sequence of events when implementing the service-to-device mapping
logic:
The service parameters are provided by the service manager
Optionally, Java or Python code can be used to map the service parameters to the individual device’s
configuration template or have the parameters calculated by the code or retrieved using some other
means.
The final set of parameters is used to fill in the variables in the device’s configuration template.
The template is fed to the device manager to be optimized and sent down to the devices.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 15
How is the transformation from service models to device models defined? This is normally a complex
problem. It might look easy from a 1000 feet view, but when it comes to the actual configuration values for a
router there are configuration details that need to be well defined. Cisco NSO simplifies this drastically by
use of the FASTMAP algorithm. Typically, an engineer defines a higher level service model representing for
example the VPN service itself and this service shall result in actual device configurations.
FASTMAP enables automatic management of any kind of change and deletion of a service. All change
scenarios and deletion are inferred from a single definition of the creation of the service. The mapping from
the service create to the corresponding device configuration is defined in a high level API or through a
template. The programmer only has to define the service create method. If later on a user changes or deletes
an existing service Cisco NSO calculates the changes.
The result of this is close to magic - at any point in time a user or external client can modify a service and
Cisco NSO will automatically calculate the required minimum diff to the network. Also deleting a service
from the network will automatically clean up all configuration data on the devices. On top of this FASTMAP
automatically enables the following functions:
1. Service dry-run: if I apply this service to the network, what will happen? The output can be shown in a
data-model general way as well as a native CLI, NETCONF etc. output.
2. Service check-sync: is the service configuration in sync with the actual device configuration? This can
detect the case that a network engineer has modified the device configuration by using the native CLI
and that the change is in conflict with a desired service configuration. It can also show the minimum diff
to restore the service.
3. Service re-deploy: generate the minimum diff to restore a service and make it happen in the network.
1-46 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Mapping Logic (Cont.)
Service Device Device
Model Model A Model B
2 x mapping logic
firewall filter ip
to destination
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 16
According to the figure above the mapping needs to transform the service model instance to the device
models. This is done by using either a device template or the NAVU DOM tree data-structures in Java.
Manipulating data-structures is well-known for any programmer. No skills in network management technical
or protocol details are needed. What is needed is of course domain expertise in the service model and how it
is represented in the network.
The template snippet below uses Xpath to select all rule lists in the service model and creates the
corresponding Junos device-model data and sets the three configurables source-address, protocol and
destination-port.
firewall {
filter fw1 {
term "{rule/name}" {
from {
source-address "{source-ip-prefix}";
protocol [ "{protocol}" ];
destination-port [ "{source-port}" ];
}
then {
accept;
}
}
}
}
Cisco NSO uses Configuration Database (CDB) to store its own configuration, the configuration of all
services, as well as a copy of the configuration of all managed devices. CDB is a RAM database, the entire
configuration is kept in RAM at all times. Thus if we use Cisco NSO to manage a large network, we need a
lot of RAM memory. CDB is also persistent, all transactions are written to disk in journal files.
By default, Cisco NSO stores all configuration data in CDB. The alternative is to use an external database as
shown in the examples. Cisco NSO/getting-started/developing-with-Cisco NSO/6- extern-db. There are a
number of advantages to CDB compared to using some external storage for configuration data. CDB has:
A solid model on how to handle configuration data in network devices, including a good update
subscription mechanism.
A networked API whereby it is possible for an unconfigured device to find the configuration data on the
network and use that configuration.
Fast lightweight database access. CDB by default keeps the entire configuration in RAM as well as on
disk.
Ease of use. CDB is already integrated into Cisco NSO, the database is lightweight and has no
maintenance needs. Writing instrumentation functions to access data is easy.
Automatic support for upgrade and downgrade of configuration data. This is a key feature, which is
useful not only when performing actual up/downgrades of Cisco NSO itself. It also greatly simplifies
the development process by allowing individual developers to add/delete items in the configuration
without any impact whatsoever on other developers. This will be fully described later.
1-48 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Alarm Manager device
device
device
object
Manages native alarms and provides: object
object
Extensible alarm-types alarm-type
Alarm
alarm-type model
Configurable mapping to alarm alarm-type
standards
specific-
Northbound SNMP Alarm MIB specific-
specific-
problem
problem
problem
CDB knows device – service mapping
cleared
cleared
active
time time
time time
time time
sev user
sev user
Services sev user
State and model-based text state
correlation rather than text state
Devices text state
notification-based
Resource Operator
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 18
Cisco NSO embeds a generic alarm manager. It is used for managing Cisco NSO native alarms and can
easily be extended with application specific alarms. Alarm sources can be notifications from devices,
undesired states on services detected or anything provided via the Java API.
The alarm manager is accessible over all northbound interfaces. A read-only view including an SNMP alarm
table and alarm notifications is available in an SNMP Alarm MIB. This MIB is suitable for integration to
SNMP based alarm systems.
First of all it is important to clearly define what an alarm means. “An alarm denotes an undesirable state in a
resource for which an operator action is required.” Alarms are often confused with general logging and event
mechanisms, thereby flooding the operator with alarms. In Cisco NSO, the alarm manager shows undesired
resource states that an operator should investigate. Cisco NSO contains other mechanisms for logging in
general. Therefore, Cisco NSO does not naively populate the alarm list with traps received in the SNMP
notification receiver.
Before looking into how Cisco NSO handles alarms it is important to define the fundamental concepts. We
make a clear distinction between alarms and events in general. Alarms should be taken seriously and be
investigated. Alarms have states, they go active with a specific severity, they change severity and they are
cleared by the resource. The same alarm may become active again. A common mistake is to confuse the
operator view with the resource view. The model described so far is the resource view. The resource itself
may consider the alarm cleared. The alarm manager does not automatically delete cleared alarms. An alarm
that has existed in the network may still need investigation. There are dedicated actions an operator can use
to manage the alarm list, for example delete alarms based on criteria's such as cleared and date. These actions
can be performed over all north-bound interfaces.
Northbound APIs
Human interaction:
NSO CLI Network
OSS/BSS EMS/NMS
Engineer
WebUI
Automation integration:
NETCONF REST CLI WebUI SNMP
NETCONF, REST, JSON/RPC NSO
Service Service Templates
Models Manager
Mapping Logic
Monitoring: Device Device
SNMP, NETCONF Models Manager FASTMAP
CDB
NED NED NED
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 20
1-50 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Cisco NSO Server User Interfaces
root@NCS:/opt/ncs/ncs-4.1.1/# ls -l
total 368
Shell drwxr-xr-x 2 root root 4096 Jun 28 12:46 bin
SSH on port 22 -rw-r--r-- 1 root root 140956 Jun 28 12:47 CHANGES
drwxr-xr-x 4 root root 4096 Jun 27 21:36 doc
CLI admin@ncs# show ncs-state version3 root root
drwxr-xr-x 4096 Jun 28 12:46 erlang
SSH on port 2024 version 4.1.1; drwxr-xr-x 3 root root 4096 Jun 28 12:45 etc
admin@ncs# drwxr-xr-x 10 root root 4096 Jun 28 12:50 examples.ncs
WebUI drwxr-xr-x 2 root root 4096 Jun 28 12:46 include
Cisco NSO HTTP on port 8080 drwxr-xr-x 3 root root 4096 Jun 28 12:45 java
Server drwxr-xr-x 5 root root 4096 Jun 28 12:48 lib
-rw-r--r-- 1 root root 128459 Jun 28 12:47 LICENSE
drwxr-xr-x 5 root root 4096 Jun 27 21:34 man
-rw-r--r-- 1 root root 541 Jul 4 14:10 ncsrc
-rw-r--r-- 1 root root 509 Jul 4 14:10 ncsrc.tcsh
drwxr-xr-x 3 root root 4096 Jul 4 14:10 netsim
drwxr-xr-x 17 root root 4096 Oct 28 10:40 packages
-rwxr--r-- 1 root root 17694 Jun 28 12:47 README
drwxr-xr-x 4 root root 4096 Jun 28 12:46 scripts
drwxr-xr-x 3 root root 4096 Jun 28 12:45 src
drwxr-xr-x 4 root root 4096 Jun 28 12:47 support
drwxr-xr-x 3 root root 4096 Jun 28 12:45 var
-rw-r--r-- 1 root root 220 Jun 28 12:47 VERSION
The ncs.conf file contains the server configuration with default management ports
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 21
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 22
At this time we should get familiar with the basics of the Cisco NSO CLI. The Cisco NSO CLI comes in two
flavors to accommodate the existing CLI familiarity of the majority of network operators:
Juniper style CLI
Cisco style CLI
Like most network devices, the Cisco NSO CLI also has two modes of operation:
The operational mode allows us to manage the device and the server. This mode is primarily used by the
operations to monitor and maintain the environment.
The configuration mode allows us to configure the services, devices and the server. This mode is
typically used by service fulfillment within operations, engineering as part of support, etc.
1-52 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Cisco NSO CLI Overview (Cont.)
admin@ncs# ?
Possible completions:
alarms - Alarm management
autowizard - Automatically query for mandatory elements
cd - Change working directory
clear - Clear parameter
cluster - Cluster configuration
compare - Compare running configuration to another configuration or a file
complete-on-space - Enable/disable completion on space
compliance - Compliance reporting
config - Manipulate software configuration information
describe - Display transparent command information
devices - The managed devices and device communication settings
display-level - Configure show command display level
...
Usability characteristics:
Auto-completion using tab or space characters
Question mark for syntax help and command description
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 23
Similar to most network devices' CLIs, you can use auto-completion (space or tab) on commands and use the
question mark to get syntax help.
switch cli
Two modes: operational and configuration (use the config and exit commands to switch between them)
Two CLI styles: Cisco and Juniper (use the switch cli command to switch between them)
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 24
The config command can be used to go from the operational mode into the configuration mode. The exit
command can be used to go back from the configuration mode into the operational mode.
Among other things, the two CLI flavors differ in how they show which mode you are in. The Cisco style
uses the hash sign ("#") to represent the privileged operational mode and the config keyword ("(config)#")
to represent the configuration mode. The Juniper style uses the greater sign (">") to represent the operational
mode and the percent sign ("%") to represent the configuration mode.
The switch cli command can be used to switch between the two CLI styles.
The commit command will commit and deploy the changes in configuration.
The abort (or revert) command will throw away the changes and exit the configuration mode.
The exit command will exit the configuration mode and prompt for commit if there are any changes pending.
1-54 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Packages
This topic describes the concept of packages used in Cisco NSO to manage any custom
additions to the system.
Package Manager
Loads and manages packages Primary package types:
All additions to core NSO functionality Device NED’s
are deployed as packages: Services
Simplifies deployment
Enables Hot-deploy/redeploy/upgrade
NETCONF REST CLI WebUI SNMP
NSO JAVA/JavaScript
Package
Service Templates Manager
Script API
Service
Models Manager
Core Alarm Developer
Mapping Logic Manager API
Engine
Device Device
CDB Notification
Models Manager FASTMAP Receiver ...
Network Element Driver (NED) NED NED NED
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 26
All user code that needs to run in Cisco NSO must be part of a package. A package is basically a directory of
files with a fixed file structure. A package consists of code, YANG modules, and custom WebUI widgets etc.
that are needed in order to add an application or function to Cisco NSO. Packages are a controlled way to
manage loading and versions of custom applications.
Each package consists of a number of components which are located in a dedicated package directory:
The package-meta-data.xml file defines the package components to load by NSO.
The src directory contains the source code for the package including the YANG model and the optional
Java code.
The templates directory contains the XML configuration templates that are used to map service
parameters to device configurations.
1-56 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Package Management
2. Develop package:
Use a text editor or an appropriate IDE to develop the package by modifying and creating
the necessary files (YANG, Java, Python, XML templates)
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 28
The figure illustrates the three main steps in the creation process for a new package:
1. Create a package skeleton using the ncs-make-packages tool.
2. Develop the package by using a text editor or an appropriate IDE to develop the package by modifying and
creating the necessary files (YANG, Java, Python, XML templates)
3. When done, compile the package by issuing the make command in the src subdirectory.
4. Activate the package by issuing the packages reload command in NSO CLI.
Network Services Orchestrator (NSO) knows how to automatically communicate southbound to Network
Configuration Protocol (NETCONF) and Simple Network Management Protocol (SNMP) enabled devices.
By supplying NSO with the YANG models of a NETCONF device, NSO knows the data models of the
device, and through the NETCONF protocol knows exactly how to manipulate the device configuration. This
can be used for a NETCONF enabled device, any device that uses ConfD as management system, or any
other device that runs a compliant NETCONF server. Similarly, by providing NSO with the MIBs for a
device, NSO can automatically manage such a device.
Reality today is that many of the existing devices in current networks do not speak NETCONF and SNMP is
usually mostly used to retrieve data from devices. By far the most common way to configure network
devices is through the CLI. Management systems typically connect over Secure Shell (SSH) to the CLI of the
device and issue series of CLI configuration commands. Some devices do not even have a CLI, and thus
SNMP, or even worse, various proprietary protocols, are used to configure the device. NSO can speak
southbound not only to NETCONF-enabled devices, but through the NED architecture it can speak to an
arbitrary management interface. This is of course not entirely automatic like with NETCONF, and depending
on the type of interface the device has for configuration, this may involve some programming. SNMP
devices can be managed automatically, by supplying NSO with the MIBs for the device, with some
additional declarative annotations. Devices with a Cisco style CLI can be managed by writing YANG models
describing the data in the CLI, and a relatively thin layer of Java code to handle the communication to the
devices. Other types of devices require more coding.
1-58 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
NED in NSO Architecture
NETCONF REST CLI SNMP
NSO
Service Service Templates
Models Manager
Mapping Logic
Device Device
Models Manager FASTMAP
CDB
CLI REST
NETCONF SOAP
over SNMP
over SSH WS
SSH
etc.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 31
The NSO architecture is described in the picture, with a built-in NED for NETCONF, a NED for SNMP, one
NED for Cisco CLIs, and a generic NED for other protocols. The NED is the adaptation layer between the
XML representation of the network configuration contained inside NSO and the wire protocol between NSO
and managed devices. The NETCONF and SNMP NEDs are built in, the CLI NED is entirely model driven,
whereas the generic NED requires a Java program to translate operations on the NSO XML tree into
configuration operations towards the device. Depending on what means are used to configure the device, this
may be more or less complicated.
NSO differentiates between managed devices that can handle transactions and devices that cannot.
PREPARE
In the prepare phase, the NEDs get exposed to all the changes that are destined for each managed device
handled by each NED. It is the responsibility of the NED to determine the outcome here. If the NED replies
successfully from the prepare phase, NSO assumes the device will be able to go through with the proposed
configuration change.
ABORT
If any participants in the transaction reject the proposed changes, all NEDs will be invoked in the abort()
method for each managed device the NED handles. It is the responsibility of the NED to make sure that
whatever was done in the PREPARE phase is undone.
COMMIT
Once all NEDs that get invoked in commit(Timeout) reply ok, the transaction is permanently committed to
the system. The NED may still reject the change in COMMIT. If any NED reject the COMMIT, all
participants will be invoked in REVERT, NEDs that support confirmed commit with a timeout (e.g. Cisco
IOS XR), may choose to use the provided timeout to make REVERT easy to implement.
REVERT
This state is reached if any NED reports failure in the COMMIT phase. Similar to the ABORT state, the
reverse diff is supplied to the NED if the NED has asked for that.
PERSIST
This state is reached at the end of a successful transaction. Here it's the responsibility of the NED to make
sure that if the device reboots, the changes are still there.
1-60 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
NETCONF NED NSO NETCONF REST CLI SNMP
required
Can be used with any device NETCONF XML
supporting NETCONF (e.g. by over SSH Config
incorporating ConfD)
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 33
Having a NETCONF server on a device enables the NSO to communicate directly with the device. No
coding is required to support device configuration. Some, but not all vendor support this capability.
NSO knows how to automatically communicate southbound to NETCONF and SNMP enabled devices. By
supplying NSO with the YANG models of a NETCONF device, NSO knows the data models of the device,
and through the NETCONF protocol knows exactly how to manipulate the device configuration. This can be
used for a NETCONF capable device, any device that uses ConfD as management system, or any other
device that runs a compliant NETCONF server. Similarly, by providing NSO with the MIBs for a device,
NSO can automatically manage such a device using SNMP.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 34
The CLI NED is an entirely model driven way to CLI script towards all Cisco like devices. The basic idea is
that the Cisco CLI engine found in ConfD, can be run in both directions:
A sequence of Cisco CLI commands can be turned into the equivalent manipulation of the internal XML
tree that represents the configuration inside NCS/ConfD. This is the normal mode of operations of
ConfD, run in Cisco mode. A YANG model, annotated appropriately, will produce a Cisco CLI. The
user can enter Cisco commands and ConfD will, using the annotated YANG model, parse the Cisco CLI
commands and change the internal XML tree accordingly. Thus this is the CLI parser and interpreter.
Model driven.
The reverse operation is also possible. Given two different XML trees, each representing a configuration
state, in the ConfD case it represents the configuration of a single device, i.e. the device using ConfD as
management framework, whereas in the NSO case, it represents the entire network configuration, we
can generate the list of Cisco commands that would take us from one XML tree to another. This
technology is used by NSO to generate CLI commands southbound when we manage Cisco like
devices.
1-62 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Generic NED NSO NETCONF REST CLI SNMP
Protocol X
Config
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 35
A generic NED is required when we want to manage a device that neither speaks NETCONF or SNMP, nor
can be modeled so that ConfD - loaded with those models - gets a CLI that looks almost/exactly like the CLI
of the managed device. For example devices that have other proprietary CLIs, devices that can only be
configured over other protocols such as Representation State Transfer (REST), Common Object Request
Broker Architecture (Corba), Extensible Markup Language-Remote Procedure Call (XML-RPC), Simple
Object Access Protocol (SOAP), other proprietary XML solutions, etc. In a manner similar to the CLI NED,
the Generic NED needs to be able to connect to the device, return the capabilities, perform changes to the
device and finally, grab the entire configuration of the device.
The interface that a Generic NED has to implement is very similar to the interface of a CLI NED.
When NSO has calculated a diff for a specific managed device, it will also calculate for CLI NEDs the exact
set of CLI commands to send to the device, according to the YANG models loaded for the device. In the case
of a generic NED, NSO will instead send an array of operations to perform towards the device in the form of
Digital Optical Monitoring (DOM) manipulations. The generic NED class will receive an array of
NedEditOp objects.
1-64 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
NETCONF REST CLI SNMP
NSO
Netsim Service Service Templates
Models Manager
Mapping Logic
Optional add-on to NEDs Device Device
Models Manager FASTMAP CDB
Simulates device’s native CLI NETCONF
CLI
SNMP Generic
NED
NED NED NED
Useful for development and XML
Config
testing
YANG
ConfD
Device NSO normally
Lightweight: enables simulation Model Java for managing a device as
of many devices on a desktop SSH if it were real
CLI
Uses YANG model and ConfD CLI over SSH Config
in reverse to simulate a device’s
Java for
CLI SSH srv. Netsim
Netsim simulating
ConfD
device’s CLI
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 36
The ncs-netsim program is a useful tool to simulate a network of devices to be managed by NSO. It makes it
easy to test NSO packages towards simulated devices. All you need is the NSO NED packages for the
devices that you need to simulate. The devices are simulated with the Tail-f ConfD product.
The figure illustrates some of the currently supported vendors and devices. Note that this is a constantly
growing list bot in the number of vendors, devices and the functionality that is supported by NEDs.
Note that is a device is on the list of supported devices it does not necessarily mean that the NED supports all
the required functionality. It may be required to request from Cisco to add additional support based on the
presented requirements.
1-66 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
NED Development Process
NED Delivery NED Delivery
NED Delivery
Sales Development/ Testing Acceptance /
Analysis / Preparation Iterations (1+n) Support
Input:
Use Case(s) Device(s): Scoping: YANG-model Update
Configuration(s) Requirements Java-code documentation
Userguide(s) Lux-script(s) Delivery server
Access
(remote/VM/physical)*
If support case:
additional logs Planning:
Resources Testing
Estimates QA Acceptance
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 38
The official NED development process has its own development cycle. If a certain device is currently not
supported, a use case for the device is gathered. This stage requires device configuration access. The new
NED will cover device functionality required to deliver a certain business case and will normally not cover
all available functions of a device. The result of the development process is a device YANG model, some
Java code and scripts. These need to be thoroughly tested and the NEDs need to go through a Quality
Assurance phase before they are put into production environment.
Note If there is a need to develop a new NED, the best way to go about is to contact Cisco NSO team. Most
likely the work required will need supervision and support from experienced NED developers.
References
For additional information, refer to these resources:
Cisco NSO documentation and manual pages.
1-68 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Lesson 1-3
NETCONF Overview
Overview
This lesson provides an overview of the standard Network Configuration Protocol (NETCONF)
that can be used to manage network devices.
Objectives
Upon completing this lesson, you will be able to meet these objectives:
Understand the challenges of network management in complex and mixed environments
Understand the benefits of NETCONF in mitigating the management challenges
Understand the main NETCONF concepts
Challenges of Network Management
This topic describes some of the main challenges of network management.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 4
The figure illustrates a typical service provider network environment where there may be a number of
network devices from different vendors and of different types and software versions. This significantly adds
to the complexity of managing services supported by the devices.
1-70 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Network Management Challenges
?
Device 1: Device 2: Device 3: Device 4: Device 1233:
Vendor A Vendor A Vendor A Vendor B Vendor W
Model X Model X Model Y Model Z Model T
Version 1.2 Version 1.4 Version 1.3 Version 9.5 Version F
A network management solution and the operator must be aware of the complexity of the network:
Learn all management interfaces.
Understand the capabilities and limitations of each device group.
Ensure consistency and reliability of configurations.
Backup configurations (and restore if/when needed).
Provides a network topology view at best, lacking services view.
SNMP!
Simple Network Management Protocol (SNMP) is an old protocol that was designed for network
management. In reality, SNMP is typically only used for network monitoring.
The SNMP is not so “Simple” and has severe limitations. Today it’s being mainly used to poll the network
on statuses not so much for configuring devices let stand end-to-end services.
1-72 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Network Management Solution – Take 2
© 2014 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 7
In fact, there were many other “takes” on this challenge such as Common Management Information Protocol
(CMIP), SNMP, Common Object Request Broker Architecture (CORBA), Common Information Model
(CIM), Simple Object Access Protocol (SOAP), Representation State Transfer (REST), etc. All of these
never resulted in a widespread use for network management across different vendors and platforms.
The IETF used a different approach by inviting service providers to the table and enquiring what they (as
operators) would expect from a good network management system. This resulted in the creation of RFC 3535
which summarizes a number of requirements for network management.
1-74 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
10. It is highly desirable that text processing tools such as diff, and version management tools such as
revision control system (RCS) or concurrent versions system (CVS), can be used to process
configurations, which implies that devices should not arbitrarily reorder data such as access control lists.
11. Typical requirements are a role-based access control model and the principle of least privilege, where a
user can be given only the minimum access necessary to perform a required task.
12. It must be possible to do consistency checks of access control lists across devices.
13. It is important to distinguish between the distribution of configurations and the activation of a certain
configuration. Devices should be able to hold multiple configurations.
14. SNMP access control is data-oriented, while CLI access control is usually command (task) oriented. As
such, it is a requirement to support both data-oriented and task-oriented access control.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 9
The typical current network management environment has the following characteristics:
Per-vendor and/or per service management systems.
Lack of integration between the systems.
Complex and costly to understand and manage the environment (operations is more costly than the
systems that are being managed).
One of the requirements set forth in RFC 3535 is to make management transaction oriented and network
wide:
Make devices transparent to the operator.
Use transactions for provisioning.
Provide automation and reliability (verification, rollback capabilities).
1-76 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Network Management Solution – Take 2
Service Models
YANG
NETCONF
NETCONF!
Analysis of
Operators Ongoing RFC 4741 6241
existing
RFC 3535 standards
management RFC 5539
Vendors protocols
development
…
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 10
The findings of RFC 3535 resulted in the creation of a new standard protocol for network management –
NETCONF. The figure illustrates the approach where the standard protocol provides configuration
management across a variety of devices (different vendors, platforms, software versions).
The NETCONF protocol provides mechanisms to install, manipulate, and delete the configuration of network
devices. It uses an Extensible Markup Language (XML)-based data encoding for the configuration data as
well as the protocol messages. The NETCONF protocol operations are realized as remote procedure calls
(RPCs).
The NETCONF protocol defines a simple mechanism through which a network device can be managed,
configuration data information can be retrieved, and new configuration data can be uploaded and
manipulated. The protocol allows the device to expose a full, formal application programming interface
(API). Applications can use this straightforward API to send and receive full and partial configuration data
sets.
The NETCONF protocol uses a remote procedure call (RPC) paradigm. A client encodes an RPC in XML
and sends it to a server using a secure, connection-oriented session. The server responds with a reply
encoded in XML. The contents of both the request and the response are fully described in XML document
type definitions (DTDs) or XML schemas, or both, allowing both parties to recognize the syntax constraints
imposed on the exchange.
A key aspect of NETCONF is that it allows the functionality of the management protocol to closely mirror
the native functionality of the device. This reduces implementation costs and allows timely access to new
features. In addition, applications can access both the syntactic and semantic content of the device's native
user interface.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 11
In order to achieve the goals set forth in RFC 3535, we should use the new approach by managing network
devices using NETCONF and designing services using YANG data modeling language.
A growing number of major vendors (e.g. Cisco, Juniper, Brocade, Ericsson, Huawei …) already support
NETCONF to some degree and the support is growing continuously as the service providers increasingly
make NETCONF a requirement in their projects.
1-78 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Introduction to NETCONF
This topic describes the benefits of NETCONF in mitigating the management challenges.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 13
NETCONF uses a simple RPC-based mechanism to facilitate communication between a client and a server.
The client can be a script or application typically running as part of a network manager. The server is
typically a network device.
A NETCONF session is the logical connection between a network administrator or network configuration
application and a network device. Global configuration attributes can be changed during any authorized
session, and the effects are visible in all sessions. Session-specific attributes affect only the session in which
they are changed.
The main advantages of NETCONF are:
Sessions use encrypted and efficient transport: XML content transported over Secure Shell (SSH) over
TCP.
Messages use XML which allows the framework to be augmented (e.g. new RPC types or new table
columns without breaking existing applications).
NETCONF is transactional which means that configuration changes happen using the all-or-nothing and
all-at-once approach which simplifies network management applications.
NETCONF is network-wide which means that a transaction can address multiple network elements in
parallel.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 14
The additional characteristic of the NETCONF / YANG approach is that the entire stack representing the
management solution is standardized:
XML for data encoding
YANG for data modeling
XPaths for data referencing
1-80 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Comparison: SNMP vs. NETCONF
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 15
The final significant advantage of NETCONF over SNMP is that it is oriented at service management (i.e.
and atom of configuration is a service and not an individual attribute).
1-82 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Four Properties That Define a Transaction: ACID
Atomicity:
Transactions are indivisible, all-or-nothing
Consistency:
Transactions are all-at-once
No internal order inside a transaction, it is a set of changes, not a sequence
Implies that { create A, create B } and { create B, create A } are identical
Systems behaving differently with respect to the sequence are not transactional
Independence:
Parallel transactions do not interfere with each other
Transactions appear to happen always-in-sequence
Durability:
Persistent configuration even in the case of a fail-over, failure, restart, etc.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 17
Atomicity
Transactions are indivisible and are implemented using the "all-or-nothing" approach. If and individual
action fails, the entire transaction is reverted back to the previous state.
Consistency
Transactions are also implemented all at once. There is no internal order inside a transaction, it is a set of
changes, not a sequence (e.g. actions { create A, create B } and { create B, create A } are identical).
Independence
Parallel transactions do not interfere with each other and transactions appear to happen always-in-sequence.
Durability
Persistent configuration even in the case of a fail-over, failure, restart, etc.
Transaction A Transaction B
⇔
Add interface eth5
over interface eth5
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 18
One of the requirements for NETCONF is that the independent of internal order. The actual order of the
configuration commands may be important, but the order should not burden the management system.
1-84 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Transactions: Configuration Backup and Restore
Backup Restore
Read the configuration Send the saved configuration
Manager does not need to know which No need to sort data
elements are configuration All-or-nothing semantics
Save result to a file No PDU size limit
Human readable XML file
Use diff and other XML processing tools
Edit file, if desired
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 19
Transactions should provide for simple bulk configuration operation such as backing up the configuration or
restoring from backup. The configuration should be available in a text format (e.g. XML encoded).
The main goal of transaction-based network-wide management is to make the configuration building blocks
transparent and only expose the service parameters to the management system and operator. The operations
support system (OSS) takes care of takes care of the rest by mapping the service model to individual device
configuration snippets that are part of the same transaction.
The process of configuration deployment may go through several validation steps (on OSS, on device before
deployment, on device after deployment). A transaction will revert to a previous state if any of the individual
components failed to deploy.
1-86 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Transactions
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 21
Network-wide transactions are the most important leap in network management technology since SNMP. No
error recovery and sequencing tasks are needed on the manager side. This is usually more than half the cost
in a mature system; more than the entire cost of the managed devices.
NETCONF Transport
The figure illustrates the important three components that comprise a NETCONF session:
NETCONF that encodes messages using XML.
SSH to provide secure communication between client and server.
TCP to provide reliability to the communications between client and server.
1-88 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
NETCONF Extensibility
<hello>
Version negotiation
<capabilities>
<capability>urn:ietf:params:netconf:base:1.1</capability>
Capability negotiation
<capability>urn:ietf:params:netconf:capability:writable-running:1.0</capability>
<capability>urn:ietf:params:netconf:capability:candidate:1.0</capability>
<capability>urn:ietf:params:netconf:capability:confirmed-commit:1.0</capability>
Supported subset of
<capability>urn:ietf:params:netconf:capability:xpath:1.0</capability> capabilities used
<capability>urn:ietf:params:netconf:capability:validate:1.0</capability>
<capability>urn:ietf:params:netconf:capability:rollback-on-error:1.0</capability> Extensions go in
<capability>http://tail-f.com/ns/netconf/with-defaults/1.0</capability>
<capability>http://tail-f.com/ns/netconf/actions/1.0</capability>
separate XML
Device namespaces, which
Manager <capability>http://tail-f.com/ns/netconf/commit/1.0</capability>
(server)
(client) <capability>http://tail-f.com/ns/example/dhcpd?module=dhcpd</capability>
makes it easier to build
<capability> ... </capability>
</capabilities> backward compatible
<hello> management
<hello>
<capabilities>
<capability>urn:ietf:params:netconf:base:1.1</capability>
<capability>urn:ietf:params:netconf:capability:candidate:1.0</capability>
<capability> ... </capability>
</capabilities>
</hello>
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 24
By declaring support for a capability in <hello>, the manager will know which operations it can submit to the
Device.
Extensions go in separate XML namespaces, which makes it easier to build backwards and forwards
compatible management applications.
1-90 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
NETCONF Network-Wide Transactions
NETCONF
The figure illustrates how configurations that are part of a transaction are sent to all participating devices.
Each device will use at least one verification step in order to determine if the configuration can be
successfully applied.
Candidate data stores enable the final committing of the configurations on all devices if all devices reported
that the configuration was successfully validated. In case one device reports a failure, the configuration will
not be committed on any device.
<get>
<get-config> A powerful set of operations
<edit-config>
<test-option> (:validate 1.1) Each operation can contain
<error-option>
<operation> (e.g. merge, replace, delete) additional attributes
<copy-config>
<commit> (:candidate, :confirmed) Some operations are only
<discard-changes> (:candidate)
<cancel-commit> (:candidate) available if required capability is
<delete-config>
<lock> supported
<unlock>
<close-session>
<kill-session>
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 27
The NETCONF protocol provides a small set of low-level operations to manage device configurations and
retrieve device state information. The base protocol provides operations to retrieve, configure, copy, and
delete configuration datastores. Additional operations are provided, based on the capabilities advertised by
the device.
The base protocol includes the following protocol operations:
get
get-config
edit-config
copy-config
delete-config
lock
unlock
close-session
kill-session
Refer to section 7 of RFC 6241 for more information about NETCONF commands.
1-92 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
NETCONF Capabilities
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 28
A NETCONF capability is a set of functionality that supplements the base NETCONF specification. The
capability is identified by a uniform resource identifier (URI) [RFC3986].
Capabilities augment the base operations of the device, describing both additional operations and the content
allowed inside operations. The client can discover the server's capabilities and use any additional operations,
parameters, and content defined by those capabilities.
The capability definition might name one or more dependent capabilities. To support a capability, the server
MUST support any capabilities upon which it depends.
Additional capabilities can be defined at any time in external documents, allowing the set of capabilities to
expand over time. Standards bodies can define standardized capabilities, and implementations can define
proprietary ones. A capability URI must sufficiently distinguish the naming authority to avoid naming
collisions.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 29
1-94 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
NETCONF Example (Cont.) Validate
configuration
3.
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.1” message-id="6">
(i.e. commit)
<validate>
<source>
<candidate/>
</source>
</validate>
</rpc> Device
Manager (server)
(client)
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.1“ message-id=“6”>
<ok/>
</rpc-reply> 4.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 30
If the device validates the configuration it will inform the server. A transaction may consist of multiple
devices being configured. If all devices successfully validate the configuration, the transaction is deemed
successful.
If any of the devices reports an error, the Cisco Network Services Orchestrator (NSO) will have to revert the
configurations by not performing the final commit. In the example above, the device reported success so the
NSO sends the final commit which puts the configuration into production.
Network-wide transactions
Applying and testing a configuration
Testing and rejecting a configuration
Rollback when device goes down
Transactions requiring all devices to be up
Backlogging transactions
Synchronizing
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 31
The above list provides some most common usage scenarios for NETCONF:
Network-wide transactions with candidate configurations for better reliability.
Applying and testing a configuration.
Testing and rejecting a configuration.
Rollback of configuration is a device goes down.
Transactions requiring all devices to be up.
Backlogging transactions for delayed deployment.
Synchronizing configurations between client and server.
1-96 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Summary
This topic summarizes the key points that were discussed in this lesson.
IETF standards and recommendations:
RFC 6020 YANG Base Specification
RFC 6087 Guidelines for YANG Authors and Reviewers
RFC 6110 Mapping YANG and Validating NETCONF Content
RFC 6244 NETCONF+Yang Architectural Overview
RFC 6643 Translation of SMIv2 MIBs to YANG
RFC 6991 Common Yang Data Types
RFC 7223 YANG Module for Interface Management
RFC 7224 YANG Module for Interface Types
Other useful sources:
https://datatracker.ietf.org/wg/netmod/charter/
https://www.ietf.org/iesg/directorate/yang-doctors.html
http://www.yang-central.org/
http://www.netconfcentral.org/
References
For additional information, refer to these resources:
Cisco NSO documentation and manual pages
YANG Overview
Overview
This lesson provides an overview of the YANG data modelling language. It is the basis for
Cisco Network Services Orchestrator's service modelling.
Objectives
Upon completing this lesson, you will be able to meet these objectives:
Understand the purpose and value of YANG
Learn YANG fundamentals
Introduction to YANG
This topic introduces the YANG modeling language and shows how it is used when
orchestrating network services.
YANG
"YANG is a data modeling language used to model configuration and state data manipulated by the
Network Configuration Protocol (NETCONF), NETCONF remote procedure calls, and NETCONF
notifications. YANG is used to model the operations and content layers of NETCONF"
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 4
The figure illustrates how YANG sits on top of the Network Configuration Protocol (NETCONF) to translate
a more device-oriented language (NETCONF) to a more human-readable language – YANG. While
NETCONF provides a standardized way of communicating with different types of devices, YANG provides
a framework for describing configurations using a syntax and semantics that is closer to human languages.
The YANG data modelling language is defined by IETF RFC 6020 and is augmented by a number of other
RFCs such as:
RFC-7317 YANG for System Management
RFC-7277 YANG for IP Management
RFC-7224 IANA Intf. Type YANG Module
RFC-7223 YANG for Intf. Management
RFC-6991 Common YANG Data Types
RFC-6536 NETCONF Access Control
RFC-6470 NETCONF Base Notifications
RFC-6244 Architecture for Network Management Using NETCONF and YANG
RFC-6087 Guidelines for YANG Authors
RFC-6022 YANG for NETCONF Monitoring
The figure illustrates the IETF's efforts to standardize management by describing two major components
through the above RFCs. NSO, however, provides a powerful set of Network Element Drivers (NEDs) that
can be used to manage virtually any type of device, even or especially if they do not support NETCONF
(yet). NEDs provide a very flexible addition which is also implemented using YANG.
1-100 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
YANG Characteristics
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 5
include include
Useful to split large modules into smaller
more manageable files
orion.yang aurora.yang
submodule orion { submodule aurora {
Submodule can never be included in any
other module
... ...
Module and submodules share the same
} } namespace
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 6
There MUST NOT be any circular chains of imports or includes. For example, if submodule "a" includes
submodule "b", "b" cannot include "a". When a definition in an external module is referenced, a locally
defined prefix MUST be used, followed by ":", and then the external identifier. References to definitions in
the local module MAY use the prefix notation. Since built-in data types do not belong to any module and
have no prefix, references to built-in data types (e.g., int32) cannot use the prefix notation.
1-102 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
YANG Module Structure
acme.yang
module acme {
namespace "http://acme.example.com/module";
prefix acme; Header Information
organization "ACME Inc.";
description "Module describing the ACME products";
revision 2007-06-09 { description "Initial revision."; } Revision Information
import ietf-yang-types { prefix yang; }
include acme-system; Imports & Includes
typedef percentage-type {
type uint8 { range "1..100"; } Type Definitions
}
grouping ifdata {
leaf ipv4-address {
type inet:ipv4-address;
}
leaf ipv4-mask { Reusable Node
type inet:ipv4-address; Declarations
}
}
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 7
notification link-failure {
description "A link failure has been detected";
leaf if-name { type string; }
leaf if-admin-status { type uint8; }
}
1-104 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Basic YANG Statements Defining Data Nodes
Container Record Contains a single structure containing zero or more values or other
statements (hierarchy)
List Array of Records Contains a list of zero or more sets of values and other statements
(hierarchy)
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 9
The table lists the most basic and common statements used when building a data model:
The leaf statement represents the simplest atom of information – single value of a specific type. This is
similar to scalar variables in programming languages.
The leaf-list statement represents a list of values (zero or more) of the same type. This is similar to an
array of scalar variables in programming languages.
The container statement represents a more relaxed structure that can contain a variety of other types of
statements. The container itself does not hold any value and hence does not have any type. This is
similar to a record definition in programming languages.
The list statement represents a list of records (zero or more). This is similar to an array of records in
programming languages.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 10
The figure above illustrates the hierarchy of a sample YANG model and the properties of individual
statements (data type, multiplicity).
1-106 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
YANG Model Statements and Hierarchy Example
container car {
Statement characteristics:
container v8_engine {
leaf-list cylinder-arrangement { Name
type string;
max-elements 8; Type (e.g. string, uint32)
}
Constraints:
container other-parts {
min-elements
list per-cylinder-parts {
max-elements
leaf piston-diameter {
type uint32; range
range "2000..9000";
} key/unique
container valves { leafref
leaf number { … }
list position { … } must
…
} when
}
Statement content is enclosed within curly
}
brackets
}
} Each sub-statement is terminated by semicolon
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 11
The figure illustrates the same example as on the previous page with the addition of YANG code that
represents a fictitious data model to describe a V8 engine and its parts.
The example illustrates the use of the previously described statements with the addition of data types and
syntax:
Each statement is identified by a case-sensitive name.
Each basic statement must be terminated by a semicolon.
A complex statements that contains other statements, modifiers, constraints or any other type of
substatement, is enclosed within curly brackets.
Each leaf and leaf-list statement require the definition of the data type using the type keyword.
Additionally, data types can be constrained using keywords, such as range, max-elements, min-
elements, etc.
YIN
XML representation of YANG
Enables developers to use the rich set of XML-based tools for data
filtering and validation, automated generation of code and documentation,
and other tasks
ASCII tree
Enables visualization of the data model hierarchy in a terminal window
HTML collapsible tree
Enables visualization and browsing of the data model hierarchy in a web
browser
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 13
The YANG and YIN formats contain equivalent information using different notations. The YIN notation
enables developers to represent YANG data models in XML and therefore use the rich set of XML-based
tools for data filtering and validation, automated generation of code and documentation, and other tasks.
Tools like Extensible Stylesheet Language Transformations (XSLT) or XML validators can be utilized.
The mapping between YANG and YIN does not modify the information content of the model.
There is a one-to-one correspondence between YANG keywords and YIN elements. The local name of a
YIN element is identical to the corresponding YANG keyword. This means, in particular, that the document
element (root) of a YIN document is always <module> or <submodule>.
Additionally, it may be useful to convert a YANG model to a hierarchical representation such as a
collapsible HTML version that can be explored using a web browser, or a text version that can be inspected
when using a command line.
1-108 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Converting from YANG to Other Formats
Use the pyang tool for validation, conversion or visualization of YANG:
Convert to YIN: pyang -f yin
Convert to a collapsible tree in HTML: pyang -f jstree
Convert to an ASCII tree: pyang -f tree
list loopback-interface { <list name="loopback-interface"> +--rw loopback-interface*
key Loopback; <key value="Loopback"/> [Loopback]
unique ip-address; <unique tag="ip-address"/> +--rw Loopback string
<leaf name="Loopback"> +--rw ip-address? uint32
leaf Loopback { <type name="string"/>
type string; </leaf> Note! The input must be a valid
} <leaf name="ip-address">
<type name="uint32"/> module file. Below are just partial
leaf ip-address { </leaf> examples.
type uint32; </list>
}
}
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 14
A handy Python tool called pyang is available to perform the following three useful functions:
Convert YANG to YIN (shown in the example above).
Convert YANG to an HTML file that contains a collapsible tree representing the data model. This is
especially useful in large and complex models where a basic editor is no longer the best choice for
viewing and editing the YANG data model. In this case it is recommended to use a dedicated YANG
IDE that supports a collapsible tree view. Alternatively, you can use pyang to convert the YANG file to
an HTML file and view the collapsible data model tree using any browser that supports JavaScript.
Convert YANG to a text file where the hierarchy is illustrated using ASCII characters (shown above).
The pyang tool supports many other operations (use pyang --help or man pyang to learn about them).
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 16
The YANG model can use the following sources for data types:
Built-in data types: YANG has a set of built-in types, similar to those of many programming
languages, but with some differences due to special requirements from the management domain.
RFC-defined data types: RFC 6991 defines additional data types described later.
Custom data types: custom data types can be defined as part of the data model or they may be available
by importing other modules that contain additional data type definitions (e.g. Cisco NSO comes with a
set of additional data types that come in useful when describing device or service configurations).
1-110 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
YANG Supports a Number of Data Types
Built-in Types Derived Types
Name Description typedef my-base-int32-type {
type int32 {
int8/16/32/64 Integer range "1..4 | 10..20";
}
uint8/16/32/64 Unsigned integer }
decimal64 Non-integer
typedef derived-int32 {
string Unicode string type my-base-int32-type {
range "11..max";
enumeration Set of alternatives }
boolean True or false }
The following table lists the built-in data types as defined in RFC 6020.
Data Type Name Description
binary Any binary data
bits A set of bits or flags
Boolean true or "false"
decimal64 64-bit signed decimal number
Empty A leaf that does not have any value
enumeration Enumerated strings
Identityref A reference to an abstract identity
instance-identifier References a data tree node
int8 8-bit signed integer
int16 16-bit signed integer
int32 32-bit signed integer
int64 64-bit signed integer
leafref A reference to a leaf instance
string Human-readable string
uint8 8-bit unsigned integer
uint16 16-bit unsigned integer
uint32 32-bit unsigned integer
uint64 64-bit unsigned integer
union Choice of member types
Custom or derived data types are created using the typedef keyword.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 18
In addition to the built-in data types, you can import modules that contain additional data type definitions.
There are two standard modules that contain data types defined in RFC 6991:
IETF YANG data types
IETF Inet data types
The following table lists the YANG data types defined in RFC 6991:
Data Type Name Description
counter32 Counter32 (SNMPv2-SMI)
zero-based-counter32 ZeroBasedCounter32 (RMON2-MIB)
counter64 Counter64 (SNMPv2-SMI)
zero-based-counter64 ZeroBasedCounter64 (HCNUM-TC)
gauge32 Gauge32 (SNMPv2-SMI)
gauge64 CounterBasedGauge64 (HCNUM-TC)
object-identifier -
object-identifier-128 OBJECT IDENTIFIER
yang-identifier -
date-and-time -
timeticks TimeTicks (SNMPv2-SMI)
timestamp TimeStamp (SNMPv2-TC)
phys-address PhysAddress (SNMPv2-TC)
mac-address MacAddress (SNMPv2-TC)
xpath1.0 -
hex-string -
uuid -
dotted-quad -
1-112 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Common YANG Data Types (RFC 6991) (Cont.)
IETF INET Types Using Types
Name Description import ietf-inet-types {
IP protocol version: 1=IPv4, 2=IPv6, 0=unknown
prefix inet;
ip-version
}
dscp Differentiated Services Code Point value: 0 to 63
ipv6-flow-label 32-bit integer in the range from 0 to 1048575
port-number 16-bit integer in the range from 0 to 65535
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 19
The following table lists the Inet data types defined in RFC 6991:
Data Type Name Description
ip-version InetVersion (INET-ADDRESS-MIB)
dscp Dscp (DIFFSERV-DSCP-TC)
ipv6-flow-label IPv6FlowLabel (IPV6-FLOW-LABEL-MIB)
port-number InetPortNumber (INET-ADDRESS-MIB)
as-number InetAutonomousSystemNumber (INET-ADDRESS-MIB)
ip-address IPv4 or IPv6 address
ipv4-address IPv4 address
ipv6-address IPv6 address
ip-address-no-zone -
ipv4-address-no-zone -
ipv6-address-no-zone -
ip-prefix -
ipv4-prefix -
ipv6-prefix -
domain-name -
host -
uri Uri (URI-TC-MIB)
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 20
Range
The range statement, which is an optional substatement to the type statement, takes as an argument a range
expression string. It is used to restrict integer and decimal built-in types, or types derived from those. A range
consists of an explicit value, or a lower-inclusive bound, two consecutive dots "..", and an upper-inclusive
bound. Multiple values or ranges can be given, separated by "|". If multiple values or ranges are given, they
all must be disjoint and must be in ascending order. If a range restriction is applied to an already range-
restricted type, the new restriction must be equal or more limiting, that is raising the lower bounds, reducing
the upper bounds, removing explicit values or ranges, or splitting ranges into multiple ranges with
intermediate gaps. Each explicit value and range boundary value given in the range expression must match
the type being restricted, or be one of the special values min or max. The min and max keywords mean the
minimum and maximum value accepted for the type being restricted, respectively.
More detail available in section 7.2.4 of RFC 6020.
Length
The length statement, which is an optional substatement to the type statement, takes as an argument a length
expression string. It is used to restrict the built-in type string, or types derived from string. A length
statement restricts the number of Unicode characters in the string. A length range consists of an explicit
value, or a lower bound, two consecutive dots "..", and an upper bound. Multiple values or ranges can be
given, separated by "|". Length-restricting values must not be negative. If multiple values or ranges are given,
they all must be disjoint and must be in ascending order. If a length restriction is applied to an already length-
restricted type, the new restriction must be equal or more limiting, that is, raising the lower bounds, reducing
the upper bounds, removing explicit length values or ranges, or splitting ranges into multiple ranges with
intermediate gaps. A length value is a non-negative integer, or one of the special values min or max. The
min and max mean the minimum and maximum length accepted for the type being restricted, respectively.
An implementation is not required to support a length value larger than 18446744073709551615.
More detail available in section 9.4.4 of RFC 6020.
1-114 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Pattern
The pattern statement, which is an optional substatement to the type statement, takes as an argument a
regular expression string, as defined in [XSD-TYPES]. It is used to restrict the built-in type string, or types
derived from string, to values that match the pattern.
If the type has multiple pattern statements, the expressions are ANDed together, i.e., all such expressions
have to match. If a pattern restriction is applied to an already pattern-restricted type, values must match all
patterns in the base type, in addition to the new patterns.
More detail available in section 7.2.4 of RFC 6020 and http://www.w3.org/TR/2004/REC-xmlschema-2-
20041028/#regexs.
More detail available in section 9.4.6 of RFC 6020.
Fraction Digits
The fraction-digits statement, which is a substatement to the type statement, must be present if the type is
decimal64. It takes as an argument an integer between 1 and 18, inclusively. It controls the size of the
minimum difference between values of a decimal64 type, by restricting the value space to numbers that are
expressible as "i x 10^-n" where n is the fraction-digits argument.
More detail available in section 9.3.4 of RFC 6020.
typedef intf-ip-addr-type {
Enumeration: type union {
type inet:ip-address;
Defines a set of names type enumeration {
enum "none";
Union: enum "unnumbered";
enum "dhcp";
Used to define a type with a combination of }
}
two or more other types }
typedef acl-id-type {
type union {
type acl-num-type;
type acl-name-type;
}
}
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 21
Enumeration
The enumeration built-in type represents values from a set of assigned names. An enumeration cannot be
restricted.
The enum statement, which is a substatement to the type statement, must be present if the type is
enumeration. It is repeatedly used to specify each assigned name of an enumeration type. It takes as an
argument a string which is the assigned name. The string must not be empty and must not have any leading
or trailing whitespace characters. The use of Unicode control codes should be avoided.
Union
The union built-in type represents a value that corresponds to one of its member types. When the type is
union, the type statement must be present. It is used to repeatedly specify each member type of the union. It
takes as an argument a string that is the name of a member type. A member type can be of any built-in or
derived type, except it must not be one of the built-in types empty or leafref. When a string representing a
union data type is validated, the string is validated against each member type, in the order they are specified
in the type statement, until a match is found. Any default value or units property defined in the member
types is not inherited by the union type.
1-116 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
YANG Types Example
// percentage type // DSCP type
typedef percentage-type { typedef dscp-type;
type uint8 { type union;
range "1..100"; type uint8 { range "0..63"; }
} type enumeration {
} enum af11;
enum af12;
// Weekday type enum af13;
typedef weekday-type { enum af21;
type enumeration { enum af22;
enum Mon; enum af23;
enum Tue; enum af31;
enum Wed; enum af32;
enum Thu; enum af33;
enum Fri; enum af41;
enum Sat; enum af42;
enum Sun; enum af43;
} enum cs1;
} enum cs2;
enum cs3;
// Hour & minute & optional second type enum cs4;
typedef hhmm-type { enum cs5;
type string { enum cs6;
pattern '([0-1]?[0-9]|2[0-4]):' + enum cs7;
'([0-5][0-9])(:[0-5][0-9])?'; enum default;
} enum dscp;
} enum ef;
enum precedence;
// Route Distinguisher AS:NUM or IP:NUM }
typedef rd-type { }
type string { }
pattern '((\d+)((\.\d+){3})?)\:\d+';
}
}
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 22
The example illustrates how custom data types can be created to serve the requirements of a service model.
The example contains the following data types:
Percentage where the value is limited to a range between 0 and 100.
Weekday definitions using abbreviations to three characters.
Time format that can contain hours and minutes and optionally seconds.
Route distinguisher type that can use IP-address-based or AS-number-based format.
Differentiated Services Code Point (DSCP) that can use names or numbers to represent the 64 possible
values.
1 3 7 5 8 3
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 24
The first four statements are used to model the data hierarchy and type. The leafref is used to link to data
elsewhere in the model and the grouping is used to create reusable chunks of code.
1-118 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Data Model and Data Visualization
Data model: Sample data:
YANG XML:
<loopback-ipv4>
XPath to reference data in the hierarchy: <loopback>1</loopback>
<ip-address>10.1.1.1</loopback>
/ loopback-ipv4 </loopback-ipv4>
/ loopback-ipv4 / loopback <loopback-ipv4>
/ loopback-ipv4 / ip-address <loopback>2</loopback>
<ip-address>10.2.2.2</loopback>
</loopback-ipv4>
Graphic visualization of hierarchy and data
type:
Table:
Leaf T Typedef 192.0.2.213 16772
198.51.100.22 19234
L Leaf-list G Grouping
203.0.113.89 22315
L List K Key Leaf
These methods are used throughout the course to
C Container R Leafref help with understanding of YANG data modeling.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 25
The figure above describes the visual tools that are used throughout this course to help with the
understanding of the different YANG constructs:
The graphic boxes provide the essential information about the type of statements. This method is useful
to visualize the hierarchy of the data model and the type of data.
Alternatively, the data (model) hierarchy can be represented using XPath.
A table is used to illustrate sample data that reflects the data model, data type and constraints.
Alternatively, sample data can also be represented using XML.
loopback XPath:
/ loopback
1
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 26
The leaf statement is used to define a leaf node in the schema tree. It takes one argument, which is an
identifier, followed by a block of substatements that holds detailed leaf information. A leaf node has a value,
but no child nodes in the data tree.
A leaf node exists in zero or one instances in the data tree. The leaf statement is used to define a scalar
variable of a particular built-in or derived type.
More detail is available in section 7.6 of RFC 6020.
1-120 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Leaf Attributes
Attribute Description
Whether this leaf is a configurable value ("true") or operational value ("false"). Inherited from
config
parent container if not specified
default Specifies default value for this leaf. Implies that leaf is optional
mandatory Whether the leaf is mandatory ("true") or optional ("false")
must XPath constraint that will be enforced for this leaf
type The data type (and range etc) of this leaf
when Conditional leaf, only present if XPath expression is true
description Human readable definition and help text for this leaf
reference Human readable reference to some other element or spec
units Human readable unit specification (e.g. Hz, MB/s, ℉)
status Whether this leaf is "current", "deprecated" or "obsolete"
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 27
Attribute: config
The config statement takes as an argument the string true or false. If config is true, the definition represents
configuration. Data nodes representing configuration will be part of the reply to a <get-config> request, and
can be sent in a <copy-config> or <edit-config> request. If config is false, the definition represents state
data. Data nodes representing state data will be part of the reply to a <get>, but not to a <get-config>
request, and cannot be sent in a <copy-config> or <edit-config> request. If config is not specified, the
default is the same as the parent schema node's config value. If the parent node is a case node, the value is
the same as the case node's parent choice node. If the top node does not specify a config statement, the
default is true. If a node has config set to false, no node underneath it can have config set to true.
Attribute: default
The default statement, which is optional, takes as an argument a string that contains a default value for the
leaf. The value of the default statement must be valid according to the type specified in the leaf's type
statement.
Attribute: mandatory
The mandatory statement, which is optional, takes as an argument the string "true" or false, and puts a
constraint on valid data. If not specified, the default is false. If mandatory is true, the behavior of the
constraint depends on the type of the leaf's closest ancestor node in the schema tree that is not a non-presence
container.
Attribute: must
The must statement, which is optional, takes as an argument a string that contains an XPath expression
(discussed later). It is used to formally declare a constraint on valid data. When a datastore is validated, all
must constraints are conceptually evaluated once for each data node in the data tree, and for all leafs with
default values in use. If a data node does not exist in the data tree, and it does not have a default value, its
must statements are not evaluated. All such constraints must evaluate to true for the data to be valid.
Attribute: type
The data type as described earlier (built-in or derived).
1-122 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Leaf-List
L loopback
XPath:
1 / loopback
2
101
102
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 28
Where the leaf statement is used to define a simple scalar variable of a particular type, the leaf-list statement
is used to define an array of a particular type. The leaf-list statement takes one argument, which is an
identifier, followed by a block of substatements that holds detailed leaf-list information. The values in a leaf-
list must be unique.
In the example above, we see a list of leaf values of the type int32 which are limited to a range between 0
and 2147483647. These are the valid number in Cisco IOS to number loopback interfaces. The table
illustrates four loopback numbers – 1, 2, 101 and 102, which are also shown in XML format.
More detail available in section 7.7 of RFC 6020.
The container statement is used to define an interior data node in the schema tree. It takes one argument,
which is an identifier, followed by a block of substatements that holds detailed container information. A
container node does not have a value, but it has a list of child nodes in the data tree. The child nodes are
defined in the container's substatements.
In the example we see an expansion to the previous example where we define two parameters to represent a
loopback interface:
Loopback interface number
Loopback interface's IP address
The table shows one instance of the container that describes loopback1 having IP address 10.1.1.1.
More detail available in section 7.5 of RFC 6020.
1-124 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
List
L loopback-ipv4 XPath:
/ loopback-ipv4
K loopback ip-address / loopback-ipv4 / loopback
/ loopback-ipv4 / ip-address
1 10.1.1.1
2 10.2.2.2
YANG (data model) XML (data)
list loopback-ipv4 { <loopback-ipv4>
key loopback; <loopback>1</loopback>
unique ip-address;
leaf loopback { <ip-address>10.1.1.1</loopback>
type int32 { </loopback-ipv4>
range "0..2147483647"; <loopback-ipv4>
} <loopback>2</loopback>
} <ip-address>10.2.2.2</loopback>
leaf ip-address { </loopback-ipv4>
type inet:ipv4-address
}
}
The list statement is used to define an interior data node in the schema tree. A list node may exist in multiple
instances in the data tree. Each such instance is known as a list entry. The list statement takes one argument,
which is an identifier, followed by a block of substatements that holds detailed list information. A list entry is
uniquely identified by the values of the list's keys, if defined.
The key statement, which must be present if the list represents configuration, and may be present otherwise,
takes as an argument a string that specifies a space-separated list of leaf identifiers of this list. A leaf
identifier must not appear more than once in the key. Each such leaf identifier must refer to a child leaf of
the list. The leafs can be defined directly in substatements to the list, or in groupings used in the list.
The combined values of all the leafs specified in the key are used to uniquely identify a list entry. All key
leafs must be given values when a list entry is created. Thus, any default values in the key leafs or their types
are ignored. It also implies that any mandatory statement in the key leafs are ignored.
A leaf that is part of the key can be of any built-in or derived type, except it must not be the built-in type
empty.
More detail available in section 7.8 of RFC 6020.
The example above illustrates a similar setup as in the previous example using the container statement. This
time the list statement enables many instances of loopback data where uniqueness only requires the loopback
number to be unique (i.e. IP addresses do not have to be unique).
L user
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 31
The example illustrates the usage of the key statement to select the leaf that is used as the unique identifier
for each list entry.
The XPath example shows how data can be referenced using the key values.
1-126 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
List: Combined Key
L route
list user {
Keys refer to leaf statements key "prefix length";
...
Key combinations must be unique }
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 32
This example shows how key combinations can be used define more complex list entry identifiers. In the
example it is required for the prefix and prefix length combination to be unique.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 33
1-128 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
List and Leaf-List Attributes
Attribute Description
max-elements Max number of elements in a list
min-elements Min number of elements in a list
ordered-by List entries are sorted by "system" or "user".
System means elements are sorted in a natural order
(numerically, alphabetically, etc). User means the order
the operator entered them in is preserved.
leaf-list domain-search {
type string; system order user order
ordered-by user; cisco.com example.com
min-elements 1;
example.com
≠ cisco.com
max-elements 2;
}
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 34
Groups of nodes can be assembled into reusable collections using the grouping statement. A grouping
defines a set of nodes that are instantiated with the uses statement.
More detail available in section 4.2.6 of RFC 6020.
The example illustrates the usage of a template (grouping) that is then used twice to describe the IP and TCP
port used for two services. Both services further refine the template by adding their default TCP porta values.
1-130 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Leafref
L services C app
XPath
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 38
XPath is an XML Path Language defined by the W3C. It uses expressions to reference or extract parts of
XML documents. It also contains a number of useful functions for nodes, numbers and strings. Although
there are newer versions of XPath, YANG uses XPath version 1.0.
XPath is often used with Leafrefs when referencing Leaf or Leaf-List values elsewhere in the data tree, with
When and Must statements to add constraints to data model definitions.
1-132 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
XPath Expressions
Expressions address an XML document and return a result that can be:
Node set: multiple elements extracted from the XML document
String: a single string element
Number: a single number element
Boolean: true or false
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 39
Expressions address an XML document and return a result that can be of one of the following type
categories:
Node set: multiple elements extracted from the XML document
String: a single string element
Number: a single number element
Boolean: true or false
The XPath example illustrates how an XPath expression (in the middle) can be used to process an XML
document (on the left) and extract the required result (on the right).
The example extracts IP addresses from all interfaces taken from the configuration of a Cisco IOS router
encoded using XML and according to the device model used by Cisco NSO for Cisco IOS devices.
The example makes use of the following characteristics of XPath expressions:
Use directory-like path to address a hierarchy in the XML document
Use wildcard * to match any element at a given level
Use // to match descendants at any level
1-134 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
XPath Examples: All GE Interface IP Addresses
XML Source Data XPath Expression XPath Result
<Loopback> <address>10.1.2.1</address>
<name>0</name> <address>10.1.2.5</address>
<ip> //GigabitEthernet//primary/address
<address> <address>10.1.2.9</address>
<primary> <address>10.1.2.13</address>
<address>10.1.1.17</address> <address>10.1.3.1</address>
<mask>255.255.255.255</mask> <address>10.1.3.5</address>
</primary>
</address> <address>10.1.3.9</address>
</ip> <address>10.1.3.13</address>
</Loopback>
<GigabitEthernet>
<name>0/1</name>
<ip> // is used as sort of wildcard for multiple levels in the
<address>
<primary> hierarchy between those of interest
<address>10.1.2.1</address>
<mask>255.255.255.252</mask>
</primary>
</address>
</ip>
</GigabitEthernet>
<GigabitEthernet>
<name>0/2</name>
<ip>
<address>
<primary>
<address>10.1.2.5</address>
...
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 41
The figure illustrates how we now only filter out the GigabitEthernet interface nodes thus not getting the
Loopback IP address in the result set.
The // expression is used as sort of wildcard for multiple levels in the hierarchy between those of interest (i.e.
GigabitEthernet and primary).
The next example further filters the result by only displaying the IP addresses of GigabitEthernet interface
nodes which represent linecard 0 on the router. We can match those nodes of linecard 0 by looking for those
GigabitEthernet interface nodes that start with (0).
1-136 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
XPath Examples: First GE IP Addresses
XML Source Data XPath Expression
<Loopback> //GigabitEthernet[position()=1]//primary/address
<name>0</name>
<ip> or simply
<address>
<primary> //GigabitEthernet[1]//primary/address
<address>10.1.1.17</address>
<mask>255.255.255.255</mask>
</primary> XPath Result
</address>
</ip> <address>10.1.2.1</address>
</Loopback>
<GigabitEthernet> Some other positioning options:
[1] <name>0/1</name>
<ip> [position()=last()] or [last()]
<address>
<primary> [position()>5]
<address>10.1.2.1</address>
<mask>255.255.255.252</mask>
</primary>
</address>
</ip>
</GigabitEthernet>
[2] <GigabitEthernet>
<name>0/2</name>
<ip>
<address>
<primary>
<address>10.1.2.5</address>
...
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 43
The example uses the index into the node set to extract a specific node or a range of nodes.
1-138 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Additional NSO XPath Functions
Category Function Description
Node deref(node-set) Returns the node set pointed to by the provide node-set
parameter (e.g. if it is a leafref)
sort-by(node-set, string) Sorts the node set according to the secondary index
String string-compare(string1, string2) Returns -1, 0 or 1 based on string comparison
compare(exp1, exp2) Returns -1, 0 or 1 based on values returned by expressions
re-match(string, regexp) Evaluates the regexp regular expression against the string
Number min(node-set), max(node-set), Return the minimum, maximum or average value from the
avg(node-set) node set
band(number1, number2), Returns a binary OR, AND, XOR or negation of the
bor(number1, number2), parameters.
bxor(number1, number2),
bnot(number)
This section describes XPath functions that can be used for example in "must" expressions in YANG
modules.
node-set deref(node-set)
The deref() function follows the reference defined by the first node in document order in the argument node-
set, and returns the nodes it refers to. If the first argument node is an instance-identifier, the function returns
a node-set that contains the single node that the instance identifier refers to, if it exists. If no such node exists,
an empty node-set is returned.
If the first argument node is a leafref, the function returns a node-set that contains the nodes that the leafref
refers to. If the first argument node is of any other type, an empty node-set is returned.
number string-compare(string,string)
The string-compare() function returns -1, 0, or 1 depending on whether the value of the string of the first
argument is respectively less than, equal to, or greater than the value of the string of the second argument.
number min(node-set)
Returns the numerically smallest number in the node-set, or NaN if the node-set is empty.
number max(node-set)
Returns the numerically largest number in the node-set, or NaN if the node-set is empty.
number avg(node-set)
Returns the numerical average of the node-set, or NaN if the node-set is empty, or if any numerical
conversion of a node failed.
1-140 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
number bnot(number)
Returns the result of bitwise NOT on number. Unless the number is an integer NaN will be returned.
node-set sort-by(node-set, string)
The sort-by() function makes it possible to order a node-set according to a secondary index (see the
tailf:secondary-index extension). The first argument must be an expression that evaluates to a
node-set, where the nodes in the node-set are all list instances of the same list. The second argument must be
the name of an existing secondary index on that list. For example given the YANG model:
container sys {
list host {
key name;
unique number;
tailf:secondary-index number {
tailf:index-leafs "number";
}
leaf name {
type string;
}
leaf number {
type uint32;
mandatory true;
}
leaf enabled {
type boolean;
default true;
}
...
}
}
The expression sort-by(/sys/host,"number") would result in all hosts, sorted by their number. And the
expression, sort-by(/sys/host[enabled='true'],"number") would result in all enabled hosts, sorted by number.
Note also that since the function returns a node-set it is also legal to add location steps to the result. I.e. the
expression sort-by(/sys/host[enabled='true'],"number")/name results in all host names sorted by the hosts
number.
Use the | display xml option to display part of the configuration in XML format
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 46
The figure illustrates how the NSO CLI can be used to retrieve portions of configurations and display them in
XML format to determine the data node hierarchy.
1-142 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
XPath Hints
admin@nso# show running-config devices device PE11 config ios:interface | display xpath
/devices/device[name='PE11']/config/ios:interface/Loopback[name='0']/ip/address/primary/address 10.1.1.17
/devices/device[name='PE11']/config/ios:interface/Loopback[name='0']/ip/address/primary/mask 255.255.255.255
/devices/device[name='PE11']/config/ios:interface/GigabitEthernet[name='0/1']/ip/address/primary/address 10.1.2.1
/devices/device[name='PE11']/config/ios:interface/GigabitEthernet[name='0/1']/ip/address/primary/mask 255.255.255.252
/devices/device[name='PE11']/config/ios:interface/GigabitEthernet[name='0/2']/ip/address/primary/address 10.1.2.5
/devices/device[name='PE11']/config/ios:interface/GigabitEthernet[name='0/2']/ip/address/primary/mask 255.255.255.252
/devices/device[name='PE11']/config/ios:interface/GigabitEthernet[name='0/3']/ip/address/primary/address 10.1.2.9
/devices/device[name='PE11']/config/ios:interface/GigabitEthernet[name='0/3']/ip/address/primary/mask 255.255.255.252
/devices/device[name='PE11']/config/ios:interface/GigabitEthernet[name='0/4']/ip/address/primary/address 10.1.2.13
/devices/device[name='PE11']/config/ios:interface/GigabitEthernet[name='0/4']/ip/address/primary/mask 255.255.255.252
/devices/device[name='PE11']/config/ios:interface/GigabitEthernet[name=’1/1']/ip/address/primary/address 10.1.3.1
/devices/device[name='PE11']/config/ios:interface/GigabitEthernet[name=’1/1']/ip/address/primary/mask 255.255.255.252
/devices/device[name='PE11']/config/ios:interface/GigabitEthernet[name=’1/2']/ip/address/primary/address 10.1.3.5
/devices/device[name='PE11']/config/ios:interface/GigabitEthernet[name=’1/2']/ip/address/primary/mask 255.255.255.252
/devices/device[name='PE11']/config/ios:interface/GigabitEthernet[name=’1/3']/ip/address/primary/address 10.1.3.9
/devices/device[name='PE11']/config/ios:interface/GigabitEthernet[name=’1/3']/ip/address/primary/mask 255.255.255.252
/devices/device[name='PE11']/config/ios:interface/GigabitEthernet[name=’1/4']/ip/address/primary/address 10.1.3.13
/devices/device[name='PE11']/config/ios:interface/GigabitEthernet[name=’1/4']/ip/address/primary/mask 255.255.255.252
...
Use the | display xpath option to display part of the configuration in XPath format
Useful when constructing XPath expressions for leafref, must or when statements
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 47
The figure illustrates an even better way how the NSO CLI can be used to determine the data node hierarchy.
The | display xpath option can be used to display output using XPath notation that can then be reused to
build XPath expressions.
Examples
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 49
The two examples will illustrate two scenarios where YANG is used within Cisco NSO:
To build vendor-specific and device-specific functionality (i.e. Network Element Driver or NED). This
example illustrates the work typically performed by NSO developers where the knowledge of specific
features and technologies is needed in order to build the capability to manage a device using its native
CLI.
This example illustrates the work typically performed by NSO developers where the knowledge of specific
features and technologies is needed in order to build the capability to manage a device using its native CLI.
To build vendor-independent and device-independent service models (this is the main focus of this
course). You will also note the distinction between the YANG used for NED which carries the
complexities associated with element management and the service models which provide much greater
simplicity.
1-144 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Example 1: Basic VPLS Configuration
!
! Create a Virtual Forwarding Instance
!
l2 vfi name { autodiscovery | manual }
vpn id id
bridge-domain domain
!
!
! Configure an interface for VPLS
!
interface interface
service instance instance ethernet
encapsulation { untagged | dot1q vlan } PE-X
bridge-domain domain
neighbor neighbor encapsulation mpls
! CE
!
The first example illustrates how the NED for Cisco IOS can be augmented to support the implementation of
basic Virtual Private LAN Services (VPLS) with the following service configuration options:
Signaling: auto discovery using Border Gateway Protocol (BGP) or manual configuration using point-
to-point Virtual Forwarding Interface (VFI).
Encapsulation: untagged Ethernet frames or 802.1q VLANs.
Switching parameter: VPN identifier, bridge domain.
The above configuration shows the chosen subset of VPLS configuration options that will be used to enable
the Cisco IOS NED to configure VPLS on Cisco IOS routers.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 51
The above example illustrates how YANG data model is mapped to the first part of the VPLS configuration.
The data types and constraints are defined to catch wrong data before it is pushed to a router.
Note This example does not show the specific annotations that are also required for Cisco NSO to properly
transform the YANG statements into Cisco IOS CLI commands.
1-146 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Example 1: Basic VPLS Configuration (Cont.)
container service {
list instance {
key "id mode"; This top-level container should be
leaf id {
type uint32 { range "1..8000"; } part of the interface configuration
}
leaf mode {
node
type enumeration {
enum ethernet {
}
} interface X/Y
} service instance instance ethernet
container encapsulation { encapsulation { untagged | dot1q vlan }
leaf untagged { type empty; } bridge-domain domain [split-horizon]
container dot1q {
leaf vlan { !
type uint32 { range "1..4096"; }
}
}
}
container bridge-domain {
leaf id {
type uint32 { range "1..4096"; }
}
leaf split-horizon { type empty; }
}
}
}
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 52
The second part of the example illustrates the interface-specific part of the VPLS configuration and how it is
mapped form YANG to Cisco IOS CLI.
Note This example does not show the specific annotations that are also required for Cisco NSO to properly
transform the YANG statements into Cisco IOS CLI commands.
The second example shows how a VPLS service is defined at a higher level where only the service
parameters are important to the operator. The pseudo-language used above describes which parameters are
needed when designing a VPLS service.
1-148 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Example 2: Basic VPLS Service Configuration (Cont.)
list vpls {
key service-name;
description "Service name"; Only the parameters matter to the
leaf service-name { type string; }
list device {
operator
key device-name;
unique bridge-domain;
Service is mapped to the actual
leaf device-name { type string; }
leaf bridge-domain {
configuration based on individual
type uint32;
range "1..4096";
device's NED type
}
list interface {
key intf-name;
leaf intf-name { type string; }
leaf encapsulation {
type union{
type uint32 {
range "1..4096";
}
type enumeration {
enum "Untagged";
}
}
} Note! The example does not show the mapping
}
} template.
}
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 54
The sample YANG service model illustrates how the service can be defined and it is independent of the
specifics of individual device types – devices can be of different types and from different vendors as long as
they support the required set of features to enable VPLS.
Note Note! The above example does not show the mapping of the service model to the individual device types.
The last example is intended to practice the YANG syntax and semantics skills by first trying to find errors in
existing YANG modules before starting to write one's own YANG modules.
Try to find errors in the above example:
Syntax errors may stop the YANG module from being parsed properly.
Semantic errors may prevent YANG from interpreting the data model properly.
Non-fatal mistakes may produce warnings (e.g. redundancy, sub-optimal code).
1-150 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Use pyang to Validate the Code
root@NCS:/tmp# pyang lpbck.yang
lpbck.yang:9: error: unterminated statement definition for keyword "key", looking at u Missing ";"
root@NCS:/tmp#
root@NCS:/tmp# vim lpbck.yang Fix syntax errors.
root@NCS:/tmp#
root@NCS:/tmp# pyang lpbck.yang
lpbck.yang:1: warning: unexpected modulename "loopback" in lpbck.yang, should be lpbck
lpbck.yang:4: error: expected keyword "prefix" as child to "import"
lpbck.yang:5: warning: imported module ietf-yang-types not used
lpbck.yang:9: warning: all keys in the list are redundantly present in the unique statement
lpbck.yang:17: error: syntax error in pattern: xmlRegexpCompile() failed
lpbck.yang:22: error: the identifier "ip-address" in the unique argument does not reference an existing
container
lpbck.yang:26: error: bad value "0-999" (should be range-arg)
lpbck.yang:26: error: restriction range not allowed for this base type
lpbck.yang:30: error: prefix "inet" is not defined (reported only once)
root@NCS:/tmp#
root@NCS:/tmp# mv lpbck.yang loopback.yang
root@NCS:/tmp#
root@NCS:/tmp# vim loopback.yang Fix remaining syntax and semantic errors.
root@NCS:/tmp#
root@NCS:/tmp# pyang loopback.yang No news is good news.
Preferably use an IDE for YANG which has syntax highlighting and YANG validation
capability (e.g. Eclipse)
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 56
Missing semicolons or curly brackets prevent the YANG parser to read the file properly so it will not report
all errors but instead you will have to find and fix them one by one. This may require many iterations with
pyang before you can start troubleshooting other syntactic and semantic errors.
Once the YANG module can be parsed, the pyang tool will search for other types of syntax errors and
semantic errors. The above output should give you enough information to fix the errors in your YANG
module.
Once you have foxed all mistakes, the pyang tool should not produce any output which means that there is
nothing wrong with the syntax and semantics of the module.
The above illustration shows the solution to the quest to find errors.
1-152 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Summary
This topic summarizes the key points that were discussed in this lesson.
IETF RFCs:
YANG: http://tools.ietf.org/html/rfc6020
Common YANG Data Types: http://tools.ietf.org/html/rfc6991
Guidelines for Authors of YANG: http://tools.ietf.org/html/rfc6087
An Architecture Using NETCONF and YANG: http://tools.ietf.org/html/rfc6244
Pyang tool:
Validation: pyang test.yang
Conversion: pyang -f yin test.yang
Text representation: pyang -f tree test.yang
HTML representation: pyang -f jstree test.yang
Use an IDE with yang syntax highlighting and YANG validation capabilities to simplify
development (e.g. Eclipse)
References
For additional information, refer to these resources:
Cisco NSO documentation and manuals.
IETF RFC 6020
W3C XPath 1.0 specification
System Setup
Overview
This lesson describes the steps required to install and prepare the environment for your first
project.
Objectives
Upon completing this lesson, you will be able to meet these objectives:
Describe the NSO installation procedure
Explain how the integrated network simulation tool can be used to quickly test NSO
functionalities against simulated devices
Describe how the integrated discovery module can be used to make an initial import of
devices to NSO
Describe how packages are imported into NSO
Cisco NSO Setup Overview
This topic will provide an overview of Cisco Network Services Orchestrator system setup
requirements and procedures.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 4
Before installing NSO, you need to know your system specifications (Operating System and CPU
architecture) to choose the appropriate NCS Installer. NSO is delivered as a self-extract archive which is
OS/CPU specific. The archive file has the pattern ncs-VERSION.OS.ARCH.installer.bin. The variables in
the pattern refer to:
VERSION: The version to install.
OS: The Operating System (linux for all Linux distributions and darwin for OS X).
ARCH: The CPU architecture (x86_64 or i686).
Before installing, ensure that a Java JDK-6.0 or higher is installed. When JDK is properly installed the
command java -version should indicate a Java version of "1.6" or higher.
2-2 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
System Requirements: Memory and CPU
Depends on complexity: Number of services, number of devices, service complexity
Example: NSO running on quad-core CPU and 32 GB RAM
RAM Memory for 10 000 Services Database disc space for 10 000 Services
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 5
NSO is a highly scalable system but if you are looking for templates for NSO server sizing you will not find
any. The NSO server system requirements vary between deployments and are based on the number of
services running in the network, the number of managed devices and actual service complexity. Having a
simple firewall service will consume less resources than a more complex service like triple play.
To illustrate the capabilities of NSO, some performance graphs are provided as an example.
Production
One, two or many Cisco NSO production systems
High availability and clustering used if/when required
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 6
An environment making use of Cisco NSO to orchestrate end-to-end services may require the following
different deployment of Cisco NSO:
Production: this is the critical running production environment which should be used solely for the
purpose of orchestrating production services.
Pre-Production Verification Lab: this environment should be a replicated production environment in a
lab for development and testing purposes with a subset of managed physical devices in the lab to cover
each device type and each use case. Optionally, a comparable set of virtual devices can be used to limit
the cost of the lab and improve the flexibility of the lab. Additionally, the lab can be augmented by
many simulated instances using Netsim devices.
Development and Testing Lab and Desktop Development: this environment is a non-critical
environment used to design and test various use cases, to develop new production services or update
existing services, etc. This environment will typically use Netsim devices or virtual devices for
development and testing purposes.
2-4 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Cisco NSO Cisco NSO
System Installation Local Installation
Intended for production environment and Intended for development and testing in
pre-production verification lab labs and on desktops
NSO can run as root or specific user NSO can run as user
(from version 4.0.1)
Simple to switch between NSO instances
System integrated with the Linux OS: (versions)
Installation directory: /op/ncs/ncs-4.1.1 Everything installed in one or two
(linked to by /opt/ncs/current)
directories
Running directory: /var/opt/ncs
Installation directory: all static files (e.g.
Log directory: /var/log/ncs binaries, libraries, scripts, tools)
Configuration directory: /etc/ncs Running directory: all dynamic files (e.g.
CDB, logs, configuration, packages)
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 7
Local Install
Use Local Install --local-install option for Development, Evaluation, proof of concept and private lab
purposes. All the NSO Examples and README steps provided with the installation are based on Local
Install only. You should always use Local Install for evaluation and development purposes. Local Install is
possible on Linux OS and OS X.
System Install
Use System Install --system-install option for production and system-wide deployment in a central location.
You need root priviliges for System Install procedure and administration of the installed NSO. As part of
System install, the NSO daemon ncs is started at boot time. System Install should be used only for
production deployment. For all other purposes, use Local Install procedure.
2. Install NSO
3. Create running environment for NSO
4. Start NSO
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 9
The NSO installation only requires a handful of steps and can be completed in minutes.
2-6 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Cisco NSO Local Installation
NSO installation file contents: Installation directory in
the current directory
NSO software, examples, documentation
(user home directory in
Lab-grade network element drivers (NEDs)
the example)
Netsim network simulator
Installing Cisco NSO can be done in seconds. You need the self-extract archive suitable for your OS and
CPU, and all you need to decide is where Cisco NSO should be installed. For training purposes, you could
very well install Cisco NSO in your home directory, e.g. as ~/Cisco ncs/3.0.
datacenter/ ncs-cdb/
ncs-run/ ncs-cdb/
ncs.conf
Running Directory ncs.conf
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 11
When working with NSO, one should be aware of two different directory types. The first is the installation
directory itself, which contains all of the NSO components. Note that it is a good practice to run NSO
projects outside the actual installation directory. This will avoid future problems when upgrading NSO to a
newer version and it will clearly separate the NSO installation form its production or project specific settings.
2-8 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Cisco NSO Local Installation
Creating Running Environment
cisco@nso:~$ cd ncs-4.1.1 Make sure binaries are added to your PATH
cisco@nso:~/ncs-4.1.1$ source ncsrc
cisco@nso:~/ncs-4.1.1$ ls -l by sourcing the environment variables
drwxr-xr-x 2 cisco cisco 4096 Jan 23 13:06 bin
-rw-r--r-- 1 cisco cisco 100882 Jan 23 13:06 CHANGES
The “source ncsrc” is required every time
drwxr-xr-x 5 cisco cisco
drwxr-xr-x 3 cisco cisco
4096 Jan 22 21:24 doc
4096 Jan 23 13:04 erlang
you start a shell session
drwxr-xr-x 3 cisco cisco
drwxr-xr-x 11 cisco cisco
4096 Jan 23 13:01 etc
4096 Jan 23 13:11 examples.ncs
Alternatively, you may add the “source
drwxr-xr-x 2 cisco cisco 4096 Jan 23 13:04 include ncsrc” command to your .profile or .bashrc
drwxr-xr-x 3 cisco cisco 4096 Jan 23 13:01 java
drwxr-xr-x 7 cisco cisco 4096 Jan 23 13:07 lib file in the home directory
-rw-r--r-- 1 cisco cisco 94796 Jan 23 13:06 LICENSE
drwxr-xr-x 6 cisco cisco 4096 Jan 22 21:05 man
-rw-rw-r-- 1 cisco cisco 546 Feb 18 12:22 ncsrc
-rw-rw-r-- 1 cisco cisco 514 Feb 18 12:22 ncsrc.tcsh
drwxrwxr-x 3 cisco cisco 4096 Feb 18 12:22 netsim
drwxr-xr-x 5 cisco cisco 4096 Jan 23 13:01 packages
-rw-r--r-- 1 cisco cisco 6455 Jan 23 13:06 README
drwxr-xr-x 4 cisco cisco 4096 Jan 23 13:05 scripts
drwxr-xr-x 3 cisco cisco 4096 Jan 23 13:01 src
drwxr-xr-x 4 cisco cisco 4096 Jan 23 13:06 support
drwxr-xr-x 3 cisco cisco 4096 Jan 23 13:01 var
-rw-r--r-- 1 cisco cisco 225 Jan 23 13:06 VERSION
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 12
Make sure you have sourced the ncsrc file in $ NCS_DIR. This sets up paths and environment variables in
order to run NSO. So this must be done all times before running NSO, so it is recommended to put that in
your profile.
In the below, replace the name of the binary and directory to install in:
sh ./ncs-3.0.linux.x86_64.installer.bin ~/ncs/3.0
source ~/ncs/3.0/ncsrc
The “source” line ensures the Cisco NSO executable and associated tools will be in your PATH. With this,
you can refer to the location where Cisco NSO is installed as $ Cisco NCS_DIR. If you like, you could put
that source command into your .bashrc, so that Cisco NSO will be in your path every time you log in.
Create an empty directory, for example in your home directory. NSO and the simulator will create files and
directories in this example directory. Make sure you change to this directory before continuing.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 13
NSO runs as a daemon, and needs a couple of directories (for logs, its database etc.). The location of all these
are in a configuration file, usually called ncs.conf. Unless supplied as an argument (using the –c option) the
NSO daemon will look for ./ncs.conf, followed by etc/ncs/ncs.conf in the NSO installation directory. In order
to make it easy to get started NSO includes a script called ncs-setup, this script will create the directories and
files needed to get started (by default in the current working directory).
2-10 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Starting Cisco NSO
Start the NSO daemon:
cisco@nso:~$ ncs
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 14
An initial configuration file, ./ncs.conf and the directories need to run NSO were created. Now, to start the
NSO daemon run "ncs" (optionally providing the configuration file as argument: -c ./ncs.conf):
ncs
The NSO daemon is now running, we can make sure it is by issuing:
ncs –status
The next thing to do is to start the CLI. The CLI is started using the ncs_cli command. By default you start
the CLI as the user you are running the shell as. Most examples will use a default built-in user called 'admin',
to start the CLI as user admin, use:
ncs_cli -u admin
The NSO CLI provides a unified CLI towards the complete network. It comes in two flavors Juniper-style
and Cisco XR style. Note that the NSO CLI is a northbound interface to the NSO representation of the
network devices and network services; do not confuse this with a cut-through CLI that reaches the devices
directly. So although the network might be a mix of vendors and device interfaces like different CLI flavors,
NSO provides one northbound CLI.
You can access the NSO CLI using You can access the WebUI
SSH: using a browser:
cisco@nso:~$ ssh -l admin -p 2024 localhost
admin@localhost's password:
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 15
By default NSO also starts its built-in Secure Shell (SSH) server, listening on port 2024. So SSH can also be
used to log into the CLI using the ssh -l admin -p 2024 localhost command.
The default password for the 'admin' user is: admin. Type exit to get out of the CLI.
NSO also starts a web-server, listening on port 8080. By directing a browser to http://localhost:8080/ you can
login using the web browser user interface (WebUI) with user admin again.
2-12 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Other Commands
Stop the NSO daemon:
cisco@nso:~$ ncs --stop
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 16
2. Install NSO
3. Start NSO
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 18
NSO System Install results in system wide Installation and Deployment. Use this Install option only for
Production deployment. For Development and Evaluation purposes, you should use only Local Install
procedure.
Before installing NSO:
1. Ensure that the root permissions are enabled.
2. Choose the correct Operating System (Linux). Currently only Linux OS is supported.
3. Ensure that Java JDK-6.0 or higher is installed.
2-14 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Uses default directories
Cisco NSO System Installation unless otherwise
specified in parameters
Run the installation:
cisco@nso:~$ sudo sh nso-4.1.1.linux.x86_64.installer.bin --system-install
INFO Using temporary directory /tmp/ncs_installer.27219 to stage NCS installation bundle
INFO Using /opt/ncs/ncs-4.1.1/ncs-4.1.1 for static files
INFO Using /etc/ncs for configuration files
INFO Using /var/opt/ncs for run-time state files
INFO Using /var/log/ncs for log files
INFO Unpacked ncs-4.1.1 in /opt/ncs/ncs-4.1.1/ncs-4.1.1
INFO Found and unpacked corresponding DOCUMENTATION_PACKAGE
INFO Found and unpacked corresponding EXAMPLE_PACKAGE
INFO Generating default SSH hostkey (this may take some time)
INFO SSH hostkey generated
INFO Environment set-up generated in /opt/ncs/ncs-4.1.1/ncs-4.1.1/ncsrc
INFO NCS installation script finished
INFO Found and unpacked corresponding NETSIM_PACKAGE
INFO Configuring installation for PAM authentication
INFO Using PAM service common-auth for authentication
INFO Generating self-signed certificates for HTTPS
...
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 19
Installing Cisco NSO can be done in seconds. You need the self-extract archive suitable for your OS and
CPU, and all you need to decide is where Cisco NSO should be installed. For training purposes, you could
very well install Cisco NSO in your home directory, e.g. as ~/Cisco ncs/3.0.
Use --system-install option to perform a system installation. This option creates a system install of NSO,
suitable for deployment.
sudo sh nso-VERSION.OS.ARCH.installer.bin --system-install
The variables in the command VERSION refers to the NSO version to install. OS refers to the Operating
System (linux). ARCH refers to the CPU architecture (x86_64 or i686).For example:
sudo sh nso-4.1.1.linux.x86_64.installer.bin --system-install
The continuation of the output from system installation shows that PAM is used for authenticating NSO
users and provides some guidelines how to create groups and add users to groups.
2-16 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Cisco NSO Local Installation
Directory Structure
/ opt/ ncs/ ncs-4.0.1/
ncs-4.1/
ncs-4.1.1/ bin/
lib/
Symbolic link Installation Directory
doc/
current/ examples.ncs
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 21
By default, when using system installation, the Installation Directory is created in /opt/ncs, the Configuration
Directory is created in /etc/ncs, the Running Directory is created in /var/opt/ncs and the Log Directory is
created in /var/log/ncs.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 22
Use the init.d script ncs to control the status of the NSO daemon.
2-18 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Installing NEDs
This topic describes how NED packages are loaded into a new NSO project.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 24
All user code that needs to run in NSO must be part of a package. A package is basically a directory of files
with a fixed file structure. A package consists of code, YANG modules, custom Web UI widgets
etc., that are needed in order to add an application or function to NSO. Packages is a controlled way to
manage loading and versions of custom applications.
When NSO starts, it needs to search for packages to load. The ncs.conf parameter /ncs-config/ load-path
defines a list of directories. At initial startup, NSO searches these directories for packages, copies the
packages to a private directory tree in the directory defined by the /ncs-config/ state-dir parameter in
ncs.conf, and loads and starts all the packages found. All .fxs (compiled YANG files) and .ccl (compiled CLI
spec files) files found in the directory load-dir in a package are loaded.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 25
There are many ways how you can choose to manage package repositories. Whatever choice you select you
must ensure that package directories (and only package directories) are visible and accessible in the NSO’s
packages subdirectory of the running directors:
Extract tar.gz files to the packages directory
Copy existing package directories to the packages directory (shown on next page)
Link to existing package directories from the packages directory (shown on next page)
2-20 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Using Existing Packages
Existing packages:
NEDS ($NCS_DIR/packages/neds)
Services ($NCS_DIR/packages/services)
Tools ($NCS_DIR/packages/tools)
Copy or softlink packages from the NSO installation or another location where
the packages are stored:
cisco@nso:/var/opt/ncs/packages$ sudo cp -r $NCS_DIR/packages/neds/cisco-ios packages/
cisco@nso:/var/opt/ncs/packages$ sudo cp -r $NCS_DIR/packages/neds/cisco-iosxr packages/
or
cisco@nso:/var/opt/ncs/packages$ sudo ln -s $NCS_DIR/packages/neds/cisco-iosxr packages/cisco-ios
cisco@nso:/var/opt/ncs/packages$ sudo ln -s $NCS_DIR/packages/neds/cisco-iosxr packages/cisco-iosxr
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 26
Existing packages can be found in the NSO installation directory ($NCS_DIR) under a folder called
packages. The existing packages are split into three groups:
NEDs: contains network element drivers for network devices.
Services: contains services like L3 VPNs, openstack etc.
Tools: contains services that can be used with NSO like Discovery Module.
To reuse the existing packages in production environments, the existing packages need to be copied to the
package folder in the project directory. A softlink can also be used as an alternative to copying the package
folder.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 27
2-22 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Compile Packages
root@nso:/var/opt/ncs/packages# cd cisco-ios/src
root@nso:/var/opt/ncs/packages/cisco-ios/src# make
cd java && ant -q all
BUILD SUCCESSFUL
Total time: 0 seconds
cd ../netsim && make all
make[1]: Entering directory `/var/opt/ncs/packages/cisco-ios/netsim'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/var/opt/ncs/packages/cisco-ios/netsim‘
root@nso:/var/opt/ncs/packages/cisco-ios/src#
Compile packages to ensure they are compiled by the correct version of the
compiler
You may also do make clean and then make to perform a complete recompile
of the package
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 28
The figure illustrates the compilation procedure for a NED package for Cisco IOS routers management.
Make sure that the compilation reports “BUILD SUCCESSFUL”. If the compilation fails, the file and line
number of failed source will be displayed.
admin@ncs#
Depending on the number of packages it may take some time for the package
upgrade process to complete
It may take even longer in case a package upgrade is performed in a live
system with multiple service packages with many service instances
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 29
The figure illustrates the usage of the packages reload command when using the Cisco style CLI. If using
the Juniper style CLI use the request packages reload command.
This request makes NSO copy all packages found in the load path to a temporary version of its private
directory (packages-in-use.new), and load the packages from this directory. If the loading is successful, this
temporary directory will be made permanent, otherwise the temporary directory is removed and NSO
continues to use the previous version of the packages. Thus when updating packages, one should always
update the version in the load path, and request that NSO does the reload via this action.
In some cases we may want NSO to do the same operation as the reload action at NSO startup, i.e. copy all
packages from the load path before loading, even though the private directory copy already exists. This can
be achieved in two different ways:
Setting the shell environment variable $NCS_RELOAD_PACKAGES to true. This will make NSO do
the copy from the load path on every startup, as long as the environment variable is set, and may be
useful in some development scenarios.
Giving the option --with-package-reload to the ncs command when starting NSO. This will make NSO
do the copy from the load path on this particular startup, without affecting the behavior on subsequent
startups. This should always be used when upgrading to a new version of NSO in an existing directory
structure, to make sure that new packages are loaded together with the other parts of the new system.
2-24 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Verifying Packages
admin@ncs# show packages package package-version
PACKAGE
NAME VERSION
----------------------
cisco-ios 4.0.4
cisco-iosxr 4.1
admin@ncs#
Check if all the required packages are loaded using the show packages
command
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 30
The purpose of this procedure is to make it possible to reliably do a package reload while NSO is running,
with fallback to the previously existing version of the packages if the reload should fail. Such a reload can be
requested via the reload action - from the NSO CLI.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 31
The figure illustrates the various options available to re-initialize the NSO system:
After changing the ncs.conf file it is enough to trigger a reload using the ncs --reload command.
When a complete restart is required you should use the /etc/init.d/ncs restart command if you are using
the system installation or use the ncs --stop command to stop the server and ncs to start the server. Note
that a server restart does not initiate a package reload action. You should use the packages reload CLI
command or use the --with-packkage-reload flag when starting a locally-installed NSO.
2-26 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Using Netsim
This topic describes how the integrated Netsim tool can be used to simulate network devices.
Netsim Overview
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 33
The ncs-netsim program is a useful tool to simulate a network of devices to be managed by NSO. It makes it
easy to test NSO packages towards simulated devices. All you need is the NSO Network Element Driver
(NED) packages for the devices that you need to simulate. The devices are simulated with the Tail-f ConfD
product. All the NSO examples use ncs-netsim to simulate the devices. A good way to learn how to use ncs-
netsim is to study these.
Netsim enables you to test the device configuration before it is deployed to real devices. NSO uses the same
YANG model for both the real and Netsim simulated devices. Netsim capabilities of a NED package are
defined in its netsim subfolder and are beyond the scope of this course.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 34
Start the simulator using the ncs-netsim start command. You should see the devices getting started as shown
above.
2-28 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Netsim Options
Netsim supports creating, adding and deleting simulated devices on the fly
cisco@ncs:~$ ncs-netsim --help
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 35
A large simulated network environment can be created if using Netsim-enabled NED packages. Use the
highlighted options to create network and add various types of device to the simulated network.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 36
Run the CLI towards one of the devices as shown above. This output shows that the device has some initial
config.
Note Netsim only simulates the CLI. There is no data plane to process packets.
2-30 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Development Lab Setup Overview
Setup an NSO running environment: Start NSO:
ncs-setup ncs
ncs.conf /etc/init.d/ncs start
Populate with packages: ncs --status
Extract/copy/link the required Log in:
packages into the packages directory ssh admin@localhost -p 2024
Make and start NETSIM devices: ncs_cli -C -u admin
Only if you want to use simulated http://localhost:8080
devices
ncs-netsim
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 37
Use a local installation of NSO together with Netsim to build a learning and development NSO environment.
References
For additional information, refer to these resources:
Cisco NSO documentation and manual pages
2-32 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Lesson 2-2
Device Manager
Overview
This lesson introduces the Device Manager component of Cisco Network Services
Orchestrator.
Objectives
Upon completing this lesson, you will be able to:
Describe how the Device Manager configures network devices
Explain how Device Manager obtains and maintain connections to network devices
Describe how the concept of templates and groups can be used in device configuration and
management
Describe the purpose of tags, annotations, policies and commit queues
Describe other tools used in device management
Explain how the WebUI can be used for device management
Overview
This topic introduces the Device Manager and its role in Cisco NSO.
Device Manager
Its the heart of NSO
NSO keeps master copy of configuration in CDB
The job of the Device Manager is to break any network configuration change to
configuration change on managed devices
Device Manager supports different protocols: Master Configuration
Cisco
NETCONF
NSO Database
CLI
SNMP Network Element Drivers
Java code
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 4
The Device Manager lies at the heart of NSO. The Device Manager maintains a flat list of all managed
devices. NSO keeps the master copy of the configuration for each managed device. Whenever a
configuration change is done to the list of device configuration master copies, the job of the Device Manager
is to partition this "network configuration change" into the corresponding changes for the actual managed
devices. Depending on the device type, different protocols are spoken southbound:
If the device is a Network Configuration Protocol (NETCONF) capable device, we produce explicit
NETCONF edit-configuration Remote Procedure Call (RPC) operations for each participating device
and then inside the same transaction that runs in the NSO, execute all the individual - device specific -
NETCONF operations.
If the device is a Simple Network Management Protocol (SNMP) device, NSO translates the change of
the NSO Document Object Model (DOM) tree into the corresponding SNMP (SET command) protocol
data units (PDUs).
If the device has a CLI which has the same structure as Cisco IOS or XR routers, a CLI NED is used to
produce the correct sequence of CLI commands.
And finally, for devices that do not fall into any of the above mentioned categories, Java code in a
Generic NED gets invoked with the proposed changes. The job for that Network Element Driver (NED)
code is to translate between the diff on the NSO DOM tree to the corresponding operations on the
device.
The architecture of the NETCONF protocol is the enabling technology here making it possible to push out
configuration changes to managed devices and then in the case of other errors, roll back changes. Devices
that do not speak NETCONF, i.e. devices that do not have transactional capabilities can also participate,
however depending on the device; error recovery may not be as good as it is for a proper NETCONF enabled
device. In order to understand the main idea behind the NSO Device Manager it is necessary to understand
the NSO data model and how NSO incorporates the YANG data models from the different managed devices.
2-34 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
NSO CLI
In Operational mode, the CLI displays operational data stored in CDB
In Configuration mode, the CLI displays network configuration data stored in CDB
Cisco Style Juniper Style
admin@nso# operational mode CLI admin@nso> operational mode CLI
admin@nso(config)# configuration mode admin@nso% configuration mode
Like many CLIs there is an operational mode and a configuration mode. Operational mode is the initial mode
after successful login to the CLI. It is primarily used for viewing.
The system status, controlling the CLI environment, monitoring and troubleshooting network connectivity,
and initiating the configure mode. Configure mode can be initiated by entering the configure command in
operational mode. All changes to the network configuration are done to a copy of the active configuration.
These changes do not take effect until a successful commit or commit confirm command is entered.
NSO organizes all managed devices as a list of devices. The path to a specific device is devices device
DEVICE-NAME.
The CLI provides two modes of operation. When prepended with > it indicates operational mode. When
prepended with % it indicates the configuration mode.
> Operation mode: fetches operational data from the network devices like interface statistics, and also
operational data that is maintained by NSO like alarm counters.
% Configuration mode. Show configuration data for all devices: this is done before we have loaded the
configuration from the real devices in the network to NSO.
Each managed device is uniquely identified by a free form text string. This would typically be the Domain
Name Server (DNS) name of the managed device but could equally well be the string format of the IP
address of the managed device or anything else. Furthermore, each managed device has a mandatory IP/port
pair that together with the authgroup leaf provides information to NSO how to connect and authenticate over
Secure Shell (SSH)/NETCONF to the managed device. Depending on the device-type NSO speaks different
protocols southbound.
The following 4 device types are available:
NETCONF - This is the default if no device-type is specified.
CLI - The NSO CLI-NED is used to speak to the device. This requires YANG models with the
appropriate annotations for the device CLI.
SNMP - The device speaks SNMP, preferably in read-write mode.
Generic NED - User java code needs to be present between NSO and the device to perform the
translation of operations to and results from the device.
The empty container /ncs:devices/device/config is used as a mount point for the YANG models from the
different managed devices. Whenever we wish to manage a device, we need access to the YANG models for
the device. We need to explicitly import the YANG models for each type of device using the nso compiler
(ncsc).
2-36 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Devices and Device YANG Models
To manage a device, we need a corresponding YANG model
Device models a are deployed as part of NED packages
All imported modules appear under /devices/device/config in the CDB
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 7
The empty container /NSC:devices/device/config is used as a mount point for the YANG models from the
different managed devices. Whenever we wish to manage a device, we need access to the YANG models for
the device. We need to explicitly, using the ncsc, import the YANG models for each type of device.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 9
When the NSO daemon is running and we have initialized the daemon with IP/Port and authentication
information as well as imported all modules we can start to actually manage devices through NSO.
NSO provides the ability to synchronize the configuration to or from the device. If we feel that the device has
the correct configuration we can choose to synchronize from a managed device whereas if we feel that NSO
has the correct device configuration and the device is wrong, we can choose to synchronize from NSO to the
device. In the normal operation, the configuration on the device and the copy of the configuration inside
NSO should be identical.
2-38 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Synchronizing to Device
When a device has been configured out of band
Clears up rogue configuration
“dry-run” option available to check changes sync-to
sync-from
admin@nso# devices device PE11 sync-to check-sync
compare-config
result true Cisco
NSO
Change device
configuration over CLI.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 10
Synchronizing from NSO to the device is common when we realize that a device has been configured out of
band. NSO has no means to enforce that devices are not directly reconfigured behind the back of NSO.
However it has means to discover this. This will happen automatically when a transaction will try to change
the device configuration. The transaction will fail due to configurations being out-of-sync. The configuration
verification can also be done manually using the check-sync command. When the configuration is out-of-
sync it may (or may not, depending on the situation at hand) make sense to synchronize from NSO to the
device, i.e. undo the rogue reconfigurations. A dry-run option is available for the sync-to commands, so that
we can check what the sync command would do to the device.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 11
When managing large networks with NSO a good strategy is to consider the NSO copy of the network
configuration to be the main master copy. All device configuration changes must go through NSO and all
other device re-configurations are considered rogue.
NSO doesn't contain any functionality which disallows rouge re-configurations of managed devices, however
it does contain a mechanism to discover if one or several devices have been configured out of band.
2-40 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Comparing Configuration
Compare out-of-sync device configuration
admin@nso(config)# devices device PE11 check-sync
result out-of-sync
info got: 334bb33aae40155831edfa0b6a978f39 expected: a1424cd35da4499f6a71b3d38ae648a8
If the device is not in sync, we are interested to know what the difference is. The CLI sequence above shows
how to do an explicit configuration comparison.
The “-” sign represents configuration items that should be deleted from the CDB in order to be the same as
on the device.
The “+” sign represents configuration items that should be added to the CDB in order to be the same as on
the device
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 13
The show configuration command will display the current configuration items in the current configuration
mode. In the example, you may note that we have configured two Loopback interfaces but the show
configuration command only displays the last one. The reason for that is that we are currently in the
Loopback 30 configuration mode.
2-42 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Displaying Configuration (Cont.)
Display only new parts of configuration:
admin@nso(config-if)# top
admin@nso(config)# show configuration
devices device PE11 Go to root of the data tree to display
config the all configuration items of the
ios:interface Loopback20
ip address 10.1.1.1 255.255.255.255 configuration session
no shutdown
exit
ios:interface Loopback30
Display full configuration
ip address 10.3.3.3 255.255.255.255
no shutdown
exit
!
!
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 14
The continuation of the example shows how we can move to the top of the CDB data tree and issue the show
configuration command again. This time it will display all configuration of the current configuration
session.
The show running-config command can be extended by specifying the part of the CDB to display.
2-44 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Configuring Devices
Configuration change happens after final commit statement
admin@nso# config
admin@nso(config)#
admin@nso(config)# devices device PE11 config ios:interface Loopback 20
admin@nso(config-if)# ip address 10.2.2.2 255.255.255.255
admin@nso(config)# devices device PE11 config ios:interface Loopback 30
admin@nso(config-if)# ip address 10.3.3.3 255.255.255.255
admin@nso(config-if)# commit
admin@nso#
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 16
It's possible to configure several devices through the NSO inside the same network transaction. The above
command was a multi host transaction. In the same transaction we re-configured three hosts. Had one of
them failed, or been non-operational, the transaction as a whole would have failed. The default re-
configuration behavior is to try to manipulate the candidate configurations of the managed devices (assuming
they support the candidate NETCONF capability). This is a two phase commit procedure. We start by
sending NETCONF edit-config commands to the managed devices. Assuming they all accept the edit-config
RPCs, we validate on all devices (if they support it). Then we continue by committing to each device. In the
ideal scenario, all participating devices support the confirmed commit capability. On all devices that support
the confirmed commit capability, NSO issues a confirmed commit RPC. If all involved devices accept the
confirmed commit, we issue the final confirming commit. This way NSO ensures network wide transactional
consistency.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 17
NSO reads the capabilities of each managed devices and executes completely different sequences of
NETCONF commands towards different types of devices.
For implementations of the NETCONF protocol that do not support the candidate configuration, and in
particular devices that do not support NETCONF commit with a timeout, NSO uses other means to cope with
the device. NSO announces candidate support and also confirmed commit capability on its northbound
NETCONF interface regardless of the capabilities of the managed devices. Simple devices that do not
support candidate configurations are handled regardless, and NSO simulates the semantics of these more
advanced NETCONF features.
NSO divides devices in the following groups:
start_trans_running - This mode is used for devices that support the Tail-f proprietary transaction
extension defined by http://tail-f.com/ns/netconf/transactions/1.0. Read more on this in the Tail-f ConfD
user guide. In principle it's a means to - over the NETCONF interface - control transaction processing
towards the running data store. This may be more efficient than going through the candidate data store.
The downside is obviously that it is Tail-f proprietary non-standardized technology.
lock_candidate - This mode is used for devices that support the candidate data store but disallow direct
writes to the running data store.
lock_reset_candidate - This mode is used for devices that support the candidate data and also allow
direct writes to the running data store. This is the default mode for Tail-f ConfD NETCONF agent.
Since the running data store is configurable, we must, prior to each configuration attempt, copy all of
running to the candidate. (ConfD has optimized this particular usage pattern, so this is a very cheap
operation for ConfD)
startup - This mode is used for devices that have writable running, no candidate but do support the
startup data store. This is the typical mode for Cisco like devices.
running-only - This mode is used for devices that only support writable running.
Which category NSO chooses for a managed device depends on which NETCONF capabilities the devices
sends to NSO in its NETCONF hello message.
2-46 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Confirmed Commit Support
Not all devices support confirmed-commit:1.0 standard NETCONF capability
NSO is able to work around that drawback
Possible failure scenarios could include:
Operator aborts the network wide transaction or connectivity to one of the devices is
lost: NSO sends the reverse diff
The device rejects the configuration: NSO aborts the transaction
NSO experiences a timeout: connectivity needs to be restored and configuration
synched from NSO
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 18
Another important discriminator between managed devices is whether they support the confirmed commit
with a timeout capability, i.e. the confirmed-commit:1.0 standard NETCONF capability. If a device supports
this capability, NSO utilizes it. This is the case with for example Juniper routers. If a managed device does
not support this capability, NSO uses NEDs to work around that problem.
In certain situations the following failure scenarios could occur:
The operator aborts the transaction, or NSO loses the SSH connection to another managed device which
is also participating in the same network transaction. In this case, NSO has the revert diff and simply
sends the precise undo information to the device. If the device does support the confirmed-commit
capability, NSO aborts the outstanding yet-uncommitted transaction simply by closing the SSH
connection. In this case, NSO sends the reverse diff instead.
The device rejects the transaction in the first place, i.e. the NSO attempt to modify its running data store.
This is an easy case since NSO then simply aborts the transaction as a whole in the initial commit
confirmed [time] attempt.
NSO loses SSH connectivity to the device during the timeout period. This is a real error case and the
configuration is now in an unknown state. NSO will abort the entire transaction, but the configuration of
the failing managed device is now probably in error. The correct procedure once network connectivity
has been restored to the device is to sync it in direction from NSO to the device. The NSO copy of the
device configuration will be what was configured prior to the failed transaction.
Even if not all participating devices have first class NETCONF agent implementations, NSO will attempt to
simulate the confirmed-commit capability.
The diagram lists the configuration flow sequence. In this example operations support system (OSS) uses
NETCONF to communicate with the NSO – the NSO provides the network abstraction and the OSS
configures the network itself through NSO instead of dealing with specific devices. The NSO runs
NETCONF or simulates NETCONF-like behavior towards devices. It locks their running and candidate
configurations and makes and validates the appropriate changes. Then it waits for confirmation from the
devices and finally commits the configuration before unlocking both candidate and running configurations.
Note that NSO can easily integrate with an existing/new OSS. Since NSO can also serve as an OSS, this is
just one of deployment scenarios.
2-48 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Error Recovery
Devices that do not have confirmed commit support
One of the devices fails to commit
NSO tries to mimic the confirmed commit
Rollback strategy is:
Retrieve device configuration
Compare with desired configuration
Calculate the diff
Apply the commands in diff
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 20
On devices that do not support confirmed commit, an error recovery mechanism is necessary. Once we have
started to commit, there is no turning back. If a device rejects the commit or dies between the edit-config
RPC and the commit RPC, we have a failure scenario where the network and NSO are out of sync. This may
sound harsh, but it's the way two-phase commit works. The manager asks all participants if they accept the
proposed change, they all acknowledge the proposed change. The manager then initiates the commit - if then
one of the participants fails to commit, NSO and that managed device are out of sync. NSO goes to great
lengths mimicking the semantics of confirmed commit towards devices that are less capable. The strategy to
roll back a less capable device is to first retrieve the entire configuration from the device, then compare that
configuration to the desired config, calculate the diff, and then finally issue the commands that are the result
of the diff calculation to the device. The reason for this strategy, is that for non-NETCONF capable devices
we cannot know for sure how much of a proposed configuration change to the device was actually accepted.
NSO keeps the changes made by the latest transactions in a form of a rollback file. This means that every
configuration can simply be revoked by rolling back the corresponding transaction.
2-50 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Rollbacks – Examples
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 22
The transaction can be rolled back all the way or selectively. Selectively means we can only roll back a part
of a transaction, that part being either:
Configuration for a specific device.
Configuration for a specific network function.
A combination of the above.
The roll back of a previous end-to-end service configuration? When an end-to-end service configuration
is rolled back to previous state, only changes done by that single transaction (ignores any changes done
by other transactions). This is also called a selective rollback.
Apart from actual device configurations that NSO also holds meta configuration data for devices. This meta
configuration includes settings necessary for managing the device and is important for the actual NSO.
The above syntax lists all possible completions for meta configuration change for a single device.
2-52 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Meta Configuration – All Devices
admin@nso(config)# devices global-settings
Possible completions:
commit-queue - Enables and configures the commit-queue
commit-retries - Retry commits on transient errors
connect-timeout - Timeout in seconds for new connections
ned-settings - Control which device capabilities ncs uses
out-of-sync-commit-behaviour - Specifies the behaviour of a commit operation involving a device that is
out of sync with ncs.
read-timeout - Timeout in seconds used when reading data
report-multiple-errors - By default, when the ncs device manager commits data southbound and when
there are errors, we only report the first error to the operator, this
flag makes ncs report all errors reported by managed devices
session-pool - Control how sessions to related devices can be pooled.
ssh-keep-alive - Controls SSH keep alive settings
trace - Trace the southbound communication to devices
trace-dir - The directory where trace files are stored
write-timeout - Timeout in seconds used when writing data
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 24
Like all configurations, meta configuration changes can be done for a separate device, a group of devices or
globally for all devices.
Possible completions:
check-sync - Check if the NCS config is in sync with the device
check-yang-modules - Check if NCS and the devices have compatible YANG modules
clear-trace - Clear all trace files
commit-queues - List of queued commits
connect - Set up sessions to all unlocked devices
device - The list of managed devices
device-group - Groups of devices
disconnect - Close all sessions to all devices
sync - DEPRECATED - use sync-to or sync-from instead
sync-from - Synchronize the config by pulling from the devices
sync-to - Synchronize the config by pushing to the devices
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 25
There are device specific actions that can be applied to all devices or a selected group of devices at once.
2-54 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Installed Device Models (NEDs)
admin@nso# show devices device-module | tab
NAME URI DEVICES
------------------------------------------------------------------------------------------------------------
tailf-ned-cisco-ios urn:ios [ PE12 PE11 CE22 CE21 CE12 CE11 ]
tailf-ned-cisco-ios-stats urn:ios-stats [ PE12 PE11 CE22 CE21 CE12 CE11 ]
tailf-ned-cisco-ios-xr http://tail-f.com/ned/cisco-ios-xr [ P11 P12 P21 PE21 PE22 PE31 PE41 ]
tailf-ned-cisco-ios-xr-stats http://tail-f.com/ned/cisco-ios-xr-stats [ P11 P12 P21 PE21 PE22 PE31 PE41 ]
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 26
It is important that the YANG models for managed devices are imported into NSO. Check the devices and
their NEDs using show devices device-module command.
Another useful command to list all devices and their state is the show devices list command. It includes the
name of the device, the address at which it is managed, the description (if specified), the NED ID and the
administrative state.
2-56 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Device Connection Management
This topic describes how device connection is obtained and maintained.
Device States
Oper State Description
Enabled Device is reachable from NSO.
Disabled Device is unreachable from NSO
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 29
NSO differentiates between oper state and admin state for a managed device. Oper state is the device
connectivity state and should reflect the actual state of the device. A managed device oper state is either
enabled or disabled. The admin state relates to the possibility of changing the device configuration and is
usually set manually.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 30
Oper state can be mapped to an alarm for the device. If the device is disabled, we may have additional error
information. If we manually stop a managed device, NSO doesn’t consider the device as non-operational
immediately. The only certain method for NSO to know that a managed device is non-operational is that it
cannot SSH connect to it. NSO cannot draw any conclusions from the fact that a managed device closed its
end of the SSH connection. It may have done so because it decided to time out an idle SSH connection. If we
try to initiate any operations towards the dead device, the device will be marked as oper state disabled.
2-58 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Admin State
Southbound-locked (default): possible to manipulate the configuration but
changes are never pushed to the device
Locked: all changes to device are forbidden
Unlocked: this is the state we set a device into when the device is operational. All
changes to the device will be sent southbound
Cisco Configure PE11
NSO
Configure PE12
Configure PE21
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 31
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 32
Apart from the discovery module a device can also be added manually. This requires to specify the following
device parameters at minimum:
IP address
Device Type
Corresponding NED (YANG model)
Access Protocol
Authentication Group
Two additional methods of adding a device to NSO exists: using cloning or templates.
2-60 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Cloning a Device
Devices can be instantiated from other devices
These devices can be immediately configured
All configuration succeeds within NSO and nothing is sent to devices
(southbound-locked state!)
All device configuration is cloned!
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 33
We can add new devices by cloning an existing device. Say we have hundreds of CE routers with known
good configuration and another one needs to be added to NSO. We can do that by cloning one of the existing
CE routers and the new device will be immediately available within NSO with the same settings. The cloned
device is southbound locked. This is a mode where we can reconfigure a device, but any changes done to it
are never sent to the managed device.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 34
A more attractive alternative to instantiating a device from the actual working configuration of another
device is to have a number of named template configurations that we can use. Compared to device cloning,
this approach is much more flexible and will only set the device parameters specified by the template.
2-62 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Load Using „ncs_load“ Command
A convenient way of loading and saving configuration
ncs_load without any options it will print the current configuration
Load (-l) option uploads XML contents to the CDB
Merge (-m) option updates the existing device list
Example of uploading and merging configurations of Netsim devices to NSO:
admin@nso:~$ ncs-netsim ncs-xml-init > devices.xml
admin@nso:~$ ncs_load -l -m devices.xml
Make sure you use the -m option to merge the XML contents with
the CDB. The default action is replace which would delete the
entire CDB and replace it with the XML contents!
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 35
This command provides a convenient way of loading and saving all or parts of the configuration in different
formats. It can be used to initialize or restore configurations as well as in CLI commands. If you run
ncs_load without any options it will print the current configuration in XML format on stdout. The exit status
will be zero on success and non-zero otherwise.
If we have already started NSO with an XML initialization file for the existing network, an updated
initialization file will not take effect unless we remove the Configuration Database (CDB) files, losing all
NSO configuration. But we can replace the original initialization data with data for the complete new
network when we have run add-to-network, by using ncs_load while NSO is running.
Authgroups
NSO requires SSH credentials to access a device
Named authgroups are used to map NSO user to device credentials
admin@nso# show running-config devices authgroups
devices authgroups group default
umap admin Cisco
NSO
remote-name admin
remote-password $4$wIo7Yd068FRwhYYI0d4IDw== Login as admin
!
umap oper Maps to username
remote-name oper on device
remote-password $4$zp4zerM68FRwhYYI0d4IDw==
!
!
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 37
When NSO connects to a managed device, it requires the SSH authentication information for that device.
Named authgroups are used to decide how to map a local NSO user to remote authentication credentials on a
managed device. The list 'group' is used for NETCONF and CLI managed devices. The list 'snmp-group' is
used for SNMP managed devices. When NSO connects to a managed device, it locates the authgroup
configured for that device. Then NSO looks up the local NSO user name in the 'umap' list. If an entry is
found, the credentials configured is used when authenticating to the managed device. If no entry is found in
the 'umap' list, the credentials configured in 'default-map' are used. If no 'default-map' has been configured,
and the local NSO user name is not found in the 'umap' list, the connection to the managed device fails.
2-64 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Device Groups
NSO requires SSH credentials to access a device
Named authgroups are used to map NSO user to device credentials
admin@nso(config)# devices device-group "PE Routers"
admin@nso(config-device-group-routers)# device-name PE1..9
admin@nso# devices device-group routers sync-from
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 38
The NSO Device Manager has a concept of groups of devices. A group is nothing more than a named group
of devices. What makes this interesting is that we can invoke several different actions on the group, thus
implicitly invoking the action on all members in the group. This is especially interesting for the apply-
template action and synch actions. The definition of device groups reside at the same level in the NSO data
model as the device list.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 39
Both device-templates and config-templates are based on the same principles and are interpreted the same
way. The difference is how they are stored and in what context they can be applied.
Two different types of templates exists:
Device-templates: These templates are part of the NSO configuration. Device-templates are created and
changed in the tree /devices/template/config the same way as any other configuration data and are
affected by rollbacks and upgrades. Device-templates can only manipulate configuration data in the
/devices/device/config tree i.e. only device data.
Config-templates: These templates gets loaded as part of packages. The config-templates are stored in
XML files in the templates sub directory of a package. Config-templates can be used to update any part
of the configuration.
The different types of templates can be used for different purposes. Basically the two types are the same but
they are stored in different ways and manipulated in different ways. It is easy to convert from one type to
another.
2-66 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Templates
Used to apply snippets of configuration Templates can hold
Create template: configuration for multiple device
admin@nso(config)# devices template NTP_DNS config
admin@nso(config-config)# ios:ntp server peer-list 10.0.0.1
types – NSO knows which part
admin@nso(config-server-list-10.0.0.1)# exit to use with which device
admin@nso(config-config)# ios:ip domain name cisco.com
admin@nso(config-config)# ios:ip name-server 198.18.133.1
admin@nso(config-config)# cisco-ios-xr:ntp server server-list 10.0.0.1
admin@nso(config-server-10.0.0.1)# exit
admin@nso(config-config)# cisco-ios-xr:domain name cisco.com
admin@nso(config-config)# cisco-ios-xr:domain name-server 198.18.133.1
admin@nso(config-config)# top
admin@nso(config)# commit
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 40
Templates can also be used to apply snippets of configuration. Templates are a flexible and powerful
mechanism in NSO which simplifies how changes can be made across the configuration data, for example
across devices of different type. They also allow a declarative way to describe such manipulations.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 41
Each value in a template is stored as a string. This string value is converted to the actual value type of the
YANG model when the template is applied.
Request devices device c1 apply-template template-name servers-static variable { name DNS_SERVER
value '192.168.2.14' } this would result in the value '192.168.2.14' being set to the dns server of device c1,
conversion from string to an actual IP Address will occur when the value is assigned.
2-68 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
XPath 1.0
Language for selecting nodes inside XML documents
Can be used to compute values based on on XML content
Used to navigate through XML tree structure
Nodes are selected based on criteria. For example @ipaddr would select all interface
ip addresses within the XML below
<?xml version="1.0" encoding="utf-8"?>
<router>
<interfaces>
<interface ipaddr="10.1.1.1">FastEthernet0</interface>
<interface ipaddr="10.1.1.2">FastEthernet1</interface>
<interface ipaddr="10.1.1.3">FastEthernet2</interface>
<interface ipaddr="10.1.1.4">FastEthernet3</interface>
</interfaces>
</router>
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 42
XPath 1.0 is a language for navigating within XML documents and can also be used to make computations
using the values stored in the XML document. XML can be represented using a tree structure and XPATH is
used to navigate through that structure.
admin@nso(config)# devices device PE11 apply-template template-name SHAPE variable { name DEV value 'PE11'}
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 43
XPath supports variables in addition to the typical operators, filters and functions. The example illustrates the
usage of variables and multiplication in an XPath expression where the speed in kbps is converted into QoS
configuration requiring a value in bps.
2-70 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Policies
The Device and Service models contain constraints that always must be true
You might want to add constraints at run-time
Example: a certain interface on the device must be available
admin@nso(config)# policy rule Loop0
admin@nso(config-rule-Loop0)# foreach /devices/device[name='PE11']
admin@nso(config-rule-Loop0)# expr config/ios:interface/Loopback[name=0]
admin@nso(config-rule-Loop0)# error-message "Loopback0 is Mandatory"
Policies allow you to specify network wide constraints that always must be true. If someone tries to apply a
configuration change over any northbound interface that would evaluate to false the configuration change is
rejected by NSO. Note that any configuration can be activated and deactivated. This means that in order to
temporarily turn off a certain policy you can deactivate it. Note also that if the configuration was changed by
any other means than NSO by local tools to the device like a CLI, a sync-from-device operation might fail if
the device configuration violates the policy.
Commit Queues
If one of the devices configured within a transaction is offline, the whole
transaction fails
This may not always be desired functionality!
Commit queues can be used to mitigate this
Transaction will succeed for Cisco
NSO Commit
non-responding devices
The configuration for the RESULT: SUCCESS
device will get queued RESULT: Commit Queued
NSO will repeatedly try to
push that configuration to the Device Offline
device RESULT: SUCCESS!
Do not confuse this with
invalid configurations
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 46
The concept of transactions eliminates best-effort configuration attempts. Either all configurations on all
devices succeed and are committed or the whole transaction fails and no changes are committed to the
network. Because NSO needs to wait for all devices to commit the configuration changes, this process can
become slow, especially when you have devices that are currently not responding. They are either offline or
inaccessible for other reasons. It may make sense to have a mechanism that handles this. This will be
separate the invalid configurations from devices that explicitly indicated an error from devices that are not
responding. This means that the transaction will only fail when the device explicitly indicates an error. If it is
simply unreachable, the changes will be backlogged in NSO but the transaction itself will still succeed.
2-72 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Commit Queues (Cont.)
Default behavior: an all-or-nothing network wide transaction
Alternative behavior using commit queues:
Synchronous commit:
admin@nso(config)# commit sync-commit-queue
Asynchronous commit:
admin@nso(config)# commit sync-commit-queue
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 47
One of the strengths on NSO is the concept of "network wide transactions". When we commit data to NSO
that spans multiple devices in the /devices/device tree, NSO will commit the data on all devices or none. The
downside of this is that the slowest device in each transaction limits the overall transactional throughput
through NSO. In NSO deployments scenarios where we wish to have higher transactional throughput than
what is possible using "network wide transactions", we can use the commit queues instead. Typically when
automation software north of NSO generates network change request it may very well be the case that more
requests arrive than what can be handled. Note, that the choke point in the majority of the cases will be the
devices, not NSO itself.
Another use case where we can use the commit queues is when we wish to push a configuration change to a
set of devices and we don't care about weather all devices accept the change or not. We do not want the
default behavior for transactions which is to reject the transaction as a whole if one or more participating
devices fail to process its part of the transaction.
When a transaction arrives at the system, NSO will split up the transactional content on a per managed
device basis. By default, NSO will - within the NSO transaction - send the data to each participating device.
The NSO transaction doesn't return until all participants have acknowledged the proposed configuration
change. With commit queues, NSO will compute the configuration change for each participating device, put
it in an outbound queue and immediately return. The queues are then independently run. The upside of this
scheme is that the transactional throughput through NSO is considerably higher. The downsides are:
If a device rejects the proposed change, NSO and the device will be out of sync. Whenever this happens,
an NSO alarm (called commit-through-queue-failed) is generated.
While a transaction remains in the queue, i.e. it has been accepted for delivery by NSO but is not yet
delivered, the view of the network in NSO is not (yet) correct. Eventually though, the queued item will
be delivered, thus achieving eventual consistency.
It’s up to the Operational Manager and the Business owners to decide how important these possible
consequences are and correlate these to the business impact.
There are several ways the commit command can be used. The commit command is the one that commits the
changes to the CDB and also starts the transactions that result in device configuration change.
2-74 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Pipes
A useful tool for command output processing
admin@nso# show running-config | ?
Possible completions:
annotation Show only statements whose annotation matches a pattern
append Append output text to a file
begin Begin with the line that matches
count Count the number of lines in the output
csv Show table output in CSV format
de-select De-select columns
display Display options
exclude Exclude lines that match
extended Display referring entries
hide Hide display options
include Include lines that match
linnum Enumerate lines in the output
match-all All selected filters must match
match-any At least one filter must match
repeat Repeat show command with a given interval
save Save output text to a file
select Select additional columns
sort-by Select sorting indices
tab Enforce table output
tags Show only statements whose tags matches a pattern
until End with the line that matches
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 49
Pipes are a useful tool for command output processing. The enable operations such as search, count and save
output to a file.
The precise list of pipe targets depends on the command executed. Some pipe targets, like select and de-
select are only available for the show command, whereas others are universally available.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 50
When using the Cisco style CLI you can use the well-known pipe filtering options such as begin and include.
Similarly you have Juniper style options when using the Juniper style CLI.
2-76 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Pipes (Cont.)
Example: display configuration with curly brackets
admin@nso# show full-configuration aaa authentication users | display curly-braces
user admin {
uid 1000;
gid 1000;
password $1$8KAvA4l/$nZ41qC0EH2xgEzT5pg7Tk.;
ssh_keydir /var/ncs/homes/admin/.ssh;
homedir /var/ncs/homes/admin;
}
user oper {
uid 1000;
gid 1000;
password $1$BznViZEs$w1ieVYCFKs.INR6d2Eo861;
ssh_keydir /var/ncs/homes/oper/.ssh;
homedir /var/ncs/homes/oper;
}
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 51
When reviewing configuration or configuration changes there is a useful pipe called display curly-braces.
This formats the output to use curly brackets and produces a Juniper style output.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 52
If you have large configurations it may make sense to be able to associate comments (annotations) and tags
with the different parts. And then be able to filter the configuration with respect to the annotations or tags.
For example, tagging parts of the configuration that relates to a certain department or customer. NSO has
support for both tags and annotations. We have a specific set of commands available in the CLI for
annotating and tagging parts of the configuration. There is also a set of pipe targets for controlling whether
the tags and annotations should be displayed, and for filtering depending on annotation and tag content.
It is possible to hide the tags and annotations when viewing the configuration, or to explicitly include them in
the listing. This is done using the display annotations/tags and hide annotations/tags pipe targets. If we
wish to hide all attributes (annotations, tags and FASTMAP attributes), we can do so by using the hide
attributes pipe target. Note that annotations and tags are part of the configuration. If you add, remove or
modify an annotation or tag you need to commit the new configuration, just as you would if you have made
any other change to the configuration.
2-78 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Annotations
An annotation is a kind a comment that can be applied to any element
admin@nso# annotate devices device PE11 config ios:interface Loopback 0 "OSPF Loopback"
admin@nso# show running-config devices device PE11 config ios:interface Loopback 0
config
/* OSPF Loopback */
ios:interface Loopback0
ip address 10.0.0.11 255.255.255.255
no shutdown
exit
!
OR
admin@ncs# show running-config | annotation "OSPF Loopback" | exclude \!
config
/* OSPF Loopback */
ios:interface Loopback0
ip address 10.1.1.1 255.255.255.255
ip nat inside
no shutdown
exit
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 53
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 54
A tag is very similar to annotations with a single difference – multiple tags can be applied to an element and
a tag is limited to one word.
2-80 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Template Tags
Tags with a specific purpose
They define how a template behaves when applied
merge | replace | create | nocreate | delete
admin@nso# tag add devices template loop config ios:interface Loopback 0 nocreate
admin@nso# tag add devices template loop config ios:interface Loopback 0 ip replace
admin@nso# show configuration devices template | display curly-braces
template loop {
config {
ios:interface {
/* Tags: nocreate */
Loopback 0 {
/* Tags: replace */
ip {
address {
primary {
address 127.0.0.1;
}
…
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 55
The templates also allow for defining different behavior when applying the template. This is accomplished
by setting tags such as merge, replace, delete or nocreate on relevant nodes in the template.
Replace tag means that when we apply the template, once we see a tag replace, we stop merging and start
replacing instead. Another tag we can use to annotate the template is nocreate. If we annotate the template
with the nocreate tag, the merge will only affect things that already exist in the target. It will never create the
node with this tag, or anything below it. It will only modify existing structures. Nodes can also be tagged
with delete. This means that when the template is applied, these nodes are deleted from the device, if they
exist. By default, configuration is merged and/or created.
References
For additional information, refer to these resources:
Cisco Documentation
2-82 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Lesson 3-1
YANG Tutorial
Overview
This lesson builds on the knowledge gained in the YANG overview lesson. In addition to
providing more information about YANG, this lesson also introduces the Network Services
Orchestrator (NSO) system and how YANG is used within the NSO architecture.
Objectives
Upon completing this lesson, you will be able to:
Understand Cisco NSO Software Architecture
Create service packages
Create validation patterns using regular expressions
Cisco NSO YANG Architecture
This topic describes the directory structure of NSO that is of importance when creating a
service model.
Package types:
Service packages
NED packages
Data provider packages
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 4
By default, NSO will be installed to /opt/ncs/ncs-X.Y directory where X.Y represents the software version
number (in case of a system install). The focus of this lesson is on the packages directory where we will be
creating new service packages.
Packages
All user code that needs to run in NSOmust be part of a package. A package is basically a directory of files
with a fixed file structure. A package consists of code, YANG modules, custom WebUI widgets etc. that are
needed in order to add an application or function to NSO. Packages is a controlled way to manage loading
and versions of custom applications.
A package is a directory where the package name is the same as the directory name. At the top level of this
directory a file called package-meta-data.xml must exist. The structure of that file is defined by the YANG
model $NCS_DIR/src/ncs/yang/tailf-ncs-packages.yang. A package may also be a tar archive with the
same directory layout. The tar archive can be either uncompressed with suffix .tar, or gzip-compressed with
suffix .tar.gz or .tgz.
3-2 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Cisco NSO Architecture
/opt/ncs/ncs-X.Y/ NSO root directory
packages/
pkg1/src/yang
Contain service package definitions
pkg2/src/yang
The packages directory contains at least one directory per services – the figure illustrates two service
directories where the src/yang subdirectory is used to hold the YANG service models. Additionally, you will
find the neds subdirectory where all the installed network element drivers are located.
packages/
src/
yang/
templates/
Note! The figure only illustrates the files and directories important for creating a template-based service.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 6
This lesson focuses on the simplest and fastest way of creating a service package by using templates only
without any additional Java-based programs. In order to create a package, we will focus on two main
components:
YANG service model located in the src/yang subdirectory.
XML device template located in the templates subdirectory.
In this lesson the focus is on creating a service which is mostly controlled by files in the templates and src
directories.
3-4 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Creating a Service Package
This topic describes the process of creating a service skeleton which consist of a number of
subdirectories and files. This is used as a starting point when creating a template-based service
package.
The remainder of this lesson will follow the package creation process as illustrated in the figure above:
The first step is to create a package skeleton which consists of the default service package subdirectory
structure and a set of default files needed to create the package.
The second step is to create a sample implementation of the new service using the Cisco NSO CLI.
The third step is to create a service template which provides the necessary mapping of YANG data
model to the individual device type configuration items.
The forth step is the creation of the YANG service model.
The final step is to compile and deploy the service.
Options:
Add a Web UI customization directory to the package
Etc.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 9
Use the ncs-make-package command to create an NSO package. The command creates an NSO package of
a certain type. For Network Element Drivers (NEDs), it creates a netsim directory by default, which means
that the package can be used to run simulated devices using ncs-netsim, i.e. that ncs-netsim can be used to
run simulation network that simulates devices of this type. The generated package should be seen as an initial
package structure. Once generated, it should be manually modified when it needs to be updated. Specifically,
the package-meta-data.xml file must be modified with correct meta data.
Packages can also be used to provide integration with external data sources (data providers).
There are other options available such as the webui used to add a WebUI customization directory to the
package, alternatively if no additional flags are chosen, it create a WebUI only package.
The focus of this lesson, however, is to create a simple template-based service package.
3-6 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Creating a Service Package Skeleton
cisco@nso:~/nso-run# cd packages/
cisco@nso:~/nso-run/packages# ncs-make-package –help
Usage: ncs-make-package [options] package-name
ADDITIONAL OPTIONS
--dest DIR
--build
--verbose
...
The tool can be used to create directory structure and skeleton files for:
NEDs: generic, NETCONF
Service packages and configuration mapping options: template, java, python or java and
template
Data provider packages
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 10
The figure illustrates how to use the ncs-make-package command to create the subdirectory and file
structure for a template based service package.
ADDITIONAL OPTIONS
--dest DIR
--build
--verbose
--ncs-depend-package DIR
--vendor <String>
-h | --help
3-8 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Step 2: Modify the YANG File
cisco@nso:~/nso-run/packages# ncs-make-package --service-skeleton template-based loopback
cisco@nso:~/nso-run/packages# cd loopback/
cisco@nso:~/nso-run/packages/loopback# ls -al
total 24
drwxr-xr-x 5 cisco cisco 4096 Oct 15 12:33 ./
drwxr-xr-x 16 cisco cisco 4096 Oct 15 12:33 ../ Create a package
drwxr-xr-x 2 cisco cisco 4096 Jun 28 12:47 load-dir/
-rw-r--r-- 1 cisco cisco 363 Oct 15 12:33 package-meta-data.xml
drwxr-xr-x 4 cisco cisco 4096 Oct 15 12:33 src/
drwxr-xr-x 2 cisco cisco 4096 Oct 15 12:33 templates/
cisco@nso:~/nso-run/packages/loopback# cd src/
cisco@nso:~/nso-run/packages/loopback/src# ls -al
total 20
drwxr-xr-x 4 cisco cisco 4096 Oct 15 12:33 ./
drwxr-xr-x 5 cisco cisco 4096 Oct 15 12:33 ../
drwxr-xr-x 3 cisco cisco 4096 Oct 15 12:33 java/
-rw-r--r-- 1 cisco cisco 377 Oct 15 12:33 Makefile
drwxr-xr-x 2 cisco cisco 4096 Oct 15 12:33 yang/
cisco@nso:~/nso-run/packages/loopback/src# cd yang/
cisco@nso:~/nso-run/packages/loopback/src/yang# ls -al
total 12
drwxr-xr-x 2 cisco cisco 4096 Oct 15 12:33 ./
Edit service model
drwxr-xr-x 4 cisco cisco 4096 Oct 15 12:33 ../
-rw-r--r-- 1 cisco cisco 655 Oct 15 12:33 mypackage.yang
cisco@nso:~/nso-run/packages/loopback/src/yang# vim loopback.yang
Preferably use an IDE for YANG which has syntax highlighting and YANG validation capability (e.g. Eclipse)
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 11
The figure illustrates the first steps in the creation of the subdirectories and files:
Create the skeleton using the ncs-make-package command.
Edit the package-meta-data.xml file to update the information (i.e. at least the description).
Edit the YANG data model where you will define your service model.
(Continued on the next page)
cisco@nso:~/nso-run/packages/loopback/src/yang# cd ..
cisco@nso:~/nso-run/packages/loopback/src# cd ..
cisco@nso:~/nso-run/packages/loopback# cd templates/
cisco@nso:~/nso-run/packages/loopback/templates# ls -al
total 12
drwxr-xr-x 2 cisco cisco 4096 Oct 15 12:33 ./
drwxr-xr-x 5 cisco cisco 4096 Oct 15 12:33 ../
-rw-r--r-- 1 cisco cisco 737 Oct 15 12:33 loopback.xml
cisco@nso:~/nso-run/packages/loopback/templates# vim loopback.xml
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 12
3-10 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Things to Learn?
How to build the template
How to design a YANG service model
Use the "top-down" or "bottom-up" approach, depending on the design
environment
So far we identified the main components in a template-based service package that we need to manipulate in
order to create a service package. The main topics of the remainder of this lesson are how to properly create
the two most important files in the service package:
YANG service model
XML mapping template
The so-called bottom-up approach can be used to simplify the entire process by going from a manual
configuration of the new service, from which we extract the XML template, which in turn allows us to create
the YANG service model.
Service requirements:
Configure loopback interfaces:
Interface number range: from 1000 to 1199
IP address range: 10.100.x.x to 10.199.x.x
IP mask: 255.255.255.255
Platforms: Cisco IOS and Cisco IOS XR
Note! This example is used throughout the remainder of this lesson to illustrate how to
create a simple template-based service model.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 14
Throughout this lesson we will use the illustrated simple service to learn how to create a template-based
service package. The first step in any service creation is its design. The sample service has the following
requirements and restrictions:
Configure loopback interfaces on Cisco IOS and Cisco IOS XR device types.
The interface number must be in the range from 1000 to 1199.
The interface's IP address must be in the range from 10.100.0.0 to 10.199.255.255.
The IP subnet mask must always be 255.255.255.255.
3-12 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Informal Service Model Defining Service Parameters
Loopback
IP Address
Device Subnet Mask
IP Address
Subnet Mask
IP Address
Subnet Mask
/device
/device/loopback-intf
/device/loopback-intf/ip-address
/device/loopback-intf/mask
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 15
In order to simplify further steps it is recommended to create an informal service design where we can
visualize the data model and more importantly create a data tree that will later be used to reference the date
from the template to the YANG model.
In our example we have created a model where any router can have any number of loopback interfaces as
long as they satisfy the requirements and restrictions set for the on the previous page.
Once we have the informal service design created and the skeleton package ready, we can proceed to the next
step where we will first try out our designed service by implementing it manually through the Cisco NSO
CLI.
3-14 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Example: Configure a Loopback Interface
admin@nso(config)# devices device PE31 config ios:interface Loopback 1172
admin@nso(config-if)# ip address 10.172.19.88 255.255.255.255
admin@nso(config-if)# exit
admin@nso(config)#
admin@nso(config)# devices device PE21 config cisco-ios-xr:interface Loopback 168
admin@nso(config-if)# ipv4 address 10.168.23.66 255.255.255.255
admin@nso(config-if)# exit
admin@nso(config)# commit
Notice that the NEDs for Cisco IOS and Cisco IOS XR expose slightly different
syntax due to different device CLIs
Central point of management prepends another layer to the configuration
hierarchy – devices
Repeat the service configuration step for each type of device in your environment
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 18
Let’s configure our sample service using the Cisco NSO CLI:
1. Enter configuration mode (use the conf command).
2. Configure a loopback interface on a Cisco IOS device.
3. Configure a loopback interface on a Cisco IOS XR device.
The configuration step has to be repeated for each type of device in the current environment as the
configuration syntax differs (note the difference between Cisco IOS and Cisco IOS XR).
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 19
Once the configuration is done, you may inspect the candidate configuration before it is pushed to the
routers. To do that you can use the commit dry-run command or the compare running brief command.
The figure show the NSO style of configuration.
3-16 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Example: Check Native Configuration
admin@nso(config)# commit dry-run outformat native
device PE21
Up-to three configuration
interface Loopback 168 verification stages:
ipv4 address 10.168.23.66 255.255.255.255
exit Cisco NSO validation
device PE31 Device validation before
interface Loopback1172
ip address 10.172.19.88 255.255.255.255 configuration activation
exit Device validation at
admin@nso(config)# commit
Commit complete. configuration activation time
admin@nso(config)#
Any one of the verification stages failing will result in all changes being reverted
on all devices that were part of the same transaction
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 20
The commit dry-run command also supports output formatting options using the outformat keyword:
cli (default): displays the NSO style configuration.
native: displays how the configuration will be converted to the native CLI of the target device.
xml: display how the native target device configuration can be represented in the XML format.
In our example we should record the XML format of the native configurations for the two device types that
we are using. This information will later be used to create the mapping template from the service model to
the device configuration.
In the figure, you see the service parameters being highlighted:
Interface number
IP address
Subnet mask
The XML name space parameter determines the device type.
Use the commit command to deploy the configuration to the devices.
3-18 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Example: Check Interface Status
admin@nso(config)# exit
admin@nso#
admin@nso# show devices device PE31 live-status interfaces Loopback ?
Possible completions:
0 100 1172
Possible match completions:
ip-address mac-address
admin@nso#
admin@nso# show devices device PE31 live-status interfaces Loopback 1172
MAC
TYPE NAME IP ADDRESS ADDRESS
------------------------------------------
Loopback 1172 10.172.19.88/32 -
admin@nso#
admin@nso# ping 10.172.19.88
PING 10.172.19.88 (10.172.19.88) 56(84) bytes of data.
64 bytes from 10.172.19.88: icmp_seq=1 ttl=255 time=1.24 ms
64 bytes from 10.172.19.88: icmp_seq=2 ttl=255 time=0.824 ms
[ok][2014-10-28 09:26:03]
admin@nso#
A thorough verification and testing is required to confirm that the configured sample
service can be used as a starting point for designing a service model
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 22
Once you have deployed the configuration you may verify the result. In this particular case where we have
created an addressable interface we can actually ping the target or check the existence of the newly deployed
interface on the devices.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 23
Any service creation would typically be preceded by a thorough testing of the new service. Using real
devices instead of simulated devices (i.e. netsim) is recommended as it allows us to use traditional service
design approaches where thorough testing is needed to ensure proper behavior before putting the service into
production.
3-20 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Service Template
This topic describes the creation of a device template that is used to map the service parameters
into a device-specific configuration.
Now that we have the new service deployed in a test environment and we have the native configurations in
XML format, we can proceed to the creation of the mapping template.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 26
The figure illustrates the default contents of the skeleton XML file that was created by the ncs-make-
package command.
It is recommended to use all lowercase names for identifiers:
file name (e.g. loopback.xml).
servicepoint (e.g. "loopback"). The servicepoint should be the same as the file name without the
extension.
The skeleton XML file already contains the device segment where there is a reference to active set of
devices.
The skeleton XML file contains the config segment where we should add out own mapping logic for the
new service.
3-22 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Example: Convert XML Configuration to Template
admin@nso(config)# commit dry-run outformat xml <config-template xmlns="http://tail-f.com/ns/config/1.0"
device PE31 { servicepoint="loopback">
<interface xmlns="urn:ios"> <devices xmlns="http://tail-f.com/ns/ncs">
<Loopback> <device>
<name>1172</name>
Variable <name>{/device}</name>
<config>
<ip>
<interface xmlns="urn:ios" tags="merge">
<address> <Loopback>
<primary>
<address>10.172.19.88</address> Variable <name>{loopback-intf}</name>
<description tags="merge">Loopback{loopback-intf}</description>
<mask>255.255.255.255</mask> <ip>
</primary> Fixed <address>
</address> <primary>
</ip> <address>{ip-address}</address>
</Loopback> <mask>255.255.255.255</mask>
</interface> </primary>
} </address>
</ip>
device PE21 {
</Loopback>
<interface xmlns="http://tail-f.com/ned/cisco- </interface>
ios-xr"> <interface xmlns="http://tail-f.com/ned/cisco-ios-xr" tags="merge">
<Loopback> <Loopback>
<id>168</id> <name>{loopback-intf}</name>
<ipv4> <description tags="merge">Loopback{loopback-intf}</description>
<address> <ip>
<mask>255.255.255.255</mask> <address>
<ip>10.168.23.66</ip> <primary>
</address> <address>{ip-address}</address>
</ipv4> <mask>255.255.255.255</mask>
</primary>
</Loopback>
</address>
</interface> </ip>
} ...
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 27
Refer back to your informal service design and the structure of data as well as the recorded native device
configuration in XML format. Paste the XML configurations into the XML template and replace the
parameter values:
/device – use variable to reference to a device
/device/loopback-intf – use a variable to reference interface number of the loopback. Note that there is
no need to specify the entire path as the looback interface is contained within the parent device.
/device/loopback-intf/ip-address – use a variable to reference the IP address of the loopback. Note that
there is no need to specify the entire path as the IP address is contained within the parent loopback
interface.
/device/loopback-intf/mask – use a static value for the subnet mask as it is required by the design to
always have a /32 subnet.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 28
You may also notice that the XML elements contain tags which control how NSO will process the elements:
merge (default): the changes will be merged with the existing data; if the data structure does not exist it
will be created.
replace: the configuration data will be replaced by the new configuration.
delete: the configuration data will be deleted.
nocreate: the configuration data will be merge only if it already exists, otherwise it will be ignored.
By default, the skeleton XML file will use the merge tag.
3-24 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
YANG Service Model
This topic describes the creation of a YANG service model.
Finally we get to the configuration of the service model that will represent a vendor independent view of the
service to the operator either directly through the NSO CLI or GUI or through a separate frontend
management systems that is integrated with Cisco NSO (e.g. via Representation State Transfer [REST]
application programming interface [API]).
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 31
The following example that is described on the following pages can be divided into the following four steps:
1. Create a service skeleton using the ncs-make-package command.
2. A visual or textual representation of the service and its parameters can now be translated into a high
level YANG model.
3. Each component is then described in detail (e.g. data types, restrictions (e.g. pattern, minimum or
maximum number of instances, range), annotation, etc.
4. A finalized YANG model is ready to be tested.
3-26 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Step 1: Creating the Service Model: Start with Skeleton Model
module loopback {
namespace "http://com/example/loopback"; Change directory to
prefix loopback;
../src/yang
import ietf-inet-types { prefix inet; }
import tailf-ncs { prefix ncs; }
Edit the skeleton service
augment /ncs:services {
list loopback { model
bname;
uses ncs:service-data; The module augments the
ncs:servicepoint "loopback"; Cisco NSO services module
leaf name {
}
type string; Devices are already
references
// may replace this with other ways of refering to the devices.
leaf-list device {
type leafref { Replace the dummy leaf with
path "/ncs:devices/ncs:device/ncs:name";
} your service model
}
// replace with your own stuff here
leaf dummy {
type inet:ipv4-address;
Replace this section with
}
} your service model.
}
}
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 32
Change the directory to ../src/yang and edit the skeleton YANG file. The dummy leaf is there as a single
parameter of the service. This part can be deleted and replaced with your own service model. The rest of the
module file should be fine although you can change it if the service design requires it.
C devices
Reuse existing resources
L devices (e.g. devices)
K name
Augment the services
PE21
PE31
module
PE32
C services
L loopback
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 33
The figure illustrates the relevant portions of the NSO data model that are of interest to us when creating the
service model:
The devices modules contains the information about the active devices in the environment.
The service module contains the services and by using the augment /ncs:services option we will add our
own service to this module.
The section within the highlighted box is our addition to the services module:
Each instance of the deployed service is uniquely identified using a name (sting). That means we will
use the list YANG keyword to allow multiple instances. The servicename leaf will be used as the key.
Additionally, we want to ensure that the model does not allow the usage of incompatible configurations:
— Ensure global uniqueness of the IP address: unique ip-address
— Ensure local (per-device) uniqueness of the interface number: unique "device loopback-intf"
3-28 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Step 2: Creating the Service Model: Top Level List
L loopback
module loopback {
namespace "http://com/example/loopback"; Add your data model to the skeleton based on
prefix loopback; the informal design you have created earlier:
import ietf-inet-types { prefix inet; }
import tailf-ncs { prefix ncs; } Leaf servicename is used as key for the list
import tailf-common { prefix tailf; }
augment /ncs:services { Leafs device, loopback-interface and ip-
list loopback {
leaf servicename { ... } address are leafs identifying the loopback
leaf device { ... }
leaf loopback-intf { ... } interface parameters
leaf ip-address { ... }
}
}
}
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 34
From the informal service model we see that we need four leafs in the loopback list:
servicename: Unique key identifying the service instance.
device: Reference to the active devices.
loopback-intf: Loopback interface number.
ip-address: IP address of the loopback interface.
L loopback
...
list loopback { Tell NSO that this is a service
key servicename;
The custom name for the service is used
uses ncs:service-data;
ncs:servicepoint "loopback"; as unique identifier in the list
leaf servicename {
tailf:info "Service Instance Name"; Optionally use the NSO-specific
type string;
}
annotations to provide textual description
... used in NSO CLI and GUI
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 35
The first parameter in our service is optional but it is good practice to allow any service instance to have a
descriptive name to make it easier for operators to find those instances. We could also create a descriptive
name by automatically combining multiple values into the name (e.g. customer name, device name, interface,
etc.).
Make sure you do keep the lines generated by the ncs-make-package command:
uses ncs:service-data
ncs:servicepoint "loopback"
The first line expands to a YANG structure that is shared amongst all services. The second line connects the
service to the Java callback.
You are also encouraged to use the NSO-specific annotations to provide additional information for the
service model by first importing the tailf-common module. In the example we use the tailf:info annotation
which provides a description of the parameter when accessed via the NSO CLI or GUI. Use the man
tailf_yang_extensions command on the server to get a list of all annotations and their descriptions.
3-30 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Step 3: Creating the Service Model: Implement Service Model
L loopback
...
list loopback { Keep the default reference to the live
...
leaf device {
list of devices
tailf:info "Router name";
mandatory true; Optionally, you may limit the
type leafref {
path "/ncs:devices/ncs:device/ncs:name"; referenced devices (e.g. only PE
}
} devices
...
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 36
The second parameter is the device on which we want to configure a loopback interface. In this example we
leave the default reference as generated by the ncs-make-package command. We only added the description
to the option.
L loopback
...
list loopback { One explicit design
... requirement: loopback
leaf loopback-intf {
tailf:info "Loopback Interface Number from 1100 to 1199"; interface number must be
mandatory true;
type uint32 { between 1100 and 1199
range "1100..1199";
}
}
One implicit requirement:
... loopback interface number
is mandatory
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 37
The third parameter is the loopback interface number. We use the integer data type (uint32 in the example)
and we further limit the data type to only accept the number range set forth in our design – from 1100 to
1199.
3-32 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Step 3: Creating the Service Model: Implement Service Model (Cont.)
L loopback
...
list loopback { The inet:ipv4-address data
... type limits the value to a
leaf ip-address {
tailf:info "Valid IP range from 10.100.x.x to 10.199.x.x."; properly formatted IPv4
mandatory true;
type inet:ipv4-address { address
pattern "10\.1[0-9][0-9]\.[0-9]+\.[0-9]+";
}
}
A additional pattern is used
... to further limit the address
to the desired range
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 38
The last parameter is the IP address of the loopback interface. A number of data types are available to
support common scenarios by importing the two modules defined by RFC-6991 Common YANG Data
Types:
ietf-inet-types
ietf-yang-types
In this case we make use of complex network data types provided by ietf-inet-types where we can enforce
the proper IP version 4 (IPv4) address format. In addition, we limit the IP address to the required range of
addresses as shown by the sample using the pattern command.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 39
At this time it may be beneficial to revisit the most common regular expression options that can be used with
YANG. The regular expression rules used are defined in XML Schema Part 2: Datatypes Second Edition
(http://www.w3.org/TR/2004/REC-xmlschema-2-20041028/#regexs).
3-34 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Regular Expressions - Example
Goal: match valid IP addresses in the range from 10.100.0.0 to 10.199.255.255 = match
valid not in range not valid IP not valid IP
10.100.1.1 10.200.1.1 1001.100.1.1 10.100.1.500 = no match
Which of the above addresses will be matched by the following regular expressions
10.\d+.\d+.\d+ 10.100.1.1 10.200.1.1 1001.100.1.1 10.100.1.500
10\.\d+\.\d+\.\d+ 10.100.1.1 10.200.1.1
1001.100.1.1
10.100.1.500
10\.1[0-9][0-9]\.[0-9]+\.[0-9]+ 10.100.1.1 10.200.1.1 1001.100.1.1 10.100.1.500
Do not reinvent the wheel - reuse ietf-yang-types and ietf-inet-types modules where a
number of useful data types are already defined
(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])
ipv4-address
data type
and
10\.1[0-9][0-9]\.[0-9]+\.[0-9]+ 10.100.1.1 10.200.1.1 1001.100.1.1 10.100.1.500
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 40
The above figure provides an example for practicing regular expressions ant to illustrate that a simplified
regular expression may not provide adequate protection against invalid parameters being used.
The example at the bottom of the page illustrates the optimal approach where the complex regular
expressions can be used by importing modules that contain them and then simply augmenting them with
additional restrictions.
In the example we use the ietf-inet-types module which contains a very specific and accurate regular
expression to validate proper IPv4 address format and then augment it with our additional restriction.
The printout above shows the entire service model that we have created to provision loopback interfaces on
routers.
Note that if you need to provide support for an additional type of device you do not have to change anything
in the service model. You simply need to add another mapping into the XML template.
3-36 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Deploy a Service
This topic describes how to install a new service package and deploy service instances.
The last step in the process is to enable the new service package.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 44
In the shell, change to a parent directory where there is Makefile that was generated by ncs-make-package
command. Use the make command to compile the package. If the compile process fails you should see the
line number of the most probable origin of a mistake in either the YANG or XML file. Once you fix all
problems, the make process should complete successfully (i.e. no error message is displayed).
In the NSO CLI, issue the request packages reload command in the operational mode to tell the NSO server
to reload all packages including the new and changed packages. Note that this process may take a while.
Also note that there may be a misconfiguration in the package that did not cause the compilation to fail but
may fail the package validity check which will be reported by the NSO CLI.
You may also inspect the /var/log/ncs/ncs.log file to see the process of loading files and to see if any files
failed to load.
3-38 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Parameter Restrictions Enforced Already in GUI and CLI
YANG data types and
constraints are validated
admin@nso(config)# services loopback Test device PE31 loopback-intf 123
------------------------------------------------------------------------^
syntax error: "123" is out of range.
admin@nso(config)# services loopback Test device PE31 loopback-intf 1123 ip-address 10.123.1.1
admin@ncs(config-loopback-Test)# top
admin@nso(config)# commit
Commit complete.
admin@nso(config)# exit
admin@nso# show service loopback Test
services loopback Test
device-modifications devices {
device PE31 {
config {
ios:interface {
+ Loopback 1123 {
+ description Loopback1123;
...
Once the new service package is successfully loaded you can try to configure a loopback interface, except
this time you will use the set service command instead of the set device command. As you can see from the
example, the set service command is vendor independent where we only set the service's parameters without
concerning ourselves with the actual syntax of native CLI's of all the used device types. You may, however,
still use the commit dry-run outformat native command to see the device-type-specific commands that will
be deployed to the target devices.
References
For additional information, refer to these resources:
Cisco documentation.
3-40 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Lesson 3-2
FASTMAP
Overview
This lesson explains what the FASTMAP algorithm is, what it does and how it streamlines the
whole service lifecycle.
Objectives
Upon completing this lesson, you will be able to:
Explain what FASTMAP algorithm does
Describe how FASTMAP covers the whole service lifecycle
Point out FASTMAP usage considerations
Explain which mechanisms available to complement FASTMAP
Introduction
This topic explains what FASTMAP is.
Overview Create
Delete
NSO reduces service to Modify
device configuration UI/API Transactions
mapping to minimum
Service YANG Service
Covers complete service Models
Configuration
lifecycle Create
Delete
Minimum configuration Modify
change is calculated and Device YANG Device
applied automatically Configuration Models
CLI
SMP Commands
NETCONF
Device
Commands
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 4
Cisco Network Services Orchestrator reduces the mapping challenge to a bare minimum. The solution covers
the complete service life-cycle so that services can be changed and deleted and NSO will automatically
calculate the minimum change to be applied to the network.
How does NSO solve this? Service and device models are the foundation for the solution. NSO uses the
IETF standardized YANG [RFC 6020] modeling language to specify service models as well as device
models. This is true even for devices that do not support YANG natively like CLI or Simple Network
Management Protocol (SNMP) based devices. The NSO tool-chain automatically generates YANG from
SNMP MIBs and for CLI devices the declarative YANG model can automatically render the corresponding
CLI commands. This collapses the first problem; the mapping is reduced to a YANG to YANG mapping
problem rather than the normal mapping from informal service models to sequences of CLI commands or
sequences of SNMP SETs.
How can NSO calculate the minimum diff towards the network? NSO stores the service instances and the
device configurations in the embedded Configuration Database (CDB). In contrast to traditional "offline"
inventory systems NSO focus on transactional integrity between the data-store and the network. The core
technology of NSO is the capability to read and write configuration to/from the devices. This leads to a "real-
time" database that is always in sync with the network. Therefore NSO can look at the desired device
configuration and generate the diff versus current configuration at the model-level. Second, NSO can
automatically render the underlying device commands for various interfaces like Cisco-style CLI, Network
Configuration Protocol (NETCONF), SNMP etc. No programming is required for this. Note that this also
includes tricky problems like sending CLI commands or SNMP protocol data units (PDUs) in the correct
order, depending on what has changed.
How is the transformation from service models to device models defined? This is normally a complex
problem. It might look easy from a 1000 feet view, but when it comes to the actual configuration values for a
router there are configuration details that need to be well defined. NSO simplifies this drastically by use of
the FASTMAP algorithm. Typically, an engineer defines a higher level service model representing for
example the VPN service itself and this service shall result in actual device configurations.
3-42 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
FASTMAP
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 5
FASTMAP is the patented algorithm that records the modifications in the create() callback, and is
responsible for automatically handling the modify and delete case.
FASTMAP enables automatic management of any kind of change and deletion of a service. All change
scenarios and deletion are inferred from a single definition of the creation of the service. The mapping from
the service create to the corresponding device configuration is defined in a high level application
programming interface (API) or through a template. The programmer only has to define the service create
method. If later on a user changes or deletes an existing service NSO calculates the changes.
As a result, at any point in time a user or external client can modify a service and NSO will automatically
calculate the required minimum diff to the network. Also deleting a service from the network will
automatically clean up all configuration data on the devices.
Service dry-run:
Displays the calculated minimum diff
Does not execute the transaction
Service check-sync:
Is the service configuration in sync with the actual device configuration?
Detects manual configuration changes.
Shows the minimum diff to restore the service.
Service re-deploy:
Generates the minimum diff and restore a service to the network
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 6
3-44 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Service and Device Models
This topic explains what service and device models are.
Service Models
Source IP
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 8
Services, service models, and device models are vague terms and can mean different things for different
people. A Service Model is a black-box definition how the service is configured. What are the parameters
that are entered by a network engineer in the NSO CLI/WebUI? What are the parameters that are sent to
NSO from the order management system to provision the service?
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 9
Device models in NSO normally refer to concrete models of the actual device type. It is connected to the
underlying device interface and network element drivers (NED). Of course, if the device supports
NETCONF/YANG the device model is the actual YANG model from the device vendor. For SNMP, it is the
YANG model generated by the NSO tool-chain from the MIBs. For CLI devices like for example a Cisco
IOS device it is the YANG model that is part of the CLI NED.
So device models are concrete, they specify the relevant parameters that can be configured on the device.
This is not to be confused with abstract general device models that do not map to an actual device. So in the
context of service mapping, the service model shall be mapped to a concrete exact model of the devices that
are included in the solution. NSO allows for an abstraction mechanism to provide an abstracted view of
different device vendors.
So, in theory, the service model could be mapped to abstractions, which in turn map to the actual concrete
device models. Experience has shown that it is better to let the service models be the "abstraction" and map
that to concrete device models rather than to provide a vendor abstraction layer. In NSO context, the service
models are the abstraction.
3-46 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
FASTMAP Principles
This topic describes the FASTMAP functionality.
FASTMAP
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 11
remote=10.1.1.15 remote=10.1.1.11
intf=0/5 pw-id=102 intf=0/9
device=PE11 device=PE12
The figure illustrates a sample service that will be used over the following pages to explain the behavior of
FASTMAP when creating, modifying and deleting service instances.
A simple Point-to-Point Layer-2 MPLS VPN is used. Each side of the point-to-point L2 VPN is defined by
the following configuration parameters:
Common pseudowire identifier (pw-id)
Device identifier (device)
GigabitEthernet interface identifier (intf)
Remote IP address for directed LDP (remote)
3-48 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
FASTMAP: Create a Service Instance
Undo
NSO stores the device level undo
Service
Model Service Instance information (reverse-diff) for each
service instance as a binary
Database APIs object inside the service instance
Create
Model-to-model
mapping
Database APIs
Create
Modify
Device
Models Device Changes Delete
To
devices
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 13
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 14
The sample configuration illustrates the configuration of the P2P L2 MPLS VPN using the NSO CLI.
3-50 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Example: Create a New Service
admin@ncs(config)# commit dry-run
device PE11 NED device model governs
config {
ios:interface { device configuration
GigabitEthernet 0/5 { parameters
xconnect {
+ address 10.1.1.15;
+ vcid 102; XML, Java or Python map
+ encapsulation mpls;
} service parameters to device
}
} configurations
}
device PE12
config {
ios:interface {
GigabitEthernet 0/9 {
xconnect {
+ address 10.1.1.11;
+ vcid 102; Service parameters
+ encapsulation mpls;
} mapped to device
}
} configuration
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 15
When using the commit dry-run command, the curly-braces type configuration will be shown and the "+"
and "-" signs will indicated the changes that will be appliend in case a full commit is executed. When a new
service is created, the minimal diff for the device configuration is calculated automatically. The picture
above shows the result of this minimal diff by indicating the new configuration lines with a ‘+’ sign.
admin@ncs(config)#
Can display native
commands in case
of CLI NED
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 16
Similarly, using the commit dry-run outformat native command, the device's native configuration will be
displayed in case we are using a CLI NED. CLI NED's YANG model contains additional information that
governs mapping of YANG statements to CLI commands. NETCONF capable devices would receive
configuration in the form of XML that can also be displayed using the commit dry-run outformat xml
command.
3-52 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
FASTMAP: Service Create
CDB / Device
/services /devices
./device='PE11' ./xconnect
PE12
./interface='0/5' address='10.1.1.15'
interface GigabitEthernet0/9
./remote='10.1.1.15' vcid='102'
xconnect 10.1.1.11 102 encapsulation mpls
encapsulation='mpls' !
The figure illustrates the two major branches in the CDB governing services and devices:
The /services subtree contains our service instance configurations
The /devices subtree contains our device configurations
The template, Java or Python based mapping logic transforms service parameters into device configurations.
The minimal difference between the current state and the new state (diff) is then sent down to the devices.
When the service instance is created the reverse of the resulting device configuration (referse diff) is also
stored together with the service instance.
Create
Delete
Delete Create the
existing modified instance
instance
Database APIs
Create
Modify
Device
Models Device Changes Delete
To
devices
Only send differences
to devices.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 18
The figure illustrates the modify method in NSO which is really just a combination of delete and create:
1. Delete the current service instance (only within the Cisco Discovery Protocol, no actual device
configuration happens at this stage).
2. Create a new service instance using the modified parameters (only within the CDP; no actual device
configuration happens at this stage).
3. Compute the configuration changes between the previous and new state.
4. Send only the changes to the devices.
3-54 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Modify and Existing Service: Example 1
admin@nso# config
Entering configuration mode terminal Only one parameter changed
admin@ncs(config)# services l2vpn ACME
admin@ncs(config-l2vpn-ACME)# pw-id 122
admin@ncs(config-link-PE12)# top CDB shows only minimal diff
admin@ncs(config)# commit dry-run changes
device PE11
config {
ios:interface {
GigabitEthernet 0/5 {
xconnect {
- vcid 102;
+ vcid 122;
}
}
}
}
device PE12
config {
ios:interface {
GigabitEthernet 0/9 {
xconnect {
- vcid 102;
+ vcid 122;
}
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 19
The next example shows how the modify action is handled by FASTMAP. The figure illustrates the minimal
diff based on the changed pseudowire ID (called pw-id in the service model and vcid in the device model).
Looking at the data structure in the CDB we see that the existing VCID 102 will be removed and the new
VCID 122 will be added.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 20
When using the commit dry-run outformat native command we see that more than just the VCID will be
changed. This is because we are using a CLI NED and the CLI syntax bundles multiple parameters into a
single command. Hence, we need to re-apply the entire xconnect command including the IP address even
thoug we did not change the IP address. These dependencies are also described in the device's YANG model
using the NSO-specific instructions that govern how YANG statements are translated into CLI commands
and vice versa.
3-56 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
FASTMAP: Service Modify (1)
CDB / Device
/services /devices
./device='PE11' ./xconnect
PE12
./interface='0/5' address='10.1.1.15'
interface GigabitEthernet0/9
./remote='10.1.1.15' vcid='122'
xconnect 10.1.1.11 122 encapsulation mpls
encapsulation='mpls' !
The figure illustrates the tree structure and which nodes get changed in the VCID modification and how these
modifications translate into device CLI commands.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 22
The second modification example changes the IP address in our existing L2 MPLS VPN service instance.
This change only affect one device (PE11).
3-58 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Modify and Existing Service: Example 2 (Cont.)
admin@nso# config
Entering configuration mode terminal
Changed parameter affects
admin@ncs(config)# services l2vpn ACME only one device
admin@ncs(config-l2vpn-ACME)# link Site1
admin@ncs(config-l2vpn-ACME)# remote 10.1.1.12 CLI NED may have additional
admin@ncs(config-link-PE12)# top
admin@ncs(config)# commit dry-run outformat native dependencies between
device PE11 configuration options (e.g.
interface GigabitEthernet0/5
xconnect 10.1.1.12 122 encapsulation mpls multiple parameters in a single
exit line)
exit
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 23
The change only affects one device but we still need to re-enter the entire xconnect command.
/services /devices
./device='PE11' ./xconnect
PE12
./interface='0/5' address='10.1.1.12'
./remote='10.1.1.12' vcid='102'
encapsulation='mpls'
FASTMAP: service mapping & diff Diff sent only to affected device
& update reverse diff
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 24
The figure illustrates the tree structure and which nodes get changed in the IP address modification and how
these modifications translate into device CLI commands.
3-60 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Modify and Existing Service: Example 3
admin@nso# config
Entering configuration mode terminal Only one parameter changed
admin@ncs(config)# services l2vpn ACME
admin@ncs(config-l2vpn-ACME)# link Site1
admin@ncs(config-l2vpn-ACME)# intf 0/6 CDB shows only minimal diff
admin@ncs(config-link-PE12)# top changes
admin@ncs(config)# commit dry-run
device PE11
config {
ios:interface {
GigabitEthernet 0/5 {
xconnect {
- address 10.1.1.5;
- vcid 123;
- encapsulation mpls;
}
}
GigabitEthernet 0/6 {
xconnect {
+ address 10.1.1.5;
+ vcid 123;
+ encapsulation mpls;
}
}
}
}
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 25
The third modification example illustrates the reconnecting of a customer site from interface
GigabitEthernet0/5 to GigabitEthernet0/6.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 26
The example illustrates how the reverse diff will make sure that the existing configuration is removed and the
new mapped configuration will be applied.
3-62 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
FASTMAP: Service Modify (3)
CDB / Device
/services /devices
The figure illustrates the tree structure and which nodes get changed in the interface modification and how
these modifications translate into device CLI commands.
Delete
Apply the undo
configuration
Database APIs
Create
Modify
Device
Models Device Changes Delete
To
devices
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 28
3-64 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Delete a Service Instance
admin@nso# config
Entering configuration mode terminal Only one parameter changed
admin@ncs(config)# no services l2vpn ACME
admin@ncs(config)# commit dry-run
device PE11 CDB shows only minimal diff
config {
ios:interface { changes
GigabitEthernet 0/6 {
xconnect {
- address 10.1.1.12;
- vcid 122;
- encapsulation mpls;
}
}
}
}
device PE11
config {
ios:interface {
GigabitEthernet 0/9 {
xconnect {
- address 10.1.1.11;
- vcid 122;
- encapsulation mpls;
}
}
}
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 29
The last example illustrates the delete action where the NSO will apply the reverse diff to revert back to the
original state before this service instance was created.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 30
3-66 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
FASTMAP: Service Delete
CDB / Device
/services /devices
./device[name='PE11'] PE11
./config interface GigabitEthernet0/6
no xconnect 10.1.1.12 122 encapsulation mpls
./interface !
./GigabitE[name='0/6']
PE12
interface GigabitEthernet0/9
no xconnect 10.1.1.11 122 encapsulation mpls
!
Once the reverse diff is applied, the service instance is no longer present in the services subtree and the
devices subtree reflects the device configurations without the unconfigured service.
Advanced FASTMAP
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 33
One of the advanced features of FASTMAP is that it keeps track of each configuration element's owner (i.e.
creator) thus enabling the configuration of shared service resources without worrying about what service
instance deletions will do to other service instances relying on the same shared configuration.
3-68 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Services Sharing Resources
CDB NSO maps service parameter
Service Instances Device Changes to device configuration
L2 VPN a1 xconnect a1
Refcount=1 NSO counts owners of each
Backpointer=l2vpn[name='A1'] configuration element
loopback 1
Operator creates Refcount=1 NSO remembers owners of
service instance Backpointer=l2vpn[name='A1']
each configuration element
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 34
The figure illustrates how the deployment of first L2 MPLS VPN service instance on a given device also
creates the prerequisite with is a Loopback interface to enable the configuration ant establishment of directed
LDP sessions. As you can see, the service parameters will result in two elements being configured on the
analyzed device: xconnect and loopback.
NSO keeps track of configuration element owners using the so-called backpointers and also counts the
number of owners using the so-called refcounter.
L2 VPN a1 xconnect a1
Refcount=1
Backpointer=l2vpn[name='A1']
Backpointer=l2vpn[name='a1']
L2 VPN a2
xconnect a2
Refcount=1
Backpointer=l2vpn[name='a2'] NSO increases the count of
owners of shared
Operator creates loopback 1 configuration elements
another service
Refcount=2
instance Backpointer= l2vpn[name='a1'], NSO updates the list of
l2vpn[name='a2'] owners of shared
configuration elements
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 35
When adding a second service instance to the same device we no longer need to configure the loopback
address but NSO should remember that there are now two owners (services that depend on the loopback
configuration) and so the FASTMAP algorithm will increase the refcounter to 2 and add the second instance
to the backpointer list.
3-70 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Services Sharing Resources
CDB
Service Instances Device Changes NSO only deletes those
xconnect a1
elements whose reference
L2 VPN a1
count is 1
Refcount=1
Backpointer=l2vpn[name='A1']
Backpointer=l2vpn[name='a1']
L2 VPN a2
xconnect a2
Refcount=1
Backpointer=l2vpn[name='a2'] NSO decrements reference
count on those elements that
Operator deletes were not deleted
one service loopback 1
instance Refcount=1 NSO updates the list of
Backpointer= l2vpn[name='a2']
owners of shared
configuration elements
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 36
The third example illustrates the decommissioning of the first service instance. This results in the application
of reverse diff but only for those configuration elements whose refcounter equals 1. The loopback
configuration will only have its refcounter decremented and the first service instance removed from the
backpointer list.
L2 VPN a2
xconnect a2
Refcount=1
Backpointer=l2vpn[name='a2'] NSO deletes shared element
Operator deletes as well
last service loopback 1
instance Refcount=1
Backpointer= l2vpn[name='a2']
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 37
The last example illustrates the decommissioning of the last service instance thus also removind the loopback
configuration due to refcounter now reaching 0.
3-72 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Advanced FASTMAP
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 38
The previously explained functionality is for reference only when template-based service mapping is used. It
is, however, important to understand FASTMAP when using other service mapping options such as Java or
Python callbacks (not covered in this course).
The figure illustrates the two-stage service deployment using Reactive FASTMAP where we must first
instantiate VNFs (stage 1) before being able to configure them (stage 2).
1. A service order comes in from operator or operations support system (OSS).
2. Service application reads service instance data and configures network elements accordingly. If new
VMs (or other environment setup) are required before the actual network devices can be reached, the
service application configures the Cloud Manager to have additional virtual machines (VMs).
3. NSO Device Manager sends the first incarnation of this transaction to the network, requesting the Cloud
manager to spin up new VM(s).
4. A service trigger application is listening for VM change events and is notified when the new VM is
ready. The service trigger application starts a new NSO transaction, configures the new device VMs in
the NSO device list and commits.
5. The service trigger application issues a service redeploy on the service(s) that are pending the VM
creation. This will invoke the service application again, like in step 2.
6. Only this time the all the necessary resources are available, and the service application will configure
them with the appropriate configuration. The NSO Device Manager sends out the second incarnation of
this transaction to the network.
3-74 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Reactive FASTMAP (Cont.)
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 40
The Reactive FASTMAP design pattern can be applied in use cases where services need to be activated in
two or more stages. This pattern is also applicable in use cases where the service needs to adapt to a changing
environment. If for example the Cloud Manager decides to move a VM from one host to another, the service
trigger application would notice and request the affected services to be redeployed. The service application
would then recompute the device configurations required to uphold the service in the new environment. NSO
Device Manager would then send out the net change to all affected devices, potentially even spinning up or
down VMs as necessary. If the service application is designed for this purpose, this adaptation may go on
throughout the entire life of the service.
References
For additional information, refer to these resources:
Cisco Documentation
3-76 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Lesson 3-3
Service Design
Overview
This lesson builds on the knowledge gained about YANG modeling language and the
capabilities of Network Services Orchestrator (NSO). This lesson will use a sample service
provider service (Layer-3 Multiprotocol Label Switching [MPLS] VPN) to illustrate the service
design process.
Objectives
Upon completing this lesson, you will be able to:
Learn to design and implement services using Cisco NSO and YANG
Use the top-down design approach
Use the bottom-up design approach
Service Design
This topic describes the classing network service design process and how this process may be
impacted or changed when including a YANG service design as part of the process.
Final Deployment
Service Operation
Operator
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 4
A typical design process in a service provider environment takes many stages. Given a certain business
environment and the generation of a service idea we will firs start by formulating the new service on a very
high level. Eventually, the network architects and engineers will start creating a high-level design which will
already detail the service parameters.
As the service design process progresses it is typically required to do a proof of concept (PoC) deployment in
a lab to ensure that the service is technically feasible. Finally, the detailed design is created which describes
the new service in enough technical detail so that it can be implemented and verified. The new service may
be deployed throughout the environment or it may initially be deployed in smaller scale (i.e. pilot
deployment). The final step in the process is releasing the new service and have the operations team take
over the provisioning of the service.
3-78 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Augmented Service Design Process
Service Idea
Top- Down Approach
High Level Design
Design Service in NSO
Development, Testing
and/ or PoC Lab Bottom- Up Approach
Detailed Design
Pilot Deployment
Final Deployment
Service Operation
Deploy Service in NSO
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 5
The stage when the services are being tested in the lab is ideal to provide the required information and
resources that help in the design of service models in Cisco NSO. This allows the design processes (service
and NSO) to run in parallel so that when the service is being deployed it will already be supported by Cisco
NSO and ready for operators to start using it.
Top-Down NSO Design Approach
When the NSO design is considered in the early stages of the service design process we can use the top-down
design approach for NSO as well. This allows the NSO designer to use the service architect's input to create a
service model first without concern for the actual device-specific technical detail at this stage.
Bottom-Up NSO Design Approach
Sometimes the management aspect may be considered only in a later stage of the design process when a
service idea has already been transformed into an exact technical solution (e.g. tested in a proof of concept
lab). Here we may be faced with an engineering input (i.e. device configuration) which describes the service
at a much lower level (it may not actually describe a service but provide device configuration and parameters
for the service). The NSO design may have to use a reverse approach to transform the technical
implementation back into a high level service model.
Deploy
Service in Provide the end result to
Operator NSO operators
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 6
When using Cisco NSO for service provisioning it is ideal to reuse the service design process and resources
to also create a service model for Cisco NSO during the design process:
The network architect will provide the high-level description of the new service and the required
parameters that define the service and the deployed service instances.
The network engineer will create the service implementation instructions as part of the design process
and also test the configuration in the development lab. The configurations and the lab can then be used
to also design the YANG service models and the mapping logic.
When it comes to the service management platform it is important to consider the requirements and
limitations of the operation's processes and procedures, their other operations support system /network
management system (OSS/NMS) tools and how NSO needs to interact with them. The operator's input
is required in the design process in order to ensure that the final solution fits best into the existing
operations environment.
By the time the service has been designed and implemented in the environment to supports the new
services, the service model will be ready to be used by the operations team on daily basis for service
management.
3-80 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Augmented Service Design Process (Cont.)
Top- Down Approach
Architect Service Model (architect)
Design
Engineer Service in Device Specific Configuration in NSO
NSO
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 7
In a top-down approach we are introducing the NSO into the service design process and can create a NSO
service model at an early stage in the design process. This model describes the service and makes it available
for testing at the operation level without having any actual underlying technical implementation (i.e.
devices). The engineering stage is involved later when the service model is being mapped to the actual
device configuration options.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 8
When faced with a situation where a service design process is already at a stage where the network or
systems engineers are testing and implementing it in a lab environment (e.g. proof of concept lab) we must
adapt our NSO design process in order to be able to use NSO at the PoC stage. In this case we may decide to
use the engineer to provide the required input information. Engineer's input information will likely be very
technical such as topology information, device configurations, and configuration parameters (as opposed to
service parameters).
The network engineer responsible for designing and testing of the new service will provide the necessary
device configurations that are used to manually provision a new service. The NSO engineer can then
translate these commands into the Cisco NSO CLI. The XML output of the configuration can then be used to
design the service model and the mapping logic which will enable the new service to be provisioned in a
vendor independent fashion. Finally, the Cisco NSO server can be integrated with the existing management
portal used for service provisioning or even self-provisioning.
3-82 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Sample Service: Layer- 3 MPLS VPN
CE- 13
Input resources:
Edge
NSO Layer 3 MPLS VPN design
PE- 13
Development lab
Core
CE- 11 PE- 11 P- 01 PE- 31 CE- 31
P- 03
Platforms at network edge:
CE- 32
Cisco IOS routers
CE- 12 PE- 12 P- 02 PE- 32
L3 MPLS VPN
Cisco IOS XR routers
…
PE- 21
CE- 21
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 9
The figure illustrates a sample topology used in a lab environment to design and test a Layer-3 MPLS VPN
service. The environment uses a mixture of different device types from different vendors. Throughout this
lesson we will be creating this service and use Cisco IOS and Cisco IOS XR as examples of a mixed device-
type environment.
The specifics of the Layer-3 MPLS VPN service provisioning require us to focus only to the network edge -
provider edge (PE) devices and customer edge (CE) devices. In this lesson we will be focusing on the
configuration of this service on PE devices.
The figure illustrates the two NSO design approaches. The preferred top-down approach would require the
NSO designer to be involved in the service design from the start and ensure that the service operations team
is included in the process. This allows for greater flexibility in the design process and early testing of the
management solution. The following section will describe this approach.
The alternative may be used when the NSO designer is involved in a design phase at a later stage or when,
for example, the engineer was charged with an additional task that required his technical solution to be
integrated with NSO.
3-84 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Service Design for Cisco NSO
Top-Down Approach
This topic describes the top-down design approach which is the preferred approach and used
when the service design for NSO is considered at the early stages of the design process.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 12
A high-level service definition that includes service characteristics, limitations, parameters, etc. is the first
step in the top-down approach. An informal service model can be created without including any low-level
technical details at this stage. The first step can already result in a YANG service model that can also be
tested without the need for a length and complex physical lab setup.
Interface Interface
Site B Site Y
Addressing Addressing
CE PE PE CE
Service description: provide isolated any to any IP communication between customer sites
Service parameters:
Access interface: PE device and interface where the customer site is connected
Addressing: IP address range and subnetting
Routing: CE to PE routing protocol options: BGP, RIP, static
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 13
The figure illustrates our sample solution that will be used throughout this lesson – Layer-3 MPLS VPN.
The Layer-3 MPLS VPN service consists of a number of parameters that are needed in order to provision a
service instance. The parameters can be divided into three main groups:
Access interface configuration where we may have a variety of interface types.
Addressing of the access interface where we may use one or more numbering options (e.g. provider
assigned public or private addresses, customer assigned private addresses).
Routing between the provider edge router and the customer edge router.
Note A typical Layer-3 MPLS VPN service would have many more characteristics such as any of a number of
quality of service mechanisms, other routing options, limits, filters, multicast, IP version 6 (IPv6), etc. This
example is condensed to fit the purposes of training.
3-86 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Layer 3 MPLS VPN Service Model
Data path in l3mplsvpn: There can be many Each VPN instance can Each VPN instance
VPN instances of is assigned to a
vpn-id have multiple links
the service (customer sites) customer
vpn-name
customer (reference) L l3mplsvpn
link/
K vpn- id L vpn- name R customer
link/interface
link/routing-protocol L link
link/static/ L static
link/static/prefix
K prefix K mask
There are three options for
link/static/mask routing: BGP, RIP or static
Static routing (if used) requires the
operator to assign prefixes
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 14
Based on the service characteristics and parameters we can create an informal design as illustrated in the
figure above. The figure illustrates YANG statements where, for example, a list statement ("L" in the figure)
is used for any object where we can have multiple instances (e.g. VPN instances, link instances within a VPN
instance, static routes for individual links within a VPN instance). Each list requires a key leaf ("K" in the
figure) which is used as identifier in the example above. The model also references NSO resources such as
customers (optional but recommended) and devices (required in order to be able to link the service to the
actual devices that will eventually be configured with the right commands).
The hierarchy of the informal model can also be represented in text (e.g. similar to directories) which will
help in referencing the data later on using XPath.
The informal design from the previous page has now been converted into YANG. The figure only illustrates
the main statements and the hierarchy of objects. The final detailed YANG service model will be covered in
the last section.
3-88 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Service Design for Cisco NSO
Top- Down Approach
The NSO service model can be tested form the operator's
perspective even without any physical equipment
Device configuration and mapping logic steps can also be performed
without any physical equipment:
Use the netsim tool to emulate devices
Enables faster development and testing
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 16
One of the main advantages of using the top-down approach is to be able to directly translate the need of the
service and the needs of operations into a testable solution without a heavy effort to build a physical proof of
concept environment.
A physical PoC can and usually will be used at a later stage at which time there will already be a functioning
service model that can be deployed. The NSO's netsim tool can be used until then to emulate the
environment and provide for flexibility and speed of development (e.g. frequent changes can be performed
efficiently if the design process so requires).
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 18
In the alternative approach we are interfacing with an engineer that can provide us with low-level
implementation characteristics. These characteristics may include information about device types, device-
specific configurations for all of the service configuration options (device specific), interface types,
configuration dependencies and limitations, etc.
The NSO designer must extract an informal service model from the information provided in the form of a
high-level design (HLD), low-level design (LLD), implementation plans, verification plans, etc.
The same sample Layer-3 MPLS VPN service will be used in this section to illustrate the technical detail that
may influence the design process.
3-90 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Informal Service Design: Layer- 3 MPLS VPN
Service Parameters: Access Interface
PE interface options:
Interface
Physical interface: interface
CE PE
number
802.1q VLAN:
802.1q VLAN interface: VLAN
trunk
VLAN
or
CE PE Subinterface: interface name, interface
number and VLAN
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 19
In the sample service we see that we may have two PE-CE connection options when looking at it from the
perspective of the PE device:
A physical interface is used to terminate the connection from a customer site (e.g. Gigabit Ethernet
interface).
A VLAN interface or a Subinterface to terminate a single VLAN coming in through a trunk interface
from an aggregating LAN switch.
Note There can be a number of other scenarios for connecting customer devices (e.g. virtual templates, tunnel
interfaces) and other interface-related characteristics such as service policies (quality of service [QoS]),
access lists, etc.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 20
In the sample Layer-3 MPLS VPN design, the service designer has chosen that the PE-CE links will use the
addresses provided by the service provider from the following range: 10.50.0.0/16, 10.150.0.0/16,
10.250.0.0/16, 172.21.0.0/16, and 172.31.0.0/16. The operator will chose the range that does not conflict
with customer's exiting address usage. All links will be point to point and will use a /30 subnet mask. The PE
router will be always used to lower IP address from the /30 subnet and the CE router will use the higher IP
address.
3-92 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Informal Service Design: Layer- 3 MPLS VPN
Service Parameters: Routing
PE- CE routing:
EBGP
BGP:
AS 65001
Peer address Customer AS number: 65001 or customer
CE PE public AS number
RIPv2 Peer address
Option: advertise default
CE PE RIP:
Option: advertise default
Static routes
Prefix(es)
Static:
Next- hop address
CE Prefix
PE
Next-hop address
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 21
When choosing the routing option, the service provider will allow the customer to choose one of the three
available options:
BGP: This option is the preferred and is used in more complex topologies (e.g. multi-homed customer
sites). The design also mandates that all customers in all sites will use the single private Border Gateway
Protocol (BGP) autonomous system (AS) number 65001 and that the peering will be established using
the directly-connected IP addresses on the PE-CE link.
RIP: This option is used with customers that have equipment that does not support BGP.
Static: This is a last resort option which requires the operator to manually enter the customer prefixes
for individual sites.
The figure illustrates the Cisco IOS configuration provided by the network engineer. It contains all
configuration options needed to deploy a Layer-3 MPLS VPN service instance using manual configuration.
From the configuration we can determine the set of parameters and options that will guide us when designing
a service model.
3-94 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Informal Service Design: Sample Service Configuration
Cisco IOS XR
vrf vpn10001
address-family ipv4 unicast
import route-target 1:10001 One instance
The same set of parameters as with
!
export route-target 1:10001 Cisco IOS
interface GigabitEthernet0/0/0/1
vrf vpn10001 One or more instances
ipv4 address 172.31.1.5 255.255.255.252
!
router bgp 1 Cisco IOS XR (continued)
vrf vpn10001
rd 1:10001 router rip
address-family ipv4 unicast vrf vpn10001
redistribute connected interface GigabitEthernet0/0/0/1
redistribute static !
! BGP routing option RIP routing option
redistribute static
neighbor 172.31.1.6 Suboption: default origination redistribute connected Suboption: default origination
remote-as 65001 default-information originate
address-family ipv4 unicast !
route-policy pass in !
allowas-in 3
route-policy pass out router static
as-override vrf vpn10001
default-originate address-family ipv4 unicast
192.168.21.0/24 172.31.1.6 Static routing option
!
! !
! !
! !
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 23
This figure illustrates the Cisco IOS XR configuration for the same Layer-3 MPLS VPN service that is also
provided by the network engineer. The designer of the service model would request such configurations for
all device types that are used in the service provider's environment.
Note that in this particular case we have the same set of parameters that define a service instance for both
device types.
Once we have collected all the configurations from the network engineer and have received the service
description from the service architect we can start creating a list of parameters that define a service instance.
The figure illustrates the parameters for our sample service. The indentation in the parameter column already
illustrates the hierarchy and interdependency of parameters:
The service instance is described using a unique identifier from the defined range. The virtual routing
and forwarding (VRF) name, route distinguisher and route target are constructed from this identifier.
Each instance can have one or more customer-facing interfaces (PE-CE interface). For each interface we
can set additional features:
— IP addressing
— Routing: BGP, Routing Information Protocol (RIP) or static routing
Now we can start translating this informal service model to a more formal YANG definition:
YANG statements to describe the characteristics of parameters (e.g. leaf, list).
YANG data type to control the value of parameters (e.g. string, integer, IP address).
The figure also illustrates the first approximation in determining the formal YANG constructs for our sample
Layer-3 MPLS VPN service. Most single parameters are constructed using the leaf statement. Those
collections of parameters that can have multiple instances, such as static routes, make use of the list
statement.
The next important step is to optimize the set of technical parameters in order to minimize the amount of
information that will be exposed to the operator of the service. The figure illustrates how we can reuse some
parameters to construct others, use formulas to calculate their values or simply use static values where
possible.
For example: the service ID is ideally suited to uniquely describe the service instance and be used to
automatically assign values to route distinguisher (RD), route target (RT) and VRF name.
3-96 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Informal Service Design: Service Optimization Challenges
Challenges:
Inventory of IP subnets for PE- CE links
Calculation of IP addresses from the subnet (local and peer)
Inventory of customer- facing interfaces and VLANs
Solutions:
Option 1: Use Java to augment the template
Option 2: Change rules to accommodate the template functionality
Option 3: Use an external inventory system
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 25
When we are faced with the optimization of service parameters we may have a challenge of how to create
certain values automatically so that we do not unnecessarily burden the operator and also minimize the
chances of human error when service instances are being provisioned.
In the sample service we see that there is a need to assign IP addresses to the PE-CE interface. The question
is how we are going to keep track of the usage of IP addresses. One solution may be to augment the
template-based service model by adding a programmatic chunk that calculates the IP subnets and
corresponding link IP address for the purpose of configuring the IP addresses on the link and to use the
remote IP address for BGP peering configuration.
Alternatively, we may change the rules (i.e. simplify them) so that we can achieve a working solution
without needing to add a Java applet to do the more complex calculation. The third option is to let the
operator enter the IP address, which is suitable if the Cisco NSO is integrated with a frontend that is also
integrated with an existing inventory system.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 26
The table illustrates the result of our service parameter optimization process. A number of parameters are no
longer needed as they will be generated from other parameters.
3-98 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Device Configuration
This topic describes how to create the mapping logic to translate the service model to device
specific configurations.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 28
When we have acquired the device configurations and finalized the informal service design and created the
list of service parameters, we can proceed to convert these into the formal service design using YANG to
model the service and the XML mapping template.
The netsim tool can also help us in the next step where we create the mapping logic to map the service
parameters to device configurations.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 29
The figure illustrates the configuration of the Layer-3 MPLS VPN service through the Cisco NSO CLI:
VRF instance
One interface (though the service will support the addition of multiple interfaces). You may also note
that we have changed the addressing policy to simplify the creation of the template-based service model.
BGP routing protocol for PE-CE peering
Static route (though the service will support the addition of multiple static routes)
Note The RIP portion of the configuration is not shown in the example above.
3-100 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
admin@ncs% set ip address primary address 172.31.1.1 mask
255.255.255.252
admin@ncs% top
admin@ncs% /* BGP Configuration */
admin@ncs% edit devices device PE12 config ios:router bgp 1
address-family with-vrf ipv4 unicast vrf vpn10001
admin@ncs% set redistribute connected
admin@ncs% set redistribute static
admin@ncs% set neighbor 172.31.1.2 remote-as 65001
admin@ncs% set neighbor 172.31.1.2 activate
admin@ncs% set neighbor 172.31.1.2 default-originate
admin@ncs% set neighbor 172.31.1.2 as-override
admin@ncs% set neighbor 172.31.1.2 allowas-in as-number 3
admin@ncs% top
admin@ncs% /* Static Route Configuration */
admin@ncs% edit devices device PE12 config ios:ip route vrf
vpn10001
admin@ncs% set ip-route-forwarding-list 192.168.11.0
255.255.255.0 172.31.1.2
admin@ncs% top
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 30
When the configuration is entered into Cisco NSO, we can use the commit dry-run outformat xml
command to generate the XML code that will serve as basis for out mapping template.
Note Only a subset of the XML output is shown in the example above.
3-102 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Device Configuration Using Cisco NSO CLI: XML Template
Cisco IOS Configuration XML Configuration XML Template NIL
<ip xmlns="urn:ios"> <export>
<route> <asn-ip>1:{vpn-id}</asn-ip>
<vrf> </export>
<name>vpn{/vpn-id}</name> </route-target>
<ip-route-forwarding-list> <rd>1:{/vpn-id}</rd>
<prefix>{static/prefix}</prefix> </definition>
<mask>{static/mask}</mask> </vrf>
<forwarding-address>172.31.{/link/site- <router xmlns="urn:ios">
<bgp when="{routing-protocol='bgp'}">
id}.2</forwarding-address>
<as-no>1</as-no>
</ip-route-forwarding-list> <address-family>
</vrf> <with-vrf>
</route> <ipv4>
</ip> <unicast-multicast>unicast</unicast-
<vrf xmlns="urn:ios"> multicast>
<definition> <vrf>
<name>vpn{/vpn-id}</name> <name>vpn{/vpn-id}</name>
<description>L3 VPN for customer <neighbor>
{/customer}</description> <id>172.31.{site-id}.2</id>
<address-family> <remote-as>65001</remote-as>
<ipv4/> <as-override/>
</address-family> <default-originate/>
<route-target> <allowas-in>
<import> <as-number>3</as-number>
<asn-ip>1:{vpn-id}</asn-ip> </allowas-in>
</import> <activate/>
</neighbor>
...
...
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 31
The last step is to replace the fixed values from the commit dry-run command with variables (the path to the
YANG model's hierarchy of statements). The data path may not be correct at this time as you may decide to
change it when you are creating the YANG data model.
In the template you can also see the conditional statement for the BGP section of the configuration which
will be processed only if the BGP routing option is chosen for the given PE-CE link. Similarly, we create
conditions for RIP and static routing options (not shown in the example above).
We have also added descriptions to the different portions of the configuration (e.g. interface, VRF) to help in
potential troubleshooting of the service instance throughout its lifetime.
Note Only a subset of the XML output is shown in the example above.
Repeat the process for each device type. In the example we have the same service configuration for Cisco
IOS XR.
Note The RIP portion of the configuration is not shown in the example above.
3-104 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
admin@ncs% set address-family ipv4 unicast redistribute
connected
admin@ncs% set address-family ipv4 unicast redistribute static
admin@ncs% set neighbor 172.31.1.6 address-family ipv4 unicast
route-policy in pass
admin@ncs% set neighbor 172.31.1.6 address-family ipv4 unicast
route-policy out pass
admin@ncs% set neighbor 172.31.1.6 address-family ipv4 unicast
as-override
admin@ncs% set neighbor 172.31.1.6 address-family ipv4 unicast
allowas-in 3
admin@ncs% set neighbor 172.31.1.6 address-family ipv4 unicast
default-originate
admin@ncs% top
admin@ncs% /* Static Route Configuration */
admin@ncs% edit devices device PE21 config cisco-ios-xr:router
static address-family ipv4 unicast
admin@ncs% set routes 192.168.21.0/24 GigabitEthernet0/0/0/1
address 172.31.1.6
admin@ncs% top
Again generate the XML configuration output using the commit dry-run outformat xml CLI command.
3-106 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Device Configuration Using Cisco NSO CLI: XML Template
Cisco IOS XR Configuration XML Configuration XML Template
<vrf xmlns="http://tail-f.com/ned/cisco-ios-xr"> <router xmlns="http://tail-f.com/ned/cisco-ios-xr">
<vrf-list> <bgp when="{routing-protocol='bgp'}">
<name>vpn{/vpn-id}</name> <bgp-no-instance>
<description>L3VPN for customer <id>1</id>
{/customer}</description> <vrf>
<address-family> <name>vpn{/vpn-id}</name>
<ipv4> <neighbor>
<unicast> <id>172.31.{site-id}.2</id>
<import> <remote-as>65001</remote-as>
<route-target> <address-family>
<address-list> <ipv4>
<name>1:{/vpn-id}</name> <unicast>
</address-list> <route-policy>
</route-target> <direction>in</direction>
</import> <name>pass</name>
<export> </route-policy>
<route-target> <route-policy>
<address-list> <direction>out</direction>
<name>1:{/vpn-id}</name> <name>pass</name>
</address-list> </route-policy>
</route-target> <as-override/>
</export> <default-originate/>
</unicast> </unicast>
</ipv4> </ipv4>
</address-family> </address-family>
... ...
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 34
Replace the static values with the expected data path to the service model.
link/interface L link
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 36
In the last step we start creating the formal YANG service model based on the information that we have
gathered so far. The figure illustrates the hierarchy of YANG statements and the types of data.
3-108 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Layer 3 MPLS VPN Service Model (Cont.)
module l3mplsvpn{
namespace "http://com/example/l3mplsvpn"; YANG statements representing our
prefix l3mplsvpn;
import ietf-inet-types { prefix inet; } informal design:
import tailf-ncs { prefix ncs; }
import tailf-common { prefix tailf; } There can be many service instances
augment /ncs:services {
list l3mplsvpn {
Each instance can have one or more PE-
leaf vpn-name { ... } CE links
leaf vpn-id { ... }
leaf customer { ... } If static routing is chosen there may be
list link { one or more static routes
leaf site-name { ... }
leaf site-id { ... }
leaf device { ... }
leaf interface { ... }
leaf routing-protocol { ... }
leaf site-name { ... }
list static {
leaf prefix { ... }
leaf mask { ... }
}
}
}
}
}
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 37
The YANG model above illustrates the main statements that describe our informal design. The above
statements should provide enough information to describe the service and pass the necessary parameters to
the device manager for the service to be properly configured on network devices.
leaf customer {
tailf:info "VPN Customer";
type leafref {
path
"/ncs:customers/ncs:customer/ncs:id";
}
}
...
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 38
The first part of the YANG model describes the service instance. This portion has three parameters (leafs):
vpn-name:
— As you can see from the example we have also added another leaf which is used to hold the
textual description of the service instance without having any other (i.e. technical) meaning.
vpn-id
— This parameter is used to uniquely identify a service instance and is reused late on for some
other configuration parameters (e.g. to constrict the VRF name).
customer
— This leaf is linked to the list of customers in the NSO. Since this is a customer service it is
expected that a service instance will be associated with a customer.
3-110 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Layer 3 MPLS VPN Service Model (Cont.)
...
list link {
tailf:info "PE-CE Attachment Point";
The second part of the service model
key link-id; contains the list statement for the PE- CE
leaf link-name { link(s)
tailf:info "Link Name";
type string;
} Each link provides a connection to a
leaf link-id { customer site:
tailf:info "Link ID";
type uint32 { Site name
range "1..255";
}
} Site ID
leaf device { PE router
tailf:info "PE Router";
type leafref { Interface number
path "/ncs:devices/ncs:device/ncs:name";
}
} (continued on next slide)
leaf interface {
tailf:info "Customer Facing Interface";
type string;
}
...
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 39
The next part contains a list of links that define individual PE-CE connections. Each link has the following
parameters:
link-name
— Just like the service instance itself, we have added another parameter that can hold textual
information about the provisioned link. This parameter holds no special technical meaning.
link-id
— This parameter is used to hold the unique link identifier. Earlier, we changed the addressing
rules to accommodate the usage of a template-based service model. This ID is used as third octet
in the PE-CE address (hence the range 1..255). Our choice, however, has an impact on the
scalability of the service as we can see that we cannot provision more than 255 links inside a
single VPN.
device
— The device is the reference to the service provider routers where we configure these services.
interface
— This parameter is used to identify the interface that connects to the customer device.
(continued on next page)
}
} Each link provides a connection to a
customer site:
list static {
tailf:info "Static Route"; Site name
key prefix;
when "../routing-protocol='static'"; Site ID
leaf prefix { PE router
tailf:info "Static Route Prefix";
type inet:ipv4-address; Interface number
}
Routing option: BGP, RIP or static routes
leaf mask {
tailf:info "Static Route Subnet Mask";
Static route(s) in case the chosen routing option
type inet:ipv4-address; is static route:
}
} Prefix
...
Subnet mask
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 40
routing-protocol
— This parameters allows the operator to choose the routing option that will be used with CE
devices: BGP, RIP version 2 or static routes.
static
— The last parameter is a list and it contains the parameters needed to configure a static route
(prefix and mask; the next-hop address is dynamically determined in the XML template). Note
that there is a when statement that only makes the static list available if the chosen routing
option is static.
3-112 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Layer- 3 MPLS VPN Example Analysis: Complexity Reduction
Devices: 10 Element Management Using Native Service Management Using Cisco
PE- CE links: 20 Device CLI NSO CLI / GUI
Routing Scenario Total CLI lines
BGP 250 20
RIP 190 20
Static (one per link) 170 20
Routing Scenario Total service parameters
BGP 140 60
RIP 100 60
Static (one per link) 160 100
If we analyze the whole process and look at the original configuration data and then compare it with the final
result, we can see that from the operations perspective we have significantly reduced the number of
commands and parameters.
In the sample calculation we use a Layer-3 MPLS VPN setup where we have 20 PE-CE links attached to 10
PE routers. That would require us to enter 250 CLI commands on routers in the case of using BGP for
signaling. When using the Cisco NSO CLI and the previously described service, we only need to enter 20
Cisco NSO CLI commands. Additionally, we have reduced the number of parameters and also provided
safeguards that minimize the risk of the operator misconfiguring the parameters.
The figure illustrates another example where we use the simplest version of VPLS to implement a Layer-2
MPLS VPN for 20 sites connected to 10 PE routers. Similarly we have achieved a great reduction in the
number of commands and parameters while also improving the robustness of the solution.
3-114 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Summary
This topic summarizes the key points that were discussed in this lesson.
Learn to design and implement services with NSO
Augment the classic service design by introducing service modeling
Make use of architect and engineering expertise to derive quality device configurations
Thoroughly test the service model in a lab or using and emulated environment
References
For additional information, refer to these resources:
Cisco Documentation
Service Management
Overview
This lesson introduces how service management is done within Cisco Network Services
Orchestrator. It explains how the Service Manager can be used both through CLI and WebUI.
Objectives
Upon completing this lesson, you will be able to:
Manage services
Deploy, remove, re-deploy service instances
Service Management Tasks
This topic describes how NSO CLI and WebUI can be used to fulfill the service management
operations.
Service Management
Service modeling
Mapping to device model
Service activation
Device “effects” Service Manager
Service dry-run
Service check-sync CDB
Mapping Logic
Transaction
Service restoration Manager
Service testing Device Manager
Mapping service to device
Aggregated operational data
Notifications
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 4
Service management consists of many different types of actions. In the previous lesson we already learned
many of the tasks when we modeled a service and applied it to the network. A number of other tasks are
available to handle service management such as checking the synchronization status, deleting a service or
just un-deploying a service.
3-118 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Service Management Options
NSO CLI: CLI WebUI API
Cisco style
Juniper style
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 5
We have seen that there are two major types of CLI in NSO to accommodate the majority of network
operators who are familiar with Cisco CLI, Juniper CLI or both. Additionally, you can manage services
through the WebUI that is automatically augmented when you add a service or you may even further
augment it by creating other objects or even integrating your own WebUI.
NSO is also very extensible and it can be integrated with other systems using a number of APIs mentioned
earlier.
Main components:
Services
Devices Service Manager
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 6
The main components of the service management are the same as the main components of the system:
Services which are handled by the service manager.
Devices which are handled by the device manager.
Additionally, there are a number of other components that help with the manageability of services
(customers, templates, alarms, etc.).
3-120 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
NSO CLI and WebUI for Services
No extra development required to provide a CLI or WebUI for services
Both CLI and WebUI options are dynamically created based on service
packages
YANG annotations can be used to influence the CLI and WebUI (e.g. tailf:info to
provide syntax help)
YANG Service Model NSO CLI
leaf vpn-id { admin@ncs(config)# services l3mplsvpn ?
tailf:info "Service Instance ID"; Possible completions:
type uint32 { Service Instance ID (10001 to 19999) 10001 range
range "10001..19999"; admin@ncs(config)#
}
}
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 7
Whenever you design a new service you will see the service name and parameters become available in the
CLI and WebUI. You may also augment the way the WebUI and CLI provide this information by using a
number of available annotations.
Use man tailf_yang_cli_extensions shell command to get help on the available NSO annotations.
Internal sync check between service configuration and device-specific configuration as a result
of the service-to-device mapping logic
Extend sync check to the actual device configuration
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 8
deep-check-sync
This will validate if the actual devices are configured according to the service. Note that there are out-format
options to see the diff. Reconcile using service re-deploy.
3-122 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
NSO: CLI (Cisco Style)
Edit an existing service instance
or create a new one
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 10
3-124 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Service Lifecycle Management
Guidelines
This topic provides some general guidelines for development and maintenance of YANG
models.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 12
Callpoint changes
CDB only considers the part of the data model in YANG modules that do not have external
data callpoints. But while upgrading, CDB does handle moving subtrees into CDB from a
callpoint and vice versa. CDB simply considers these as added and deleted schema elements.
Thus an application can be developed using CDB in the first development cycle. When the
external database component is ready it can easily replace CDB without changing the schema.
Should the automatic upgrade fail, exit codes and log-entries will indicate the reason.
3-126 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Service Package Upgrade Actions
A re-deploy of the upgraded service is needed when the service change results
in changed device commands
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 13
The figure illustrates the path of data from the service model down to the device configuration. Any change
in any of the involved pieces of logic may require some actions in order to make those changes active.
This and the next two pages provide an overview of general guideline to follow in order to simplify the
development and maintenance of solutions based on YANG service models. The "should" and "may" are not
the same as "must" but following the guidelines may prove to be useful especially when modifying
(upgrading) service models.
3-128 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Service Model Versioning
May: May:
Add or update a status Change mandatory to false (or
statement: current deprecated remove it)
obsolete
Remove or relax min- & max-
Expand allowed range, length, elements
pattern
Add or clarify a description
Add a default (but not change it!) without changing the semantics
Add units, add or update a Change state data to optional
reference configuration
Remove an if-feature
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 15
In general, always consider what impact a changed model will have on the service upgrade.
Also follow the guidelines provided by IETF's in RFC 6087 and make use of IETF's data type defined in
RFC 6021 as well as all extensions provided by NSO.
3-130 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Summary
This topic summarizes the key points that were discussed in this lesson.
Operations characteristics
Simplicity and reliability: operator exposed to the optimal set of service parameters and
reliable actions
Performance characteristics
Simplicity: service manager is only concerned with service model, not with service
instance actions (create, delete, modify)
Optimization: only the minimum set of commands is sent to the devices
References
For additional information, refer to these resources:
Cisco Documentation
IETF RFCs 6087, 6020 and 6021
Objectives
Upon completing this lesson, you will be able to:
Identify Cisco NSO northbound interfaces and outline APIs
Identify use cases for different integration options
Understand capabilities and limitation of APIs
Cisco NSO Integration Options
This topic describes Cisco NSO integration options.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 4
Any management system must be placed into an existing environment with existing other systems and
established business processes. As such we are always faced with a number of requirements pertaining to
integration of a new system with the relevant existing systems in order to abide by existing business process
rules or optimize them.
Some of the more common integration requirements are:
Integration with other existing OSS/NMS.
Customization of user interface to fit business processes.
Task automation using scripts (e.g. triggered, scheduled).
Bulk data import or export.
4-2 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Cisco NSO Integration Options
OSS/BSS Network EMS/NMS
Engineer
NETCONF REST CLI WebUI SNMP
NSO JAVA/JavaScrip
t
Northbound APIs
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 5
Up to this point we have shown how to use the NSO CLI and WebUI to perform configuration tasks of
"southbound" devices. Cisco NSO provides several northbound programmatic interfaces that a network
engineer can use to automate tasks.
NSO Northbound Scripting Interfaces:
CLI: This is a network wide CLI that provides transactions across multiple devices and full support for
the service models. Also this enables network automation by scripting towards the network and the
network services in a unified CLI rather than towards the devices' native CLIs.
REST: The rest interface provides the complete model available as HTTP GET, PUT and other
operations. The data is available as XML and JavaScript Object Notation (JSON).
NETCONF: This gives other OSS applications a Network Configuration Protocol (NETCONF)
interface to the devices and services managed by NSO.
MAAPI: General Management Agent Application Programming Interface (MAAPI) comes in several
flavors. MAAPI is available as command line utilities, C-API, Java API, and a Python API. This lesson
will illustrate the use of command-line utilities.
JavaScript: The JavaScript interface is used to build custom Web interfaces. The interface is AJAX
based so that true clients can be built, including for example event subscriptions without round-trips to
the web server.
Scripts: Cisco NSO also supports what are called "plug-and-play" scripts. Plug-and-play scripts can be
dropped in a running NSO system. The scripts will extend the CLI with new functions. Plug-and-play
scripts are only available in the NSO CLI. They are often implemented as shell scripts that calls MAAPI
functions. Also note that NSO can be used as a development platform to build custom network
management applications.
SNMP: NSO can present operational data over Simple Network Management Protocol (SNMP) to
upper layer management systems. This is useful for example in the case of alarms and performance data.
There is also a dedicated SNMP Alarm MIB for the NSO Alarm Manager.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 7
NETCONF is the preferred integration API when integrating other OSS/NMS systems in front of NSO as
long as they support the protocol. NSO supports a number of other APIs discussed later which can be used in
case NETCONF is not supported.
The NSO NETCONF north bound API can be used by arbitrary NETCONF clients. The installation of NSO
also provides a NETCONF client:
netconf-console
This is a very simple Python based NETCONF client that is shipped as source code in the NSO
distribution.
Other NETCONF clients will work too, as long as they adhere to the NETCONF protocol. When integrating
NSO into larger OSS/NMS environments, the NSO NETCONF API is a good choice of integration point.
4-4 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Cisco NSO NETCONF API Example
cisco@nso:~$ netconf-console --get-config -x /services/l3mplsvpn[vpn-id='10001']
<?xml version="1.0" encoding="UTF-8"?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1">
<data>
<services xmlns="http://tail-f.com/ns/ncs">
<l3mplsvpn xmlns="http://com/example/l3mplsvpn">
<vpn-id>10001</vpn-id>
<vpn-name>Primary VPN</vpn-name>
<customer>ACME</customer> Main NETCONF options:
<link>
<link-id>2</link-id> --get
<link-name>Central Site</link-name> --get-config
<device>PE12</device>
<interface>4</interface> --edit-config
<routing-protocol>bgp</routing-protocol>
</link>
The figure illustrates the use of the netconf-console command to retrieve service configuration information.
XPath can be used to retrieve the required data.
Where <filename> is a file containing a NETCONF XML command session. If <filename> is not given, one
of the Command Options must be given. Filename - means standard input.
Options:
-h, --help show this help message and exit
-v VERSION, --version=VERSION
-s STYLE, --outputStyle=STYLE Display output in: raw, plain, pretty, all, or noaaa format
--iter=ITER Sends the same request ITER times. Useful only intest scripts
-i, --interactive
TCP Options:
-g GROUPS, --groups=GROUPS Set group membership for user - comma separated string
-G SUPGROUPS, --sup-groups=SUPGROUPS Set supplementary UNIX group ids for user – comma separated
string of integers
--get-config Takes an optional --db argument, default is 'running', and an optional -x argument for XPath filtering
--with-defaults=WDEFAULTS One of 'explicit', 'trim', 'report-all' or 'report- all-tagged'. Use with --get, --get-
config, or --copy-config.
--with-inactive Send with-inactive parameter. Use with --get, --get-config, --copy-config, or --edit-config.
-x, --xpath XPath filter to be used with --get, --get-config, and --create-subscription
--discard-changes
--commit
--copy-running-to-startup
--copy-config=COPY Takes a filename as argument. The contents of the file is data for a single NETCONF copy-config
operation (put into the <config> XML element). Takes an optional --db argument, default is 'running'.
--edit-config=EDIT Takes a filename as argument. The contents of the file is data for a single NETCONF edit-config operation
(put into the <config> XML element). Takes an optional --db argument, default is 'running'.
--rpc=RPC Takes a filename as argument. The contents of the file is a single NETCONF rpc operation (w/o the
surrounding <rpc>).
4-6 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Cisco NSO CLI API
This topic describes the Cisco NSO CLI API that allows external usage of CLI commands.
There are two options available to access operational and configuration data in NSO:
ncs_cli: This shell command allows access using the NSO CLI commands. Take into consideration that
this command provides local access to the CLI on the NSO server without additional security. A remote
access to CLI should use the standard approach by using Secure Shell (SSH).
ncs_cmd: This shell command allows access using the low-level Configuration Database (CDB)
commands.
ncs_load: This shell command allows the loading and saving of NSO configurations.
Cisco NSO CLI API
The ncs_cli program is a C frontend to the NSO CLI engine. The ncs_cli program connects to
NSO and basically passes data back and forth from the user to NSO. The ncs_cli command can
be invoked from the command line. If so, no authentication is done.
NAME
ncs_cli - Frontend to the NSO CLI engine
SYNOPSIS
ncs_cli [options] [File]ncs_cli [--help] [--host Host] [--ip IpAddress | IpAddress/Port] [--
address Address] [--port PortNumber] [--cwd Directory] [--proto tcp | ssh | console] [--
interactive] [--noninteractive] [--user Username] [--uid UidInt] [--groups Groups] [--
gids GidList] [--gid Gid] [--opaque Opaque] [--noaaa]
DESCRIPTION
The ncs_cli program is a C frontend to the NSO CLI engine. The ncs_cli program connects to
NSO and basically passes data back and forth from the user to NCS.ncs_cli can be invoked
4-8 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
ENVIRONMENT VARIABLES
NCS_IPC_ADDRWhich IP address to connect to.
NCS_IPC_PORTWhich TCP port to connect to.
SSH_CONNECTIONSet by openssh and used by ncs_cli to determine client IP address etc.
TERMPassed on to terminal aware programs invoked by NSO.
EXIT CODES
0 Normal exit
1 Failed to read user data for initial handshake.
2 Close timeout, client side closed, session inactive.
3 Idle timeout triggered.
4 TCP level error detected on daemon side.
5 Internal error occurred in daemon.
5 User interrupted clistart using special escape char.
6 User interrupted clistart using special escape char.
7 Daemon abruptly closed socket.
SCRIPTING
It is very easy to use ncs_cli from /bin/sh scripts. ncs_cli reads stdin and can then also be run
in non interactive mode. This is the default if stdin is not a tty (as reported byisatty())
Here is example of invoking ncs_cli from a shell script.
#!/bin/sh ncs_cli << EOF configure set foo bar 13 set funky stuff 44 commit exit no-confirm
exit EOF
And here is en example capturing the output of ncs_cli:
#!/bin/sh { ncs_cli << EOF; configure set trap-manager t2 ip-address 10.0.0.1 port 162 snmp-
version 2 commit exit no-confirm exit EOF } | grep 'Aborted:.*not unique.*' if [ $? != 0 ]; then
echo 'test2: commit did not fail'; exit 1; fi
The above type of CLI scripting is a very efficient and easy way to test various aspects of the
CLI.
Cisco NSO CDB API
Command line utility that interfaces to common NSO library functions
Synopsis
ncs_cmd [(1) options] [filename]
ncs_cmd [(1) options] -c string
ncs_cmd -h | -h commands | -h command-name...
(1) [ -r | -o | -e | -S ] [-f [w] | [p] [ r | s ] ] [-a address] [-p port] [-u user] [-g group] [-x context]
[-s] [-m] [-h] [-d]
DESCRIPTION
The ncs_cmd utility is implemented as a wrapper around many common CDB and MAAPI
function calls. The purpose is to make it easier to prototype and test various NSO issues using
normal scripting tools.
4-10 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
DESCRIPTION
This command provides a convenient way of loading and saving all or parts of the
configuration in different formats. It can be used to initialize or restore configurations as well
as in CLI commands.
If you run ncs_load without any options it will print the current configuration in XML format
on stdout. The exit status will be zero on success and non-zero otherwise.
COMMON OPTIONS
-dDebug flag. Add more to increase debug level. All debug output will be to stderr.
-tMeasure how long the requested command takes and print the result on stderr.
-F x | p | j | c | iSelects the format of the configuration, must be set both when loading and
saving. One of XML (x), pretty XML (p) curly braces J-style CLI (j), C-style CLI (c), or I-style
CLI (i). Default is XML.
-HHide all hidden nodes. By default, no nodes are hidden unless ncs_load has attached to an
existing transaction, in which case the hidden nodes are the same as in that transaction's
session.
-UUnhide all hidden nodes. By default, no nodes are hidden unless ncs_load has attached to an
existing transaction, in which case the hidden nodes are the same as in that transaction's
session.
-u user, -g group ..., -c contextLoading and saving the configuration is done in a user session,
using these options it is possible to specify which user, groups (more than one -g can be used to
add groups), and context that should be used when starting the user session. If only a user is
supplied the user is assumed to belong to a single group with the same name as the user. This is
significant in that AAA rules will be applied for the specified user / groups / context
combination. The default is to use the system context, which implies that AAA rules will not be
applied at all.
Note
If the environment variables NCS_MAAPI_USID and NCS_MAAPI_THANDLE are set (see
the ENVIRONMENT section), or if the -i option is used, these options are silently ignored,
since ncs_load will attach to an existing transaction.
-iInstead of starting a new user session and transaction, ncs_load will try to attach to the init
session. This is only valid when NSO is in start phase 0, and will fail otherwise. It can be used
to load a “factory default”file during startup, or loading a file during upgrade.
SAVE CONFIGURATION
By default the complete current configuration will be output on stdout. To save it in a file add
the filename on the command line (the -f option is deprecated). The file is opened by
the ncs_load utility, permissions and ownership will be determined by the user
running ncs_load. Output format is specified using the -Foption.
When saving the configuration in XML format, the context of the user session (see the -
c option) will determine which namespaces with export restriction (fromncsc --export ) that are
included. If the system context is used (this is the default), all namespaces are saved, regardless
of export restriction. When saving the configuration in one of the CLI formats, the context used
for this selection is always cli.
A number of options are only applicable, or have a special meaning when saving the
configuration:
4-12 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
LOAD CDB OPERATIONAL
The -C option is used to load operational data. When you use -C all other options (except -d)
are ignored, since they don't apply. Files on the command line must be in XML format
Any data in the file which isn't part of CDB operational per the data model will be ignored.
This means that you can save a single file with both configuration and operational data and feed
it back to ncs_load.
If you use a relative path for filename it is assumed to be relative to the working directory of
the ncs_load command
EXAMPLES
Example 1. Reloading all xml files in the cdb directory
ncs_load -D -m -l cdb/*.xml
Example 9. Output all instances in list /foo/table which has ix larger than 10
ncs_load -F x -P "/foo/table[ix > 10]"
ENVIRONMENT
NCS_IPC_ADDRThe address used to connect to the NSO daemon, overrides the compiled in
default.
NCS_IPC_PORTThe port number to connect to the NSO daemon on, overrides the compiled in
default.
4-14 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Cisco NSO CLI Script Example
cisco@nso:~$ more l3mplsvpn.sh
#!/bin/sh
{ ncs_cli << EOF;
configure
set services l3mplsvpn $1 vpn-name $2 customer $3 link $4 device $5 interface $6 routing-
protocol bgp
commit
exit no-confirm
exit
EOF
}
if [ $? != 0 ]; then echo 'l3mplsvpn.sh: really serious error'; exit 1; fi
The figure illustrates a simple script used to provision a link in a Layer-3 Multiprotocol Label Switching
Virtual Private Network (MPLS VPN) service which we have created in the previous lesson. The script will
provide textual feedback from which we can determine whether the action was successful or not.
The ncs_cli command can be used in a variety of manners when other integration options are not possible:
Scripting to automate tasks.
Integration with a web application using common gateway interface (CGI).
if ($#ARGV<5){
print "\nl3mplsvpn.pl vpnid vpnname customer linkid device
interface\n\n";
exit;
}
Integrate with existing EMS / NSM systems EMS / NMS / Web Portal
CDB
REST example using curl and a GET request:
curl -u admin:admin http://localhost:8080/api/running/devices/device/PE13/config/router?deep&select=bgp;ospf
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 13
NSO provides the JavaScript JSON RPC API and the REST API that can be used in front-end systems for
WebUI integration purposes.
When integrating the NSO WebUI with other systems it is important to remember that the NSO WebUI is
dynamically adapting to the data models. That means that the interface is not static and any changes in the
data model may affect the integration with front-end systems.
The JSON RPC is recommended for a more complex integration scenario which wants to make use of the
session state and active interaction between the front-end system and NSO. The REST API can be used in
more simplistic environment where simple stateless web transaction support is needed.
REST API
The RESTful API over HTTP can be used for accessing data defined in YANG, using the datastores defined
in NETCONF.
Configuration data and state data are exposed as resources that accept the GET method. Resources
representing configuration data also accept the DELETE, PATCH, POST, and PUT methods:
GET to retrieve a resource.
PUT to replace a resource.
POST to create a resource.
DELETE to delete a resource.
There is also a number of query options that allow the filtering of returned data. For example:
4-16 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
select=resource1;resource2(expression): semicolon separated list of resources and/or expression
within parenthesis
deep: display entire subtree
shallow: only display resource without subtree
offset: display a limited set of list entries to retrieve
limit: display a limited set of list entries to retrieve
In order to enable Representation State Transfer (REST), in NSO, REST must be enabled in ncs.conf. The
webserver configuration for REST is shared with the WebUI's config. However, the WebUI does not have to
be enabled for REST to work.
Example:
curl -u admin:admin
http://localhost:8080/api/running/devices/device/PE13/config/router?deep&select=bgp;ospf
The example illustrates the usage of REST API by using the curl shell command. In the example, we access
the configuration of Border Gateway Protocol (BGP) on router PE13. Note the similarity with NSO CLI in
the path used and the output produced:
NSO CLI: show devices device PE11 config ios:router bgp | display xml
REST: /api/running/devices/device/PE11/config/router/bgp?deep
4-18 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Cisco NSO REST API Example
cisco@nso:~$ curl -u admin:admin -H "Accept: application/vnd.yang.data+json"
http://localhost:8080/api/running/devices/device/PE11/config/ios:router/bgp?deep
{
"tailf-ned-cisco-ios:router": {
"bgp": [
{
"as-no": 1,
"address-family": {
"ipv4": [
Instruct NSO to reply Depth options:
{
"af": "unicast", using JSON for data - Default: 5 levels
"bgp-af": {
"bgp": {
"bestpath": {
encoding - "deep": all levels
}, - "shallow": 2 levels
"nexthop": {
}
}
},
"neighbor": [
{
"id": "10.1.1.13",
"remote-as": "1",
"capability": {
},
"translate-update": {
}
},
...
Northbound application platform or developer may prefer JSON data encoding which may be achieved using
the Accept and Content-Type HTTP options in order to receive or supply data in JSON format.
Use cases:
Augment the NSO CLI Custom
Augment policy rules commands
CDB
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 17
With the scripting mechanism it is possible for an end-user to add new functionality to Cisco NSO CLI in a
plug-and-play like manner without any special tools. There are three categories of scripts:
command scripts are used to add new commands to the CLI.
policy scripts are invoked at validation time and may control the outcome of a transaction. Policy
scripts have the mandate to cause a transaction to abort.
post-commit scripts are invoked when a transaction has been committed. Post-commit scripts can for
example be used for logging, sending external events etc.
Scripts are located in the scripts subdirectory where there are three additional subdirectories, one for
each category of scripts (command, policy, and post-commit). Scripts are automatically loaded at startup
and may also be manually reloaded with the CLI command script reload.
The scripts can make use of other APIs available to process operational or configuration data:
ncs-maapi
netconf-console
ncs_cli
ncs_cmd
ncs_load
4-20 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Cisco NSO MAAPI
Name
ncs-maapi — command to access an ongoing transaction
Synopsis
ncs-maapi --get Path...
ncs-maapi --set Path Value [ Path Value... ]
ncs-maapi --keys Path...
ncs-maapi --exists Path...
ncs-maapi --delete Path...
ncs-maapi --create Path...
ncs-maapi --insert Path...
ncs-maapi --revert
ncs-maapi --msg To Message Sender
--priomsg To Message
--sysmsg To Message
ncs-maapi --cliget Param...
ncs-maapi --cliset Param Value [ Param Value... ]
ncs-maapi --cmd2path Cmd [ Cmd ]
ncs-maapi --cmd-path [--is-deleta ] [--emit-parents ] [--non-recursive ] Path [ Path ]
ncs-maapi --cmd-diff Path [ Path ]
ncs-maapi --keypath-diff Path
ncs-maapi --clicmd [--get-io ] [--no-hidden ] [--no-error ] [--no-aaa ] [--no-fullpath ] [-
unhide <group>] Cli command...
DESCRIPTION
This command is intended to be used from inside a CLI command or a NETCONF extension
RPC. These can be implemented in several ways, as an action callback or as an executable.
It is sometimes convenient to use a shell script to implement a CLI command and then invoke
the script as an executable from the CLI. The ncs-maapi program makes it possible to
manipulate the transaction in which the script was invoked.
Using the ncs-maapi command it is possible to, for example, write configuration wizards and
custom show commands.
Use the man ncs-maapi command to get the complete description of the command options and
examples.
my $l=`ncs-maapi --clicmd "show configuration devices device * config ios:interface | display xpath |
nomore" 2>&1`;
print $l;
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 18
All scripts are required to provide a formal description of their interface. When the scripts are loaded, NSO
will invoke the scripts with --command, --policy or --post-commit as an argument.
The script must respond by writing its formal interface description on stdout and exit normally. Such a
description consists of one or more sections. The required sections depend on the category of the script.
In the example, we use the ncs-maapi command to execute a native NSO CLI command. The example is
effectively creating and alias for the CLI command. Note that you may achieve a similar goal by adding a
new command to the ncs.cli (this approach however requires the recompiling of the CLI and restarting of the
server).
Note You should use a different API if you want to process the output of a command (ncs-maapi is executed
with the context of the NSO CLI and does not allow the processing of output; you should use ncs_cli or
netconf-console instead; described earlier in this lesson).
set -e
usage=
newline=cat
file=
while [ $# -gt 0 ]; do
case "$1" in
--h)
4-22 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
usage=1
;;
--command)
# Configuration of the command
#
# modes - CLI mode (oper config)
# styles - CLI style (c i j)
# cmdpath - Full CLI command path
# help - Command help text
#
# Configuration of the parameters
#
# name - (optional) name of the parameter
# presence - optional or mandatory
# type - void - A parameter without a value
# words - any - Multi word param. Only valid for
the last param
# flag - Extra word added before the parameter
value
# prefix - Extra string prepended to the parameter
value
# help - Command help text
cat << EOF
begin command
modes: oper
styles: c i j
cmdpath: my scripting echo
help: Display a line of text
end
begin param
name: nolf
type: void
presence: optional
flag: -n
help: Do not output the trailing newline
end
begin param
name: file
presence: optional
flag: -f
help: Redirect output to file
end
begin param
presence: mandatory
words: any
help: String to be displayed
end
EOF
exit
;;
# String to be displayed.
string=$*
if [ x"$usage" != x ]; then
echo
echo "Usage: $0 [-n] [-f file] string"
echo
echo " --command Mandatory for command scripts"
echo " --params Mandatory for command scripts"
echo
echo " -h Display this help and exit"
echo " -n Do not output trailing newline"
echo " -f filename Redirect output to file"
echo " string String to be displayed"
exit 1
fi
set -e
4-24 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
if [ $# -gt 0 ]; then
case "$1" in
--post-commit)
cat << EOF
begin post-commit
end
EOF
exit 0
;;
*)
echo
echo "Usage: $0 [--post-commit]"
echo
echo " --post-commit Mandatory for post-commit
scripts"
exit 1
;;
esac
else
file='/var/log/ncs/ncs-transaction.log';
# echo "Redirect stdout to logfile"
exec > "${file}" 2>&1
echo
date
echo $0
echo "CONFD_MAAPI_USID=$CONFD_MAAPI_USID"
echo "CONFD_MAAPI_THANDLE=$CONFD_MAAPI_THANDLE"
echo
echo "--- transaction diff ---"
ncs-maapi --keypath-diff /
fi
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 20
The Cisco NSO SNMP agent provides SNMP access to the data available through the NSO management
backplane. The same data can also be accessed via other protocols/applications such as NETCONF, WebUI,
and CLI. This data can be stored in CDB, or made available by a data provider.
4-26 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
SNMP Example
cisco@nso:~$ snmpwalk -M /opt/ncs/ncs-3.2/src/ncs/snmp/mibs -m ALL -v 2c -c public 127.0.0.1:4000 TAILF-
TOP-MIB::tfModules
TAILF-ALARM-MIB::tfAlarmNumber.0 = Gauge32: 22
TAILF-ALARM-MIB::tfAlarmLastChanged.0 = STRING: 2014-11-8,9:33:24.4,+0:0
TAILF-ALARM-MIB::tfAlarmType.1 = STRING: connection-failure
TAILF-ALARM-MIB::tfAlarmType.2 = STRING: connection-failure
TAILF-ALARM-MIB::tfAlarmType.3 = STRING: connection-failure
TAILF-ALARM-MIB::tfAlarmType.4 = STRING: connection-failure
TAILF-ALARM-MIB::tfAlarmType.5 = STRING: connection-failure
TAILF-ALARM-MIB::tfAlarmType.6 = STRING: connection-failure
TAILF-ALARM-MIB::tfAlarmType.7 = STRING: connection-failure
TAILF-ALARM-MIB::tfAlarmType.8 = STRING: connection-failure
TAILF-ALARM-MIB::tfAlarmType.9 = STRING: connection-failure
TAILF-ALARM-MIB::tfAlarmType.10 = STRING: connection-failure
TAILF-ALARM-MIB::tfAlarmType.11 = STRING: connection-failure
TAILF-ALARM-MIB::tfAlarmType.12 = STRING: connection-failure
TAILF-ALARM-MIB::tfAlarmType.13 = STRING: connection-failure
TAILF-ALARM-MIB::tfAlarmType.14 = STRING: package-load-failure
...
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 21
Cisco NSO supports SNMP to monitor the system status and the Cisco NSO alarms. The TAILF-ALARM-
MIB MIB is available in src/ncs/snmp/mibs subdirectory.
References
For additional information, refer to these resources:
Cisco NSO documentation
4-28 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Lesson 4-2
Objectives
Upon completing this lesson, you will be able to:
Describe the most common Cisco NSO administration tasks
System Configuration
System Maintenance
Authentication and Authorization
Clustering
High Availability
Scalable System Management
System Troubleshooting
System Configuration
In this topic you will learn how to configure the Cisco NSO system using the configuration file
and the inline configuration options of the Cisco NSO CLI.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 4
Remember that there are two main options when installing the NSO system:
Local installation: this installation creates a sand-boxed environment where there are all the files and
directories needed for the NSO system top operate.
System installation: this installation integrates into the architecture of the hosting operation system so
you will find that various parts of the file system are used for NSO.
Either installation can however be tuned to use arbitrary directories for various purposes.
It is important to know the type of installation in order to be able to manage the system.
4-30 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
System Configuration
Primary source of system configuration is the ncs.conf file:
In system installation the default location is /etc/ncs/ncs.conf
In local installation the ncs.conf file is located in the running directory of NSO
All other system configuration is stored within NSO's CDB (i.e. accessible via
CLI or WebUI)
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 5
Cisco NSO is configured in two different ways. It's configuration file, ncs.conf, and also through whatever
data that is entered into Cisco NSO itself. For example, if we instruct Cisco NSO to manage yet another
device, i.e. we add an entry to /devices/device, which could certainly be considered as configuration data for
Cisco NSO itself.
The ncs.conf file contains the core configuration describing the startup options and the main system
components. Everything else is configured through the NSO itself via the CLI or WebUI.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 6
The directory parameters are dynamically generated based on the environment variables passed to the NSO
server at startup:
The $NCS_DIR environment variable contains the installation directory of Cisco NSO, such as
/opt/ncs/current.
The $NCS_RUN_DIR environment variable contains the running directory of Cisco NSO, such as
/var/opt/ncs.
The $NCS_LOG_DIR environment variable contains the log file directory for Cisco NSO, such as
/var/log/ncs.
The ncs.con XML file contains the following main sections and confirms to the YANG model defined in
tailf-ncs-config.yang:
The load-path element configures the locations where the systems is to search for *.fxs files.
The scripts element configures the locations where the plug-and-play scripts are located.
The state-dir element configures the location where the running packages are located.
The notification element configures the notification mechanisms for alarms.
The cdb element configures the location of the Configuration Database (CDB) files and from where they
are initiated.
(list continued on the next page)
4-32 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
System Configuration: ncs.conf (Cont.)
<logs>
Environment variables: <syslog-config> … </syslog-config>
NCS_LOG_DIR: log file location (e.g. <ncs-log>
/var/logs/ncs) <enabled>true</enabled>
<file>
logs: location and configuration of <name>${NCS_LOG_DIR}/ncs.log</name>
<enabled>true</enabled>
logging: </file>
syslog: disabled <syslog>
<enabled>true</enabled>
ncs-log: enabled </syslog>
developer: enabled </ncs-log>
<developer-log> … </developer-log>
audit: enabled <developer-log-level>info</developer-log-level>
netconf: enabled <audit-log> … </audit-log>
<netconf-log> … </netconf-log>
snmp: enabled <snmp-log> … </snmp-log>
webui-browser-log: enabled <webui-browser-log> … </webui-browser-log>
<webui-access-log> … </webui-access-log>
webui-access-log: enabled <xpath-trace-log> … </xpath-trace-log>
xpath-trace-log: disabled (useful for <error-log> … </error-log>
troubleshooting XPath, CPU intensive) </logs>
error-log: enabled
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 7
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 8
4-34 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
System Configuration: ncs.conf (Cont.)
<webui> … </webui>
webui: web-based user interface:
HTTP (e.g. port 8080, enabled) <rest>
<enabled>true</enabled>
SSL configuration (e.g. port 8888, private </rest>
key, certificate, disabled)
<netconf-north-bound>
rest: REST API (enabled) <enabled>true</enabled>
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 9
System Maintenance
Backup
Restore Manual:
backup
Scheduled
Upgrade restore
backup
upgrade
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 11
4-36 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Cisco NSO can be backed up using the ncs-backup command which backs up the database (CDB) files, state
files, config files and rollback files from the installation directory. Use the ncs-backup command to take a
complete backup (for disaster recovery).
The backup will be stored in the Run Directory /var/opt/ncs/backups/ncsVERSION@DATETIME.backup.
Make sure that the backup files are also properly backed up to another system to mitigate possible disk
failures in the Cisco NSO server which would result in the loss of the system and the backup files.
NAME
ncs-backup - Command to backup and restore NSO data
SYNOPSIS
ncs-backup [--install-dir InstallDir] [--non-interactive]
ncs-backup --restore [Backup] [--install-dir InstallDir] [--non-interactive]
DESCRIPTION
The ncs-backup command can be used to backup and restore NSO CDB, state data, and config files for an
NSO "system installation", i.e. one that was done with the --system-install option to the NSO installer (see
ncs-installer(1)). Unless the --restore option is used, the command creates a backup. The backup is stored in
the RunDir/backups directory, named with the NSO version and current date and time.
OPTIONS
--restore [ Backup ]
Restore a previously created backup. The Backup argument is either the name of a file in the
RunDir/backups directory or the full path to a backup file. If the argument is omitted, unless the
[ --install-dir InstallDir ]
Specifies the directory for installation of NSO static files, like the --install-dir option to the installer. If this
option is omitted, /opt/ncs will be used for InstallDir.
[ --non-interactive ]
If this option is used, restore will proceed without asking for confirmation.
4-38 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Cisco NSO restore is performed if you would like to switch back to a previous good state or restore a backup.
Note It is always advisable to stop NSO before performing the restore operation.
Follow these steps to upgrade Cisco NSO to a new version (the figure above illustrates an upgrade from
version 3.2 to version 3.3):
Step 1 Install the new version.
sudo sh ncs-NEWVERSION.OS.ARCH.installer.bin --system-install
Step 2 Stop previous installed NSO.
/etc/init.d/ncs stop
Step 3 Take a complete backup (for disaster recovery)
ncs-backup
Step 4 Switch to new version by updating symbolic link.
cd /opt/ncs
rm -f current
ln -s ncs-NEWVERSION current
Step 5 Make sure that the /var/opt/ncs/packages directory has packages that are appropriate for the new
version. When upgrading from one version of NSO to another version in the same major branch
i.e x.y are unchanged in NCS-x.y.z (Ex: ncs-3.1 to ncs-3.1.2), it should be possible to continue to
use the same packages. But when upgrading to a different major branch, the packages normally
need to be rebuilt (or pre-built packages for the new major branch need to be used).
Step 6 Start NSO with package reload option.
NCS_RELOAD_PACKAGES=true /etc/init.d/ncs start
Step 7 Verify that everything is working.
Step 8 If you want to switch back to previous known/good state, start by stopping NSO.
/etc/init.d/ncs stop
— Then restore from backup.
4-40 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
ncs-backup --restore
— Move back symbolic link
cd /opt/ncs
rm -f current
ln -s ncs-VERSION current
— And restart NSO.
/etc/init.d/ncs start
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 16
This topic describes how to use Cisco NSO's built-in authentication and authorization mechanisms. Users log
into NSO through the CLI, NETCONF, SNMP, or via the WebUI. In either case, users need to be
authenticated. That is, a user needs to present credentials, such as a password or a public key in order to gain
access.
Once a user is authenticated, all operations performed by that user need to be authorized. That is, certain
users may be allowed to perform certain tasks, whereas others are not. This is called authorization. We
differentiate between authorization of commands and authorization of data access.
The NSO daemon manages device configuration including AAA information. In fact, NSO both manages
AAA information and uses it. The AAA information describes which users may login, what passwords they
have and what they are allowed to do.
This is solved in NSO by requiring a data model to be both loaded and populated with data. As delivered,
NSO uses the YANG module tailf-aaa.yang for authentication, while ietf-netconf-acm.yang (NETCONF
Access Control Model [NACM], RFC 6536) as augmented by tailf-acm.yang is used for group assignment
and authorization.
4-42 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Authentication Configuration: ncs.conf
<aaa>
local-authentication: users <ssh-server-key-dir>${NCS_CONFIG_DIR}/ssh</ssh-server-key-dir>
stored in CDB: <pam>
<enabled>true</enabled>
Static passwords <service>common-auth</service>
Public-key authentication </pam>
<external-authentication>
(RSA, DSA)
<enabled>false</enabled>
<executable>my-test-auth.sh</executable>
pam (recommended): </external-authentication>
users authenticated
through PAM which can <local-authentication>
offload authentication to a <enabled>true</enabled>
</local-authentication>
central AAA server (e.g. to </aaa>
use one-time password
authentication)
external-authentication: users are authenticated using an external executable
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 17
If Secure Shell (SSH) termination is enabled for NETCONF or the CLI, the NSO built-in SSH server needs
to have server keys. These keys are generated by the NSO install script and by default end up in
$NCS_DIR/etc/ncs/ssh. It is also possible to use OpenSSH to terminate NETCONF or the CLI. If OpenSSH
is used to terminate SSH traffic, the SSH keys are not necessary.
/ncs-config/aaa/ssh-pubkey-authentication
If SSH termination is enabled for NETCONF or the CLI, this item controls how the NSO SSH daemon
locates the user keys for public key authentication. See Section 35.4.1, “Public Key Login”
/ncs-config/aaa/local-authentication/enabled
The term "local user" refers to a user stored under /aaa/authentication/users. The alternative is a user
unknown to NSO, typically authenticated by Pluggable Authentication Modules (PAM). By default, NSO
first checks local users before trying PAM or external authentication. Local authentication is practical in test
environments. It is also useful when we want to have one set of users that are allowed to login to the host
with normal shell access and another set of users that are only allowed to access the system using the normal
encrypted, fully authenticated, northbound interfaces of NSO.
If we always authenticate users through PAM it may make sense to set this configurable to false. If we
disable local authentication it implicitly means that we must use either PAM authentication or "external
authentication". It also means that we can leave the entire data trees under /aaa/authentication/users and, in
the case of "external auth" also /nacm/groups (for NACM) or /aaa/authentication/groups (for legacy tailf-aaa)
empty.
/ncs-config/aaa/pam
If this configuration parameter is defined and if the group of a user cannot be determined, a logged in user
ends up in the given default group.
/ncs-config/aaa/external-authentication
Password Login
Password login is triggered in the following cases:
When a user logs in over NETCONF or the CLI using the built in SSH server, with a password. The
user presents a username and a password in accordance with the SSH protocol.
When a user logs in using the WebUI. The WebUI asks for a username and password.
When the method Maapi.authenticate() is used.
In this case, NSO will by default try local authentication, PAM, and external authentication, in that order, as
described below. It is possible to change the order in which these are tried, by modifying the ncs.conf.
parameter /ncs-config/aaa/auth-order.
1. If /aaa/authentication/users/user{$USER} exists and the presented password matches the encrypted
password in /aaa/authentication/users/user{$USER}/password the user is authenticated.
2. If the password does not match or if the user does not exist in /aaa/authentication/users, PAM login is
attempted, if enabled. See Section 35.4.3, “PAM” for details.
3. If all of the above fails and external authentication is enabled, the configured executable is invoked.
4-44 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
database, the keys in the user's $HOME/.ssh directory are checked. If these keys match the keys
presented by the user, authentication succeeds.
4. Otherwise, authentication fails. In all cases the keys are expected to be stored in a file called
authorized_keys (or authorized_keys2 if authorized_keys does not exist), and in the native OpenSSH
format (i.e. as generated by the OpenSSH ssh-keygen command). If authentication succeeds, the user's
group membership is established as described in Section 35.6, “Group Membership”.
This is exactly the same procedure that is used by the OpenSSH server with the exception that the built-in
SSH server also may locate the directory containing the public keys for a specific user by consulting the
/aaa/authentication/users tree.
High Availability
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 19
Cisco NSO support replication of the CDB configuration as well as of the operational data kept in CDB. The
replication architecture is that of one active master and a number of passive slaves.
A group of NSO hosts consisting of a master, and one or more slaves, is referred to as a high availability
group (and sometimes as an availability group cluster - however this is completely independent and separate
from the clustering feature).
All configuration write operations must occur at the master and NSO will automatically distribute the
configuration updates to the set of live slaves. Operational data in CDB may be replicated or not based on the
tailf:persistent statement in the data model. All write operations for replicated operational data must also
occur at the master, with the updates distributed to the live slaves, whereas non-replicated operational data
can also be written on the slaves.
The only thing NSO does is to replicate the CDB data amongst the members in the high availability group.
It doesn't perform any of the otherwise high availability related tasks such as running election protocols in
order to elect a new master. This is the task of a High-Availability Framework (HAFW) which must be in
place. The HAFW must instruct NSO which nodes are up and down using methods from Ha class in the Java
library.
Alternatively, if we do not wish to run NSO with a full scale high availability framework, we can use the
NSO package in $NCS_DIR/examples.ncs/web-server-farm/ha/packages/manual-ha to manually control
a small high availability pair of two nodes and manually indicate which node is master and which is slave. If
the master dies, the operator will have to manually tell the slave, that it is now master.
4-46 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Replication is supported in several different architectural setups. For example two-node active/standby
designs as well as multi-node clusters with runtime software upgrade.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 20
NSO must be instructed through the ncs.conf configuration file that it should run in high availability mode.
The IP address and the port above indicates which IP and which port should be used for the communication
between the high availability nodes. The tick-timeout is a duration indicating how often each slave must send
a tick message to the master indicating liveness. If the master has not received a tick from a slave within 3
times the configured tick time, the slave is considered to be dead. Similarly, the master sends tick messages
to all the slaves. If a slave has not received any tick messages from the master within the 3 times the timeout,
the slave will consider the master dead and report accordingly.
4-48 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
High Availability Framework (HAFW) HAFW controls NSO
node state
Default state: none (normal
nso1.beMaster
standalone operation) nso2.beSlave
HAFW
HAFW can instruct NSO to become
master or slave
Note! NSO does not come with an
automated implementation of HAFW Replicate CDB
NSO1 NSO2
Note! NSO installation contains an example for manual master/slave control:
examples.ncs/web-server-farm/ha/packages/manual-ha
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 21
A high availability node can be in one of three states: NONE, SLAVE or MASTER. Initially a node is in the
NONE state. This implies that the node will read its configuration from CDB, stored locally on file. Once the
high availability framework has decided whether the node should be a slave or a master the HAFW must
invoke either the methods Ha.beSlave(master) or Ha.beMaster().
When an NSO high availability node starts, it always starts up in mode NONE. This is consistent with how
NSO works without high availability enabled. At this point there are no other nodes connected. Each NSO
node reads its configuration data from the locally stored CDB and applications on or off the node may
connect to NSO and read the data they need.
At some point, the HAFW will command some nodes to become slave nodes of a named master node. When
this happens, each slave node tracks changes and (logically or physically) copies all the data from the master.
Previous data at the slave node is overwritten.
Note that the HAFW, by using NSO's start phases, can make sure that NSO does not start its northbound
interfaces (NETCONF, CLI, etc.) until the HAFW has decided what type of node it is. Furthermore, once a
node has been set to the SLAVE state, it is not possible to initiate new write transactions towards the node. It
is thus never possible for an agent to write directly into a slave node. Once a node is returned either to the
NONE state or to the MASTER state, write transactions can once again be initiated towards the node.
Clustering
Clustering provides Cluster link
communication between
standalone NSO systems
NSO1 NSO2
Remote devices can be
accessed through other NSO
systems
Remote devices' configurations
are not stored locally
devices devices
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 23
The NSO Clustering feature essentially makes it possible for a Device Manager on one NSO to connect and
communicate with a Device Manager on another NSO. An NSO cluster consists of loosely coupled, yet
tightly integrated set of co-operating NSO nodes.
When cluster mode is enabled it is possible to add devices using /devices/device/remote-node (instead of
address/port). A device added in such a way does not store its configuration on that local NSO node, instead
that node will query the remote node whenever configuration data is read. In fact, all operations towards that
device (read/write of config/stats, as well as actions) are delegated to the remote NSO node in question.
Designing a cluster deployment requires planning. There can be many reasons to use clustering: scaling
(handling more devices than a single node can handle), partitioning considerations (for example delegating
Device Manager responsibility according to geographical or network topological considerations). Another
reason can be to spread out services (services can be made to run on different cluster nodes).
4-50 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Clustering Use Case: Service/Device Partitioning
Service
Mgmt
Top level NSO or NSOs are used for
service management
Bottom level NSOs are used for device
management
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 24
The figure illustrates the separation of NSO functionality into two levels in a cluster based on service and
device management:
Top level NSO or NSOs are used for service management
Bottom level NSOs are used for device management
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 25
The figure illustrates a use case where the load is distributed among geographical regions. This minimizes
the performance impact on NSO by splitting the managed devices among the regional NSOs.
4-52 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Clustering Use Case: Service Partitioning
Global
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 26
The next use case can also reduce the load on NSOs but using and additional layer of separation by making
different NSOs responsible for different sets of services. This may also be a requirement in case there are
separate administrative domains for different types of services.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 27
The figure illustrates a combination of high availability and scalability clustering where each cluster node is
implemented as a pair of high availability nodes (master and slave).
4-54 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Clustering Implementation
Implementation steps: 1. Add remote node
NCS1 NCS2
Requirements:
2. Add remote devices
Each node must have all the
NEDs of configured remote
nodes locally installed
devices devices
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 28
<netconf-north-bound>
<enabled>true</enabled>
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 29
In order for NSO systems to be able to communicate you need to enable northbound NETCONF on port
2022.
4-56 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Cluster Configuration: Add Remote Nodes
admin@nso(config)# cluster authgroup nso-global ?
Possible completions:
default-map - Remote authentication parameters for users not in umap
umap - Map NCS users to remote authentication parameters Use in case the
admin@nso(config)# cluster authgroup nso-global default-map ? same credentials
Possible completions:
remote-name - Specify node user name are valid across
remote-password - Specify the remote password the entire cluster
same-pass - Use the local NCS user name as the remote user name
same-user - Use the local NCS user name as the remote user name
admin@nso(config)# cluster authgroup nso-global default-map same-user same-pass
admin@nso(config)# cluster remote-node nso-am address 10.65.0.2 authgroup nso-global
admin@nso(config)# cluster remote-node nso-emea address 10.129.0.2 authgroup nso-global
admin@nso(config)# cluster remote-node nso-apac address 10.193.0.2 authgroup nso-global
admin@nso(config)# commit
Commit complete. Retrieve public SSH keys
admin@nso(config)# cluster remote-node nso-am ssh fetch-host-keys
admin@nso(config)# cluster remote-node nso-emea ssh fetch-host-keys from cluster neighbors
admin@nso(config)# cluster remote-node nso-apac ssh fetch-host-keys
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 30
Assuming we have the new NSO node, ncs-global, up and running we need to first add the three other nodes
to its configuration. The very first step is to set up authentication configuration. NSO uses NETCONF over
SSH to communicate to other nodes in the cluster, the simplest way to set up authentication is to have NSO
pass on the credentials one has logged in with on to the next NSO.
admin@nso(config)# commit
Commit complete.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 31
Once the other nodes in the cluster have been created we can start adding remote devices connected to those
nodes.
4-58 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Scalable System Management
In this topic you will learn how to use the NCT toolset to efficiently manage a larger NSO
install base.
NSO3 NSO8
NSO6 NSO5
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 33
NCT is a collection of tools that can be used to install and manage NCS nodes.
NSO2
SSH NSO7
NCT
NSO1 NSO4
Each NCS node can be operated on independently but the main idea is that NCT can operate on a set of NSO
nodes. To operate on a set of NSO nodes a, so called, hostsfile is needed. A hostsfile consists of host entries
according to the following example.
4-60 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Scalable System Management: NCT Toolset
Hostsfile defines rules for
accessing remote nodes
{"IP-address",[options]}
NSO2
NSO7
SSH
NCT
A hostsfile is a plain text file that consists of host-entries, containing individual options for each entry. Each
entry - called a a Tuple, that begin with a ‘{’ bracket and ends with a ‘}.’ - consists of a Hostname/IP-
Address, enclosed in double quotes and a list of options, where the list begin with a ‘[’ bracket and ends with
a corresponding ‘]’ bracket.
Each option is represented as a tuple with the switch name and its value, and if it is an unary switch it is
represented as just the switch name. The ‘-’ in a switch corresponds to a ‘_’ in the hostsfile. For example, the
switch ‘--ssh-user’ correspond to ‘ssh_user’ in the hostsfile.
Each managed NSO node can be given a name (alias) that can then be used by NCT commands to reference
the NSO nodes by name. Often it can also be useful to be able to group a subset of the Hosts in the hostsfile
when you want to restrict or group an operation to only those Hosts. This can be done with the group
mechanism.
name
A name representation of the host. It is mandatory for the nct-move-device command. Example:
{"192.168.23.99",[{name, "paris"}, ... ]}.
{"192.168.23.98",[{name, "london"}, ... ]}.
Mandatory for nct-move-device.
groups
A list of groups the host belongs to. Example:
{"192.168.23.99",[{groups, ["groupA", "groupB"]}, ... ]}.
{"192.168.23.98",[{groups, ["groupB", "groupC"]}, ... ]}.
4-62 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
NCT: Hostsfile Options (Cont.)
SSH Access:
Options: ssh_user, ssh_pass, ssh_port
Static SSH access parameters to log into remote NSO node shell
NETCONF:
Options: netconf_user, netconf_pass, netconf_port
Static NETCONF access parameters to log into remote NSO CLI
NSO System Directories:
Options: install_dir, run_dir, config_dir, log_dir
NSO system directories used on remote NSO node
NSO Device Migration:
Options: service_node, device_node
Used to implement device migration between NSO nodes
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 37
The Hostsfile can contain any option available to the NCT tool. The options are typically in the form of --
option. Remember, each Hostsfile option omits the startin "--" and has the other ‘-’ characters in a switch
replaced by the ‘_’ character in the Hostsfile. For example, the switch ‘--ssh-user’ correspond to ‘ssh_user’ in
the hostsfile.
Common options for NCT tools
--concurrent BOOL
Each HOST will be operated upon concurrently. The default value is true. If set to false, each HOST will be
dealt with in sequence. Obviously, the default behavior often results in a faster total execution time.
However, when debugging a command it can be useful to only execute one HOST at a time.
--name NAME
Restrict the command to only operate on the given NAME.
--group GROUP[,GROUP]
Restrict the command to only operate on the given GROUP or groups.
--groupoper GROUPOPER
If several groups are specified with the --group switch. This switch defines if the union or intersection of
those groups should be used. Possible values are: "or" (default) or "and".
--help
Will print out a short help text and then terminate the command.
-h, --host HOST[,HOST]+
Define one HOST, or several comma separated HOST. The given hosts are the ones the command will
operate upon.
--hostsfile HOSTSFILE
The HOSTSFILE containing the HOST entries. By setting the environment variable ‘NCT_HOSTSFILE’ to
HOSTSFILE this switch can be omitted.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 38
4-66 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
NCT Toolset: Load Configuration
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 39
With the nct-load-config command it is possible to load XML configuration files to NCS hosts, either
running NSO instances or as initial configuration.
NCT Load Configuration Options
--file FILE
The configuration xml file containing CDB configuration, or an ncs.conf file.
Example: `config.xml | ncs.conf'
--type TYPE
The type of configuration file. See the TYPE section. Valid types are: cdb, cdb-init or ncs-conf.
--install-dir InstallDir
This is the directory where static files, primarily the code and libraries for the NCS daemon, are installed.
The actual directory used for a given invocation of the installation script is InstallDir/ncs-VSN, allowing for
coexistence of multiple installed versions. The currently active version is identified by a symbolic link
InstallDir/current pointing to one of the ncs-VSN directories. If the --install-dir option is omitted, /opt/ncs
will be used for InstallDir.
--config-dir ConfigDir
This directory is used for config files, e.g. ncs.conf. If the --config-dir option is omitted, /etc/ncs will be used
for ConfigDir.
--run-dir RunDir
This directory is used for run-time state files, such as the CDB data base and currently used packages. If the -
-run-dir option is omitted, /var/opt/ncs will be used for RunDir.
The nct-backup will perform an NCS backup on the specified Host(s) using the built in NSO functionality.
At success, the name of the created backup file will be returned.
This command has no specific options, only the options common to all NCT commands.
4-68 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
NCT Toolset: Move Device
Use nct move-device tool to move Service Node
a device from one NSO to another NSO2
Prerequisites:
Device Nodes
Hostsfile: name, device_node,
NSO1 NSO2
service_node, REST options
Nodes have REST enabled
SSL enabled (or disable SSL for
Migrate device from
REST in Hostsfile) one device NSO
devices node to another devices
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 41
The nct-move-device is a command can be used for moving a managed device from one NSO node to
another using the REST API of NSO. Note that this command requires the cluster topology to be described in
the
Hostsfile.
NCT Move Device Options
--device DEVICE
The name of the device to move.
--from FROM
The NCS device node name, as specified in the hostsfile.
--to TO
The NCS device node name, as specified in the hostsfile.
--rest-pass RESTPASS
The REST password to be used (default: admin).
--rest-port RESTPORT
The REST Port number to be used (default: 8080).
--rest-user RESTUSER
The REST user to be used (default: admin).
--rest-SSL BOOLEAN
REST via SSL true/false (default: true).
The nct-cli-cmd is a command to execute NSO CLI commands on one or several NSO systems.
-c CMD or --cmd CMD
The CMD argument is a string that can contain any valid CLI command that you want to execute on the
host(s). Note that the command(s) are piped to the ncs_cli executable.
4-70 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
NCT Toolset: Package Management
Options:
Default action is to list packages: -c <command>
cisco@nso:~$ nct packages install
Package Info at 10.65.0.2:8080
ncs-4.1.1-cisco-ios-4.0.4 (loaded) Statuses: deinstall
ncs-4.1.1-cisco-iosxr-4.1 (loaded) installable fetch
ncs-4.1.1-juniper-junos-3.0.21 (loaded)
l2vpn-1.0 (loaded) installed --file <package file>
l3mplsvpn-1.0 (loaded) loaded --package <package name>
...
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 43
Use the nct-packages command to install, uninstall, load NSO packages and retrieve related package status
information, such as if the package is installed, loaded or just installable.
NCT Packages Options
-c, --cmd CMD
The default CMD is ‘list’ which will list all the packages in host(s) and their status. The status can be any of
‘installable’, ‘installed’ or ‘loaded’. These values can also be used as a CMD and will then only show those
packages with this status. To get the NCS package moved to host(s), i.e to make it ‘installable’, use ‘fetch’ as
the CMD. To install or deinstall use the ‘install’ or ‘deinstall’ value as the CMD. To load or unload a
package into a running NCS use the ‘reload’ CMD. The ‘fetch’ command require the ‘--file’ switch to be
used. The ‘install’ and ‘deinstall’ require the ‘--package’ switch.
--file FILE
The package file name. Example: ‘ncs-3.3-tailf-hcc-3.0.8.tar.gz’. This switch is used in combination with the
‘-c fetch’ switch.
--package PACKAGE
The package name. Example: ‘ncs-3.3-tailf-hcc-3.0.8’. This switch is used in combination with either ‘-c
install’ or ‘-c deinstall’ switches.
The nct-upgrade command will upgrade an NSO release on the specified host(s) using the ‘--cmd’ and ‘--
ncs-vsn’ switches. The default is to first do an NCS backup and to reload any packages. This behavior can be
changed with the ‘--backup’ and ‘--reload_packages’ switches.
When doing an upgrade, this command will do the following:
1. Assert the given NCS version really is installed on the Host.
2. Assert that given NCS version isn’t already running.
3. Make sure that there exist ‘installable’ packages that corresponds to the (old) already installed packages.
4. Backup NCS (default action, but optional)
5. Uninstall the old packages, then install the new packages.
6. Stop NCS
7. Rearrange the symlinks under InstallDir
8. Start NCS (default is to also reload all packages, but optional)
NCT Upgrade Options
--backup BOOL
If ‘true’ (default), an NCS backup will be performed before the NCS upgrade takes place. This can be turned
off by specifying ‘false’ as the BOOL value.
-c, --cmd CMD
The CMD can be either upgrade (default) or available. The former will perform an NCS upgrade and the
latter will show all installed releases on host(s).
--ncs-vsn NCSVSN
The NSCVSN is a string containing the NCS version number. Example: ‘3.2.1’
--reload-packages BOOL
If ‘true’ (default), any packages will be reloaded when the new (upgraded) NCS is started. This can be turned
off by setting the BOOL value to ‘false’.
4-72 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Other NCT Tools
Copy files to NSO nodes (/tmp is default destination):
cisco@nso:~$ nct copy --file neds.tar.gz --to-dir /opt/resources
Install NSO:
cisco@nso:~$ nct install nso-4.1.1.linux.x86_64.installer.bin
Install NCS to 10.65.0.2:22
Installation started, see : /tmp/nso-4.1.1.linux.x86_64.installer.bin.log
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 45
Refer to the manual pages for a complete list and description of all NCT commands. the figure illustrates
how to install, start or stop the NSO system and how to copy file to an NSO system or retrieve logs from a
NSO system.
System Troubleshooting
Installation problems
Startup issues
Service design challenges
Service instance deployment problems
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 47
4-74 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
System Troubleshooting Strategies
Run NSO in verbose mode and in foreground
Tail relevant log files:
System install: /var/logs/ncs/ cisco@nso:~$ ncs --verbose --foreground
...
Local install: in logs subdirectory
of the running directory
cisco@nso:~$ tail –f /var/log/ncs/ncs.log
...
Relevant log files:
ncs.log: system event logs
audit.log: system access logs
devel.log: detailed debugging log useful for development
xpath.trace: detailed XPath parsing log useful for development
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 48
When NSO is started, give the --verbose (abbreviated -v) and --foreground flags. This will prevent NSO
from starting as a daemon and cause some messages to be printed on the stdout.
$ ncs --verbose --foreground ...
To find out what NSO is/was doing, browsing NSO's log files is often helpful. In the examples, they are
called 'devel.log', 'ncs.log', 'audit.log'. If you are working with your own system, make sure the log files are
enabled in ncs.conf. They are already enabled in all the examples.
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 49
NSO will give you a comprehensive status report if you call ncs –status. NSO status information is also
available as operational data under /ncs-state (e.g. by using the show ncs-state CLI command).
4-76 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Restarting NSO
After changing the configuration (ncs.conf) it is enough to reload the
configuration:
System installation Local installation
cisco@nso:~$ sudo ncs --reload cisco@nso:~$ ncs --reload
Restarting NSO:
System installation Local installation
cisco@nso:~$ sudo /etc/init.d/ncs cisco@nso:~$ ncs --stop
restart cisco@nso:~$ ncs
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 50
The figure illustrates the various options available to re-initialize the NSO system:
After changing the ncs.conf file it is enough to trigger a reload using the ncs --reload command.
When a complete restart is required you should use the /etc/init.d/ncs restart command if you are using
the system installation or use the ncs --stop command to stop the server and ncs to start the server. Note
that a server restart does not initiate a package reload action. You should use the packages reload CLI
command or use the --with-packkage-reload flag when starting a locally-installed NSO.
Per-device settings:
admin@nso(config)# devices device rtr-sf-pe122 trace pretty
admin@nso(config)# commit
admin@nso# devices device rtr-sf-pe122 disconnect
admin@nso# devices device rtr-sf-pe122 connect
admin@nso# file show <path>/ned-cisco-ios-rtr-sf-pe122.trace
Log file name is constructed from the NED ID and the hostname
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 51
Service model or NED development may require additional troubleshooting information that can be
generated by enabling NETCONF trace logs. The figure illustrates how to enable logs globally or on per-
device basis.
It is possible to turn on and off NETCONF/NED traffic tracing. This is often a good way to troubleshoot
problems. In order to understand the trace output, a basic prerequisite is a good understanding of the
NETCONF RFC. Similarly for CLI NEDs, a good understanding of the CLI capabilities of the managed
devices is required. To turn on southbound traffic tracing, we need to enable the feature and we must also
configure a directory where we want the trace output to be written. It is possible to have the trace output in
two different formats, pretty and raw. The pretty mode indents all the XML data for enhanced readability and
the raw mode does not. Sometimes when the XML is broken, raw mode is required.
4-78 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Gathering Support Information
When opening a support request it is important to gather the required
information:
Transcript and the configuration needed to reproduce an issue
Log files: make sure you enable the error logs when reproducing the issue
Use ncs –status to collect system information
Use the ncs --debug-dump <dump-file> options to create a dump file
© 2016 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 52
When reporting an issue to the NSO support team it is recommended to collect as much valuable data which
can help resolve the issue in a timely manner. In addition to the previously mentioned troubleshooting
options you should also provide a dump file and error logs when having problems with the NSO system.
Make sure you enable logging before reproducing an issue to prepare the support information.
The following sections provide some additional information regarding the available troubleshooting
mechanisms.
Transcript
When contacting support, it often helps the support engineer to understand what you are trying to achieve if
you copy-paste the commands, responses and shell scripts that you used to trigger the problem.
Debug dump
If you suspect you have experienced a bug in NSO, or NSO told you so, you can give Support a debug dump
to help us diagnose the problem. It contains a lot of status information (including a full ncs --status report)
and some internal state information. This information is only readable and comprehensible to the NSO
development team, so send the dump to your support contact. A debug dump is created using ncs --debug-
dump mydump1. Many interesting traces will wash away with time, or stay undetected if there are lots of
irrelevant facts in the dump.
System dump
If NSO aborts due to failure to allocate memory (see Section 31.8, “Disaster management”), and you believe
that this is due to a memory leak in NSO, creating one or more debug dumps as described above (before
NSO aborts) will produce the most useful information for Support. If this is not possible, you can make NSO
produce a system dump just before aborting. To do this, set the environment variable $NCS_DUMP to a file
name for the dump before starting NSO. The dumped information is only comprehensible to the NSO
development team, so send the dump to your support contact.
4-80 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Summary
This topic summarizes the key points that were discussed in this lesson.
Reliability: backup, master/slave setup
Performance: clustering
Security: AAA setup
Scalability: use NCT
New features: upgrade to latest version
References
For additional information, refer to these resources:
Cisco Documentation
Objectives
Upon completing this lesson, you will be able to:
Understand and manage alarms in Cisco NSO
Manage alarms thorough the Alarm Center or CLI
Configure alarm management characteristics
Create Cisco NSO system status report
Alarms Overview
This topic describes the Cisco NSO alarming capabilities.
Alarm Management
" An alarm denotes an undesirable state in a
resource for which an operator action is required"
Monitoring System
© 2014 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 4
Cisco NSO embeds a generic alarm manager. It is used for managing NSO native alarms and can easily be
extended with application specific alarms. Alarm sources can be notifications from devices, undesired states
on services detected or anything provided via the Java application programming interface (API).
NSO generates alarms for serious problems that must be remedied. Alarms are available over all northbound
interfaces and they exist at the path /alarms. NSO alarms are managed as any other alarms by the general
NSO Alarm Manager.
The NSO alarm manager also presents a northbound Simple Network Management Protocol (SNMP) view,
alarms can be retrieved as an alarm table, and alarm state changes are reported as SNMP Notifications.
Note Not every alarm has a service impact. Some alarms are considered minor, some of them may also
originate from the NSO itself and have nothing to do with the state of the service or the network.
4-84 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Alarm Manager Alarm
SNMP Alarm
Handling
Managers
Clients
Alarm sources: Auto- generated Dedicated SNMP
northbound alarm MIB
NSO states generate alarms interface
Device events can generate alarms
Any other source can be designed to Alarm Manager:
generate alarms Alarm Model
Alarm List
Alarm consumers: Operator Actions
Alarms in CDB
NSO CLI or WebUI
SNMP agent Dedicated alarm API
First of all it is important to clearly define what an alarm means. “An alarm denotes an undesirable state in a
resource for which an operator action is required.” An alarms doesn’t necessarily mean that there is a service
outage or degradation. Typically there are alarms tiers that will denote the severity of the situation. Alarms
are often confused with general logging and event mechanisms, thereby overflooding the operator with
alarms. In NSO, the alarm manager shows undesired resource states that an operator should investigate. NSO
contains other mechanisms for logging in general. Therefore, NSO does not naively populate the alarm list
with traps received in the SNMP notification receiver.
Before looking into how NSO handles alarms it is important to define the fundamental concepts. We make a
clear distinction between alarms and events in general. Alarms should be taken seriously and be investigated.
Alarms have states, they go active with a specific severity, they change severity and they are cleared by the
resource. The same alarm may become active again. A common mistake is to confuse the operator view with
the resource view. The model described so far is the resource view. The resource itself may consider the
alarm cleared. The alarm manager does not automatically delete cleared alarms. An alarm that has existed in
the network may still need investigation. There are dedicated actions an operator can use to manage the
alarm list, for example delete alarms based on criteria’s such as cleared and date. These actions can be
performed over all north-bound interfaces.
Rather than viewing alarms as a list of alarm notifications NSO defines alarms as states on objects. The NSO
alarm list uses four keys for alarms: the alarming object within a device and the alarm type and an optional
specific problem. Alarm types are normally unique identifiers for a specific alarm state and are defined
statically. An alarm type corresponds to the well-known X.733 alarm standard tuple event type, and probable
cause. Specific problem is an optional key that is string based and can further redefine an alarm type at run-
time. This is needed for alarms that are not known before a system is deployed. Imagine a system with
general digital inputs. A MIB might specify traps called input-high, input-low. When defining the SNMP
notification reception, an integrator might define an alarm type called "External-Alarm". Input-high might
imply a major alarm and input-low might imply clear. At installation some detectors report "fire-alarm" and
some "door-open" alarms. This is configured at the device and sent as free text in the SNMP var-binds. This
is then managed by using the specific problem field of the NSO alarm manager to separate this different
alarm types.
The Alarm Manager has three main components:
4-86 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Alarm Handling
© 2014 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 6
Investigation Observation
None
Ack Closed
© 2014 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 7
4-88 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Alarm Management
This topic describes the alarm management interface in Cisco NSO using the WebUI or the
CLI.
Alarm Management
© 2014 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 9
Alarm handling can be integrated with existing internal procedure used to handle incidents. NSO offers the
following alarm access capabilities:
Locally on NSO via CLI or WebUI
Poll via SNMP or any other northbound API
Forward alarms as SNMP traps
© 2014 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 10
The show alarms command will list the summary statistics for alarms and then the entire list of alarms with
their details (equivalent to what was shown in the WebUI on the previous page).
By selecting an individual alarm you will see the details such as all state changes, and all operation actions.
Each alarm entry shows the last status change for the alarm and also a child list with all status changes sorted
in chronological order.
is-cleared: Was the last state change = clear?
last-status-change: Time stamp for last status change
last-perceived-severity: Last severity (not equal to clear)
last-alarm-text: The last alarm text (not equal to clear)
status-change:
— event-time: The time reported by the device
— received-time: The time that the state change was received by NSO
— perceived-severity
— alarm-text
Alarm type descriptions
alarm-type: Base identity for alarm types. A unique identification of the fault, not including the
managed object. Alarm types are used to identify if alarms indicate the same problem or not, for lookup
into external alarm documentation, etc. Different managed object types and instances can share alarm
types. If the same managed object reports the same alarm type, it is to be considered to be the same
alarm. The alarm type is a simplification of the different X.733 and 3GPP alarm IRP alarm correlation
mechanisms and it allows for hierarchical extensions. A 'specific-problem' can be used in addition to the
alarm type in order to have different alarm types based on information not known at design-time, such
as values in textual SNMP Notification varbinds.
4-90 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
ncs-dev-manager-alarm: Base type for all alarms related to the device manager. This is never reported,
sub-identities for the specific device alarms are used in the alarms.
ned-live-tree-connection-failure: Failed to connect for one of the optional live tree NEDs.
dev-manager-internal-error: An internal error in NSO device manager.
final-commit-error: A managed device validated a configuration change, but failed to commit. When
this happens, NSO and the device are out of sync. Reconcile by comparing and sync-from or sync-to.
commit-through-queue-blocked: A commit was queued behind a queue item waiting to be able to
connect to one of its devices. This is potentially dangerous since one unreachable device can potentially
fill up the commit queue indefinitely.
revision-error: A managed device arrived with a known module, but too new revision. Upgrade the
Device NED using the new YANG revision in order to use the new features in the device.
missing-transaction-id: A device announced in its Network Configuration Protocol (NETCONF) hello
message that it supports the transaction-id as defined in http://tail-f.com/yang/netconf-monitoring.
However when NSO tries to read the transaction-id no data is returned. This usually a case of
misconfigured NACM rules on the managed device. The NSO check-sync feature will not work.
configuration-error: A device was badly configured in a manner making it unusable.
commit-through-queue-failed: A queued commit failed. The device is now out of sync.
connection-failure: NSO failed to connect to a managed-device. Verify address, port authentication,
check that the device is up and running.
out-of-sync: A managed device is out of sync with NO. Reconcile by comparing sync-from or sync-to.
ncs-snmp-notification-receiver-alarm: The snmp-notification-receiver could not setup its configuration,
either at startup or when reconfigured. Snmp notifications will now be missed. Check the error-message
and change the configuration.
receiver-configuration-error: An SNMP Notification Receiver configuration error prevented it from
starting.
ncs-package-alarm: Base type for all alarms related to packages. This is never reported, sub-identities
for the specific package alarms are used in the alarms.
package-load-failure: NSO failed load a package. Check the package for the reason.
package-operation-failure: A package has some problem with its operation. Check the package for the
reason.
ncs-service-manager-alarm: Base type for all alarms related to the service manager. This is never
reported, sub-identities for the specific service alarms are used in the alarms.
© 2014 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 11
The figure illustrates a list of alarms on PE devices. You can see that one of them is still active (not cleared).
Such alarms require immediate action. They will prevent any changes from being pushed down to this device
until the incident is resolved.
4-92 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Operator Actions None
Acknowledged
The alarm manager also defines Alarm
operator actions for handling alarms. Observation
States
Use NSO or an existing monitoring Investigation
© 2014 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 12
Operator actions can set operator states on alarms (for example, acknowledged, observed, and so on), and
also enable you to administratively manage the alarm list (for example, deleting alarms).
The following administrative alarm states are available:
None
Acknowledged
Observation
Investigation
Closed
Compliance Reporting
Report
Used to check if configuration is definition Report
correct (compliant)
Problem management requires
analysis of incident history
Compliance reports can be used to
gather information Cisco NSO
Design reports
Reports can be designed upfront Generate reports
Reports can be generated when
needed
© 2014 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 14
Compliance reporting
When the unexpected happens or things come to the worst and the network configuration is broken, there is a
need to gather information and verify the configuration. Cisco NSO has numerous functions to show
different aspects of such a network config verification. However, to simplify this task, the compliance
reporting can assemble information using a selection of these functions and present the resulting information
in one report. The aim for this report is to answer two fundamental questions:
Who has done what?
Is the network correctly configured?
What defines then a correctly configured network? Where is the master? NSO by nature, with the
configurations stored in Configuration Database (CDB), is the master. Checking the live devices against the
NSO stored device configuration is a fundamental part of compliance reporting. But it does not stop here.
Compliance reporting can also be based on one or a number of stored device templates which the live
devices are compared against. The compliance reports can also be a combination of both approaches.
Compliance verification can be defined to check the current situation or checking historic events, or both. To
assemble historic events, rollback files and audit logs are used. Therefore these functionalities must have
been enabled for the time period of interest, or else no history view can be presented.
The reports can be formatted either as text, html or docbook xml format. The intention of the docbook
format is that the user can take the report and by further post-processing create reports formatted by own
choice, for instance Portable Document Format (PDF) using Apache FOP.
4-94 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Report Definition Options
Device selection options: Service selection options:
all- devices: check all defined devices all- services: check all defined services
device- group: specified list of device groups service: specified list of services
device: specified list of devices select- services: specified by an XPath
expression
select- devices: specified by an XPath
expression
© 2014 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 15
The report has a device-check and a service-check container for specifying devices and services to check. The
compare-template list allows for specifying templates to compare device configurations against.
For a report definition specifying the device-check container, the default behavior for the verification of
devices is the following:
To request a check-sync action to verify that the device is currently in sync. This behavior is controlled
by the leaf current-out-of-sync (default true).
To scan history (i.e. logs) for failed check-sync events and report these. This behavior is controlled by
the leaf historic-out-of-sync (default true).
To scan commit log (i.e. rollback files) for changes on the devices report these. This behavior is
controlled by the leaf historic-changes (default true).
For a report definition specifying the service-check container, the default behavior for the verification of
services is the following:
4-96 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Compliance Reporting: Report Definitions via CLI
Create report definition
admin@ncs(config)# compliance reports report "Full PE Report"
admin@ncs(config-report-Full PE Report)# device-check device-group CSR-PE
admin@ncs(config-report-Full PE Report)# service-check all-services
admin@ncs(config-report-Full PE Report)# commit
Run report
admin@ncs# compliance reports report "Full PE Report" run
id 57
compliance-status violations
info Checking 5 devices and 6 services
location http://localhost:8080/compliance-reports/report_57_administrator_1_2014-11-
14T9:32:29:0.xml
admin@ncs#
© 2014 Cisco and/or its affiliates. All rights reserved. Cisco Network Services Orchestrator 16
The figure illustrates how the same can be accomplished using the NSO CLI.
Alternatively, if you use the Juniper style CLI you would do something like this:
administrator@ncs% set compliance reports report "Full PE
Report" device-check device-group CSR-PE
[ok][2014-11-14 09:17:01]
[edit]
administrator@ncs%
administrator@ncs% set compliance reports report "Full PE
Report" service-check all-services
[ok][2014-11-14 09:17:12]
[edit]
administrator@ncs% commit
Commit complete.
[ok][2014-11-14 09:17:48]
[edit]
administrator@ncs> request compliance reports report "Full PE
Report" run
id 58
compliance-status violations
info Checking 5 devices and 6 services
location http://localhost:8080/compliance-
reports/report_58_administrator_1_2014-11-14T9:29:2:0.xml
[ok][2014-11-14 09:29:05]
administrator@ncs> show compliance report-results report
COMPLIANCE
ID NAME TITLE TIME WHO
STATUS LOCATION
4-98 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.
Configuration Compliance Report
Device group name
Ensure devices have standard configurations
based on device templates: Template name
admin@ncs(config)# compliance reports report CC_PE
admin@ncs(config-report-CC_PE)# compare-template "Template for PE Routers" "PE Routers"
admin@ncs(config-compare-template-Template for PE Routers/PE Routers)# commit
The last example of compliance reporting focuses on ensuring that a group of devices complies with standard
configuration sets defined by device templates. The printout on the right shows that PE11 is missing the
required NTP configuration.
References
For additional information, refer to these resources:
Cisco Documentation
4-100 Cisco Network Services Orchestrator (NSO) 2.0 © 2016 Cisco Systems, Inc.