def create_attachable_access_entity_profile(infra, entity_profile, **args): """Create an attached entity profile. This provides a template to deploy hypervisor policies on a large set of leaf ports. This also provides the association of a Virtual Machine Management (VMM) domain and the physical network infrastructure. """ args = args['optional_args'] if 'optional_args' in args.keys() else args infra_attentityp = AttEntityP(infra, entity_profile) if 'enable_infrastructure_vlan' in args.keys(): if args['enable_infrastructure_vlan'] in [True, 'True']: infra_provacc = ProvAcc(infra_attentityp) elif args['enable_infrastructure_vlan'] in [False, 'False']: infra_provacc = ProvAcc(infra_attentityp) infra_provacc.delete() if 'domain_profiles' in args.keys() and is_valid(args['domain_profiles']): for domain in args['domain_profiles']: if domain['type'] == 'physical': path = 'uni/phys-' elif domain['type'] == 'vcenter': path = 'uni/vmmp-VMware/dom-' elif domain['type'] == 'layer2': path = 'uni/l2dom-' elif domain['type'] == 'layer3': path = 'uni/l3dom-' else: print 'Invalid domain type.' path = '' infra_rsdomp = RsDomP(infra_attentityp, path + domain['name']) if is_valid_key(args, 'interface_policy_group'): infra_funcp = FuncP(infra) infra_accportgrp = AccPortGrp(infra_funcp, args['interface_policy_group']) infra_rsattentp = RsAttEntP(infra_accportgrp) return infra_attentityp
def AEP_build(host, user, profile, domain): print('[BEG] Attached Entity Profile Configuration') moDir = apic_login(host, user, password) polUni = Uni('') infraInfra = Infra(polUni) aepName = 'ASA-L3OUT-Cobra' print('--- Creating AEP: ' + aepName) infraAttEntityP = AttEntityP(infraInfra, name=aepName) print(' Associating Domain: ' + domain + ' to AEP: ' + aepName) infraRsDomP2 = RsDomP(infraAttEntityP, tDn=u'uni/phys-' + domain + '-1') cfg_commit(moDir, infraInfra) print('[END] Attached Entity Profile Configuration') return aepName
def create_attachable_access_entity_profile(modir, profile_name, **args): args = args['args_from_CLI'] if 'args_from_CLI' in args.keys() else args # Query a parent infra = modir.lookupByDn('uni/infra') infra_attentityp = AttEntityP(infra, profile_name) if 'enable_infrastructure_vlan' in args.keys(): if args['enable_infrastructure_vlan'] in [True, 'True']: infra_provacc = ProvAcc(infra_attentityp) elif args['enable_infrastructure_vlan'] in [False, 'False']: infra_provacc = ProvAcc(infra_attentityp) infra_provacc.delete() if 'domain_profiles' in args.keys(): for domain in args['domain_profiles']: infra_rsdomp = RsDomP(infra_attentityp, 'uni/phys-' + domain) print_query_xml(infra) commit_change(modir, infra)
def remove_attachable_access_entity_profile(infra, entity_profile, **args): """Remove an attached entity profile. This provides a template to deploy hypervisor policies on a large set of leaf ports. This also provides the association of a Virtual Machine Management (VMM) domain and the physical network infrastructure. """ args = args['optional_args'] if 'optional_args' in args.keys() else args infra_attentityp = AttEntityP(infra, entity_profile) infra_attentityp.delete()
def remove_attachable_access_entity_profile(infra, entity_profile, **args): """Remove an attached entity profile. This also provides the removal of a Virtual Machine Management (VMM) domain and the physical network infrastructure. """ args = args['optional_args'] if 'optional_args' in args.keys() else args infra_attentityp = AttEntityP(infra, entity_profile) infra_attentityp.delete()