op script example: using python

commit script: 

scp commit_permissions.py ansible@192.168.99.111:/var/db/scripts/commit/


op script folder:

scp device_info.py vagrant@192.168.99.111:/var/db/scripts/op/



vMX config
vagrant@vqfx-re# show
commit {
    file commit_permissions.py;
}
language python;


set system scripts commit file commit_permissions.py
system scripts commit file commit_permissions.py
set system scripts language python


commit_
from junos import Junos
from junos import Junos_Context
from junos import Junos_Configuration
import jcs

def main():
    # Get configuration root object
    root = Junos_Configuration

    message = "Permission all is assigned to invalid class."

    # Warn about any login classes with the all permission set
    for element in root.findall("./system/login/class[permissions='all']"):
        jcs.emit_warning("class:" + element.find('name').text + " " + message)

if __name__ == '__main__':
    main()