[ndnSIM] SINR packet tag in ndnSIM 2.5

Spyridon (Spyros) Mastorakis mastorakis at cs.ucla.edu
Sat Jul 28 20:16:48 PDT 2018


Hi Thiago,

that might require some hacking.

I think that this might be the right place to start:

https://github.com/named-data-ndnSIM/ndnSIM/blob/master/model/ndn-net-device-transport.cpp#L119 <https://github.com/named-data-ndnSIM/ndnSIM/blob/master/model/ndn-net-device-transport.cpp#L119>

In ndnSIM, each simulated node receives NS-3 packets from others and the NDN packets are encapsulated into NS-3 packets. The above method is called when an NS-3 packet is received by a node and extracts the NDN packet from the NS-3 packet. I would guess that the tag you are talking about might be attached to the received NS-3 packet. If my intuition is right, you should be able to extract it in this method and store it for later or pass it to the strategy.

Hope this helps,

Spyridon (Spyros) Mastorakis
Personal Website: http://cs.ucla.edu/~mastorakis/ <http://cs.ucla.edu/~mastorakis/>
Internet Research Laboratory
Computer Science Department
UCLA

> On Jul 27, 2018, at 12:21 PM, Thiago Teixeira <tteixeira at umass.edu> wrote:
> 
> Hi Spyros,
>  
> Thanks for your email. In summary, we added a SINR packet tag on the node’s WiFi interface, which we want to read the value in the strategy layer. The issue is that we could not find a method to read the SINR tag in the strategy. We are able to create and use other using the NDNLP (as your commits show). The problem is that the SINR tag is a NS-3 tag (not ndnlp).
> And yes, we are not using sockets whatsoever. 
>  
> Regarding your last sentence, do you have any documentation or examples on how to make sure the NS-3 tag is preserved in the NDN packet?
>  
> I tried this in the strategy,
>     std::shared_ptr<ns3::SnrTag> tag;
>     auto sinrTag = interest. template getTag <ns3::ndn::Ns3PacketTag> ();
>     bool hasTag = sinrTag.getPacket().PeekPacketTag(tag);
>  
> but I get,
>     error: ‘class std::shared_ptr<ns3::ndn::Ns3PacketTag>’ has no member named ‘getPacket’
>  
>  
> Thanks for your help,
>  
> Thiago
>  
>   <>
> From: Spyridon (Spyros) Mastorakis [mailto:mastorakis at cs.ucla.edu] 
> Sent: Friday, July 27, 2018 2:20 PM
> To: Rajvardhan Deshmukh <rdeshmukh at umass.edu>
> Cc: NdnSIM <ndnSIM at lists.cs.ucla.edu>; Thiago Teixeira <tteixeira at umass.edu>
> Subject: Re: [ndnSIM] SINR packet tag in ndnSIM 2.5
>  
> Hi,
>  
> I am not sure I understand what you are trying to do.
>  
> It seems to me that you are using sockets and some TCP application, but you are trying to use NDN?
>  
> If you want to use an NS-3 tag, you will have to make sure that when you try to get the NDN packet out of the NS-3 packet, you have to preserve the tag. 
>  
> Thanks,
>  
> Spyridon (Spyros) Mastorakis
> Personal Website: http://cs.ucla.edu/~mastorakis/ <http://cs.ucla.edu/~mastorakis/>
> Internet Research Laboratory
> Computer Science Department
> UCLA
>  
> On Jul 24, 2018, at 11:32 AM, Rajvardhan Deshmukh <rdeshmukh at umass.edu <mailto:rdeshmukh at umass.edu>> wrote:
>  
> Hi Spyros,
> 
> We intend to access the SINR/SNR in the forwarding strategy.
> 
> 1) As i was going through the links <https://github.com/named-data-ndnSIM/NFD/commit/3bebd1190b1c45f8acaa0fe1d3a3100651a062e4#diff-bcc8f3e64bcd66371436f906a83e51b5> Spyros sent, i noticed that they use an interest or data object with API setTag. But we don't have access to those objects in the PHY (wifi) layer. So i'm not sure as to which object i should use the SetTag API. Should we pursue this line of thoughts?
>  
> We also looked at ns3 related posts.
> 2) So, we looked at ns3 related posts, which suggest that we need to attach the SNR value to the Packet in the PHY layer.
> We added a SINR packet tag in the src/wifi/model/wifi-phy.cc <http://wifi-phy.cc/> EndReceive() method using the following snippet:
> 
>   SnrTag tag;
> 
>   tag.Set(signalNoise.signal - signalNoise.noise);
> 
>   if (! packet->PeekPacketTag (tag)){
> 
>      packet->AddPacketTag (tag);
> 
>   }
> 
> The implementation of the SINR packet tag is available at src/wifi/model/snr-tag.cc <http://snr-tag.cc/>.
> But we get an error during reading this Tag in the forwarding strategy:
>  
>  
> ns3::Ptr<ns3::Socket>m_socket=node->GetObject<ns3::Socket>(); //(line of concern)                                    
> ns3::Ptr<ns3::Packet>packet=m_socket->Recv();                                                                                                                     
> ns3::SnrTag tag;                                                                                      
> if(packet->PeekPacketTag(tag)){                                                                      
>         NS_LOG_DEBUG ("Received Packet with SRN = " << tag.Get());                                          
>        
> std::cout<< "\nSNR:"<< tag.Get()<< std::endl;                                                       
>                                                                                                            
> }
> Note: I think we get to get the right socket (check line of concern) using something similar to what they do in the application layer in ns3 (GetObject<OnOffApplication> ()->GetSocket ())
>  
> Can you assist please? Let me know if you need more info.
>  
> Thanks,
> Raj
> -------------------------------------------------------------------
> FROM: Spyridon (Spyros) Mastorakis [mailto:mastorakis at cs.ucla.edu <mailto:mastorakis at cs.ucla.edu>] 
> SENT: Monday, July 23, 2018 9:43 PM
> TO: Thiago Teixeira <tteixeira at umass.edu <mailto:tteixeira at umass.edu>>
> CC: ndnsim <ndnsim at lists.cs.ucla.edu <mailto:ndnsim at lists.cs.ucla.edu>>
> SUBJECT: Re: [ndnSIM] SINR packet tag in ndnSIM 2.5 
> 
> Hi Thiago,
> 
> I think we have converted our NS-3 tags to NDN Link Protocol (LP) tags.
> For more details, take a look at these commits (HopCount tag): 
> 
> https://github.com/named-data-ndnSIM/NFD/commit/3bebd1190b1c45f8acaa0fe1d3a3100651a062e4 <https://github.com/named-data-ndnSIM/NFD/commit/3bebd1190b1c45f8acaa0fe1d3a3100651a062e4>
> 
> 
> https://github.com/named-data-ndnSIM/ndn-cxx/commit/e1ae096efd8ad503ce7dbd616ee174afaed6c66b <https://github.com/named-data-ndnSIM/ndn-cxx/commit/e1ae096efd8ad503ce7dbd616ee174afaed6c66b>
> 
> 
> Thanks, 
> 
> Spyridon (Spyros) Mastorakis
> Personal Website: http://cs.ucla.edu/~mastorakis/ <http://cs.ucla.edu/~mastorakis/>
> Internet Research Laboratory
> Computer Science Department
> UCLA 
> 
> 
> On Jul 23, 2018, at 2:52 PM, Thiago Teixeira <tteixeira at umass.edu <mailto:tteixeira at umass.edu>>
> wrote: 
> Hi Spyros,
> 
> We intend to access the SINR/SNR in the forwarding strategy.
> 
> 1) As i was going through the links <https://github.com/named-data-ndnSIM/NFD/commit/3bebd1190b1c45f8acaa0fe1d3a3100651a062e4#diff-bcc8f3e64bcd66371436f906a83e51b5> Spyros sent, i noticed that they use an interest or data object with API setTag. But we don't have access to those objects in the PHY (wifi) layer. So i'm not sure as to which object i should use the SetTag API.
>  
> 
> 
> 2) So, we looked at ns3 related posts, which suggest that we need to attach the SNR value to the Packet in the PHY layer.
> We added a SINR packet tag in the src/wifi/model/wifi-phy.cc <http://wifi-phy.cc/> EndReceive() method using the following snippet:
> 
>   SnrTag tag;
> 
>   tag.Set(signalNoise.signal - signalNoise.noise);
> 
>   if (! packet->PeekPacketTag (tag)){
> 
>      packet->AddPacketTag (tag);
> 
>   }
> 
> The implementation of the SINR packet tag is available at src/wifi/model/snr-tag.cc <http://snr-tag.cc/>.
> But we get an error during reading this Tag in the forwarding strategy:
>  
>  
> ns3::Ptr<ns3::Socket>m_socket=node->GetObject<ns3::Socket>();                                     
> ns3::Ptr<ns3::Packet>packet=m_socket->Recv();                                                                                                                     
> ns3::SnrTag tag;                                                                                      
> if(packet->PeekPacketTag(tag)){                                                                      
>         NS_LOG_DEBUG ("Received Packet with SRN = " << tag.Get());                                          
>        
> std::cout<< "\nSNR:"<< tag.Get()<< std::endl;                                                       
>                                                                                                            
> }
> Note: I think we get to get the right socket using something similar to what they do in the application layer in ns3 (GetObject<OnOffApplication> ()->GetSocket ())
>  
> Can you assist please?
>  
> Thanks,
> Raj
> -------------------------------------------------------------------
> FROM: Spyridon (Spyros) Mastorakis [mailto:mastorakis at cs.ucla.edu <mailto:mastorakis at cs.ucla.edu>] 
> SENT: Monday, July 23, 2018 9:43 PM
> TO: Thiago Teixeira <tteixeira at umass.edu <mailto:tteixeira at umass.edu>>
> CC: ndnsim <ndnsim at lists.cs.ucla.edu <mailto:ndnsim at lists.cs.ucla.edu>>
> SUBJECT: Re: [ndnSIM] SINR packet tag in ndnSIM 2.5 
> 
> Hi Thiago,
> 
> I think we have converted our NS-3 tags to NDN Link Protocol (LP) tags.
> For more details, take a look at these commits (HopCount tag): 
> 
> https://github.com/named-data-ndnSIM/NFD/commit/3bebd1190b1c45f8acaa0fe1d3a3100651a062e4 <https://github.com/named-data-ndnSIM/NFD/commit/3bebd1190b1c45f8acaa0fe1d3a3100651a062e4>
> 
> 
> https://github.com/named-data-ndnSIM/ndn-cxx/commit/e1ae096efd8ad503ce7dbd616ee174afaed6c66b <https://github.com/named-data-ndnSIM/ndn-cxx/commit/e1ae096efd8ad503ce7dbd616ee174afaed6c66b>
> 
> 
> Thanks, 
> 
> Spyridon (Spyros) Mastorakis
> Personal Website: http://cs.ucla.edu/~mastorakis/ <http://cs.ucla.edu/~mastorakis/>
> Internet Research Laboratory
> Computer Science Department
> UCLA 
> 
> 
> On Jul 23, 2018, at 2:52 PM, Thiago Teixeira <tteixeira at umass.edu <mailto:tteixeira at umass.edu>>
> wrote: 
> 
> Hi all, 
> 
> We added a SINR packet tag in the src/wifi/model/wifi-phy.cc <http://wifi-phy.cc/> [1 <https://github.com/named-data-ndnSIM/ns-3-dev/blob/ndnSIM-v2.5/src/wifi/model/wifi-phy.cc#L2541>]
> EndReceive() method using the following snippet: 
> 
> SnrTag tag; 
> 
> tag.Set(signalNoise.signal - signalNoise.noise); 
> 
> if (! packet->PeekPacketTag (tag)){ 
> 
> packet->AddPacketTag (tag); 
> 
> } 
> 
> The implementation of the SINR packet tag is available at
> src/wifi/model/snr-tag.cc <http://snr-tag.cc/> [2 <https://github.com/named-data-ndnSIM/ns-3-dev/blob/ndnSIM-v2.5/src/wifi/model/snr-tag.cc>]. 
> 
> We would like to get the value of the tag in the forwarding strategy.
> Before ndnSIM 2.3, we could just use something like this: 
> 
> SnrTag tag; 
> 
> Ptr<Packet> payload = ConstCast<Packet>(interest->GetPayload()); 
> 
> payload->PeekPacketTag (tag); 
> 
> but in ndnSIM 2.5 we could not find an equivalent method. I think we
> need to convert the SINR tag to type ns3::ndn::ns3PacketTag, is that
> correct? 
> 
> Can you assist please? 
> 
> Thanks, 
> 
> Thiago 
> 
> _______________________________________________
> ndnSIM mailing list
> ndnSIM at lists.cs.ucla.edu <mailto:ndnSIM at lists.cs.ucla.edu>
> http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim <http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim> [3 <http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim>]
> 
>   
> 
> Links:
> ------
> [1] https://github.com/named-data-ndnSIM/ns-3-dev/blob/ndnSIM-v2.5/src/wifi/model/wifi-phy.cc#L2541 <https://github.com/named-data-ndnSIM/ns-3-dev/blob/ndnSIM-v2.5/src/wifi/model/wifi-phy.cc#L2541>
> [2] https://github.com/named-data-ndnSIM/ns-3-dev/blob/ndnSIM-v2.5/src/wifi/model/snr-tag.cc <https://github.com/named-data-ndnSIM/ns-3-dev/blob/ndnSIM-v2.5/src/wifi/model/snr-tag.cc>
> [3] http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim <http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim>
> 
> 
> Hi all, 
> 
> We added a SINR packet tag in the src/wifi/model/wifi-phy.cc <http://wifi-phy.cc/> [1 <https://github.com/named-data-ndnSIM/ns-3-dev/blob/ndnSIM-v2.5/src/wifi/model/wifi-phy.cc#L2541>]
> EndReceive() method using the following snippet: 
> 
> SnrTag tag; 
> 
> tag.Set(signalNoise.signal - signalNoise.noise); 
> 
> if (! packet->PeekPacketTag (tag)){ 
> 
> packet->AddPacketTag (tag); 
> 
> } 
> 
> The implementation of the SINR packet tag is available at
> src/wifi/model/snr-tag.cc <http://snr-tag.cc/> [2 <https://github.com/named-data-ndnSIM/ns-3-dev/blob/ndnSIM-v2.5/src/wifi/model/snr-tag.cc>]. 
> 
> We would like to get the value of the tag in the forwarding strategy.
> Before ndnSIM 2.3, we could just use something like this: 
> 
> SnrTag tag; 
> 
> Ptr<Packet> payload = ConstCast<Packet>(interest->GetPayload()); 
> 
> payload->PeekPacketTag (tag); 
> 
> but in ndnSIM 2.5 we could not find an equivalent method. I think we
> need to convert the SINR tag to type ns3::ndn::ns3PacketTag, is that
> correct? 
> 
> Can you assist please? 
> 
> Thanks, 
> 
> Thiago 
> 
> _______________________________________________
> ndnSIM mailing list
> ndnSIM at lists.cs.ucla.edu <mailto:ndnSIM at lists.cs.ucla.edu>
> http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim <http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim> [3 <http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim>]
> 
>   
> 
> Links:
> ------
> [1] https://github.com/named-data-ndnSIM/ns-3-dev/blob/ndnSIM-v2.5/src/wifi/model/wifi-phy.cc#L2541 <https://github.com/named-data-ndnSIM/ns-3-dev/blob/ndnSIM-v2.5/src/wifi/model/wifi-phy.cc#L2541>
> [2] https://github.com/named-data-ndnSIM/ns-3-dev/blob/ndnSIM-v2.5/src/wifi/model/snr-tag.cc <https://github.com/named-data-ndnSIM/ns-3-dev/blob/ndnSIM-v2.5/src/wifi/model/snr-tag.cc>
> [3] http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim <http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20180728/01ba96fc/attachment-0001.html>


More information about the ndnSIM mailing list