TestArea.ned 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. package inet.examples.ospfv2.areatests;
  2. import inet.common.misc.ThruputMeteringChannel;
  3. import inet.linklayer.ethernet.EtherHub;
  4. import inet.node.inet.StandardHost;
  5. import inet.node.ospfv2.OSPFRouter;
  6. module TestArea
  7. {
  8. parameters:
  9. @display("p=10,10;b=412,316");
  10. int numHosts = default(3);
  11. int extGates = default(0);
  12. gates:
  13. inout ethg[extGates];
  14. types:
  15. channel C extends ThruputMeteringChannel
  16. {
  17. delay = 0.1us;
  18. datarate = 100Mbps;
  19. thruputDisplayFormat = "#N";
  20. }
  21. submodules:
  22. H[numHosts]: StandardHost {
  23. @display("i=device/laptop");
  24. }
  25. N[numHosts]: EtherHub;
  26. R[numHosts]: OSPFRouter;
  27. B[extGates]: OSPFRouter;
  28. connections:
  29. // host to router links
  30. for i=0..numHosts-1 {
  31. H[i].ethg++ <--> C <--> N[i].ethg++;
  32. R[i].ethg++ <--> C <--> N[i].ethg++;
  33. }
  34. // towards other areas
  35. for i=0..extGates-1 {
  36. ethg[i] <--> B[i].ethg++;
  37. }
  38. // ring of routers
  39. for i=1..numHosts-1 {
  40. R[i].ethg++ <--> C <--> R[i-1].ethg++;
  41. }
  42. for i=1..extGates-1 {
  43. B[i].ethg++ <--> C <--> B[i-1].ethg++;
  44. }
  45. R[0].ethg++ <--> C <--> R[numHosts-1].ethg++ if numHosts > 2 && extGates == 0;
  46. B[0].ethg++ <--> C <--> B[extGates-1].ethg++ if numHosts == 0 && extGates > 2;
  47. R[0].ethg++ <--> C <--> B[extGates-1].ethg++ if numHosts > 0 && extGates > 0;
  48. B[0].ethg++ <--> C <--> R[numHosts-1].ethg++ if numHosts > 0 && extGates > 0 && (numHosts+extGates > 2);
  49. }