0% found this document useful (0 votes)
7 views51 pages

5.PIOT Unit 5

PIOT UNIT-5

Uploaded by

jgangadhar.cse
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views51 pages

5.PIOT Unit 5

PIOT UNIT-5

Uploaded by

jgangadhar.cse
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 51

IoT Communication Models

Request-Response Communication Model


Publish-Subscribe Communication Model
Push-Pull Communication Model
Exclusive Pair Communication Model
REQUEST-RESPONSE COMMUNICATION MODEL
REQUEST-RESPONSE COMMUNICATION MODEL

 Request-Response is a communication model in which the client


sends requests to the server and the server responds to the
requests.
 When the server receives a request, it decides how to respond,
fetches the data, retrieves resource representations, prepares the
response, and then sends the response to the client.
PUBLISH-SUBSCRIBE COMMUNICATION MODEL
PUBLISH-SUBSCRIBE COMMUNICATION MODEL

 Publish-Subscribe is a communication model that involves


publishers, brokers and consumers.
 Publishers are the source of data. Publishers send the data to the
topics which are managed by the broker. Publishers are not aware
of the consumers.
 Consumers subscribe to the topics which are managed by the
broker.
 When the broker receives data for a topic from the publisher, it
sends the data to all the subscribed consumers.
PUSH-PULL COMMUNICATION MODEL
PUSH-PULL COMMUNICATION MODEL

 Push-Pull is a communication model in which the data producers


push the data to queues and the consumers pull the data from the
queues. Producers do not need to be aware of the consumers.
 Queues help in decoupling the messaging between the producers
and consumers.
 Queues also act as a buffer which helps in situations when there is a
mismatch between the rate at which the producers push data and
the rate at which the consumers pull data.
EXCLUSIVE PAIR COMMUNICATION MODEL
EXCLUSIVE PAIR COMMUNICATION MODEL

 Exclusive Pair is a bidirectional, fully duplex communication model


that uses a persistent connection between the client and server.
 Once the connection is setup it remains open until the client sends
a request to close the connection.
 Client and server can send messages to each other after connection
setup.
IoT Communication APIs

REST-Based Communication APIs


WebSocket-Based Communication APIs
IoT Communication APIs
 An API (Application Programming Interface is an interface used by programs to access an
application.
 It allows a program to send commands to another programs and receive responses back
from that application.
 Basically a normal interface (user Interface) allows a person to use an application/service
whereas an Application Interface allows a computer/program to use an
application/service.
 Many of the APIs today are Web API’s and are designed to use the HTTP protocol.
 An Application Program Interface (API) is a set of routines, protocols, and tools for building software
applications; it specifies how software components should interact.
 APIs are tightly linked with IoT because they allow you to securely expose connected devices to
customers, go-to-market channels, and other applications in your IT infrastructure.
REST-based Communication APIs
REST-based Communication APIs

 Representational State Transfer (REST) is a set of architectural


principles by which you can design web services and web APIs that
focus on a system’s resources and how resource states are
addressed and transferred.
 REST APIs follow the request response communication model.
 The REST architectural constraints apply to the components,
connectors, and data elements, within a distributed hypermedia
system.
Request-Response model used by REST:
The REST architectural constraints

• Client-Server: The principle behind client-server constraint is the separation of concerns.


Separation allows client and server to be independently developed and updated.

• Stateless: Each request from client to server must contain all the info. Necessary to
understand the request, and cannot take advantage of any stored context on the server.

• Cache-able: Cache constraint requires that the data within a response to a request be
implicitly or explicitly labeled as cache-able or non-cacheable. If a response is cache-able,
then a client cache is given the right to reuse that response data for later, equivalent requests.

• Layered System: constraints the behavior of components such that each component cannot
see beyond the immediate layer with which they are interacting.

• User Interface: constraint requires that the method of communication between a client and
a server must be uniform.

• Code on Demand: Servers can provide executable code or scripts for clients to execute in
their context. This constraint is the only one that is optional.
WebSocket-based Communication APIs
WebSocket-based Communication APIs

 WebSocket APIs allow bidirectional, full duplex communication


between clients and servers.
 WebSocket APIs follow the exclusive pair communication model.
UNIT-V
IoT Physcial Servers and Cloud Offerings
UNIT-V IoT PHYSICAL SERVERS AND CLOUD Classes: 09
OFFERINGS
Introduction to cloud storage models and communication APIs, WAMP –
AutoBahn for IoT, Xively cloud for IoT, case studies illustrating IoT design –
home automation, smart cities, smart environment.
Introduction to cloud storage models & communication APIs

Cloud computing is a transformative computing paradigm that involves delivering applications and
services over the internet.
Introduction to Cloud Computing

The worker can use a cloud computing service to finish their work
because the data is managed remotely by a server. Another example: you
have a problem with your mobile device and you need to reformat it or
reinstall the operating system. You can use Google Photos to upload your
photos to internet-based storage.
After the reformat or reinstall, you can then either move the photos back
to you device or you can view the photos on your device from the
internet when you want.
Cloud Computing
Characteristics

First, the cloud computing of IoT is an on-demand self service, meaning


it’s there when you need it. Cloud computing is a web-based service that
can be accessed without any special assistance or permission from other
people; however, you need at minimum some sort of internet access.

Second, the cloud computing of IoT involves broad network access,


meaning it offers several connectivity options. Cloud computing resources
can be accessed through a wide variety of internet-connected devices
such as tablets, mobile devices and laptops. This level of convenience
means users can access those resources in a wide variety of manners,
even from older devices. Again, though, this emphasizes the need for
network access points.
Characteristics

Third, cloud computing allows for resource pooling, meaning information


can be shared with those who know where and how (have permission) to
access the resource, anytime and anywhere. This lends to broader
collaboration or closer connections with other users. From an IoT
perspective, just as we can easily assign an IP address to every "thing" on
the planet, we can share the "address" of the cloud-based protected and
stored information with others and pool resources.

Fourth, cloud computing features rapid elasticity, meaning users can


readily scale the service to their needs. You can easily and quickly edit
your software setup, add or remove users, increase storage space, etc.
This characteristic will further empower IoT by providing elastic
computing power, storage and networking.
Characteristics

Finally, the cloud computing of IoT is a measured service, meaning


you get what you pay for. Providers can easily measure usage
statistics such as storage, processing, bandwidth and active user
accounts inside your cloud instance. This pay per use (PPU) model
means your costs scale with your usage. In IoT terms, it's
comparable to the ever-growing network of physical objects that
feature an IP address for internet connectivity, and the
communication that occurs between these objects and other
internet-enabled devices and systems; just like your cloud service,
the service rates for that IoT infrastructure may also scale with use.
Service and Deployment

Service models
Service delivery in cloud computing comprises three different
service models: software as a service (SaaS), platform as a service
(PaaS), and infrastructure as a service (IaaS).
Software as a service (SaaS) provides applications to the cloud’s
end user that are mainly accessed via a web portal or service-
oriented architecture-based web service technology. These services
can be seen as ASP (application service provider) on the application
layer. Usually, a specific company that uses the service would run,
maintain and give support so that it can be reliably used over a
long period of time.
Service and Deployment

Platform as a service (PaaS) consists of the actual environment for


developing and provisioning cloud applications. The main users of
this layer are developers that want to develop and run a cloud
application for a particular purpose. A proprietary language was
supported and provided by the platform (a set of important basic
services) to ease communication, monitoring, billing and other
aspects such as startup as well as to ensure an application’s
scalability and flexibility. Limitations regarding the programming
languages supported, the programming model, the ability to access
resources, and the long-term persistence are possible
disadvantages.
Service and Deployment

Infrastructure as a service (IaaS) provides the necessary hardware


and software upon which a customer can build a customized
computing environment. Computing resources, data storage
resources and the communications channel are linked together
with these essential IT resources to ensure the stability of
applications being used on the cloud. Those stack models can be
referred to as the medium for IoT, being used and conveyed by the
users in different methods for the greatest chance of
interoperability. This includes connecting cars, wearables, TVs,
smartphones, fitness equipment, robots, ATMs, and vending
machines as well as the vertical applications, security and
professional services, and analytics platforms that come with
them.
Deployment models

Deployment in cloud computing comprises four deployment


models: private cloud, public cloud, community cloud and hybrid
cloud.
A private cloud has infrastructure that’s provisioned for exclusive
use by a single organization comprising multiple consumers such as
business units. It may be owned, managed and operated by the
organization, a third party or some combination of them, and it
may exist on or off premises.
A public cloud is created for open use by the general public. Public
cloud sells services to anyone on the internet. (Amazon Web
Services is an example of a large public cloud provider.)
Deployment models

This model is suitable for business requirements that require


management of load spikes and the applications used by the
business, activities that would otherwise require greater
investment in infrastructure for the business. As such, public cloud
also helps reduce capital expenditure and bring down operational
IT costs.
A community cloud is managed and used by a particular group or
organizations that have shared interests, such as specific security
requirements or a common mission.
Deployment models

Finally, a hybrid cloud combines two or more distinct private,


community or public cloud infrastructures such that they remain
unique entities but are bound together by standardized or
proprietary technology that enables data and application
portability. Normally, information that’s not critical is outsourced to
the public cloud, while business-critical services and data are kept
within the control of the organization.
CLOUD STORAGE API

A cloud storage API is an application program interface that


connects a locally-based application to a cloud-based storage
system, so that a user can send data to it and access and work with
data stored in it. To the application, the cloud storage system is just
another target device, like tape or disk-based storage. An
application program interface (API) is code that allows two
software programs to communicate with each other. The API
defines the correct way for a developer to write a program that
requests services from an operating system (OS) or other
application. APIs are implemented by function calls composed of
verbs and nouns. The required syntax is described in the
documentation of the application being called.
CLOUD STORAGE API

Why APIs are important for business


The web, software designed exchange information via the internet
and cloud computing have all combined to increase the interest in
APIs in general and services in particular. Software that was once
custom-developed for a specific purpose is now often written
referencing APIs that provide broadly useful features, reducing
development time and cost and mitigating the risk of errors. APIs
have steadily improved software quality over the last decade, and
the growing number of web services exposed through APIs by
cloud providers is also encouraging the creation of cloud-specific
applications, internet of things efforts and apps to support mobile
devices and users.
CLOUD STORAGE API

Three basic types of APIs


APIs take three basic forms: local, web-like and program-like.
1. Local APIs are the original form, from which the name came.
They offer OS middleware services to application programs.
Microsoft's .NET APIs, the TAPI (Telephony API) for voice
applications, and database access APIs are examples of the
local API form.
2. Web APIs are designed to represent widely used resources like
HTML pages and are accessed using a simple HTTP protocol.
Any web URL activates a web API. Web APIs are often called
REST (representational state transfer) or RESTful because the
publisher of REST interfaces doesn't save any data internally
between requests. As such, requests from many users can be
intermingled as they would be on the internet.
CLOUD STORAGE API

Three basic types of APIs


APIs take three basic forms: local, web-like and program-like.
1. Local APIs are the original form, from which the name came.
They offer OS middleware services to application programs.
Microsoft's .NET APIs, the TAPI (Telephony API) for voice
applications, and database access APIs are examples of the
local API form.
2. Web APIs are designed to represent widely used resources like
HTML pages and are accessed using a simple HTTP protocol.
Any web URL activates a web API. Web APIs are often called
REST (representational state transfer) or RESTful because the
publisher of REST interfaces doesn't save any data internally
between requests. As such, requests from many users can be
intermingled as they would be on the internet.
CLOUD STORAGE API

Program APIs are based on remote procedure call (RPC) technology


that makes a remote program component appear to be local to the
rest of the software. Service Oriented Architecture (SOA) APIs, such
as Microsoft's WS-series of APIs, are program APIs.
IoT / Cloud Convergence

• Internet-of-Things can benefit from the scalability, performance


and pay-as-you-go nature of cloud computing infrastructures.
Indeed, as IoT applications produce large volumes of data and
comprise multiple computational components (e.g., data
processing and analytics algorithms), their integration with cloud
computing infrastructures could provide them with opportunities
for cost-effective on-demand scaling. As prominent examples
consider the following settings:

•A Small Medium Enterprise (SME) developing an energy
management IoT product, targeting smart homes and smart
buildings. By streaming the data of the product (e.g., sensors and
WSN data) into the cloud it can accommodate its growth needs in a
scalable and cost effective fashion. As the SMEs acquires more
customers and performs more deployments of its product, it is able
WAMP for IoT

• Web Application Messaging Protocol (WAMP) is a sub-protocol of


Websocket which provides publish-subscribe and remote procedure call
(RPC) messaging Patterns.
WAMP - Concepts

• Transport: Transport is channel that connects two peers.


• Session: Session is a conversation between two peers that runs over a transport.
• Client: Clients are peers that can have one or more roles. In publish-subscribe model client
can have following roles:
– Publisher: Publisher publishes events (including payload) to the topic maintained by the
Broker.
– Subscriber: Subscriber subscribes to the topics and receives the events including the
payload.
In RPC model client can have following roles:
– Caller: Caller issues calls to the remote procedures along with call arguments.
– Callee: Callee executes the procedures to which the calls are issued by the caller and
returns the results back to the caller.
• Router: Routers are peers that perform generic call and event routing. In publish-subscribe
model Router has the role of a Broker:
– Broker: Broker acts as a router and routes messages published to a topic to all subscribers

subscribed to the topic.


In RPC model Router has the role of a Broker:
– Dealer: Dealer acts a router and routes RPC calls from the Caller to the Callee and routes
results from Callee to Caller.
• Application Code: Application code runs on the Clients (Publisher, Subscriber, Callee or
Caller).
Amazon EC2 – Python Example
Amazon AutoScaling – Python Example
Contd....
Contd....
Amazon S3 – Python Example
Amazon RDS – Python Example
Amazon DynamoDB – Python Example
Python for MapReduce
Python Packages of Interest

• JSON
• JavaScript Object Notation (JSON) is an easy to read and write data-interchange format. JSON is
used
as an alternative to XML and is is easy for machines to parse and generate. JSON is built on two
structures - a collection of name-value pairs (e.g. a Python dictionary) and ordered lists of values
(e.g..
a Python list).
• XML
• XML (Extensible Markup Language) is a data format for structured document interchange. The Python

minidom library provides a minimal implementation of the Document Object Model interface and has
an API similar to that in other languages.
• HTTPLib & URLLib
• HTTPLib2 and URLLib2 are Python libraries used in network/internet programming
• SMTPLib
• Simple Mail Transfer Protocol (SMTP) is a protocol which handles sending email and routing e-mail
between mail servers. The Python smtplib module provides an SMTP client session object that can be

used to send email.


• NumPy
• NumPy is a package for scientific computing in Python. NumPy provides support for large multi-
dimensional arrays and matrices
• Scikit-learn
• Scikit-learn is an open source machine learning library for Python that provides implementations of
various machine learning algorithms for classification, clustering, regression and dimension reduction
problems.
Python Web Application Framework - Django

• Django is an open source web application framework for developing web


applications in Python.
• A web application framework in general is a collection of solutions, packages
and best practices that allows development of web applications and dynamic
websites.
• Django is based on the Model-Template-View architecture and provides a
separation of the data model from the business rules and the user interface.
• Django provides a unified API to a database backend.
• Thus web applications built with Django can work with different databases
without requiring any code changes.
• With this fiexibility in web application design combined with the powerful
capabilities of the Python language and the Python ecosystem, Django is best
suited for cloud applications.
• Django consists of an object-relational mapper, a web templating system and a
regular-expression based URL dispatcher.
Django Architecture

• Django is Model-Template-View (MTV) framework.


• Model
• The model acts as a definition of some stored data and handles the
interactions with the database. In a web application, the data can be
stored in a relational database, non-relational database, an XML file,
etc. A Django model is a Python class that outlines the variables and
methods for a particular type of data.
• Template
• In a typical Django web application, the template is simply an HTML
page with a few extra placeholders. Django’s template language can
be used to create various forms of text files (XML, email, CSS,
Javascript, CSV, etc.)
• View
• The view ties the model to the template. The view is where you write
the code that actually generates the web pages. View determines what
data is to be displayed, retrieves the data from the database and
passes the data to the template.

You might also like