'CgkSslTps', 'CgkF5VpnConn', 'CgkF5CertificateCheck' ], 've': [ 'CgkF5LTM', 'CgkF5Apm', 'CgkF5SyncStatus', 'CgkF5ASMLearningDbCheck', 'CgkSslTps', 'CgkF5VpnConn', 'CgkF5CertificateCheck' ], 'app': [ 'CgkF5LTM', 'CgkF5Apm', 'CgkF5SyncStatus', 'CgkF5ASMLearningDbCheck', 'CgkSslTps', 'CgkF5VpnConn', 'CgkF5CertificateCheck' ], } for dev_class in all_classes: dev_class_uid = '/zport/dmd/Devices' + dev_class templates_to_bind = [ x[0] for x in z.get_bound_templates(uid=dev_class_uid) ] # add common templates for template in class_templates['all']: if template not in templates_to_bind: templates_to_bind.append(template) # add specific templates for key, value in class_templates.iteritems(): if key in dev_class_uid.lower(): for template in class_templates[key]: if template not in templates_to_bind: templates_to_bind.append(template) if 'HA' not in dev_class:
new_class_name = new_class_name + '/' + new_id make_sure_class_exists(new_class_name) class_templates = { 'all': ['Device', 'CgkBigip', 'CgkBigipCluster', 'CgkF5CPU', 'CgkF5Memory'], 'ltm': ['CgkF5LTM', 'CgkSslTps'], 'ha/ltm': ['CgkF5SyncStatus', 'CgkF5HagroupStatus'], 'asm': ['CgkF5ASMLearningDbCheck'], 'apm': ['CgkF5Apm', 'CgkF5VpnConn'], } for dev_class in all_classes: dev_class_uid = '/zport/dmd/Devices' + dev_class templates_to_bind = [x[0] for x in z.get_bound_templates(uid=dev_class_uid)] # add common templates for template in class_templates['all']: if template not in templates_to_bind: templates_to_bind.append(template) # add specific templates for key, value in class_templates.iteritems(): if key in dev_class_uid.lower(): for template in class_templates[key]: if template not in templates_to_bind: templates_to_bind.append(template) templates_to_bind = list(set(templates_to_bind))