Showing results for 
Search instead for 
Did you mean: 

CPE full configuration - how to segment it ?


I have not found any good guide how to implement CPE full configuration in NSO. Most of examples are of one service, that is small part of the device configuration. I could do a single monster size cpe_service but that would grow unmanageable pretty quickly.

     I could split configuration into pieces, but where do i say what config sections are necessary for specific product+technical_schema inside service? Examples what i've seen is to use commit script to choose template inside python/java code. Right now i have 45 product+technical_schema components. When I add different supported CPE models then i have 138 combinations. Doing it with if-then statements inside commit code sucks, it should use templates somehow.

If completely ignore what is possible in NSO i would like to segment it like:

1) Every config sections would have its own template and provisioning code attached to it. There is always some need to calculate something, for example interface ip addresses in NSO:

     cisco - <address><primary><address></address><mask></mask></primary></address>

     juniper - <address><name></name></address>

Inside template XML can I callback a custom function, to get interface "ip address + mask" in desired format?

2) I would need to describe what config sections are to be used for a specific product+technical_schema. As there are many combinations i would like to describe combinations outside of "cpe service yang".

3) In "cpe service" i would keep only parameters and their structure. I'm not quite sure, but i think i need to have parameters with tags "admin, customers". For example helpdesk and customer should be able to change LAN interface but not WAN. How to implement this?

    During "cpe service" commit it should lookup its sections and pass "cpe service" parameters to config sections for xml template search&replace.


Re: CPE full configuration - how to segment it ?

Our current CPE generator was written by me in 2010. It was my very first programming project that was used by some other people that me, until that time i've made only personal usage scripts. Most of config sections are reusable. With last new cisco_cpe configuration i had to do 6 new config sections and reused 11 old ones. I'm looking for ways of doing similar segmentation in NSO.

1) All services (teenus) and connection_type (yhendus) are described in single XML file. Webpage menus are auto generated from it. I have 138 different combination of service, connection_type, cpe_model.

rain@ohoo:~/project/conf_gen$ cat teenus_konf.xml | grep "<teenus\|<yhendus\|<router\|<conf"

<teenus cat="L3VPN">

  <yhendus cat="1CPE">

    <conf cat="cisco_ios.xml">

      <router cat="all">

      <router cat="892F">

      <router cat="887VA-M">


    <conf cat="junos.xml">

      <router cat="all">

      <router cat="srx-100">


  <yhendus cat="2CPE_MAIN">

  <yhendus cat="2CPE_BACKUP">


<teenus cat="INTERNET">

  <yhendus cat="2CPE_MAIN">

  <yhendus cat="2CPE_BACKUP">

  <yhendus cat="1CPE_2BGP">


2) In the same file inside "<router>" tag are configuration pieces used for that service+connection+cpe_model. A CPE full configuration is put together from common (cat=all) and device(cat=892F) specific configuration pieces. Single "tykk" is xpath query in file "<conf cat="cisco_ios.xml">" where actual config is located.

<yhendus cat="1CPE">

<conf cat="cisco_ios.xml">

  <router cat="all">




    <tykk var="RD">/config/pieces/snmp_client/param[@var='%VAR%']</tykk>





    <tykk var="QOS_PROFILE">/config/pieces/qos_profile_kvl/param[@var='%VAR%']</tykk>

    <tykk var="QOS_MARK">/config/pieces/qos_mark_kvl/param[@var='%VAR%']</tykk>


    <router cat="892F">


    <tykk var="QOS_PROFILE">/config/pieces/qos_shaper/param[@var='%VAR%']</tykk>


    <tykk var="QOS_PROFILE">/config/pieces/int_uplink_qos/param[@var='%VAR%']</tykk>

    <tykk var="QOS_MARK">/config/pieces/int_klient_qos_mark/param[@var='%VAR%']</tykk>


3) Single piece of config is from vendor specific XML file. Previously described xpath query is automatically appended by parent tag to add router info to query "/config/pieces/vty/router[@cat='all']". Variables are automatically read from config pieces and shown on webpage for filling.


  <router cat="all">





access-list 23 remark Telnet ACL

access-list 23 permit %BGP_NEIG1%

access-list 23 permit x.x.x.x

access-list 23 permit y.y.y.y

access-list 23 deny   any

line con 0

logging synchronous

line vty 0 4

access-class 23 in vrf-also

logging synchronous

transport input telnet ssh




4) Every variable has definition on top of vendor specific xml file. If it has "autovar/mysql" defined it tries to look up its content from database. If it has "kontr/fnkts" then user/database input should be ran through that function (ipaddr) with paramter (ip) for correct format/result.



    <desc>BGP naaber wan interfacel, elioni keskne jaama ruuter</desc>









Screenshot from 2018-04-24 16-03-54.png

Cisco Employee

Re: CPE full configuration - how to segment it ?

Hi Rain,

Whoa, thanks for all the details!! I'm going to have to think about this one for a bit.