NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
ns3::AnnotatedTopologyReader Class Reference

This class reads annotated topology and apply settings to the corresponding nodes and links. More...

#include <annotated-topology-reader.hpp>

Inheritance diagram for ns3::AnnotatedTopologyReader:
Collaboration diagram for ns3::AnnotatedTopologyReader:

Public Member Functions

 AnnotatedTopologyReader (const std::string &path="", double scale=1.0)
 Constructor. More...
 
virtual ~AnnotatedTopologyReader ()
 
virtual NodeContainer Read ()
 Main annotated topology reading function. More...
 
virtual NodeContainer GetNodes () const
 Get nodes read by the reader. More...
 
virtual const std::list< Link > & GetLinks () const
 Get links read by the reader. More...
 
virtual void AssignIpv4Addresses (Ipv4Address base)
 Assign IPv4 addresses to all links. More...
 
virtual void SetBoundingBox (double ulx, double uly, double lrx, double lry)
 Set bounding box where nodes will be randomly places (if positions are unspecified) More...
 
virtual void SetMobilityModel (const std::string &model)
 Set mobility model to be used on nodes. More...
 
virtual void ApplyOspfMetric ()
 Apply OSPF metric on Ipv4 (if exists) and Ccnx (if exists) stacks. More...
 
virtual void SaveTopology (const std::string &file)
 Save positions (e.g., after manual modification using visualizer) More...
 
virtual void SaveGraphviz (const std::string &file)
 Save topology in graphviz format (.dot file) More...
 

Protected Member Functions

Ptr< Node > CreateNode (const std::string name, uint32_t systemId)
 
Ptr< Node > CreateNode (const std::string name, double posX, double posY, uint32_t systemId)
 
void ApplySettings ()
 This method applies setting to corresponding nodes and links NetDeviceContainer must be allocated NodeContainer from Read method. More...
 

Protected Attributes

std::string m_path
 
NodeContainer m_nodes
 

Detailed Description

This class reads annotated topology and apply settings to the corresponding nodes and links.

Definition at line 36 of file annotated-topology-reader.hpp.

Constructor & Destructor Documentation

◆ AnnotatedTopologyReader()

ns3::AnnotatedTopologyReader::AnnotatedTopologyReader ( const std::string &  path = "",
double  scale = 1.0 
)

Constructor.

Parameters
pathns3::Names path
scaleScaling factor for coordinates in input file
See also
ns3::Names class

Definition at line 66 of file annotated-topology-reader.cpp.

References SetMobilityModel().

◆ ~AnnotatedTopologyReader()

ns3::AnnotatedTopologyReader::~AnnotatedTopologyReader ( )
virtual

Definition at line 103 of file annotated-topology-reader.cpp.

Member Function Documentation

◆ Read()

NodeContainer ns3::AnnotatedTopologyReader::Read ( void  )
virtual

Main annotated topology reading function.

This method opens an input stream and reads topology file with annotations.

Returns
the container of the nodes created (or empty container if there was an error)

Reimplemented in ns3::RocketfuelMapReader, and ns3::RocketfuelWeightsReader.

Definition at line 154 of file annotated-topology-reader.cpp.

References ndn::time::abs(), ApplySettings(), CreateNode(), m_nodes, and m_path.

Referenced by ns3::RocketfuelWeightsReader::Read().

◆ GetNodes()

NodeContainer ns3::AnnotatedTopologyReader::GetNodes ( ) const
virtual

Get nodes read by the reader.

Definition at line 142 of file annotated-topology-reader.cpp.

References m_nodes.

◆ GetLinks()

const std::list< TopologyReader::Link > & ns3::AnnotatedTopologyReader::GetLinks ( ) const
virtual

Get links read by the reader.

Definition at line 148 of file annotated-topology-reader.cpp.

Referenced by ns3::RocketfuelMapReader::Read().

◆ AssignIpv4Addresses()

void ns3::AnnotatedTopologyReader::AssignIpv4Addresses ( Ipv4Address  base)
virtual

Assign IPv4 addresses to all links.

Note, IPv4 stack should be installed on all nodes prior this call

Every link will receive /24 netmask

Parameters
baseStarting IPv4 address (second link will have base+256)

Definition at line 269 of file annotated-topology-reader.cpp.

◆ SetBoundingBox()

void ns3::AnnotatedTopologyReader::SetBoundingBox ( double  ulx,
double  uly,
double  lrx,
double  lry 
)
virtual

Set bounding box where nodes will be randomly places (if positions are unspecified)

Parameters
ulxUpper left x coordinate
ulyUpper left y coordinate
lrxLower right x coordinate
lryLower right y coordinate

Definition at line 85 of file annotated-topology-reader.cpp.

◆ SetMobilityModel()

void ns3::AnnotatedTopologyReader::SetMobilityModel ( const std::string &  model)
virtual

Set mobility model to be used on nodes.

Parameters
modelclass name of the model

Definition at line 97 of file annotated-topology-reader.cpp.

Referenced by AnnotatedTopologyReader().

◆ ApplyOspfMetric()

void ns3::AnnotatedTopologyReader::ApplyOspfMetric ( )
virtual

Apply OSPF metric on Ipv4 (if exists) and Ccnx (if exists) stacks.

Definition at line 282 of file annotated-topology-reader.cpp.

◆ SaveTopology()

void ns3::AnnotatedTopologyReader::SaveTopology ( const std::string &  file)
virtual

Save positions (e.g., after manual modification using visualizer)

Reimplemented in ns3::RocketfuelMapReader.

Definition at line 435 of file annotated-topology-reader.cpp.

References m_nodes.

◆ SaveGraphviz()

void ns3::AnnotatedTopologyReader::SaveGraphviz ( const std::string &  file)
virtual

Save topology in graphviz format (.dot file)

Reimplemented in ns3::RocketfuelMapReader.

Definition at line 538 of file annotated-topology-reader.cpp.

References m_nodes.

◆ CreateNode() [1/2]

Ptr< Node > ns3::AnnotatedTopologyReader::CreateNode ( const std::string  name,
uint32_t  systemId 
)
protected

◆ CreateNode() [2/2]

Ptr< Node > ns3::AnnotatedTopologyReader::CreateNode ( const std::string  name,
double  posX,
double  posY,
uint32_t  systemId 
)
protected

Definition at line 123 of file annotated-topology-reader.cpp.

References m_nodes, and m_path.

◆ ApplySettings()

void ns3::AnnotatedTopologyReader::ApplySettings ( )
protected

This method applies setting to corresponding nodes and links NetDeviceContainer must be allocated NodeContainer from Read method.

Definition at line 327 of file annotated-topology-reader.cpp.

Referenced by ns3::RocketfuelWeightsReader::Commit(), Read(), and ns3::RocketfuelMapReader::Read().

Member Data Documentation

◆ m_path

std::string ns3::AnnotatedTopologyReader::m_path
protected

◆ m_nodes

NodeContainer ns3::AnnotatedTopologyReader::m_nodes
protected

The documentation for this class was generated from the following files: