aboutsummaryrefslogtreecommitdiffstats
path: root/pharoslaas
diff options
context:
space:
mode:
authorAric Gardner <agardner@linuxfoundation.org>2019-10-04 15:28:34 -0400
committerAric Gardner <agardner@linuxfoundation.org>2019-10-04 15:29:32 -0400
commitf5025949a43415ae92b0885f3e61c43538f5c7b7 (patch)
tree8227ae1619a87935141ae4aea289bae3ea9ccc0f /pharoslaas
parent3a61da9e2e522f938686ebdd78f6db1a0a0e24b3 (diff)
Rename Pharos to Laas
related to https://gerrit.opnfv.org/gerrit/c/laas/+/68576 Signed-off-by: Aric Gardner <agardner@linuxfoundation.org> Change-Id: Ie5338260d6a13e557ef8fe00eda43269a17da3d6
Diffstat (limited to 'pharoslaas')
-rw-r--r--pharoslaas/actions/add_booking.py61
-rw-r--r--pharoslaas/actions/add_booking.yaml26
-rw-r--r--pharoslaas/actions/apex_install.sh18
-rw-r--r--pharoslaas/actions/apex_install.yaml22
-rw-r--r--pharoslaas/actions/apex_workflow.yaml30
-rw-r--r--pharoslaas/actions/clean-workflow.yaml31
-rw-r--r--pharoslaas/actions/compass_install.sh18
-rw-r--r--pharoslaas/actions/compass_install.yaml22
-rw-r--r--pharoslaas/actions/compass_workflow.yaml29
-rw-r--r--pharoslaas/actions/deployment_workflow.yaml39
-rw-r--r--pharoslaas/actions/fogAction.py153
-rw-r--r--pharoslaas/actions/fog_captureHost.py37
-rw-r--r--pharoslaas/actions/fog_captureHost.yaml25
-rw-r--r--pharoslaas/actions/fog_captureWorkflow.yaml25
-rw-r--r--pharoslaas/actions/fog_changeImage.py38
-rw-r--r--pharoslaas/actions/fog_changeImage.yaml31
-rw-r--r--pharoslaas/actions/fog_imageWorkflow.yaml31
-rw-r--r--pharoslaas/actions/fog_startImaging.py55
-rw-r--r--pharoslaas/actions/fog_startImaging.yaml27
-rw-r--r--pharoslaas/actions/fog_waitForCapture.py37
-rw-r--r--pharoslaas/actions/fog_waitForCapture.yaml25
-rw-r--r--pharoslaas/actions/fog_waitForImaging.py44
-rw-r--r--pharoslaas/actions/fog_waitForImaging.yaml25
-rw-r--r--pharoslaas/actions/fuel_horizon_nat.sh34
-rw-r--r--pharoslaas/actions/fuel_horizon_nat.yaml31
-rw-r--r--pharoslaas/actions/fuel_install.sh26
-rw-r--r--pharoslaas/actions/fuel_install.yaml21
-rw-r--r--pharoslaas/actions/fuel_workflow.yaml28
-rw-r--r--pharoslaas/actions/genPass.sh20
-rw-r--r--pharoslaas/actions/genPass.yaml26
-rw-r--r--pharoslaas/actions/joid_install.sh64
-rw-r--r--pharoslaas/actions/joid_install.yaml27
-rw-r--r--pharoslaas/actions/joid_workflow.yaml31
-rw-r--r--pharoslaas/actions/password_workflow.yaml26
-rw-r--r--pharoslaas/actions/restartHost.sh20
-rw-r--r--pharoslaas/actions/restartHost.yaml27
-rw-r--r--pharoslaas/actions/setPass.sh19
-rw-r--r--pharoslaas/actions/setPass.yaml30
-rw-r--r--pharoslaas/actions/update.sh29
-rw-r--r--pharoslaas/actions/update.yaml21
-rw-r--r--pharoslaas/actions/update_workflow.yaml31
-rw-r--r--pharoslaas/actions/vpnAction.py183
-rw-r--r--pharoslaas/actions/vpn_delete_user.py47
-rw-r--r--pharoslaas/actions/vpn_delete_user.yaml30
-rw-r--r--pharoslaas/actions/vpn_make_user.py61
-rw-r--r--pharoslaas/actions/vpn_make_user.yaml31
-rw-r--r--pharoslaas/actions/waitForBoot.sh29
-rw-r--r--pharoslaas/actions/waitForBoot.yaml26
-rw-r--r--pharoslaas/actions/workflows/apex_workflow.yaml7
-rw-r--r--pharoslaas/actions/workflows/clean-workflow.yaml16
-rw-r--r--pharoslaas/actions/workflows/compass_workflow.yaml8
-rw-r--r--pharoslaas/actions/workflows/deployment_workflow.yaml47
-rw-r--r--pharoslaas/actions/workflows/fog_captureWorkflow.yaml27
-rw-r--r--pharoslaas/actions/workflows/fog_imageWorkflow.yaml39
-rw-r--r--pharoslaas/actions/workflows/fuel_workflow.yaml8
-rw-r--r--pharoslaas/actions/workflows/joid_workflow.yaml11
-rw-r--r--pharoslaas/actions/workflows/password_workflow.yaml18
-rw-r--r--pharoslaas/actions/workflows/update_workflow.yaml24
-rw-r--r--pharoslaas/config.schema.yaml40
-rw-r--r--pharoslaas/hosts.json22
-rw-r--r--pharoslaas/pack.yaml28
-rw-r--r--pharoslaas/pharoslaas.yaml.example18
-rw-r--r--pharoslaas/requirements.txt3
-rw-r--r--pharoslaas/rules/clean.yaml28
-rw-r--r--pharoslaas/rules/deployment.yaml30
-rw-r--r--pharoslaas/sensors/dashboard_listener.yaml45
-rwxr-xr-xpharoslaas/sensors/pharos.py238
67 files changed, 0 insertions, 2424 deletions
diff --git a/pharoslaas/actions/add_booking.py b/pharoslaas/actions/add_booking.py
deleted file mode 100644
index b34c23d..0000000
--- a/pharoslaas/actions/add_booking.py
+++ /dev/null
@@ -1,61 +0,0 @@
-##############################################################################
-# Copyright 2017 Parker Berberian and Others #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-##############################################################################
-import json
-import requests
-import time
-import calendar
-from st2actions.runners.pythonrunner import Action
-
-
-class Add_Booking_Action(Action):
-
- def run(self, booking_id):
- dashboard = self.action_service.get_value(name="dashboard_url")
- url = dashboard + "api/bookings/" + str(booking_id)
- try:
- booking = requests.get(url).json()
- booking['start'] = self.convert_time(booking['start'])
- booking['end'] = self.convert_time(booking['end'])
- booking['status'] = 1
-
- # add booking id to bookings list
- bookings = json.loads(
- self.action_service.get_value(name="bookings", local=False)
- )
- if booking['id'] in bookings:
- return
- bookings.append(booking['id'])
- self.action_service.set_value(
- name="bookings",
- value=json.dumps(bookings),
- local=False
- )
-
- # add booking to datastore
- name = "booking_" + str(booking['id'])
- self.action_service.set_value(
- name=name,
- value=json.dumps(booking),
- local=False
- )
-
- except Exception:
- pass
-
- def convert_time(self, timestr):
- time_struct = time.strptime(timestr, '%Y-%m-%dT%H:%M:%SZ')
- epoch_time = calendar.timegm(time_struct)
- return epoch_time
diff --git a/pharoslaas/actions/add_booking.yaml b/pharoslaas/actions/add_booking.yaml
deleted file mode 100644
index 0851599..0000000
--- a/pharoslaas/actions/add_booking.yaml
+++ /dev/null
@@ -1,26 +0,0 @@
----
-##############################################################################
-# Copyright 2017 Parker Berberian and Others #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-##############################################################################
-
-name: add_booking
-enabled: true
-runner_type: python-script
-entry_point: add_booking.py
-parameters:
- booking:
- type: string
- required: true
- description: "id of booking to add"
diff --git a/pharoslaas/actions/apex_install.sh b/pharoslaas/actions/apex_install.sh
deleted file mode 100644
index f3ca83b..0000000
--- a/pharoslaas/actions/apex_install.sh
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/bash
-##############################################################################
-# Copyright 2017 Parker Berberian and Others #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-##############################################################################
-
-echo "not implemented"
diff --git a/pharoslaas/actions/apex_install.yaml b/pharoslaas/actions/apex_install.yaml
deleted file mode 100644
index 1956997..0000000
--- a/pharoslaas/actions/apex_install.yaml
+++ /dev/null
@@ -1,22 +0,0 @@
----
-##############################################################################
-# Copyright 2017 Parker Berberian and Others #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-##############################################################################
-
-name: apex_install
-description: "placeholder for apex isntallation action"
-runner_type: remote-shell-script
-entry_point: apex_install.sh
-enabled: false
diff --git a/pharoslaas/actions/apex_workflow.yaml b/pharoslaas/actions/apex_workflow.yaml
deleted file mode 100644
index 43adf4a..0000000
--- a/pharoslaas/actions/apex_workflow.yaml
+++ /dev/null
@@ -1,30 +0,0 @@
----
-##############################################################################
-# Copyright 2017 Parker Berberian and Others #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-##############################################################################
-
-name: "apex_workflow"
-runner_type: "action-chain"
-description: "This workflow installs apex"
-enabled: true
-entry_point: "workflows.apex_workflow.yaml"
-parameters:
- host:
- type: "string"
- required: true
-
- scenario:
- type: "string"
- required: false
diff --git a/pharoslaas/actions/clean-workflow.yaml b/pharoslaas/actions/clean-workflow.yaml
deleted file mode 100644
index cc93afb..0000000
--- a/pharoslaas/actions/clean-workflow.yaml
+++ /dev/null
@@ -1,31 +0,0 @@
----
-##############################################################################
-# Copyright 2017 Parker Berberian and Others #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-##############################################################################
-
-name: "clean-workflow"
-runner_type: "action-chain"
-description: "This workflow cleans a host after a deployment"
-entry_point: "workflows/clean-workflow.yaml"
-enabled: true
-parameters:
- host:
- type: "string"
- required: true
- description: "hostname of host to be cleaned"
- key:
- type: "string"
- required: false
- description: "st2 key of vpn user to delete"
diff --git a/pharoslaas/actions/compass_install.sh b/pharoslaas/actions/compass_install.sh
deleted file mode 100644
index 4d5d829..0000000
--- a/pharoslaas/actions/compass_install.sh
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/bash
-##############################################################################
-# Copyright 2017 Parker Berberian and Others #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-##############################################################################
-
-curl https://raw.githubusercontent.com/opnfv/compass4nfv/stable/euphrates/quickstart.sh | bash
diff --git a/pharoslaas/actions/compass_install.yaml b/pharoslaas/actions/compass_install.yaml
deleted file mode 100644
index 9f88314..0000000
--- a/pharoslaas/actions/compass_install.yaml
+++ /dev/null
@@ -1,22 +0,0 @@
----
-##############################################################################
-# Copyright 2017 Parker Berberian and Others #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-##############################################################################
-
-name: compass_install
-description: "placeholder for compass action"
-runner_type: remote-shell-script
-entry_point: compass_install.sh
-enabled: true
diff --git a/pharoslaas/actions/compass_workflow.yaml b/pharoslaas/actions/compass_workflow.yaml
deleted file mode 100644
index 8e78372..0000000
--- a/pharoslaas/actions/compass_workflow.yaml
+++ /dev/null
@@ -1,29 +0,0 @@
----
-##############################################################################
-# Copyright 2017 Parker Berberian and Others #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-##############################################################################
-
-name: "compass_workflow"
-runner_type: "action-chain"
-entry_point: "workflows/compass_workflow.yaml"
-enabled: true
-parameters:
- host:
- type: "string"
- required: true
-
- scenario:
- type: "string"
- required: false
diff --git a/pharoslaas/actions/deployment_workflow.yaml b/pharoslaas/actions/deployment_workflow.yaml
deleted file mode 100644
index 659b7e2..0000000
--- a/pharoslaas/actions/deployment_workflow.yaml
+++ /dev/null
@@ -1,39 +0,0 @@
----
-##############################################################################
-# Copyright 2017 Parker Berberian and Others #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-##############################################################################
-
-description: This is the workflow that will provision the host as requested.
-enabled: true
-runner_type: mistral-v2
-entry_point: workflows/deployment_workflow.yaml
-name: deployment_workflow
-pack: pharoslaas
-parameters:
- installer:
- required: true
- type: string
- host:
- required: true
- type: string
- scenario:
- required: false
- type: string
- os:
- required: false
- type: string
- booking:
- required: false
- type: string
diff --git a/pharoslaas/actions/fogAction.py b/pharoslaas/actions/fogAction.py
deleted file mode 100644
index ef74939..0000000
--- a/pharoslaas/actions/fogAction.py
+++ /dev/null
@@ -1,153 +0,0 @@
-##############################################################################
-# Copyright 2017 Parker Berberian and Others #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-##############################################################################
-
-import requests
-import sys
-import json
-import time
-from st2actions.runners.pythonrunner import Action
-
-
-class FogAction(Action):
- """
- This class talks with the REST web api for the FOG server.
- """
- def __init__(self, config=None):
- self.baseURL = config['fog']['address']
- self.fogKey = config['fog']['api_key']
- self.userKey = config['fog']['user_key']
- self.updateHeader()
-
- def updateHeader(self):
- """
- recreates the http header used to talk to the fog api
- """
- self.header = {}
- self.header['fog-api-token'] = self.fogKey
- self.header['fog-user-token'] = self.userKey
-
- def getImageID(self, img=None, os=None, host=None):
- """
- returns the numerical id associated with the given img name or
- operating system. If both are given, the img gets priority.
- if img is a number, it is assumed to be a valid id
- """
- # st2 will promote an empty arg to the str "None" :(
- if not img or img == "None":
- return self.getImageIDFromOS(os, host)
- try:
- return int(img)
- except:
- url = self.baseURL+"image"
- images = requests.get(url=url, headers=self.header)
- images = images.json()['images']
- for image in images:
- if img == image['name']:
- return image['id']
- return -1
-
- def getImageIDFromOS(self, os, host):
- enum = {"ubuntu": "ubuntu_image",
- "centos": "centos_image",
- "suse": "suse_image"
- }
- os = os.lower()
- if os not in enum.keys():
- return -1
- host_dict = json.loads(
- self.action_service.get_value(name=host, local=False)
- )
- return int(host_dict[enum[os]])
-
- def delTask(self, hostNum):
- """
- Tries to delete an existing task for the host
- with hostNum as a host number
- """
- try:
- url = self.baseURL+'fog/host/'+str(hostNum)+'/cancel'
- req = requests.delete(url, headers=self.header)
- if req.status_code == 200:
- self.logger.info("%s", "successfully deleted image task")
- except Exception:
- self.logger.exception("Failed to delete the imaging task!")
-
- def getHostNumber(self, hostname):
- """
- returns the host number of given host
- """
- try:
- req = requests.get(self.baseURL+"host", headers=self.header)
- hostData = req.json()
- if hostData is not None:
- for hostDict in hostData['hosts']:
- if hostname == hostDict['name']:
- return hostDict['id']
- return -1
- except Exception:
- self.logger.exception('%s', "Failed to connect to the FOG server")
-
- def request(self, url, data=None, method="get"):
- if data is not None:
- return self.dataRequest(url, data, method=method)
- try:
- response = requests.get(url, headers=self.header)
- return response.json()
- except Exception:
- self.logger.exception("Failed to reach FOG at %s", url)
- sys.exit(1)
-
- def dataRequest(self, url, data, method="post"):
- methods = {
- "post": requests.post,
- "put": requests.put
- }
- try:
- return methods[method](url, json=data, headers=self.header)
- except Exception:
- self.logger.exception("Failed to reach FOG at %s", url)
- sys.exit(1)
-
- def getFogHost(self, host):
- hostData = self.action_service.get_value(host, local=False)
- return json.loads(hostData)['fog_name']
-
- def waitForTask(self, taskID):
- """
- Watches a task and waits for it to finish (disapear).
- There may be a smarter way to do this and track errors,
- but st2 will timeout for me if something goes wrong
- """
- task = self.getTask(taskID)
- while(task):
- time.sleep(15)
- task = self.getTask(taskID)
-
- def getAllTasks(self):
- try:
- tasks = requests.get(
- self.baseURL+'task/current',
- headers=self.header
- ).json()['tasks']
- return tasks
- except Exception:
- return []
-
- def getTask(self, taskID):
- for task in self.getAllTasks():
- if task['id'] == taskID:
- return task
- return {}
diff --git a/pharoslaas/actions/fog_captureHost.py b/pharoslaas/actions/fog_captureHost.py
deleted file mode 100644
index d8ee343..0000000
--- a/pharoslaas/actions/fog_captureHost.py
+++ /dev/null
@@ -1,37 +0,0 @@
-##############################################################################
-# Copyright 2017 Parker Berberian and Others #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-##############################################################################
-
-from fogAction import FogAction
-import requests
-import sys
-
-
-class StartCaptureAction(FogAction):
- def __init__(self, config=None):
- super(StartCaptureAction, self).__init__(config=config)
-
- def run(self, host=None):
- """
- Schedules a capture for the given host with its
- assigned image
- """
- host = self.getFogHost(host)
- num = str(self.getHostNumber(host))
- url = self.baseURL+'host/'+num+'/task'
- try:
- requests.post(url, headers=self.header, json={"taskTypeID": 2})
- except Exception:
- sys.exit(1)
diff --git a/pharoslaas/actions/fog_captureHost.yaml b/pharoslaas/actions/fog_captureHost.yaml
deleted file mode 100644
index 3e38825..0000000
--- a/pharoslaas/actions/fog_captureHost.yaml
+++ /dev/null
@@ -1,25 +0,0 @@
----
-##############################################################################
-# Copyright 2017 Parker Berberian and Others #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-##############################################################################
-
-name: fog_captureHost
-entry_point: fog_captureHost.py
-runner_type: python-script
-enabled: true
-parameters:
- host:
- type: string
- required: true
diff --git a/pharoslaas/actions/fog_captureWorkflow.yaml b/pharoslaas/actions/fog_captureWorkflow.yaml
deleted file mode 100644
index a951d55..0000000
--- a/pharoslaas/actions/fog_captureWorkflow.yaml
+++ /dev/null
@@ -1,25 +0,0 @@
----
-##############################################################################
-# Copyright 2017 Parker Berberian and Others #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-##############################################################################
-
-name: fog_captureWorkflow
-entry_point: workflows/fog_captureWorkflow.yaml
-runner_type: action-chain
-enabled: true
-parameters:
- host:
- type: string
- required: true
diff --git a/pharoslaas/actions/fog_changeImage.py b/pharoslaas/actions/fog_changeImage.py
deleted file mode 100644
index 3586a75..0000000
--- a/pharoslaas/actions/fog_changeImage.py
+++ /dev/null
@@ -1,38 +0,0 @@
-##############################################################################
-# Copyright 2017 Parker Berberian and Others #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-##############################################################################
-
-from fogAction import FogAction
-import requests
-
-
-class ChangeImageAction(FogAction):
- def __init__(self, config):
- super(ChangeImageAction, self).__init__(config=config)
-
- def run(self, host=None, image=None, os=None):
- """
- Sets the image to be used during ghosting to the image
- with id imgNum. host can either be a hostname or number.
- """
- imgNum = self.getImageID(img=image, os=os, host=host)
- if imgNum < 0:
- return
- host = self.getFogHost(host)
- hostnum = self.getHostNumber(host)
- url = self.baseURL+"host/"+str(hostnum)
- host_conf = requests.get(url, headers=self.header).json()
- host_conf['imageID'] = str(imgNum)
- requests.put(url+"/edit", headers=self.header, json=host_conf)
diff --git a/pharoslaas/actions/fog_changeImage.yaml b/pharoslaas/actions/fog_changeImage.yaml
deleted file mode 100644
index 36deff9..0000000
--- a/pharoslaas/actions/fog_changeImage.yaml
+++ /dev/null
@@ -1,31 +0,0 @@
----
-##############################################################################
-# Copyright 2017 Parker Berberian and Others #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-##############################################################################
-
-name: "fog_changeImage"
-enabled: true
-runner_type: python-script
-entry_point: "fog_changeImage.py"
-parameters:
- host:
- type: string
- required: true
- image:
- required: false
- type: string
- os:
- required: false
- type: string
diff --git a/pharoslaas/actions/fog_imageWorkflow.yaml b/pharoslaas/actions/fog_imageWorkflow.yaml
deleted file mode 100644
index f8c4aef..0000000
--- a/pharoslaas/actions/fog_imageWorkflow.yaml
+++ /dev/null
@@ -1,31 +0,0 @@
----
-##############################################################################
-# Copyright 2017 Parker Berberian and Others #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-##############################################################################
-
-name: "fog_imageWorkflow"
-entry_point: "workflows/fog_imageWorkflow.yaml"
-runner_type: "action-chain"
-enabled: true
-parameters:
- host:
- type: "string"
- required: true
- image:
- required: false
- type: "string"
- os:
- required: false
- type: "string"
diff --git a/pharoslaas/actions/fog_startImaging.py b/pharoslaas/actions/fog_startImaging.py
deleted file mode 100644
index f775efe..0000000
--- a/pharoslaas/actions/fog_startImaging.py
+++ /dev/null
@@ -1,55 +0,0 @@
-##############################################################################
-# Copyright 2017 Parker Berberian and Others #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-##############################################################################
-
-from fogAction import FogAction
-import requests
-import sys
-
-
-class StartImagingAction(FogAction):
- def __init__(self, config=None):
- super(StartImagingAction, self).__init__(config=config)
-
- def run(self, host=None):
- """
- Schedules an imaging task for the given host.
- This automatically uses the "associated" disk image.
- """
- host = self.getFogHost(host)
- num = str(self.getHostNumber(host))
- url = self.baseURL+'host/'+num+'/task'
- try:
- req = requests.post(
- url,
- headers=self.header,
- json={"taskTypeID": 1}
- )
- if req.status_code == 200:
- # self.logger.info("%s", "Scheduled image task for host")
- pass
- except Exception:
- # self.logger.warning("%s", "Failed to schedule host imaging")
- # self.logger.warning("%s", "Trying to delete existing image task")
- self.delTask(num)
- req = requests.post(
- url,
- headers=self.header,
- json={"taskTypeID": 1}
- )
- if req.status_code == 200:
- # self.logger.info("%s", "Scheduled image task for host")
- pass
- sys.exit(0)
diff --git a/pharoslaas/actions/fog_startImaging.yaml b/pharoslaas/actions/fog_startImaging.yaml
deleted file mode 100644
index 2a24f4d..0000000
--- a/pharoslaas/actions/fog_startImaging.yaml
+++ /dev/null
@@ -1,27 +0,0 @@
----
-##############################################################################
-# Copyright 2017 Parker Berberian and Others #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-##############################################################################
-
-name: "fog_startImaging"
-description: "This will use FOG to image the given host"
-runner_type: "python-script"
-enabled: true
-entry_point: "fog_startImaging.py"
-parameters:
- host:
- type: "string"
- description: "the hostname of the host (eg pod2)"
- required: true
diff --git a/pharoslaas/actions/fog_waitForCapture.py b/pharoslaas/actions/fog_waitForCapture.py
deleted file mode 100644
index 7f7c488..0000000
--- a/pharoslaas/actions/fog_waitForCapture.py
+++ /dev/null
@@ -1,37 +0,0 @@
-##############################################################################
-# Copyright 2017 Parker Berberian and Others #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-##############################################################################
-
-from fogAction import FogAction
-import sys
-
-
-class waitForCaptureAction(FogAction):
- def __init__(self, config=None):
- super(waitForCaptureAction, self).__init__(config=config)
-
- def run(self, host=None):
- host = self.getFogHost(host)
- captureTaskID = self.getCaptureTaskID(host)
- if(captureTaskID < 0):
- sys.exit(1)
- self.waitForTask(captureTaskID)
-
- def getCaptureTaskID(self, host=None):
- for task in self.getAllTasks():
- hostname = str(task['host']['name'])
- if hostname == host and int(task['typeID']) == 2:
- return task['id']
- return -1
diff --git a/pharoslaas/actions/fog_waitForCapture.yaml b/pharoslaas/actions/fog_waitForCapture.yaml
deleted file mode 100644
index 2d0364e..0000000
--- a/pharoslaas/actions/fog_waitForCapture.yaml
+++ /dev/null
@@ -1,25 +0,0 @@
----
-##############################################################################
-# Copyright 2017 Parker Berberian and Others #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-##############################################################################
-
-name: fog_waitForCapture
-enabled: true
-runner_type: python-script
-entry_point: fog_waitForCapture.py
-parameters:
- host:
- type: string
- required: true
diff --git a/pharoslaas/actions/fog_waitForImaging.py b/pharoslaas/actions/fog_waitForImaging.py
deleted file mode 100644
index ea73f8f..0000000
--- a/pharoslaas/actions/fog_waitForImaging.py
+++ /dev/null
@@ -1,44 +0,0 @@
-##############################################################################
-# Copyright 2017 Parker Berberian and Others #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-##############################################################################
-
-from fogAction import FogAction
-import sys
-
-
-class WaitForImagingAction(FogAction):
- def __init__(self, config=None):
- super(WaitForImagingAction, self).__init__(config=config)
-
- def run(self, host):
- """
- tracks the imaging task to completion.
- """
- host = self.getFogHost(host)
- imageTaskID = self.getImagingTaskID(host)
- if(imageTaskID < 0):
- sys.exit(1)
- self.waitForTask(imageTaskID)
-
- def getImagingTaskID(self, host):
- """
- Sorts through all current tasks to find the image task
- associated with the given host.
- """
- for task in self.getAllTasks():
- hostname = str(task['host']['name'])
- if hostname == host and int(task['typeID']) == 1:
- return task['id']
- return -1
diff --git a/pharoslaas/actions/fog_waitForImaging.yaml b/pharoslaas/actions/fog_waitForImaging.yaml
deleted file mode 100644
index 4be325c..0000000
--- a/pharoslaas/actions/fog_waitForImaging.yaml
+++ /dev/null
@@ -1,25 +0,0 @@
----
-##############################################################################
-# Copyright 2017 Parker Berberian and Others #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-##############################################################################
-
-name: "fog_waitForImaging"
-entry_point: "fog_waitForImaging.py"
-runner_type: "python-script"
-enabled: true
-parameters:
- host:
- required: true
- type: "string"
diff --git a/pharoslaas/actions/fuel_horizon_nat.sh b/pharoslaas/actions/fuel_horizon_nat.sh
deleted file mode 100644
index a58516d..0000000
--- a/pharoslaas/actions/fuel_horizon_nat.sh
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/bin/bash
-#############################################################################
-#Copyright 2017 Parker Berberian and others #
-# #
-#Licensed under the Apache License, Version 2.0 (the "License"); #
-#you may not use this file except in compliance with the License. #
-#You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-#Unless required by applicable law or agreed to in writing, software #
-#distributed under the License is distributed on an "AS IS" BASIS, #
-#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-#See the License for the specific language governing permissions and #
-#limitations under the License. #
-#############################################################################
-
-ctlprivip=$(virsh domifaddr ctl01 | grep 10.20.0 | awk '{print $4}' | cut -d "/" -f 1)
-ctlpubip=$(ssh -i fuel/mcp/scripts/mcp.rsa ubuntu@"$ctlprivip" ip r | grep 10.16.0.0/24 | awk '{print $9}')
-#default is 10.16.0.101?
-MYIP=$1
-DESTINATION=$ctlpubip
-MYBRIDGE=10.16.0.1
-DESTNETWORK=10.16.0.0/24
-PORT=8078
-
-iptables -I INPUT 2 -d "$MYIP" -p tcp --dport "$PORT" -j ACCEPT
-iptables -t nat -I INPUT 1 -d "$MYIP" -p tcp --dport "$PORT" -j ACCEPT
-iptables -I FORWARD -p tcp --dport "$PORT" -j ACCEPT
-
-iptables -t nat -I PREROUTING -p tcp -d "$MYIP" --dport "$PORT" -j DNAT --to-destination "$DESTINATION:$PORT"
-iptables -t nat -I POSTROUTING -p tcp -s "$DESTINATION" ! -d "$DESTNETWORK" -j SNAT --to-source "$MYIP"
-
-iptables -t nat -I POSTROUTING 2 -d "$DESTINATION" -j SNAT --to-source "$MYBRIDGE"
diff --git a/pharoslaas/actions/fuel_horizon_nat.yaml b/pharoslaas/actions/fuel_horizon_nat.yaml
deleted file mode 100644
index 15bc7d8..0000000
--- a/pharoslaas/actions/fuel_horizon_nat.yaml
+++ /dev/null
@@ -1,31 +0,0 @@
----
-##############################################################################
-# Copyright 2017 Parker Berberian and Others #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-##############################################################################
-
-name: fuel_horizon_nat
-runner_type: remote-shell-script
-entry_point: fuel_horizon_nat.sh
-parameters:
- my_ip:
- type: string
- description: "ip of remote host"
- required: true
- position: 0
- destination:
- type: string
- description: "ip of horizon dashboard"
- required: true
- position: 1
diff --git a/pharoslaas/actions/fuel_install.sh b/pharoslaas/actions/fuel_install.sh
deleted file mode 100644
index b5913f1..0000000
--- a/pharoslaas/actions/fuel_install.sh
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/bash
-##############################################################################
-# Copyright 2017 Parker Berberian and Others #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-##############################################################################
-
-git clone https://git.opnfv.org/fuel
-
-export TERM='xterm-256color' # hack to avoid tput error
-
-#make idf and pdf virtual
-mv fuel/mcp/config/labs/local/pod1.yaml fuel/mcp/config/labs/local/virtual_pod1.yaml
-mv fuel/mcp/config/labs/local/idf-pod1.yaml fuel/mcp/config/labs/local/idf-virtual_pod1.yaml
-
-fuel/ci/deploy.sh -b file://"$(pwd)"/fuel/mcp/config -l local -p virtual_pod1 -s os-nosdn-nofeature-noha
diff --git a/pharoslaas/actions/fuel_install.yaml b/pharoslaas/actions/fuel_install.yaml
deleted file mode 100644
index 301ac77..0000000
--- a/pharoslaas/actions/fuel_install.yaml
+++ /dev/null
@@ -1,21 +0,0 @@
----
-##############################################################################
-# Copyright 2017 Parker Berberian and Others #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-##############################################################################
-
-name: "fuel_install"
-enabled: true
-runner_type: remote-shell-script
-entry_point: "fuel_install.sh"
diff --git a/pharoslaas/actions/fuel_workflow.yaml b/pharoslaas/actions/fuel_workflow.yaml
deleted file mode 100644
index 6975054..0000000
--- a/pharoslaas/actions/fuel_workflow.yaml
+++ /dev/null
@@ -1,28 +0,0 @@
----
-##############################################################################
-# Copyright 2017 Parker Berberian and Others #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-##############################################################################
-
-name: "fuel_workflow"
-runner_type: "action-chain"
-enabled: true
-entry_point: "workflows/fuel_workflow.yaml"
-parameters:
- host:
- type: "string"
- required: true
- scenario:
- type: "string"
- required: false
diff --git a/pharoslaas/actions/genPass.sh b/pharoslaas/actions/genPass.sh
deleted file mode 100644
index 5eba059..0000000
--- a/pharoslaas/actions/genPass.sh
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/bash
-##############################################################################
-# Copyright 2017 Parker Berberian and Others #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-##############################################################################
-
-pass=$(base64 /dev/urandom | head -c 50 | tr -d '/' | tr -d '+' | head -c 25)
-
-st2 key set "$1" "$pass" --encrypt
diff --git a/pharoslaas/actions/genPass.yaml b/pharoslaas/actions/genPass.yaml
deleted file mode 100644
index c56daa6..0000000
--- a/pharoslaas/actions/genPass.yaml
+++ /dev/null
@@ -1,26 +0,0 @@
----
-##############################################################################
-# Copyright 2017 Parker Berberian and Others #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-##############################################################################
-
-name: genPass
-entry_point: genPass.sh
-enabled: true
-runner_type: local-shell-script
-parameters:
- key:
- type: string
- required: true
- position: 0
diff --git a/pharoslaas/actions/joid_install.sh b/pharoslaas/actions/joid_install.sh
deleted file mode 100644
index bab13e2..0000000
--- a/pharoslaas/actions/joid_install.sh
+++ /dev/null
@@ -1,64 +0,0 @@
-#!/bin/bash
-#############################################################################
-#Copyright 2017 Parker Berberian and others #
-# #
-#Licensed under the Apache License, Version 2.0 (the "License"); #
-#you may not use this file except in compliance with the License. #
-#You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-#Unless required by applicable law or agreed to in writing, software #
-#distributed under the License is distributed on an "AS IS" BASIS, #
-#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-#See the License for the specific language governing permissions and #
-#limitations under the License. #
-#############################################################################
-
-if [ "$1" ]; then
- # parses the passed scenario
- args=($(echo "$1" | tr "-" "\n"))
- # args is array: [os, nosdn, nofeature, noha]
-else
- args=('os' 'nosdn' 'nofeature' 'noha')
-fi
-# the deploy script expects 'none' rather than 'nofeature'
-if [ "nofeature" == "${args[2]}" ]; then
- args[2]="none"
-fi
-if [ "os" == "${args[0]}" ]; then
- args[0]="openstack"
-fi
-# grabs the joid repo
-git clone "https://gerrit.opnfv.org/gerrit/joid.git"
-# working directory has to be where 03-maasdeploy is
-cd joid/ci || exit 1
-# virtualy deploy maas
-./03-maasdeploy.sh virtual
-# deploys OPNFV with the given scenario
-./deploy.sh -o newton -s "${args[1]}" -t "${args[3]}" -l default -d xenial -m "${args[0]}" -f "${args[2]}"
-
-juju gui --show-credentials --no-browser &>output.juju
-
-DESTINATION=$( grep -E -o "[0-9].*[0-9]" output.juju | tr -d '/' | sed s/:.*//g )
-MYIP=$( ip a | grep -E -o "10.10.30.[0-9]+" | sed s/^.*255.*$//g | tr -d '\n' )
-
-rm -f output.juju
-
-
-############## Uses NAT to make juju gui available at my public address ####################
-
-MYIP=$1
-DESTINATION=$2
-MYBRIDGE=192.168.122.1
-DESTNETWORK=192.168.122.0/24
-PORT=17070
-
-iptables -I INPUT 2 -d "$MYIP" -p tcp --dport "$PORT" -j ACCEPT
-iptables -t nat -I INPUT 1 -d "$MYIP" -p tcp --dport "$PORT" -j ACCEPT
-iptables -I FORWARD -p tcp --dport "$PORT" -j ACCEPT
-
-iptables -t nat -I PREROUTING -p tcp -d "$MYIP" --dport "$PORT" -j DNAT --to-destination "$DESTINATION:$PORT"
-iptables -t nat -I POSTROUTING -p tcp -s "$DESTINATION" ! -d "$DESTNETWORK" -j SNAT --to-source "$MYIP"
-
-iptables -t nat -I POSTROUTING 2 -d "$DESTINATION" -j SNAT --to-source "$MYBRIDGE"
diff --git a/pharoslaas/actions/joid_install.yaml b/pharoslaas/actions/joid_install.yaml
deleted file mode 100644
index 8b26cb2..0000000
--- a/pharoslaas/actions/joid_install.yaml
+++ /dev/null
@@ -1,27 +0,0 @@
----
-##############################################################################
-# Copyright 2017 Parker Berberian and Others #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-##############################################################################
-
-name: "joid_install"
-runner_type: "remote-shell-script"
-description: "This action will install Joid onto a given host"
-enabled: true
-entry_point: "joid_install.sh"
-parameters:
- scenario:
- type: string
- required: false
- position: 1
diff --git a/pharoslaas/actions/joid_workflow.yaml b/pharoslaas/actions/joid_workflow.yaml
deleted file mode 100644
index 7273cf7..0000000
--- a/pharoslaas/actions/joid_workflow.yaml
+++ /dev/null
@@ -1,31 +0,0 @@
----
-##############################################################################
-# Copyright 2017 Parker Berberian and Others #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-##############################################################################
-
-name: "joid_workflow"
-description: "installs joid"
-runner_type: "action-chain"
-entry_point: "workflows/joid_workflow.yaml"
-enabled: true
-parameters:
- host:
- type: "string"
- required: true
- scenario:
- type: "string"
- required: false
- timeout:
- default: 7200
diff --git a/pharoslaas/actions/password_workflow.yaml b/pharoslaas/actions/password_workflow.yaml
deleted file mode 100644
index 7798d64..0000000
--- a/pharoslaas/actions/password_workflow.yaml
+++ /dev/null
@@ -1,26 +0,0 @@
----
-##############################################################################
-# Copyright 2017 Parker Berberian and Others #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-##############################################################################
-
-name: password_workflow
-description: "sets a rand pass on host and stores it encrypted"
-enabled: true
-runner_type: action-chain
-entry_point: "workflows/password_workflow.yaml"
-parameters:
- host:
- type: string
- required: true
diff --git a/pharoslaas/actions/restartHost.sh b/pharoslaas/actions/restartHost.sh
deleted file mode 100644
index b6842d1..0000000
--- a/pharoslaas/actions/restartHost.sh
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/bash
-##############################################################################
-# Copyright 2017 Parker Berberian and Others #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-##############################################################################
-
-ssh -o userknownhostsfile=/dev/null -o stricthostkeychecking=false root@"$1" "shutdown -r now"
-
-exit 0
diff --git a/pharoslaas/actions/restartHost.yaml b/pharoslaas/actions/restartHost.yaml
deleted file mode 100644
index f274caf..0000000
--- a/pharoslaas/actions/restartHost.yaml
+++ /dev/null
@@ -1,27 +0,0 @@
----
-##############################################################################
-# Copyright 2017 Parker Berberian and Others #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-##############################################################################
-
-name: restartHost
-description: restarts given host imediately and returns 0
-runner_type: local-shell-script
-entry_point: restartHost.sh
-parameters:
- host:
- type: string
- required: true
- description: host to restart
- position: 0
diff --git a/pharoslaas/actions/setPass.sh b/pharoslaas/actions/setPass.sh
deleted file mode 100644
index 8b1ddfc..0000000
--- a/pharoslaas/actions/setPass.sh
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/bash
-##############################################################################
-# Copyright 2017 Parker Berberian and Others #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-##############################################################################
-
-pass=$(st2 key get "$2" --decrypt | grep 'value' | awk '{print $4}')
-ssh -o userknownhostsfile=/dev/null -o stricthostkeychecking=no root@$1 "echo -e '$pass\n$pass' | passwd"
diff --git a/pharoslaas/actions/setPass.yaml b/pharoslaas/actions/setPass.yaml
deleted file mode 100644
index 0c12cba..0000000
--- a/pharoslaas/actions/setPass.yaml
+++ /dev/null
@@ -1,30 +0,0 @@
----
-##############################################################################
-# Copyright 2017 Parker Berberian and Others #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-##############################################################################
-
-name: setPass
-enabled: true
-entry_point: setPass.sh
-runner_type: local-shell-script
-parameters:
- host:
- required: true
- type: string
- position: 0
- key:
- required: true
- type: string
- position: 1
diff --git a/pharoslaas/actions/update.sh b/pharoslaas/actions/update.sh
deleted file mode 100644
index 6635864..0000000
--- a/pharoslaas/actions/update.sh
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/bin/bash
-##############################################################################
-# Copyright 2017 Parker Berberian and Others #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-##############################################################################
-
-#check which package manager is used and run appropriate update cmd
-
-if which apt; then
- apt -y update && apt -y upgrade
-elif which yum; then
- yum -y upgrade
-elif which zypper; then
- zypper -n update
-else
- echo "Could not find package manager"
- exit 1
-fi
diff --git a/pharoslaas/actions/update.yaml b/pharoslaas/actions/update.yaml
deleted file mode 100644
index 7c11a6d..0000000
--- a/pharoslaas/actions/update.yaml
+++ /dev/null
@@ -1,21 +0,0 @@
----
-##############################################################################
-# Copyright 2017 Parker Berberian and Others #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-##############################################################################
-
-name: update
-entry_point: update.sh
-enabled: true
-runner_type: remote-shell-script
diff --git a/pharoslaas/actions/update_workflow.yaml b/pharoslaas/actions/update_workflow.yaml
deleted file mode 100644
index 27bbbba..0000000
--- a/pharoslaas/actions/update_workflow.yaml
+++ /dev/null
@@ -1,31 +0,0 @@
----
-##############################################################################
-# Copyright 2017 Parker Berberian and Others #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-##############################################################################
-
-name: update_workflow
-entry_point: workflows/update_workflow.yaml
-enabled: true
-runner_type: action-chain
-parameters:
- host:
- required: true
- type: string
- os:
- required: false
- type: string
- disk:
- required: false
- type: string
diff --git a/pharoslaas/actions/vpnAction.py b/pharoslaas/actions/vpnAction.py
deleted file mode 100644
index 819ba13..0000000
--- a/pharoslaas/actions/vpnAction.py
+++ /dev/null
@@ -1,183 +0,0 @@
-##############################################################################
-# Copyright 2017 Parker Berberian and Others #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-##############################################################################
-
-import ldap
-import os
-import random
-from base64 import b64encode
-from st2actions.runners.pythonrunner import Action
-
-names = [
- 'frodo_baggins', 'samwise_gamgee', 'peregrin_took', 'meriadoc_brandybuck',
- 'bilbo_baggins', 'gandalf_grey', 'aragorn_dunadan', 'arwen_evenstar',
- 'saruman_white', 'pippin_took', 'merry _randybuck', 'legolas_greenleaf',
- 'gimli_gloin', 'anakin_skywalker', 'padme_amidala', 'han_solo',
- 'jabba_hut', 'mace_windu', 'count_dooku', 'qui-gon_jinn',
- 'admiral_ackbar', 'emperor_palpatine'
-]
-
-
-class VPNAction(Action):
- """
- This class communicates with the ldap server to manage vpn users.
- This class extends the above ABC, and implements the makeNewUser,
- removeOldUser, and __init__ abstract functions you must override to
- extend the VPN_BaseClass
- """
-
- def __init__(self, config=None):
- """
- init takes the parsed vpn config file as an arguement.
- automatically connects and authenticates on the ldap server
- based on the configuration file
- """
- self.config = config['vpn']
- server = self.config['server']
- self.uri = "ldap://"+server
-
- self.conn = None
- user = self.config['authentication']['user']
- pswd = self.config['authentication']['pass']
- if os.path.isfile(pswd):
- pswd = open(pswd).read()
- self.connect(user, pswd)
-
- def connect(self, root_dn, root_pass):
- """
- Opens a connection to the server in the config file
- and authenticates as the given user
- """
- self.conn = ldap.initialize(self.uri)
- self.conn.simple_bind_s(root_dn, root_pass)
-
- def addUser(self, full_name, passwd):
- """
- Adds a user to the ldap server. Creates the new user with the classes
- and in the directory given in the config file.
- full_name should be two tokens seperated by a space. The first token
- will become the username
- private helper function for the makeNewUser()
- """
- full_name = str(full_name)
- passwd = str(passwd) # avoids unicode bug
- first = full_name.split('_')[0]
- last = full_name.split('_')[1]
- user_dir = self.config['directory']['user']
- user_dir += ','+self.config['directory']['root']
- user_dir = str(user_dir)
- dn = "uid=" + first + ',' + user_dir
- record = [
- ('objectclass', ['top', 'inetOrgPerson']),
- ('uid', first),
- ('cn', full_name),
- ('sn', last),
- ('userpassword', passwd),
- ('ou', str(self.config['directory']['user'].split('=')[1]))
- ]
- self.conn.add_s(dn, record)
- return first, dn
-
- def makeNewUser(self, name=None, passwd=None):
- """
- creates a new user in the ldap database, with the given name
- if supplied. If no name is given, we will try to select from the
- pre-written list above, and will resort to generating a random string
- as a username if the preconfigured names are all taken.
- Returns the username and password the user needs to authenticate, and
- the dn that we can use to manage the user.
- """
- if name is None:
- i = 0
- while not self.checkName(name):
- i += 1
- if i == 20:
- name = self.randoString(8)
- name += ' '+self.randoString(8)
- break # generates a random name to prevent infinite loop
- name = self.genUserName()
- if passwd is None:
- passwd = self.randoString(15)
- username, dn = self.addUser(name, passwd)
- return username, passwd, dn
-
- def checkName(self, name):
- """
- returns true if the name is available
- """
- if name is None:
- return False
- uid = name.split('_')[0]
- base = self.config['directory']['user'] + ','
- base += self.config['directory']['root']
- filtr = '(uid=' + uid + ')'
- timeout = 5
- ans = self.conn.search_st(
- base,
- ldap.SCOPE_SUBTREE,
- filtr,
- timeout=timeout
- )
- return len(ans) < 1
-
- @staticmethod
- def randoString(n):
- """
- uses /dev/urandom to generate a random string of length n
- """
- n = int(n)
- # defines valid characters
- alpha = 'abcdefghijklmnopqrstuvwxyz'
- alpha_num = alpha
- alpha_num += alpha.upper()
- alpha_num += "0123456789"
-
- # generates random string from /dev/urandom
- rnd = b64encode(os.urandom(3*n)).decode('utf-8')
- random_string = ''
- for char in rnd:
- if char in alpha_num:
- random_string += char
- return str(random_string[:n])
-
- def genUserName(self):
- """
- grabs a random name from the list above
- """
- i = random.randint(0, len(names) - 1)
- return names[i]
-
- def deleteUser(self, dn):
- dn = str(dn) # avoids unicode bug
- self.conn.delete(dn)
-
- def getAllUsers(self):
- """
- returns all the user dn's in the ldap database in a list
- """
- base = self.config['directory']['user'] + ','
- base += self.config['directory']['root']
- filtr = '(objectclass='+self.config['user']['objects'][-1]+')'
- timeout = 10
- ans = self.conn.search_st(
- base,
- ldap.SCOPE_SUBTREE,
- filtr,
- timeout=timeout
- )
- users = []
- for user in ans:
- users.append(user[0]) # adds the dn of each user
- return users
diff --git a/pharoslaas/actions/vpn_delete_user.py b/pharoslaas/actions/vpn_delete_user.py
deleted file mode 100644
index eac5f78..0000000
--- a/pharoslaas/actions/vpn_delete_user.py
+++ /dev/null
@@ -1,47 +0,0 @@
-##############################################################################
-# Copyright 2017 Parker Berberian and Others #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-##############################################################################
-
-import json
-from vpnAction import VPNAction
-
-
-class Del_VPN_User(VPNAction):
-
- def __init__(self, config=None):
- super(Del_VPN_User, self).__init__(config=config)
-
- def run(self, dn=None, key=None):
- if not dn or dn == "None":
- if not key or key == "None":
- return
- vpn_info = json.loads(
- self.action_service.get_value(
- name=key,
- local=False,
- decrypt=True
- )
- )
- dn = vpn_info['dn']
- st2key = key
- else:
- st2key = 'vpn_'
- # get username from dn
- for attr in dn.split(','):
- if 'uid' in attr:
- st2key += attr.split('=')[-1]
- # we have the dn and key now
- self.action_service.delete_value(name=st2key, local=False)
- self.deleteUser(dn)
diff --git a/pharoslaas/actions/vpn_delete_user.yaml b/pharoslaas/actions/vpn_delete_user.yaml
deleted file mode 100644
index 4e06411..0000000
--- a/pharoslaas/actions/vpn_delete_user.yaml
+++ /dev/null
@@ -1,30 +0,0 @@
----
-##############################################################################
-# Copyright 2017 Parker Berberian and Others #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-##############################################################################
-
-name: vpn_delete_user
-entry_point: vpn_delete_user.py
-enabled: true
-runner_type: python-script
-parameters:
- dn:
- required: false
- type: string
- description: "dn of user to delete"
- key:
- required: false
- type: string
- description: "key in st2 datastore with vpn info"
diff --git a/pharoslaas/actions/vpn_make_user.py b/pharoslaas/actions/vpn_make_user.py
deleted file mode 100644
index 56cf9e6..0000000
--- a/pharoslaas/actions/vpn_make_user.py
+++ /dev/null
@@ -1,61 +0,0 @@
-##############################################################################
-# Copyright 2017 Parker Berberian and Others #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-##############################################################################
-
-import datetime
-from vpnAction import VPNAction
-import json
-
-
-class Make_VPN_User(VPNAction):
-
- def __init__(self, config=None):
- super(Make_VPN_User, self).__init__(config=config)
-
- def run(self, booking=None, user=None, passwd=None):
- if user == "None":
- user = None
- if passwd == "None":
- passwd = None
- name, passwd, dn = self.makeNewUser(name=user, passwd=passwd)
- vpn_info = {}
- vpn_info['dn'] = dn
- vpn_info['username'] = name
- vpn_info['password'] = passwd
- now = datetime.date.today()
- vpn_info['created'] = now.isoformat() # 'YYYY-MM-DD' today
- self.action_service.set_value(
- name='vpn_'+name,
- value=json.dumps(vpn_info),
- local=False,
- encrypt=True
- )
- if booking is not None:
- self.addUserToBooking(vpn_info, booking)
-
- def addUserToBooking(self, vpn_info, booking):
- name = "booking_" + str(booking)
- booking = json.loads(
- self.action_service.get_value(
- name=name,
- local=False
- )
- )
- booking['vpn_key'] = "vpn_" + vpn_info['username']
- self.action_service.set_value(
- name=name,
- value=json.dumps(booking),
- local=False
- )
diff --git a/pharoslaas/actions/vpn_make_user.yaml b/pharoslaas/actions/vpn_make_user.yaml
deleted file mode 100644
index eb90956..0000000
--- a/pharoslaas/actions/vpn_make_user.yaml
+++ /dev/null
@@ -1,31 +0,0 @@
----
-##############################################################################
-# Copyright 2017 Parker Berberian and Others #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-##############################################################################
-
-name: vpn_make_user
-entry_point: vpn_make_user.py
-runner_type: python-script
-enabled: true
-parameters:
- booking:
- required: false
- type: string
- user:
- required: false
- type: string
- passwd:
- required: false
- type: string
diff --git a/pharoslaas/actions/waitForBoot.sh b/pharoslaas/actions/waitForBoot.sh
deleted file mode 100644
index 399795e..0000000
--- a/pharoslaas/actions/waitForBoot.sh
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/bin/bash
-##############################################################################
-# Copyright 2017 Parker Berberian and Others #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-##############################################################################
-
-ping -c 1 "$1"
-
-while [ $? -gt 0 ] ; do
- ping -c 1 "$1" && sleep 5
-done
-
-false
-
-while [ $? -gt 0 ] ; do
- ping -c 1 "$1" && sleep 5
-done
-exit 0
diff --git a/pharoslaas/actions/waitForBoot.yaml b/pharoslaas/actions/waitForBoot.yaml
deleted file mode 100644
index 0700980..0000000
--- a/pharoslaas/actions/waitForBoot.yaml
+++ /dev/null
@@ -1,26 +0,0 @@
----
-##############################################################################
-# Copyright 2017 Parker Berberian and Others #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-##############################################################################
-
-name: waitForBoot
-entry_point: waitForBoot.sh
-runner_type: local-shell-script
-enabled: true
-parameters:
- host:
- type: string
- required: true
- position: 0
diff --git a/pharoslaas/actions/workflows/apex_workflow.yaml b/pharoslaas/actions/workflows/apex_workflow.yaml
deleted file mode 100644
index 17d842f..0000000
--- a/pharoslaas/actions/workflows/apex_workflow.yaml
+++ /dev/null
@@ -1,7 +0,0 @@
----
-chain:
- -
- name: "apex_install"
- ref: "pharoslaas.apex_install"
- parameters:
- hosts: "{{host}}"
diff --git a/pharoslaas/actions/workflows/clean-workflow.yaml b/pharoslaas/actions/workflows/clean-workflow.yaml
deleted file mode 100644
index c0a13e7..0000000
--- a/pharoslaas/actions/workflows/clean-workflow.yaml
+++ /dev/null
@@ -1,16 +0,0 @@
----
-chain:
- -
- name: "image"
- ref: "pharoslaas.fog_imageWorkflow"
- parameters:
- host: "{{host}}"
- on-success: "delete_vpn_user"
-
- -
- name: "delete_vpn_user"
- ref: "pharoslaas.vpn_delete_user"
- parameters:
- key: "{{key}}"
-
-default: "image"
diff --git a/pharoslaas/actions/workflows/compass_workflow.yaml b/pharoslaas/actions/workflows/compass_workflow.yaml
deleted file mode 100644
index 6a03511..0000000
--- a/pharoslaas/actions/workflows/compass_workflow.yaml
+++ /dev/null
@@ -1,8 +0,0 @@
----
-chain:
- -
- name: "compass_install"
- ref: "opnfv.compass_install"
- parameters:
- hosts: "{{host}}"
- timeout: 7200
diff --git a/pharoslaas/actions/workflows/deployment_workflow.yaml b/pharoslaas/actions/workflows/deployment_workflow.yaml
deleted file mode 100644
index c32d60d..0000000
--- a/pharoslaas/actions/workflows/deployment_workflow.yaml
+++ /dev/null
@@ -1,47 +0,0 @@
----
-version: '2.0'
-pharoslaas.deployment_workflow:
- description: The master workflow to provision, install, deploy hosts
- input:
- - host
- - installer
- - scenario
- - os
- - booking
- tasks:
- image_host:
- action: pharoslaas.fog_imageWorkflow host=<% $.host %> os=<% $.os %>
- on-success:
- - install_fuel: <% $.installer = 'Fuel' %>
- - install_joid: <% $.installer = 'Joid' %>
- - install_apex: <% $.installer = 'Apex' %>
- - install_compass: <% $.installer = 'Compass' %>
- - change_password: <% not $.installer in list('Fuel','Joid','Apex','Compass') %>
-
- install_fuel:
- action: pharoslaas.fuel_workflow host=<% $.host %> scenario=<% $.scenario %>
- on-success:
- - change_password
-
- install_joid:
- action: pharoslaas.joid_workflow host=<% $.host %> scenario=<% $.scenario %>
- on-success:
- - change_password
-
- install_apex:
- action: pharoslaas.apex_workflow host=<% $.host %> scenario=<% $.scenario %>
- on-success:
- - change_password
-
- install_compass:
- action: pharoslaas.compass_workflow host=<% $.host %> scenario=<% $.scenario %>
- on-success:
- - change_password
-
- change_password:
- action: pharoslaas.password_workflow host=<% $.host %>
- on-success:
- - make_vpn_user
-
- make_vpn_user:
- action: pharoslaas.vpn_make_user booking=<% $.booking %>
diff --git a/pharoslaas/actions/workflows/fog_captureWorkflow.yaml b/pharoslaas/actions/workflows/fog_captureWorkflow.yaml
deleted file mode 100644
index 0f2fece..0000000
--- a/pharoslaas/actions/workflows/fog_captureWorkflow.yaml
+++ /dev/null
@@ -1,27 +0,0 @@
----
-chain:
- -
- name: "startCapture"
- ref: "pharoslaas.fog_captureHost"
- parameters:
- host: "{{host}}"
- on-success: "restartHost"
- -
- name: "restartHost"
- ref: "pharoslaas.restartHost"
- parameters:
- host: "{{host}}"
- on-success: "waitForCapture"
- -
- name: "waitForCapture"
- ref: "pharoslaas.fog_waitForCapture"
- parameters:
- host: "{{host}}"
- on-success: "waitForBoot"
-
- -
- name: "waitForBoot"
- ref: pharoslaas.waitForBoot
- parameters:
- host: "{{host}}"
- timeout: 60
diff --git a/pharoslaas/actions/workflows/fog_imageWorkflow.yaml b/pharoslaas/actions/workflows/fog_imageWorkflow.yaml
deleted file mode 100644
index 52eff63..0000000
--- a/pharoslaas/actions/workflows/fog_imageWorkflow.yaml
+++ /dev/null
@@ -1,39 +0,0 @@
----
-chain:
- -
- name: "changeImage"
- ref: "pharoslaas.fog_changeImage"
- parameters:
- image: "{{image}}"
- host: "{{host}}"
- os: "{{os}}"
- on-success: "startImaging"
-
- -
- name: "startImaging"
- ref: pharoslaas.fog_startImaging
- parameters:
- host: "{{host}}"
- on-success: "restartHost"
-
- -
- name: "restartHost"
- ref: pharoslaas.restartHost
- parameters:
- host: "{{host}}"
- on-success: "waitForImaging"
-
- -
- name: "waitForImaging"
- ref: pharoslaas.fog_waitForImaging
- parameters:
- host: "{{host}}"
- timeout: 180
- on-success: "waitForBoot"
-
- -
- name: "waitForBoot"
- ref: pharoslaas.waitForBoot
- parameters:
- host: "{{host}}"
- timeout: 60
diff --git a/pharoslaas/actions/workflows/fuel_workflow.yaml b/pharoslaas/actions/workflows/fuel_workflow.yaml
deleted file mode 100644
index f0d166c..0000000
--- a/pharoslaas/actions/workflows/fuel_workflow.yaml
+++ /dev/null
@@ -1,8 +0,0 @@
----
-chain:
- -
- name: 'fuel_install'
- ref: 'pharoslaas.fuel_install'
- parameters:
- hosts: "{{host}}"
- timeout: 7200
diff --git a/pharoslaas/actions/workflows/joid_workflow.yaml b/pharoslaas/actions/workflows/joid_workflow.yaml
deleted file mode 100644
index 610832e..0000000
--- a/pharoslaas/actions/workflows/joid_workflow.yaml
+++ /dev/null
@@ -1,11 +0,0 @@
----
-chain:
-
- -
- name: "joid_install"
- ref: "pharoslaas.joid_install"
- parameters:
- hosts: "{{host}}"
- timeout: "{{timeout}}"
-
-default: "joid_install"
diff --git a/pharoslaas/actions/workflows/password_workflow.yaml b/pharoslaas/actions/workflows/password_workflow.yaml
deleted file mode 100644
index d400c53..0000000
--- a/pharoslaas/actions/workflows/password_workflow.yaml
+++ /dev/null
@@ -1,18 +0,0 @@
----
-chain:
-
- -
- name: genPasswd
- ref: pharoslaas.genPass
- parameters:
- key: "{{host}}-pass"
- on-success: setPasswd
-
- -
- name: setPasswd
- ref: pharoslaas.setPass
- parameters:
- host: "{{host}}"
- key: "{{host}}-pass"
-
-default: genPasswd
diff --git a/pharoslaas/actions/workflows/update_workflow.yaml b/pharoslaas/actions/workflows/update_workflow.yaml
deleted file mode 100644
index 132266f..0000000
--- a/pharoslaas/actions/workflows/update_workflow.yaml
+++ /dev/null
@@ -1,24 +0,0 @@
----
-chain:
-
- -
- name: "imageHost"
- ref: "pharoslaas.fog_imageWorkflow"
- parameters:
- image: "{{image}}"
- os: "{{os}}"
- host: "{{host}}"
- on-success: "updateHost"
-
- -
- name: "updateHost"
- ref: "pharoslaas.update"
- parameters:
- hosts: "{{host}}"
- on-success: "captureHost"
-
- -
- name: "captureHost"
- ref: "pharoslaas.fog_captureWorkflow"
- parameters:
- host: "{{host}}"
diff --git a/pharoslaas/config.schema.yaml b/pharoslaas/config.schema.yaml
deleted file mode 100644
index 309afe8..0000000
--- a/pharoslaas/config.schema.yaml
+++ /dev/null
@@ -1,40 +0,0 @@
----
-##############################################################################
-# Copyright 2017 Parker Berberian and Others #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-##############################################################################
-
-fog:
- description: "FOG server configuration"
- type: "object"
- required: true
- properties:
- address:
- type: "string"
- description: "where to reach the fog server"
- required: true
- api_key:
- type: "string"
- description: "FOG api key"
- required: true
- secret: true
- user_key:
- type: "string"
- description: "FOG api user key"
- required: true
- secret: true
-
-vpn:
- type: object
- required: false
diff --git a/pharoslaas/hosts.json b/pharoslaas/hosts.json
deleted file mode 100644
index a39616c..0000000
--- a/pharoslaas/hosts.json
+++ /dev/null
@@ -1,22 +0,0 @@
-[
- {
- "name": "pod1",
- "value": "{\"pharos_id\": 999, \"fog_name\": \"fog_host1\", \"hostname\": \"pod1\", \"ubuntu_image\": 1, \"centos_image\": 2, \"suse_image\": 3}"
- },
- {
- "name": "pod2",
- "value": "{\"pharos_id\": 998, \"fog_name\": \"fog_host2\", \"hostname\": \"pod2\", \"ubuntu_image\": 1, \"centos_image\": 2, \"suse_image\": 3}"
- },
- {
- "name": "pod3",
- "value": "{\"pharos_id\": 997, \"fog_name\": \"fog_name3\", \"hostname\": \"pod3\", \"ubuntu_image\": 1, \"centos_image\": 2, \"suse_image\": 3}"
- },
- {
- "name": "hosts",
- "value" : "[\"pod1\", \"pod2\", \"pod3\"]"
- },
- {
- "name": "bookings",
- "value": "[]"
- }
-]
diff --git a/pharoslaas/pack.yaml b/pharoslaas/pack.yaml
deleted file mode 100644
index 7144a71..0000000
--- a/pharoslaas/pack.yaml
+++ /dev/null
@@ -1,28 +0,0 @@
----
-##############################################################################
-# Copyright 2017 Parker Berberian and Others #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-##############################################################################
-
-name: pharoslaas
-description: Provides all tools needed to host your own OPNFV lab
-keywords:
- - OPNFV
- - Lab-as-a-Service
- - LaaS
- - Linux
- - Openstack
-version: 0.0.1
-author: pberberian
-email: pberberian@iol.unh.edu
diff --git a/pharoslaas/pharoslaas.yaml.example b/pharoslaas/pharoslaas.yaml.example
deleted file mode 100644
index 954e0d7..0000000
--- a/pharoslaas/pharoslaas.yaml.example
+++ /dev/null
@@ -1,18 +0,0 @@
----
-fog:
- address: "http://myfogserver.com/fog/"
- api_key: "MySecretAPIKey"
- user_key: "MySecretAPIUserKey"
-
-vpn:
- server: "myvpn.ldap.server.org"
- authentication:
- pass: "password"
- user: "cn=root,o=opnfv,dc=iol,dc=unh,dc=edu"
- directory:
- root: "o=opnfv,dc=iol,dc=unh,dc=edu"
- user: "ou=People"
- user:
- objects:
- - top
- - inetOrgPerson
diff --git a/pharoslaas/requirements.txt b/pharoslaas/requirements.txt
deleted file mode 100644
index 697fe47..0000000
--- a/pharoslaas/requirements.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-requests
-libvirt-python
-python-ldap
diff --git a/pharoslaas/rules/clean.yaml b/pharoslaas/rules/clean.yaml
deleted file mode 100644
index f623ce6..0000000
--- a/pharoslaas/rules/clean.yaml
+++ /dev/null
@@ -1,28 +0,0 @@
----
-##############################################################################
-# Copyright 2017 Parker Berberian and Others #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-##############################################################################
-
-name: on_end_deployment_trigger
-pack: pharoslaas
-description: dummy rule to link end deployment trigger to clean action
-enabled: true
-trigger:
- type: pharoslaas.end_deployment_trigger
-action:
- ref: pharoslaas.clean-workflow
- parameters:
- host: "{{ trigger.host }}"
- key: "{{trigger.key}}"
diff --git a/pharoslaas/rules/deployment.yaml b/pharoslaas/rules/deployment.yaml
deleted file mode 100644
index 93942bf..0000000
--- a/pharoslaas/rules/deployment.yaml
+++ /dev/null
@@ -1,30 +0,0 @@
----
-##############################################################################
-# Copyright 2017 Parker Berberian and Others #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-##############################################################################
-
-name: on_deployment_trigger
-pack: pharoslaas
-description: "rule to link deployment trigger to deployment action"
-enabled: true
-trigger:
- type: pharoslaas.start_deployment_trigger
-action:
- ref: pharoslaas.deployment_workflow
- parameters:
- installer: "{{ trigger.installer }}"
- host: "{{ trigger.host }}"
- scenario: "{{ trigger.scenario }}"
- booking: "{{ trigger.booking }}"
diff --git a/pharoslaas/sensors/dashboard_listener.yaml b/pharoslaas/sensors/dashboard_listener.yaml
deleted file mode 100644
index 31c215f..0000000
--- a/pharoslaas/sensors/dashboard_listener.yaml
+++ /dev/null
@@ -1,45 +0,0 @@
----
-##############################################################################
-# Copyright 2017 Parker Berberian and Others #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-##############################################################################
-
-class_name: "Pharos_api"
-entry_point: "pharos.py"
-description: "polls the dashboard api for deployments"
-poll_interval: 30
-trigger_types:
- -
- name: "start_deployment_trigger"
- descrition: "a simple deployment trigger"
- payload_schema:
- type: "object"
- properties:
- host:
- type: "string"
- installer:
- type: "string"
- scenario:
- type: "string"
- booking:
- type: "string"
-
- -
- name: "end_deployment_trigger"
- description: "marks the end of a booking"
- payload_schema:
- host:
- type: "string"
- key:
- type: "string"
diff --git a/pharoslaas/sensors/pharos.py b/pharoslaas/sensors/pharos.py
deleted file mode 100755
index a11160c..0000000
--- a/pharoslaas/sensors/pharos.py
+++ /dev/null
@@ -1,238 +0,0 @@
-##############################################################################
-# Copyright 2017 Parker Berberian and Others #
-# #
-# Licensed under the Apache License, Version 2.0 (the "License"); #
-# you may not use this file except in compliance with the License. #
-# You may obtain a copy of the License at #
-# #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-# #
-# Unless required by applicable law or agreed to in writing, software #
-# distributed under the License is distributed on an "AS IS" BASIS, #
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
-# See the License for the specific language governing permissions and #
-# limitations under the License. #
-##############################################################################
-
-import requests
-import time
-import calendar
-import json
-from st2reactor.sensor.base import PollingSensor
-
-
-class Pharos_api(PollingSensor):
- """
- This class listens to the dashboard and starts/stops bookings accordingly.
- """
-
- def getBookingList(self):
- return json.loads(
- self.sensor_service.get_value(name='bookings', local=False)
- )
-
- def updateBookingList(self, blist):
- self.sensor_service.set_value(
- name='bookings',
- value=json.dumps(blist),
- local=False
- )
-
- def AddBooking(self, new_booking):
- """
- checks if booking is in the database, and adds it if it isnt
- """
- # first, check if booking is already expired
- if time.time() > new_booking['end']:
- return
- # check if booking already in db
- booking_list = self.getBookingList()
- if new_booking['id'] in booking_list:
- return
- new_booking['status'] = 0 # add status code
- booking_list.append(new_booking['id'])
- name = "booking_" + str(new_booking['id'])
- self.sensor_service.set_value(
- name=name,
- value=json.dumps(new_booking),
- local=False
- )
- self.updateBookingList(booking_list)
-
- def convertTimes(self, booking):
- """
- this method will take the time reported by Pharos in the
- format yyyy-mm-ddThh:mm:ssZ
- and convert it into seconds since the epoch,
- for easier management
- """
- booking['start'] = self.pharosToEpoch(booking['start'])
- booking['end'] = self.pharosToEpoch(booking['end'])
-
- def pharosToEpoch(self, timeStr):
- """
- Converts the dates from the dashboard to epoch time.
- """
- time_struct = time.strptime(timeStr, '%Y-%m-%dT%H:%M:%SZ')
- epoch_time = calendar.timegm(time_struct)
- return epoch_time
-
- def checkBookings(self):
- """
- This method checks all the bookings in our database to see if any
- action is required.
- """
-
- # get all active bookings from database into a usable form
- booking_list = self.getBookingList()
- for booking_id in booking_list:
- booking = self.getBooking(booking_id)
- # first, check if booking is over
- if time.time() > booking['end']:
- self.log.info("ending the booking with id %i", booking_id)
- self.endBooking(booking)
- # Then check if booking has begun and the host is still idle
- elif time.time() > booking['start'] and booking['status'] < 1:
- self.log.info("starting the booking with id %i", booking['id'])
- self.startBooking(booking)
-
- def startBooking(self, booking):
- """
- Starts the scheduled booking on the requested host with
- the correct config file.
- The provisioning process gets spun up in a subproccess,
- so the api listener is not interupted.
- """
- host = self.getServer(pharos_id=booking['resource_id'])['hostname']
- self.log.info("Detected a new booking started for host %s", host)
- self.setBookingStatus(booking['id'], 1) # mark booking started
- # dispatch trigger into system
- trigger = "pharoslaas.start_deployment_trigger"
- payload = {"host": host, "installer": booking['installer_name']}
- payload['scenario'] = booking['scenario_name']
- payload['booking'] = booking['id']
- self.sensor_service.dispatch(trigger=trigger, payload=payload)
-
- def endBooking(self, booking):
- """
- Resets a host once its booking has ended.
- """
- host = self.getServer(pharos_id=booking['resource_id'])['hostname']
- self.log.info('Lease expired. Resetting host %s', host)
- self.setBookingStatus(booking['id'], 3)
- self.removeBooking(booking['id'])
- # dispatch trigger to clean
- host = self.getServer(pharos_id=booking['resource_id'])['hostname']
- trigger = "pharoslaas.end_deployment_trigger"
- payload = {"host": host, "booking": booking['id']}
- if 'vpn_key' in booking.keys():
- payload['key'] = booking['vpn_key']
- else:
- payload['key'] = ''
- self.sensor_service.dispatch(trigger=trigger, payload=payload)
-
- def getServer(self, fog_name=None, hostname=None, pharos_id=None):
- key = ""
- value = ""
- if fog_name is not None:
- key = "fog_name"
- value = fog_name
- elif hostname is not None:
- key = "hostname"
- value = hostname
- elif pharos_id is not None:
- key = "pharos_id"
- value = pharos_id
- for server in self.servers:
- if server[key] == value:
- return server
-
- def getBooking(self, booking_id):
- name = "booking_" + str(booking_id)
- return json.loads(
- self.sensor_service.get_value(
- name=name,
- local=False
- )
- )
-
- def setBookingStatus(self, booking_id, status):
- booking = self.getBooking(booking_id)
- booking['status'] = status
- name = "booking_" + str(booking_id)
- self.sensor_service.set_value(
- name=name,
- value=json.dumps(booking),
- local=False
- )
-
- def removeBooking(self, booking_id):
- blist = self.getBookingList()
- blist.remove(booking_id)
- self.updateBookingList(blist)
- name = "booking_" + str(booking_id)
- self.sensor_service.delete_value(name=name, local=False)
-
- # Sensor Interface Methods #
-
- def setup(self):
- """
- This method is called by stackstorm once to setup this polling sensor.
- Basically __init__, assigns instance variables, etc
- """
- server_names = json.loads(
- self.sensor_service.get_value('hosts', local=False)
- )
- self.servers = []
- for server in server_names:
- self.servers.append(
- json.loads(
- self.sensor_service.get_value(server, local=False)
- )
- )
- self.resource_ids = []
- for host in self.servers:
- self.resource_ids.append(host['pharos_id'])
- self.log = self.sensor_service.get_logger(name=self.__class__.__name__)
- self.dashboard = self.sensor_service.get_value(
- name='dashboard_url',
- local=False
- )
- self.log.info("connecting to dashboard at %s", self.dashboard)
- # get token here for when dashboard supports it
-
- def poll(self):
- """
- this method will continuously poll the pharos dashboard.
- If a booking is found on our server,
- we will start a deployment in the background with the
- proper config file for the requested
- installer and scenario.
- """
- self.log.debug("%s", "Beginning polling of dashboard")
- try:
- url = self.dashboard+"/api/bookings/"
- bookings = requests.get(url).json()
- for booking in bookings:
- if booking['resource_id'] in self.resource_ids:
- self.convertTimes(booking)
- self.AddBooking(booking)
- self.checkBookings()
- except Exception:
- self.log.exception('%s', "failed to connect to dashboard")
-
- def cleanup(self):
- # called when st2 goes down
- pass
-
- def add_trigger(self, trigger):
- # called when trigger is created
- pass
-
- def update_trigger(self, trigger):
- # called when trigger is updated
- pass
-
- def remove_trigger(self, trigger):
- # called when trigger is deleted
- pass