The following example provides the Card-Port MODEL as described in Correlation model used for example scripts.
/* card.mdl -
*
* Copyright (c) 2019, VMware Inc.
* All Rights Reserved
*
* A simple model file for use as an example of writing and
* building a small model.
*
*/
// Include the "resource" class from the netmate heirarchy.
#include "nm/nm.mdl"
// Since we include nm.mdl for purposes of derivation, we must
// have the generated .h file include nm.h
#pragma include_h "nm/nm.h"
///////////////////////////////////////////////////////////////
//
// This is a very simple card.
//
///////////////////////////////////////////////////////////////
// The class Card
interface Card : MR_ManagedObject {
// Attributes maintained for the class Card
attribute string CardDesc
"A brief description of the card";
// Relationship between the class Card and
// the class Port
relationshipset ComposedOf, Port, PartOf
"The ports in this card";
// The notifications for the class Card
export
Down, // Problems
Impaired; // Compound Notification
problem Down
"The card is down, causing all its ports to be "
"operationally down"
= OperationallyDown;
propagate symptom OperationallyDown
"Symptom observed on the ports in this card"
= Port, ComposedOf, OperationallyDown;
// Compound notification
aggregate Impaired
"The card or a port on this card is Down"
= Down,
PortDown;
Card-Port MODEL example 149
Card-Port MODEL Code
propagate aggregate PortDown
"The Down problem on ports in this card"
= Port, ComposedOf, Down;
}
// The class Port
interface Port : MR_ManagedObject {
// Attributes maintained for the class Port
enum operStatus_e {
TESTING = 0,
UP = 1,
DOWN = 2
};
attribute operStatus_e operStatus
"The operational status of the port"
= TESTING;
// relationship between the class Port and
// the class Card
relationship PartOf, Card, ComposedOf
"The card this port is part of";
// The notifications for the class Port
export
OperationallyDown, // Symptom
Down; // Problem
event OperationallyDown
"This port is not operational"
= operStatus == DOWN;
// Problem
problem Down
"The port is down"
= OperationallyDown;
}