next up previous
Next: Extending BRITE's Java Version Up: Extending BRITE's C++ Version Previous: Passing parameters to the


Generation Functionality

Extending the functionality is done basically by adding a new model class to BRITE. As described in Section 3.3, BRITE architecture's is centered around the Model class (see Figure 3). If we wanted to add a new router-level model to BRITE, we could create a new class, NewRouterModel deriving from RouterModel. Code excerpt 5 shows the declaration of such a class.


\begin{Program}
% latex2html id marker 644\footnotesize\begin{verbatim}class...
....
};\end{verbatim}\caption{ Model class for new router-level model}\end{Program}

Note that the NewRouterModel class contains two public methods that are a fundamental part of its interface: Generate and toString. Every model in BRITE, including the models for imported files, have a Generate method which is in charge of generating the graph for the constructed topology according to the model. Also, the toString method is used when exporting a BRITE topology into a file.

In BRITE, a new topology is generated by instantiating an object of the class Topology. The constructor for the class Topology receives a pointer to a Model as an argument. Next, the Topology constructor populates its model member with the received pointer, and populates its Graph member by invoking the Generate method of the received model. Once this is done, the topology has been created. Code excerpt 6 from file Topology.cc, shows the actions of the Topology constructor.


\begin{Program}
% latex2html id marker 658\footnotesize\begin{verbatim}Topo...
...m->Generate();
}\end{verbatim}\caption{Topology class constructor}\end{Program}

The Generate method of every new model should return a pointer to a Graph, containing the topology created. As an example, let's take a look at the code excerpt 7 which shows the Generate method of the RouterWaxmanModel class, taken from the file RouterWaxmanModel.cc.


\begin{Program}
% latex2html id marker 669\footnotesize\begin{verbatim}Graph...
...h;
}\end{verbatim}\caption{Generate method for Router Waxman model}\end{Program}

As we can see, this Generate method performs the required steps to generate the topology. The first step is to place the nodes into the plane. The specific functionality associated with model RouterWaxman is in particular encapsulated inside the method InterconnectNodes. Finally, the AssignBW method, which in this case is not overridden by the RouterWaxman class, is invoked to assign bandwidths to the links according to certain bandwidth distribution. Thus, for the new model, we must provide a Generate method with the appropriate functionality to produce topologies according to the new model.

ProgramJava excerpt


next up previous
Next: Extending BRITE's Java Version Up: Extending BRITE's C++ Version Previous: Passing parameters to the
Alberto Medina 2001-04-12