예제 #1
0
    # Create afi-safi policy instances
    nbr_ipv6_afsf.apply_policy.config.import_policy.append('PASS-ALL')

    nbr_ipv6_afsf.apply_policy.config.export_policy.append('PASS-ALL')

    nbr_ipv6.afi_safis.afi_safi.append(nbr_ipv6_afsf)

    crud_service.create(session, nbr_ipv6)

    #now delete nbr_ipv4
    crud_service.delete(session, nbr_ipv4)

    nbr_ipv6_filter = bgp.Bgp.Neighbors.Neighbor()
    nbr_ipv6_filter.neighbor_address = '2001:db8:fff1::1'

    nbr_ipv6_read = crud_service.read(session, nbr_ipv6_filter)

    # help(nbr_ipv6_read)
    print(nbr_ipv6_read)

    #crud_service.read(session,bgp_cfg1)


if __name__ == "__main__":
    init_logging()
    provider = establish_session()
    crud_service = CRUDService()
    bgp_run(crud_service, provider)
    exit()
예제 #2
0
    try:
        interfaces = crud_service.read(provider, interfaces_filter)
        for interface in interfaces.interface:
            print_interface(interface)
    except YPYError:
        print('An error occurred reading interfaces.')


def create_interfaces_config(crud_service, provider):

    interface = Interfaces.Interface()
    interface.config.name = 'LoopbackYDK'
    interface.name = interface.config.name

    try:
        crud_service.create(provider, interface)
    except YPYError:
        print('An error occurred creating the interface.')



if __name__ == "__main__":
    init_logging()
    provider = establish_session()
    crud_service = CRUDService()
    read_interfaces(crud_service, provider)


    provider.close()
    exit()