Example #1
0
def _add_vfabric_database(output, argv, arg_dict, call_from, syntax=None):
    """
       [add] vfabric <vfabric-name> [<general-atts>]
       [EN <en-attrs>] | [FC <fc-attrs>]

       general-attrs: 
                      [primary_gw_id <primary_gw_id>]
                      [backup_gw_id <backup_gw_id>]
                      [protocol <protocol>]
                      [component_mask <component_mask>]

    """
    valid_list = [
        'primary_gw_id', 'backup_gw_id', 'component_mask', 'protocol'
    ]
    #print arg_dict
    arg_dict = _editing_edit_dictionary(arg_dict)
    if call_from == 'edit':
        print arg_dict
        result = vfm.py_vfm_vfabric_edit_general_attr(arg_dict)
        print "vfabric edited:", result
    elif call_from == 'add':
        vfabric = vfm.py_vfm_vfabric_create(arg_dict)
        print "vfabric created:", vfabric
    return output
Example #2
0
File: test.py Project: rajat007/vfm
def vfabric_create():
    result = vfm.py_vfm_vfabric_create({
        'protocol': 1,
        'name': "V Fabric10",
        'desc': "test",
        'type': 1
    })
Example #3
0
def _add_vfabric_fc_prop(output, argv, arg_dict, call_from):
    """
       [edit | add] vfabric <vfabric-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', '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_vfabric_fc_prop.__doc__,
                    descape=" Keyword '%s' is not an FC attribute \n" % (n, )))
            return output

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

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

    # FC-ID ?
    print arg_dict
    arg_dict = _editing_edit_dictionary(arg_dict)
    if call_from == 'edit':
        result = vfm.py_vfm_vfabric_edit_general_attr(arg_dict)
        print "vfabric edited:", result
    elif call_from == 'add':
        vfabric = vfm.py_vfm_vfabric_create(arg_dict)
        print "vfabric created:", vfabric
    return output
Example #4
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 
Example #5
0
def _add_vfabric_en_prop(output, argv, arg_dict, call_from):
    """
       [edit | add ] vfabric <vfabric-name> [<general-atts>]
       [EN <en-attrs>] | [FC <fc-attrs>]

       en-attrs:      [mac <mac-addr>]
                      [vlan <vlan-value>]
    """
    _NON_EN_PROP = ['wwnn', 'wwpn', 'fcid']
    # 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_vfabric_en_prop.__doc__,
                    descape=" Keyword '%s' is not an EN attribute" % (n, )))
            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':
        result = vfm.py_vfm_vfabric_edit_general_attr(arg_dict)
        print "vfabric edited:", result
    elif call_from == 'add':
        vfabric = vfm.py_vfm_vfabric_create(arg_dict)
        print "vfabric created:", vfabric

    return output
Example #6
0
def _add_vfabric_fc_prop(output, argv, arg_dict, call_from):
    """
       [edit | add] vfabric <vfabric-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','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_vfabric_fc_prop.__doc__,
                                           descape = " Keyword '%s' is not an FC attribute \n" % (n,)))
                    return output

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

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

    # FC-ID ?
    print arg_dict
    arg_dict = _editing_edit_dictionary(arg_dict)
    if call_from == 'edit':
        result = vfm.py_vfm_vfabric_edit_general_attr(arg_dict)
        print "vfabric edited:", result
    elif call_from == 'add':
        vfabric = vfm.py_vfm_vfabric_create(arg_dict)
        print "vfabric created:", vfabric
    return output
Example #7
0
def _add_vfabric_database(output, argv, arg_dict,call_from, syntax = None):
    """
       [add] vfabric <vfabric-name> [<general-atts>]
       [EN <en-attrs>] | [FC <fc-attrs>]

       general-attrs: 
                      [primary_gw_id <primary_gw_id>]
                      [backup_gw_id <backup_gw_id>]
                      [protocol <protocol>]
                      [component_mask <component_mask>]

    """
    valid_list = ['primary_gw_id','backup_gw_id','component_mask', 'protocol']
    #print arg_dict
    arg_dict = _editing_edit_dictionary(arg_dict)
    if call_from == 'edit':
        print arg_dict
        result = vfm.py_vfm_vfabric_edit_general_attr(arg_dict)
        print "vfabric edited:", result
    elif call_from == 'add':
        vfabric = vfm.py_vfm_vfabric_create(arg_dict)
        print "vfabric created:", vfabric
    return output
Example #8
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
Example #9
0
def _add_vfabric_en_prop(output, argv, arg_dict, call_from):
    """
       [edit | add ] vfabric <vfabric-name> [<general-atts>]
       [EN <en-attrs>] | [FC <fc-attrs>]

       en-attrs:      [mac <mac-addr>]
                      [vlan <vlan-value>]
    """
    _NON_EN_PROP = [ 'wwnn','wwpn','fcid']
    # 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_vfabric_en_prop.__doc__,
                                           descape = " Keyword '%s' is not an EN attribute" % (n,)))
                    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':
        result = vfm.py_vfm_vfabric_edit_general_attr(arg_dict)
        print "vfabric edited:", result
    elif call_from == 'add':
        vfabric = vfm.py_vfm_vfabric_create(arg_dict)
        print "vfabric created:", vfabric

    return output
Example #10
0
def invalid_ip():  #CREATES A VADAPTER WITH PROTOCOL = ''
    try:
        vfm.py_vfm_vfabric_create({'proto': 10})
    except StandardError, error:
        print error
Example #11
0
def reg3():  #NEED PROTOCOL VALIDATION
    try:
        vfm.py_vfm_vfabric_create({'protocol': 10})
    except StandardError, error:
        print error
Example #12
0
def reg2():  #WORKING
    try:
        vfm.py_vfm_vfabric_create({})
    except StandardError, error:
        print error
Example #13
0
def reg2():#WORKING
        try:
                vfm.py_vfm_vfabric_create({})
        except StandardError ,error:
                print error
Example #14
0
def vfabric_create():
        result = vfm.py_vfm_vfabric_create({'protocol' : 1,
                                                'name' : "V Fabric10",
                                                'desc' : "test",
                                                'type' : 1})
Example #15
0
def invalid_ip(): #CREATES A VADAPTER WITH PROTOCOL = ''
        try:
                vfm.py_vfm_vfabric_create({'proto' : 10})
        except StandardError ,error:
                print error
Example #16
0
def reg3():#NEED PROTOCOL VALIDATION
        try:
                vfm.py_vfm_vfabric_create({'protocol' : 10})
        except StandardError ,error:
                print error
Example #17
0
def reg1():  #WORKING
    vfabric = vfm.py_vfm_vfabric_create(vfabric_ip)
    print "vadpter created:", vfabric
    edit1(vfabric)
Example #18
0
def reg1():#WORKING
        vfabric = vfm.py_vfm_vfabric_create(vfabric_ip)
        print "vadpter created:", vfabric
        edit1(vfabric)