op_mko
A utility that translates a process model from binary or XML form into C or C++ code form, then compiles it into object code form. This utility also compiles pipeline stages, packet conversion files, and external code files.
Description
Most models are created and modified using the modeler program, which is a comprehensive interactive application with an easy-to-use graphical user interface (GUI). However, the system also provides an alternative, external interface for creating and modifying models, more in line with the Linux philosophy of small, non-graphical tool programs that perform one particular task.
Using the provided external interfaces, you can define a set of models programmatically by invoking functions from the EMA Package (described in Chapter 1 “External Model Access” on page 1). After an EMA-based application has completed executing, the models it specified will be stored in the appropriate model directories. Network, node, and parameter models that have been created in this way are ready to use in a simulation. However, process models that have been created in this way must still be translated into C or C++ and compiled, so that they can later be linked into a simulation. One way to accomplish the translation/compilation is to invoke the modeler program, open the Process Editor, and perform the Compile Process Model operation. Invoking the op_mko utility is the external alternative; it translates and compiles a process model specified as an argument on its command line.
The following figure shows a schematic of the operation of op_mko; note the Linux suffixes of the respective versions of the process model.
Figure 19: Schematic of the Operation of op_mko

Similarly, op_mko will compile either a pipeline stage or external code file using the appropriate compiler for either C or C++, depending on the file specification (.c for C and .cpp for C++). The “kernel_type”, “m32”, “m64”, and “mt” preferences specify which simulation kernel to compile for.
Preferences
This program supports the following preference sets:
- “Standard Preferences”
- “Diagnostics” preferences
- “Development” preferences
- “Licensing Preferences”
This program also supports the following additional preferences.
all
Used alone, causes op_mko to recompile all process, external code, and pipeline stages in the model directories. When used with the type preference, compiles all files of the specified type (for example, op_mko -all -type ets compiles all .ets.c and .ets.cpp files).
| Type | Default Value |
|---|---|
| boolean | FALSE |
gui
Specifies whether op_mko should generate a network visualization mapping library for execution in the OPNET GUI (when TRUE) or during discrete event simulation (when FALSE).
Note: This preference, when TRUE, causes op_mko to ignore the kernel_type preference and generate a library that is linked with the necessary libraries for use in the GUI. The simulation kernel is not linked against; thus, you cannot use Kernel Procedures in code that will create a “gui” library.
| Type | Default Value |
|---|---|
| boolean | FALSE |
m
Specifies the base name of the process model, pipeline stage, or external code file that is to be compiled by op_mko. Models in both binary (.m) and XML (.xml) form are supported. The file path or file type suffix should not be included in the value of this preference.
Note: When compiling process models or wireless domain models, Riverbed Modeler maps any spaces in the model file name to underscore characters in the function derived from that model. For these models, the mapped name is the same as the interrupt function. For example, my process model.pr.m would have my_process_model() as the name of its interrupt function.
This preference is required and can be entered only from the command line.
| Type | Default Value |
|---|---|
| string | none |
raw_err
Specifies how compiler output should be handled. When FALSE, compiler output is parsed and displayed in tabular form. When TRUE, the raw compiler output is displayed.
This preference can be used only from the command line.
| Type | Default Value |
|---|---|
| boolean | FALSE |
type
Specifies the type of model to be compiled: “pr” for process, “ps” for pipeline stage, “pfp” for overall packet conversion method files, “pff” for packet field conversion method files, “ex” for external code file, “ets” for ETS code file, “da” for design actions, and “wdomain” for wireless domains. The base name of the model is specified by the m preference.
This preference is required and can be entered only from the command line.
| Type | Default Value |
|---|---|
| string | none |
Example Usage
% op_mko -m router -type pr
------------------------------------------------
op_mko: process model object form
(/home/users/tsmith/op_models/router.pr.o) produced
------------------------------------------------
%