示例#1
0
def _add_vadapter_en_prop(output, argv, arg_dict, call_from):
    """
       [edit | add ] vadapter <vadapter-name> [<general-atts>]
       [EN <en-attrs>] | [FC <fc-attrs>]

       en-attrs:      [mac <mac-addr>]
                      [promiscuous [TRUE | FALSE]]
                      [silent_listener [TRUE | FALSE]]
                      [vlan <vlan-value>]
    """
    _NON_EN_PROP = [ 'wwnn','wwpn','fc_id','spma','fmpa']
    # Check for attributes which are not in en properties.
    for n in _NON_EN_PROP:
         if arg_dict.has_key(n):
                    output.completeOutputError(InvalidArgumentCount(syntax=_add_vadapter_en_prop.__doc__,
                                           descape = " Keyword '%s' is not an EN attribute" % (n,)))
		    return output
    
    # Check Boolean values. 
    if arg_dict.has_key('promiscuous'):
            if _check_boolean_value(arg_dict, 'promiscuous') !=0:
               msg = " Keyword 'promiscuous' expected value [Enabled| Disabled]"
	       output.completeOutputError(InvalidArgumentCount(descape = " \n '%s'='%s' Invalid promiscuous value . \n %s \n" % 
					('promiscuous',arg_dict['promiscuous'],msg)))
	       return output 

    if arg_dict.has_key('silent_listener'):
            if _check_boolean_value(arg_dict, 'silent_listener') !=0:
               msg1 = " Keyword 'silent_listener' expected value [Enabled| Disabled]"
  	       output.completeOutputError(InvalidArgumentCount(descape = "\n '%s'='%s' Invalid silent_listener value . \n %s \n " % 
					('silent_listener', arg_dict['silent_listener'], msg1)))
	       return output
	
    if arg_dict.has_key('mac'):
	if isMAC(arg_dict['mac']) != 1:
	      output.completeOutputError(InvalidArgumentCount(descape = "\n Invalid MAC address \n "))
	      return output

    if arg_dict.has_key('vlan'):
         if _isVLAN(arg_dict['vlan']) != 1:
	    output.completeOutputError(InvalidArgumentCount(descape = "\n Invalid VLAN value, Expected values : d,d,d-d or d,d or d-d Syntax:d = digit [0-9] \n"))  
	    return output
   
    #print arg_dict
    arg_dict = _editing_edit_dictionary(arg_dict)
    if call_from == 'edit':
        #
        # Change the dictionary according to the reggression.py
        # 
        result = vfm.py_vfm_vadapter_edit_general_attr(arg_dict)
        print "vdapter edited:", result
    elif call_from == 'add':
        vadapter = vfm.py_vfm_vadapter_create(arg_dict)
        print "vadpter created:", vadapter

    return output
示例#2
0
def reg1():  #WORKING
    vadapter = vfm.py_vfm_vadapter_create(vadapter_ip)
    print "vadpter created:", vadapter
    edit1(vadapter)
    result = vfm.py_vfm_vadapter_edit_general_attr({
        'id': vadapter['id'],
        'io_module_id': 1,
        'vfabric_id': 34
    })
    print "vdapter edited:", result
示例#3
0
def reg1():
        vfabric = vfm.py_vfm_vfabric_create(vfabric_ip)
        print "Vfabric created:", vfabric

        vadapter = vfm.py_vfm_vadapter_create(vadapter_ip)
        print "vadpter created:", vadapter

        result = vfm.py_vfm_vfabric_edit_general_attr({'id': vfabric['id'],
                                                'primary_gateway':1})
        print "vfabric edited:", result

        result = vfm.py_vfm_vadapter_edit_general_attr({'id':vadapter['id'], 'vfabric_id':vfabric['id'], 'io_module_id' : 1})
        print "vdapter edited:", result
        try :
                result = vfm.py_vfm_vfabric_online({'id':vfabric['id']})
        except StandardError, e:
                print "ERROR ! " ,e 
示例#4
0
def _add_vadapter_fc_prop(output, argv, arg_dict, call_from):
    """
       [edit | add] vadapter <vadapter-name> [<general-atts>]
       [EN <en-attrs>] | [FC <fc-attrs>]

       fc-attrs:   [wwpn <world-wide-port-name>] 
                   [wwnn <world-wide-node-name>]

    """
    _NON_FC_PROP = ['mac','silent_listener','promiscuous','vlan']
    # Check for attributes which are not in fc properties.
    for n in _NON_FC_PROP:
	if arg_dict.has_key(n):
                    output.completeOutputError(InvalidArgumentCount(syntax=_add_vadapter_fc_prop.__doc__,
                                           descape = " Keyword '%s' is not an FC attribute" % (n,)))
		    return output

    if arg_dict.has_key('wwpn'):
       if  _validateWorldWideNodeOrPortName(arg_dict, 'wwpn') != 0:
	       output.completeOutputError(InvalidArgumentCount(syntax=_add_vadapter_fc_prop.__doc__,
                                     descape = " '%s' = '%s' is not valid Value" % ('wwpn',arg_dict['wwpn'])))
	       return output
		
    if arg_dict.has_key('wwnn'):
       if  _validateWorldWideNodeOrPortName(arg_dict, 'wwnn') != 0:
               output.completeOutputError(InvalidArgumentCount(syntax=_add_vadapter_fc_prop.__doc__,
                                     descape = " '%s' = '%s' is not valid Value" % ('wwnn', arg_dict['wwnn'])))
	       return output 

    # FC-ID ?
    #print arg_dict
    arg_dict = _editing_edit_dictionary(arg_dict)
    if call_from == 'edit':
         #
         # Change the dictionary according to the reggression.py
         # 
        result = vfm.py_vfm_vadapter_edit_general_attr(arg_dict)
        print "vdapter edited:", result
    elif call_from == 'add':
        vadapter = vfm.py_vfm_vadapter_create(arg_dict)
        print "vadpter created:", vadapter
示例#5
0
def reg1():
    vfabric = vfm.py_vfm_vfabric_create(vfabric_ip)
    print "Vfabric created:", vfabric

    vadapter = vfm.py_vfm_vadapter_create(vadapter_ip)
    print "vadpter created:", vadapter

    result = vfm.py_vfm_vfabric_edit_general_attr({
        'id': vfabric['id'],
        'primary_gateway': 1
    })
    print "vfabric edited:", result

    result = vfm.py_vfm_vadapter_edit_general_attr({
        'id': vadapter['id'],
        'vfabric_id': vfabric['id'],
        'io_module_id': 1
    })
    print "vdapter edited:", result
    try:
        result = vfm.py_vfm_vfabric_online({'id': vfabric['id']})
    except StandardError, e:
        print "ERROR ! ", e
示例#6
0
def _add_vadapter_database(output, argv, arg_dict, call_from, syntax = None):
    """
       [add] vadapter <vadapter-name> [<general-atts>]
       [EN <en-attrs>] | [FC <fc-attrs>]

       general-attrs: [vfabric_id <vfabric_id>]
                      [io_module_id <io_module_id>]
                      [status [ONLINE | OFFLINE]]
                      [init_type [ HOST | NETWORK]]
                      [assignment_type [AUTO | MANUAL | ONCE ]]
                      [component_mask [INT]]
    """
    valid_list = ['vfabric_id', 'init_type', 'io_module_id','name','status', 'protocol', 'assignment_type']
    #print arg_dict
    dict = {}
    if call_from == 'edit':
        arg_dict = _editing_edit_dictionary(arg_dict)
        result = vfm.py_vfm_vadapter_edit_general_attr(arg_dict)
	print "vdapter edited:", result
    elif call_from == 'add':
        arg_dict = _editing_edit_dictionary(arg_dict)
        vadapter = vfm.py_vfm_vadapter_create(arg_dict)
        print "vadpter created:", vadapter
    return output
示例#7
0
文件: test.py 项目: rajat007/vfm
def vadapter_create():
    result = vfm.py_vfm_vadapter_create(dict)
示例#8
0
def invalid_ip():  #CREATES A VADAPTER WITH PROTOCOL = ''
    try:
        vfm.py_vfm_vadapter_create({'proto': 10})
    except StandardError, error:
        print error
示例#9
0
def reg3():  #NEED PROTOCOL VALIDATION
    try:
        vfm.py_vfm_vadapter_create({'protocol': 10})
    except StandardError, error:
        print error
示例#10
0
def reg2():  #WORKING
    try:
        vfm.py_vfm_vadapter_create({})
    except StandardError, error:
        print error
示例#11
0
文件: test.py 项目: gautamrege/vfm
def vadapter_create():
        result = vfm.py_vfm_vadapter_create(dict)
示例#12
0
def invalid_ip(): #CREATES A VADAPTER WITH PROTOCOL = ''
        try:
                vfm.py_vfm_vadapter_create({'proto' : 10})
        except StandardError ,error:
                print error
示例#13
0
def reg3():#NEED PROTOCOL VALIDATION
        try:
                vfm.py_vfm_vadapter_create({'protocol' : 10})
        except StandardError ,error:
                print error
示例#14
0
def reg2():#WORKING
        try:
                vfm.py_vfm_vadapter_create({})
        except StandardError ,error:
                print error
示例#15
0
def reg1():#WORKING
        vadapter = vfm.py_vfm_vadapter_create(vadapter_ip)
        print "vadpter created:", vadapter
        edit1(vadapter)
        result = vfm.py_vfm_vadapter_edit_general_attr({'id':vadapter['id'],'io_module_id':1, 'vfabric_id': 34})
        print "vdapter edited:", result