示例#1
0
int
main(int argc, char *argv[])
{
    char opt;
    int ret, option_index;

    while (((opt = getopt_long(argc, argv, "",
                        long_options, &option_index)) >= 0)) {
        switch (opt) {
        case 0:
            break;

        default:
            Usage();
        }
    }

    cl = vr_get_nl_client(VR_NETLINK_PROTO_DEFAULT);
    if (!cl) {
        exit(1);
    }

    vr_get_mem_stats(cl);

    return 0;
}
示例#2
0
int
main(int argc, char *argv[])
{
    int ret, opt, option_index;
    vrouter_ops req;

    parse_ini_file();
    platform = get_platform();

    if (argc == 1) {
        Usage();
    }

    while ((opt = getopt_long(argc, argv, "",
                    long_options, &option_index)) >= 0) {
        switch (opt) {
        case 0:
            parse_long_opts(option_index, optarg);
            break;

        case '?':
        default:
            Usage();
            break;
        }
    }


    validate_options();

    cl = vr_get_nl_client(VR_NETLINK_PROTO_DEFAULT);
    if (!cl) {
        exit(1);
    }

    vr_vrouter_op(cl);

    return 0;
}
示例#3
0
int main(int argc, char *argv[])
{
    int ret, opt, option_index;

    while ((opt = getopt_long(argc, argv, "bcdgn:l:",
                    long_options, &option_index)) >= 0) {
            switch (opt) {
            case 'c':
                if (vxlan_op >= 0)
                    Usage();

                vxlan_op = SANDESH_OP_ADD;
                create_set = 1;
                break;

            case 'd':
                if (vxlan_op >= 0)
                    Usage();

                vxlan_op = SANDESH_OP_DELETE;
                delete_set = 1;
                break;

            case 'g':
                if (vxlan_op >= 0)
                    Usage();

                vxlan_op = SANDESH_OP_GET;
                get_set = 1;
                break;

            case 'b':
                if (vxlan_op >= 0)
                    Usage();

                vxlan_op = SANDESH_OP_DUMP;
                dump_set = 1;
                break;

            case 'n':
                vxlan_nh = atoi(optarg);
                nh_set = 1;
                break;

            case 'l':
                vxlan_vnid = strtoul(optarg, NULL, 10);
                vnid_set = 1;
                break;

            case 0:
                parse_long_opts(option_index, optarg);
                break;

            case '?':
            default:
                Usage();
        }
    }

    validate_options();

    if ((vxlan_op == SANDESH_OP_DUMP) ||
            (vxlan_op == SANDESH_OP_GET)) {
        printf("VXLAN Table\n\n");
        printf(" VNID    NextHop\n");
        printf("----------------\n");
    }

    cl = vr_get_nl_client(VR_NETLINK_PROTO_DEFAULT);
    if (!cl) {
        exit(1);
    }

    vr_vxlan_op(cl);

    return 0;
}
示例#4
0
int main(int argc, char *argv[])
{
    int ret, opt, option_index;

    mirror_fill_nl_callbacks();

    while ((opt = getopt_long(argc, argv, "bcdgn:m:",
                    long_options, &option_index)) >= 0) {
            switch (opt) {
            case 'c':
                if (mirror_op >= 0)
                    Usage();

                create_set = 1;
                mirror_op = SANDESH_OP_ADD;
                break;

            case 'd':
                if (mirror_op >= 0)
                    Usage();

                delete_set = 1;
                mirror_op = SANDESH_OP_DEL;
                break;

            case 'g':
                if (mirror_op >= 0)
                    Usage();

                get_set = 1;
                mirror_op = SANDESH_OP_GET;
                break;

            case 'b':
                if (mirror_op >= 0)
                    Usage();

                dump_set = 1;
                mirror_op = SANDESH_OP_DUMP;
                break;

            case 'n':
                mirror_nh = atoi(optarg);
                nh_set = 1;
                break;

            case 'm':
                mirror_index = atoi(optarg);
                mirror_set = 1;
                break;

            case 0:
                parse_long_opts(option_index, optarg);
                break;

            case '?':
            default:
                Usage();
                break;
        }
    }

    validate_options();

    if ((mirror_op == SANDESH_OP_DUMP) ||
            (mirror_op == SANDESH_OP_GET)) {
        printf("Mirror Table\n\n");
        printf("Flags:D=Dynamic Mirroring, Hw=NIC Assisted Mirroring \n\n");
        printf("Index    NextHop    Flags       VNI    Vlan\n");
        printf("------------------------------------------------\n");
    }

    cl = vr_get_nl_client(VR_NETLINK_PROTO_DEFAULT);
    if (!cl) {
        exit(1);
    }

    vr_mirror_op(cl);

    return 0;
}