def ps_create(args):
    try:
        obj = ProtectionSystem(args.ip, args.port)

        if not common.validate_port_number(args.deviceport):
            errorMessage = "-deviceport " + str(args.deviceport) + " is not a valid port number"
            raise SOSError(SOSError.CMD_LINE_ERR, errorMessage)

        res = obj.ps_create(args.name, args.deviceip, args.deviceport, args.username, args.type, args.registration_mode)
    except SOSError as e:
        common.format_err_msg_and_raise(
            "create", "protectionsystem " + args.name + " (" + args.type + ") ", e.err_text, e.err_code
        )
def ps_update(args):
    try:
        obj = ProtectionSystem(args.ip, args.port)
        if(args.deviceport):
            if(not common.validate_port_number(args.deviceport)):
                errorMessage = "-deviceport " +  str(args.deviceport) + " is not a valid port number"
                raise SOSError(SOSError.CMD_LINE_ERR, errorMessage)
                #At least one of the arguments

        res = obj.ps_update( args.name,
	   		     args.deviceip,
                             args.deviceport,
                             args.username,
                             args.type,
                            )
    except SOSError as e:
        common.format_err_msg_and_raise("update", "protectionsystem "+ args.name +" ("+ args.type + ") ", e.err_text, e.err_code)     
예제 #3
0
def ps_create(args):
    try:
        obj = ProtectionSystem(args.ip, args.port)

        if (not common.validate_port_number(args.deviceport)):
            errorMessage = \
            "-deviceport " + str(args.deviceport) + \
            " is not a valid port number"
            raise SOSError(SOSError.CMD_LINE_ERR, errorMessage)

        res = obj.ps_create(args.name, args.deviceip, args.deviceport,
                            args.username, args.type, args.registration_mode)
    except SOSError as e:
        common.format_err_msg_and_raise(
            "create",
            "protectionsystem " + args.name + " (" + args.type + ") ",
            e.err_text, e.err_code)
예제 #4
0
def ps_update(args):
    try:
        obj = ProtectionSystem(args.ip, args.port)
        if (args.deviceport):
            if (not common.validate_port_number(args.deviceport)):
                errorMessage = "-deviceport " + \
                str(args.deviceport) + " is not a valid port number"
                raise SOSError(SOSError.CMD_LINE_ERR, errorMessage)
                # At least one of the arguments

        res = obj.ps_update(args.name, args.deviceip, args.deviceport,
                            args.username, args.type, args.clusterid,
                            args.varray_add, args.varray_remove)
    except SOSError as e:
        common.format_err_msg_and_raise(
            "update",
            "protectionsystem " + args.name + " (" + args.type + ") ",
            e.err_text, e.err_code)