SlideShare a Scribd company logo
OpenStack Heat
Virtual Private Cloud (VPC) Resources
1) List of VPC APIs implemented in Heat
a) CreateVPC == Create Virtual Network
b) CreateSubnet == Create Subnet in Virtual Network(VPC)
c) CreateInternetGateway == Get external network defined in the
Project
d) AttachInternetGateway == Connect external network to routers in
the Virtual Network(VPC)
e) CreateRouteTable == Create a router and attach to Virtual
Network(VPC)
f) AssociateRouteTable == Attach subnet to router
g) CreateEIP == Attach floating ip to instance
2) Resource
heat/heat/engine/resource.py
class Resource(object):
@scheduler.wrappertask
def create(self):
'''
Create the resource. Subclasses should provide a handle_create() method
to customise creation.
'''
@scheduler.wrappertask
def update(self, after, before=None, prev_resource=None):
'''
update the resource. Subclasses should provide a handle_update()
method
to customise update, the base-class handle_update will fail by default.
'''
def resource_id_set(self, inst):
self.resource_id = inst
OpenStack Training Videos
Play Training Videos
https://www.youtube.com/user/sajuptpm/videos
Continue ...
def action_handler_task(self, action, args=[], action_prefix=None):
'''
A task to call the Resource subclass's handler methods for an action.
Calls the handle_<ACTION>() method for the given action and then calls
the check_<ACTION>_complete() method with the result in a loop until it
returns True. If the methods are not provided, the call is omitted.
Any args provided are passed to the handler.
If a prefix is supplied, the handler method handle_<PREFIX>_<ACTION>()
is called instead.
'''
def physical_resource_name(self):
name = '%s-%s-%s' % (self.stack.name,
self.name,
short_id.get_id(self.id))
return name
def neutron(self):
return self.client('neutron')
3) VPC Resource
heat/heat/engine/resources/vpc.py
class VPC(resource.Resource):
PROPERTIES = (
CIDR_BLOCK, INSTANCE_TENANCY, TAGS,
) = (
'CidrBlock', 'InstanceTenancy', 'Tags',
)
properties_schema = { .... }
def handle_create(self):
client = self.neutron()
# The VPC's net and router are associated by having identical names.
net_props = {'name': self.physical_resource_name()}
router_props = {'name': self.physical_resource_name()}
net = client.create_network({'network': net_props})['network']
self.resource_id_set(net['id'])
client.create_router({'router': router_props})['router']
Continue ...
def check_create_complete(self, *args):
....
def handle_delete(self):
....
def resource_mapping():
return {
'AWS::EC2::VPC': VPC,
}
4) Subnet Resource
heat/heat/engine/resources/subnet.py
class Subnet(resource.Resource):
PROPERTIES = (
AVAILABILITY_ZONE, CIDR_BLOCK, VPC_ID, TAGS,
) = (
'AvailabilityZone', 'CidrBlock', 'VpcId', 'Tags',
)
properties_schema = { .... }
def handle_delete(self):
....
def resource_mapping():
return {
'AWS::EC2::Subnet': Subnet,
}
Continue ...
def handle_create(self):
client = self.neutron()
# TODO(sbaker) Verify that this CidrBlock is within the vpc CidrBlock
network_id = self.properties.get(self.VPC_ID)
props = {
'network_id': network_id,
'cidr': self.properties.get(self.CIDR_BLOCK),
'name': self.physical_resource_name(),
'ip_version': 4
}
subnet = client.create_subnet({'subnet': props})['subnet']
self.resource_id_set(subnet['id'])
router = vpc.VPC.router_for_vpc(self.neutron(), network_id)
if router:
client.add_interface_router(
router['id'],
{'subnet_id': subnet['id']})
5) RouteTable Resource
heat/heat/engine/resources/route_table.py
class RouteTable(resource.Resource):
PROPERTIES = (
VPC_ID, TAGS,
) = (
'VpcId', 'Tags',
)
properties_schema = { .... }
def handle_create(self):
client = self.client()
props = {'name': self.physical_resource_name()}
router = client.create_router({'router': props})['router']
self.resource_id_set(router['id'])
def resource_mapping():
return {
'AWS::EC2::RouteTable': RouteTable
}
6) SubnetRouteTableAssociation Resource
heat/heat/engine/resources/route_table.py
class SubnetRouteTableAssociation(resource.Resource):
PROPERTIES = (ROUTE_TABLE_ID, SUBNET_ID,) = ( 'RouteTableId', 'SubnetId',)
properties_schema = { .... }
def handle_create(self):
client = self.client()
subnet_id = self.properties.get(self.SUBNET_ID)
router_id = self.properties.get(self.ROUTE_TABLE_ID)
#remove the default router association for this subnet.
try:
previous_router = self._router_for_subnet(subnet_id)
if previous_router:
client.remove_interface_router(
previous_router['id'],
{'subnet_id': subnet_id})
except Exception as ex:
self.client_plugin().ignore_not_found(ex)
client.add_interface_router(
router_id, {'subnet_id': subnet_id})
def resource_mapping():
return {
'AWS::EC2::SubnetRouteTableAssociation': SubnetRouteTableAssociation,
}
7) InternetGateway Resource
heat/heat/engine/resources/internet_gateway.py
class InternetGateway(resource.Resource):
PROPERTIES = (TAGS,) = ('Tags',)
properties_schema = { .... }
def handle_create(self):
self.resource_id_set(self.physical_resource_name())
@staticmethod
def get_external_network_id(client):
ext_filter = {'router:external': True}
ext_nets = client.list_networks(**ext_filter)['networks']
if len(ext_nets) != 1:
raise exception.Error(
_('Expected 1 external network, found %d') % len(ext_nets))
external_network_id = ext_nets[0]['id']
return external_network_id
def resource_mapping():
return {
'AWS::EC2::InternetGateway': InternetGateway,
}
8) VPCGatewayAttachment Resource
heat/heat/engine/resources/internet_gateway.py
class VPCGatewayAttachment(resource.Resource):
PROPERTIES = (
VPC_ID, INTERNET_GATEWAY_ID, VPN_GATEWAY_ID,
) = ( 'VpcId', 'InternetGatewayId', 'VpnGatewayId',)
properties_schema = { .... }
def handle_create(self):
client = self.neutron()
external_network_id = InternetGateway.get_external_network_id(client)
for router in self._vpc_route_tables():
client.add_gateway_router(router.resource_id, {
'network_id': external_network_id})
def resource_mapping():
return {
'AWS::EC2::VPCGatewayAttachment': VPCGatewayAttachment,
}
9) ElasticIp Resource
heat/heat/engine/resources/eip.py
class ElasticIp(resource.Resource):
PROPERTIES = (DOMAIN, INSTANCE_ID,) = ('Domain', 'InstanceId', )
properties_schema = { .... }
def handle_create(self):
"""Allocate a floating IP for the current tenant."""
ips = None
if self.properties[self.DOMAIN]:
from heat.engine.resources import internet_gateway
ext_net = internet_gateway.InternetGateway.get_external_network_id(self.neutron())
props = {'floating_network_id': ext_net}
ips = self.neutron().create_floatingip({
'floatingip': props})['floatingip']
self.ipaddress = ips['floating_ip_address']
self.resource_id_set(ips['id'])
instance_id = self.properties[self.INSTANCE_ID]
if instance_id:
server = self.nova().servers.get(instance_id)
server.add_floating_ip(self._ipaddress())
def resource_mapping():
return {
'AWS::EC2::EIP': ElasticIp,
}
10) ElasticIpAssociation Resource
heat/heat/engine/resources/eip.py
class ElasticIpAssociation(resource.Resource):
PROPERTIES = (
INSTANCE_ID, EIP, ALLOCATION_ID, NETWORK_INTERFACE_ID,
) = (
'InstanceId', 'EIP', 'AllocationId', 'NetworkInterfaceId',
)
properties_schema = { .... }
def handle_create(self):
"""Add a floating IP address to a server."""
if self.properties[self.EIP]:
server = self.nova().servers.get(self.properties[self.INSTANCE_ID])
server.add_floating_ip(self.properties[self.EIP])
self.resource_id_set(self.properties[self.EIP])
def resource_mapping():
return {
'AWS::EC2::EIPAssociation': ElasticIpAssociation,
}
11) VPC UnitTest
heat/heat/tests/test_vpc.py
class VPCTestBase(common.HeatTestCase):
class VPCTest(VPCTestBase):
class SubnetTest(VPCTestBase):
class NetworkInterfaceTest(VPCTestBase):
class InternetGatewayTest(VPCTestBase):
class RouteTableTest(VPCTestBase):
12) ElasticIp UnitTest
heat/heat/tests/test_eip.py
class EIPTest(common.HeatTestCase):
class AllocTest(common.HeatTestCase):
Thanks
● Email: sajuptpm@gmail.com
● Training Videos: https://www.youtube.com/user/sajuptpm/videos
● WebSite: http://fosshelp.blogspot.in
● IRC: saju_m
● Skype: sajuptpm

More Related Content

What's hot

Docker, LinuX Container
Docker, LinuX ContainerDocker, LinuX Container
Docker, LinuX Container
Araf Karsh Hamid
 
[OpenStack Days Korea 2016] Track1 - 카카오는 오픈스택 기반으로 어떻게 5000VM을 운영하고 있을까?
[OpenStack Days Korea 2016] Track1 - 카카오는 오픈스택 기반으로 어떻게 5000VM을 운영하고 있을까?[OpenStack Days Korea 2016] Track1 - 카카오는 오픈스택 기반으로 어떻게 5000VM을 운영하고 있을까?
[OpenStack Days Korea 2016] Track1 - 카카오는 오픈스택 기반으로 어떻게 5000VM을 운영하고 있을까?
OpenStack Korea Community
 
Deep dive in container service discovery
Deep dive in container service discoveryDeep dive in container service discovery
Deep dive in container service discovery
Docker, Inc.
 
[2018] 오픈스택 5년 운영의 경험
[2018] 오픈스택 5년 운영의 경험[2018] 오픈스택 5년 운영의 경험
[2018] 오픈스택 5년 운영의 경험
NHN FORWARD
 
Open vSwitch 패킷 처리 구조
Open vSwitch 패킷 처리 구조Open vSwitch 패킷 처리 구조
Open vSwitch 패킷 처리 구조
Seung-Hoon Baek
 
Room 1 - 6 - Trần Quốc Sang - Autoscaling for multi cloud platform based on S...
Room 1 - 6 - Trần Quốc Sang - Autoscaling for multi cloud platform based on S...Room 1 - 6 - Trần Quốc Sang - Autoscaling for multi cloud platform based on S...
Room 1 - 6 - Trần Quốc Sang - Autoscaling for multi cloud platform based on S...
Vietnam Open Infrastructure User Group
 
Keystone at openstack multi sites
Keystone at openstack multi sitesKeystone at openstack multi sites
Keystone at openstack multi sites
Vietnam Open Infrastructure User Group
 
[오픈소스컨설팅] Open Stack Ceph, Neutron, HA, Multi-Region
[오픈소스컨설팅] Open Stack Ceph, Neutron, HA, Multi-Region[오픈소스컨설팅] Open Stack Ceph, Neutron, HA, Multi-Region
[오픈소스컨설팅] Open Stack Ceph, Neutron, HA, Multi-Region
Ji-Woong Choi
 
Helm intro
Helm introHelm intro
Kubernetes 1001
Kubernetes 1001Kubernetes 1001
Kubernetes 1001
HungWei Chiu
 
[232] 성능어디까지쥐어짜봤니 송태웅
[232] 성능어디까지쥐어짜봤니 송태웅[232] 성능어디까지쥐어짜봤니 송태웅
[232] 성능어디까지쥐어짜봤니 송태웅
NAVER D2
 
Deeper Dive in Docker Overlay Networks
Deeper Dive in Docker Overlay NetworksDeeper Dive in Docker Overlay Networks
Deeper Dive in Docker Overlay Networks
Docker, Inc.
 
Introduction of OpenStack cascading solution
Introduction of OpenStack cascading solutionIntroduction of OpenStack cascading solution
Introduction of OpenStack cascading solution
Joe Huang
 
[오픈소스컨설팅] EFK Stack 소개와 설치 방법
[오픈소스컨설팅] EFK Stack 소개와 설치 방법[오픈소스컨설팅] EFK Stack 소개와 설치 방법
[오픈소스컨설팅] EFK Stack 소개와 설치 방법
Open Source Consulting
 
[MeetUp][1st] 오리뎅이의_쿠버네티스_네트워킹
[MeetUp][1st] 오리뎅이의_쿠버네티스_네트워킹[MeetUp][1st] 오리뎅이의_쿠버네티스_네트워킹
[MeetUp][1st] 오리뎅이의_쿠버네티스_네트워킹
InfraEngineer
 
[OpenInfra Days Korea 2018] (Track 4) - Grafana를 이용한 OpenStack 클라우드 성능 모니터링
[OpenInfra Days Korea 2018] (Track 4) - Grafana를 이용한 OpenStack 클라우드 성능 모니터링[OpenInfra Days Korea 2018] (Track 4) - Grafana를 이용한 OpenStack 클라우드 성능 모니터링
[OpenInfra Days Korea 2018] (Track 4) - Grafana를 이용한 OpenStack 클라우드 성능 모니터링
OpenStack Korea Community
 
OpenStack and Kubernetes - A match made for Telco Heaven
OpenStack and Kubernetes - A match made for Telco HeavenOpenStack and Kubernetes - A match made for Telco Heaven
OpenStack and Kubernetes - A match made for Telco Heaven
Trinath Somanchi
 
DevConf 2014 Kernel Networking Walkthrough
DevConf 2014   Kernel Networking WalkthroughDevConf 2014   Kernel Networking Walkthrough
DevConf 2014 Kernel Networking Walkthrough
Thomas Graf
 
eBPF maps 101
eBPF maps 101eBPF maps 101
eBPF maps 101
SUSE Labs Taipei
 
Red Hat OpenStack 17 저자직강+스터디그룹_1주차
Red Hat OpenStack 17 저자직강+스터디그룹_1주차Red Hat OpenStack 17 저자직강+스터디그룹_1주차
Red Hat OpenStack 17 저자직강+스터디그룹_1주차
Nalee Jang
 

What's hot (20)

Docker, LinuX Container
Docker, LinuX ContainerDocker, LinuX Container
Docker, LinuX Container
 
[OpenStack Days Korea 2016] Track1 - 카카오는 오픈스택 기반으로 어떻게 5000VM을 운영하고 있을까?
[OpenStack Days Korea 2016] Track1 - 카카오는 오픈스택 기반으로 어떻게 5000VM을 운영하고 있을까?[OpenStack Days Korea 2016] Track1 - 카카오는 오픈스택 기반으로 어떻게 5000VM을 운영하고 있을까?
[OpenStack Days Korea 2016] Track1 - 카카오는 오픈스택 기반으로 어떻게 5000VM을 운영하고 있을까?
 
Deep dive in container service discovery
Deep dive in container service discoveryDeep dive in container service discovery
Deep dive in container service discovery
 
[2018] 오픈스택 5년 운영의 경험
[2018] 오픈스택 5년 운영의 경험[2018] 오픈스택 5년 운영의 경험
[2018] 오픈스택 5년 운영의 경험
 
Open vSwitch 패킷 처리 구조
Open vSwitch 패킷 처리 구조Open vSwitch 패킷 처리 구조
Open vSwitch 패킷 처리 구조
 
Room 1 - 6 - Trần Quốc Sang - Autoscaling for multi cloud platform based on S...
Room 1 - 6 - Trần Quốc Sang - Autoscaling for multi cloud platform based on S...Room 1 - 6 - Trần Quốc Sang - Autoscaling for multi cloud platform based on S...
Room 1 - 6 - Trần Quốc Sang - Autoscaling for multi cloud platform based on S...
 
Keystone at openstack multi sites
Keystone at openstack multi sitesKeystone at openstack multi sites
Keystone at openstack multi sites
 
[오픈소스컨설팅] Open Stack Ceph, Neutron, HA, Multi-Region
[오픈소스컨설팅] Open Stack Ceph, Neutron, HA, Multi-Region[오픈소스컨설팅] Open Stack Ceph, Neutron, HA, Multi-Region
[오픈소스컨설팅] Open Stack Ceph, Neutron, HA, Multi-Region
 
Helm intro
Helm introHelm intro
Helm intro
 
Kubernetes 1001
Kubernetes 1001Kubernetes 1001
Kubernetes 1001
 
[232] 성능어디까지쥐어짜봤니 송태웅
[232] 성능어디까지쥐어짜봤니 송태웅[232] 성능어디까지쥐어짜봤니 송태웅
[232] 성능어디까지쥐어짜봤니 송태웅
 
Deeper Dive in Docker Overlay Networks
Deeper Dive in Docker Overlay NetworksDeeper Dive in Docker Overlay Networks
Deeper Dive in Docker Overlay Networks
 
Introduction of OpenStack cascading solution
Introduction of OpenStack cascading solutionIntroduction of OpenStack cascading solution
Introduction of OpenStack cascading solution
 
[오픈소스컨설팅] EFK Stack 소개와 설치 방법
[오픈소스컨설팅] EFK Stack 소개와 설치 방법[오픈소스컨설팅] EFK Stack 소개와 설치 방법
[오픈소스컨설팅] EFK Stack 소개와 설치 방법
 
[MeetUp][1st] 오리뎅이의_쿠버네티스_네트워킹
[MeetUp][1st] 오리뎅이의_쿠버네티스_네트워킹[MeetUp][1st] 오리뎅이의_쿠버네티스_네트워킹
[MeetUp][1st] 오리뎅이의_쿠버네티스_네트워킹
 
[OpenInfra Days Korea 2018] (Track 4) - Grafana를 이용한 OpenStack 클라우드 성능 모니터링
[OpenInfra Days Korea 2018] (Track 4) - Grafana를 이용한 OpenStack 클라우드 성능 모니터링[OpenInfra Days Korea 2018] (Track 4) - Grafana를 이용한 OpenStack 클라우드 성능 모니터링
[OpenInfra Days Korea 2018] (Track 4) - Grafana를 이용한 OpenStack 클라우드 성능 모니터링
 
OpenStack and Kubernetes - A match made for Telco Heaven
OpenStack and Kubernetes - A match made for Telco HeavenOpenStack and Kubernetes - A match made for Telco Heaven
OpenStack and Kubernetes - A match made for Telco Heaven
 
DevConf 2014 Kernel Networking Walkthrough
DevConf 2014   Kernel Networking WalkthroughDevConf 2014   Kernel Networking Walkthrough
DevConf 2014 Kernel Networking Walkthrough
 
eBPF maps 101
eBPF maps 101eBPF maps 101
eBPF maps 101
 
Red Hat OpenStack 17 저자직강+스터디그룹_1주차
Red Hat OpenStack 17 저자직강+스터디그룹_1주차Red Hat OpenStack 17 저자직강+스터디그룹_1주차
Red Hat OpenStack 17 저자직강+스터디그룹_1주차
 

Similar to VPC Implementation In OpenStack Heat

10 Excellent Ways to Secure Spring Boot Applications - Okta Webinar 2020
10 Excellent Ways to Secure Spring Boot Applications - Okta Webinar 202010 Excellent Ways to Secure Spring Boot Applications - Okta Webinar 2020
10 Excellent Ways to Secure Spring Boot Applications - Okta Webinar 2020
Matt Raible
 
Microservices DevOps on Google Cloud Platform
Microservices DevOps on Google Cloud PlatformMicroservices DevOps on Google Cloud Platform
Microservices DevOps on Google Cloud Platform
Sunnyvale
 
Object Oriented Code RE with HexraysCodeXplorer
Object Oriented Code RE with HexraysCodeXplorerObject Oriented Code RE with HexraysCodeXplorer
Object Oriented Code RE with HexraysCodeXplorer
Alex Matrosov
 
A Series of Fortunate Events: Building an Operator in Java
A Series of Fortunate Events: Building an Operator in JavaA Series of Fortunate Events: Building an Operator in Java
A Series of Fortunate Events: Building an Operator in Java
VMware Tanzu
 
Javascript Application Architecture with Backbone.JS
Javascript Application Architecture with Backbone.JSJavascript Application Architecture with Backbone.JS
Javascript Application Architecture with Backbone.JS
Min Ming Lo
 
Interoute Virtual Data Centre api 101
Interoute Virtual Data Centre api 101Interoute Virtual Data Centre api 101
Interoute Virtual Data Centre api 101
jon_graham1977
 
Serverless
ServerlessServerless
Serverless
Iegor Fadieiev
 
What mom never told you about bundle configurations - Symfony Live Paris 2012
What mom never told you about bundle configurations - Symfony Live Paris 2012What mom never told you about bundle configurations - Symfony Live Paris 2012
What mom never told you about bundle configurations - Symfony Live Paris 2012D
 
Working in the multi-cloud with libcloud
Working in the multi-cloud with libcloudWorking in the multi-cloud with libcloud
Working in the multi-cloud with libcloud
Grig Gheorghiu
 
Symfony2 from the Trenches
Symfony2 from the TrenchesSymfony2 from the Trenches
Symfony2 from the Trenches
Jonathan Wage
 
How to add a new hypervisor to CloudStack:Lessons learned from Hyper-V effort
How to add a new hypervisor to CloudStack:Lessons learned from Hyper-V effortHow to add a new hypervisor to CloudStack:Lessons learned from Hyper-V effort
How to add a new hypervisor to CloudStack:Lessons learned from Hyper-V effort
Donal Lafferty
 
Puppet and CloudStack
Puppet and CloudStackPuppet and CloudStack
Puppet and CloudStackke4qqq
 
Bring your infrastructure under control with Infrastructor
Bring your infrastructure under control with InfrastructorBring your infrastructure under control with Infrastructor
Bring your infrastructure under control with Infrastructor
Stanislav Tiurikov
 
Puppet and Apache CloudStack
Puppet and Apache CloudStackPuppet and Apache CloudStack
Puppet and Apache CloudStack
Puppet
 
Infrastructure as code with Puppet and Apache CloudStack
Infrastructure as code with Puppet and Apache CloudStackInfrastructure as code with Puppet and Apache CloudStack
Infrastructure as code with Puppet and Apache CloudStackke4qqq
 
Developing your first application using FIWARE
Developing your first application using FIWAREDeveloping your first application using FIWARE
Developing your first application using FIWAREFIWARE
 
Exploring MySQL Operator for Kubernetes in Python
Exploring MySQL Operator for Kubernetes in PythonExploring MySQL Operator for Kubernetes in Python
Exploring MySQL Operator for Kubernetes in Python
Ivan Ma
 
How to add a new hypervisor to CloudStack - Lessons learned from Hyper-V effort
How to add a new hypervisor to CloudStack - Lessons learned from Hyper-V effortHow to add a new hypervisor to CloudStack - Lessons learned from Hyper-V effort
How to add a new hypervisor to CloudStack - Lessons learned from Hyper-V effort
ShapeBlue
 
Crud operations using aws dynamo db with flask ap is and boto3
Crud operations using aws dynamo db with flask ap is and boto3Crud operations using aws dynamo db with flask ap is and boto3
Crud operations using aws dynamo db with flask ap is and boto3
Katy Slemon
 

Similar to VPC Implementation In OpenStack Heat (20)

10 Excellent Ways to Secure Spring Boot Applications - Okta Webinar 2020
10 Excellent Ways to Secure Spring Boot Applications - Okta Webinar 202010 Excellent Ways to Secure Spring Boot Applications - Okta Webinar 2020
10 Excellent Ways to Secure Spring Boot Applications - Okta Webinar 2020
 
Microservices DevOps on Google Cloud Platform
Microservices DevOps on Google Cloud PlatformMicroservices DevOps on Google Cloud Platform
Microservices DevOps on Google Cloud Platform
 
Object Oriented Code RE with HexraysCodeXplorer
Object Oriented Code RE with HexraysCodeXplorerObject Oriented Code RE with HexraysCodeXplorer
Object Oriented Code RE with HexraysCodeXplorer
 
A Series of Fortunate Events: Building an Operator in Java
A Series of Fortunate Events: Building an Operator in JavaA Series of Fortunate Events: Building an Operator in Java
A Series of Fortunate Events: Building an Operator in Java
 
Javascript Application Architecture with Backbone.JS
Javascript Application Architecture with Backbone.JSJavascript Application Architecture with Backbone.JS
Javascript Application Architecture with Backbone.JS
 
Interoute Virtual Data Centre api 101
Interoute Virtual Data Centre api 101Interoute Virtual Data Centre api 101
Interoute Virtual Data Centre api 101
 
Serverless
ServerlessServerless
Serverless
 
What mom never told you about bundle configurations - Symfony Live Paris 2012
What mom never told you about bundle configurations - Symfony Live Paris 2012What mom never told you about bundle configurations - Symfony Live Paris 2012
What mom never told you about bundle configurations - Symfony Live Paris 2012
 
Working in the multi-cloud with libcloud
Working in the multi-cloud with libcloudWorking in the multi-cloud with libcloud
Working in the multi-cloud with libcloud
 
Symfony2 from the Trenches
Symfony2 from the TrenchesSymfony2 from the Trenches
Symfony2 from the Trenches
 
How to add a new hypervisor to CloudStack:Lessons learned from Hyper-V effort
How to add a new hypervisor to CloudStack:Lessons learned from Hyper-V effortHow to add a new hypervisor to CloudStack:Lessons learned from Hyper-V effort
How to add a new hypervisor to CloudStack:Lessons learned from Hyper-V effort
 
Puppet and CloudStack
Puppet and CloudStackPuppet and CloudStack
Puppet and CloudStack
 
Bring your infrastructure under control with Infrastructor
Bring your infrastructure under control with InfrastructorBring your infrastructure under control with Infrastructor
Bring your infrastructure under control with Infrastructor
 
Puppet and Apache CloudStack
Puppet and Apache CloudStackPuppet and Apache CloudStack
Puppet and Apache CloudStack
 
Infrastructure as code with Puppet and Apache CloudStack
Infrastructure as code with Puppet and Apache CloudStackInfrastructure as code with Puppet and Apache CloudStack
Infrastructure as code with Puppet and Apache CloudStack
 
Developing your first application using FIWARE
Developing your first application using FIWAREDeveloping your first application using FIWARE
Developing your first application using FIWARE
 
Exploring MySQL Operator for Kubernetes in Python
Exploring MySQL Operator for Kubernetes in PythonExploring MySQL Operator for Kubernetes in Python
Exploring MySQL Operator for Kubernetes in Python
 
How to add a new hypervisor to CloudStack - Lessons learned from Hyper-V effort
How to add a new hypervisor to CloudStack - Lessons learned from Hyper-V effortHow to add a new hypervisor to CloudStack - Lessons learned from Hyper-V effort
How to add a new hypervisor to CloudStack - Lessons learned from Hyper-V effort
 
Crud operations using aws dynamo db with flask ap is and boto3
Crud operations using aws dynamo db with flask ap is and boto3Crud operations using aws dynamo db with flask ap is and boto3
Crud operations using aws dynamo db with flask ap is and boto3
 
Code Igniter 2
Code Igniter 2Code Igniter 2
Code Igniter 2
 

Recently uploaded

Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke
 
Graphic Design Crash Course for beginners
Graphic Design Crash Course for beginnersGraphic Design Crash Course for beginners
Graphic Design Crash Course for beginners
e20449
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
informapgpstrackings
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Globus
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
abdulrafaychaudhry
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
vrstrong314
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
Globus
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
kalichargn70th171
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
Fermin Galan
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
Cyanic lab
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
Globus
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Shahin Sheidaei
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
IES VE
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
Globus
 

Recently uploaded (20)

Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
 
Graphic Design Crash Course for beginners
Graphic Design Crash Course for beginnersGraphic Design Crash Course for beginners
Graphic Design Crash Course for beginners
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
 

VPC Implementation In OpenStack Heat

  • 1. OpenStack Heat Virtual Private Cloud (VPC) Resources
  • 2. 1) List of VPC APIs implemented in Heat a) CreateVPC == Create Virtual Network b) CreateSubnet == Create Subnet in Virtual Network(VPC) c) CreateInternetGateway == Get external network defined in the Project d) AttachInternetGateway == Connect external network to routers in the Virtual Network(VPC) e) CreateRouteTable == Create a router and attach to Virtual Network(VPC) f) AssociateRouteTable == Attach subnet to router g) CreateEIP == Attach floating ip to instance
  • 3. 2) Resource heat/heat/engine/resource.py class Resource(object): @scheduler.wrappertask def create(self): ''' Create the resource. Subclasses should provide a handle_create() method to customise creation. ''' @scheduler.wrappertask def update(self, after, before=None, prev_resource=None): ''' update the resource. Subclasses should provide a handle_update() method to customise update, the base-class handle_update will fail by default. ''' def resource_id_set(self, inst): self.resource_id = inst
  • 4. OpenStack Training Videos Play Training Videos https://www.youtube.com/user/sajuptpm/videos
  • 5. Continue ... def action_handler_task(self, action, args=[], action_prefix=None): ''' A task to call the Resource subclass's handler methods for an action. Calls the handle_<ACTION>() method for the given action and then calls the check_<ACTION>_complete() method with the result in a loop until it returns True. If the methods are not provided, the call is omitted. Any args provided are passed to the handler. If a prefix is supplied, the handler method handle_<PREFIX>_<ACTION>() is called instead. ''' def physical_resource_name(self): name = '%s-%s-%s' % (self.stack.name, self.name, short_id.get_id(self.id)) return name def neutron(self): return self.client('neutron')
  • 6. 3) VPC Resource heat/heat/engine/resources/vpc.py class VPC(resource.Resource): PROPERTIES = ( CIDR_BLOCK, INSTANCE_TENANCY, TAGS, ) = ( 'CidrBlock', 'InstanceTenancy', 'Tags', ) properties_schema = { .... } def handle_create(self): client = self.neutron() # The VPC's net and router are associated by having identical names. net_props = {'name': self.physical_resource_name()} router_props = {'name': self.physical_resource_name()} net = client.create_network({'network': net_props})['network'] self.resource_id_set(net['id']) client.create_router({'router': router_props})['router']
  • 7. Continue ... def check_create_complete(self, *args): .... def handle_delete(self): .... def resource_mapping(): return { 'AWS::EC2::VPC': VPC, }
  • 8. 4) Subnet Resource heat/heat/engine/resources/subnet.py class Subnet(resource.Resource): PROPERTIES = ( AVAILABILITY_ZONE, CIDR_BLOCK, VPC_ID, TAGS, ) = ( 'AvailabilityZone', 'CidrBlock', 'VpcId', 'Tags', ) properties_schema = { .... } def handle_delete(self): .... def resource_mapping(): return { 'AWS::EC2::Subnet': Subnet, }
  • 9. Continue ... def handle_create(self): client = self.neutron() # TODO(sbaker) Verify that this CidrBlock is within the vpc CidrBlock network_id = self.properties.get(self.VPC_ID) props = { 'network_id': network_id, 'cidr': self.properties.get(self.CIDR_BLOCK), 'name': self.physical_resource_name(), 'ip_version': 4 } subnet = client.create_subnet({'subnet': props})['subnet'] self.resource_id_set(subnet['id']) router = vpc.VPC.router_for_vpc(self.neutron(), network_id) if router: client.add_interface_router( router['id'], {'subnet_id': subnet['id']})
  • 10. 5) RouteTable Resource heat/heat/engine/resources/route_table.py class RouteTable(resource.Resource): PROPERTIES = ( VPC_ID, TAGS, ) = ( 'VpcId', 'Tags', ) properties_schema = { .... } def handle_create(self): client = self.client() props = {'name': self.physical_resource_name()} router = client.create_router({'router': props})['router'] self.resource_id_set(router['id']) def resource_mapping(): return { 'AWS::EC2::RouteTable': RouteTable }
  • 11. 6) SubnetRouteTableAssociation Resource heat/heat/engine/resources/route_table.py class SubnetRouteTableAssociation(resource.Resource): PROPERTIES = (ROUTE_TABLE_ID, SUBNET_ID,) = ( 'RouteTableId', 'SubnetId',) properties_schema = { .... } def handle_create(self): client = self.client() subnet_id = self.properties.get(self.SUBNET_ID) router_id = self.properties.get(self.ROUTE_TABLE_ID) #remove the default router association for this subnet. try: previous_router = self._router_for_subnet(subnet_id) if previous_router: client.remove_interface_router( previous_router['id'], {'subnet_id': subnet_id}) except Exception as ex: self.client_plugin().ignore_not_found(ex) client.add_interface_router( router_id, {'subnet_id': subnet_id}) def resource_mapping(): return { 'AWS::EC2::SubnetRouteTableAssociation': SubnetRouteTableAssociation, }
  • 12. 7) InternetGateway Resource heat/heat/engine/resources/internet_gateway.py class InternetGateway(resource.Resource): PROPERTIES = (TAGS,) = ('Tags',) properties_schema = { .... } def handle_create(self): self.resource_id_set(self.physical_resource_name()) @staticmethod def get_external_network_id(client): ext_filter = {'router:external': True} ext_nets = client.list_networks(**ext_filter)['networks'] if len(ext_nets) != 1: raise exception.Error( _('Expected 1 external network, found %d') % len(ext_nets)) external_network_id = ext_nets[0]['id'] return external_network_id def resource_mapping(): return { 'AWS::EC2::InternetGateway': InternetGateway, }
  • 13. 8) VPCGatewayAttachment Resource heat/heat/engine/resources/internet_gateway.py class VPCGatewayAttachment(resource.Resource): PROPERTIES = ( VPC_ID, INTERNET_GATEWAY_ID, VPN_GATEWAY_ID, ) = ( 'VpcId', 'InternetGatewayId', 'VpnGatewayId',) properties_schema = { .... } def handle_create(self): client = self.neutron() external_network_id = InternetGateway.get_external_network_id(client) for router in self._vpc_route_tables(): client.add_gateway_router(router.resource_id, { 'network_id': external_network_id}) def resource_mapping(): return { 'AWS::EC2::VPCGatewayAttachment': VPCGatewayAttachment, }
  • 14. 9) ElasticIp Resource heat/heat/engine/resources/eip.py class ElasticIp(resource.Resource): PROPERTIES = (DOMAIN, INSTANCE_ID,) = ('Domain', 'InstanceId', ) properties_schema = { .... } def handle_create(self): """Allocate a floating IP for the current tenant.""" ips = None if self.properties[self.DOMAIN]: from heat.engine.resources import internet_gateway ext_net = internet_gateway.InternetGateway.get_external_network_id(self.neutron()) props = {'floating_network_id': ext_net} ips = self.neutron().create_floatingip({ 'floatingip': props})['floatingip'] self.ipaddress = ips['floating_ip_address'] self.resource_id_set(ips['id']) instance_id = self.properties[self.INSTANCE_ID] if instance_id: server = self.nova().servers.get(instance_id) server.add_floating_ip(self._ipaddress()) def resource_mapping(): return { 'AWS::EC2::EIP': ElasticIp, }
  • 15. 10) ElasticIpAssociation Resource heat/heat/engine/resources/eip.py class ElasticIpAssociation(resource.Resource): PROPERTIES = ( INSTANCE_ID, EIP, ALLOCATION_ID, NETWORK_INTERFACE_ID, ) = ( 'InstanceId', 'EIP', 'AllocationId', 'NetworkInterfaceId', ) properties_schema = { .... } def handle_create(self): """Add a floating IP address to a server.""" if self.properties[self.EIP]: server = self.nova().servers.get(self.properties[self.INSTANCE_ID]) server.add_floating_ip(self.properties[self.EIP]) self.resource_id_set(self.properties[self.EIP]) def resource_mapping(): return { 'AWS::EC2::EIPAssociation': ElasticIpAssociation, }
  • 16. 11) VPC UnitTest heat/heat/tests/test_vpc.py class VPCTestBase(common.HeatTestCase): class VPCTest(VPCTestBase): class SubnetTest(VPCTestBase): class NetworkInterfaceTest(VPCTestBase): class InternetGatewayTest(VPCTestBase): class RouteTableTest(VPCTestBase):
  • 17. 12) ElasticIp UnitTest heat/heat/tests/test_eip.py class EIPTest(common.HeatTestCase): class AllocTest(common.HeatTestCase):
  • 18. Thanks ● Email: sajuptpm@gmail.com ● Training Videos: https://www.youtube.com/user/sajuptpm/videos ● WebSite: http://fosshelp.blogspot.in ● IRC: saju_m ● Skype: sajuptpm