Ch09-Wireless Embedded Internet

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 84

1

Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
WirelessSensorNetworks
Dr.Ing.VoQueSon
Email:sonvq@hcmut.edu.vn
2
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
Chapter9:WirelessEmbeddedInternet
ICMPv6
Autoconfiguration
NeighborDiscovery
IProutinginWSNs:RPL
Embeddedweb REST/CoAP
Chapter10:Lab/Demo
ProgrammingwithTinyOS/Contiki
RoutinginWSNs
DataCollection
IPv6/6LoWPAN
Content
3
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
IPv6review
IPv4andIPv6comparison
6LoWPAN:IPv6Header
Compression:supportL3
routing(RouteOver)
6LoWPANNeighbor
Discovery
4
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
ICMPv6
InternetControlMessage
Protocolv6
ModificationfromICMPfor
IPv4
NeighborDiscovery(ND)
ReplaceARP,ICMP
ReachabilityofNeighbors
Hostsusetodiscoveryrouters,
autoconfigurationof
addresses
DuplicateAddressDetection
(DAD)
5NDmessages:
RouterSolicitation(type133)
RouterAdvertisement(type134)
NeighborSolicitation(type135)
NeighborAdvertisement(type
136)
Redirect(type137)
5
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
Autoconfiguration
6
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
IPRoutinginWSNs
LowpowerandLossyNetwork(LLN)consistsofanedge
router(alsocalledasLLNBorderRouterLBR),Router(R)and
Host(H):
Hchoosesonlythedefaultrouter
Rforwardstraffic
ROLLoperatesonlywithinLoWPAN andterminatesatLBR
7
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
RPL:newtrendinWSN
RoutingProtocolforLowpowerandLossy Network
(LLNs)
LLN:LowpowerandLossy networks(LLNs)aretypically
composedofmanyembeddeddeviceswithlimitedpower,memory,
andprocessingresourcesinterconnectedbyavarietyoflinks,such
asIEEE802.15.4orLowPowerWiFi.Thereisawidescopeof
applicationareasforLLNs,includingindustrialmonitoring,building
automation(HVAC,lighting,accesscontrol,fire),connectedhome,
healthcare,environmentalmonitoring,urbansensornetworks,
energymanagement,assetstrackingandrefrigeration
8
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
LLNs:Fact
LLNshavenottobeconfusedwithWirelessSensorNetworks
AWSNisanLLN,butnottheopposite!
LLNsarenotnecessarilywireless.
Industrialautomationnetworksarewired.
LLNswilluseIPv6.Nodiscussionsaboutthis.
IPv4isadeadhorse.
LLNnodescannotbeeasilyconfigured.
Typicallytheyrecheap,smallandwithverylimitedmemory/CPU
9
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
LLNs:OpenIssues
Transmissionefficiency(6lowpan)
Nodesrunonbattery.Savingenergyisapremium.IPv6Headersmust
becompressed.
Nodebootstrap(6lowpannd)
Configurationisanightmare,andnormalIPv6autoconfigurationis
toochatty,NS/NAaswell,etc,.
Routing(ROLL)
Routingrequirementsarescenariobased.Mainly:
onetoone(configuration,datareading)
manytoone(datagathering)
onetomany(datadissemination)
10
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
DAGandDODAG
DAG:DirectedAcyclicGraph(Fig.B)
DAGroot:anodewithintheDAGthathasnooutgoingedge
AllpathsterminatedataDAGroot
Alledgesareorientedinsuchawaythatnocyclesexist(Fig.Ais
notaDAG)
DODAG:DestinationOrientedDAG(Fig.C)
DefinesaDAGthatformspathstoasinglelogicalroot
11
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
WhyDODAGforRPL?
TrafficinLLN
MainlyforP2MPandMP2Ptrafficflows
Asopposedtoatreetopology,DODAGenables
(re)routearoundloss/interferenceandeasilyadapts
transientchanges
RPLorganizesatopologyasaDirectedAcyclicGraph
(DAG)thatispartitionedintooneormore
DestinationOrientedDAGs(DODAGs)
TherootinDAGactsasasinkP2MPandMP2Ptraffic
DODAGroot>LBR
Informationstoredandprocessingatothernodescanbereduced
12
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
UpwardandDownwardRoutes
Upward:thedirectionfromleafnodes
towardstheDODAGroot
DataflowtowardstheDAGrootMP2P
trafficflows
Downward:thedirectionfromthe
DODAGroottowardsleafnodes
DataflowawayfromtheDAGroot
P2MPtrafficflows
Pointtopointdataflowviaupand
downroute
UpwardRoute
13
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
RankvsOF
Rank:node'sindividualpositionrelativetoothernodeswith
respecttoaDODAGroot
IncreasesintheDowndirectionanddecreasesintheUpdirection
RankcomputeddependsontheObjectiveFunction (OF)e.g.
calculatedasasimpletopologicaldistance(hopcounts)ormayalsobe
calculatedasafunctionoflinkmetrics
ObjectiveFunction(OF):Definestheoptimizationobjectives
tocomputetheRank
Optimizationobjectives:minimizingenergy,minimizinglatency,or
satisfyingsomeconstraints,etc
Dictateshowrouters(parents)insidetheDODAGareselected
14
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
RPLInstance
RPLInstance:ComposedofoneormoredisjointDODAGs,eachof
whichhasanuniqueDODAGID
AllDODAGsinthesameRPLInstance usethesameOF(Objective
Function)
RPLInstanceID:identifiesasetofoneormoreDestinationOriented
DAGs(DODAGs)
RPLinstanceID canbeusedtoidentifydifferentOFs
RPLInstanceID andDODAGID uniquelyidentifiesasingleDODAGin
thenetwork
differentDODAGID=differentrootnode
15
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
DAGConstruction
DistanceVector
advertisepathcost(routing
metric)
chooseaparent(defaultrouter/
nexthop)thatminimizepathcost
Avoidsloops&counttoinfinity
Assigneverynodearank
NodeRank:Relativeposition
withinaDODAG
Rankstrictlydecreasingtowards
theroot
Parents&Siblings
Parentsnodeswithlowerranks
Siblingsnodeswithsameranks
16
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
DataPathValidation&LoopDetection
PPLpacketinformation(Up/Downroute)is
transportedwithadatapacket
Ondemandloopdetectionusingdata
packets
maintainingauptodateroutingtopologycan
wasteenergyforLLNswithinfrequentdata
Aninconsistencybetweentherouting
decisionforapacket(upwardordownward)
andtheRankrelationshipbetweenthetwo
nodesindicatesapossibleloop
E.g.ifS3receivesapacketflaggedasmoving
intheupwarddirection,andifthatpacket
recordsthatthetransmitter(S2)isofalower
Rank thanthereceivingnode(S3)
S3shouldinitiatealocalrepair
RPLdoesnotguaranteetheabsenceofloopsbutrathertriestoavoidthem
andspecifiesmechanismstodetectloopsviadatapathvalidation
17
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
CreationofUpwardroutes DIOmessages
SomenodesareconfiguredtobeDODAG
roots
DODAGrootsadvertisetheirpresence
(affiliationwithaDODAG,routingcost,and
relatedmetrics)bysendinglinklocal
multicast DIOmessagestoallRPLnodes
NodeslistenforDIOs
tojoinanewDODAG(thusselectingDODAG
parents),
ortomaintainanexistingDODAG,according
tothespecifiedObjectiveFunction
Nodesupdateroutingtableentries,forthe
destinationsspecifiedbytheDIOmessage
NodescandecidetojoinoneormoreDODAG
parentsasthenexthopforthedefaultroute
18
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
CreationofDownwardRoutes:DAOMessages
RPLusesDestinationAdvertisementObject
(DAO)messagestoestablishdownward
routes
DAOmessagesareanoptionalfeaturefor
applicationsthatrequireP2MPorP2P
traffic
RPLsupportstwomodesofdownward
traffic
Storing(fullystateful)
Nonstoring(fullysourcerouted)
19
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
StoringModevsNonStoringmode
Storingmode
Creationofroutes
DAOpropagatestowardstherootvia
therouters
Eachroutermaintainsroutestoeach
routerinWSNs
Datagoeshopbyhop(eachrouter
forwardsthepackettotherightnext
hop)
Nonsoringmode
Onlytherootstoresroutestotheall
routersinWSNs
Calculatesroutestoalldestinationby
piecingtogethertheinfo(addressof
therouters)collectedfromDAO
messages
Dataforwardsusingsourcerouting
20
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
StoringModevsNonStoringmode
Storingmode:
Requiresmorestoragecapacitiesandmemoryoneachrouter
Efficientcommunications
Extramechanismtoavoidloops(e.g.useofRPLpacketinformation)
Nonstoringmode:
Doesnotrequireadditionalstateontherouters,butincreasesthe
messageoverhead
Trafficthroughtherootnodeincreasesforinternaltraffic(e.g.P2P
trafficwithina6LoWPAN)
Loopcanbeavoidedbycheckingheaders?
Thedatapackettravelsuptoa
commonancestoratwhichpointitis
forwardedinthedowndirectionto
thedestination
21
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
RouteConstructionandForwarding
Uproutestowardsnodesofdecreasing
rank
ViaDAGparents(alwaysforwardtolower
rankwhenpossible)
mayforwardtosiblingifnolowerrank
exists
Downroutestowardsnodesof
increasingrank
Nodesinformparentsoftheirpresenceand
reachability
Forwardhopbyhop(storingmode)orusing
sourcerouting(nonstoringmode)
22
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
Summary:BuildingDODAG
RouterssendsDIO(DODAGInformationObject)messages
Useslinklocalmulticasting
Indicatesarespectiverank(=position),accordingtoametric
(e.g.hopcount)w.r.t.theroot
Upwardroutes(pathstowardstheroot)arecreated
Definestheoptimizationobjectivewhenformingupwardroute
Linkproperties:(Reliability,Latency),Nodeproperties:(Poweredor
not)
Objective:optimizepathsbasedononeormoremetrics
NodeissuesDAO(DestinationAdvertisementObject)
messages
PropagatesviaDAOparentsdiscoveredduringDIOpropagation
DAOcanbeacknowledged
Downwardroutesarecreate
23
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
DAGConstruction
LLNlinksaredepicted
LBRisconfiguredbythe
systemadministrator(There
couldbeseveralLBR)
Linksareannotatedw/ETX
RPLusesnewCMPv6
messages
DIO:DODAGInformationObject
DAO:DestinationAdvertisement
Object
DIS:DODAGInformation
Solicitation
A B C
E D F
G H I
1
3
2
1
1
1 1
1
4
1
1
1 1
1
1
LBR1
24
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
DAGConstruction
ObjectiveCodePointfor
example
Metric:ETX
Objective:MinimizeETX
Depthcomputation:Depth~ETX
Notethatapracticalcomputation
maybemorecoarse
A B C
E D F
G H I
1
3
2
1
1
1 1
1
4
1
1
1 1
1
1
LBR1
25
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
DAGConstruction
LBR1multicastsRADIO
NodesA,B,Creceiveand
processRADIO
NodesA,B,Cconsiderlink
metricstoLBR1andthe
optimizationobjective
Theoptimizationobjectivecan
besatisfiedbyjoiningtheDAG
rootedatLBR1
NodesA,B,CaddLBR1asa
DAGparentandjointheDAG
A B C
E D F
G H I
1
3
2
1
1
1 1
1
4
1
1
1 1
1
1
LBR1
RA:RouteAdvertisement
26
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
DAGConstruction
NodeAisatDepth1inthe
DAG,ascalculatedbythe
routineindicatedbythe
exampleOCP(Depth~ETX)
NodeBisatDepth3,NodeC
isatDepth2
NodesA,B,Chaveinstalled
defaultroutes(::/0)with
LBR1assuccessor
A B C
E D F
G H I
1
3
2
1
1
LBR1
1 1
1
4
1
1
1 1
1
1
27
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
C
DAGConstruction
TheRAtimeronNodeC
expires
NodeCmulticastsRADIO
LBR1ignoresRADIOfrom
deepernode
NodeBcanaddNodeCas
alternateDAGParent,
remainingatDepth3
NodeEjoinstheDAGat
Depth3byaddingNodeCas
DAGParent
A B
E D F
G H I
1
3
2
1
1
LBR1
1 1
1
4
1
1
1 1
1
1
Ifanodeisconfiguredtoactasarouter,itstartsadvertisingthegraphinformationtoitsneighbors
Aleafnode,itsimplyjoinsthegraphanddoesnotsendanyDIOmessage
28
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
DAGConstruction
LBR1multicastsDIO
NodeAisatDepth1,andcan
reach::/0viaLBR1withETX
1
NodeBisatDepth3,with
DAGParentsLBR1,andcan
reach::/0viaLBR1orCwith
ETX3
NodeCisatDepth2,::/0via
LBR1withETX2
NodeEisatDepth3,::/0via
CwithETX3
A B C
E D F
G H I
1
3
2
1
1
LBR1
1 1
1
4
1
1
1 1
1
1
29
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
DAGConstruction
C
TheRAtimeronNodeAexpires
NodeAmulticastsRADIO
LBR1ignoresRADIOfrom
deepernode
NodeBaddsNodeA
NodeBcanimprovetoamore
optimumpositionintheDAG
NodeBremoves LBR1,NodeC
asDAGParents
NodeBremoves (keepsas
backup)
::/0viaLBR1withETX3
::/0viaCwithETX3
Adds:
::/0viaAwithETX2
A B
E D F
G H I
1
3
2
1
1
LBR1
1 1
1
4
1
1
1 1
1
1
30
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
DAGConstruction
NodeAisatDepth1,::/0via
LBR1withETX2
NodeBisatDepth2,::/0via
AwithETX2
NodeCisatDepth2,::/0via
LBR1withETX2
NodeEisatDepth3,::/0via
CwithETX3
A B C
E D F
G H I
1
3
2
1
1
LBR1
1 1
1
4
1
1
1 1
1
1
31
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
DAGConstruction
DAGConstruction
continues
Andiscontinuously
maintained
Thisripplingeffectbuildsthe
graphedgesoutfromthe
roottotheleafnodeswhere
theprocessterminates
Eachnodeofthegraphhasa
routingentrytowardsits
parentinahopbyhop
fashion
Theleafnodecansenda
packetallthewaytorootof
thegraphbyjustforwarding
thepackettoitsimmediate
parent
A B C
E D F
G H I
1
3
2
1
1
LBR1
1 1
1
4
1
1
1 1
1
1
32
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
A
E D F
G H
MP2PTraffic viaUpwardRoute
MP2Ptrafficflowsinwards
alongDAG,towardDAGRoot
DAGRootmayalsoextend
connectivitytootherprefixes
beyondtheDAGroot,as
specifiedintheDIO
Nodesmayjoinmultiple
DAGsasnecessarytosatisfy
applicationconstraints
1
3
2
1
1
LBR1
1 1
1
4
1
1
1 1
1
1
I
B C
33
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
DownwardRouteandDestinationAdvertisements
DestinationAdvertisementsbuild
uproutingstateinsupportof
P2MPtrafficflowsoutward,from
thesinktoothernodes
DAusesthesameDAG
Forsimplicity,wewillfocusona
subsetofDAintheexample
Nodesinformparentsoftheir
presenceandreachabilityto
descendantsbysendingaDAO
message
Nodecapableofmaintaining
routingstate>Aggregateroutes
Nodeincapableofmaintaining
routingstate>attachanexthop
addresstothereverseroutestack
containedwithintheDAOmessage
A B C
E D F
G H I
1
3
2
1
1
LBR1
1 1
1
4
1
1
1 1
1
1
34
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
DestinationAdvertisements
Somenodesmaybeableto
storeroutingstateforoutward
flows(LBR1,A,F)
Somenodesmaynot(B,D)
Somenodesmayhavea
limitedability;DAsmay
indicateapriorityforstorage
A B
D F
G H
1
LBR1
1
1
1
1
1
1
35
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
DestinationAdvertisements
DAsmaybetriggeredbyDAG
rootornodewhodetectsa
change
DAtimersconfiguredsuch
thatDAsstartatgreater
depth,andmayaggregateas
theymoveup
A B
D F
G H
1
LBR1
1
1
1
1
1
1
36
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
DestinationAdvertisements
LBR1triggersDestination
AdvertisementmechanisminDIO
GemitsNAtoFwithDAO
indicatingreachabilityto
destinationprefixG::
FstoresG::viaG
HemitsNAtoFfordestination
prefixH::
FstoresH::viaH
1
LBR1
1
1
1
1
1
1
H
A B
D F
G
NA:NeighborAdvertisement
37
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
G
DestinationAdvertisements
SupposeinthisexampleFhasa
prefixF*::capableofaggregating
{F::,G::,H::}
Themethodtoprovisionsuchaprefixis
beyondthescopeofRPL
FemitsNAtoDwithDAOindicating
reachabilitytodestinationprefixF*::
Dcannotstore
(continued)
A B
D F
H
1
LBR1
1
1
1
1
1
1
38
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
F
G
A
H
DestinationAdvertisements
DaddsFtotheReverseRouteStack
intheDAO,andpassesDAOontoB
forF*::[F]
DalsoemitsaDAOindicatingprefix
D::toB
Bcannotstoreroutingstate
(continued)
1
LBR1
1
1
1
1
1
1
B
D
39
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
DestinationAdvertisements
BaddsDtotheReverseRoute
StackintheDAOforD::,andpasses
DAOD::[D]ontoA
AstoresD::viaB,withthe
piecewisesourceroute[D]
BalsoemitsaDAOindicatingprefix
B::toA
AstoresB::viaB
(continued)
1
LBR1
1
1
1
1
1
1
D F
G H
B A
40
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
DestinationAdvertisements
AemitsDAOstoLBR1for
destinationprefixesA::,B::,D::,
andF*
LBR1storesA::viaA,B::viaA,
D::viaA,andF*::viaA
AstoredB::viaB,D::viaB[D],
F*viaB[D,F]
B,Dstorednothing
FstoredG::viaG,H::viaH
1
1
1
1
1
1
1
B
LBR1
D F
G H
A
41
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
P2MPTraffic
Theroutingstatesetupby
DestinationAdvertisementisused
todirectP2MPtrafficoutward
LBR1directstrafficforG(F*::)toA
Aaddssourceroutingdirective,[D,
F],andforwardstoB
Busessourceroutingdirectiveto
forwardtoD...
1
1
1
1
1
1
1
F
G H
A B
LBR1
D
42
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
P2MPTraffic
Dusessourceroutingdirectiveto
forwardtoF
FusesroutingstatetoforwardtoG
Notetheuseofsourceroutingto
traversethestatelessregionofthe
LLN
Thedetailsofthesourcerouting
mechanismarestilltobedefined
1
1
1
1
1
1
1
D F
G H
A B
LBR1
43
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
Bydefault,P2Ptrafficfollows
thedefaultrouteuntilanode
isencounteredwhohasa
moreexplicitroute
P2Ptrafficflowsinwards
alongtheDAGuntila
commonnodeisreachedto
directthetrafficoutwards
P2PTraffic
1
3
2
1
1
1 1
1
4
1
1
1 1
1
1
A
E D F
G H
LBR1
I
B C
44
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
Thedefaultschemeallows
P2Ptrafficwithminimalstate
requiredofnodes butis
notappropriateinallcases
MoreoptimalP2Proutes
maybecomputedand
installediftheapplication
requires
RPLdoesnotspecifynor
precludesuchamechanismat
thistime
P2PTraffic
1
3
2
1
1
1 1
1
4
1
1
1 1
1
1
A
E D F
G H
LBR1
I
B C
45
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
Considerthecasewherethe
linkBDgoesbad
NodeDwillremoveBfrom
itsDAGparentset
NodeDnolongerhasany
DAGparentsinthegrounded
DAG,soitwillbecomethe
rootofitsownfloatingDAG
DAGMaintenance:FloatingDAG
1
3
2
1
1
1 1
1
4
1
1
1 1
1
1
A
E D F
G H
LBR1
I
B C
46
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
NodeDmulticastsanRADIO
toinformitssubDAGofthe
change
NodeIhasanalternateDAG
Parent,E,anddoesnothave
toleavetheDAGrootedat
LBR1.
NodeIremovesNodeDasa
DAGParent
DAGMaintenance:FloatingDAG
1
3
2
1
1
1 1
1
4
1
1
1 1
1
1
A
E
G H
LBR1
B C
F
I
D
47
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
NodeFdoesnothavean
optiontostayintheDAG
rootedatLBR1(noalternate
DAGParents),soNodeF
followsNodeDintothe
floatingDAG
NodeFmulticastsanRADIO
NodesGandHfollowNodeF
intothefloatingDAG
DAGMaintenance:LocalRepair
1
3
2
1
1
1 1
1
4
1
1
1 1
1
1
A
E
LBR1
B C
I G H
F D
48
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
ThesubDAGofnodeDhas
nowbeenfrozen
Nodescontainedinthesub
DAGhavebeenidentified,
andbyfollowingnodeDinto
thefloatingDAG,allold
routestoLBR1havebeen
purged
ThefloatingDAGseeksto
rejoinagroundedDAG
DAGMaintenance:LocalRepair
1
3
2
1
1
1 1
1
4
1
1
1 1
1
1
A
E
LBR1
B C
I G H
F D
49
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
NodeImulticastsanRADIO
NodeDseesachanceto
rejoingroundedDAGat
depth5throughNodeI
NodeDstartsaDAGHop
timerofduration 4
associatedwithNodeI
DAGMaintenance
1
3
2
1
1
1 1
1
4
1
1
1 1
1
1
A
LBR1
G H
F E
B C
D
I
50
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
SupposealinkAFbecomes
viable
NodeAmulticastsanRADIO
NodeFseesachanceto
rejoingroundedDAGat
depth2throughNodeA
NodeFstartsaDAGHop
timerofduration 1
associatedwithNodeA
DAGMaintenance
1
3
2
1
1
1 1
1
4
1
1
1 1
1
1
1
I
A
LBR1
G H
F E
B C
D
51
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
NodeFsDAGHopTimer
expires
NodeFjoinstothegrounded
DAGatdepth2byaddingA
asaDAGparent,and
removingD
NodeFmulticastsanRADIO
NodesGandHfollowNodeF
tothegroundedDAG
DAGMaintenance:LoopAvoidance
1
3
2
1
1
1 1
1
4
1
1
1 1
1
1
1
I
LBR1
E
B C A
G H
F D
52
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
NodeDseesachanceto
rejoinDAGLBR1atdepth3
throughNodeF
NodeDstartsaDAGHop
timerofduration 2
associatedwithNodeF,in
additiontheDAGHoptimer
alreadyrunningwith
duration 4associatedwith
NodeI
DAGMaintenance:LoopAvoidance
1
3
2
1
1
1 1
1
4
1
1
1 1
1
1
1
I
LBR1
E
B C A
G H
F D
53
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
NodeDsDAGHoptimerof
duration 2tendstoexpire
first
NodeDjoinsthegrounded
DAGatdepth3byadding
NodeFasaDAGParent
Thebreakingoffandre
joiningofthebrokensub
DAGisthuscoordinatedwith
loopavoidance
DAGMaintenance:LoopAvoidance
1
3
2
1
1
1 1
1
4
1
1
1 1
1
1
1
I
LBR1
E
B C A
G H
F D
54
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
Twomechanismstoavoidcounttoinfinity
FloatingDAG
LeaveDAG,colorsubDAG,thenlookfornewroutes
Operationlocaltonodesthatmustincreasetheirdepth
Doesnotguaranteeloopfreedom
Sequencenumberchange
Loopfreedom,butexpensivenetworkwideoperation
Usedinfrequentlyifpossible
Loop Avoidance
55
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
RPL:summary
Workingwith6LoWPAN
SupportIPbasedApplication
SupportP2MP,MP2Ptraffic
Routingstateisminimized:statelessnodeshavetostoreonly
instance(s)configurationparametersandalistofparent
nodes
Takesintoaccountbothlinkandnodepropertieswhen
choosingpaths
Linkfailuresdoesnottriggerglobalnetworkreoptimization
56
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
ProtocolStackforWSNs
Whatdoesmissingintheprotocolstack?
PHY/MAC802.15.4
Adaptation:6LoWPAN
Routing:RPL
Transport:UDP
ApplicationProtocol?
IPprovidespacketnetworkingoverheterogeneouslinks
UDP:Besteffort(packetsmaybesilentlydropped,duplicatedor
delayedandmayarriveoutoforder) thefastestandmostsimpleway
oftransmittingdata
TCP:Reliableconnectionoriented
IPusesSocketCommunication:endpointsaredefinedby16bit
sourceanddestinationportsandsourceanddestinationIPaddresses
57
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
IPbasedApplicationProtocols
Widelyusedinternetprotocols(TCP,HTTP,FTP;SIPand
SOAP)
Considerableworkhastobedoneforadaptingto6LoWPAN
ExistingprotocolsforWSNs(mainlybasedonUDP)
MQTT:MessageQueueTelemetryTransportisdevelopedby
IBM
CAP:ZigBeeCompactapplicationProtocol
SLP:simpleServiceLocationProtocol
Etc..
58
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
IPbasedApplicationProtocols
IPbasedapplicationprotocolsover6LoWPAN
6LoWPANsupportsthecompressionofUDPportsdownto
arangeof16
shouldbeenoughforlimitednumberofapplicationsthatcanbe
run
TCPheaderisnoteasytocompress
TCPisnotefficientoverlossywirelessmultihopnetworks
WhyUDPfor6LoWPAN?
Simple,compressibleandsuitsmostapplicationprotocols
needs
Multicastsupport
Reliability?
59
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
ApplicationProtocolsforWSNs
MQTT(MessageQueueTelemetryTransport)byIBM
Lightweightpublish/subscribeprotocoloverTCP/IP
Fixedlengthheader(2bytes)
Onetomanymessagedistribution
3QoS formessagedelivery(Atmostonce,atleastonce,exactly
once)
Applications,e.g.FacebookMessenger
XMLbasedprotocols(SOAP)
M2MXML
MessagesarestrictASCII
Devicesareidentifiedby128bitUUID
BiTXml
RESTful protocols
HTTP
CoAP
60
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
DesignIssues
LinkLayer
Payloadsize,limited
bandwidth,lossy
Multicastsupport
Networking
LimitedcompressedUDPport
Hostissues
Sleepingcycles
Identification(64bit,16bit
addresses)
Compression
Headerandpayload
compression
Endtoendorbyan
intermediatenode
Security
Applicationlayersecurity
Firewallingattheedgerouter
61
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
WebService
Defactoforinterserver
communications
AllInternetserversspeakHTTP/XML
SOAPorRESTarchitecture
Advantages
Formalmessagesequences
Internetwidesupport
MostInternetapplicationsuseweb
services,whichdependonthebasic
RepresentationalStateTransfer(REST)
architecture
Disadvantagesforembeddedservices
Inefficient,complex
62
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
RESTArchitecture
RepresentationalStateTransfer(REST)
Describesclientserverandcacheablecommunications
protocol,suchasHTTP,tomakesimplecallsbetweennetwork
devices
RESTstylearchitecturesconsistofclientsandservers
Clientsinitiaterequeststoservers
Serversprocessrequestsandreturnappropriateresponses
Requestsandresponsesarebuiltaroundthetransferof
representationsofresources
Resources:mostlyidentifiedbyitsURI(Uniform
ResourcesIdentifier)
Resourcesmaybewebaddress,aphysicalresourceorsimply
adocumentlocatedsomewhereonaserver
Representations:tomanipulateresources
Representationdefinestheformatoftheresource
TypicalrepresentationsareHTML,XMLorJSON,
butmaybealsobinary,plaintext,MIMEtypes,etc
Methods:allowsclientstoretrieve,modifyordelete
resourcesbyuseoftheirrepresentations
Thebasicoperations/methodsonaresourceareGET,PUT,
POSTandDELETE
63
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
Resource
Protocols(e.g.HTTP,CoAP)
Sourcesofspecificinformation
(e.g.sensors,webcontent)
IdentifiedbyanUniform
ResourceIdentifier(URI)
Manipulationthrough
Methods(e.g.GET,PUT)
Representedasjpg,plaintext,
etc
64
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
WebServicesforWSNs
Todayswebservicesarenogoodforembeddedsystems
FTP,HTTP,XML,SOAP
Webservicesforembeddeddevices
RESTful architectureforgoodwebintegration
UDPbasedtransportwithmulticastsupport
Overheadsuitableforconstrainednetworks
Complexitysuitableforconstrainednodes
Builtinwebdiscoveryandsecurity
TheConstrainedRESTful Environments(CoRE)working
groupaimsatrealizingtheRESTarchitecturefor
constrainednodesandnetworks
e.g.8bitmicrocontrollerswithlimitedRAMandROM
networks(e.g.6LoWPAN)
65
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
CoAP:ConstrainedApplicationProtocol
Aspecializedwebtransferprotocolforusewithconstrained
networksandnodes
M2Mapplications(smartenergy,buildingautomation,etc)
Tomonitorsimplesensors(e.g.temperaturesensors,lightswitches,and
powermeters)
Tocontrolactuators(e.g.lightswitches,heatingcontrollers,anddoor
locks)
Tomanagedevices
Embeddedwebtransferprotocol(coap://)
Asynchronoustransactionmodel
UDPbindingwithreliabilityandmulticastsupport
GET,POST,PUT,DELETEmethods
URIsupport
Small,simpleheader<10bytes
SubsetofMIMEtypesandHTTPcompatibleresponsecodes
Optionalobservation,blocktransferanddiscovery
66
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
WhatisCoAP (andisnot)?
CoAP is
ARESTful protocol
Bothsynchronousandasynchronous
Forconstraineddevicesandnetworks
SpecializedforM2Mapplications
Easytoproxyto/fromHTTP
CoAP isnot
AreplacementforHTTP
GeneralHTTPcompression
Separatefromtheweb
67
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
COREArchitecture
UseofwebservicesontheInternet
dependsontheRepresentational
StateTransfer(REST)architecture
RESTful protocoltocaterthespecial
requirementsofaconstrained
environment
SimpleRESTful protocoltransport
Create,Read,Update,Delete,Notify
Small,simpleheader
4bytebaseheader
TLVoptions,typically1270bytesper
option
URIsupport:e.g.
coap://fec0::1:5683/temp
Subsetofcontenttypes
SubsetofHTTPcompatibleresponse
codes
UDPbindings
defaultport=5683
C:Constrainednode sensor
nodes
Nonconstrainednodes server,
proxy,node,etc
68
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
CoAP Requirements
69
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
TheTransactionModel
Transport
CoAP isdefinedforUDP
Messaging
Simplemessageexchangebetween
endpoints
CON,NON,ACK,RST
REST
Request/Responsepiggybackedon
messages
Method,ResponseCodeandOptions
(URI,contenttypeetc.
70
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
MethodsofCoAP
GET:retrievestheinformationoftheresourceidentifiedby
therequestURI
PUT:requeststhatthefile/resourceidentifiedbytherequest
URItobeupdatedwiththeenclosedmessagebody.Ifdoes
notexsist,itcreatesanewresource
POST:Submitsdatatobeprocessedtotheidentified
resource.Thedataisincludedinthebodyoftherequest.This
mayresultinthecreationofanewresourceortheupdatesof
existingresourcesorboth
DELETE:requeststhattheresourceidentifiedbytherequest
URItobedeleted
71
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
CoAP MessageFormat
Ver:Version,
T:TransactionType
(CON,NON,ACK)
OC:Numberofoptions
Code:Methodor
ResponseCode
MessageID:AuniqueID
assignedbytheoriginator
OptionDelta Difference
betweenthisoptiontype
andtheprevious!
Length Lengthofthe
optionvalue(0270)!
Value Thevalueof
Lengthbytes
immediatelyfollows
Length
MessageFormat
OptionHeader
72
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
CoAP Code
Structureofthe8bit
Responsecode:
3classes:
2 Success
4 Clienterror
5 Servererror
Example:"NotFound"is
writtenas4.04 indicating
avalueofdecimal132
73
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
ExampleofCoAP Message
74
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
TransactionMessagesofCoAP
Confirmable(CON)
Toknowitdidarriveortodeliver
thereply
ReturnmessagetypeACK/RST
Acknowledgment(ACK)
ACKtotheCONmessage(identified
byamessageID)
Payloadcarriesmoredata
Reset(RST)
TolettheclientknowtheCON
messageisreceived,butprocessing
failed
E.g.nodehasrebooted
NonConfirmable(NON)
DonotrequireanACK
E.g.repeatedreadingsfroma
sensor
75
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
CoAP Operation
CoAP interactionissimilartotheclient/servermodel
(CoAP endpoints)
URIandContenttypesupport(likeinHTTP)
MessageexchangeissimilartoHTTP
Requestactionisoriginatedbyaclient(usingaMethod
code)
RequestisforaResource(identifiedbyaURI)onaserver
ResponseissentwithaResponseCode
76
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
CoAP Operation
UnlikeHTTP,CoAP deals
OperatesoverUDP,withreliableunicast
andmulticastsupport
Retransmission(=reliableunicast)ACoAP end
pointkeepstrackofopenConfirmable
messagesitsentthatarewaitingforaresponse
SimpleCongestionControl exponentialback
offmechanism
Dealswithmessageinterchanges
seperately
Servermightneedlongertimetoobtainthe
representationofresource.Thisresultsinthe
clientretransmittingtherequest
77
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
CoAP Operation
OperatesoverUDP,with
reliableunicastandbest
effortmulticastsupport
CONvsNONmessages?
IfCON/NONmessages
cannotbeprocessed,
ServersendsRST
message
WhyMID&Token?
78
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
CoAP Options
ContentType:Specifiestheformatoftheapplicationpayload
MaxAge:Maximumageforamessagetobecached
ProxyUri:DefinesanabsoluteURItoaproxy
Token:Matchesaseparateresponsetoarequest
UriHost:SpecifiestheInternethostofaresource(onlyadded
ifnotrepresentingthedestinationIPaddressoftherequest)
UriPath:Specifiestheresourceofthehost
UriPort:Specifiestheportofthehost(onlyaddedifdiffers
fromthedestinationUDPportrequest)
UriQuery:Indicatesadditionaloptionsfortherequest
Etc..
79
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
RequestExample
RequestandResponse
CONmessage
NONmessage
Dealingwithpacketloss
80
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
RequestExample
Normalresponse
81
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
Caching
CoAP includesasimplecaching
model
Cacheability determinedby
responsecode
Freshnessmodel
MaxAgeoptionindicatescache
lifetime
Validationmodel
ValiditycheckedusingtheEtag
Option
Aproxyoftensupportscaching
Usuallyonbehalfofasleeping
node,
andtoreducenetworkload
82
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
Observation
TheObserveOption,when
present,modifiestheGETmethod
soitdoesnotonlyretrievea
representationofthecurrentstate
oftheresourceidentifiedbythe
requestURI,butalsorequeststhe
servertoaddtheclienttothelistof
observersoftheresource.
Inaresponse,theObserveOption
identifiesthemessageasa
notification,whichimpliesthatthe
clienthasbeenaddedtothelistof
observersandthattheserverwill
notifytheclientoffurtherchanges
totheresourcestate
83
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
BlockTransfer
Transferslargerthancanbeaccommodatedinconstrainednetworklink
layerpacketscanbeperformedinsmallerblocks.
Nohardtomanageconversationstateiscreatedattheadaptationlayer
orIPlayerforfragmentation.
84
Telecomm.Dept.
FacultyofEEE
WSN2013
HCMUT
ResourceDiscovery
ResourceDiscoverywithCoRE
LinkFormat
WeblinkingasperRFC5988
Discoveringthelinkshostedby
CoAP servers
GET/.wellknown/core
Returnsalinkheaderstyle
format
URL,relation,type,interface,
contenttypeetc.

You might also like