Exemplo n.º 1
0
    def post(self):
        parse = reqparse.RequestParser()
        parse.add_argument('ip', type=str, help='错误的ip', default='192.168.5.1')
        parse.add_argument('username',
                           type=str,
                           help='错误的username',
                           default='root')
        parse.add_argument('password',
                           type=str,
                           help='错误的password',
                           default='123456')
        args = parse.parse_args()
        # 从前端请求中解析参数
        ip = args.get('ip')
        username = args.get('username')
        password = args.get('password')

        # 这里调用(操作/验证)脚本
        # 将Router fa0/0划分为两个子接口
        excute(ip, username, password, './scripts/Router.txt')
        # 以下为实例代码
        token = 'opearte step 7 : telnet complete:divide Router fa0/0'
        response = make_response(
            jsonify(code=0, data={'token': token}, message='OK'))
        return response
Exemplo n.º 2
0
    def post(self):
        parse = reqparse.RequestParser()
        parse.add_argument('ip', type=str, help='错误的ip', default='192.168.5.5')
        parse.add_argument('username',
                           type=str,
                           help='错误的username',
                           default='root')
        parse.add_argument('password',
                           type=str,
                           help='错误的password',
                           default='123456')
        args = parse.parse_args()
        # 获取当前文件夹id
        ip = args.get('ip')
        username = args.get('username')
        password = args.get('password')

        # 这里调用(操作/验证)脚本

        # 配置Switch1划分VLAN10和VLAN20

        excute(ip, username, password, './scripts/Split_Vlan.txt')

        # 以下为实例代码
        token = 'opearte step 5 : telnet complete:configurate Switch1 divide as VLAN10 and VLAN20'
        response = make_response(
            jsonify(code=0, data={'token': token}, message='OK'))
        return response
Exemplo n.º 3
0
def VlanAPI():
    parse = reqparse.RequestParser()
    parse.add_argument('ip', type=str, help='错误的ip', default='192.168.5.5')
    parse.add_argument('username',
                       type=str,
                       help='错误的username',
                       default='root')
    parse.add_argument('password',
                       type=str,
                       help='错误的password',
                       default='123456')
    args = parse.parse_args()
    # 获取当前文件夹id
    Switch_ip = args.get('ip')
    username = args.get('username')
    Switch_password = args.get('password')

    # 这里调用(操作/验证)脚本

    # 配置Switch1划分VLAN10和VLAN20

    excute(Switch_ip, username, Switch_password, './scripts/Split_Vlan.txt',
           socketio)
    data = {}
    ret = ReturnJ()
    ret.data = data
    return ret.toJson()
Exemplo n.º 4
0
def DivideAPI():

    parse = reqparse.RequestParser()
    parse.add_argument('ip', type=str, help='错误的ip', default='192.168.5.1')
    parse.add_argument('username',
                       type=str,
                       help='错误的username',
                       default='root')
    parse.add_argument('password',
                       type=str,
                       help='错误的password',
                       default='123456')
    args = parse.parse_args()
    # 从前端请求中解析参数
    Router_ip = args.get('ip')
    username = args.get('username')
    Router_password = args.get('password')

    # 这里调用(操作/验证)脚本
    # 将Router fa0/0划分为两个子接口
    excute(Router_ip, username, Router_password, './scripts/Router.txt',
           socketio)
    data = {}
    ret = ReturnJ()
    ret.data = data
    return ret.toJson()
Exemplo n.º 5
0
def TrunkAPI():
    excute(Switch_ip, username, Switch_password, './scripts/Trunk.txt',
           socketio)
    data = {}
    ret = ReturnJ()
    ret.data = data
    return ret.toJson()
Exemplo n.º 6
0
def TrunkAPI():
    flag, message = excute(Switch_ip, username, Switch_password,
                           './scripts/Trunk.txt', socketio)
    data = {}
    ret = ReturnJ()
    ret.data = data
    ret.flag = flag
    ret.message = message
    return ret.toJson()