Matteo Scandolo | ede125b | 2017-08-08 13:05:25 -0700 | [diff] [blame] | 1 | |
| 2 | # Copyright 2017-present Open Networking Foundation |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | |
| 16 | |
Scott Baker | c41914d | 2017-06-26 14:00:52 -0700 | [diff] [blame] | 17 | site_id=GetSites()[0]["site_id"] |
| 18 | nodeinfo = {'hostname': "{{ node_hostname }}", 'dns': "8.8.8.8"} |
| 19 | n_id = AddNode(site_id, nodeinfo) |
| 20 | mac = "DE:AD:BE:EF:00:01" |
| 21 | interfacetemplate = {'mac': mac, 'kind': 'physical', 'method': 'static', 'is_primary': True, 'if_name': 'eth0'} |
| 22 | i_id = AddInterface(n_id, interfacetemplate) |
| 23 | ip_addr = "169.254.169.1" # TO DO: get this from Neutron in the future |
| 24 | netmask = "255.255.255.254" # TO DO: get this from Neutron in the future |
| 25 | ipinfo = {'ip_addr': ip_addr, 'netmask': netmask, 'type': 'ipv4'} |
| 26 | ip_id = AddIpAddress(i_id, ipinfo) |
| 27 | routeinfo = {'interface_id': i_id, 'next_hop': "127.0.0.127", 'subnet': '0.0.0.0', 'metric': 1} |
| 28 | r_id = AddRoute(n_id, routeinfo) |
| 29 | hpc_slice_id = GetSlices({"name": "co_coblitz"})[0]["slice_id"] |
| 30 | AddSliceToNodes(hpc_slice_id, [n_id]) |
| 31 | dnsdemux_slice_id = GetSlices({"name": "co_dnsdemux"})[0]["slice_id"] |
| 32 | dnsredir_slice_id = GetSlices({"name": "co_dnsredir_coblitz"})[0]["slice_id"] |
| 33 | AddSliceToNodes(dnsdemux_slice_id, [n_id]) |
| 34 | AddSliceToNodes(dnsredir_slice_id, [n_id]) |
| 35 | takeoverscript=GetBootMedium(n_id, "node-cloudinit", '') |
| 36 | file("/root/takeover-{{ node_hostname }}","w").write(takeoverscript) |