Ilya Moiseenko | 1eff17d | 2011-08-17 10:55:53 -0700 | [diff] [blame] | 1 | /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /* |
| 3 | * Copyright (c) 2011 University of California, Los Angeles |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License version 2 as |
| 7 | * published by the Free Software Foundation; |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 17 | * |
| 18 | * Author: Ilya Moiseenko <iliamo@cs.ucla.edu> |
| 19 | */ |
| 20 | |
| 21 | #include "annotated-topology-reader.h" |
Ilya Moiseenko | 1eff17d | 2011-08-17 10:55:53 -0700 | [diff] [blame] | 22 | |
Alexander Afanasyev | 8633d5d | 2011-12-12 18:02:31 -0800 | [diff] [blame] | 23 | #include "ns3/nstime.h" |
| 24 | #include "ns3/log.h" |
| 25 | #include "ns3/assert.h" |
| 26 | #include "ns3/names.h" |
| 27 | #include "ns3/net-device-container.h" |
| 28 | #include "ns3/point-to-point-helper.h" |
| 29 | #include "ns3/point-to-point-net-device.h" |
| 30 | #include "ns3/internet-stack-helper.h" |
| 31 | #include "ns3/ipv4-address-helper.h" |
| 32 | #include "ns3/ipv4-global-routing-helper.h" |
| 33 | #include "ns3/drop-tail-queue.h" |
| 34 | #include "ns3/ipv4-interface.h" |
| 35 | #include "ns3/ipv4.h" |
| 36 | #include "ns3/string.h" |
| 37 | #include "ns3/pointer.h" |
| 38 | #include "ns3/uinteger.h" |
| 39 | #include "ns3/ipv4-address.h" |
| 40 | |
| 41 | #include "ns3/constant-position-mobility-model.h" |
Alexander Afanasyev | 8633d5d | 2011-12-12 18:02:31 -0800 | [diff] [blame] | 42 | |
| 43 | #include <boost/foreach.hpp> |
| 44 | #include <boost/lexical_cast.hpp> |
| 45 | |
Alexander Afanasyev | 66e6fd7 | 2011-12-12 21:34:51 -0800 | [diff] [blame] | 46 | #include <set> |
| 47 | |
Ilya Moiseenko | 1eff17d | 2011-08-17 10:55:53 -0700 | [diff] [blame] | 48 | using namespace std; |
| 49 | |
| 50 | namespace ns3 |
| 51 | { |
Ilya Moiseenko | 7dd43be | 2011-08-18 18:57:12 -0700 | [diff] [blame] | 52 | |
| 53 | NS_LOG_COMPONENT_DEFINE ("AnnotatedTopologyReader"); |
Ilya Moiseenko | 1eff17d | 2011-08-17 10:55:53 -0700 | [diff] [blame] | 54 | |
Alexander Afanasyev | 8633d5d | 2011-12-12 18:02:31 -0800 | [diff] [blame] | 55 | AnnotatedTopologyReader::AnnotatedTopologyReader (const std::string &path) |
| 56 | : m_path (path) |
Alexander Afanasyev | ae3b7c3 | 2011-12-13 13:20:06 -0800 | [diff] [blame] | 57 | , m_randX (0, 100.0) |
| 58 | , m_randY (0, 100.0) |
Ilya Moiseenko | 7dd43be | 2011-08-18 18:57:12 -0700 | [diff] [blame] | 59 | { |
Alexander Afanasyev | 66e6fd7 | 2011-12-12 21:34:51 -0800 | [diff] [blame] | 60 | NS_LOG_FUNCTION (this); |
Alexander Afanasyev | 7dbdcaf | 2011-12-13 21:40:37 -0800 | [diff] [blame] | 61 | |
Alexander Afanasyev | bdc0d98 | 2011-12-16 01:15:26 -0800 | [diff] [blame] | 62 | SetMobilityModel ("ns3::ConstantPositionMobilityModel"); |
Ilya Moiseenko | 7dd43be | 2011-08-18 18:57:12 -0700 | [diff] [blame] | 63 | } |
| 64 | |
Alexander Afanasyev | ae3b7c3 | 2011-12-13 13:20:06 -0800 | [diff] [blame] | 65 | void |
| 66 | AnnotatedTopologyReader::SetBoundingBox (double ulx, double uly, double lrx, double lry) |
| 67 | { |
| 68 | NS_LOG_FUNCTION (this << ulx << uly << lrx << lry); |
Alexander Afanasyev | 8633d5d | 2011-12-12 18:02:31 -0800 | [diff] [blame] | 69 | |
Alexander Afanasyev | ae3b7c3 | 2011-12-13 13:20:06 -0800 | [diff] [blame] | 70 | m_randX = UniformVariable (ulx, lrx); |
| 71 | m_randY = UniformVariable (uly, lry); |
| 72 | } |
Alexander Afanasyev | 8633d5d | 2011-12-12 18:02:31 -0800 | [diff] [blame] | 73 | |
Alexander Afanasyev | 7dbdcaf | 2011-12-13 21:40:37 -0800 | [diff] [blame] | 74 | void |
| 75 | AnnotatedTopologyReader::SetMobilityModel (const std::string &model) |
| 76 | { |
| 77 | NS_LOG_FUNCTION (this << model); |
| 78 | m_mobilityFactory.SetTypeId (model); |
| 79 | } |
| 80 | |
Ilya Moiseenko | 7dd43be | 2011-08-18 18:57:12 -0700 | [diff] [blame] | 81 | AnnotatedTopologyReader::~AnnotatedTopologyReader () |
| 82 | { |
Alexander Afanasyev | 66e6fd7 | 2011-12-12 21:34:51 -0800 | [diff] [blame] | 83 | NS_LOG_FUNCTION (this); |
Ilya Moiseenko | 7dd43be | 2011-08-18 18:57:12 -0700 | [diff] [blame] | 84 | } |
Alexander Afanasyev | 66e6fd7 | 2011-12-12 21:34:51 -0800 | [diff] [blame] | 85 | |
Alexander Afanasyev | ae3b7c3 | 2011-12-13 13:20:06 -0800 | [diff] [blame] | 86 | Ptr<Node> |
| 87 | AnnotatedTopologyReader::CreateNode (const std::string name) |
| 88 | { |
Alexander Afanasyev | 7dbdcaf | 2011-12-13 21:40:37 -0800 | [diff] [blame] | 89 | return CreateNode (name, m_randX.GetValue (), m_randY.GetValue ()); |
Alexander Afanasyev | ae3b7c3 | 2011-12-13 13:20:06 -0800 | [diff] [blame] | 90 | } |
| 91 | |
| 92 | Ptr<Node> |
| 93 | AnnotatedTopologyReader::CreateNode (const std::string name, double posX, double posY) |
| 94 | { |
Alexander Afanasyev | 7dbdcaf | 2011-12-13 21:40:37 -0800 | [diff] [blame] | 95 | NS_LOG_FUNCTION (this << name << posX << posY); |
Alexander Afanasyev | ae3b7c3 | 2011-12-13 13:20:06 -0800 | [diff] [blame] | 96 | Ptr<Node> node = CreateObject<Node> (); |
Alexander Afanasyev | 7dbdcaf | 2011-12-13 21:40:37 -0800 | [diff] [blame] | 97 | Ptr<MobilityModel> loc = DynamicCast<MobilityModel> (m_mobilityFactory.Create ()); |
Alexander Afanasyev | ae3b7c3 | 2011-12-13 13:20:06 -0800 | [diff] [blame] | 98 | node->AggregateObject (loc); |
| 99 | |
| 100 | loc->SetPosition (Vector (posX, posY, 0)); |
| 101 | |
| 102 | Names::Add (m_path, name, node); |
| 103 | |
| 104 | return node; |
| 105 | } |
| 106 | |
Ilya Moiseenko | 7dd43be | 2011-08-18 18:57:12 -0700 | [diff] [blame] | 107 | NodeContainer |
| 108 | AnnotatedTopologyReader::Read (void) |
| 109 | { |
Alexander Afanasyev | 66e6fd7 | 2011-12-12 21:34:51 -0800 | [diff] [blame] | 110 | ifstream topgen; |
| 111 | topgen.open (GetFileName ().c_str ()); |
| 112 | NodeContainer nodes; |
Ilya Moiseenko | 7dd43be | 2011-08-18 18:57:12 -0700 | [diff] [blame] | 113 | |
Alexander Afanasyev | 66e6fd7 | 2011-12-12 21:34:51 -0800 | [diff] [blame] | 114 | if ( !topgen.is_open () ) |
Ilya Moiseenko | 1eff17d | 2011-08-17 10:55:53 -0700 | [diff] [blame] | 115 | { |
Alexander Afanasyev | 8633d5d | 2011-12-12 18:02:31 -0800 | [diff] [blame] | 116 | NS_LOG_ERROR ("Cannot open file " << GetFileName () << " for reading"); |
Alexander Afanasyev | 66e6fd7 | 2011-12-12 21:34:51 -0800 | [diff] [blame] | 117 | return nodes; |
Ilya Moiseenko | 1eff17d | 2011-08-17 10:55:53 -0700 | [diff] [blame] | 118 | } |
Alexander Afanasyev | 8633d5d | 2011-12-12 18:02:31 -0800 | [diff] [blame] | 119 | |
Alexander Afanasyev | 66e6fd7 | 2011-12-12 21:34:51 -0800 | [diff] [blame] | 120 | while (!topgen.eof ()) |
| 121 | { |
| 122 | string line; |
| 123 | getline (topgen, line); |
| 124 | |
| 125 | if (line == "router") break; |
| 126 | } |
| 127 | |
| 128 | while (!topgen.eof ()) |
| 129 | { |
| 130 | string line; |
| 131 | getline (topgen,line); |
| 132 | if (line[0] == '#') continue; // comments |
| 133 | if (line=="link") break; // stop reading nodes |
| 134 | |
| 135 | istringstream lineBuffer (line); |
| 136 | string name, city; |
| 137 | double latitude, longitude; |
| 138 | |
| 139 | lineBuffer >> name >> city >> latitude >> longitude; |
Alexander Afanasyev | ae3b7c3 | 2011-12-13 13:20:06 -0800 | [diff] [blame] | 140 | Ptr<Node> node = CreateNode (name, 2*longitude, -2*latitude); |
Alexander Afanasyev | 66e6fd7 | 2011-12-12 21:34:51 -0800 | [diff] [blame] | 141 | nodes.Add (node); |
Alexander Afanasyev | 66e6fd7 | 2011-12-12 21:34:51 -0800 | [diff] [blame] | 142 | } |
| 143 | |
| 144 | map<string, set<string> > processedLinks; // to eliminate duplications |
| 145 | |
| 146 | // SeekToSection ("link"); |
| 147 | while (!topgen.eof ()) |
| 148 | { |
| 149 | string line; |
| 150 | getline (topgen,line); |
| 151 | if (line == "") continue; |
| 152 | if (line[0] == '#') continue; // comments |
| 153 | |
| 154 | // NS_LOG_DEBUG ("Input: [" << line << "]"); |
| 155 | |
| 156 | istringstream lineBuffer (line); |
Alexander Afanasyev | 7dbdcaf | 2011-12-13 21:40:37 -0800 | [diff] [blame] | 157 | string from, to, capacity, metric, delay, queueSizeNode1, queueSizeNode2; |
Alexander Afanasyev | 66e6fd7 | 2011-12-12 21:34:51 -0800 | [diff] [blame] | 158 | |
Alexander Afanasyev | 7dbdcaf | 2011-12-13 21:40:37 -0800 | [diff] [blame] | 159 | lineBuffer >> from >> to >> capacity >> metric >> delay >> queueSizeNode1 >> queueSizeNode2; |
Alexander Afanasyev | 66e6fd7 | 2011-12-12 21:34:51 -0800 | [diff] [blame] | 160 | |
| 161 | if (processedLinks[to].size () != 0 && |
| 162 | processedLinks[to].find (from) != processedLinks[to].end ()) |
| 163 | { |
| 164 | continue; // duplicated link |
Ilya Moiseenko | 7dd43be | 2011-08-18 18:57:12 -0700 | [diff] [blame] | 165 | } |
Alexander Afanasyev | 66e6fd7 | 2011-12-12 21:34:51 -0800 | [diff] [blame] | 166 | processedLinks[from].insert (to); |
| 167 | |
| 168 | Ptr<Node> fromNode = Names::Find<Node> (m_path, from); |
| 169 | NS_ASSERT (fromNode != 0); |
| 170 | Ptr<Node> toNode = Names::Find<Node> (m_path, to); |
| 171 | NS_ASSERT (fromNode != 0); |
| 172 | |
| 173 | Link link (fromNode, from, toNode, to); |
| 174 | |
| 175 | link.SetAttribute ("DataRate", capacity); |
| 176 | link.SetAttribute ("OSPF", metric); |
Alexander Afanasyev | 7dbdcaf | 2011-12-13 21:40:37 -0800 | [diff] [blame] | 177 | |
| 178 | if (!delay.empty ()) |
| 179 | link.SetAttribute ("Delay", delay); |
| 180 | if (!queueSizeNode1.empty ()) |
| 181 | link.SetAttribute ("QueueSizeNode1", queueSizeNode1); |
| 182 | if (!queueSizeNode2.empty ()) |
| 183 | link.SetAttribute ("QueueSizeNode2", queueSizeNode2); |
Alexander Afanasyev | 66e6fd7 | 2011-12-12 21:34:51 -0800 | [diff] [blame] | 184 | |
| 185 | AddLink (link); |
| 186 | NS_LOG_DEBUG ("New link " << from << " <==> " << to << " / " << capacity << "Kbps with " << metric << " metric"); |
Ilya Moiseenko | 7dd43be | 2011-08-18 18:57:12 -0700 | [diff] [blame] | 187 | } |
| 188 | |
Alexander Afanasyev | ae3b7c3 | 2011-12-13 13:20:06 -0800 | [diff] [blame] | 189 | NS_LOG_INFO ("Annotated topology created with " << nodes.GetN () << " nodes and " << LinksSize () << " links"); |
Alexander Afanasyev | 66e6fd7 | 2011-12-12 21:34:51 -0800 | [diff] [blame] | 190 | topgen.close (); |
Ilya Moiseenko | 7dd43be | 2011-08-18 18:57:12 -0700 | [diff] [blame] | 191 | |
Alexander Afanasyev | 8633d5d | 2011-12-12 18:02:31 -0800 | [diff] [blame] | 192 | ApplySettings (); |
Alexander Afanasyev | 8633d5d | 2011-12-12 18:02:31 -0800 | [diff] [blame] | 193 | |
Alexander Afanasyev | 66e6fd7 | 2011-12-12 21:34:51 -0800 | [diff] [blame] | 194 | return nodes; |
Ilya Moiseenko | 7dd43be | 2011-08-18 18:57:12 -0700 | [diff] [blame] | 195 | } |
Ilya Moiseenko | 1eff17d | 2011-08-17 10:55:53 -0700 | [diff] [blame] | 196 | |
Ilya Moiseenko | 58d2667 | 2011-12-08 13:48:06 -0800 | [diff] [blame] | 197 | void |
Alexander Afanasyev | 8633d5d | 2011-12-12 18:02:31 -0800 | [diff] [blame] | 198 | AnnotatedTopologyReader::AssignIpv4Addresses (Ipv4Address base) |
Ilya Moiseenko | 58d2667 | 2011-12-08 13:48:06 -0800 | [diff] [blame] | 199 | { |
Alexander Afanasyev | 8633d5d | 2011-12-12 18:02:31 -0800 | [diff] [blame] | 200 | Ipv4AddressHelper address (base, Ipv4Mask ("/24")); |
Ilya Moiseenko | 1eff17d | 2011-08-17 10:55:53 -0700 | [diff] [blame] | 201 | |
Alexander Afanasyev | 8633d5d | 2011-12-12 18:02:31 -0800 | [diff] [blame] | 202 | BOOST_FOREACH (const Link &link, m_linksList) |
Ilya Moiseenko | 58d2667 | 2011-12-08 13:48:06 -0800 | [diff] [blame] | 203 | { |
Alexander Afanasyev | 8633d5d | 2011-12-12 18:02:31 -0800 | [diff] [blame] | 204 | address.Assign (NetDeviceContainer (link.GetFromNetDevice (), |
| 205 | link.GetToNetDevice ())); |
Ilya Moiseenko | 1eff17d | 2011-08-17 10:55:53 -0700 | [diff] [blame] | 206 | |
Alexander Afanasyev | 8633d5d | 2011-12-12 18:02:31 -0800 | [diff] [blame] | 207 | base = Ipv4Address (base.Get () + 256); |
| 208 | address.SetBase (base, Ipv4Mask ("/24")); |
Alexander Afanasyev | 66e6fd7 | 2011-12-12 21:34:51 -0800 | [diff] [blame] | 209 | } |
Ilya Moiseenko | 1eff17d | 2011-08-17 10:55:53 -0700 | [diff] [blame] | 210 | |
Alexander Afanasyev | 8633d5d | 2011-12-12 18:02:31 -0800 | [diff] [blame] | 211 | ApplyOspfMetric (); |
Alexander Afanasyev | 66e6fd7 | 2011-12-12 21:34:51 -0800 | [diff] [blame] | 212 | } |
Ilya Moiseenko | 1eff17d | 2011-08-17 10:55:53 -0700 | [diff] [blame] | 213 | |
Alexander Afanasyev | 8633d5d | 2011-12-12 18:02:31 -0800 | [diff] [blame] | 214 | void |
| 215 | AnnotatedTopologyReader::ApplyOspfMetric () |
Alexander Afanasyev | 66e6fd7 | 2011-12-12 21:34:51 -0800 | [diff] [blame] | 216 | { |
Alexander Afanasyev | 0777f1c | 2011-12-12 20:22:45 -0800 | [diff] [blame] | 217 | BOOST_FOREACH (const Link &link, m_linksList) |
Alexander Afanasyev | 66e6fd7 | 2011-12-12 21:34:51 -0800 | [diff] [blame] | 218 | { |
Alexander Afanasyev | 7dbdcaf | 2011-12-13 21:40:37 -0800 | [diff] [blame] | 219 | NS_LOG_DEBUG ("OSPF: " << link.GetAttribute ("OSPF")); |
Alexander Afanasyev | 8633d5d | 2011-12-12 18:02:31 -0800 | [diff] [blame] | 220 | uint16_t metric = boost::lexical_cast<uint16_t> (link.GetAttribute ("OSPF")); |
Ilya Moiseenko | 1eff17d | 2011-08-17 10:55:53 -0700 | [diff] [blame] | 221 | |
Alexander Afanasyev | 66e6fd7 | 2011-12-12 21:34:51 -0800 | [diff] [blame] | 222 | { |
Alexander Afanasyev | 8633d5d | 2011-12-12 18:02:31 -0800 | [diff] [blame] | 223 | Ptr<Ipv4> ipv4 = link.GetFromNode ()->GetObject<Ipv4> (); |
| 224 | NS_ASSERT (ipv4 != 0); |
Alexander Afanasyev | 0777f1c | 2011-12-12 20:22:45 -0800 | [diff] [blame] | 225 | |
Alexander Afanasyev | 8633d5d | 2011-12-12 18:02:31 -0800 | [diff] [blame] | 226 | int32_t interfaceId = ipv4->GetInterfaceForDevice (link.GetFromNetDevice ()); |
| 227 | NS_ASSERT (interfaceId >= 0); |
Alexander Afanasyev | 0777f1c | 2011-12-12 20:22:45 -0800 | [diff] [blame] | 228 | |
Alexander Afanasyev | 8633d5d | 2011-12-12 18:02:31 -0800 | [diff] [blame] | 229 | ipv4->SetMetric (interfaceId,metric); |
Alexander Afanasyev | 66e6fd7 | 2011-12-12 21:34:51 -0800 | [diff] [blame] | 230 | } |
Ilya Moiseenko | 1eff17d | 2011-08-17 10:55:53 -0700 | [diff] [blame] | 231 | |
Alexander Afanasyev | 66e6fd7 | 2011-12-12 21:34:51 -0800 | [diff] [blame] | 232 | { |
Alexander Afanasyev | 8633d5d | 2011-12-12 18:02:31 -0800 | [diff] [blame] | 233 | Ptr<Ipv4> ipv4 = link.GetToNode ()->GetObject<Ipv4> (); |
| 234 | NS_ASSERT (ipv4 != 0); |
| 235 | |
| 236 | int32_t interfaceId = ipv4->GetInterfaceForDevice (link.GetToNetDevice ()); |
| 237 | NS_ASSERT (interfaceId >= 0); |
| 238 | |
| 239 | ipv4->SetMetric (interfaceId,metric); |
Alexander Afanasyev | 66e6fd7 | 2011-12-12 21:34:51 -0800 | [diff] [blame] | 240 | } |
Alexander Afanasyev | 8633d5d | 2011-12-12 18:02:31 -0800 | [diff] [blame] | 241 | } |
| 242 | } |
| 243 | |
| 244 | void |
| 245 | AnnotatedTopologyReader::ApplySettings () |
| 246 | { |
| 247 | PointToPointHelper p2p; |
Ilya Moiseenko | 58d2667 | 2011-12-08 13:48:06 -0800 | [diff] [blame] | 248 | |
Alexander Afanasyev | 8633d5d | 2011-12-12 18:02:31 -0800 | [diff] [blame] | 249 | BOOST_FOREACH (Link &link, m_linksList) |
| 250 | { |
Alexander Afanasyev | 66e6fd7 | 2011-12-12 21:34:51 -0800 | [diff] [blame] | 251 | string tmp; |
| 252 | |
Alexander Afanasyev | 7dbdcaf | 2011-12-13 21:40:37 -0800 | [diff] [blame] | 253 | if (link.GetAttributeFailSafe ("DataRate", tmp)) |
| 254 | { |
Alexander Afanasyev | 8f5a9bb | 2011-12-18 19:49:02 -0800 | [diff] [blame^] | 255 | NS_LOG_INFO ("DataRate = " + link.GetAttribute("DataRate")); |
| 256 | p2p.SetDeviceAttribute ("DataRate", StringValue(link.GetAttribute("DataRate"))); |
Alexander Afanasyev | 7dbdcaf | 2011-12-13 21:40:37 -0800 | [diff] [blame] | 257 | } |
Alexander Afanasyev | 66e6fd7 | 2011-12-12 21:34:51 -0800 | [diff] [blame] | 258 | |
| 259 | if (link.GetAttributeFailSafe("Delay", tmp)) |
| 260 | { |
Alexander Afanasyev | 8f5a9bb | 2011-12-18 19:49:02 -0800 | [diff] [blame^] | 261 | NS_LOG_INFO ("Delay = " + link.GetAttribute("Delay")); |
| 262 | p2p.SetChannelAttribute ("Delay", StringValue(link.GetAttribute("Delay"))); |
Alexander Afanasyev | 66e6fd7 | 2011-12-12 21:34:51 -0800 | [diff] [blame] | 263 | } |
Ilya Moiseenko | 58d2667 | 2011-12-08 13:48:06 -0800 | [diff] [blame] | 264 | |
Alexander Afanasyev | 8633d5d | 2011-12-12 18:02:31 -0800 | [diff] [blame] | 265 | NetDeviceContainer nd = p2p.Install(link.GetFromNode (), link.GetToNode ()); |
| 266 | link.SetNetDevices (nd.Get (0), nd.Get (1)); |
| 267 | |
Alexander Afanasyev | 66e6fd7 | 2011-12-12 21:34:51 -0800 | [diff] [blame] | 268 | if (link.GetAttributeFailSafe("QueueSizeNode1", tmp)) |
| 269 | { |
| 270 | PointerValue txQueueFrom; |
| 271 | link.GetFromNetDevice ()->GetAttribute ("TxQueue", txQueueFrom); |
| 272 | NS_ASSERT (txQueueFrom.Get<DropTailQueue> () != 0); |
Alexander Afanasyev | 8633d5d | 2011-12-12 18:02:31 -0800 | [diff] [blame] | 273 | |
Alexander Afanasyev | 7dbdcaf | 2011-12-13 21:40:37 -0800 | [diff] [blame] | 274 | NS_LOG_INFO ("QueueFrom: " << link.GetAttribute("QueueSizeNode1")); |
Alexander Afanasyev | 66e6fd7 | 2011-12-12 21:34:51 -0800 | [diff] [blame] | 275 | txQueueFrom.Get<DropTailQueue> ()->SetAttribute ("MaxPackets", StringValue (link.GetAttribute("QueueSizeNode1"))); |
| 276 | } |
| 277 | |
| 278 | if (link.GetAttributeFailSafe("QueueSizeNode2", tmp)) |
| 279 | { |
| 280 | PointerValue txQueueTo; |
| 281 | link.GetToNetDevice ()->GetAttribute ("TxQueue", txQueueTo); |
| 282 | NS_ASSERT (txQueueTo.Get<DropTailQueue> () != 0); |
Ilya Moiseenko | 7e14efa | 2011-12-12 17:56:22 -0800 | [diff] [blame] | 283 | |
Alexander Afanasyev | 7dbdcaf | 2011-12-13 21:40:37 -0800 | [diff] [blame] | 284 | NS_LOG_INFO ("QueueTo: " << link.GetAttribute("QueueSizeNode2")); |
Alexander Afanasyev | a174aa5 | 2011-12-13 01:30:32 -0800 | [diff] [blame] | 285 | txQueueTo.Get<DropTailQueue> ()->SetAttribute ("MaxPackets", StringValue (link.GetAttribute("QueueSizeNode2"))); |
Ilya Moiseenko | 58d2667 | 2011-12-08 13:48:06 -0800 | [diff] [blame] | 286 | } |
Alexander Afanasyev | 8633d5d | 2011-12-12 18:02:31 -0800 | [diff] [blame] | 287 | } |
Alexander Afanasyev | 66e6fd7 | 2011-12-12 21:34:51 -0800 | [diff] [blame] | 288 | } |
Alexander Afanasyev | 8633d5d | 2011-12-12 18:02:31 -0800 | [diff] [blame] | 289 | |
| 290 | } |