Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 21

UNIT 5

SHORT ANSWERS:

1. Write short notes WAMP?

Ans: WAMP for IoT


• It is a subprotocol of WebSocket
• It is a routed protocol that means it requires a central router server to work.
• Enables different technologies,processes and machines to communicate with each other
at real time.
• It offers two tools : Remote Procedure Call(RPC) and Pub / Sub
• Messages on WAMP are based on JSON format.

Web Application Messaging Protocol (WAMP) is a sub-protocol of Web socket which provides
publish-subscribe and remote procedure call (RPC) messaging patterns.

2. Write short on Iaas?

Ans: . Infrastructure as a Service (IaaS):

• IaaS is the delivery of technology infrastructure as an on demand scalable service.

• IaaS provides users the ability to provision computing and storage resources. These
resources are provided to the users as a virtual machine instances and virtual storage.

• Users can start, stop, configure and manage the virtual machines & virtual storage.

• Users can deploy operating systems and applications of their choice on the virtual
resources provisioned in the cloud.

• Virtual resources provisioned by the users are billed based on pay-per-use paradigm.

Advantages:

• Enhanced Scalability.
• Flexibility.

Disadvantages:

• Security issues

• Service delays

• Network delays

Used by: System administrators

Example: AWS EC2 (Amazon Elastic Compute Cloud )

3. Mention any 4 benefits of Cloud Computing?

Ans: Benefits of Cloud Computing

1. Lower IT infrastructure and computer costs for users


2. Improved performance
3. Fewer Maintenance issues
4. Instant software updates
5. Improved compatibility between Operating systems
6. Backup and recovery
7. Performance and Scalability
8. Increased storage capacity
9. Increase data safety

4. write short notes on types of clouds?

There are 4 Deployment models of Cloud & they are

1. Private Cloud: Here, computing resources are deployed for one particular organization. 


This method is more used for intra-business interactions.  Where the computing resources
can be governed, owned and operated by the same organization.
2. Community Cloud: Here, computing resources are provided for a community and
organizations. 
3. Public Cloud: This type of cloud is used usually for B2C (Business to Consumer) type
interactions.  Here the computing resource is owned, governed and operated by
government, an academic or business organization. 
4. Hybrid Cloud: This type of cloud can be used for both type of interactions -  B2B
(Business to Business) or B2C ( Business to Consumer). This deployment method is
called hybrid cloud as the computing resources are bound together by different clouds.

5. Write Short notes on Web API?

Ans: 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.

LONG ANSWERS:

1. Explain cloud for IoT with the help of Xively cloud service?

Ans: Xively Cloud

• It is an IoT Cloud Platform


• Builds , manages and derive business value from connected products
• Provides cloud base API
• It is a PAAS via RESTful API
• Supports messaging service based on MQTT

Xively Concepts :
Xively device: It is your “device” or the IoT project you are building. Consider it as an envelope
containing the data.

Channels: It is the streaming coming from your sensors. Usually, the channel number is equal
to the sensor number (as long as you want to monitor them all).
Sending data to Xively and monitoring :
Step1:Adding the “device” to our account
Step2:Define the channels
Step3:Use the Xively library for your device
Step4:Send data to Cloud
Step5:Run the Code
Step6:Create a dashboard using the data stored in Xively

Step1:Adding the “device” to our account

Step2: Define the channels:

Step3: Add Xively library to the device


#include <HttpClient.h>
#include <SPI.h>
#include <Ethernet.h>
Note: It is sample libraries code user can write own as per requirements

• Xively Datastream that holds the four stream we send to Xively platform.

• Each channel defined previously using Xively interface corresponds to a Xively


Datastream.

• Remember to use in the data stream the same name used in the Xively interface.

Xively Data:
• Connecting Freeboard.io to Xively.

• This can be done easily using API Key.

Create charts connecting them to the Xively channels covered before.

Create dashboard:
2. Explain in detail about cloud service models?
Service models of Cloud Computing

• Cloud Services are offered to users in different forms.

• Service models are the reference models on which the Cloud Computing is based. These
can be categorized into three basic service models as listed below:

1. Infrastructure as a Service (IaaS)

2. Platform as a Service (PaaS)

3. Software as a Service (SaaS)

. Infrastructure as a Service (IaaS)

• IaaS is the delivery of technology infrastructure as an on demand scalable


service.

• IaaS provides users the ability to provision computing and storage resources.
These resources are provided to the users as a virtual machine instances and
virtual storage.
• Users can start, stop, configure and manage the virtual machines & virtual
storage.

• Users can deploy operating systems and applications of their choice on the
virtual resources provisioned in the cloud.

• Virtual resources provisioned by the users are billed based on pay-per-use


paradigm.

Advantages:

• Enhanced Scalability.

• Flexibility.

Disadvantages:

• Security issues

• Service delays

• Network delays

Used by: System administrators

Example: AWS EC2 (Amazon Elastic Compute Cloud )

Amazon Elastic Compute Cloud (Amazon EC2) is a web service that

provides resizable computing capacity—literally, servers in Amazon's data

centers—that you use to build and host your software systems.

Platform-as-a-Service(PaaS)
• PaaS provides users the ability to develop and deploy application in cloud using the
development tools, APIs, software libraries and services (OR)

• Provides OS +Programming language + API + Server + database

• No choice of OS, NO virtual machines/storage.

• Users can build, compile & run programs to develop Applications.

• Typically applications must be developed with a particular platform in mind

• Users are responsible for data manage & application resources.

• Multi tenant environments.

Advantages:

• Scalable & Cost effective

• Faster market for developers

• Easy deployment of web applications

Disadvantages:

• Must use language provided

• No virtual machines/storage.

• Vendor lock-in

Used by: Software Developers

Example: Google App Engine, AWS Elastic Bean Stack

Software-as-a-Service(SaaS)
• SaaS provides the user a complete software application or the user interface
to the application itself

• The Cloud Service provider(vendor) manages the underlying cloud


infrastructure including servers, network, operating system, storage and
Application software.

• User is unaware of underlying architecture since managed by vendor.

• NO need to install software on PC

• Applications are provided through client interface(browser)

• Platform independent(mac, windows, linux)

Advantages:

• Universally accessible from any platform

• Excellent for collaborative work

• Vendors provides modest software tools

• Allows for multi tenancy

Disadvantages:

• Less flexibility

• Browser issues

• Vendor lock-in
Used by: End Consumers

Example: Gmail, online office 365, Google Docs, online convertors--ilovepdf

3. Explain Django Architecture and various steps involved to develop an simple


webpage using Django web framework?

Ans:

Introduction to Django

 Django is a Python-based web framework which allows you to quickly


create web application without all of the installation or dependency
problems that you normally will find with other frameworks.

 When you’re building a website, you always need a similar set of


components: a way to handle user authentication (signing up, signing in,
signing out), a management panel for your website, forms, a way to
upload files, etc.

 Django gives you ready-made components to use.

Django architecture:

Django is based on MVT (Model-View-Template) architecture. MVT is a


software design pattern for developing a web application.
MVT Structure has the following three parts –
Model: Model is going to act as the interface of your data. It is responsible for
maintaining data. It is the logical data structure behind the entire application and
is represented by a database (generally relational databases such as MySql,
Postgres).

View: The View is the user interface — what you see in your browser when you
render a website. It is represented by HTML/CSS/Javascript and Jinja files.

Template: A template consists of static parts of the desired HTML output as


well as some special syntax describing how dynamic content will be inserted.
Python Web framework using Django:

Step1: Create a Project in Pycharm lets assume my project is “KmitDjang1 “


Step2: Install Django---- Open terminal & type: pip install Django

Step 3: Creating a Project


Lets’ check how to create a basic project using Django after you have installed it in your pc.
 To initiate a project of Django on Your PC, open Terminal and Enter the following
command
django-admin startproject projectName
 A New Folder with name projectName will be created. To enter in the project using
terminal enter command
cd projectName

Step 4 : Now run, Python manage.py runserver


Now visit http://localhost:8000/ or click on http link in python terminal

Step 5: Creating an App

Django is famous for its unique and fully managed app structure. For every functionality, an
app can be created like a completely independent module. This article will take you through
how to create a basic app and add functionalities using that app.
 To create a basic app in your Django project you need to go to directory
containing manage.py and from there enter the command :
python manage.py startapp projectApp

Now you can see your directory structure as under :


Step 6: To consider the app in your project you need to specify your project name in
INSTALLED_APPS list as follows in settings.py:

Step 7: open views.py write below code

from django.shortcuts import render


from django.http import HttpResponse
# Create your views here.

def index(req):
return HttpResponse("<h1> KMIT IT IOT-LAB WELCOMES YOU</h1>")
Step 8: So, we have finally created an app but to render the app using urls we need to include
the app in our main project so that urls redirected to that app can be rendered. Let us explore it.
Move to projectName-> projectName -> urls.py  and add below code in the header

from django.contrib import admin


from django.urls import path
from projectApp import views

urlpatterns = [
path('admin/', admin.site.urls),

path('projectApp',views.index)
]

Step 9: Python manage.py runserver


visit http://localhost:8000/projectApp will provide the required webpage.
4. Explain in detail about WAMP for IoT
WAMP for IoT
• It is a subprotocol of WebSocket
• It is a routed protocol that means it requires a central router server to work.
• Enables different technologies,processes and machines to communicate with each other
at real time.
• It offers two tools : Remote Procedure Call(RPC) and Pub / Sub
• Messages on WAMP are based on JSON format.

Web Application Messaging Protocol (WAMP) is a sub-protocol of Websocket which provides


publish-subscribe and remote procedure call (RPC) messaging patterns.

WAMP
1. Transport: Transport is channel that connects two peers.
2. Session: Session is a conversation between two peers that runs over a transport.
3. Client: Clients are peers that can have one or more roles. In publish-subscribe model client
can have following roles:
a) Publisher: Publisher publishes events (including payload) to the topic maintained
by thebroker.
b) Subscriber: Subscriber subscribes to the topics and receives the events including
the payload.
In RPC model client can have following roles: –

1. 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 thetopic.

In RPC model Router has the role of a Broker: –

1. Dealer: Dealer acts a router and routes RPC calls from the Caller to the Callee and routes
results from Callee toCaller.
2. Application Code: Application code runs on the Clients (Publisher, Subscriber, Callee or
Caller).

AUTOBAHN for IoT

Open source(MIT) real-time framework

Framework for WAMP and WebSocket i.e Web, Mobile and IoT

Compatible with Python 2.7

Supports TLS(Transport Layer Security) (secured WebSocket)


Autobahn Installation for WAMP
Installation
•$ sudo apt-get install python-twisted python-dev
•$ sudo apt-get install python-pip
•$ sudo pip install-upgrade twisted
•$ sudo pip install-upgrade autobahn

Implementation
•$ git clone https://github.com/tavendo/AutobahnPython.git

5. Compare Cloud Computing and Grid Computing

                      Cloud Computing                            Grid Computing

 Cloud computing works more as a service  Grid computing uses the available
provider for utilizing computer resource resource and interconnected computer
systems to accomplish a common goal

 Cloud computing is a centralized model  Grid computing is a decentralized


model, where the computation could
occur over many administrative model

 Cloud is a collection of computers usually  A grid is a collection of computers


owned by a single party. which is owned by a multiple parties in
   multiple locations and connected
together so that users can share the
combined power of resources

 Cloud offers more services all most all the  Grid provides limited services
services like web hosting, DB (Data Base)
support and much more

 Cloud computing is typically provided within a  Grid computing federates the resources
single organization (eg : Amazon) located within different organization.

You might also like