cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
469
Views
5
Helpful
2
Replies

Create Interactions between NSO and External inventory

Jerems
Spotlight
Spotlight

Hi All,

 

Let's say that i have to rely on an external inventory to fullfill some variable values in a service template.

How would you proceed to allow your service package to import those values from an external database like Netbox acting as a SOT for example ?

In the example below i would like to fetch the value of the variable "cpe-ip-address" from Netbox.

<device>
  <name>{/device-cpe}</name>
  <config>
    <configuration xmlns="http://xml.juniper.net/xnm/1.1/xnm">
      <interfaces>
        <interface>
          <name>{/interfaces/cpe-iface-id}</name>
          <flexible-vlan-tagging/>
          <?foreach {/vlans}?>
          <unit>
            <name>{cvlan-id}</name>
            <description>{/interfaces/cpe-unit-desc}</description>
            <vlan-id>{cvlan-id}</vlan-id>
            <family>
              <inet>
                <address>
                  <name>{ipv4-address/cpe-ip-address}</name>
                </address>
              </inet>
            </family>
          </unit>
          <?end?>
        </interface>
      </interfaces>
    </configuration>
  </config>
</device>

Thanks in advance

Jerems

 

1 Accepted Solution

Accepted Solutions

u.avsec
Spotlight
Spotlight

Hey,

I would suggest looking up ReactiveFASTMAP concept in developer guide.I wouldn't be surprised if there is an actual example in examples.ncs for this too (NSO install dir).

 

Basically your service package python code needs to:

-Figure out that the IP is missing

-Fetch IP via some sort of API (probably rest?)

-Store received IP in a config false yang node for persistency

-Redeploy the service (you will need a subscriber monitoring the above yang node)

 

-Release mechanism so that NSO releases IP on Netbox once service is deleted (you can pair this mechanism with the subscriber as well)

 

Flow would be like this:

Commit-> Python detects missing IP -> Calls code for fetching IP from IPAM and exiting create method -> Code fetches IP and places it in NSO -> Subscriber code figures that out and redeploys the service

On service delete:

Subscriber detects service being deleted and runs the IPAM IP release code

 

Something like that.

 

 

 

 

 

View solution in original post

2 Replies 2

u.avsec
Spotlight
Spotlight

Hey,

I would suggest looking up ReactiveFASTMAP concept in developer guide.I wouldn't be surprised if there is an actual example in examples.ncs for this too (NSO install dir).

 

Basically your service package python code needs to:

-Figure out that the IP is missing

-Fetch IP via some sort of API (probably rest?)

-Store received IP in a config false yang node for persistency

-Redeploy the service (you will need a subscriber monitoring the above yang node)

 

-Release mechanism so that NSO releases IP on Netbox once service is deleted (you can pair this mechanism with the subscriber as well)

 

Flow would be like this:

Commit-> Python detects missing IP -> Calls code for fetching IP from IPAM and exiting create method -> Code fetches IP and places it in NSO -> Subscriber code figures that out and redeploys the service

On service delete:

Subscriber detects service being deleted and runs the IPAM IP release code

 

Something like that.

 

 

 

 

 

Jerems
Spotlight
Spotlight

Thanks a lot @u.avsec