Example #1
0
    sys.exit(1)

vlanToPopulate = sys.argv[len(sys.argv) - 1]

for x in range(1, len(sys.argv) - 1):
    argument = sys.argv[x]

    # make sure that there is a colon separating swich name from the community
    indexOfColon = argument.find(":")
    if indexOfColon == -1:
        print "argument " + sys.argv[
            x] + " is invalid, no colon found, bypassing..."
    else:
        switchName = argument[0:indexOfColon]
        switchCommunity = argument[indexOfColon + 1:len(argument)]
        switchType = getSwitchType(switchName, switchCommunity)

        switch = None

        # 3com switch
        if (switchType == "threecomsuperstack"):
            switch = ThreeComSuperstack(switchName, switchCommunity)

        # Extreme switch
        elif (switchType == "extremesummit"):
            switch = ExtremeSummit(switchName, switchCommunity)

        # Unknown switch
        else:
            print "unrecognized switch type for switch " + switchName + ", bypassing..."
            exit(1)
Example #2
0
from hardware.switches.threecomsuperstack import ThreeComSuperstack
from hardware.switches.extremesummit import ExtremeSummit
from auxiliary.hen import VLAN

if len(sys.argv) < 5:
    print "usage: portstatus.py [switchaddress] [community] [set|get] [portnumber] [up|down]"
    sys.exit(0)

switchAddress = sys.argv[1]
community = sys.argv[2]
operation = sys.argv[3]
port = sys.argv[4]
if (operation != "get"):
    updown = sys.argv[5]

switchType = switch.getSwitchType(switchAddress, community)
if (switchType == "threecomsuperstack"):
    switch = ThreeComSuperstack(switchAddress, community)
    if (operation == "get"):
        status = switch.getPortStatus(int(port))
        if (status == "1"):
            print "up"
        elif (status == "2"):
            print "down"
        else:
            print "testing"
    else:
        if (updown == "up"):
            switch.enablePort(int(port))
            print "enabled port " + port
        else:
Example #3
0
from hardware.switches.extremesummit import ExtremeSummit
from auxiliary.hen import VLAN


if len(sys.argv) < 5:
    print "usage: portstatus.py [switchaddress] [community] [set|get] [portnumber] [up|down]"
    sys.exit(0)

switchAddress = sys.argv[1]
community = sys.argv[2]
operation =  sys.argv[3]
port = sys.argv[4]
if (operation != "get"):
    updown = sys.argv[5]

switchType = switch.getSwitchType(switchAddress, community)
if (switchType == "threecomsuperstack"):
    switch =  ThreeComSuperstack(switchAddress, community)
    if (operation == "get"):
        status = switch.getPortStatus(int(port))
        if (status == "1"):
            print "up"
        elif (status == "2"):
            print "down"
        else:
            print "testing"
    else:
        if (updown == "up"):
            switch.enablePort(int(port))
            print "enabled port " + port
        else:
Example #4
0
    print "Usage: python populatevlan switch1:community1 [switch2:community2,  ...] vlan"
    sys.exit(1)

vlanToPopulate = sys.argv[len(sys.argv) - 1]

for x in range(1, len(sys.argv) - 1):
    argument = sys.argv[x]

    # make sure that there is a colon separating swich name from the community
    indexOfColon = argument.find(":")
    if indexOfColon == -1:
        print "argument " + sys.argv[x] + " is invalid, no colon found, bypassing..."
    else:
        switchName = argument[0:indexOfColon]
        switchCommunity = argument[indexOfColon + 1:len(argument)]
        switchType = getSwitchType(switchName, switchCommunity)

        switch = None

        # 3com switch
        if (switchType == "threecomsuperstack"):
            switch = ThreeComSuperstack(switchName, switchCommunity)

        # Extreme switch
        elif (switchType == "extremesummit"):
            switch = ExtremeSummit(switchName, switchCommunity)

        # Unknown switch
        else:
            print "unrecognized switch type for switch " + switchName + ", bypassing..."
            exit(1)