# for the example ... from exampleutils import * from jnpr.eznc import Netconf as Junos from jnpr.eznc.resources.srx.nat_src_simple import NatSourceSimple from jnpr.eznc.utils import ConfigUtils login = dict(user='******', host='vsrx_cyan', password='******') jdev = Junos(**login) jdev.open() # meta-toolbox the config-utils package onto this object, # this gives us access to: jdev.ez.cu.<functions> jdev.ez( cu=ConfigUtils ) # define a resource manager for simple source-NAT use-cases rmgr = NatSourceSimple( jdev ) # if you want to see the resource properties, you could do: # >>> print NatSourceSimple.PROPERTIES # ['zone_from', 'zone_to', 'match_src_addr', 'match_dst_addr', 'pool_from_addr', 'pool_to_addr'] # define some default properties we'll use: ##### ------------------------------------------------------------------------- ##### now create a super-simple config that all uses the same name "oubound-all" ##### name for the rule-set name, the rule name, and the pool name ##### -------------------------------------------------------------------------
# for the example ... from exampleutils import * from jnpr.eznc import Netconf as Junos from jnpr.eznc.resources.srx.nat_src_simple import NatSourceSimple from jnpr.eznc.utils import ConfigUtils login = dict(user='******', host='vsrx_cyan', password='******') jdev = Junos(**login) jdev.open() # meta-toolbox the config-utils package onto this object, # this gives us access to: jdev.ez.cu.<functions> jdev.ez(cu=ConfigUtils) # define a resource manager for simple source-NAT use-cases rmgr = NatSourceSimple(jdev) defaults = dict(zone_from='OUTSIDE-DC-ST1', zone_to='PII-SOX-DC-ST1') def load_defaults(r): for k, v in defaults.items(): r[k] = v def make_simple(): r = rmgr["outbound-all"]