Skip to content

Instantly share code, notes, and snippets.

@upa
Last active August 29, 2015 14:13
Show Gist options
  • Save upa/136e5b6eb068b79a10f7 to your computer and use it in GitHub Desktop.
Save upa/136e5b6eb068b79a10f7 to your computer and use it in GitHub Desktop.
--- a/helper/quagga-helper.cc Mon Sep 15 00:35:15 2014 +0900
+++ b/helper/quagga-helper.cc Fri Jan 23 05:01:04 2015 +0900
@@ -102,6 +102,7 @@
class OspfConfig : public Object
{
private:
+ std::string router_id;
std::map<std::string, uint32_t> *networks;
public:
OspfConfig ()
@@ -140,6 +141,12 @@
}
void
+ SetRouterId (const char * router_id)
+ {
+ this->router_id = std::string (router_id);
+ }
+
+ void
SetFilename (const std::string &filename)
{
m_filename = filename;
@@ -180,6 +187,9 @@
os << " network " << (*i).first << " area " << (*i).second << std::endl;
}
os << " redistribute connected" << std::endl;
+ if (router_id != "") {
+ os << " ospf router-id " << router_id << std::endl;
+ }
os << "!" << std::endl;
}
std::vector<uint32_t> *iflist;
@@ -647,6 +657,20 @@
}
void
+QuaggaHelper::SetOspfRouterId (Ptr<Node> node, const char * routerid)
+{
+ Ptr<OspfConfig> ospf_conf = node->GetObject<OspfConfig> ();
+ if (!ospf_conf)
+ {
+ ospf_conf = new OspfConfig ();
+ node->AggregateObject (ospf_conf);
+ }
+ ospf_conf->SetRouterId (routerid);
+ return;
+}
+
+
+void
QuaggaHelper::EnableOspfDebug (NodeContainer nodes)
{
for (uint32_t i = 0; i < nodes.GetN (); i++)
diff -r ab763dc2d433 helper/quagga-helper.h
--- a/helper/quagga-helper.h Mon Sep 15 00:35:15 2014 +0900
+++ b/helper/quagga-helper.h Fri Jan 23 05:01:04 2015 +0900
@@ -89,6 +89,14 @@
void EnableOspf (NodeContainer nodes, const char *network);
/**
+ * \brief Set router-id param of OSPF to the node.
+ *
+ * \param node The node to set router-id of OSPF instance.
+ * \param routerid The router id value.
+ */
+ void SetOspfRouterId (Ptr<Node> node, const char * routerid);
+
+ /**
* \brief Configure the debug option to the ospfd daemon (via debug ospf xxx).
*
* \param nodes The node(s) to configure the options.
@thehajime
Copy link

line 15
void

  • setRouterid (const char * router_id)

if it is SetRouterId (), that'll be okay for the merge.

@upa
Copy link
Author

upa commented Jan 22, 2015

changed !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment