show ospf implemented.

This commit is contained in:
Ondrej Filip 2000-06-01 16:26:59 +00:00
parent cf318e3cd3
commit 4ab4e9778f
4 changed files with 46 additions and 3 deletions

View file

@ -40,6 +40,9 @@ CF_ADDTO(dynamic_attr, OSPF_METRIC1 { $$ = f_new_dynamic_attr(EAF_TYPE_INT | EAF
CF_ADDTO(dynamic_attr, OSPF_METRIC2 { $$ = f_new_dynamic_attr(EAF_TYPE_INT | EAF_TEMP, T_INT, EA_OSPF_METRIC2); })
CF_ADDTO(dynamic_attr, OSPF_TAG { $$ = f_new_dynamic_attr(EAF_TYPE_INT | EAF_TEMP, T_INT, EA_OSPF_TAG); })
CF_CLI(SHOW OSPF, optsym, [<name>], [[Show information about ospf protocol]])
{ ospf_sh(proto_get_named($3, &proto_ospf)); } ;
CF_CLI(SHOW OSPF NEIGHBORS, optsym, [<name>], [[Show information about ospf neighbors]])
{ ospf_sh_neigh(proto_get_named($4, &proto_ospf)); } ;

View file

@ -500,11 +500,11 @@ ospf_sh_neigh_info(struct ospf_neighbor *n)
min=(exp-sec)/60;
if(min>59)
{
sprintf(etime,"-Inf-");
bsprintf(etime,"-Inf-");
}
else
{
sprintf(etime,"%02u:%02u", min, sec);
bsprintf(etime,"%02u:%02u", min, sec);
}
if(n->rid==ifa->drid) pos="dr ";

View file

@ -324,7 +324,7 @@ ospf_sh_neigh(struct proto *p)
struct ospf_neighbor *n;
struct proto_ospf *po=(struct proto_ospf *)p;
cli_msg(-1013,"%s:",p->name);
cli_msg(-1013,"%s:", p->name);
cli_msg(-1013,"%-12s\t%3s\t%-15s\t%-5s\t%-12s\t%-10s","Router ID","Pri",
" State", "DTime", "Router IP", "Interface");
WALK_LIST(ifa,po->iface_list)
@ -332,3 +332,42 @@ ospf_sh_neigh(struct proto *p)
ospf_sh_neigh_info(n);
cli_msg(0,"");
}
void
ospf_sh(struct proto *p)
{
struct ospf_area *oa;
struct proto_ospf *po=(struct proto_ospf *)p;
struct ospf_iface *ifa;
struct ospf_neighbor *n;
int ifano;
int nno;
int adjno;
cli_msg(-1014,"%s:", p->name);
cli_msg(-1014,"Number of areas: %u", po->areano);
WALK_LIST(oa,po->area_list)
{
cli_msg(-1014,"\tArea: %I (%u) %s", oa->areaid, oa->areaid,
oa->areaid==0 ? "[BACKBONE]" : "");
ifano=0;
nno=0;
adjno=0;
WALK_LIST(ifa, po->iface_list)
{
if(oa==ifa->oa) ifano++;
WALK_LIST(n, ifa->neigh_list)
{
nno++;
if(n->state==NEIGHBOR_FULL) adjno++;
}
}
cli_msg(-1014,"\t\tNumber of interfaces: %u", ifano);
cli_msg(-1014,"\t\tNumber of LSAs: %u", oa->gr->hash_entries);
cli_msg(-1014,"\t\tNumber of neighbors: %u", nno);
cli_msg(-1014,"\t\tNumber of fully adjacent neighbors: %u", adjno);
}
cli_msg(0,"");
}

View file

@ -363,6 +363,7 @@ void area_disp(timer *timer);
void schedule_rt_lsa(struct ospf_area *oa);
void schedule_rtcalc(struct ospf_area *oa);
void ospf_sh_neigh(struct proto *p);
void ospf_sh(struct proto *p);
#define EA_OSPF_METRIC1 EA_CODE(EAP_OSPF, 0)
#define EA_OSPF_METRIC2 EA_CODE(EAP_OSPF, 1)