Fix ordering of elements for Openstack block device mapping
[osm/SO.git] / rwcal / test / rwcal_dump.cpp
1
2 /*
3 *
4 * Copyright 2016 RIFT.IO Inc
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 *
18 */
19
20
21
22 /**
23 * @file cal_dump
24 * @author Jeremy Mordkoff
25 * @date 05/14/2015
26 * @brief test program to dump what we can glean from an installation
27 */
28
29
30 #include <limits.h>
31 #include <cstdlib>
32 #include <iostream>
33
34 #include "rwcal-api.h"
35
36
37 int main(int argc, char ** argv, char ** envp)
38 {
39
40 #if 0
41 rw_status_t status;
42 rwcal_module_ptr_t m_mod;
43 Rwcal__YangData__Rwcal__Flavorinfo__FlavorinfoList *flavor;
44 rwpb_gi_Rwcal_FlavorInfo *flavors;
45 Rwcal__YangData__Rwcal__Flavorinfo *flavorinfo;
46 unsigned int i;
47 char url[128];
48
49 if (argc != 4 ) {
50 fprintf(stderr, "args are IP user password\n");
51 return(1);
52 }
53 snprintf(url, 128, "http://%s:35357/v2.0/tokens", argv[1] );
54
55 m_mod = rwcal_module_alloc();
56 status = rwcal_cloud_init(m_mod, RW_MANIFEST_RWCAL_CLOUD_TYPE_OPENSTACK_AUTH_URL, argv[2], argv[3], url );
57 if (status != RW_STATUS_SUCCESS)
58 return status;
59
60 status = rwcal_cloud_flavor_infos(m_mod, &flavors);
61 if (status != RW_STATUS_SUCCESS)
62 return status;
63 flavorinfo = flavors->s.message;
64 printf("ID NAME MEM DISK VCPU PCI HP TC\n");
65 printf("---------------------------------------- ---------------- ------ ---- ---- ---- -- --\n");
66 for (i = 0; i<flavorinfo->n_flavorinfo_list; i++) {
67 flavor = flavorinfo->flavorinfo_list[i];
68 printf("%-40s %-16s %6d %4d %4d %4d %2d %2d\n", flavor->id, flavor->name, flavor->memory, flavor->disk, flavor->vcpus, flavor->pci_passthru_bw,
69 flavor->has_huge_pages, flavor->trusted_host_only );
70 }
71
72 rwcal__yang_data__rwcal__flavorinfo__gi_unref(flavors);
73 #endif
74 return 0;
75
76 }
77