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
def vfabric_edit(): result = vfm.py_vfm_vfabric_edit_general_attr({ 'primary_gateway' : 123456, 'backup_gateway' : 1234, 'type' :1, 'auto_failover' : 0, 'protocol' : 2, 'id' : 3})
def vfabric_edit(): result = vfm.py_vfm_vfabric_edit_general_attr({ 'primary_gateway': 123456, 'backup_gateway': 1234, 'type': 1, 'auto_failover': 0, 'protocol': 2, 'id': 3 })
def edit1(vfabric): #WORKING try: result = vfm.py_vfm_vfabric_edit_general_attr({ 'id': 76, 'running_mode': 2, 'primary_gateway': 900, 'backup_gateway': 9, 'auto_failover': 1, 'auto_failback': 0 }) print "vfabric edited:", result except StandardError, e: print e
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
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
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
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
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
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
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
def edit4(): #ERROR IN UPDATING THE VADAPTER try: result = vfm.py_vfm_vfabric_edit_general_attr({'io_module_id': 3}) print "vfabric edited:", result except StandardError, e: print e
def edit4():#ERROR IN UPDATING THE VADAPTER try: result = vfm.py_vfm_vfabric_edit_general_attr({'io_module_id':3}) print "vfabric edited:", result except StandardError, e: print e
def edit1(vfabric):#WORKING try: result = vfm.py_vfm_vfabric_edit_general_attr({'id': 76, 'running_mode' : 2, 'primary_gateway' : 900, 'backup_gateway' : 9, 'auto_failover' : 1, 'auto_failback' : 0}) print "vfabric edited:", result except StandardError, e: print e