A New Ns3 Implementation of CCNX 1.0 Protocol: July 2017
A New Ns3 Implementation of CCNX 1.0 Protocol: July 2017
A New Ns3 Implementation of CCNX 1.0 Protocol: July 2017
net/publication/318487817
CITATIONS READS
0 76
5 authors, including:
Marc Mosko
Palo Alto Research Center
53 PUBLICATIONS 212 CITATIONS
SEE PROFILE
Some of the authors of this publication are also working on these related projects:
All content following this page was uploaded by Marc Mosko on 18 June 2019.
Abstract
The ccns3Sim project is an open source implementation of the CCNx 1.0 protocols for the NS3 simulator. We
describe the implementation and several important features including modularity and process delay simulation.
The ccns3Sim implementation is a fresh NS3-specific implementation. Like NS3 itself, it uses C++98 standard,
NS3 code style, NS3 smart pointers, NS3 xUnit, and integrates with the NS3 documentation and manual. A
user or developer does not need to learn two systems. If one knows NS3, one should be able to get started with
the CCNx code right away. A developer can easily use their own implementation of the layer 3 protocol, layer
4 protocol, forwarder, routing protocol, Pending Interest Table (PIT) or Forwarding Information Base (FIB) or
Content Store (CS). A user may configure or specify a new implementation for any of these features at runtime
in the simulation script. In this paper, we describe the software architecture and give examples of using the
simulator. We evaluate the implementation with several example experiments on ICN caching.
keywords
ICN, CCNx, NS3, Simulation
Computing Science Laboratory, PARC
*corresponding author: [email protected]
Contents 1. Introduction
1 Introduction 1 The ccns3Sim [1] open source project is an NS3 [2] im-
plementation of the CCNx 1.0 protocol specifications
2 Node Architecture 2
[8, 7]. It is released as a source code module for the
2.1 Modeling delays . . . . . . . . . . . . . . . . . . . . . . .4 NS3 simulator. It runs with an unmodified NS3 simu-
2.2 CCNxL3Protocol (Layer 3) . . . . . . . . . . . . . . . .5 lator, though one patch is required to add an Ethertype
2.3 CCNxStandardForwarder . . . . . . . . . . . . . . . . .5 to the PPP implementation. ccns3Sim includes many
2.4 CCNxPortal (Layer 4) . . . . . . . . . . . . . . . . . . .6 examples and documentation.
The ccns3Sim implementation is a fresh NS3-
3 Routing 6
specific implementation. Like NS3 itself, it uses C++98
3.1 Installing a routing protocol . . . . . . . . . . . . . . . 7 standard, NS3 code style, NS3 smart pointers, NS3 xU-
3.2 Name Flooding Protocol Routing . . . . . . . . . . . 7 nit, and integrates with the NS3 documentation and
4 Applications 8 manual. A user or developer does not need to learn two
systems. If one knows NS3, one should be able to get
4.1 Consumer-Producer . . . . . . . . . . . . . . . . . . . . 8
started with the CCNx code right away. A developer
5 Experiments 8 can easily use their own implementation of the layer 3
6 Conclusions 9 protocol, layer 4 protocol, forwarder, routing protocol,
References 9
Pending Interest Table (PIT) or Forwarding Information
Base (FIB) or Content Store (CS). A user may config-
ure or specify a new implementation for any of these
A new NS3 Implementation of CCNx 1.0 Protocol — 2/9
1 NodeContainer nodes ;
side the forwarder. The forwarder, via the CCNxFor-
2 nodes . Create ( 5 ) ;
warder interface, handles calls to RouteInput() and 3
RouteOutput(). 4 CCNxStackHelper ccnx ;
The user selects each component via the simulation 5 ccnx . Install ( nodes ) ;
script. Figure 2 shows the set of “helpers” for use in Listing 1. Installing CCNx on NodeContainer
the simulation script. The top-most helper is the CCNx-
StackHelper. It is responsible for the overall instal- The CCNxPortal abstraction is the layer 4 protocol
lation of CCNx on an ns3::Node or ns3::NodeCon- from the applications’s point of view. It has functions
tainer. Each major architectural component – the layer to Send(), SendTo(), Recv(), and RecvFrom() using a
3 implementation, the forwarder implementation, and CCNxMessage. We provide one implementation class,
the routing protocol – has its own helper. CCNxMessagePortal, which is a simple 1-for-1 pro-
In NS3 terminology, a Helper is a factory that can tocol without any transport features (like a UDP). The
create an object and then aggregates it to an NS3 node. CCNxMessage class is the base for CCNxInterest and
Aggregating an object to a node makes an association CCNxContentObject. The class CCNxL4Protocol is
between the class and the node, so at a later time one the layer 4 abstraction from the layer 3 point of view. An
can ask a node for a specific implementation. This is, implementation class like CCNxMessagePortal inher-
for example, how the NfpRoutingProtocol uses the its from both CCNxPortal and CCNxL4Protocol.
CCNxForwarder interface without needing to know ex- One can run CCNxL3Protocol over any Layer 2 Net-
actly which implementation is being used. When the for- Devices. We have used it over point-to-point, CSMA,
warder implementation, such as CCNxStandardFor- WiFi, and VirtualNetDevice in our unit tests. One
warder aggregates on to a node, it can be retrieved via could use CCNx over IP tunnels (e.g. UDP tunnels)
its base class. using a VirtualNetDevice wrapping a UDP socket.
ccns3Sim’s packet coding is wire-format compati-
• NfpRoutingHelper: Used to configure and install ble with the standard CCNx 1.0 TLV format. We have,
Message pipeline delays CCNxDelayQueue<T>
A new NS3 Implementation of CCNx 1.0 Protocol — 4/9
Delayed
StandardLayer3 GetServiceTime(T item)
No Delay
StandardForwarder
NetDevice
NetDevice
NetDevice
ProcessDelay PIT
InputDelay
InputDelay
MessagePortal push_back(T item) DequeueCallback(T item)
ProcessDelay FIB
InputDelays
App
ProcessDelay CS
ns3 Timer
Figure 4. Delaydelay
Queue
Figure 3. Layer delays
Once the delay is over and the item is passed to De- 2.3 CCNxStandardForwarder
queueCallback(T item), no further calculation is The CCNxForwarder abstract base class represents the
done and item is passed to the next step in the service interface to a forwarder. A forwarder manages all the
pipeline. Listing 3 shows an example of this usage. state necessary to find the next hop for packet. In a
standard implementation, this means it has a FIB to
2.2 CCNxL3Protocol (Layer 3) forward Interest and a PIT to forward Content Objects.
As shown in Figure 1, the CCNxL3Protocol interface The class CCNxStandardForwarder implements the
(abstract base class), implemented by CCNxStandard- standards-based forwarder. The principle function of
layer3 class, is the central glue between the network the forwarder is to service calls to RouteInput() and
and the node. Besides the necessary APIs to send and RouteOutput(). These functions, whose names are
receive packets, it also performs these functions: taken from the NS3 Internet module, are the interface
to forward a packet. CCNxL3Protocol calls the first
• Layer 3 Interfaces: It maintains a layer 3 abstraction
when it receives a packet from a network device and
of network devices via the CCNxL3Interface
calls the second when it receives a packet from a Layer
class. This maintains layer 3 data about an inter-
4 protocol. The result of those functions is a vector of
face, such as if CCNx is forwarding on it or if the
CCNxConnections on which forward the packet.
interface is administratively up or down. It also
A user may configure the forwarder via the CC-
tracks how to broadcast on a network device.
NxStandardForwarderHelper, which implements
• Connection Table: The connection table stores infor- the CCNxForwarderHelper abstract base class. A
mation about each adjacency using the CCNxCon- user may entirely replace the forwarder by im-
nection abstract base class. It is implemented plementing their own forwarder and forwarder
by CCNxConnectionDevice for layer 2 devices helper. For example, as shown in Listing 5,
and CCNxConnectionL4 for layer 4 transport the class acme::AcmeForwarder implements the
connections. Each individual peer on a network CCNxForwarder interface and is configured via
interface has its own connection. Each layer 2 acme::AcmeForwarderHelper.
interface that supports broadcast has a special con-
nection in the connection table for its broadcast 1 AcmeForwarderHelper forwarder ;
address. 2 forwarder . UseTwoCopy ( t r u e ) ;
3
• Prefixes: Registering a prefix from Layer 4 means 4 CCNxStackHelper ccnx ;
the FIB will be updated to add to a specific CC- 5 ccnx . SetForwardingHelper ( forwarder ) ;
6 ccnx . Install ( nodes ) ;
NxConnectionL4 for the prefix. Unregistering a
prefix removes that connection from the FIB. Listing 5. Using a custom forwarder
• Anchors: Anchors are like registering and unregis- The CCNxStandardForwarderHelper exposes
tering a prefix, but in addition the routing protocol three factories to allow a user to customize or replace
will be notified that the local node is an anchor. the three main functional components: PIT, FIB, and
The routing protocol will then begin advertising ContentStore. This abstraction is specific to the CC-
the prefix as locally reachable. NxStandardForwarderHelper, not the CCNxFor-
warderingHelper because those tables may not exist
in other forwarders, such as a label-swapping forwarder.
1 AcmeLayer3Helper layer3 ; The tables are represented by an
2
3 CCNxStackHelper ccnx ; ns3::ObjectFactory, not a helper. This is be-
4 ccnx . SetLayer3Helper ( layer3 ) ; cause, in ns3 usage, a helper not only creates an
5 ccnx . Install ( nodes ) ; ns3::Object, it also aggregates it to a node. The
Listing 4. Using a custom Forwarder factories for the forwarder tables do not perform an
aggregation step; they are a pure factory, so we call them
The CCNxL3Protocol is replaceable via the sim- a factory not a helper. Suppose you have AcmePit
ulation script. A user could create, for example, the that implements the CCNxPit interface. One may use
AcmeLayer3 that implements the CCNxL3Protocol code similar to Listing 6 to replace the PIT used by the
interface and the AcmeLayer3Helper that im- standard forwarder.
plements the CCNxLayer3Helper abstract base Similar to the PIT, CCNxStandardForwarder-
class. A user may then instantiate the helper in Helper takes an ObjectFactory for the FIB and Con-
the simulation script and pass it to CCNxStack- tent Store. A user may provide their own implementa-
Helper::SetLayer3Helper(), as shown in List- tions by creating their own factory and passing it to the
ing 4. CCNxStandardForwarderHelper.
A new NS3 Implementation of CCNx 1.0 Protocol — 6/9
3.1 Installing a routing protocol its sequence number is larger than the currently known
Instantiating a routing protocol uses the NfpRout- sequence number and it came from a current predeces-
ingHelper, as shown in Listing 10. Once the script sets sor for the (prefix, achorName) pair. A withdraw has no
optional parameters, such as the HelloInterval, it distance associated with it. This feasibility criteria al-
then adds it to the CCNxStackHelper before installing lows equal-cost multipath to each anchor. Periodically
the stack helper on nodes. (e.g. every 10 seconds) the anchor advertises its prefixes.
Each link (neighbor adjacency) has a positive cost. We
use “1” for all link costs.
1 NfpRoutingHelper nfp ;
2 nfp . Set ( ” H e l l o I n t e r v a l ” , TimeValue ( Seconds ( 1 ) ) ) ←- Each routing node will accept only feasible adver-
; tisements. When a node receives a strictly better adver-
3
tisement, it erases all prior predecessors for the (prefix,
4 CCNxStackHelper ccnx ;
5 ccnx . SetRoutingHelper ( nfp ) ; achorName) pair and uses only the strictly better adver-
6 ccnx . Install ( nodes ) ; tisement. It immediately (with jitter) forwards the adver-
tisement with increased cost to its peers. When a node
Listing 10. Installing a routing protocol
receives an equal advertisement, it adds the predecessor
to the list of equal cost multi-paths for the (prefix, achor-
Name) pair and does not forward the advertisement. If a
3.2 Name Flooding Protocol Routing
withdraw message changes the state of a (prefix, achor-
The Name Flooding Protocol (NFP) is a distance vector
Name) pair to unreachable, it is forwarded immediately
routing protocol for CCNx names. It creates indepen-
(with jitter). If it does not change the state, its only ef-
dent directed acyclic graphs (DAGs) for each pair ( an-
fect is to remove a specific predecessor from the set of
chorName, prefix ). An anchor name is a unique identifier
multi-path predecessors.
for a node that advertises a prefix. We use a CCNxName
for both the anchorName and prefix. The prefix is a NFP uses two routing messages: an advertisement
CCNx name prefix for matching against Interest mes- and a withdraw. If a node loses reachability for a route,
sages to determine where to send them. This construc- it may immediately send a withdraw message to its
tion allows each node to keep the maximum information neighbors. Routes use soft state and will timeout after
about prefix reachability at the expense of extra signal- 3x the advertisement period. Advertisements and with-
ing and storage costs. Node should still forward only draws are sent in a routing message, which is in turn
towards the least cost anchor, as there is no guarantee carried in the payload of a Interest message. Each rout-
that two anchor paths will not cause a loop for the same ing message has a 1-hop MessageSeqnum specific to that
prefix. NFP is intended as a demonstration of a CCNx 1-hop message. A message is only accepted if (Router-
routing protocol, and exhibits worse performance than Name, MessageSeqnum) is greater than the previously
other protocols, such as in [5]. heard (RouterName, MessageSeqnum). A routing message
NFP advertises the tuple (prefix, anchorName, anchor- is also an implicit Hello from that neighbor. It may be
PrefixSeqnum, distance). Each (prefix, anchorName) pair is sent with no advertisements or withdraws to function
considered independently from other advertisements. simply as a Hello.
This means that NFP maintains routes to all anchors that The neighbor table tracks Hello status for each neigh-
advertise a specific name prefix. Each anchor is respon- bor. It has a callback to NeighborStateChanged()
sible for incrementing its own anchorPrefixSeqnum with whenever the state of a neighbor changes (UP, DOWN,
each new advertisement. As the advertisement travels DEAD). We use a 3-state model for neighbors so we do
over the network, its distance is always increasing with not erase their messageSeqnum right away when they go
each hop. We do not require min-hop link costs, it could DOWN. They have to timeout a second time to DEAD
be any positive distance per hop. state before we erase the record. If a neighbor goes to
Each anchor has a unique name, for example a cryp- DOWN state, we erase all next hops that use that neigh-
tographic hash of a public key. In our experiments, we bor. That may cause PrefixStateChanged() to be
use a name that is a 32-byte value, similar to what a called if a (prefix, anchorName) becomes unreachable. On
SHA-256 hash of a public key would be. a DEAD change, we simply erase the record.
An advertisement for (pref ix, anchorN ame) is con- The prefix table stores the best advertisements we
sidered feasible if the anchorPrefixSeqnumis greater than have seen for each (prefix, anchorName) pair. It has a
any previously seen sequence number, or anchorPrefixSe- callback to PrefixStateChanged() when a (prefix,
qnum being equal to a previous advertisement and the anchorName) becomes reachable or unreachable. There
distance is no greater than any previous advertisement currently is not a method to prune DEAD records like
seen at the node. An advertisement is strictly better if there is for neighbors.
the sequence number is larger or begin equal the dis-
tance is strictly less. A withdraw message is feasible if
A new NS3 Implementation of CCNx 1.0 Protocol — 8/9
80x103
CCNx applications inherit from the CCNxApplica-
Computational Cost
70x103
tion base class, which in turn inherits from ns3::App- 60x103
lication. This means that CCNx applications can use 50x103
40x103
the ns3::ApplicationContainer, which provides
30x103
easy mechanisms to start and stop applications on a 20x103
node. We provide two example applications: a con- 10x103
sumer and a producer. 0x100
1 2 3 4 5
Number of Replicas
4.1 Consumer-Producer Figure 5. Computational Cost after Link Failure
The consumer-producer example applications use a CC-
NxRepository. The repository is a name prefix plus a
fixed number of content objects all of a fixed size. One 5. Experiments
repository may be shared between all producers (repli-
cas), so there is no duplication of state. Each CCNx- This section presents results of some experiments with
Producer will register as an anchor for the repository the NFP routing protocol (see Section 3.2). The pur-
prefix (and thus advertise it via a routing protocol) and pose is to illustrate using the simulator on a non-trivial
serve the repositories content via a CCNxMessagePor- topology with real routing traffic. These experiments
tal. Each CCNxConsumer will request names from the are not a thorough evaluation of the NFP routing pro-
repository with a fixed request rate. For each request, it tocol, though they do show some of its characteristics.
uses CCNxRepository::GetRandomName() to pick As mentioned in the prior section on NFP, because it
a name from the repository. Currently, the repository treats each pair (anchorN ame, pref ix) as an indepen-
only supports a uniform name distribution. A node may dent routing process, it will scale worse than LSCR [5]
have zero or more producers on it. or DCR [4], which only advertise the best anchor for a
prefix.
We used a similar methodology as in [5], which
1 Ptr <c o n s t CCNxName> prefix = Create <CCNxName> ←-
( ” ccnx : / name= p r e f i x ” ) ; presents the routing protocol LSCR. The simulations
2 uint32_t bytes = 1 2 4 ; are done on the 154 node AT&T topology using the sim-
3 uint32_t count = 1 0 0 0 ; ulator’s NFP protocol. Because NFP is a distance vector
4 Ptr <CCNxContentRepository> repo = Create <←-
CCNxContentRepository> ( prefix , bytes , count←-
protocol, the comparison is not exactly apples to apples.
); Instead of measuring link state advertisements (LSAs),
we measure advertisement and withdraw routing up-
Listing 11. Creating a repository date messages. We measure computational complexity
Listing 11 shows how to create a content repository the same: it is each call for an event (e.g. a timer or ta-
with a given prefix. In this example, each content ob- ble operation) and each iteration through a loop control
ject, which will have its own individual name under structure. We have not implemented the NLSR or LSCR
the name ccnx:/name=prefix, will be 124 bytes of protocols in our simulator, so we cannot directly com-
payload, and there will be 1,000 of them. The Ptr<> pare results. The methodology in [5] uses 30 random
reference to the repo is then shared between producer nodes as anchors and randomly distributed 210 name
nodes and consumer nodes (see the next listing). prefixes among them. We repeat each experiment 20
Listing 12 shows how to create a set of consumer times.
nodes for a repository repo. Because the CCNxAp- Figure 5 shows the computation cost associated with
plication class follows the standard NS3 application a single link failure. After an initial period (30 seconds),
model, we can use the ApplicationContainer to a single link is selected and failed by introducing a 100%
schedule starting and stopping an application. The same packet loss. After 3 seconds, the Hello protocol times
process applies to the CCNxProducer. out and the peers on the link remove each other. Be-
cause the topology has a few nodes of high degree and
many nodes of low degree, this usually results in one or
1 CCNxConsumerHelper consumer ( repo ) ; a small number of nodes being disconnected. The com-
2 consumer . SetAttribute ( ” R e q u e s t I n t e r v a l ” , ←-
TimeValue ( MilliSeconds ( 5 ) ) ) ;
putational cost is almost linear in the number of replicas
3 ApplicationContainer consumerApps = consumer . ←- because each (anchorN ame, pref ix) pair is propagated,
Install ( consumerNodes ) ; so when a leaf node has its link cut, it will lose a number
4 consumerApps . Start ( Seconds ( 2 ) ) ; of routes proportional to the number of replicas.
5 consumerApps . Stop ( Seconds ( 1 2 ) ) ;
Figure 6 shows the number of routing update mes-
Listing 12. Configuring a consumer sages triggered by a link failure. As with the computa-
A new NS3 Implementation of CCNx 1.0 Protocol — 9/9
1x103
References
500x100
[1]
ccns3Sim open source project. https://github.
0x100
1 2 3 4 5 com/PARC/ccns3Sim/wiki. Accessed: 2016-05-
Number of Replicas 05.
Figure 6. Routing messages after Link Failure [2]
NS3 simulator. http://nsnam.org. Accessed:
2016-05-05.
[3]
tional cost, the number of withdraw messages will scale R. Chiocchetti, D. Rossi, and G. Rossini. ccnsim: An
linearly with the number of replicas. highly scalable ccn simulator. In 2013 IEEE Inter-
In terms of processing efficiency, ccns3Sim executes national Conference on Communications (ICC), pages
these 50 second virtual time examples in under 40.1 sec- 2309–2314, June 2013.
onds real time in a simulation with over 18.8M compu- [4]
J. Garcia-Luna-Aceves. Name-based content rout-
tational complexity and 221,880 packets. That comes ing in information centric networks using distance
out to an average execution time of 2.1 usec per routing information. In Proceedings of the 1st International
protocol event on a MacBook Pro laptop with a 2.6 GHz Conference on Information-centric Networking, ICN ’14,
core i7 CPU. The simulations use under 285 MB of RAM pages 7–16, New York, NY, USA, 2014. ACM.
(just under 1.8 MB per node). Most of the memory is [5]
E. Hemmati and J. Garcia-Luna-Aceves. A new
going to the content repositories. approach to name-based link-state routing for
information-centric networks. In Proceedings of the
6. Conclusions 2nd International Conference on Information-Centric Net-
working, pages 29–38. ACM, 2015.
The ccns3Sim module for NS3 implements the CCNx
[6]
1.0 protocols. It is a native NS3 implementation in C++98 S. Mastorakis, A. Afanasyev, I. Moiseenko, and
that uses the NS3 coding style, memory and object man- L. Zhang. ndnsim 2.0: A new version of the ndn
agement functions, and application style. Using mod- simulator for ns-3. Technical report, Technical Report
ular NS3 helpers, a user can substitute or configure all NDN-0028, NDN, 2015.
the major CCNx components: the Layer 3 implementa- [7]
M. Mosko, I. Solis, and C. Wood. Ccnx messages
tion, the forwarder, the routing protocol, the PIT, FIB, in tlv format. Internet-Draft draft-irtf-icnrg-
and Content Store with in the forwarder, and the layer ccnxmessages-02, IETF Secretariat, April 2016.
4 Portal. Each of these pieces includes a layer delay http://www.ietf.org/internet-drafts/
model to allow simulation of data structure and pro- draft-irtf-icnrg-ccnxmessages-02.txt.
cessing delays. We also provide an example routing [8]
M. Mosko, I. Solis, and C. Wood. Ccnx
protocol, Name Flooding Protocol (NFP) to illustrate
semantics. Internet-Draft draft-irtf-icnrg-
how a dynamic routing protocol operates in ccns3Sim.
ccnxsemantics-02, IETF Secretariat, April 2016.
There is still more work to be done. Future work will
http://www.ietf.org/internet-drafts/
expand the cryptographic side of the implementation
draft-irtf-icnrg-ccnxsemantics-02.txt.
to allow modeling the use of pubic key cryptography.
The packet encoding currently does not support vir-
tual payloads, which are a common simulation tool to
reduce processing time. ccns3Sim is also missing In-
terest NACKs, organizational unit TLVs, and nameless
objects. We also plan on incorporating the CCNx model
within NS3’s LTE model to simulate its use in mobile
networks.
In terms of protocol implementation, future work
will include several important features. The consumer-
producer applications will support Zipf request distribu-
tions and the content store will support different place-
ment (where to cache) and replacement strategies. There
are also many optimizations to make content caching