示例#1
0
def modify_UCS_VNIC(vl_range):
    handle = UcsHandle(credentials.UCS_login['ipaddr'],
                       credentials.UCS_login['username'],
                       credentials.UCS_login['password'])
    handle.login()
    for vlan_id in vl_range:
        mo = VnicLanConnTempl(parent_mo_or_dn="org-root", name="ACI-A")
        mo_vnic_a = VnicEtherIf(parent_mo_or_dn=mo,
                                default_net="no",
                                name="ACI-" + vlan_id)
        handle.set_mo(mo)
        mo = VnicLanConnTempl(parent_mo_or_dn="org-root", name="ACI-B")
        mo_vnic_b = VnicEtherIf(parent_mo_or_dn=mo,
                                default_net="no",
                                name="ACI-" + vlan_id)
        handle.set_mo(mo)
        handle.commit()
示例#2
0
def createVNICTemplates(handle, vlan, org):
    print "Creating Kubernetes VNIC Templates"
    from ucsmsdk.mometa.vnic.VnicLanConnTempl import VnicLanConnTempl
    from ucsmsdk.mometa.vnic.VnicEtherIf import VnicEtherIf
    mo = VnicLanConnTempl(parent_mo_or_dn=org, templ_type="updating-template", name="kubeA", descr="", stats_policy_name="default", switch_id="A", pin_to_group_name="", mtu="1500", policy_owner="local", qos_policy_name="", ident_pool_name="kubeA", nw_ctrl_policy_name="")
    mo_1 = VnicEtherIf(parent_mo_or_dn=mo, default_net="yes", name=vlan)
    handle.add_mo(mo)

    mob = VnicLanConnTempl(parent_mo_or_dn=org, templ_type="updating-template", name="kubeB", descr="", stats_policy_name="default", switch_id="B", pin_to_group_name="", mtu="1500", policy_owner="local", qos_policy_name="", ident_pool_name="kubeB", nw_ctrl_policy_name="")
    mo_2 = VnicEtherIf(parent_mo_or_dn=mob, default_net="yes", name=vlan)
    handle.add_mo(mob)

    try: 
        handle.commit()
    except UcsException as err:
        if err.error_code == "103":
            print "\tVNIC Templates already exist"
示例#3
0
def setup_vnic_template(server, module):
    from ucsmsdk.mometa.vnic.VnicLanConnTempl import VnicLanConnTempl
    from ucsmsdk.mometa.vnic.VnicEtherIf import VnicEtherIf

    ansible = module.params
    args_mo = _get_mo_params(ansible)

    changed = False

    for vnic in args_mo['vnic_list']:
        exists = False
        mo = server.query_dn(args_mo['org_dn'] + '/lan-conn-templ-' +
                             vnic['name'])
        if mo:
            exists = True

        if ansible['state'] == 'absent':
            if exists:
                changed = True
                if not module.check_mode:
                    server.remove_mo(mo)
                    server.commit()
        else:
            if not exists:
                changed = True
                if not module.check_mode:
                    # create if mo does not already exist
                    #if not "description" in vnic:
                    #    vnic["description"] = ""
                    #if not "qos_policy_name" in vnic:
                    #    vnic["qos_policy_name"] = ""
                    if not "mtu" in vnic:
                        vnic["mtu"] = "1500"
                    mo = VnicLanConnTempl(
                        parent_mo_or_dn=args_mo['org_dn'],
                        descr=vnic['description'],
                        ident_pool_name=vnic['mac_pool'],
                        name=vnic['name'],
                        mtu=vnic['mtu'],
                        #qos_policy_name=vnic['qos_policy_name'],
                        switch_id=vnic['side'])

                    # make the first network the native vlan
                    def_net = "yes"
                    for v in vnic['vlan']:
                        mo_1 = VnicEtherIf(parent_mo_or_dn=mo,
                                           default_net=def_net,
                                           name=v)
                        if def_net == "yes":
                            def_net = "no"

                    server.add_mo(mo, True)
                    server.commit()

    return changed
示例#4
0
def update_nic(server, vnic, org):
    from ucsmsdk.mometa.vnic.VnicLanConnTempl import VnicLanConnTempl
    from ucsmsdk.mometa.vnic.VnicEtherIf import VnicEtherIf
    # create if mo does not already exist
    if not "description" in vnic:
        vnic["description"] = "" 
    if not "qos_policy" in vnic:
        vnic["qos_policy"] = ""
    if not "mtu" in vnic:
        vnic["mtu"] = "1500"
    if not "stats_policy" in vnic:
        vnic["stats_policy"] = "default"

    # default template is updating, this is different than  
    # standard UCS because UCS made the wrong decision for
    # default.  
    if "updating" in vnic:
        if vnic["updating"] == "yes":
            vnic["updating"] = "updating-template"
        else:
            vnic["updating"] = "initial-template"
    else:
        vnic["updating"] = "updating-template"

    if not "nw_ctrl_policy" in vnic:
        vnic["nw_ctrl_policy"] = ""
    mo = VnicLanConnTempl(parent_mo_or_dn=org,
                          templ_type=vnic['updating'],
                          descr=vnic['description'],    
                          ident_pool_name=vnic['mac_pool'],
                          name=vnic['name'],
                          mtu=vnic['mtu'],
                          qos_policy_name=vnic['qos_policy'],
                          stats_policy_name=vnic['stats_policy'],
                          nw_ctrl_policy_name=vnic['nw_ctrl_policy'],
                          switch_id=vnic['side'])

    if "vlans" in vnic:
        for v in vnic['vlans']:
	    if not 'native' in v:
	        v['native'] = 'no'
            mo_x = VnicEtherIf(parent_mo_or_dn=mo, 
                               default_net=v['native'],
                               name=v['name'])

    server.add_mo(mo, True)
    server.commit()
示例#5
0
def main():
    argument_spec = ucs_argument_spec
    argument_spec.update(
        org_dn=dict(type='str', default='org-root'),
        name=dict(type='str', required=True),
        description=dict(type='str', aliases=['descr'], default=''),
        fabric=dict(type='str', default='A', choices=['A', 'B', 'A-B', 'B-A']),
        redundancy_type=dict(type='str',
                             default='none',
                             choices=['none', 'primary', 'secondary']),
        peer_redundancy_template=dict(type='str',
                                      aliases=['peer_redundancy_templ'],
                                      default=''),
        target=dict(type='str', default='adapter', choices=['adapter', 'vm']),
        template_type=dict(type='str',
                           default='initial-template',
                           choices=['initial-template', 'updating-template']),
        vlans_list=dict(type='list'),
        cdn_source=dict(type='str',
                        default='vnic-name',
                        choices=['vnic-name', 'user-defined']),
        cdn_name=dict(type='str', default=''),
        mtu=dict(type='str', default='1500'),
        mac_pool=dict(type='str', default=''),
        qos_policy=dict(type='str', default=''),
        network_control_policy=dict(type='str', default=''),
        pin_group=dict(type='str', default=''),
        stats_policy=dict(type='str', default='default'),
        state=dict(type='str',
                   default='present',
                   choices=['present', 'absent']),
    )

    module = AnsibleModule(
        argument_spec,
        supports_check_mode=True,
        required_if=[
            ['cdn_source', 'user-defined', ['cdn_name']],
        ],
    )
    ucs = UCSModule(module)

    err = False

    # UCSModule creation above verifies ucsmsdk is present and exits on failure.  Additional imports are done below.
    from ucsmsdk.mometa.vnic.VnicLanConnTempl import VnicLanConnTempl
    from ucsmsdk.mometa.vnic.VnicEtherIf import VnicEtherIf

    changed = False
    try:
        mo_exists = False
        props_match = False
        # dn is <org_dn>/lan-conn-templ-<name>
        dn = module.params['org_dn'] + '/lan-conn-templ-' + module.params[
            'name']

        mo = ucs.login_handle.query_dn(dn)
        if mo:
            mo_exists = True

        if module.params['state'] == 'absent':
            # mo must exist but all properties do not have to match
            if mo_exists:
                if not module.check_mode:
                    ucs.login_handle.remove_mo(mo)
                    ucs.login_handle.commit()
                changed = True
        else:
            # set default params for lists which can't be done in the argument_spec
            if module.params.get('vlans_list'):
                for vlan in module.params['vlans_list']:
                    if not vlan.get('native'):
                        vlan['native'] = 'no'
                    if not vlan.get('state'):
                        vlan['state'] = 'present'
            # for target 'adapter', change to internal UCS Manager spelling 'adaptor'
            if module.params['target'] == 'adapter':
                module.params['target'] = 'adaptor'
            if mo_exists:
                # check top-level mo props
                kwargs = dict(descr=module.params['description'])
                kwargs['switch_id'] = module.params['fabric']
                kwargs['redundancy_pair_type'] = module.params[
                    'redundancy_type']
                kwargs['peer_redundancy_templ_name'] = module.params[
                    'peer_redundancy_template']
                kwargs['ident_pool_name'] = module.params['mac_pool']
                # do not check shared props if this is a secondary template
                if module.params['redundancy_type'] != 'secondary':
                    kwargs['target'] = module.params['target']
                    kwargs['templ_type'] = module.params['template_type']
                    kwargs['cdn_source'] = module.params['cdn_source']
                    kwargs['admin_cdn_name'] = module.params['cdn_name']
                    kwargs['mtu'] = module.params['mtu']
                    kwargs['qos_policy_name'] = module.params['qos_policy']
                    kwargs['nw_ctrl_policy_name'] = module.params[
                        'network_control_policy']
                    kwargs['pin_to_group_name'] = module.params['pin_group']
                    kwargs['stats_policy_name'] = module.params['stats_policy']
                if mo.check_prop_match(**kwargs):
                    # top-level props match, check next level mo/props
                    if not module.params.get('vlans_list'):
                        props_match = True
                    else:
                        # check vlan props
                        for vlan in module.params['vlans_list']:
                            child_dn = dn + '/if-' + str(vlan['name'])
                            mo_1 = ucs.login_handle.query_dn(child_dn)
                            if vlan['state'] == 'absent':
                                if mo_1:
                                    props_match = False
                                    break
                            else:
                                if mo_1:
                                    kwargs = dict(default_net=vlan['native'])
                                    if mo_1.check_prop_match(**kwargs):
                                        props_match = True
                                else:
                                    props_match = False
                                    break

            if not props_match:
                if not module.check_mode:
                    # create if mo does not already exist
                    # secondary template only sets non shared props
                    if module.params['redundancy_type'] == 'secondary':
                        mo = VnicLanConnTempl(
                            parent_mo_or_dn=module.params['org_dn'],
                            name=module.params['name'],
                            descr=module.params['description'],
                            switch_id=module.params['fabric'],
                            redundancy_pair_type=module.
                            params['redundancy_type'],
                            peer_redundancy_templ_name=module.
                            params['peer_redundancy_template'],
                            ident_pool_name=module.params['mac_pool'],
                        )
                    else:
                        mo = VnicLanConnTempl(
                            parent_mo_or_dn=module.params['org_dn'],
                            name=module.params['name'],
                            descr=module.params['description'],
                            switch_id=module.params['fabric'],
                            redundancy_pair_type=module.
                            params['redundancy_type'],
                            peer_redundancy_templ_name=module.
                            params['peer_redundancy_template'],
                            target=module.params['target'],
                            templ_type=module.params['template_type'],
                            cdn_source=module.params['cdn_source'],
                            admin_cdn_name=module.params['cdn_name'],
                            mtu=module.params['mtu'],
                            ident_pool_name=module.params['mac_pool'],
                            qos_policy_name=module.params['qos_policy'],
                            nw_ctrl_policy_name=module.
                            params['network_control_policy'],
                            pin_to_group_name=module.params['pin_group'],
                            stats_policy_name=module.params['stats_policy'],
                        )

                    if module.params.get('vlans_list'):
                        for vlan in module.params['vlans_list']:
                            if vlan['state'] == 'absent':
                                child_dn = dn + '/if-' + str(vlan['name'])
                                mo_1 = ucs.login_handle.query_dn(child_dn)
                                ucs.login_handle.remove_mo(mo_1)
                            else:
                                mo_1 = VnicEtherIf(
                                    parent_mo_or_dn=mo,
                                    name=str(vlan['name']),
                                    default_net=vlan['native'],
                                )

                    ucs.login_handle.add_mo(mo, True)
                    ucs.login_handle.commit()
                changed = True

    except Exception as e:
        err = True
        ucs.result['msg'] = "setup error: %s " % str(e)

    ucs.result['changed'] = changed
    if err:
        module.fail_json(**ucs.result)
    module.exit_json(**ucs.result)
示例#6
0
        mo_1 = FcpoolBlock(parent_mo_or_dn=mo, to="20:00:00:25:B5:A0:00:FF", r_from="20:00:00:25:B5:A0:00:00")
        handle.add_mo(mo)
        handle.commit()

        mo = FcpoolInitiators(parent_mo_or_dn=my_Full_Path_Org, name="WWPN_Pool-A", policy_owner="local", descr="WWPN Pool FI-A", assignment_order="sequential", purpose="port-wwn-assignment")
        mo_1 = FcpoolBlock(parent_mo_or_dn=mo, to="20:01:00:25:B5:A0:00:0F", r_from="20:01:00:25:B5:A0:00:00")
        handle.add_mo(mo)
        handle.commit()

        mo = FcpoolInitiators(parent_mo_or_dn=my_Full_Path_Org, name="WWPN_Pool-B", policy_owner="local", descr="WWPN Pool FI-B", assignment_order="sequential", purpose="port-wwn-assignment")
        mo_1 = FcpoolBlock(parent_mo_or_dn=mo, to="20:01:00:25:B5:B0:00:0F", r_from="20:01:00:25:B5:B0:00:00")
        handle.add_mo(mo)
        handle.commit()

#Create vNIC Templates
mo = VnicLanConnTempl(parent_mo_or_dn=my_Full_Path_Org, templ_type="updating-template", name="MGMT-A", descr="Management FI-A", stats_policy_name="default", admin_cdn_name="", switch_id="A", pin_to_group_name="", mtu="1500", policy_owner="local", qos_policy_name="", ident_pool_name="MGMT-A", cdn_source="vnic-name", nw_ctrl_policy_name="CDP_EN")
mo_1 = VnicEtherIf(parent_mo_or_dn=mo, default_net="yes", name="Mgmt")
mo_2 = VnicEtherIf(parent_mo_or_dn=mo, default_net="no", name="vMotion")
handle.add_mo(mo)
handle.commit()

mo = VnicLanConnTempl(parent_mo_or_dn=my_Full_Path_Org, templ_type="updating-template", name="MGMT-B", descr="Management FI-B", stats_policy_name="default", admin_cdn_name="", switch_id="B", pin_to_group_name="", mtu="1500", policy_owner="local", qos_policy_name="", ident_pool_name="MGMT-B", cdn_source="vnic-name", nw_ctrl_policy_name="CDP_EN")
mo_1 = VnicEtherIf(parent_mo_or_dn=mo, default_net="yes", name="Mgmt")
mo_2 = VnicEtherIf(parent_mo_or_dn=mo, default_net="no", name="vMotion")
handle.add_mo(mo)
handle.commit()

mo = VnicLanConnTempl(parent_mo_or_dn=my_Full_Path_Org, templ_type="updating-template", name="VM-A", descr="Production FI-A", stats_policy_name="default", admin_cdn_name="", switch_id="A", pin_to_group_name="", mtu="1500", policy_owner="local", qos_policy_name="", ident_pool_name="VM-A", cdn_source="vnic-name", nw_ctrl_policy_name="CDP_EN")
#Depending on the VLANs that will pass wot the NIC:
#mo_1 = VnicEtherIf(parent_mo_or_dn=mo, default_net="no", name=Production)
#mo_2 = VnicEtherIf(parent_mo_or_dn=mo, default_net="no", name="VLAN_800")
示例#7
0
def vnic_template_create(handle,
                         name,
                         vlans=[],
                         con_policy_type=None,
                         con_policy_name=None,
                         mtu=1500,
                         qos_policy_name="",
                         target="",
                         ident_pool_name="",
                         nw_ctrl_policy_name="",
                         pin_to_group_name="",
                         switch_id="A",
                         stats_policy_name="default",
                         templ_type="initial-template",
                         descr="",
                         parent_dn="org-root"):
    """
    Creates vNIC Template

    Args:
        handle (UcsHandle)
        name (String) : vNIC Template name
        vlans (List) : List of tuples - [(vlan_name, native_vlan)]
        con_policy_type (String) : Connection Policy Type ["dynamic-vnic","usnic","vmq"]
        con_policy_name (String) : Connection Policy name
        mtu (String)
        qos_policy_name (String) : QoS Policy name
        target (String) : ((vm|adaptor|defaultValue),){0,2}(vm|adaptor|defaultValue){0,1}
        ident_pool_name (String) : MAC Address Pool name
        nw_ctrl_policy_name (String) : Network Control Policy name
        pin_to_group_name (String) : Pin Group name
        switch_id (String) : ["A", "A-B", "B", "B-A", "NONE"]
        stats_policy_name (String) : Stats Threshold Policy name
        templ_type (String) : ["initial-template", "updating-template"]
        descr (String) :
        parent_dn (String) :

    Returns:
        None

    Example:
        sample_vlans = [("my_vlan","yes"),("lab_vlan","no"),("sample_vlan","no")]
        vnic_template_create(handle, "sample_vnic_template", sample_vlans, "usnic",
                            "sample_usnic_policy", "1500", "samp_qos_policy",
                            "adaptor,vm", "samp_mac_pool")
    """
    from ucsmsdk.mometa.vnic.VnicLanConnTempl import VnicLanConnTempl
    from ucsmsdk.mometa.vnic.VnicDynamicConPolicyRef import VnicDynamicConPolicyRef
    from ucsmsdk.mometa.vnic.VnicUsnicConPolicyRef import VnicUsnicConPolicyRef
    from ucsmsdk.mometa.vnic.VnicVmqConPolicyRef import VnicVmqConPolicyRef

    from ucsmsdk.mometa.vnic.VnicEtherIf import VnicEtherIf

    obj = handle.query_dn(parent_dn)
    if obj:
        mo = VnicLanConnTempl(parent_mo_or_dn=obj,
                              templ_type=templ_type,
                              name=name,
                              descr=descr,
                              stats_policy_name=stats_policy_name,
                              switch_id=switch_id,
                              pin_to_group_name=pin_to_group_name,
                              mtu=mtu,
                              policy_owner="local",
                              qos_policy_name=qos_policy_name,
                              target=target,
                              ident_pool_name=ident_pool_name,
                              nw_ctrl_policy_name=nw_ctrl_policy_name)

        handle.add_mo(mo, True)
        handle.commit()

        # TODO: Query to check if connection policy exists
        if con_policy_name:
            if con_policy_type.lower() == "dynamic-vnic":
                mo_1 = VnicDynamicConPolicyRef(parent_mo_or_dn=mo,
                                               con_policy_name=con_policy_name)
            elif con_policy_type.lower() == "usnic":
                mo_1 = VnicUsnicConPolicyRef(parent_mo_or_dn=mo,
                                             con_policy_name=con_policy_name)
            elif con_policy_type.lower() == "vmq":
                mo_1 = VnicVmqConPolicyRef(parent_mo_or_dn=mo,
                                           con_policy_name=con_policy_name)
            else:
                log.info(con_policy_type +
                         " is not a valid Connection Policy type.")

        vlan_mo = []
        if vlans != None:
            for vlan in vlans:
                # TODO: Query to check if VnicEtherIf exists
                if len(vlan) != 2:
                    raise Exception(
                        "Invalid number of VLAN properties. Expect 2 properties. Actual:%d"
                        % (len(vlan)))
                vlan_name = vlan[0]
                is_native_vlan = vlan[1]
                # TODO: Query to check if VnicEtherIf exists
                vlan_mo.append(
                    VnicEtherIf(parent_mo_or_dn=mo,
                                name=vlan_name,
                                default_net=is_native_vlan))

        handle.add_mo(mo, modify_present=True)
        handle.commit()
    else:
        log.info(parent_dn + " MO is not available")
示例#8
0
handle.commit()
##### End-Of-PythonScript #####

#Create vNIC Templates
##### Start-Of-PythonScript #####

from ucsmsdk.mometa.vnic.VnicLanConnTempl import VnicLanConnTempl
from ucsmsdk.mometa.vnic.VnicEtherIf import VnicEtherIf

mo = VnicLanConnTempl(parent_mo_or_dn="org-root/org-Sub_Org_Test",
                      templ_type="updating-template",
                      name="MGMT-A",
                      descr="Management FI-A",
                      stats_policy_name="default",
                      admin_cdn_name="",
                      switch_id="A",
                      pin_to_group_name="",
                      mtu="1500",
                      policy_owner="local",
                      qos_policy_name="",
                      ident_pool_name="MGMT-A",
                      cdn_source="vnic-name",
                      nw_ctrl_policy_name="CDP_EN")
mo_1 = VnicEtherIf(parent_mo_or_dn=mo, default_net="yes", name="VLAN_200")
mo_2 = VnicEtherIf(parent_mo_or_dn=mo, default_net="no", name="VLAN_800")
handle.add_mo(mo)
handle.commit()

mo = VnicLanConnTempl(parent_mo_or_dn="org-root/org-Sub_Org_Test",
                      templ_type="updating-template",
                      name="MGMT-B",
                      descr="Management FI-B",
示例#9
0
def vnic_template(input):
	name = input['name']
	descr=input['descr']
	switch_id=input['switch_id']
	redundancy_pair_type="none"
	templ_type= input['templ_type']
	vlan_name=input['vlan_name']
	default_net=input['default_net']
	cdn_source=input['cdn_source']
	admin_cdn_name=input['admin_cdn_name']
	mtu=input['mtu']
	ident_pool_name= input['ident_pool_name']
	state = input['state']
	ip=input['ip']
	username=input['username']
	password=input['password']
	mo=""
	mo_block=""
	results = {}
	ucs_handle = pickle.loads(str(ucs_login.main(ip,username,password)))
###-------CHECK IF MO EXISTS---------------------------------

	try:
		mo = ucs_handle.query_dn("org-root/lan-conn-templ-"+name)
		mo_block=ucs_handle.query_dn("org-root/lan-conn-templ-"+name+"/if-"+vlan_name)
		mo_children=ucs_handle.query_children(in_dn="org-root/lan-conn-templ-"+name,class_id="vnicEtherIf")
	except:
		print("Could not query children of macpool")


###----if expected state is "present"------------------------

	if state == "present":
		block_temp=False
		if(mo_block and mo_block.name ==vlan_name and mo_block.default_net ==default_net):
				
			block_temp=True
		elif (vlan_name == "" and not(mo_children)):
			block_temp=True
		elif (mo_children):
			block_temp=False
		else:
			block_temp=False
				
		if (mo):
			if ( mo.name == name and mo.descr == descr and mo.switch_id ==switch_id and mo.redundancy_pair_type == redundancy_pair_type and mo.templ_type ==templ_type and mo.cdn_source == cdn_source and mo.admin_cdn_name == admin_cdn_name and mo.mtu ==mtu and mo.ident_pool_name == ident_pool_name   and block_temp):
				results['name']=name;
				results['expected'] = True;
				results['changed'] = False;
				results['present'] = True;


			else:
				try:
					modified_mo =  VnicLanConnTempl(parent_mo_or_dn="org-root", name=name, descr=descr ,switch_id =switch_id , redundancy_pair_type = redundancy_pair_type ,templ_type = templ_type , cdn_source = cdn_source , admin_cdn_name = admin_cdn_name , mtu =mtu ,ident_pool_name = ident_pool_name )
					if(vlan_name):
						mo_1= VnicEtherIf(parent_mo_or_dn=modified_mo,default_net=default_net, name=vlan_name)					
					ucs_handle.add_mo(modified_mo,True)
					ucs_handle.commit()
					results['name']=name;
					results['present'] = True;
					results['removed'] = False;
					results['changed'] = True

		   		except Exception,e:
					print(e)

###----------if not, create boot policy with desired config ----------------

		else:
			try:
			    mo =  VnicLanConnTempl(parent_mo_or_dn="org-root", name=name, descr=descr ,switch_id =switch_id , redundancy_pair_type = redundancy_pair_type ,templ_type = templ_type , cdn_source = cdn_source , admin_cdn_name = admin_cdn_name , mtu=mtu ,ident_pool_name = ident_pool_name )
			    if(vlan_name):
				mo_1= VnicEtherIf(parent_mo_or_dn=mo,default_net=default_net, name=vlan_name)
			    ucs_handle.add_mo(mo)
                            ucs_handle.commit()
			    results['name']=name;
			    results['present'] = False;
			    results['created'] = True;
			    results['changed'] = True;

			except:
			    results['error'] = "Vnic template creation failed"
			    return results
示例#10
0
                    handle.add_mo(mo)
                handle.commit()
            if row['vNIC_Template'] and row['vNIC_Fabric'] and row[
                    'vNIC_VLAN'] and row['vNIC_Native_VLAN'] and row[
                        'vNIC_MTU'] and row['vNIC_MAC']:
                # create vNIC templates
                from ucsmsdk.mometa.vnic.VnicLanConnTempl import VnicLanConnTempl
                from ucsmsdk.mometa.vnic.VnicEtherIf import VnicEtherIf

                mo = VnicLanConnTempl(parent_mo_or_dn=org,
                                      templ_type="updating-template",
                                      name=row['vNIC_Template'],
                                      descr="",
                                      stats_policy_name="default",
                                      admin_cdn_name="",
                                      switch_id=row['vNIC_Fabric'],
                                      pin_to_group_name="",
                                      mtu=row['vNIC_MTU'],
                                      policy_owner="local",
                                      qos_policy_name="",
                                      ident_pool_name=row['vNIC_MAC'],
                                      cdn_source="vnic-name",
                                      nw_ctrl_policy_name="Enable_CDP")
                # allow multiple vlans if specified as a list in the csv
                # note that native vlan is set globally, so native  only works here if a single VLAN is specified
                for vlans in [row['vNIC_VLAN']]:
                    vlans = vlans.split(',')
                    for vlan in vlans:
                        # strip unnecessary characters
                        vlan = vlan.strip(' ')
                        vlan = vlan.strip('\"')
                        mo_1 = VnicEtherIf(parent_mo_or_dn=mo,