4 * Copyright 2016 RIFT.IO Inc
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
10 * http://www.apache.org/licenses/LICENSE-2.0
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.
24 * @author Jeremy Mordkoff
26 * @brief test program to dump what we can glean from an installation
34 #include "rwcal-api.h"
37 int main(int argc
, char ** argv
, char ** envp
)
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
;
50 fprintf(stderr
, "args are IP user password\n");
53 snprintf(url
, 128, "http://%s:35357/v2.0/tokens", argv
[1] );
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
)
60 status
= rwcal_cloud_flavor_infos(m_mod
, &flavors
);
61 if (status
!= RW_STATUS_SUCCESS
)
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
);
72 rwcal__yang_data__rwcal__flavorinfo__gi_unref(flavors
);