cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
732
Views
0
Helpful
2
Replies

CPE full configuration - how to segment it ?

rainnomm56
Level 1
Level 1

Hi,

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>172.20.56.243</address><mask>255.255.255.254</mask></primary></address>

     juniper - <address><name>90.191.254.189/27</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.

2 Replies 2

rainnomm56
Level 1
Level 1

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>/config/pieces/authentication</tykk>

    <tykk>/config/pieces/common_shit</tykk>

    <tykk>/config/pieces/snmp</tykk>

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

    <tykk>/config/pieces/logging</tykk>

    <tykk>/config/pieces/vty</tykk>

    <tykk>/config/pieces/banner_min</tykk>

    <tykk>/config/pieces/qos_mark_cpe_generated</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>

    <router cat="892F">

    <tykk>/config/pieces/bgp1_l3vpn</tykk>

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

    <tykk>/config/pieces/int_common_87x_88x</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>

  </router>


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.


<vty>

  <router cat="all">

     <vars>

      <var>BGP_NEIG1</var>

     </vars>

      <conf>

access-list 23 remark Telnet ACL

access-list 23 permit %BGP_NEIG1%

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

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

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

    </conf>

  </router>

</vty>

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.

  <var>

    <name>BGP_NEIG1</name>

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

    <kontr>

      <fnkts>ipaddr</fnkts>

      <muut>ip</muut>

    </kontr>

    <autovar>

      <mysql>m_pe_ip</mysql>

    </autovar>

  </var>


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

Hi Rain,

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

Thanks,

-Dan