Author: Graham Land
Date: 08/03/17
Twitter: @allthingsclowd
def deploy_heat_stack(k5token, stack_name, stack_to_deploy, stack_parameters): | |
"""Summary : K5 HEAT API call to send a heat stack, wrapped in a string, to a K5 Project | |
Returns: | |
TYPE: JSON Object containing the new Stack Id or Error Codes | |
""" | |
orchestrationURL = unicode(get_endpoint(k5token, "orchestration")) + unicode("/stacks") | |
print orchestrationURL | |
token = k5token.headers['X-Subject-Token'] |
heat_template_version: 2013-05-23 | |
# Author: Graham Land | |
# Date: 08/03/2017 | |
# Purpose: Fujitsu K5 OpenStack IaaS Heat Template that deploys 3 servers on a new network and attaches the network to a given router. | |
# Input parameters - | |
# routerId - unique id of the router that the network should be attached to | |
# imageName - the image OS that will be deployed | |
# flavorName - the vcpu and ram size of the servers | |
# dataVolume - the size of the data volume to be attached to the servers | |
# cidr - private network ip address details |
#!/usr/bin/python | |
"""Summary: | |
The following tutorial demonstrates how the native OpenStack APIs can be used to deploy a server, network, subnet and router | |
on the Fujitsu K5 IaaS Platform | |
Author: Graham Land | |
Date: 27/01/17 | |
Twitter: @allthingsclowd | |
Github: https://github.com/allthingscloud | |
Blog: https://allthingscloud.eu |
heat_template_version: 2013-05-23 | |
# Author: Graham Land | |
# Date: 24/01/2017 | |
# Website: https//allthingscloud.eu | |
# Purpose: Template to demonstrate the basic format/usage of HOT template to deploy a PHP_CMSimple Server | |
description: PHP_CMSimple Demo Server | |
# Input parameters | |
parameters: |
Fully Automated Shared Service API Deployment on Fujitsu K5
Target - Fujitsu K5 IaaS Cloud Platform
Author: Graham Land Date: 18/1/17 Twitter: @allthingsclowd Github: https://github.com/allthingscloud Blog: https://allthingscloud.eu
def add_static_route_to_subnet(k5token, subnetid, routes, region): | |
# e.g. routes = = [{'destination': '192.168.101.0/24', 'nexthop': u'192.168.100.2'},{'destination': '192.168.100.0/24', 'nexthop': u'192.168.100.2'}] | |
subnetURL = 'https://networking.' + region + \ | |
'.cloud.global.fujitsu.com/v2.0/subnets/' + subnetid | |
try: | |
response = requests.put(subnetURL, | |
headers={'X-Auth-Token': k5token, | |
'Content-Type': 'application/json'}, | |
json={"subnet": {"host_routes": routes}}) | |
return response |
def update_router_routes(k5token, routerid, routes, region): | |
# e.g. routes = [{'destination': '192.168.10.0/24', 'nexthop': u'192.168.100.2'}, {'destination': '192.168.11.0/24', 'nexthop': u'192.168.100.2'}] | |
try: | |
routerURL = 'https://networking-ex.' + region + \ | |
'.cloud.global.fujitsu.com/v2.0/routers/' + routerid | |
response = requests.put(routerURL, | |
headers={'X-Auth-Token': k5token, | |
'Content-Type': 'application/json'}, | |
json={"router": {"routes": routes}}) | |
return response |
def inter_project_connection_create(k5token, router, port, region): | |
routerURL = 'https://networking-ex.' + region + \ | |
'.cloud.global.fujitsu.com/v2.0/routers/' + \ | |
router + '/add_cross_project_router_interface' | |
try: | |
response = requests.put(routerURL, | |
headers={'X-Auth-Token': k5token, | |
'Content-Type': 'application/json'}, | |
json={"port_id": port}) |
def get_rescoped_token(k5token, projectid, region): | |
"""Get a regional project token - rescoped | |
Returns: | |
STRING: Regionally Scoped Project Token | |
Args: | |
k5token (TYPE): valid regional token | |
projectid (TYPE): project id to scope to | |
region (TYPE): k5 region |