def log_mgr_srv_addr_del(req_data): """ TBD """ _err_reason = [ '', # err_code: 0 'bad request', # err_code: 1 'cannot remove vlan 1', # err_code: 2 'excute error', # err_code: 3 ] obj = {'error': False, 'err_code': 0, 'err_reason': ''} ipaddr = str(req_data.get('serveraddr')) vrf = str(req_data.get('vrf')) if vrf == 'default': cmd_del_ns = 'cdbctl delete/cdb/sys/ns_route/1#514#%s/inband/' % ipaddr cmd_del_srv = 'cdbctl delete/cdb/app/syslog_cfg/server_addr/0/%s' % ipaddr else: cmd_del_ns = 'cdbctl delete/cdb/sys/ns_route/1#514#%s/outband/' % ipaddr cmd_del_srv = 'cdbctl delete/cdb/app/syslog_cfg/server_addr/64/%s' % ipaddr status, lines = vcmd.get_status_lines(cmd_del_srv) if status != 0: obj['error'] = True obj['err_code'] = 1 obj['err_reason'] = _err_reason[1] return obj vcmd.get_status_lines(cmd_del_ns) return obj
def radius_server_del(req_data): """ TBD """ _err_reason = [ '', # err_code: 0 'bad request', # err_code: 1 'cmd excute error', # err_code: 2 ] obj = {'error': False, 'err_code': 0, 'err_reason': ''} host = str(req_data.get('host')) vrf = str(req_data.get('inband')) if vrf == "mgmt": NS_BAND = "outband" else: NS_BAND = "inband" print host cmd = 'cdbctl delete/cdb/l2/dot1x_radius/key/%s/%s/1812' % (host, NS_BAND) status, lines = vcmd.get_status_lines(cmd) if status != 0: obj['error'] = True obj['err_code'] = 2 obj['err_reason'] = '; '.join(lines) return obj cmd = 'cdbctl delete/cdb/sys/ns_route/1#1812#%s/%s/' % (host, NS_BAND) vcmd.get_status_lines(cmd) return obj
def ipv4_port_ip_address_set(iface, ipaddr, mask, enable, secondary): """ API: Return: { error: bool, err_code: int, err_reason: string } """ _err_reason = [ '', # err_code: 0 'bad request param', # err_code: 1 'cannot set interface', # err_code: 2 ] obj = {'error': False, 'err_code': 0, 'err_reason': ''} iface = str(iface) ipaddr = str(ipaddr) mask = str(mask) enable = str(enable) secondary = str(secondary) flag_secondary = "1" if secondary == "Secondary" or secondary == "1" else '' cmd = 'cdbctl update/cdb/l3/route_if/%s/ifc_ipv4/add/%s/%s/%s' % ( iface, ipaddr, mask, flag_secondary) if enable == "Add": status, lines = vcmd.get_status_lines( 'cdbctl update/cdb/l3/route_if/%s/ifc_ipv4/add/%s/%s/%s' % (iface, ipaddr, mask, flag_secondary)) if status != 0: obj['error'] = True obj['err_code'] = 2 obj['err_reason'] = '; '.join(lines) else: if flag_secondary: status, lines = vcmd.get_status_lines( 'cdbctl update/cdb/l3/route_if/%s/ifc_ipv4/del/%s/%s/%s' % (iface, ipaddr, mask, flag_secondary)) if status != 0: obj['error'] = True obj['err_code'] = 2 obj['err_reason'] = '; '.join(lines) else: status, lines = vcmd.get_status_lines( 'cdbctl update/cdb/l3/route_if/%s/ifc_ipv4/del/%s/%s' % (iface, ipaddr, mask)) if status != 0: obj['error'] = True obj['err_code'] = 2 obj['err_reason'] = '; '.join(lines) return obj
def delete_all(): """ API: Retrun: { error: bool, err_code: int, err_reason: string } """ _err_reason = [ '', # err_code: 0 'request is empty', # err_code: 1 'bad request', # err_code: 2 'cmd excute error', # err_code: 3 ] obj = {'error': False, 'err_code': 0, 'err_reason': ''} # exec delete cmd_static = 'cdbctl update/cdb/action/l2_action/flush_fdb/fdb/static' cmd_dynamic = 'cdbctl update/cdb/action/l2_action/flush_fdb/fdb/dynamic' # delete directly, dont need to care any result status, lines = vcmd.get_status_lines(cmd_static) status, lines = vcmd.get_status_lines(cmd_dynamic) return obj
def radius_server_add(req_data): """ TBD """ _err_reason = [ '', # err_code: 0 'bad request', # err_code: 1 'cmd excute error', # err_code: 2 ] obj = {'error': False, 'err_code': 0, 'err_reason': ''} host = str(req_data.get('host')) vrf = str(req_data.get('inband')) key = str(req_data.get('key')) enable = str(req_data.get('KeyEn')) if vrf == "mgmt": NS_BAND = "outband" else: NS_BAND = "inband" if False == os.path.isfile('/switch/etc/cmd/tap_group.xml'): cmd = 'cdbctl update/cdb/l3/check_mgmt_if_ip/%s' % (host) # excute status, lines = vcmd.get_status_lines(cmd) if status != 0: obj['error'] = True obj['err_code'] = 2 obj['err_reason'] = '; '.join(lines) return obj cmd = 'cdbctl create/cdb/sys/ns_route/1#1812#%s/7/%s/' % (host, NS_BAND) status, lines = vcmd.get_status_lines(cmd) if status != 0: obj['error'] = True obj['err_code'] = 2 obj['err_reason'] = '; '.join(lines) return obj if enable == "True": cmd = 'cdbctl create/cdb/l2/dot1x_radius/key/%s/1812/shared_secret/"%s"/max_retry/0/timeout/0/is_inband/%s/' % ( host, key, NS_BAND) else: cmd = 'cdbctl create/cdb/l2/dot1x_radius/key/%s/1812/shared_secret//max_retry/0/timeout/0/is_inband/%s/' % ( host, NS_BAND) status, lines = vcmd.get_status_lines(cmd) if status != 0: obj['error'] = True obj['err_code'] = 2 obj['err_reason'] = '; '.join(lines) return obj return obj
def dot1x_port_control_set(port_name, ctl_state): """ API: PUT: /<port_name>/<ctl_state>/ Retrun: { error: bool, err_code: int, err_reason: string } """ _err_reason = [ '', # err_code: 0 'bad request', # err_code: 1 'cmd excute error', # err_code: 2 ] obj = {'error': False, 'err_code': 0, 'err_reason': ''} # param check name = str(port_name) state = str(ctl_state) if state == "1" or state == "Auto": stat_value = "auto" elif state == "2" or state == "Force-unauthorized": stat_value = "force-unauthorized" elif state == "3" or state == "Force-authorized": stat_value = "force-authorized" elif state == "Disable": stat_value = "Disable" if stat_value == "Disable": # excute status, lines = vcmd.get_status_lines('cdbctl delete/cdb/l2/dot1x_port/%s' % (name)) if status != 0: obj['error'] = True obj['err_code'] = 2 obj['err_reason'] = '; '.join(lines) return obj else: # excute status, lines = vcmd.get_status_lines('cdbctl create/cdb/l2/dot1x_port/%s/authControlledPortControl/%s' % (name, stat_value)) if status != 0: obj['error'] = True obj['err_code'] = 2 obj['err_reason'] = '; '.join(lines) return obj return obj
def upload_image(fil): """ API PUSH: Retrun: { error: bool, err_code: int, err_reason: string } """ _err_reason = [ '', # err_code: 0 'bad request', # err_code: 1 '', # err_code: 2, file already exists 'IO Error', # err_code: 3 ] obj = {'error': False, 'err_code': 0, 'err_reason': ''} if not fil: obj['error'] = True obj['err_code'] = 1 obj['err_reason'] = _err_reason[1] return obj file_path = '/mnt/flash/boot/' + secure_filename(fil.filename) # check exists # if os.path.exists(file_path): # obj['error'] = True # obj['err_code'] = 2 # obj['err_reason'] = 'file "%s" already exists, please rename the image and reupload' % file_path # return obj # save file try: #1. unlock protect for ../boot path status, lines = vcmd.get_status_lines( 'mount -t ubifs -o remount -rw ubi1:boot /mnt/flash/boot/') fil.save(file_path) #2. restore protect for ../boot path status, lines = vcmd.get_status_lines( 'mount -t ubifs -o remount -r ubi1:boot /mnt/flash/boot/') except IOError: obj['error'] = True obj['err_code'] = 3 obj['err_reason'] = _err_reason[3] return obj return obj
def log_mgr_update_status(req_data): """ TBD """ _err_reason = [ '', # err_code: 0 'bad request', # err_code: 1 'cannot remove vlan 1', # err_code: 2 'excute error', # err_code: 3 ] obj = {'error': False, 'err_code': 0, 'err_reason': ''} type = str(req_data.get('type')) enable = str(req_data.get('status')) if type == 'server': status, lines = vcmd.get_status_lines( 'cdbctl update/cdb/app/syslog_cfg/enable_to_server/%s' % enable) # param check if status != 0: obj['error'] = True obj['err_code'] = 1 obj['err_reason'] = _err_reason[1] return obj if type == 'cache': status, lines = vcmd.get_status_lines( 'cdbctl update/cdb/app/syslog_cfg/enable_to_file/%s' % enable) # param check if status != 0: obj['error'] = True obj['err_code'] = 1 obj['err_reason'] = _err_reason[1] return obj if type == 'merge': status, lines = vcmd.get_status_lines( 'cdbctl update/cdb/app/syslog_cfg/enable_merge/%s' % enable) # param check if status != 0: obj['error'] = True obj['err_code'] = 1 obj['err_reason'] = _err_reason[1] return obj return obj
def load_balance_tunnel_hash_set(hashmode): """ TBD """ _err_reason = [ '', # err_code: 0 'bad request param', # err_code: 1 ] obj = {'error': False, 'err_code': 0, 'err_reason': ''} vcmd.get_status_lines( 'cdbctl update/cdb/sys/lag_global/load_balance_inner_field_en/inner_field_en/%s' % str(hashmode)) return obj
def snmp_target_addr_del(req_data): """ TBD """ _err_reason = [ '', # err_code: 0 'bad request param', # err_code: 1 'cannot set interface', # err_code: 2 ] obj = {'error': False, 'err_code': 0, 'err_reason': ''} ipaddr = str(req_data.get('trapaddr')) commu = str(req_data.get('community')) addr = str(req_data.get('vrf')) if addr == "mgmt": NS_BAND = "outband" else: NS_BAND = "inband" cmd = 'cdbctl delete/cdb/app/snmp_trap/%s/%s/162/%s' % (ipaddr, commu, NS_BAND) status, lines = vcmd.get_status_lines(cmd) if status != 0: obj['error'] = True obj['err_code'] = 1 obj['err_reason'] = _err_reason[1] return obj cmd = 'cdbctl delete/cdb/sys/ns_route/1#162#%s/%s' % (ipaddr, NS_BAND) status, lines = vcmd.get_status_lines(cmd) if status != 0: obj['error'] = True obj['err_code'] = 1 obj['err_reason'] = _err_reason[1] return obj cmd = 'cdbctl delete/cdb/sys/inband_snat/1#162#%s' % (ipaddr) status, lines = vcmd.get_status_lines(cmd) if status != 0: obj['error'] = True obj['err_code'] = 1 obj['err_reason'] = _err_reason[1] return obj return obj
def tap_timestamp_set(req_data): """ TBD """ _err_reason = [ '', # err_code: 0 'cmd excute error', # err_code: 1 ] obj = {'arr': [], 'error': False, 'err_code': 0, 'err_reason': ''} StampEn = str(req_data.get('timeStampEn')) macDa = str(req_data.get('macDa')) macSa = str(req_data.get('macSa')) etherType = str(req_data.get('etherType')) if StampEn == "True": cmd = 'cdbctl update/cdb/sys/sys_global/tap_ts_macda/%s/%s/%s' % ( macDa, macSa, etherType) else: cmd = 'cdbctl update/cdb/sys/sys_global/tap_ts_macda/0.0.0/0.0.0/0' status, lines = vcmd.get_status_lines(cmd) if status != 0: obj['error'] = True obj['err_code'] = 1 obj['err_reason'] = ' '.join(lines) return obj return obj
def tap_description_set(req_data): """ TBD """ _err_reason = [ '', # err_code: 0 'cmd excute error', # err_code: 1 ] obj = {'arr': [], 'error': False, 'err_code': 0, 'err_reason': ''} group_name = str(req_data.get('group_name')) description = str(req_data.get('description')) if len(description): cmd = 'cdbctl update/cdb/tap/tap_group/%s/desc/1/%s' % (group_name, description) else: cmd = 'cdbctl update/cdb/tap/tap_group/%s/desc/0' % (group_name) status, lines = vcmd.get_status_lines(cmd) if status != 0: obj['error'] = True obj['err_code'] = 1 obj['err_reason'] = ' '.join(lines) return obj return obj
def tap_group_table_add(req_data): """ TBD """ _err_reason = [ '', # err_code: 0 'cmd excute error', # err_code: 1 ] obj = {'arr': [], 'error': False, 'err_code': 0, 'err_reason': ''} group_name = str(req_data.get('group_name')) group_id = str(req_data.get('group_id')) if len(group_name) == 0: return obj cmd = 'cdbctl create/cdb/tap/tap_group/%s' % (group_name) if group_id.isdigit(): cmd = cmd + '/%s' % (group_id) else: cmd = cmd + '/-1' status, lines = vcmd.get_status_lines(cmd) if status != 0: obj['error'] = True obj['err_code'] = 1 obj['err_reason'] = ' '.join(lines) return obj return obj
def snmp_community_del(req_data): """ TBD """ _err_reason = [ '', # err_code: 0 'bad request param', # err_code: 1 'cannot set interface', # err_code: 2 ] obj = {'error': False, 'err_code': 0, 'err_reason': ''} name = str(req_data.get('key')) access = str(req_data.get('type')) cmd = 'cdbctl delete/cdb/app/snmp_community/%s' % (name) status, lines = vcmd.get_status_lines(cmd) if status != 0: obj['error'] = True obj['err_code'] = 1 obj['err_reason'] = _err_reason[1] return obj return obj
def dhcp_del_snoop_vlan(vlan_str): """ API: PUT: /<int:vid>/ Retrun: { error: bool, err_code: int, err_reason: string } """ _err_reason = [ '', # err_code: 0 'bad request', # err_code: 1 'cmd excute error', # err_code: 2 ] obj = {'error': False, 'err_code': 0, 'err_reason': ''} # param check # excute status, lines = vcmd.get_status_lines( 'cdbctl delete/cdb/dhcp/dhcsnooping/vlans/%s' % vlan_str) if status != 0: obj['error'] = True obj['err_code'] = 2 obj['err_reason'] = '; '.join(lines) return obj return obj
def flow_entry_del(req_data): """ TBD """ _err_reason = [ '', # err_code: 0 'entry is null', # err_code: 1 ] obj = {'entry_arr': [], 'error': False, 'err_code': 0, 'err_reason': ''} entry = str(req_data.get('entry')) table = str(req_data.get('table')) flow_type = str(req_data.get('type')) temp = entry.split() if flow_type == "flow": cmd = 'cdbctl delete/cdb/l2/ace_config/%s/%s/snmp_set//type/flow' % ( table, temp[1]) elif flow_type == "flow_match": cmd = 'cdbctl delete/cdb/l2/ace_config/%s/%s/snmp_set//type/flow_match' % ( table, temp[1]) else: cmd = 'cdbctl delete/cdb/l2/ace_config/%s/%s/snmp_set//' % (table, temp[1]) status, lines = vcmd.get_status_lines(cmd) if status != 0: obj['error'] = True obj['err_code'] = 1 obj['err_reason'] = ' '.join(lines) return obj return obj
def snmp_usm_user_set(req_data): """ TBD """ _err_reason = [ '', # err_code: 0 'bad request param', # err_code: 1 'cannot set interface', # err_code: 2 ] obj = {'error': False, 'err_code': 0, 'err_reason': ''} usmuser = str(req_data.get('usmuser')) authensel = str(req_data.get('authensel')) authen = str(req_data.get('authen')) encrypsel = str(req_data.get('encrypsel')) encry = str(req_data.get('encry')) cmd = 'cdbctl create/cdb/app/snmp_usm_user/%s/remote//authentication/%s/auth_pwd//"%s"/privacy/%s/pri_pwd//"%s"/' % ( usmuser, authensel, authen, encrypsel, encry) print cmd status, lines = vcmd.get_status_lines(cmd) if status != 0: obj['error'] = True obj['err_code'] = 1 obj['err_reason'] = _err_reason[1] return obj return obj
def snmp_context_del(req_data): """ TBD """ _err_reason = [ '', # err_code: 0 'bad request param', # err_code: 1 'cannot set interface', # err_code: 2 ] obj = {'error': False, 'err_code': 0, 'err_reason': ''} contnama = str(req_data.get('context')) cmd = 'cdbctl delete/cdb/app/snmp_context/%s' % (contnama) status, lines = vcmd.get_status_lines(cmd) if status != 0: obj['error'] = True obj['err_code'] = 1 obj['err_reason'] = _err_reason[1] return obj return obj
def clear(): """ API: CLAER: Return: { error: bool, err_code: int, err_reason: string } """ _err_reason = [ '', # err_code: 0 'arp cache clear failed', # err_code: 1 ] obj = {'error': False, 'err_code': 0, 'err_reason': ''} status, lines = vcmd.get_status_lines('cdbctl update/cdb/l3/flush_arp') vcmd.execute('sleep 1') if status != 0: obj['error'] = True obj['err_code'] = status obj['err_reason'] = _err_reason[1] return obj return obj
def load_balance_set_hash_mpls_enable(mpls_enable): _err_reason = [ '', # err_code: 0 'bad request', # err_code: 1 'cmd excute error', # err_code: 2 'group is not exist', # err_code: 3 ] obj = {'error': False, 'err_code': 0, 'err_reason': ''} # obj['error'] = True # obj['err_code'] = 1 # obj['err_reason'] = _err_reason[1] if mpls_enable == "true": cmd = "cdbctl update/cdb/l2/hash_field_profile/port-channel/bitmap_disable/mpls/1" else: cmd = "cdbctl update/cdb/l2/hash_field_profile/port-channel/bitmap_disable/mpls/0" status, lines = vcmd.get_status_lines(cmd) if status != 0: obj['error'] = True obj['err_code'] = 2 obj['err_reason'] = '; '.join(lines) return obj return obj
def flow_table_del(req_data): """ TBD """ _err_reason = [ '', # err_code: 0 'cmd excute error', # err_code: 1 ] obj = {'arr': [], 'error': False, 'err_code': 0, 'err_reason': ''} flow_name = str(req_data.get('name')) flow_type = str(req_data.get('type')) if flow_type == 'flow': cmd = 'cdbctl delete/cdb/l2/acl_config/%s/type/flow' % (flow_name) elif flow_type == 'flow_match': cmd = 'cdbctl delete/cdb/l2/acl_config/%s/type/flow_match' % ( flow_name) else: cmd = 'cdbctl delete/cdb/l2/acl_config/%s' % (flow_name) status, lines = vcmd.get_status_lines(cmd) if status != 0: obj['error'] = True obj['err_code'] = 1 obj['err_reason'] = ' '.join(lines) return obj return obj
def tap_truncation_set(req_data): """ TBD """ _err_reason = [ '', # err_code: 0 'cmd excute error', # err_code: 1 ] obj = {'arr': [], 'error': False, 'err_code': 0, 'err_reason': ''} enable = str(req_data.get('truncationEn')) length = str(req_data.get('length')) if enable == "True": cmd = 'cdbctl update/cdb/sys/sys_global/trunction_length/%s' % length else: cmd = 'cdbctl update/cdb/sys/sys_global/trunction_length/0' status, lines = vcmd.get_status_lines(cmd) if status != 0: obj['error'] = True obj['err_code'] = 1 obj['err_reason'] = ' '.join(lines) return obj return obj
def del_token(self, obj): """ DELETE { token: string, } Retrun { error: bool, err_code: int, err_reason: string, } """ _err_reason = [ '', # err_code: 0 'bad request', # err_code: 1 'invalid token', # err_code: 2 ] ret_obj = {'error': False, 'err_code': 0, 'err_reason': ''} #param check token = obj.get('token') if token == None: ret_obj['error'] = True ret_obj['err_code'] = 1 ret_obj['err_reason'] = _err_reason[1] return ret_obj # delete web session exec_str = 'cdbctl delete/cdb/app/login/%s' % (str(token)) status, output = vcmd.get_status_lines(exec_str) return ret_obj
def log_mgr_update_buffer_size(req_data): """ TBD """ _err_reason = [ '', # err_code: 0 'bad request', # err_code: 1 'cannot remove vlan 1', # err_code: 2 'excute error', # err_code: 3 ] obj = {'error': False, 'err_code': 0, 'err_reason': ''} size = str(req_data.get('size')) status, lines = vcmd.get_status_lines( 'cdbctl update/cdb/app/syslog_cfg/logging_lines/%s' % size) if status != 0: obj['error'] = True obj['err_code'] = 1 obj['err_reason'] = _err_reason[1] return obj return obj
def set_port_status(if_key, status): """ Param: if_key: eth-x-x status: True - no shutdown, False: shutdown Retrun: { error: bool, err_code: int, err_reason: string } """ _err_reason = [ '', # err_code: 0 'cmd excute error', # err_code: 1 ] obj = {'arr': [], 'error': False, 'err_code': 0, 'err_reason': ''} cmd = 'cdbctl update/cdb/interface/%s/up/%d' % (if_key, 1 if status else 0) status, lines = vcmd.get_status_lines(cmd) if status != 0: obj['error'] = True obj['err_code'] = 1 obj['err_reason'] = ' '.join(lines) return obj return obj
def clock_current_time_set(req_data): """ TBD """ _err_reason = [ '', # err_code: 0 'Set Time Form Error', # err_code: 1 ] obj = {'arr': [], 'error': False, 'err_code': 0, 'err_reason': ''} year = str(req_data.get('Year')) month = str(req_data.get('Month')) day = str(req_data.get('Day')) hour = str(req_data.get('Hour')) minute = str(req_data.get('Minute')) second = str(req_data.get('Second')) time = hour + ":" + minute + ":" + second status, cfg = vcmd.get_status_lines( 'cdbctl update/cdb/sys/clock/%s/%s/%s/%s' % (time, day, month, year)) if status != 0: obj['error'] = True obj['err_code'] = 3 obj['err_reason'] = _err_reason[1] return obj return obj
def snmp_community_set(req_data): """ TBD """ _err_reason = [ '', # err_code: 0 'Community Configuration repeat', # err_code: 1 'cannot set interface', # err_code: 2 ] obj = {'error': False, 'err_code': 0, 'err_reason': ''} name = str(req_data.get('name')) access = str(req_data.get('access')) cmd = 'cdbctl create/cdb/app/snmp_community/%s/type/%s' % (name, access) status, lines = vcmd.get_status_lines(cmd) if status != 0: obj['error'] = True obj['err_code'] = 1 obj['err_reason'] = _err_reason[1] return obj return obj
def get(): _err_reason = [ '', # err_code: 0 'interface statistic is not exist', # err_code: 1 ] obj = { 'if_statistic_arr': [], 'error': False, 'err_code': 0, 'err_reason': '' } status, lines = vcmd.get_status_lines('cdbctl show/cdb/interface/status') if status != 0: obj['error'] = True obj['err_code'] = 1 obj['err_reason'] = _err_reason[1] return obj for i in lines: tmp = {} prt = i.split(' ', 1) if (prt[0][0:4] == 'eth-' or prt[0][0:3] == 'agg'): tmp['full_name'] = prt[0] flag = flow_config_en(prt[0]) tmp['flow_flag'] = flag obj['if_statistic_arr'].append(tmp) return obj
def snmp_notify_set(req_data): """ TBD """ _err_reason = [ '', # err_code: 0 'bad request param', # err_code: 1 'cannot set interface', # err_code: 2 ] obj = {'error': False, 'err_code': 0, 'err_reason': ''} notiname = str(req_data.get('notiname')) tagname = str(req_data.get('tagname')) notitype = str(req_data.get('notitype')) cmd = 'cdbctl create/cdb/app/snmp_notify/%s/tag/%s/%s/' % ( notiname, tagname, notitype) print cmd status, lines = vcmd.get_status_lines(cmd) if status != 0: obj['error'] = True obj['err_code'] = 1 obj['err_reason'] = _err_reason[1] return obj return obj
def snmp_target_params_set(req_data): """ TBD """ _err_reason = [ '', # err_code: 0 'bad request param', # err_code: 1 'cannot set interface', # err_code: 2 ] obj = {'error': False, 'err_code': 0, 'err_reason': ''} params = str(req_data.get('params')) username = str(req_data.get('username')) paramsel = str(req_data.get('paramsel')) cmd = 'cdbctl create/cdb/app/snmp_target_params/%s/user/%s/%s/' % ( params, username, paramsel) status, lines = vcmd.get_status_lines(cmd) if status != 0: obj['error'] = True obj['err_code'] = 1 obj['err_reason'] = _err_reason[1] return obj return obj