blob: 7df08caa515f2cdddf8825d4b8433abade6dc737 [file] [log] [blame]
Matteo Scandoloede125b2017-08-08 13:05:25 -07001
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 Bakerc41914d2017-06-26 14:00:52 -070017site_id=GetSites()[0]["site_id"]
18nodeinfo = {'hostname': "{{ node_hostname }}", 'dns': "8.8.8.8"}
19n_id = AddNode(site_id, nodeinfo)
20mac = "DE:AD:BE:EF:00:01"
21interfacetemplate = {'mac': mac, 'kind': 'physical', 'method': 'static', 'is_primary': True, 'if_name': 'eth0'}
22i_id = AddInterface(n_id, interfacetemplate)
23ip_addr = "169.254.169.1" # TO DO: get this from Neutron in the future
24netmask = "255.255.255.254" # TO DO: get this from Neutron in the future
25ipinfo = {'ip_addr': ip_addr, 'netmask': netmask, 'type': 'ipv4'}
26ip_id = AddIpAddress(i_id, ipinfo)
27routeinfo = {'interface_id': i_id, 'next_hop': "127.0.0.127", 'subnet': '0.0.0.0', 'metric': 1}
28r_id = AddRoute(n_id, routeinfo)
29hpc_slice_id = GetSlices({"name": "co_coblitz"})[0]["slice_id"]
30AddSliceToNodes(hpc_slice_id, [n_id])
31dnsdemux_slice_id = GetSlices({"name": "co_dnsdemux"})[0]["slice_id"]
32dnsredir_slice_id = GetSlices({"name": "co_dnsredir_coblitz"})[0]["slice_id"]
33AddSliceToNodes(dnsdemux_slice_id, [n_id])
34AddSliceToNodes(dnsredir_slice_id, [n_id])
35takeoverscript=GetBootMedium(n_id, "node-cloudinit", '')
36file("/root/takeover-{{ node_hostname }}","w").write(takeoverscript)