<commit_before>#! /usr/bin/python
import os


def make_remove_vlans(vlan_ids,add,switch_ip='192.168.3.245'):
    # Expects that you send a string which is a comma separated list of vlan_ids and a bool for adding or removing
    for vlan_id in vlan_ids.split(','):
        if add:
            cmd='''snmpset -L n -v1 -cDell_Network_Manager 192.168.3.245 \
dot1qVlanStaticName.%s s "%s" \
dot1qVlanStaticEgressPorts.%s x '00' \
dot1qVlanForbiddenEgressPorts.%s x '00' \
dot1qVlanStaticUntaggedPorts.%s x '00' \
dot1qVlanStaticRowStatus.%s i 4'''%(vlan_id,"vlan"+vlan_id,vlan_id,vlan_id,vlan_id,vlan_id)
            print cmd
            os.system(cmd)
#os.system(cmd)
        else:
           pass
def edit_ports_on_vlan(port_ids,vlan_id,add,switch_ip='192.168.3.245'):
    
    # Expects that you send a comma separated list of ports
    # A string for vlan_id
    # And a bool for adding (True = adding, False = Removing)
    x=0
    for port_id in port_ids.split(','):
        if add:
            port=int(port_id)
            x=x+2**(24-port)
        else:
            pass

    hexstr="%x"%x
    hexstr=hexstr.zfill(6)
    cmd='''snmpset -L n -v1 -cDell_Network_Manager 192.168.3.245 \
dot1qVlanStaticEgressPorts.%s x '%s' \
dot1qVlanStaticUntaggedPorts.%s x '%s' '''%(vlan_id,hexstr,vlan_id,hexstr)
    print cmd
    os.system(cmd)<commit_msg>fixed empty port_list exception<commit_after>#! /usr/bin/python
import os


def make_remove_vlans(vlan_ids,add,switch_ip='192.168.3.245'):
    # Expects that you send a string which is a comma separated list of vlan_ids and a bool for adding or removing
    for vlan_id in vlan_ids.split(','):
        if add:
            cmd='''snmpset -L n -v1 -cDell_Network_Manager 192.168.3.245 \
dot1qVlanStaticName.%s s "%s" \
dot1qVlanStaticEgressPorts.%s x '00' \
dot1qVlanForbiddenEgressPorts.%s x '00' \
dot1qVlanStaticUntaggedPorts.%s x '00' \
dot1qVlanStaticRowStatus.%s i 4'''%(vlan_id,"vlan"+vlan_id,vlan_id,vlan_id,vlan_id,vlan_id)
            print cmd
            os.system(cmd)
#os.system(cmd)
        else:
           pass
def edit_ports_on_vlan(port_ids,vlan_id,add,switch_ip='192.168.3.245'):
    
    # Expects that you send a comma separated list of ports
    # A string for vlan_id
    # And a bool for adding (True = adding, False = Removing)
    if port_ids == "":
       return
    x=0
    for port_id in port_ids.split(','):
        if add:
            port=int(port_id)
            x=x+2**(24-port)
        else:
            pass

    hexstr="%x"%x
    hexstr=hexstr.zfill(6)
    cmd='''snmpset -L n -v1 -cDell_Network_Manager 192.168.3.245 \
dot1qVlanStaticEgressPorts.%s x '%s' \
dot1qVlanStaticUntaggedPorts.%s x '%s' '''%(vlan_id,hexstr,vlan_id,hexstr)
    print cmd
    os.system(cmd)
{'fraction_non_alphanumeric': 0.1233175700254638, 'fraction_numerical': 0.044379774463441254, 'mean_word_length': 2.9398280802292263, 'pattern_counts': {'":': 1, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 8, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4641089', 'n_tokens_mistral': 1160, 'n_tokens_neox': 1068, 'n_words': 233}