kongou-ae
4/8/2014 - 3:54 AM

show_acl.py

show_acl.py

#/usr/bin/env python
# -*- coding: utf-8 -*-

import onep
from onep.element import *
from onep.interfaces import *
from onep.routing import *
from onep.policy import *
from onep.core.util import *

if __name__ == '__main__':

    network_element = NetworkElement('MyRouter's FQDN','testapp')
    session_config = SessionConfig(SessionConfig.SessionTransportMode.TLS)
    session_config.ca_certs = '/home/cisco/MYDOMAIN.ca.pem'

    try:
        session_handle = network_element.connect('username','Password',session_config)

        aclList = Acl.get_acl_list(network_element, 1)
        for acl in aclList:
            print(acl)

        network_element.disconnect()

    except Exception as e:
        print( 'type:' + str(type(e)))
        print( 'args:' + str(e.args))
        print( 'message:' + e.message)
        network_element.disconnect()