3. fw_Oper.route User documentation!

3.1. Cisco Firewall Routes - How To ?

Use the route module of fw_oper package to get the necessary matching entries for the Routes on Cisco Firewall.

Note

For now route changes are not implemented.

3.2. High-level Overview

  1. Define inputs

  2. Import package, modules

  3. select firewall, routes, route Objects

  4. perform necessary search operations

3.3. Detailed How To

  1. Define inputs:

    file = 'running-config log captuerd file for fw.log'    # fw log
    
    prefix = '10.10.10.0/24'
    
  2. Import necessary package/modules:

    import fwOper as fw
    
  3. Create Firewall Object:

    with open(file, 'r') as f:
            flst = f.readlines()
    
    insts = fw.get_object(fw.Instances, conf_list=flst)
    print(insts)                    # set of instances
    
  4. Refereance to Instance to routes

    routes = insts['instance_name'].routes
    routes = insts.instance_name.routes
    print(routes)                   # all routes
    

    instance_name can be accepted in either bracket or dotted format. Use of bracket format is must if space/special characters involved in instance_name.

  5. Operations on routes:

    print(routes)                           # all routes
    print(prefix in routes)         # bool: is prefix match any route.
    print(routes.prefix(prefix))    # matching route for given prefix
    print(routes.prefix(prefix).ifdesc)     # route description for matching route
    print(routes.prefix(prefix).route_line) # string prop ( object work without it )