diff --git a/CHANGES.html b/CHANGES.html
index 5e9cfcdf5..5d1cc98ab 100644
--- a/CHANGES.html
+++ b/CHANGES.html
@@ -64,6 +64,8 @@ nodes to be placed outside of buildings defined in the scenario.
Added a priority queue disc (PrioQueueDisc).
Added a new trace source in StaWifiMac for tracing beacon arrivals
Added a new helper method to ApplicationContainer to start applications with some jitter around the start time
+ (network) Add a method to check whether a node with a given ID is within a NodeContainer.
+
Changes to existing API:
diff --git a/RELEASE_NOTES b/RELEASE_NOTES
index 896a67279..55748c7b6 100644
--- a/RELEASE_NOTES
+++ b/RELEASE_NOTES
@@ -32,6 +32,8 @@ New user-visible features
- (wifi) Add a new trace source to StaWifiMac to trace beacon arrivals
- (network) Add a method to allow random variable-based jitter to be added
to the start times of applications in a container.
+- (network) Add a method to check whether a node with a given ID is within
+ a NodeContainer.
Bugs fixed
----------
diff --git a/src/network/helper/node-container.cc b/src/network/helper/node-container.cc
index 6e1d66770..cf03e27b5 100644
--- a/src/network/helper/node-container.cc
+++ b/src/network/helper/node-container.cc
@@ -136,4 +136,17 @@ NodeContainer::GetGlobal (void)
return c;
}
+bool
+NodeContainer::Contains (uint32_t id) const
+{
+ for (uint32_t i = 0; i < m_nodes.size (); i++)
+ {
+ if (m_nodes[i]->GetId () == id)
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
} // namespace ns3
diff --git a/src/network/helper/node-container.h b/src/network/helper/node-container.h
index 967da9d51..a602a5a6d 100644
--- a/src/network/helper/node-container.h
+++ b/src/network/helper/node-container.h
@@ -288,6 +288,14 @@ public:
*/
static NodeContainer GetGlobal (void);
+ /**
+ * \brief Return true if container contains a Node with index id
+ *
+ * \return whether the NodeContainer contains a node with index id
+ * \param id Node Id
+ */
+ bool Contains (uint32_t id) const;
+
private:
std::vector > m_nodes; //!< Nodes smart pointers
};