Commit 6feebc86 authored by 's avatar

Test for mapi_get_device_info()


git-svn-id: file:///home/svn/mapi/trunk@1252 8d5bb341-7cf1-0310-8cf6-ba355fef3186
parent c64dbf3b
......@@ -7,8 +7,9 @@ int main(MAPI_UNUSED int argc, char *argv[])
{
int fd, ok;
mapi_flow_info_t info;
mapi_device_info_t device_info;
int err_no =0 , flag=0;
mapi_device_info_t device_info;
//mapi_device_info_t device_info[3]; //e.g. for network flow consists of 3 monitoring devices
int err_no =0;
char error[512];
if(!argv[1])
......@@ -51,6 +52,7 @@ DOT;
printf("\n");
DOT;
if((ok = mapi_get_device_info(info.devid, &device_info))<0){
//if((ok = mapi_get_device_info(info.devid, device_info))<0){ //In case of 3 devices
fprintf(stderr, "Getting device info failed on devid:%d\n", info.devid);
mapi_read_error( &err_no, error);
fprintf(stderr,"Errorcode :%d description: %s \n" ,err_no, error);
......@@ -69,13 +71,46 @@ DOT;
printf("\n");
/*
// In case of 3 monitoring device in the DIMAPI flow
printf("\ndevice info : Device 1 ");
printf("\n\t id = %d", device_info[0].id);
printf("\n\t device = %s", device_info[0].device);
printf("\n\t name: %s", device_info[0].name);
printf("\n\t alias = %s", device_info[0].alias);
printf("\n\t description = %s", device_info[0].description);
printf("\n\t link_speed = %d", device_info[0].link_speed);
printf("\n\t mpls = %d", device_info[0].mpls);
printf("\n\t vlan = %d", device_info[0].vlan);
printf("\n");
printf("\ndevice info : Device 2 ");
printf("\n\t id = %d", device_info[1].id);
printf("\n\t device = %s", device_info[1].device);
printf("\n\t name: %s", device_info[1].name);
printf("\n\t alias = %s", device_info[1].alias);
printf("\n\t description = %s", device_info[1].description);
printf("\n\t link_speed = %d", device_info[1].link_speed);
printf("\n\t mpls = %d", device_info[1].mpls);
printf("\n\t vlan = %d", device_info[1].vlan);
printf("\n");
printf("\ndevice info : Device 3 ");
printf("\n\t id = %d", device_info[2].id);
printf("\n\t device = %s", device_info[2].device);
printf("\n\t name: %s", device_info[2].name);
printf("\n\t alias = %s", device_info[2].alias);
printf("\n\t description = %s", device_info[2].description);
printf("\n\t link_speed = %d", device_info[2].link_speed);
printf("\n\t mpls = %d", device_info[2].mpls);
printf("\n\t vlan = %d", device_info[2].vlan);
printf("\n");
*/
/*
* Sanity checks
*/
if(info.num_functions != 1){
fprintf(stderr, "WARNING: Sanity check failed %d functions found\n" , info.num_functions);
}
if(mapi_close_flow(fd)<0){
fprintf(stderr,"Close flow failed\n");
mapi_read_error( &err_no, error);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment