cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2187
Views
5
Helpful
10
Replies

how to pass or inherit parameters between NSO stacked services

mastedarq
Level 1
Level 1

In advance I just want to explain that I'm NSO newbie, so please don't be offended by the meritoric quality of my questions.
I picked the L3VPN service case to present my questions as it should be good example of what I want to achieve.
I like the approach of stacked services so decided it should be nice to split whole L3 service configuration to smaller parts (which can be reused in other services). By doing that I encountered some obstacles and based on simplified example I'd like to get some more information how to proceed with it.

On attached draw there are three services: "L3VPN" (CFS, umbrella service), "GLOBAL_VRF_DEF" (RFS) and "BGP_VRF_DEF" (RFS).

IMG_0006.jpg
Both RFS services are using some common pieces of information to configure device: vrf_name and vrf_address_families.

What I want to achieve is:
- based on CFS level defined parameters (vrf_name, vrf_address_families) they should be inherited by both RFS services
- Yang models of RFS services shouldn't(?) contain objects of above mentioned parameters at all (just the CFS Yang model) (or more precisely the user shouldn't be asked of such again)

So basically my question is how to pass parameters between services, are there some kind of constrains, what is the best approach, is it even possible at all or I'm missing the intention of NSO "logic" completely?

All of the above services are python-and-template based.

I'll appreciate any advice.

 

YANG models

L3VPN
-----
list L3VPN {
	key name;

	leaf name {
		type string;
	}

	leaf device {
		type leafref {
			path "/ncs:devices/ncs:device/ncs:name";
		}
	}

	leaf vrf_name {
		type string;
	}

	leaf vrf_afi {
		type enumeration {
			enum "ipv4";
			enum "ipv6";
		}
	}

	leaf vrf_safi {
		type enumeration {
			enum "unicast";
			enum "multicast";
		}
	}
}

GLOBAL_VRF_DEF & BGP_VRF_DEF (common Yang model parts)
----------------------------
list GLOBAL_VRF_DEF {
	key name;

	leaf name {
		type string;
	}
// here object is leaf-list as this RFS service can be reused or executed as standalone to configure multiple devices at the same time leaf-list device { type leafref { path "/ncs:devices/ncs:device/ncs:name"; } } // what about the rest of the parameters (vrf_name, vrf_afi, vrf_safi?) }

 XML templates

L3VPN
-----
<config-template>
	<services>
		<GLOBAL_VRF_DEF>
			<name>{/name}</name>
			<device>{/device}</device>
			<vrf_name>{/vrf_name}</vrf_name>
			<vrf_afi>{/vrf_afi}</vrf_afi>
			<vrf_safi>{/vrf_safi}</vrf_safi>
		</GLOBAL_VRF_DEF>
		<BGP_VRF_DEF>
			<name>{/name}</name>
			<device>{/device}</device>
			<vrf_name>{/vrf_name}</vrf_name>
			<vrf_afi>{/vrf_afi}</vrf_afi>
			<vrf_safi>{/vrf_safi}</vrf_safi>
		</BGP_VRF_DEF>
	</services>
</config-template>

GLOBAL_VRF_DEF & BGP_VRF_DEF (here just the first one presented, but BGP_VRF_DEF should use same parameters within its own configuration with similar exceptions)
----------------------------
<devices> 
 <device>
  <name>{/device}</name>
  <config>
    <vrf xmlns="http://tail-f.com/ned/cisco-ios-xr">
      <vrf-list>
        <name>{/vrf_name}</name>
        <address-family>
          <ipv4>
            <unicast> 
				<!-- ... some configuration here -->
            </unicast>
<multicast> <!-- it should only be send to device if CFS level "vrf_safi='multicast'" -->
<!-- ... some configuration here -->
</multicast> </ipv4> <ipv6> <!-- it should only be send to device if CFS level "vrf_afi='ipv6'" --> <unicast> <!-- ... some configuration here --> </unicast> </ipv6> </address-family> </vrf-list> </vrf> </config> </device> </devices>