Thursday, October 19, 2017

OpenStack Orchestration to Add the subnet created to the Router interface.

OpenStack Orchestration to Add the subnet created to the Router interface.


  • Please note that there is already a router that hasbeen there as 'router'
  • This adds the subnet to the router so that the router 'router' can be used to route the traffic from the VMs in this network to the external network



---

The Stack file to add an interface to the router 'router' is as follows 

[root@newtonallinone HeatOrchestrationTemplates(keystone_admin)]# cat 06Routerinterfaceadd.yml
---
# for Newton release of OpenStack
#
heat_template_version: 2016-10-14

description: put the subnet to the router

resources:
  router_interface:
    type: OS::Neutron::RouterInterface
    properties:
      router: router
      subnet: internalsubnet1

outputs:
  subnet_info:
    value: { get_attr: [router_interface]}
[root@newtonallinone HeatOrchestrationTemplates(keystone_admin)]#


---

The above stack definition will add the subnet 'internalsubnet1' to the router 'router'.

--

Stack 


openstak stack create -t 06Routerinterfaceadd.yml routerinterfaceaddinternalsubnet1

[root@newtonallinone HeatOrchestrationTemplates(keystone_admin)]# openstack stack create -t 06Routerinterfaceadd.yml routerinterfaceaddinternalsubnet1
+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| id                  | 164f98d6-57da-4a59-a863-0c29bae587c1 |
| stack_name          | routerinterfaceaddinternalsubnet1    |
| description         | put the subnet to the router         |
| creation_time       | 2017-10-19T21:08:27Z                 |
| updated_time        | None                                 |
| stack_status        | CREATE_IN_PROGRESS                   |
| stack_status_reason | Stack CREATE started                 |
+---------------------+--------------------------------------+
[root@newtonallinone HeatOrchestrationTemplates(keystone_admin)]#


--


the stack creation shows complete 

Lets ensure that the Router has now an interface added from the 'internalsubnet1' subnet



---


[root@newtonallinone HeatOrchestrationTemplates(keystone_admin)]# neutron router-port-list router
+--------------------------------------+------+-------------------+--------------------------------------------------------------------------------------+
| id                                   | name | mac_address       | fixed_ips                                                                            |
+--------------------------------------+------+-------------------+--------------------------------------------------------------------------------------+
| 28c89ce2-4861-4dfc-bbf3-fae2bd0bf0d7 |      | fa:16:3e:91:54:0e | {"subnet_id": "9480b504-db1f-4f05-97b6-4058c7b168c9", "ip_address": "192.168.201.1"} |
| e035d8d8-de23-420b-a655-1d3afc0f1bb5 |      | fa:16:3e:fa:73:3c | {"subnet_id": "d8e83610-7b77-4683-abc5-0cf3b6186395", "ip_address": "172.16.101.9"}  |
| e69fe0ef-9535-418c-b60b-138abd9bc899 |      | fa:16:3e:9d:c2:d5 | {"subnet_id": "7206c8e9-64ca-4ba1-abef-12639820fd37", "ip_address": "192.168.11.1"}  |
+--------------------------------------+------+-------------------+--------------------------------------------------------------------------------------+
[root@newtonallinone HeatOrchestrationTemplates(keystone_admin)]#


---

This shows that a port from the internal Subnet internalsubnet1 with the IP address 192.168.202.1 has been added to the router

No comments:

Post a Comment