8.4. Common Function/Class filters for Jinja tables Processing

class nettoolkit.j2config.func.Aggregated(table)[source]

Bases: Common

device Aggregated/instances

Parameters:

table (dict) – dataframe dictionary

Returns:

Instance of Aggregated

Return type:

Aggregated

Yields:

Aggregated – Instance of Aggregated

class nettoolkit.j2config.func.Bgp(table)[source]

Bases: Common

device Bgp/instances

Parameters:

table (dict) – dataframe dictionary

Returns:

Instance of Bgp

Return type:

Bgp

Yields:

Bgp – Instance of Bgp

bgp_peers(vrf)[source]

yields data slice(s) for the bgp information where bgp_vrf matches with provided vrf name

Parameters:

vrf (str) – vrf name

Yields:

data_slice – of matching bgp details

vrf_not_none()[source]

yields data slice(s) for the bgp information where bgp_vrf is not none

Yields:

data_slice – of matching bgp details

class nettoolkit.j2config.func.Common(table)[source]

Bases: object

COMMON FUNCTIONALITY CLASS TO INHERIT

class nettoolkit.j2config.func.Loopback(table)[source]

Bases: Common

device Loopback/instances

Parameters:

table (dict) – dataframe dictionary

Returns:

Instance of Loopback

Return type:

Loopback

Yields:

Loopback – Instance of Loopback

class nettoolkit.j2config.func.Ospf(table)[source]

Bases: Common

device Ospf

Parameters:

table (dict) – dataframe dictionary

Returns:

Instance of Ospf

Return type:

Ospf

Yields:

Ospf – Instance of Ospf

area_summary_tupples()[source]
vrf(vrf='')[source]
class nettoolkit.j2config.func.Physical(table)[source]

Bases: Common

device Physical/instances

Parameters:

table (dict) – dataframe dictionary

Returns:

Instance of Physical

Return type:

Physical

Yields:

Physical – Instance of Physical

interface(n)[source]

yields data slice(s) for the sorted physical interfaces informations

Parameters:

n (int) – interface number

Yields:

data_slice – of matched interface

interface_type(intf_type)[source]

condition: is provided dataslice is of given interface type

Parameters:
  • data (data_slice) – Pandas DataFrame slice

  • intf_type (str) – interface type to be verify

Returns:

result of condition

Return type:

bool

interface_type_ends(x)[source]

condition: is provided dataslice ends with given argument x

Parameters:
  • data (data_slice) – Pandas DataFrame slice

  • x (str) – interface type ending identifier to be verify with

Returns:

result of condition

Return type:

bool

sorted()[source]

provides list of sorted interface numbers

Returns:

of interface numbers sorted

Return type:

list

sorted_interfaces()[source]

yields data slice(s) for the sorted physical interfaces informations

Yields:

data_slice – sorted physical interfaces

yields data slice(s) for the physical interface information, where int_filter information starts with uplink.

Yields:

data_slice – of matching physical interfaces details

class nettoolkit.j2config.func.Static(table)[source]

Bases: Common

device static

Parameters:

table (dict) – dataframe dictionary

Returns:

Instance of Static

Return type:

Static

Yields:

Static – Instance of Static

default_route(default_route=True)[source]
has_nexthop()[source]
version(ver)[source]
vrf(vrf)[source]
class nettoolkit.j2config.func.Vlan(table)[source]

Bases: Common

device Vlan/instances

Parameters:

table (dict) – dataframe dictionary

Returns:

Instance of Vlan

Return type:

Vlan

Yields:

Vlan – Instance of Vlan

of_instance(vrf)[source]

yields data slice(s) for the vrf matching with intvrf column

Parameters:

vrf (str) – vrf name

Yields:

data_slice – of matching vrf with intvrf

vlan(n)[source]

returns data slice for the matching vlan number

Parameters:

n (int) – vlan number

Yields:

data_slice – of matching vlan number

vlans_sorted_range(start, stop)[source]

yields data slice(s) for the vlans matching for the provided range

Parameters:
  • start (int) – starting vlan number

  • stop (int) – ends vlan number

Yields:

data_slice – of matching vlan numbers

class nettoolkit.j2config.func.Vrf(table)[source]

Bases: Common

device vrf/instances

Parameters:

table (dict) – dataframe dictionary

Returns:

Instance of VRF

Return type:

Vrf

Yields:

Vrf – Instance of VRF

sorted()[source]

list of available vrfs sorted by vrf field.

Returns:

sorted vrfs

Return type:

list

sorted_vpnids()[source]

list of available vpnids sorted.

Returns:

sorted vpnids

Return type:

list

sorted_vrf_data()[source]

vrf data generator, sorted by vrf names

Yields:

data_slice – data for all vrf rows except vrf is none, sorted by vrf names

sorted_vrf_data_by_vpnid()[source]

vrf data generator, sorted by vpnids

Yields:

data_slice – data for all vrf rows except vrf is none, sorted by vpnids

vrf_get(vrf)[source]

get a particular vrf data

Parameters:

vrf (str) – vrf name

Yields:

data_slice – data for matching vrf row

vrf_not_none()[source]

condition: vrf is not None

Yields:

data_slice – data from Row that matches condition

nettoolkit.j2config.func.sort(obj)[source]

exectes sorted method on provided object

Parameters:

obj (dynamic) – Any object object instance declaring sorted method

Returns:

sorted method output from object.

Return type:

dynamic